//Define Image Preloader Function for jQuery Library
$.preloadImages = function()
{
	//Lopp through all the Parameters passed into function
	for(var i = 0; i<arguments.length; i++)
	{
		//Create a new IMG tag and assign/load an Image into it.
		$("<img>").attr("src", arguments[i]);
	}
}


//Defin Document Ready (OnLoad) Function
$(document).ready(function(){
	 
	//PreLoad Images
	$.preloadImages("../images/colorResult.png");

	//Check if ColorTable Container DIV exist on Page
	if(typeof $("#divColorTable").attr("class") != "undefined")
	{	
		//Yes, Now Populate ColorTable Container DIV using AJAX
		$.ajax({
					 
			url: "../designerpaints/getcolortable_static.html",
			cache: true,
			success: function(ajaxResponse){
				
				$("#divColorTable").html(ajaxResponse);
				
			}
			
		});
		
	}		//if(typeof $("#divColorTable").attr("class") != "undefined")
	
	//Construct Background Color Changeable Image Section
	$('#bgColorChangeBox').add_layer("url('../images/colorResult.png') no-repeat bottom");	
	
	//Add a Default Color as Background Color to Color Changeable Image Section
	$('#bgColorChangeBox').css("background-color", "#F49A28");
	
	
	//Find the Finish Listing DIV (which will be on colorfinish.php page)
	$("div.divFinish").each(function (i){

		//Attach MouseOver Event with the selected DIV tag in context
		$("div.divFinish").eq(i).mouseover(function(event){

			$("div.divFinish").eq(i).css("background-color", "#DBEBF2");

			//Prevent default behavoiur of Event to fire
			event.preventDefault();
			
		});

		//Attach MouseOut Event with the selected DIV tag in context
		$("div.divFinish").eq(i).mouseout(function(event){

			$("div.divFinish").eq(i).css("background-color", "");

			//Prevent default behavoiur of Event to fire
			event.preventDefault();
			
		});

	});

});		//$(document).ready(function(){

