function openwin(url,w,h){
    window.open(url,"getDetail","top=50 left=400 height="+h+",width="+w+",toolbar=no,menubar=no,resizable=no,scrollbars=yes,location=no,status=no")
}

function checkLoginform(){
	if(document.Login.UserName.value==""){alert("请填写用户名！");document.Login.UserName.focus();return false;}
	if(document.Login.PassWord.value==""){alert("请填写密码！");document.Login.PassWord.focus();return false;}
	if(document.Login.VNum.value==""){alert("请填写验证问题！");document.Login.VNum.focus();return false;}
	return true;
}
function reCode(){
	var a=document.getElementById('v1');
	a.innerHTML="<img src='../inc/VNum.asp' alt='问题太难换一个！' title='问题太难换一个！' onClick='reCode()' width='80' height='25' >";
	document.getElementById('VNum').value="";
}
function pagewh(){
	Aleft=document.getElementById('left');
	Aright=document.getElementById('right');
	Aleftoc=document.getElementById('leftoc');
	Atop=document.getElementById('top');
	APageMain=document.getElementById('PageMain');
	Anav=document.getElementById('nav');
	APageTitle=document.getElementById("PageTitle")
	
	
	

	
	Height_P=document.body.clientHeight-1;
	Height_T=Atop.offsetHeight;
	Width_P=document.body.clientWidth;
	if (window.navigator.userAgent.indexOf("MSIE")>=1) Width_P=Width_P+17;
}
function leftoc(){
	pagewh();
	if(Aleft.className=='leftoc'){
		Aleft.className=""
		Atop.className="";
	}else{
		Aleft.className="leftoc";
		Atop.className="HidContent";
		Aright.style.height=(Height_P-1);
		APageMain.style.height=(Height_P-49);
		Aleft.style.height=(Height_P);
		Aleftoc.style.height=(Height_P);
	}
	adminHeight_();
}
function adminHeight_(){
	pagewh();
	//alert(Width_P);
	Aleft.style.height=(Height_P-Height_T+30);
	Aleftoc.style.height=(Height_P-Height_T);
	Aright.style.height=(Height_P-Height_T);
	Aright.style.width=(Width_P-Aleft.offsetWidth-17);
	APageMain.style.height=(Height_P-Height_T-49);
	Anav.style.width=(Width_P-205-17);
	
}
function AdminNav_(i){
	pagewh();
	var ul=document.getElementById("menu").getElementsByTagName("ul");
	var li=document.getElementById("menu").getElementsByTagName("li");
	var a=nav.getElementsByTagName("a");
	for(ii=0;ii<a.length;ii++){
		a[ii].className="";
		if(i==ii) a[ii].className="a";
	}
	for(ii=0;ii<ul.length;ii++){
		ul[ii].className="HidContent";
	}
	for(ii=0;ii<li.length;ii++){
		li[ii].className="";
	}
	
	
	document.getElementById("AdminM_"+i).className="";
	Aleft.className="";
	APageTitle.innerHTML="← 请选择左侧菜单";
	APageMain.innerHTML="";
	//Anav.style.width=(Width_P-205);
}
function AdminIs_(j,jj,j1,j2){
	APageTitle.innerHTML=jj;
	APageMain.innerHTML="<iframe src="+j+" frameborder='0' id='iframeshow' name='iframeshow'  style='width:100%;' scrolling='no' onload='this.height=iframeshow.document.body.scrollHeight'></iframe>"
	
	var li=document.getElementById("AdminM_"+j1).getElementsByTagName("li");
	for(i=1;i<=li.length;i++){
		li[i-1].className="";
	}
	document.getElementById("AdminM_"+j1+"_"+j2).className="a";
}
function delmsg(msgid,txt)
{
	if(confirm(txt))
		window.location.href="?Action=Del&ID="+msgid;
}
function delmsgM(msgid,txt)
{
	if(confirm(txt))
		window.location.href="?Del=1&Action=Del&ID="+msgid;
}
function delmsgMclear(msgid,txt)
{
	if(confirm(txt))
		window.location.href="?Recover=1&Action=clear&ID="+msgid;
}
function delmsgW1(msgid,txt)
{
	if(confirm(txt))
		window.location.href="?Del=1&Action=Del&ID="+msgid+"&w=1";
}
function delmsgW2(msgid,txt)
{
	if(confirm(txt))
		window.location.href="?Del=1&Action=Del&ID="+msgid+"&w=2";
}
function delmsgA(msgid,txt)
{
	if(confirm(txt))
		window.location.href="?Action=Del&ID="+msgid;
}
function onIs(thisdiv){
	thisdiv.style.borderColor=='#ff0000' ? thisdiv.style.borderColor='#ccc' : thisdiv.style.borderColor='#ff0000' ;
}
function textIn(a,b){
	var a1=document.getElementById(a);
	var a2=","+document.getElementById(a).value+",";
	if(a2.indexOf(','+b+',')<0){
		a1.value=="" ? a1.value = b : a1.value += ","+b
	}
}
function M_Add(){
	if(document.Add.NID.value==""){alert("请分配编号！");document.Add.NIDa.focus();return false;}
	if(document.Add.B2.value=="" || document.Add.B2.value.length<8){alert("请正确填写或选择入会日期！");document.Add.B2.focus();return false;}
	if(document.Add.A.value==""){alert("请填写姓名！");document.Add.A.focus();return false;}
	if(document.Add.A2.value=="9"){alert("请选择性别！");document.Add.A2.focus();return false;}
	if(document.Add.A3.value=="" || document.Add.A3.value.length<8){alert("请正确填写或选择出生日期！");document.Add.A3.focus();return false;}
	if(document.Add.A4.value==""){alert("请输入籍贯！");document.Add.A4.focus();return false;}
	if(document.Add.A5.value=="0"){alert("请选择民族！");document.Add.A5.focus();return false;}
	if(document.Add.A7.value=="0"){alert("请选择所在省份！");document.Add.A7.focus();return false;}
	if(document.Add.A8.value==""){alert("请填写居住地址！");document.Add.A8.focus();return false;}
	if(document.Add.A10.value=="" || document.Add.A10.value.length<10){alert("请正确填写电话号码，格式：01066186418");document.Add.A10.focus();return false;}
	if(document.Add.A11.value=="" || document.Add.A11.value.length<11){alert("请正确填写手机号码！");document.Add.A11.focus();return false;}
	if(document.Add.Pic.value==""){alert("请上传近期相片！");document.Add.Pic.focus();return false;}
	return true;
}
function W1_Add(){
	if(document.Add.NID.value==""){alert("请输入会员编号！");document.Add.NID.focus();return false;}
	if(document.Add.Pic.value==""){alert("请上传作品图片！");document.Add.Pic.focus();return false;}
	if(document.Add.A.value==""){alert("请填写作品名称！");document.Add.A.focus();return false;}
	if(document.Add.A3.value==""){alert("请填写创作时间！");document.Add.A3.focus();return false;}
	return true;
}
function W2_Add(){
	if(document.Add.NID.value==""){alert("请输入会员编号！");document.Add.NID.focus();return false;}
	if(document.Add.A.value==""){alert("请填写理论作品标题！");document.Add.A.focus();return false;}
	if(document.Add.A3.value==""){alert("请填写创作时间！");document.Add.A3.focus();return false;}
	return true;
}
function textA(a,num){
	var a1
	a1=a.value;
	if(a1.length>=num+1){
		a1=a1.substr(0,num);
		a.value=a1;
		alert("输入的内容太多，请不要超过"+num+"字节，谢谢！！");
	}
}
function isnum(a){
	var a1,reg
	a1=a.value;
	reg=/[^0-9]/;
	if(reg.test(a1)){
		//a.value=a1.substr(0,a1.length-1);
		a.value="";
		a.focus(); 
		alert("此处只能输入半角数字,谢谢！！"); 
		return false; 
	}
}
function getNid(id,name){
	window.opener.Add.NID.value=id;
	window.opener.MemberName.innerHTML=name;
	self.close();
}
function getNid2(id,name,y,hf,zw){
	window.opener.Add.NID.value=id;
	window.opener.MemberName.innerHTML=name;
	var a=""
	var nowy = new Date().getFullYear();
	for (i=y;i<=nowy+5;i++){
		if(hf.indexOf(i)>0){
			a+="<input name='A' type='checkbox' id='A' value="+i+" disabled checked>"+i+" ";
		}else{
			a+="<input name='A' type='checkbox' id='A' value="+i+">"+i+" ";
		}
		
	}
	a+="<input name='B8' type='hidden' id='B8' value="+hf+">";
	window.opener.jfnf.innerHTML=a;
	window.opener.jfzw.innerHTML=zw;
	self.close();
}

//添加产品 图片显示
function ProductAddshow(path){
		var ShowPic=parent.document.getElementById("ShowPic");
		ShowPic.innerHTML +="<img src='../upload/Product/"+path+"' height='50' border='0' onclick=ProductDelshow('"+path+"')></a> ";
}

//添加产品 刷新图片显示
function ProductReshow(){
	var Pic=document.Add.Pic.value.split("\n");
	var tmpPic="";
	var ShowPic=document.getElementById("ShowPic");
	var ShowPicHtml="";
	if(Pic.length>=10){up.className="HidContent";}else{up.className="";}
	
	for(var i=0;i<Pic.length & i<10;i++){
		if(Pic[i].length>5){
			ShowPicHtml +="<img src='../upload/Product/"+Pic[i].replace("/","/S_")+"' height='50' border='0'> "
			if(i==0){
				tmpPic+=Pic[i];
			}else{
				tmpPic+="\n"+Pic[i];
			}
			
		}
	}
	document.Add.Pic.value=tmpPic;		//去除多余图片，但图片文件无法删除
	ShowPic.innerHTML=ShowPicHtml;
}


//添加产品 尺码名称
function ProductShowCM() {
	ProductCM.innerHTML="";
	ProductCMList.innerHTML="";
	if (http_request.readyState == 4) {
		if (http_request.status == 200) {
			var detail=unescape(http_request.responseText).split("!")
				CMContent=""
				if(detail.length>0){
					for(var i=0;i<detail.length;i++){
						if(detail[i].split("$")[1]!="undefined"){
							CMContent+="<li><input type='radio' name='A31' id='radio' value='"+detail[i].split("$")[0]+"' onclick=ProductShowCML('"+detail[i].split("$")[2]+"')>"+detail[i].split("$")[1]+"</li>";
						}
					}
				}
				ProductCM.innerHTML="<ul>"+CMContent+"</ul>";
		} else {
			alert('There was a problem with the request.');
		}
	}
}

function ProductShowCML(list){
	var list
	var CMListContent="";
	if (list.length>1){
		list=list.split("@");
		for(var i=0;i<list.length;i++){
			if(list[i].length>3){
				CMListContent+="<li><input name='A32' type='checkbox' value='"+list[i].split(",")[0]+"' onclick=ProductShowCMSize(this,parentNode)> "+list[i].split(",")[0]+"<!--KC--></li>";
			}
		}
		ProductCMList.innerHTML="<ul>"+CMListContent+"</ul>";
		
	}
	//alert(CMListContent)
}

function ProductShowCMSize(a,a1){
	var checkbox=a;
	var C1=a1.innerHTML.split("<!--KC-->");
	if(checkbox.checked==true){
		//a1.innerHTML=C1[0]+"<!--KC--><span style='margin-left:40px;'>库存:<input name="+checkbox.value+" size=10 maxlength=20 onchange=parentNode.getElementsByTagName('input')[0].value+=this.value></span>"
		a1.innerHTML=C1[0]+"<!--KC--><span style='margin-left:40px;'>库存:<input name=KC"+checkbox.value+" size=10 maxlength=20 onchange=isnum(this) value=0></span>"
	}else{
		a1.innerHTML=C1[0];
	}
}
function ProductKCChange(a,a1){
	var a
	var a1
	//alert(a1.getElementsByTagName("input")[0].value);
	alert (a.getElementsByName);
	
	
}

function GetPID() {
	var spic
	if (http_request.readyState == 4) {
		if (http_request.status == 200) {
			var detail=unescape(http_request.responseText).split("$")
				if(detail.length>1){
					spic=detail[3].split("@")[0];
					pic.innerHTML="<img src='../upload/Product/"+spic.replace("/","/S_")+"' height='80' border='0'>";
					
					document.Add.PID.value=detail[0];
					document.Add.PName.value=detail[1];
					document.Add.PPrice.value=detail[2];
				}else{
					pic.innerHTML="查无产品！";	
					document.Add.PID.value="";
					document.Add.PName.value="";
					document.Add.PPrice.value="";
				}
				
		} else {
			alert('There was a problem with the request.');
		}
	}
}

function SelectProvince(is,s1){
	var is
	var s1
	if(s1=="undefined"){s1=0};
	var p="<select name='Province' id='Province' onChange='SelectCity(0,"+s1+")' onClick='SelectCity(-1,"+s1+")'>"
	+"<option value='0'>选择省份</option>";
	for(var i=0;i<ChinaCity.length;i++){
		p+="<option value='"+(i+1)+"' "
		if(is==i+1){p+=" selected "}
		p+=">"+ChinaCity[i].split("|")[0]+"</option>";
	}

	p+="</select>";
	
	C_1.innerHTML=p;
}

function SelectCity(is,s1){
	var is
	var s1
	is=","+is+","
	if(s1=="undefined"){s1=0}
	var a=document.Add.Province.value;
	if(a!=0){
		var data=ChinaCity[a-1].split("|");
		var p="<select name='City' id='City' "
		if(s1==1){p+="size='5' multiple='multiple'"};
		p+=">"
		+"<option value='0'>选择城市</option>";
	
		for(var i=1;i<data.length;i++){
			p+="<option value='"+i+"' "
			if(is.indexOf(","+i+",")>=0){p+=" Selected "}
			p+=">"+data[i]+"</option>";
		}
		p+="</select>";
		C_2.innerHTML=p;
	}else{
		p=""
	}
	C_2.innerHTML=p;
}


function IndexNavShow(id){
	var img=document.getElementById("ShopNav_"+id);
	var onM=document.getElementById("ShopNav2_"+id);
	for (i=1;i<=6;i++){
		document.getElementById("ShopNav_"+i).style.display="none";
		document.getElementById("ShopNav2_"+i).className="";
	}
	img.style.display="";
	onM.className="a";
	
}


function IndexMarquee(){
	var speed=30
	demo2.innerHTML=demo1.innerHTML
	function Marquee(){
		if(demo2.offsetWidth-demo.scrollLeft<=0)
			demo.scrollLeft-=demo1.offsetWidth
		else{
			demo.scrollLeft++
		}
	}
	var MyMar=setInterval(Marquee,speed)
	demo.onmouseover=function() {clearInterval(MyMar)}
	demo.onmouseout=function() {MyMar=setInterval(Marquee,speed)}
}
function slc(id){
	var showlc=document.getElementById("Lc"+id);
	if(showlc.className==""){
			showlc.className="lc";
	}else{
		showlc.className="";
	}
}




