// JavaScript Document

//函数：F_flash(文件名,宽,度)
//作用：用这个函数代替插入Flash时的繁琐的代码，而且在IE里不需要激活
function F_flash(flashURL,flashWIDTH,flashHEIGHT)
{
document.writeln ('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" WIDTH='+flashWIDTH+' HEIGHT='+flashHEIGHT+'>'); 
document.writeln ('<PARAM NAME=movie VALUE="'+flashURL+'">'); 
document.writeln ('<PARAM NAME=wmode VALUE=transparent>'); 
document.writeln ('<PARAM NAME=loop VALUE=true>'); 
document.writeln ('<PARAM NAME=quality VALUE=high>'); 
document.writeln ('<EMBED src="'+flashURL+'" loop=true wmode=opaque quality=high swLiveConnect=FALSE WIDTH='+flashWIDTH+' HEIGHT='+flashHEIGHT+' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED>'); 
document.writeln ('</OBJECT>'); 
}

//函数：checkloginform()
//作用：检查登录
function checkloginform()
{
	if(loginfrom.email.value=="")
	{
		alert("email is null!");
		loginfrom.email.focus();
		return false;
	}
	if(chekemail(loginfrom.email.value)==false) 
	{
		alert("email error!");
		loginfrom.email.focus();
		return false;
	}
	if(loginfrom.UserPwd.value=="")
	{
		alert("password is null!");
		loginfrom.UserPwd.focus();
		return false;
	}
	loginfrom.submit();	
}
//Products页面类别展示
var act;
function showClass(Mh)
{
	var h = parseInt(document.getElementById("PCLass").style.height);
	if (h < Mh){
		over(Mh);
		document.getElementById("li2").innerHTML = 'more <img src="images/arrow-green_2.gif"/>';
		//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	}else{
		out();
		document.getElementById("li2").innerHTML = 'more <img src="images/arrow-green.gif"/>';
	}
}
function over(Mh)
{
	var h = parseInt(document.getElementById("PCLass").style.height);
	if (h < Mh){
		document.getElementById("PCLass").style.height = h + 1;
		document.getElementById("DIV2").style.height=h +1;
		clearTimeout(act);
		act = setTimeout('over('+Mh+')', 1);
	}
}
function out(){
	var h = parseInt(document.getElementById("PCLass").style.height);
	if (h > 19){
	document.getElementById("PCLass").style.height = h - 1;
	document.getElementById("DIV2").style.height = h - 1;
	clearTimeout(act);
	act = setTimeout('out()', 10);
	}
}
//函数：chekemail(email)
//作用：检查Email格式是否输入正确
//事件：if(chekemail(loginfrom.email.value)==false) 
function chekemail(email) 
{ 
var pattern = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
if(pattern.test(email)) 
{ 
	return true; 
} 
else 
	return false; 
} 
//函数：JHshNumberText()
//作用：强制只能输入数字
//事件：onKeyPress="JHshNumberText()"
function JHshNumberText()
{
   if ( !((window.event.keyCode >= 48) && (window.event.keyCode <= 57)))
   {
	   window.event.keyCode = 0 ;
   }
}
//函数：OutputNewsCode(Val,price)
//作用：用在购物车页面，在更改数量的时候，总的金额随之变动
//参数：Val数量，price，显示总的金额
//事件：OutputNewsCode(Val,price)
function OutputNewsCode(Val,price,obj){
	if (Val!=''){
		document.getElementById(obj).innerHTML = Val*price;
		//obj_online("check.asp?qu="+Val);
	}
	else{
		CartForm.Quntity.value=1;
		document.getElementById(obj).innerHTML = 1*price;
	}	
}
//函数：OutputNewsCode(Val,price)
//作用：用在购物车页面，在更改数量的时候，总的金额随之变动
//参数：Val数量，price，显示总的金额
//事件：OutputNewsCode(Val,price)
function GoConfirm(msg,url){
	if(confirm(msg))
	window.location=url;
}

function CheckForm()
{
	if(myform.email.value=="")
	{
		alert("Email is Null!");
		myform.email.focus();
		return false;
	}
	if(document.getElementById("EmailStr").className=="Reg_error")
	{
		alert("Email is error!");
		myform.email.focus();
		return false;
	}
	if(myform.Psw.value=="")
	{
		alert("Password is Null!");
		myform.Psw.focus();
		return false;
	}
	if(myform.CPsw.value=="")
	{
		alert("Confirm Password is Null!");
		myform.CPsw.focus();
		return false;
	}
	else{
		if (myform.CPsw.value != myform.Psw.value)
		{
			alert("Passwords do not match!");
			myform.CPsw.focus();
			return false;
		}
	}
	if(myform.userName.value=="")
	{
		alert("Name is Null!");
		myform.userName.focus();
		return false;
	}
	if(myform.Address.value=="")
	{
		alert("Address is null!");
		myform.Address.focus();
		return false;
	}
	if(myform.City.value=="")
	{
		alert("City is null!");
		myform.City.focus();
		return false;
	}
	if(myform.Tel1.value=="")
	{
		alert("Tel is null!");
		myform.Tel1.focus();
		return false;
	}
	if(myform.Tel2.value=="")
	{
		alert("Tel is null!");
		myform.Tel2.focus();
		return false;
	}
	myform.submit();
}
//myaccount 页面的Check
function CheckEditForm()
{
	if(myform.Psw.value=="")
	{
		alert("Password is Null!");
		myform.Psw.focus();
		return false;
	}
	if(myform.userName.value=="")
	{
		alert("Name is Null!");
		myform.userName.focus();
		return false;
	}
	if(myform.Address.value=="")
	{
		alert("Address is null!");
		myform.Address.focus();
		return false;
	}
	if(myform.City.value=="")
	{
		alert("City is null!");
		myform.City.focus();
		return false;
	}
	if(myform.Tel1.value=="" )
	{
		alert("Tel is null!");
		myform.Tel1.focus();
		return false;
	}
	if(myform.Tel2.value=="")
	{
		alert("Tel is null!");
		myform.Tel2.focus();
		return false;
	}
	myform.submit();
}
function checkorder()
{
	if(myform.PersonName.value=="")
	{
		alert("Name is Null!");
		myform.PersonName.focus();
		return false;
	}
	if(myform.Address.value=="")
	{
		alert("Address is Null!");
		myform.Address.focus();
		return false;
	}
	if(myform.City.value=="")
	{
		alert("City is Null!");
		myform.City.focus();
		return false;
	}
//	if(myform.Code.value=="")
//	{
//		alert("Zip Code is Null!");
//		myform.Code.focus();
//		return false;
//	}
	if(myform.Email.value=="")
	{
		alert("E-mail is Null!");
		myform.Email.focus();
		return false;
	}
	if(myform.Tel1.value=="")
	{
		alert("Tel is Null!");
		myform.Tel1.focus();
		return false;
	}
	if(myform.Tel2.value=="")
	{
		alert("Tel is Null!");
		myform.Tel2.focus();
		return false;
	}
	myform.submit();
}
//检查Email输入是否正确以及是否已被注册过
function checkEmail(val)
{
	if(val!="")
	{
		var patn =/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
		if(!patn.test(val)) 
		{
			document.getElementById("EmailStr").innerHTML="Email format error";
			document.getElementById("EmailStr").className="Reg_error";
			return false;
		}
		else
		{
			document.getElementById("EmailStr").innerHTML="right";
			document.getElementById("EmailStr").className="Reg_err";
			CheckInput("check.asp?email="+val);
		}
	}
}
//检查两次输入的密码是否相同
function checkpsw(val)
{
	if(myform.CPsw.value!="")
	{
		if (myform.CPsw.value != myform.Psw.value)
		{
			document.getElementById("confpswStr").innerHTML="Passwords do not match!";
			document.getElementById("confpswStr").className="Reg_error";
			//myform.CPsw.focus();
		}
	}
}

function Reduction(obj)
{
	document.getElementById(obj).innerHTML="";
	document.getElementById(obj).className="";
}

//弹出窗口
function openwin(url,wid,hei){
  window.open(url,"mywindow","toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no,width="+wid+",height="+hei+",top=100,left=180'");

}
//关闭弹出窗口
function closewin()
{
window.opener =null; 
window.close(); 
}
//MyOrder.asp页面的一个更新状态用的
function upflag(OrderNo,fv)
{
	myform.NO.value=OrderNo;
	myform.f.value=fv;
	myform.submit();
}
//把关键字提交到Search页面
function subkey()
{
	var obj=document.getElementById("keyword");
	if (obj.value=="")
	{
		alert("The KeyWord is Null!");
		obj.focus();
		return false;				
	}else{
		location.href="search.asp?keyword="+obj.value;
	}
}
//提交到consignment.asp页面，以存储用户选的运费方式，和对于订单的要求
function checkRedeem()
{	
	if(document.getElementById("RedeemNO").value=="")
	{
		alert("The Redeem Code is Null!");
		document.getElementById("RedeemNO").focus();
		return false;				
	}else{
		RedeemFrom.RedeenCode.value=document.getElementById("RedeemNO").value;
	}
	RedeemFrom.submit();	
}

function downfile(fname)
{
	alert("downfile.asp?path="+fname);
window.open("downfile.asp?path="+fname,'','');
}
function checkinputNO(Mi,Ma,PID,obj,act)
{
	if(document.getElementById(obj).value>Ma && Ma!=0)
	{
		alert("Quantity should be less than max quantity");
		document.getElementById(obj).focus();
		return false;
	}else if(document.getElementById(obj).value<Mi && Mi!=0)
	{
		alert("Quantity should be more than min quantity");
		document.getElementById(obj).focus();
		return false;
	}
	else{
		if (act=="update"){
			location.href='shoppingcart.asp?act='+act+'&PID='+PID+'&qu='+document.getElementById(obj).value;
		}else{
			location.href='shoppingcart.asp?act='+act+'&PID='+PID+'&qu='+document.getElementById(obj).value+'&Psize='+document.getElementById('Psize').value
		}
	}
}
<!--
function CloseWin()
{
var ua=navigator.userAgent
var ie=navigator.appName=="Microsoft Internet Explorer"?true:false
if(ie){
var IEversion=parseFloat(ua.substring(ua.indexOf("MSIE ")+5,ua.indexOf(";",ua.indexOf("MSIE "))))
if(IEversion< 5.5){
var str = '<object id=noTipClose classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11">'
str += '<param name="Command" value="Close"></object>';
document.body.insertAdjacentHTML("beforeEnd", str);
document.all.noTipClose.Click();
}
else{
window.opener =null;
window.close();
}
}
else{
window.close()
}
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

//-->
