/*
 * Resource highligher
 * powered by jQuery (http://www.jquery.com)
 * 
 * written by Petrenko Yuri (http://www.3suns.com.ua/)
 * 
 * for more info visit http://www.3suns.com.ua/
 *
 */


(function($) {  
	$.fn.resourceHighlight = function(){	
	/* CONFIG */
//		var resource_types = new Array("doc", "xls", "zip", "ppt");
		var resource_types = ["doc", "xls", "zip", "ppt"];
		
		return this.each(function () {
			var href = $(this).attr('href');
			for (var k in resource_types) {
				res_type = resource_types[k];
			  var regExp = new RegExp("."+res_type, "gi")
			  if (href.match(regExp)) {
				href = RegExp.$1;
				$(this).addClass('docs').css({
					'backgroundImage':'url(res/images/filetypes/idoc_'+res_type+'.gif)'
				});
//				window.status += " " + $(this).css('backgroundImage'); // debug purposes
			  }
			}
		}); 	
	/* END CONFIG */
	/* CSS class "docs" definition
			a.docs{
				background-position:0px 0px;
				background-repeat:no-repeat;
				padding-left:25px;
			}	
	*/
	};
})(jQuery)

// starting the script on page load
$(document).ready(function(){
	$('a').resourceHighlight();
});
