var adDiv_ip;
var ns_ip=(document.layers);
var ie_ip=(document.all);
var w3_ip=(document.getElementById && !ie_ip);
function initPopup_ip(){
	if(!ns_ip && !ie_ip && !w3_ip){
		return;
	}
	if(ie_ip){
		adDiv_ip=eval('document.getElementById("BuycurrencyipWin").style');
	}else if(ns_ip){
		adDiv_ip=eval('document.layers["BuycurrencyipWin"]');
	}else if(w3_ip){
		adDiv_ip=eval('document.getElementById("BuycurrencyipWin").style');
	}
	if (ie_ip || w3_ip){
		adDiv_ip.visibility="visible";
	}else{
		adDiv_ip.visibility ="show";
	}
	showPopup_ip();
}
function showPopup_ip(){
		if (ie_ip){
			documentWidth  =ietruebody_ip().offsetWidth/2+ietruebody_ip().scrollLeft-20;
			documentHeight =ietruebody_ip().offsetHeight/2+ietruebody_ip().scrollTop-20;
		} else if (ns_ip){
			documentWidth=window.innerWidth/2+window.pageXOffset-20;
			documentHeight=window.innerHeight/2+window.pageYOffset-20;
		} else if (w3_ip){
			documentWidth=self.innerWidth/2+window.pageXOffset-20;
			documentHeight=self.innerHeight/2+window.pageYOffset-20;
		}
		adDiv_ip.left=documentWidth-300 + 'px';
		adDiv_ip.top =documentHeight-300 + 'px';
		//document.getElementById("showresults").innerHTML= documentHeight-250 + 'px';
		setTimeout("showPopup_ip()",100);
}
function closePopup_ip(){
	if (ie_ip || w3_ip){
		adDiv_ip.display="none";
	}else{
		adDiv_ip.visibility ="hide";
	}
}
function ietruebody_ip(){
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;
} 

function hideSelectBoxes_ip(){
	selects = document.getElementsByTagName("select");
	for (i = 0; i != selects.length; i++) {
		selects[i].style.visibility = "hidden";
	}
}

function showSelectBoxes_ip(){
	selects = document.getElementsByTagName("select");
	for (i = 0; i != selects.length; i++) {
		selects[i].style.visibility = "visible";
	}
}

function getPageSize_ip(){
	var xScroll, yScroll;
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}
	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}
    screenwidth=window.screen.width-20;
    screenheight=window.screen.height;
    if(pageWidth>screenwidth){screenwidth=pageWidth;}
    if(pageHeight>screenwidth){screenheight=pageHeight;}
	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight,screenwidth,screenheight) 
	return arrayPageSize;
}

function BuycurrencyipWin(){
   hideSelectBoxes_ip();
   var arrayPageSize = getPageSize_ip();
   document.getElementById("overplay_ipbg").style.height=(arrayPageSize[1]+100)+"px";
   document.getElementById("overplayip").style.display="block";
   document.getElementById("overplayip").style.height=arrayPageSize[5]+"px";
   document.getElementById("overplayip").style.width=arrayPageSize[4]+"px";
   document.getElementById("BuycurrencyipWin").style.display="block";
   initPopup_ip();
} 

function CloseBuycurrencyipWin(ishow){
   showSelectBoxes_ip();
   document.getElementById("overplayip").style.display="none";
   document.getElementById("groupcred").style.display = 'block';
   if(ishow == 0){try{onloadopendiv();}catch(e){}}
} 

function ShowBuycurrencyipWin(ishow){
	if(getLkecnCookie("impactnbox") != 'yes' || ishow == 1){
		var stable = '<div id="overplayip">'+
			         '  <div id="overplay_ipbg"></div>'+
			         '  <div class="daji" id="BuycurrencyipWin">'+
			         '    <div class="daji0"><img src="/images/jia0.jpg" /></div>'+
			         '    <div class="daji1">'+
			         '      &nbsp;&nbsp;&nbsp;&nbsp;近日连续接到消费者反映，网络上发现很多销售假冒林卡尔系列产品的网站。<br />'+
			         '      &nbsp;&nbsp;&nbsp;&nbsp;我公司经调查发现，这类网站以伪造香港注册公司名义进行售假等诈骗活动，更有部分网站通过拷贝我公司网站，冒充我公司名义销售假冒林卡尔系列产品，严重影响我公司声誉。我公司将向当地工商部门进行检举，并保留向人民法院起诉的权利。<br />'+
			         '      &nbsp;&nbsp;&nbsp;&nbsp;在此我们再次重申，我公司旗下的林卡尔代购网网址为：WWW.LKECN.COM以及WWW.SUGIYAMA.NET.CN。我公司的免费热线为：8008881878（固话）和4006660440（手机），现在开通400电话门槛低，随便几百元就能开通，很多骗子或山寨卖家为了鱼目混珠也开通了400电话，特此为了方便消费者的使用和区分我公司与其他所谓代购网的企业形象，我公司开通了企业级800电话。<br />'+
			         '      &nbsp;&nbsp;&nbsp;&nbsp;此外根据了解我公司旗下WWW.LKECN.COM是目前最正规、最合资格的林卡尔代购行业网站，非在本公司旗下网站代购的林卡尔系列产品，本公司不给予负责。<br />'+
			         '      &nbsp;&nbsp;&nbsp;&nbsp;最后提醒广大消费者，现今网上假冒林卡尔猖獗，有部分网站以低廉的价钱以及利用各种花言巧语诱惑消费者，进行售假和非法销售林卡尔等违法活动。更有伪造公司名义的网站挂羊头卖狗肉。因此需要购买林卡尔产品的顾客务必选择正规公司代购，或托朋友在日本购买。选择正规公司代购时须确保代购方的工商营业资格和其他资质证明。如发现售假及非法销售行为的网站，请及时向当地工商等部门投诉。<br />'+
			         '      &nbsp;&nbsp;&nbsp;&nbsp;我们真诚的祝愿每位意向购买的朋友都能买到正品林卡尔，实现你们的家庭梦想！'+
			         '      <div class="daji2"></div>'+
			         '      <div class="daji3">我公司在工商局、食品药品监督局、支付宝的认证证明：</div>'+
			         '      <div class="daji4">'+
			         '        &nbsp;工商局企业资料登记系统：<a target="_blank" href="http://cx.fsaic.gov.cn/qycx/thread.php?regno=440682000076824">http://cx.fsaic.gov.cn/qycx/thread.php?regno=440682000076824</a><br />'+
			         '        &nbsp;支付宝特约商家：<a target="_blank" href="https://www.alipay.com/aip/aip_validate_list.htm?trust_id=AIP01056030">https://www.alipay.com/aip/aip_validate_list.htm?trust_id=AIP01056030</a><br />'+
			         '        &nbsp;广东省食品药品监督管理局颁发证件：<a target="_blank" href="http://www.lkecn.com/images/wsxh.jpg">http://www.lkecn.com/images/wsxh.jpg</a><br />'+
			         '      </div>'+
			         '      <div class="daji5"><img src="/images/jiabutton.jpg" onclick="CloseBuycurrencyipWin('+ishow+')" /></div>'+
			         '    </div>'+ //<div class="daji1">
			         '    <div class="daji6"></div>'+
			         '  </div>'+  //<div class="daji" id="BuycurrencyipWin">
			         '</div>'; //<div id="overplayip">
	    document.getElementById("impactbox").innerHTML = stable;
		BuycurrencyipWin();
		writeLkecnCookie('impactnbox','yes','hours',3);
		document.getElementById("groupcred").style.display = 'none';
	}else{
		try{onloadopendiv();}catch(e){}
	}
}

function resendsms(){
	document.getElementById('tosubmit').disabled=true;
	document.getElementById('upmobile').disabled=true;
	document.getElementById('resend').disabled=true;
    document.getElementById('modiymobile').style.display='none';
    document.getElementById('resend').value='正发送短信校验码。。。';
	var url="/ajax.aspx?action=impactmobile&id="+id+"&mobile="+mobile+"&randtime="+GetRands();
	loadAjaxDataAsyn(url,"ResultReSend",new Array(),"ErrReSend",false);
	try{clearInterval(sendtodbtimer);}catch(e){}
	sendtodbtimer = setInterval(ReSendTimer,20000);
}

function ReSendTimer(){
	try{clearInterval(sendtodbtimer);}catch(e){}
	document.getElementById('tosubmit').disabled=false;
	document.getElementById('upmobile').disabled=false;
	document.getElementById('resend').disabled=false;
	document.getElementById('resend').value='重新获取短信';
	alert("重新获取失败！！！");
}

function ResultReSend(html){
	try{clearInterval(sendtodbtimer);}catch(e){}
	document.getElementById('tosubmit').disabled=false;
	document.getElementById('upmobile').disabled=false;
	document.getElementById('resend').disabled=false;
	document.getElementById('resend').value='重新获取短信';
	html=unescape(html);
	if(html.indexOf('sendyes') > -1){
		alert("校验码发送成功，请待会收到后输入校验码进行验证");
	}else{
		alert(html);
	}
}

function ErrReSend(errmsg){
	try{clearInterval(sendtodbtimer);}catch(e){}
	document.getElementById('tosubmit').disabled=false;
	document.getElementById('upmobile').disabled=false;
	document.getElementById('resend').disabled=false;
	document.getElementById('resend').value='重新获取短信';
	if(errmsg != ''){alert(errmsg);}
}

function toupmobile(m){
	var umobile = jstrim(document.getElementById('mmobile').value);
	if(m == 0){
		document.getElementById('modiymobile').style.display='block';
		if(umobile == ''){document.getElementById('mmobile').value = mobile;}
	}else{
 	    if(checkmobile(umobile)){
   	       alert("手机号码不能为空或手机号码格式不正确");
 	    }else if(umobile == mobile){
   	       resendsms();//alert("你没有修改原手机号码("+mobile+")");
 	    }else{
   	       document.getElementById('tosubmit').disabled=true;
   	       document.getElementById('upmobile').disabled=true;
   	       document.getElementById('resend').disabled=true;
   	       document.getElementById('upphone').disabled=true;
   	       document.getElementById('upphone').value='正处理...';
	       var url="/ajax.aspx?action=impactupmobile&id="+id+"&mobile="+umobile+"&randtime="+GetRands();
	       var p = new Array();
	       p[0] = umobile;
	       loadAjaxDataAsyn(url,"ResultReUpMobileSend",p,"ErrReUpMobileSend",false);
	       try{clearInterval(sendtodbtimer);}catch(e){}
	       sendtodbtimer = setInterval(ReUpMobileSendTimer,20000);
 	    }
	}
}

function ReUpMobileSendTimer(){
	try{clearInterval(sendtodbtimer);}catch(e){}
	document.getElementById('tosubmit').disabled=false;
	document.getElementById('upmobile').disabled=false;
	document.getElementById('resend').disabled=false;
	document.getElementById('upphone').disabled=false;
	document.getElementById('upphone').value='修改';
	alert("修改失败！！！");
}

function ResultReUpMobileSend(html,umobile){
	try{clearInterval(sendtodbtimer);}catch(e){}
	document.getElementById('tosubmit').disabled=false;
	document.getElementById('upmobile').disabled=false;
	document.getElementById('resend').disabled=false;
	document.getElementById('upphone').disabled=false;
	document.getElementById('upphone').value='修改';
	html=unescape(html);
	if(html.indexOf('sendyes') > -1){
		mobile = umobile;
		document.getElementById('tsendmobile').innerHTML = umobile;
		alert("修改手机号码成功，请待会收到后输入校验码进行验证");
	}else if(html.indexOf('！') > -1){
		mobile = umobile;
		document.getElementById('tsendmobile').innerHTML = umobile;
		alert(html);
	}else{
		alert(html);
	}
}

function ErrReUpMobileSend(errmsg,umobile){
	try{clearInterval(sendtodbtimer);}catch(e){}
	document.getElementById('tosubmit').disabled=false;
	document.getElementById('upmobile').disabled=false;
	document.getElementById('resend').disabled=false;
	document.getElementById('upphone').disabled=false;
	document.getElementById('upphone').value='修改';
	if(errmsg != ''){alert(errmsg);}
}

function toupsubmit(){
	var code = jstrim(document.getElementById('dcode').value);
	if(code.length != 6 || !checkisnumber(code,0)){
		alert('校验码是6位数字');
	}else{
	    document.getElementById('tosubmit').disabled=true;
	    document.getElementById('upmobile').disabled=true;
  	    document.getElementById('resend').disabled=true;
        document.getElementById('modiymobile').style.display='none';
        document.getElementById('tosubmit').value='正校验。。。';
	    var url="/ajax.aspx?action=checkimpactcode&id="+id+"&code="+code+"&randtime="+GetRands();
	    loadAjaxDataAsyn(url,"ResultUpSubmit",new Array(),"ErrUpSubmit",false);
	    try{clearInterval(sendtodbtimer);}catch(e){}
	    sendtodbtimer = setInterval(UpSubmitTimer,20000);
	}
}

function UpSubmitTimer(){
	try{clearInterval(sendtodbtimer);}catch(e){}
	document.getElementById('tosubmit').disabled=false;
	document.getElementById('upmobile').disabled=false;
	document.getElementById('resend').disabled=false;
	document.getElementById('tosubmit').value=' 确 定 ';
	alert("校验失败！！！");
}

function ResultUpSubmit(html){
	try{clearInterval(sendtodbtimer);}catch(e){};
	html=unescape(html);
	if(html.indexOf('sendyes') > -1){
		document.getElementById('dosend').style.display='none';
		document.getElementById('csend').style.display='block';
	}else{
        document.getElementById('tosubmit').disabled=false;
	    document.getElementById('upmobile').disabled=false;
    	document.getElementById('resend').disabled=false;
	    document.getElementById('tosubmit').value=' 确 定 '
		alert(html);
	}
}

function ErrUpSubmit(errmsg){
	try{clearInterval(sendtodbtimer);}catch(e){}
	document.getElementById('tosubmit').disabled=false;
	document.getElementById('upmobile').disabled=false;
	document.getElementById('resend').disabled=false;
	document.getElementById('tosubmit').value=' 确 定 ';
	if(errmsg != ''){alert(errmsg);}
}

