var imageDivHeight = $("#ajax360PreloaderInitImage").height(); 

function ajax360PreloaderRun(iProductID){
/* Get Div Height */
$("#ajax360PreloaderFlash").hide();
ajax360PreloaderLoader("showLoader");
$("#ajax360PreloaderFlash").load("../jquery/shopping/ajax360Preloader.cfm", {iProductID:iProductID},
function(){setTimeout(function () {ajax360PreloaderLoad360(imageDivHeight);ajax360PreloaderLoader("hideLoader");}, 3000);
});
}
function ajax360PreloaderLoad360(imageDivHeight){
	// imageDivHeight = $("#ajax360PreloaderInitImage").height();
	$("#ajax360PreloaderFlash").css('height',300);
	$("#ajax360PreloaderInitImage").fadeOut(function(){
		$("#ajax360PreloaderFlash").fadeIn('slow');
		ajax360PreloaderLoadButton("switchToImage");
	});
}
function ajax360PreloaderLoadInitImage(imageDivHeight){
	$("#ajax360PreloaderInitImage").css('height',imageDivHeight);
	$("#ajax360PreloaderFlash").fadeOut(function(){
		$("#ajax360PreloaderInitImage").fadeIn('slow');
		ajax360PreloaderLoadButton("switchTo360");
	});
}
function ajax360PreloaderLoader(Loader){
	if (typeof(Loader) != 'undefined' && Loader == 'showLoader'){
		$("#ajax360PreloaderChanger").html("<div id='ajax360PreloaderLoader' style='display: none;'></div>");
		$("#ajax360PreloaderLoader").fadeIn();
	}else if (typeof(Loader) != 'undefined' && Loader == 'hideLoader'){$("#ajax360PreloaderLoader").fadeOut(function(){$("#ajax360PreloaderChanger").html();});
	}
}
function ajax360PreloaderLoadButton(buttonType){
	if (typeof(buttonType) != 'undefined' && buttonType == 'switchTo360'){
		$("#ajax360PreloaderChanger").html("<input type='image' src='/img/core3/start-rotation.gif' align='middle' value='Start Rotation' style='vertical-align: middle; border: 0; padding: 0; background: transparent;' alt='Start Rotation' onclick='ajax360PreloaderLoad360(imageDivHeight)'/>").fadeIn();
	}else if (typeof(buttonType) != 'undefined' && buttonType == 'switchToImage'){
		$("#ajax360PreloaderChanger").html("<input type='image' src='/img/core3/stop-rotation.gif' align='middle' value='Stop Rotation' style='vertical-align: middle; border: 0; padding: 0; background: transparent;' alt='Stop Rotation' onclick='ajax360PreloaderLoadInitImage(imageDivHeight)'/>").fadeIn();
	}
}
