// Function Cart =========================================================================
var mainurl = "http://www.satangsoft.com/fastweb2/";
//var mainurl = "";
var hst = window.location.hostname;
	function showShop(Vr){
		var ob = "shopshow";
		var ob2 = "shopzone";
		document.getElementById(ob2).innerHTML = '<table width="800" height="550" border="0" cellpadding="0" cellspacing="0"><tr><td height="23"><div align="center"><table width="100%" height="23" border="0" cellpadding="0" cellspacing="0"><tr><td align="left"><a href="http://www.satangsoft.com/" target="_blank"><img src="'+mainurl+'img_shop/title.gif" border="0" alt="Shopping Cart System by Satangsoft" align="absmiddle" /></a></td><td width="74"><a href="javascript:onclick=hideShop();"><img src="'+mainurl+'img_shop/close.gif" border="0" alt="ปิดหน้านี้" align="absmiddle" /></a></td></tr></table></div></td></tr><tr><td height="1" bgcolor="#999999"></td></tr><tr height="526"><td><iframe id="sShop" name="sShop" frameborder="0" marginheight="0" marginwidth="0" style="border:0; height:526px; width:100%" scrolling="no" src="'+mainurl+'shop.php?'+Vr+'"></iframe></td></tr></table>';
		document.body.style.overflow = "hidden";
		var winwidth = 0, winheight = 0;
		  if( typeof( window.innerWidth ) == 'number' ) {
			//Non-IE
			winwidth = window.innerWidth;
			winheight = window.innerHeight;
			var docheight = window.innerHeight;
			//alert('Non-IE');
		  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
			//IE 6+ in 'standards compliant mode'
			winwidth = document.documentElement.clientWidth;
			winheight = document.documentElement.clientHeight;
			var docheight = document.body.clientHeight;
			//alert('IE 6+ in');
		  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
			//IE 4 compatible
			winwidth = document.body.clientWidth;
			winheight = document.body.clientHeight;
			var docheight = document.body.clientHeight;
			//alert('IE 4 compatible');
		  }

		winwidth =  parseInt(winwidth);
		winheight =  parseInt(winheight);
		docheight =  parseInt(docheight);
		
		if(docheight<550){
			docheight = winheight;
		}
				
		document.all[ob].style.visibility = "visible";
		document.all[ob].style.left = "0px";
		document.all[ob].style.top = "0px";
		document.all[ob].style.width = winwidth + "px";
		document.all[ob].style.height = docheight + "px";
		

		var top = (winheight-550)/2;
		var left = (winwidth-800)/2;
		fadetoview(ob2);  //FadeIn
		document.all[ob2].style.left = left+"px";
		document.all[ob2].style.top = top+"px";
		document.all[ob2].style.width = "800px";
		document.all[ob2].style.height = "550px";
	}
		
	function hideShop(){
		document.body.style.overflow = "";
		document.all['shopshow'].style.visibility = 'hidden';
		document.getElementById('shopzone').innerHTML = '';
		document.all['shopzone'].style.visibility = 'hidden';
	}
	
	function addCart(C,N,P,ID){
		window.navigate('#');
		showShop('id='+ID+'&c='+C+'&n='+N+'&p='+P+'&h='+hst)
	}
	
	function showCart(ID){
		window.navigate('#');
		showShop('id='+ID+'&h='+hst)
	}
	
	function showRegister(){
		window.navigate('#');
		showShop('act=register')
	}
	
	function showConfirm(ID){
		window.navigate('#');
		showShop('act=confirm&id='+ID)
	}
	
	function showManager(){
		window.navigate('#');
		showShop('act=register&mode=manager')
	}
	
	function cancelCart(delUrl) {
	  if (confirm("คุณต้องการยกเลิกรายการทั้งหมด\n(ถ้าคุณเพิ่งเคยสั่งซื้อครั้งแรก ระบบจะลบข้อมูลของคุณไปด้วย คุณอาจต้องกรอกรายการสมัครใหม่)\nคุณต้องการเดี๋ยวนี้หรือไม่ ?")) {
		window.open(delUrl,'xData','');
	  }
	}
	
	function delItem(delUrl) {
	  if (confirm("คุณต้องการลบรายการสั่งซื้อนี้ เดี๋ยวนี้หรือไม่ ?")) {
		window.open(delUrl,'xData','');
	  }
	}
	
	function goUrl(Url) {
		window.open(Url,'xData','');
	}
	
	document.write('<div id="shopshow" style="position:absolute; overflow:hidden; filter :alpha(opacity=50); -moz-opacity: .50; z-index:10; background-color:#333333"; visibility:hidden"></div>');
	document.write('<div id="shopzone" style="position:absolute; overflow:hidden; filter:progid:DXImageTransform.Microsoft.Fade(duration=1); z-index:11; visibility:hidden;"></div>');