/*-------------------------------------------------
jcIR written by Jason Chandler
-------------------------------------------------*/
jQuery.fn.jcIR = function(options) {
	//default settings
	var options = jQuery.extend( {
		image_dir: '',//directory when image is located this would be a sub directory inside "images"
		image_ext: '.jpg',//replacement image file extension
		elem_width: '',//width of element being replaced
		elem_height: ''//height of element being replaced
	},options);
	return this.each(function(){
		var dir = '';//set empty variable
		if (options.image_dir) {//if image_dir is set when calling jcIR
			$(dir = 'images/' + options.image_dir + '/');	
		} else {//else set default
			$(dir = 'images/')
		}
		var image_name = jQuery(this).attr('id');//gets the id of the item and uses that as the name of replacement image
		var alt_text = jQuery(this).text();
		jQuery(this).addClass('replaced')
			.css('width', options.elem_width + 'px')
			.css('height', options.elem_height + 'px')
			.css('background-image','url(' + dir + image_name + options.image_ext + ')');
	if (jQuery.fn.pngFix) $(document).pngFix();
	});
}
