function CartManager_frmSubmit(frm)
{														
	if(isInt(trim(frm.CartManager_ItemNumber.value),false))
		{
			frm.submit();
		} else {
		  alert("An integer is needed!");
		  frm.CartManager_ItemNumber.focus();
		  return;
		}
}
function CartManager_frmSubmit2(frm)
{							
  var length = frm.CartManager_ItemNumber.length;   
  
  for(i=0;i<length;i++)	
  {    
		if(!isInt(trim(frm.CartManager_ItemNumber[i].value),false))
		{
			alert("An integer is needed!");
		  frm.CartManager_ItemNumber[i].focus();
		  return;  			
		} 
  }
  
	frm.submit();    
}


function CartManager_update(compId,compName,productId,quantity)
{
	
var date = new Date();
   strUrl = ""; 	
   if (compId!= null && compId.length > 0) 
	strUrl = strUrl + '?CompID=' + compId; 
   if (compName!= null && compName.length > 0) 
	strUrl = strUrl + '&CompName=' + compName; 
   if (itemId!= null && itemId.length > 0) 
	strUrl = strUrl + '&CartManager_ProductID=' + productId; 
   if (quantity!= null && quantity.length > 0) 
	strUrl = strUrl + '&CartManager_ProductNumber=' + quantity; 	
   if (mode!= null && mode.length > 0) 
	strUrl = strUrl + '&CartManager_action=update'; 
	strUrl = strUrl + "&time=" + Date.getTime();
   eval("self.location='" + strUrl + "'");
}

function CartManager_check(compId,compName,itemId,mode)
 {
  
   var date = new Date();
   strUrl = ""; 	
   if (compId!= null && compId.length > 0) 
	strUrl = strUrl + '?CompID=' + compId; 
   if (compName!= null && compName.length > 0) 
	strUrl = strUrl + '&CompName=' + compName; 
   if (itemId!= null && itemId.length > 0) 
	strUrl = strUrl + '&CartManager_ProductID=' + itemId; 
   if (mode!= null && mode.length > 0) 
	strUrl = strUrl + '&CartManager_action=' + mode; 
	strUrl = strUrl + "&time=" + date.getTime();
   eval("self.location='" + strUrl + "'");
}				
 	
function CartManager_putfavorite(page, id)
{
  var date = new Date();
	if(page.indexOf("?") > -1)							
		document.location = page + "&Favorite_action=add&Favorite_ProductID=" + id + "&time=" + date.getTime();				
	else
		document.location = page + "?Favorite_action=add&Favorite_ProductID=" + id + "&time=" + date.getTime();				
} 

function CartManager_link(page)
{
  var date = new Date();
	if(page.indexOf("?") > -1)							
		document.location = page + "&time="+date.getTime();				
	else
		document.location = page + "?time="+date.getTime();											
}			


function CartManager_openNewWindow(url, type, str)
{			
	newWindow = window.open(url, type, str);		
}

function CartManager_OutProductRegister(form)
{	
	if (trim(form.RegUserEmail.value) == "")
	{
		alert("Please input email address！");
		form.RegUserEmail.focus();
		return false;
	}
	
	//校验类似于abc@sitechasia.com的邮件
	pattern1="^[a-zA-Z0-9_.\-]+[@]{1}[a-zA-Z0-9_\-]+[.]{1,5}[a-zA-Z0-9_\-]+";
	//校验类似于abc@myce.net.cn的邮件
	pattern2="^[a-zA-Z0-9_.\-]+[@]{1}[a-zA-Z0-9_\-]+[.]{1,5}[a-zA-Z0-9_\-]+[.]{1,5}[a-zA-Z0-9_\-]";	
	if(!(form.RegUserEmail.value.match(pattern1) || form.RegUserEmail.value.match(pattern2) ))
	{
		alert("Please enter the valid email address！");
		form.RegUserEmail.focus();
		return false;
	}
	
	//form.submit();
	window.close();
}

function CartManager_putfavorite(ProductID)
{
	PutFavoriteForm.Favorite_ProductID.value = ProductID;
	PutFavoriteForm.submit();
  //var date = new Date();					
		//document.location = "Favorite.html?Favorite_ProductID="+ProductID+"&Favorite_action=add&time=" + date.getTime();				
} 
