function ViewLargeImage(ImgName,ImgWidth,ImgHeight, URLHead){
	var popupWin = window.open(URLHead+'productviewer.htm?'+ImgName,'ViewLargeImage','toolbar=no,directories=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width='+(ImgWidth+45)+',height='+(ImgHeight+45)+',left=15,top=15,screenX=15,screenY=15');
	}

function GetXmlHttpObject(){
	if(window.XMLHttpRequest){
  	// code for IE7+, Firefox, Chrome, Opera, Safari
  		return new XMLHttpRequest();
  		}
	else if (window.ActiveXObject){
	// code for IE6, IE5
  		return new ActiveXObject("Microsoft.XMLHTTP");
  		}
	else{
		alert ("Your browser does not support AJAX!");
		return null;
		}
	}

function UnlockCus(UnlockCode){
	xmlhttp=GetXmlHttpObject();
	if(xmlhttp != null){
		rand = Math.random();
		var AllVariable='UnlockCode='+UnlockCode;
		xmlhttp.open('POST', 'account/login.inc.php?Rand='+rand, false);
		xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlhttp.onreadystatechange = function(){
			if(xmlhttp.readyState==4 && xmlhttp.status==200){
				alert(xmlhttp.responseText);
				}
			}
		xmlhttp.send(AllVariable);
		}
	}

function MoreInfo(BaseUrl, RecNo){
	var InfoWin = window.open(BaseUrl+'more-info.php?RID='+RecNo,'MoreInfo','toolbar=no,directories=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=700,height=500,left=15,top=15,screenX=15,screenY=15');
	}

function SiginPage(SSLpageURL, MyAccount, ShoppingPage, MakeCookie){
	var SiginPage = window.open(SSLpageURL+'account/signin.php?MyAccount='+MyAccount+'&ShoppingPage='+ShoppingPage+'&MakeCookie='+MakeCookie,'SignIn','directories=no,scrollbars=yes,location=no,status=no,menubar=no,resizable=yes,copyhistory=no,width=444,height=450,left=150,top=100,screenX=15,screenY=30');
	}

function NewCustomerPage(SSLpageURL, MyAccount, ShoppingPage, MakeCookie){
	window.open(SSLpageURL+'account/signin.php?NewCustomer=1&MyAccount='+MyAccount+'&ShoppingPage='+ShoppingPage+'&MakeCookie='+MakeCookie,'Register','directories=no,scrollbars=yes,location=no,status=no,menubar=no,resizable=yes,copyhistory=no,width=444,height=450,left=150,top=100,screenX=15,screenY=30');
	}

function Click2Check(ClickName){
	if(!document.getElementById(ClickName).checked){
		document.getElementById(ClickName).checked=true;
		}
	else{
		document.getElementById(ClickName).checked=false;
		}
	}

function ShowMultiAddress(){
	xmlhttp=GetXmlHttpObject();
	if(xmlhttp != null){
		var x=0;
		rand = Math.random();
		var AllVariable='ShowMultiAddress=1';
		xmlhttp.open('POST', 'Plus2Cart.php?Rand='+rand, true);
		xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlhttp.onreadystatechange = function(){
				if(xmlhttp.readyState==4 && xmlhttp.status==200){
				opener.parent.document.getElementById('MultiShippingTxt').innerHTML=xmlhttp.responseText;
				if(opener.parent.document.getElementById('AllItemSet').value==1){
					opener.parent.document.getElementById('ClickContinue').innerHTML='<input type="Image" style="border:0px;" src="../images/continue.gif" width="88" height="20" alt="continue" onclick="javascript:alert(\'Not all products had been set shipping address.\'); return false;">';
					}
				else{
					opener.parent.document.getElementById('ClickContinue').innerHTML='<input type="Image" style="border:0px;" src="../images/continue.gif" width="88" height="20" alt="continue">';
					}
				self.close();
				}
			}
		xmlhttp.send(AllVariable);
		}
	}

function ManageItem(PID, ListType, ListValue, CustID, PageName){	
	document.getElementById('ItemStatus-'+PID).height=14;
	var MainPageLink = document.getElementById('MyListLink');
	var AllWishListItemTxt = document.getElementById('AllWishListItem');
	if(PageName == 'orderitem.php'){
		MainPageLink = opener.parent.document.getElementById('MyListLink');
		AllWishListItemTxt = opener.parent.document.getElementById('AllWishListItem');
		}

	if(!ListValue){
		var Text1 = '<a href="javascript:ManageItem('+PID+', \'WISH\', 1, '+CustID+', \''+PageName+'\');" style="text-decoration:underline; color:#7d7d7d; font-size:10px;" title="Add To My Wish List">Add To My Wish List</a>';
		document.getElementById('ItemStatus-'+PID).src = 'images/clrpix.gif';
		document.getElementById('Manage_Status'+PID).innerHTML = Text1;
		if(PageName == 'orderitem.php'){
			opener.parent.document.getElementById('ItemStatus-'+PID).src = 'images/clrpix.gif';
			opener.parent.document.getElementById('Manage_Status'+PID).innerHTML = Text1;
			}
		AllWishListItemTxt.innerHTML = parseInt(AllWishListItemTxt.innerHTML)-1;
		if(parseInt(AllWishListItemTxt.innerHTML)-1 < 0){
			MainPageLink.onclick = function(){ alert('You have no item in Wish List'); return false; }
			}
		}
	else if(ListType == 'WISH'){
		var Text2 = '<a href="javascript:ManageItem('+PID+', \'WISH\', 0, '+CustID+', \''+PageName+'\');" style="text-decoration:underline; color:#7d7d7d; font-size:10px;" title="Remove From My Wish List">Remove From My Wish List</a>';
		document.getElementById('ItemStatus-'+PID).src = 'images/mywishlist.gif';
		document.getElementById('Manage_Status'+PID).innerHTML= Text2;
		if(PageName == 'orderitem.php'){
			opener.parent.document.getElementById('ItemStatus-'+PID).src = 'images/mywishlist.gif';
			opener.parent.document.getElementById('Manage_Status'+PID).innerHTML = Text2;
			}
		AllWishListItemTxt.innerHTML = parseInt(AllWishListItemTxt.innerHTML)+1;
		MainPageLink.onclick = "";
		}
	else if(ListType == 'RANK'){
		ItemStatusImg.src = 'images/stars-'+ListValue+'.gif';
		}
	
	xmlhttp=GetXmlHttpObject();
	if(xmlhttp != null){
		rand = Math.random();
		xmlhttp.open('POST', 'account/manageitem.php?Rand='+rand, false);
		xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlhttp.send('PN='+PID+'&ListType='+ListType+'&ListValue='+ListValue+'&CustID='+CustID);
		}
	}
