jQuery(document).ready(function() {
	hashCheck();
});

function hashCheck()
{
	var strURL = window.location.hash;
	var strURL_array = strURL.split("/");
	var strLocation;
	var strPage;
	if(strURL_array.length==2)
	{
		strLocation = strURL_array[0].replace("#", "");
		if(strLocation.toLowerCase() == 'detail')
		{
			strPage = strURL_array[1].replace( /%20/g, " " );
			thumbs(strPage);
		}		
	}
}


function thumbs(sku) {
	var jqajax = jQuery.ajax({
		url: '/pages/gallery_thumb_rpc.php',
		data: 'sku='+escape(sku),
		dataType: 'html',
		success: function(resp)
		{
			jQuery('#gallery_detail').html(resp);
		}});
}

//Event.observe(window, 'load', init, false);
/* jQueryification
function hashCheck()
{
	//alert(window.location.hash);
	var strURL = window.location.hash;
	var strURL_array=strURL.split("/");
	var strLocation;
	var strPage;
	if (strURL_array.length==2) {
		strLocation = strURL_array[0];
		strLocation = strLocation.replace("#", "");
		strPage = strURL_array[1];
		
		
		var strReplaceAll = strPage;
		var intIndexOfMatch = strReplaceAll.indexOf( "%20" );

		// Loop over the string value replacing out each matching
		// substring.
		while (intIndexOfMatch != -1){
			// Relace out the current instance.
			strReplaceAll = strReplaceAll.replace( "%20", " " )

			// Get the index of any next matching substring.
			intIndexOfMatch = strReplaceAll.indexOf( "%20" );
		}
		
		
		if(strLocation == 'detail')
		{
			thumbs(strReplaceAll);
		}
		
	}
}
*/
/*
 * jQueryfication not redoing this due to document ready
function init(){
	hashCheck();
}
*/
/* During jQueryfication didn't see implementation
 * Instance of actual usage is in commented out code
function fetch(target,page){
	var url = '/pages/gallery_rpc.php';
	var pars = 'task='+target+'&page='+page;
	var myAjax = new Ajax.Updater(target, url, { method: 'get',	parameters: pars });
}
*/

/* Commented out Prototype version
function thumbs(sku){
	var target = 'gallery_detail';
	var url = '/pages/gallery_thumb_rpc.php';
	var pars = 'sku='+escape(sku);
	var myAjax = new Ajax.Updater(target, url, { method: 'get',	parameters: pars, evalScripts: true });
}
*/

