var bagwin;
function buy_ou(productid){
	url = "/buy/bag_ou.asp?productid="+ productid
	if (bagwin){
		bagwin.close()
		bagwin=window.open(url , 'bag','menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=no,width=570,top=0,left='+(window.screen.availWidth-580)+',height=200')
	}else{
		bagwin=window.open(url , 'bag','menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=no,width=570,top=0,left='+(window.screen.availWidth-580)+',height=200')
	}
}
function viewbag_ou(){
	url = "/buy/bag_ou.asp"
	window.open(url , 'bag','menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=no,width=570,top=0,left='+(window.screen.availWidth-580)+',height=200')
}
//----------------------------------------------------------------
function buy(productid){
	url = "/buy/bag.asp?productid="+ productid
	if (bagwin){
		bagwin.close()
		bagwin=window.open(url , 'bag','menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=no,width=570,top=0,left='+(window.screen.availWidth-580)+',height=200')
	}else{
		bagwin=window.open(url , 'bag','menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=no,width=570,top=0,left='+(window.screen.availWidth-580)+',height=200')
	}
}

function viewbag(){
	url = "/buy/check.asp"
	window.open(url , 'bag','menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=no,width=570,top=0,left='+(window.screen.availWidth-580)+',height=200')
}

function cal() {
    var weight = document.all("weight").value;
    var height = document.all("height").value/100;
    var sex = document.all("sf").checked;
    var bmi=0;

    if (weight=="" || isNaN(weight)) {
        alert("你输入的体重不对");
    } else {
        if (height=="" || isNaN(height)) {
            alert("你输入的身高不对");
        } else {
            bmi=Math.round(weight/(height*height)*100)/100;
            if (sex) {  //女
                if (bmi<19) {
                    document.all("result").innerHTML="<font color='blue'><strong>" + "【BMI值：" + bmi + "】 你有点儿瘦哦！</strong></font>"
                } else if (bmi>21 && bmi<=24) {
                    document.all("result").innerHTML="<font color='blue'><strong>" + "【BMI值：" + bmi + "】 你有点儿胖哦，要开始减肥了！</strong></font>"
                } else if (bmi>24) {
                    document.all("result").innerHTML="<font color='red'><strong>" + "【BMI值：" + bmi + "】 你可是真的胖了，需要大力减肥了！</strong></font>"
                } else {
                    document.all("result").innerHTML="<font color='black'><strong>" + "【BMI值：" + bmi + "】 你的身材标准极了！恭喜！</strong></font>"
                }
            } else {    //男
                if (bmi<22) {
                    document.all("result").innerHTML="<font color='blue'><strong>" + "【BMI值：" + bmi + "】 你有点儿瘦哦！</strong></font>"
                } else if (bmi>24 && bmi<=27) {
                    document.all("result").innerHTML="<font color='blue'><strong>" + "【BMI值：" + bmi + "】 你有点儿胖哦，要开始减肥了！</strong></font>"
                } else if (bmi>27) {
                    document.all("result").innerHTML="<font color='red'><strong>" + "【BMI值：" + bmi + "】 你可是真的胖了，需要大力减肥了！</strong></font>"
                } else {
                    document.all("result").innerHTML="<font color='black'><strong>" + "【BMI值：" + bmi + "】 你的身材标准极了！恭喜！</strong></font>"
                }
            }
        }
    }
}

function openwindow(url) {
   window.open(url,'new','toolbar=no,scrollbars=no,width=550,height=330');
    }
	
function heci_file(fileid)
{
url = "/file_haci/heci_file.asp?fileid="+ fileid
window.open(url , 'bag','menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=no,width=320,top=0,left='+(window.screen.availWidth-500)+',height=300')

}
function seek(engine) {
    var key = document.all("word").value;
    if (key!="") {
        if (engine=="baidu") {
            var url = "http://www.baidu.com/baidu?word=" + key + "&ct=2097152&cl=3&tn=bds&si=www.gw365.com";
        } else if (engine=="yahoo") {
            var url = "http://search.cn.yahoo.com/search?p=" + key + "&vs=www.gw365.com&ei=GBK&f=D6_5";
        } else if (engine=="google") {
            var url = "http://www.google.com/search?q=" + key + "&ie=GB2312&oe=GB2312&hl=zh-CN&domains=www.gw365.com&sitesearch=www.gw365.com";
        } 
        window.open(url,"_blank");
    } else {
        alert("Please Input your keywords.\n请输入您要找的关键字!\n");
    }
}

//进入输入框时清除提示信息
function focus_clear(opt) {
	if (opt=="1") {
		if (document.getElementById("note").value=="欢迎在此留言，我们会尽快与您联系") {
			document.getElementById("note").value="";
		}
	} else {
		if (document.getElementById("tel").value=="请输入电话(手机)号码:") {
			document.getElementById("tel").value="";
		}
	}
}

//离开输入框时设置提示信息
function focus_set(opt) {
	if (opt=="1") {
		if (document.getElementById("note").value=="") {
			document.getElementById("note").value="欢迎在此留言，我们会尽快与您联系";
		}
	} else {
		if (document.getElementById("tel").value=="") {
			document.getElementById("tel").value="请输入电话(手机)号码:";
		}
	}
}

//将留言板设置成最小
function resize(){
	obj=document.getElementById("liuyan").style;
	if(document.getElementById("yourword").style.display!="none") {
		document.getElementById("yourword").style.display="none";
		obj.height=26;
	} else {
		document.getElementById("yourword").style.display="";
		obj.height=175;
	}
	adjust();
}

//电话号码输入时防止“无用”字符的输入
function digitChk(){
	if(window.event.keyCode==45 || window.event.keyCode>47 && window.event.keyCode<59){
	}else{
		window.event.keyCode=0;
		return true;
	}
}

//“确认”按钮
function confirm(){
	if(document.getElementById("note").value.length==0 || document.getElementById("note").value=="欢迎在此留言，我们会尽快与您联系") {
		alert("欢迎在此留言，我们会尽快与您联系");
	} else {
		if(document.getElementById("tel").value.length<11 || document.getElementById("tel").value=="请输入电话(手机)号码:") {
			alert("请输入正确的电话号码，固定电话需要区号。");
		} else {
			url1=document.URL.lastIndexOf("/")+1;
			url2=document.URL.indexOf(".asp");
			sprURL="/bangzhu/savepinglun.asp?note="+document.getElementById("note").value;

			sprURL=sprURL+"&tel="+document.getElementById("tel").value;
			sprURL=sprURL+"&aspid="+document.URL.substring(url1,url2);
			document.getElementById("note").value = "欢迎在此留言，我们会尽快与您联系";
			document.getElementById("tel").value = "请输入电话(手机)号码:";
			window.open(sprURL,"win11","toolbar=no,location=no,diretories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=320,height=100")
		}
	}
}

//滚动窗口或改变窗口大小时调节“留言板位置”
function adjust(){
    obj=document.getElementById("liuyan").style;
    l = obj.height.length - 2;
    h = eval(obj.height.substring(0,l));
    obj.top=document.body.clientHeight + document.body.scrollTop - h - 3;
    obj.left=document.body.clientWidth + document.body.scrollLeft -205;
}

//状态条的设置
function doInterval() {
	tmp = "全国统一订购电话：400-716-0202，咨询电话：020-8562-6400，团购批发电话:131-3864-0099.本公司批零兼营，欢迎选购";
	if (sStatus == "") {
		sStatus = "＞";
	} else if (sStatus == "＞") {
		sStatus = "＞＞";
	} else if (sStatus == "＞＞") {
		sStatus = "＞＞＞";
	} else if (sStatus == "＞＞＞") {
		sStatus = "＞＞＞＞";
	} else if (sStatus == "＞＞＞＞") {
		sStatus = "＞＞＞＞＞";
	} else {
		sStatus = "";
	}
	window.status = sStatus + tmp;
}

var sStatus = "";   //状态条用

//主入口程序
function getLiuyan() {
	//动态输出“留言板”
	document.write("<div id='liuyan' style='position:absolute;width:200px;background:#ffffff;border-style:solid;border-width:1px;border-color:#3C537c;'>");
	document.write("<div style='margin:1px;padding:0 2px 0 1px;text-align:right;letter-spacing:1px;line-height:24px;color:#F6FFF0;background:#3C537c;font-weight:500;font-size:10pt;cursor:default;'>欢迎您对本产品留言&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style='cursor:pointer;' onClick='resize()'>×</span></div>");
	document.write("<div id='yourword' style='padding:2px;'><textarea id='note' rows='6' style='font-size:9pt;width:190px;margin:2px;padding:1px;color:#8c929a;border:solid 1px #8aa8a8;' onFocus='focus_clear(1);' onBlur='focus_set(1);'>欢迎在此留言，我们会尽快与您联系</textarea>");
	document.write("<input id='tel' type='text' maxlength='15' value='请输入电话(手机)号码:' onFocus='focus_clear(2);' onBlur='focus_set(2);' onKeyPress='digitChk();' style='font-size:10pt;width:190px;margin:2px;color:#8c929a;border:solid 1px #8aa8a8;'>");
	document.write("<input type='button' value='发送' onClick='confirm();' style='font-size:9pt;color:#F6FFF0;background:#3C537c;border-style:solid;padding:0;width:35%;margin:2px;padding:2px 0 0 0;vertical-align:middle;'>");
	document.write("<span style='margin-left:22px;color:#8c929a;font-size:9pt;'>广州炬正技术支持</span></div></div>");

	//设置初始位置
	obj=document.getElementById("liuyan").style;
	obj.height = 176;
	obj.top=document.body.clientHeight - 176 - 3;
	obj.left=document.body.clientWidth - 205;

	window.onresize = adjust;
	window.onscroll = adjust;
	setInterval("doInterval()","1000");
}

