
function check_mes(){
if(document.mes.FID_2430.value==""){
    alert("Content can not be empty!");
    document.mes.FID_2430.focus();
    return false;
  }
   if(document.mes.FID_2427.value==""){
    alert("Nickname can not be empty!");
    document.mes.FID_2427.focus();
    return false;
  }
  if(document.mes.FID_2428.value==""){
    alert("Telephone Number can not be empty!");
    document.mes.FID_2428.focus();
    return false;
  }
  if(document.mes.FID_2429.value==""){
    alert("Email can not be empty!");
    document.mes.FID_2429.focus();
    return false;
  }
 
 
  return true;
}

function shop_add_cart(sj,CID,IID)//ajax添加到购物车
{
	//alert("ss");

	//var num;
	//num=document.getElementById('num').value;
	var num = document.getElementById('num') ? document.getElementById('num').value : 1;
	var url="";
	if (!Utils.isNumber(num) || num==0)
	{
		alert("Please enter the number of purchase");
	}
	//check="<?=$hckeck?>";	
	else
	{
	//Ajax.call('user.php?act=cart', 'IID=' + IID+'&CID='+CID+"&sj="+sj, cart_callback , 'GET', 'TEXT', true, true );
	//alert( 'IID=' + IID+'&CID='+CID+"&sjid="+sj);
	//alert(document.getElementById('num').value);
	
		if (sj==99)
		{
			Ajax.call(SITE_URL+'/shop.php?act=shop_cart', 'IID=' + IID+'&CID='+CID+"&sjid="+sj+"&num="+num, shop_add_wishResponse, 'POST', 'JSON');
			//url=SITE_URL+"/shop.php?act=shop_cart&"+'IID=' + IID+'&CID='+CID+"&sjid="+sj+"&num="+num;
		}
		else
		{
			Ajax.call(SITE_URL+'/shop.php?act=shop_cart', 'IID=' + IID+'&CID='+CID+"&sjid="+sj+"&num="+num, shop_add_cartResponse, 'POST', 'JSON');
			//url=SITE_URL+"/shop.php?act=shop_cart&"+'IID=' + IID+'&CID='+CID+"&sjid="+sj+"&num="+num;
		}
		//window.open(url,'cart','width='+screen.Width+',height='+screen.Height+',toolbar=yes,scrollbars=yes,resizable=yes,menubar=yes');
	}
}

function shop_cart_del(sj,CID,IID)//ajax添加到购物车删除某件商品
{
	//alert("ss");
	//Ajax.call('user.php?act=cart', 'IID=' + IID+'&CID='+CID+"&sj="+sj, cart_callback , 'GET', 'TEXT', true, true );
	Ajax.call(SITE_URL+'/shop.php?act=shop_cart_del', 'IID=' + IID+'&CID='+CID+"&sjid="+sj, shop_cart_delResponse, 'POST', 'JSON');
}

function shop_cart_clear(sj,CID)//ajax添加到购物车清除
{
	//alert("ss");
	//Ajax.call('user.php?act=cart', 'IID=' + IID+'&CID='+CID+"&sj="+sj, cart_callback , 'GET', 'TEXT', true, true );
	Ajax.call(SITE_URL+'/shop.php?act=shop_cart_clear','CID='+CID+"&sjid="+sj, shop_cart_delResponse, 'POST', 'JSON');
}
function shop_change_num(sj,CID,IID,num)//ajax添加到购物车某件商品修改数量
{
	//alert('IID=' + IID+'&num='+num);
	//2008-3-11alert(Math.int(num));
	var asj=sj;
	if (num>0)
	{
		//Ajax.call('user.php?act=change_num','IID=' + IID+'&num='+num+'&sj='+sj, add_cartResponse , 'GET', 'TEXT', true, true );
		Ajax.call('shop.php?act=shop_change_num', 'IID=' + IID+'&num='+num+"&sjid="+asj+"&CID="+CID, shop_cart_delResponse, 'POST', 'JSON');
	}
	else
	{
		alert("数量参数错误，请重新输入");
		location.reload();
		return false;
	}

}
function shop_cart_submit(sj,CID,IID)//ajax检测是否可以提交
{
	
	//	Ajax.call('user.php?act=cart_submit','CID=' + CID+'&sj='+sj+'&IID='+IID, alert_callback, 'POST', 'JSON');
		Ajax.call(SITE_URL+'/shop.php?act=shop_cart_submit','CID=' + CID+'&sjid='+sj+'&IID='+IID, shop_url_callback , 'GET', 'TEXT', true, true );
		
}

/* *
 * 处理添加商品到购物车的反馈信息
 */
function shop_add_cartResponse(result)//添加购物车
{
	
	/**/
  if (result.error > 0)
  {
   
      alert(result.message);
   
  }
  else
  {
	 
	//var url=result.url;
	var url=SITE_URL+"/Member.php?info=cart";
	//alert("jjj");
	
	if (url!='')
	{
		//if (checkclick("Successful operation, the need to view Cart?"))
		{
			self.location.href=url;
		}
	}
	/**/
	//OpenWindow(url,"cart",screen.Width,screen.Height);
	
	//window.force.open(url);
	//window.open(url,'blank_','width='+screen.Width+',height='+screen.Height);
  }
}
function ForceWindow ()
{
  this.r = document.documentElement;
  this.f = document.createElement("FORM");
  this.f.target = "_blank";
  this.f.method = "post";
  this.r.insertBefore(this.f, this.r.childNodes[0]);
}





function shop_cart_delResponse(result)//添加购物车
{
	
	/**/
  if (result.error > 0)
  {
   
      alert(result.message);
   
  }
  else
  {
	  var cartInfo = document.getElementById('cart_list');
		if (cartInfo)
		{
		  cartInfo.innerHTML = result.content;
		}
	  
  }
}

function shop_add_wishResponse(result)//有意向的列表
{
	
	/**/
  if (result.error > 0)
  {
   
      alert(result.message);
   
  }
  else
  {
	 
	//var url=result.url;
	var url=SITE_URL+"/Member.php?info=wish";

	//alert("jjj");
	
	if (url!='')
	{
		//self.location=url;
		//if (checkclick("Successful operation, the need to view Wish?"))
		{
			self.location.href=url;
		}		
	}/**/
	//OpenWindow(url,"wish");
//	window.force.open(url);
	//window.open(url,'blank_','width='+screen.Width+',height='+screen.Height);
	
  }
}

function shop_alert_callback(result)//弹出提示信息
{
	//result="s";
	if (result!="")
	{
		alert(result)
	}
}
function shop_url_callback(result)//弹出提示信息
{
	if (result!="")
	{
		location.href=result;
	}
}
function shop_IsDigit(vv) { 
	return ((event.keyCode >= 48) &&(event.keyCode <= 57));
}