function openwin(url,target,w,h)
{
	newWin=window.open(url,target,"toolbar=no,menubar=no,status=no,location=no,scrollbars=yes,resizable=yes,copyhistory=yes,width="+w+",height="+h);
	newWin.focus();
}
function addtocart(goodz_id)
{
	newWin=window.open("addtocart.asp?goodz_id="+goodz_id,"cart","toolbar=no,menubar=no,status=no,location=no,scrollbars=no,resizable=no,copyhistory=yes,width=300,height=240");
	if(newWin)
	newWin.focus();
	else
	alert("出现错误，可能是因为你的浏览器屏蔽了弹出窗口功能！\r请尝试修改浏览器设置或者在点击时按住Ctrl键。")
}
function addsimcart(card_telno)
{
	newWin=window.open("addsimcart.php?card_telno="+card_telno,"cart","toolbar=no,menubar=no,status=no,location=no,scrollbars=yes,resizable=yes,copyhistory=yes,width=240,height=220");
}
function havenoChar(theelement)
{//含有非法字符 返回 true
   text="<>&?'\"";
   for(i=0;i<=theelement.length-1;i++)
   {
      char1=theelement.charAt(i);
      index=text.indexOf(char1);
      if(index!=-1)
      {
        return true;
      }
   }
   return false;
}
function NotNumber(theelement)
{//是否整数
   text="1234567890";
   for(i=0;i<=theelement.length-1;i++)
   {
      char1=theelement.charAt(i);
      index=text.indexOf(char1);
      if(index==-1)
      {
        return true;
      }
   }
   return false;
}
function NotNumber2(theelement)
{//是否数字
   text="1234567890.";
   for(i=0;i<=theelement.length-1;i++)
   {
      char1=theelement.charAt(i);
      index=text.indexOf(char1);
      if(index==-1)
      {
        return true;
      }
   }
   return false;
}
function checknum(targ,flag)
{//检查输入是否数字
	if(targ.value==""){
		alert("请输入正确的数字！");
		targ.form.reset();
		targ.focus();
		return;
	}
	if(flag){
		if(NotNumber2(targ.value)){
			alert("必须输入正确的数字！");
			targ.form.reset();
			targ.focus();
			return;
		}
	}
	else{
		if(NotNumber(targ.value)){
			alert("必须输入正确的整数！");
			targ.form.reset();
			targ.focus();
			return;
		}		
	}
}
function checklogin(targ){
if(targ.username.value.length<1 ||targ.username.value.length>20){
	alert("请输入正确的会员登录名！");
	targ.username.focus();
	return false;
	}
if(targ.passwd.value.length<1 ||targ.passwd.value.length>20){
	alert("请输入正确的登录密码！");
	targ.passwd.focus();
	return false;
	}	
return true;	
}
function change_page(newpage)
{
targ=document.pageform;
targ.page.value=newpage;
targ.submit();
}
function change_page1(newpage1)
{
targ=document.pageform1;
targ.page.value=newpage1;
targ.submit();
}
function pic_show(url)
{
	newWin=window.open('../picshow.asp?img='+url,'picshow',"left="+(screen.width/2-150)+",top="+(screen.height/2-150)+",width=300,height=300,toolbar=no,menubar=no,status=no,location=no,scrollbars=yes,resizable=yes,copyhistory=yes");
	newWin.focus();
}
function user_show(targ)
{
	newWin=window.open("reg_detail.asp","user","toolbar=no,menubar=no,status=no,location=no,scrollbars=yes,resizable=yes,copyhistory=yes,width=560,height=580");
}
function havenoChar(theelement)
{//含有非法字符 返回 true
   text="<>&?'\"";
   for(i=0;i<=theelement.length-1;i++)
   {
      char1=theelement.charAt(i);
      index=text.indexOf(char1);
      if(index!=-1)
      {
        return true;
      }
   }
   return false;
}
function NotNumber(theelement)
{//是否整数
   text="1234567890";
   for(i=0;i<=theelement.length-1;i++)
   {
      char1=theelement.charAt(i);
      index=text.indexOf(char1);
      if(index==-1)
      {
        return true;
      }
   }
   return false;
}
function NotNumber2(theelement)
{//是否数字
   text="1234567890.";
   for(i=0;i<=theelement.length-1;i++)
   {
      char1=theelement.charAt(i);
      index=text.indexOf(char1);
      if(index==-1)
      {
        return true;
      }
   }
   return false;
}
function checknum(targ,flag)
{//检查输入是否数字
	if(targ.value==""){
		alert("请输入正确的数字！");
		targ.form.reset();
		targ.focus();
		return;
	}
	if(flag){
		if(NotNumber2(targ.value)){
			alert("必须输入正确的数字！");
			targ.form.reset();
			targ.focus();
			return;
		}
	}
	else{
		if(NotNumber(targ.value)){
			alert("必须输入正确的整数！");
			targ.form.reset();
			targ.focus();
			return;
		}		
	}
}
function whichItem(flag)
{//选择操作对象
	var e = event.srcElement
	while (e.tagName != flag)
		e = e.parentElement
	return e
}
function CheckAll(targ)
  {//全部选中
	if (targ.sel.length==null)
		{//只有一条记录的情况
			targ.sel.checked=targ.selall.checked;
			cca(targ.sel);
		}else{
			for (var i=0;i<targ.sel.length;i++){
			targ.sel[i].checked=targ.selall.checked;
			cca(targ.sel[i]);
			}
		}
}
function CheckSelect(targ)
{//是否选中，返回选中的记录数目
	var num=0;
	if (targ.sel.length==null)
		{//只有一条记录的情况
			if (targ.sel.checked==true){
				num=1;
			}			
		}else{
			for (var i=0;i<targ.sel.length;i++){
			if(targ.sel[i].checked)
			num+=1;
			}
		}
	if(num==0){
		alert("你没有选中任何信息！！");
		}
	return num;
}
function DeleteAlert(targ,act)
{//删除警告
	if (CheckSelect(targ)) {
	if(confirm("警告：此操作不可恢复！！\r确认删除所选信息？")){
	targ.action=act;
	targ.submit();
		}
	}
return;
}

