	var browser = navigator.appName;
	var staticVar = 0;
	var startLeft = 0;
	var startTop = 0;
	var imgDivContainerLeft = 0;
	var lightboxWidth = 264;
	//var overlayWidth = 3*<?=$columnSize?>;
	var overlayWidth = 3*90;
	//var overlayHeight = <?=$rows==4?$rows*$columnSize:360?>;
	var overlayHeight = 360;
	
	function enlarge_OnMouseOver(elmID,start,end){
		//alert('test');
		if(elmID!=staticVar){
			enlarge(elmID,start,end);
			staticVar = elmID;
		}
	}
	
	function enlarge(elmID,start,end){
		if(document.getElementById("div_"+elmID))
		{
			var elm = document.getElementById("div_"+elmID);
			var elmImg = document.getElementById("img_"+elmID);
			start++;
			elm.style.width = start+"px";
			elm.style.height = start+"px";
			if(elmImg.width>elmImg.height)
					elmImg.width = elmImg.width+1;
				else
					elmImg.height = elmImg.height+1;
			if(start<=end)
				setTimeout("enlarge('"+elmID+"','"+start+"','"+end+"')",20);
		}
	}
	
	function small_OnMouseOut(elmID,start,end){
		if(document.getElementById('div_Details'))
		document.getElementById('div_Details').innerHTML='&nbsp;';
		small(elmID,start,end);
		staticVar = 0;
	}
	
	function small(elmID,start,end){
		if(document.getElementById("div_"+elmID))
		{
			var elm = document.getElementById("div_"+elmID);
			var elmImg = document.getElementById("img_"+elmID);
			start--;
			elm.style.width = start+"px";
			elm.style.height = start+"px";
			if(elmImg.width>elmImg.height)
					elmImg.width = elmImg.width-1;
				else
					elmImg.height = elmImg.height-1;
			if(start>=end)
				setTimeout("small('"+elmID+"','"+start+"','"+end+"')",20);
		}
	}
	function ShowCategoryProducts(cid)
	{
		//alert(cid);
		FillDivRequest('../front/pg_show_products.aspx?cid='+cid,'pg_wrapper','')
	}
	
	function FillDivRequest(url,hiddenElmBgImage,selectElmBgImage)
	{
		//alert(url);
		var tempdiv = document.getElementById(hiddenElmBgImage);
		var overlayDiv = document.getElementById("pg_overlayDiv");
		overlayDiv.style.display="block";
		overlayDiv.style.visibility="visible";
		overlayDiv.style.left = tempdiv.style.left;
		overlayDiv.style.top = tempdiv.style.top;
		overlayDiv.style.width = tempdiv.style.width;
		overlayDiv.style.height = tempdiv.style.height;
		tempdiv.innerHTML = "";
	var XMLhttpObj = false;
    if (typeof XMLHttpRequest != 'undefined'){
        XMLhttpObj = new XMLHttpRequest();
    } else if (window.ActiveXObject){
        	try{
            	XMLhttpObj = new ActiveXObject('Msxml2.XMLHTTP');
        	} catch(e) {
            		try{
                		XMLhttpObj = new ActiveXObject('Microsoft.XMLHTTP');
            		} catch(e) {}
        	}
    }
    if (!XMLhttpObj) return;
	
	XMLhttpObj.onreadystatechange = function() {
    	if (XMLhttpObj.readyState == 4) { // when request is complete
    		FillDiv(XMLhttpObj.responseText,hiddenElmBgImage,selectElmBgImage);
        }
    };
    url = url+"&sid="+Math.random();
    XMLhttpObj.open('GET', url, true);
    XMLhttpObj.send(null);
	}
	
	function FillDiv(optionData,hElmBgImage,sElmBgImage) {
	//alert(optionData);
	var elmBGImage = document.getElementById(hElmBgImage);
	elmBGImage.innerHTML = "";
	elmBGImage.innerHTML = optionData;
	initLightbox();
	var overlayDiv = document.getElementById("pg_overlayDiv");
	overlayDiv.style.display="none";
	overlayDiv.style.visibility="hidden";
   }
   
   
   var vTimeoutInstance;
	function startScrolling(elmId,mode){
		var elm = document.getElementById(elmId);
		var elmPos = parseInt(elm.style.top);
		if(mode == "Up"){
			if(elmPos >=eval(-elm.offsetHeight+parseInt(elm.parentNode.style.height))){
				elmPos -= 2;
				elm.style.top = elmPos + "px";
				vTimeoutInstance = setTimeout("startScrolling('"+elmId+"','"+mode+"')",20);
			}
		}
		else
		{
				if(elmPos < 0){
					elmPos += 2;
					elm.style.top = elmPos + "px";
					vTimeoutInstance = setTimeout("startScrolling('"+elmId+"','"+mode+"')",20);
				}
		}
	}
	function stopScrolling(elmId){
		clearTimeout(vTimeoutInstance);
	}
	
	function Gallery_Shop_ChangeMainImage(imgSrc,pid,imgPopupSrc){
		//var linkStr ="style=cursor:pointer;cursor:hand; onclick=window.open('../LSAdmin/displayImage.aspx?path="+imgPopupSrc+"','Help','600','500','no','yes',50,50);";
		var linkStr ="style=cursor:pointer;cursor:hand; onclick=window.open('../LSAdmin/displayImage.aspx?path="+imgPopupSrc+"','Help','height=500,width=600,scrollbars=yes,resizable=no');";
		document.getElementById("div_LargeProdImage_"+pid).innerHTML = "<img "+linkStr+" src='"+imgSrc+"' />";
		document.getElementById("div_LargeProdImage_"+pid).style.opacity = 0.0;
		Gallery_Shop_CustomfadeIn(0,5,0,imgSrc,"div_LargeProdImage_"+pid);
	}
	function Gallery_Shop_CustomfadeIn(aa,cc,tt,imgSrc,imgId){
		var elmImg = document.getElementById(imgId);
		tt+=cc
		elmImg.style.opacity = eval(parseFloat(elmImg.style.opacity) + 0.02);
		aa = parseInt(aa)+2;
		elmImg.style.filter = "alpha(opacity="+aa+")";
		elmImg.style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity="+aa+")";
		if(aa < 100){
			setTimeout("Gallery_Shop_CustomfadeIn('"+aa+"','"+cc+"','"+tt+"','"+imgSrc+"','"+imgId+"')",0);
		}
	}
	
	function addToShopCart(pid)
	{
		location.href="shop.aspx?cart=add&pid="+pid+"&qty_"+pid+"="+document.getElementById("qty_"+pid).value;
	}
	function showHideProductDetail(pid)
	{
		if(document.getElementById("div_productDetail_"+pid).style.display=="none")
		{
			document.getElementById("div_productDetail_"+pid).style.display="block";
			document.getElementById("span_link_"+pid).innerHTML="hide details"
		}
		else
		{
			document.getElementById("div_productDetail_"+pid).style.display="none";
			document.getElementById("span_link_"+pid).innerHTML="more details"
		}
	}
