// JavaScript Document
function g(o){return document.getElementById(o);}
function gel(a){return document.getElementById(a);}
var regchar 	= new RegExp("^[A-Za-z0-9]+$","");
var regchinese  = new RegExp("^[A-Za-z0-9\u4e00-\u9fa5]+$","");
var regUserID  	= new RegExp("^[-_A-Za-z0-9\u4e00-\u9fa5]+$","");
var regnonum	= new RegExp("^[A-Za-z\u4e00-\u9fa5]+$","");

function HoverLi(t,n){
//如果有N个标签,就将i<=N;
for(var i=1;i<4;i++){
	g(t+'_'+i).className='normaltab';
	g(t+'_0'+i).className='tb01_c undis';
	if (n==2){
		g("tb1_UrlLink").href='/Application.asp';
	} else {
		g("tb1_UrlLink").href='/News.asp?part=8&ClassID=1';
	}
}
	g(t+'_0'+n).className='tb01_c dis';
	g(t+'_'+n).className='hovertab';
}

function HoverLi2(t,n){
//如果有N个标签,就将i<=N;
for(var i=1;i<4;i++){
	g(t+'_'+i).className='normaltab';
	g(t+'_0'+i).className='tb01_c undis';
	if (n==2){
		g("tb1_UrlLink").href='/News.asp?part=8&ClassID=1';
	} else {
		g("tb1_UrlLink").href='/News.asp?part=9';
	}
}
	g(t+'_0'+n).className='tb01_c dis';
	g(t+'_'+n).className='hovertab';
}

function HoverLiTb51(t,n,count){
//如果有N个标签,就将i<=N;
for(var i=1;i<=count;i++){
	g(t+'_'+i).className='tb5_normaltab';
	g(t+'_0'+i).className='tb501_c undis';
}
	g(t+'_0'+n).className='tb501_c dis';
	g(t+'_'+n).className='tb5_hovertab';
}
function HoverLiTb52(t,n,count){
//如果有N个标签,就将i<=N;
for(var i=1;i<=count;i++){
	g(t+'_'+i).className='tb5_normaltab';
	g(t+'_0'+i).className='tb501_c undis';
}
	g(t+'_0'+n).className='tb501_c dis';
	g(t+'_'+n).className='tb5_hovertab';
}
function HoverLiTb53(t,n,count){
//如果有N个标签,就将i<=N;
for(var i=1;i<=count;i++){
	g(t+'_'+i).className='tb5_normaltab';
	g(t+'_0'+i).className='tb501_c undis';
}
	g(t+'_0'+n).className='tb501_c dis';
	g(t+'_'+n).className='tb5_hovertab';
}
function HoverLiTb54(t,n,count){
//如果有N个标签,就将i<=N;
for(var i=1;i<=count;i++){
	g(t+'_'+i).className='tb5_normaltab';
	g(t+'_0'+i).className='tb501_c undis';
}
	g(t+'_0'+n).className='tb501_c dis';
	g(t+'_'+n).className='tb5_hovertab';
}
function HoverLiTb55(t,n,count){
//如果有N个标签,就将i<=N;
for(var i=1;i<=count;i++){
	g(t+'_'+i).className='tb5_normaltab';
	g(t+'_0'+i).className='tb501_c undis';
}
	g(t+'_0'+n).className='tb501_c dis';
	g(t+'_'+n).className='tb5_hovertab';
}
function HoverLiTb56(t,n,count){
//如果有N个标签,就将i<=N;
for(var i=1;i<=count;i++){
	g(t+'_'+i).className='tb5_normaltab';
	g(t+'_0'+i).className='tb501_c undis';
}
	g(t+'_0'+n).className='tb501_c dis';
	g(t+'_'+n).className='tb5_hovertab';
}
//如果要做成点击后再转到请将<li>中的onmouseover 改成 onclick;

var count = -1; 
function countDown(){ 
	var b = document.getElementById("s"); 
	document.Agree.elements['agree'].disabled = true;
	if(this.count>=0)
	{
		b.value = "同意协议("+(this.count--)+")"; 
		setTimeout("countDown()",1000); 
	}else{ 
	b.value = "同意协议"; 
	b.disabled = false; 
	document.Agree.elements['agree'].disabled = false;
	}
}
function iAgree(){
	if (document.Agree.elements['agree'].checked){
	document.getElementById("s").disabled = false; 
	}else{
	document.getElementById("s").disabled = true; 
	}
}
function checkLoginTop(TheForm){
	var userUserTopID = TheForm.UserTopID.value;
	if (userUserTopID=="" )
	{
		alert('请输入用户名');
		TheForm.UserTopID.focus();
		return false;
	} else if(!regUserID.test(userUserTopID) || userUserTopID.length < 5 || userUserTopID.length > 18){
		alert('用户名必须为5-18位[中文,A-Z,a-z,0-9,下划线,横线]');
		TheForm.UserTopID.focus();
		return false;
	}
	var userUserTopPs = TheForm.UserTopPs.value;
	if (userUserTopPs=="" )
	{
		alert('请输入密码');
		TheForm.UserTopPs.focus();
		return false;
	} else if(!regchar.test(userUserTopPs) || userUserTopPs.length < 5 || userUserTopPs.length > 15){
		alert('密码必须为5-15位[a-z A-Z 0-9]');
		TheForm.UserTopPs.focus();
		return false;
	}
}


document.write("<style type=\"text/css\">body{padding:0px;margin:0px}.close{float:right;cursor:default}</style>")
function $(id){ return document.getElementById(id)}
function AlertMsg(title,content){
	var msgw,msgh,msgbg,msgcolor,bordercolor,titlecolor,titlebg; 
	//弹出窗口设置
	msgw = 400;		//窗口宽度 
	msgh = 200;		//窗口高度 
	msgbg = "#FFF";			//内容背景
	msgcolor = "#000";		//内容颜色
	bordercolor = "#000"; 	//边框颜色 
	titlecolor = "#FFF";	//标题颜色
	titlebg = "#369";		//标题背景
	//遮罩背景设置  
	var sWidth,sHeight; 
	sWidth = screen.availWidth; 
	if(screen.availHeight > document.body.scrollHeight){
		sHeight = screen.availHeight;	//少于一屏
	}else{
		sHeight = document.body.scrollHeight;	//多于一屏 
	}
	//创建遮罩背景 
	var maskObj = document.createElement("div"); 
	maskObj.setAttribute('id','maskdiv'); 
	maskObj.style.position = "absolute"; 
	maskObj.style.top = "0"; 
	maskObj.style.left = "0"; 
	maskObj.style.background = "#777"; 
	maskObj.style.filter = "Alpha(opacity=30);"; 
	maskObj.style.opacity = "0.3"; 
	maskObj.style.width = sWidth + "px"; 
	maskObj.style.height = sHeight + "px"; 
	maskObj.style.zIndex = "10000"; 
	document.body.appendChild(maskObj); 
	//创建弹出窗口
	var msgObj = document.createElement("div") 
	msgObj.setAttribute("id","msgdiv"); 
	msgObj.style.position ="absolute";
	msgObj.style.top = (screen.availHeight - msgh) / 4 + "px";
	msgObj.style.left = (screen.availWidth - msgw) / 2 + "px";
	msgObj.style.width = msgw + "px";
	msgObj.style.height = msgh + "px";
	msgObj.style.fontSize = "12px";
	msgObj.style.background = msgbg;
	msgObj.style.border = "1px solid " + bordercolor; 
	msgObj.style.zIndex = "10001"; 
	//创建标题
	var thObj = document.createElement("div");
	thObj.setAttribute("id","msgth"); 
	thObj.className = "DragAble";
	thObj.title = "按住鼠标左键可以拖动窗口！";
	thObj.style.cursor = "move";
	thObj.style.padding = "4px 6px";
	thObj.style.color = titlecolor;
	thObj.style.background = titlebg;
	var titleStr = "<a class='close' title='关闭' onclick='CloseMsg()'>关闭</a>"+"<span>"+ title +"</span>";
	thObj.innerHTML = titleStr;
	//创建内容
	var bodyObj = document.createElement("div");
	bodyObj.setAttribute("id","msgbody"); 
	bodyObj.style.padding = "10px";
	bodyObj.style.lineHeight = "1.5em";
	var txt = document.createTextNode(content);
	bodyObj.appendChild(txt);
	//生成窗口
	document.body.appendChild(msgObj);
	$("msgdiv").appendChild(thObj);
	$("msgdiv").appendChild(bodyObj);
}
function CloseMsg(){
	//移除对象
	document.body.removeChild($("maskdiv")); 
	$("msgdiv").removeChild($("msgth")); 
	$("msgdiv").removeChild($("msgbody")); 
	document.body.removeChild($("msgdiv")); 
}


function CLASS_MSN_MESSAGE(id,width,height,caption,title,message,target,action){  
    this.id     	 = id;  
    this.title  	 = title;  
    this.caption	 = caption;  
    this.message	 = message;  
    this.target 	 = target;  
    this.action 	 = action;  
    this.width  	 = width?width:200;  
    this.height 	 = height?height:120;  
    this.timeout	 = 150;  
    this.speed  	 = 20; 
    this.step   	 = 1; 
    this.right  	 = screen.width -1;  
    this.bottom 	 = screen.height; 
    this.left   	 = this.right - this.width; 
    this.top    	 = this.bottom - this.height; 
    this.timer  	 = 0; 
    this.pause  	 = false;
    this.close  	 = false;
    this.autoHide    = true;
}  
  
/**//*  
*    隐藏消息方法  
*/  
CLASS_MSN_MESSAGE.prototype.hide = function(){  
    if(this.onunload()){  
        var offset  = this.height>this.bottom-this.top?this.height:this.bottom-this.top; 
        var me  = this;  
        if(this.timer>0){   
            window.clearInterval(me.timer);  
        }  
        var fun = function(){  
            if(me.pause==false||me.close){
                var x  = me.left; 
                var y  = 0; 
                var width = me.width; 
                var height = 0; 
                if(me.offset>0){ 
                    height = me.offset; 
                } 
     
                y  = me.bottom - height; 
     
                if(y>=me.bottom){ 
                    window.clearInterval(me.timer);  
                    me.Pop.hide();  
                } else { 
                    me.offset = me.offset - me.step;  
                } 
                me.Pop.show(x,y,width,height);    
            }             
        }  
        this.timer = window.setInterval(fun,this.speed)      
    }  
}  
  
/**//*  
*    消息卸载事件，可以重写  
*/  
CLASS_MSN_MESSAGE.prototype.onunload = function() {  
    return true;  
}  
/**//*  
*    消息命令事件，要实现自己的连接，请重写它  
*  
*/  
CLASS_MSN_MESSAGE.prototype.oncommand = function(){  
    //this.close = true;
    this.hide();  
 	window.open("/Member.asp?part=7&parttid=1");
} 

CLASS_MSN_MESSAGE.prototype.oncommand1 = function(){  
    this.hide();  
 	window.open("/Member.asp?part=4&parttid=13");
} 
/**
*    消息显示方法  
*/  
CLASS_MSN_MESSAGE.prototype.show = function(){  
    var oPopup = window.createPopup(); //IE5.5+  
    
    this.Pop = oPopup;  
  
    var w = this.width;  
    var h = this.height;  
  
    var str;
	str = "<DIV style='border:#306ca4 1px solid;z-index:99999;left:0px;width:" + w + "px;position:absolute; top:0px;height:" + h + "px;'>"
    str += "<TABLE cellSpacing='2' cellPadding='0' width='100%' border='0'><TR>"
    str += "<td><div style='background:#def0fe;height:25px;line-height:25px;font-size:12px;padding-left:5px;'><SPAN title=关闭 style='float:right;font-weight:bold;font-size:12px;cursor:pointer;color:red;margin-right:5px;' id='btSysClose'>×</SPAN>"+ this.caption +"</div></td>"
	str += "</TR>"
	str += "<TR>"
    str += "<TD height=" + (h-33) + ">"
    str += "<DIV style='padding:5px;font-size:12px;WIDTH:100%;line-height:22px;color:#1f336b;height:100%;background:#f5fafe;'>" + this.title + "<Br>"  
	str += "<a href='javascript:void(0);' style='color:#ff0000;' hidefocus='false' id='btCommand'>> 会员短消息中心</a><Br><a href='javascript:void(0);' style='color:#ff0000;' hidefocus='false' id='btCommand1'>> 会员订单中心</a><Br>"
	str += "</div>"
    //str += "<A href='javascript:void(0)' hidefocus='false' id='btCommand'><FONT color=#ff0000>" + this.message + "</FONT></A></div>"
    str += "</TD></TR>" 
	str += "</TABLE></DIV>"
	
    oPopup.document.body.innerHTML = str; 
    
    this.offset  = 0; 
    var me  = this;  
    oPopup.document.body.onmouseover = function(){me.pause=true;}
    oPopup.document.body.onmouseout = function(){me.pause=false;}
    var fun = function(){  
        var x  = me.left; 
        var y  = 0; 
        var width    	= me.width; 
        var height    	= me.height; 
            if(me.offset>me.height){ 
                height 	= me.height; 
            } else { 
                height 	= me.offset; 
            } 
        y  = me.bottom - me.offset; 
        if(y<=me.top){ 
            me.timeout--; 
            if(me.timeout==0){ 
                window.clearInterval(me.timer);  
                if(me.autoHide){
                    me.hide(); 
                }
            } 
        } else { 
            me.offset = me.offset + me.step; 
        } 
        me.Pop.show(x,y,width,height);    
    }
  
    this.timer = window.setInterval(fun,this.speed)      
  
    var btClose = oPopup.document.getElementById("btSysClose");  
  
    btClose.onclick = function(){  
        me.close = true;
        me.hide();  
    }
  
    var btCommand = oPopup.document.getElementById("btCommand");  
    btCommand.onclick = function(){  
        me.oncommand();  
    }
	
	var btCommand1 = oPopup.document.getElementById("btCommand1");  
    btCommand1.onclick = function(){  
        me.oncommand1();  
    }
	
}  
/**//* 
** 设置速度方法 
**/ 
CLASS_MSN_MESSAGE.prototype.speed = function(s){ 
    var t = 20; 
    try { 
        t = praseInt(s); 
    } catch(e){} 
    this.speed = t; 
} 
/**//* 
** 设置步长方法 
**/ 
CLASS_MSN_MESSAGE.prototype.step = function(s){ 
    var t = 1; 
    try { 
        t = praseInt(s); 
    } catch(e){} 
    this.step = t; 
} 

CLASS_MSN_MESSAGE.prototype.rect = function(left,right,top,bottom){ 
    try { 
        this.left       = left    	!=null?left:this.right-this.width; 
        this.right      = right    	!=null?right:this.left +this.width; 
        this.bottom     = bottom	!=null?(bottom>screen.height?screen.height:bottom):screen.height; 
        this.top        = top    	!=null?top:this.bottom - this.height; 
    } catch(e){} 
}

//购物车运用
function buy(){   
	var ss = "scrollbars=yes,menubar=yes,resizable=yes,toolbar=yes,location=yes,width=800,height=600,left=155,top=15"
	w = window.open("","buy",ss)
	w.focus();
}

//收藏夹
function favpro(){
	var ss = "scrollbars=yes,menubar=yes,resizable=yes,toolbar=yes,location=yes,width=800,height=600,left=155,top=15"
	w = window.open("","favpro",ss)
	w.focus();
}

//咨询热线
function advisory(){   
	var ss = "scrollbars=yes,menubar=yes,resizable=yes,toolbar=yes,location=yes,width=800,height=600,left=155,top=15"
	w = window.open("","advisory",ss)
	w.focus();
}

//在线报名
function baoMing(){   
	var ss = "scrollbars=yes,menubar=yes,resizable=yes,toolbar=yes,location=yes,width=800,height=600,left=155,top=15"
	w = window.open("","baoMing",ss)
	w.focus();
}

/* 顶部搜索 */
/* 搜索文章 */
function searchArticle(){
	if(gel('TopKeyWord').value==''){
		alert('请输入搜索关键词');
		TopSearch.TopKeyWord.focus();
		return false;
	} else {
		location.href='Search.asp?ClassID=1&keyword='+gel('TopKeyWord').value;
	}
}
/* 搜索产品 */
function searchProduct(){
	if(gel('TopKeyWord').value==''){
		alert('请输入搜索关键词');
		TopSearch.TopKeyWord.focus();
		return false;
	} else {
		location.href='Search.asp?ClassID=2&keyword='+gel('TopKeyWord').value;		
	}
}
/* 搜索企业 */
function searchCompany(){
	if(gel('TopKeyWord').value==''){
		alert('请输入搜索关键词');
		TopSearch.TopKeyWord.focus();
		return false;
	} else {
		location.href='Search.asp?ClassID=3&keyword='+gel('TopKeyWord').value;	
	}
}
/* 医院企业 */
function searchHospital(){
	if(gel('TopKeyWord').value==''){
		alert('请输入搜索关键词');
		TopSearch.TopKeyWord.focus();
		return false;
	} else {
		location.href='Search.asp?ClassID=4&keyword='+gel('TopKeyWord').value;	
	}
}

/* 顶部搜索 */

/* 图片放大层效果 */
//根据ID获取页面元素
function getObject(objectId) {
     if(document.getElementById && document.getElementById(objectId)) {
       // W3C DOM
       return document.getElementById(objectId);
     } 
     else if (document.all && document.all(objectId)) {
       // MSIE 4 DOM
       return document.all(objectId);
     } 
     else if (document.layers && document.layers[objectId]) {
       // NN 4 DOM.. note: this won't find nested layers
       return document.layers[objectId];
     } 
     else {return false;}
}

//e为元素对象,获得此元素的左上角坐标(x,y)和宽、高
function   getAbsPoint(e){  
    var x = e.offsetLeft;
	var y = e.offsetTop;	
	var w = e.clientWidth; 
	var h = e.clientHeight; 
	while(e=e.offsetParent){
       x += e.offsetLeft;  
       y += e.offsetTop;
    }
	return x+'|'+y+'|'+w+'|'+h;	
    //alert(x+'---'+y+'---'+h+'---'+w);    
}  

// 释放层
function close_layer(){
	if(getObject('layers')){getObject('layers').parentNode.removeChild(getObject('layers'));}
}

//创建并显示层
function   show_layer(objs){   
	close_layer(); 
	//读取图片绝对坐标
	var xy=getAbsPoint(objs).split('|');
	var x=parseInt(xy[0].replace('px',''));
	var y=parseInt(xy[1].replace('px',''));
	var w=parseInt(xy[2].replace('px',''));
	var h=parseInt(xy[3].replace('px','')); 
	var ww=w+260;
	//当坐标大于窗口宽高度时强制在一位置显示
	if(x>document.body.clientWidth-ww){
		x=document.body.clientWidth-300
		y=y+h;
	}else{
		x=x+w+15;
	}
	//创建div层    
	var div = document.createElement("div");   
	div.id = "layers";     
	div.className = 'bigpic';
	div.style.top = y+"px";   
	div.style.left = x+"px";
	div.innerHTML = '<div onmouseleave="close_layer();"><span class="arrow"></span><a target="_blank" id="bb"></a></div>'
	document.body.appendChild(div);   
	getObject('bb').className="loading";
	getObject('bb').innerHTML='<img src='+objs.src+'>';
	getObject('bb').className="";
}
/* 图片放大层效果 */

function CheckReplyHelp(TheForm){
	if(TheForm.UName.value==''){
		alert('请输入回复人姓名');
		TheForm.UName.focus();
		return false;
	}
	var reg    	= new RegExp("^[0-9]+$","");
	var userAge = TheForm.Age.value;
	if(userAge<1 || userAge>100 || !reg.test(userAge)){
		alert('请输入年龄且必须为数字');
		TheForm.Age.focus();
		return false;
	}
	var userTel 	= TheForm.Tel.value;
	var reTel   	= new RegExp("^[-0-9]+$","");
	if(userTel==''){
		alert('请输入联系电话');
		TheForm.Tel.focus();
		return false;
	} else if(!reTel.test(userTel)) {
		alert('格式出错！电话格式：021-29726179或者11位手机号码');
		TheForm.Tel.focus();
		return false;
	}
	if(TheForm.Address.value==''){
		alert('请输入联系地址');
		TheForm.Address.focus();
		return false;
	}
	var userEmail = TheForm.Email.value;
	var reEmail = /^([a-zA-Z0-9_\.-]+)@(([a-zA-Z0-9_-]+)\.)+[a-zA-Z]{2,3}$/;
	if(TheForm.Email.value==''){
		alert('请输入电子邮件');
		TheForm.Email.focus();
		return false;
	} else if(!reEmail.test(userEmail)){
		alert('电子邮件格式出错');
		TheForm.Email.focus();
		return false;
	}
	if(TheForm.Symptoms.value==''){
		alert('请输入初步估计诊断');
		TheForm.Symptoms.focus();
		return false;
	}
	if(TheForm.Code.value==''){
		alert('请输入验证码');
		TheForm.Code.focus();
		return false;
	}
	if(!this.checkCode){return false;}
}

function checkListSearch(TheForm){
	if(TheForm.listkeyword.value==''){
		alert('请输入搜索关键词');
		TheForm.listkeyword.focus();
		return false;
	}
}

function GuShiBtn(bNum){
	for(var j=1;j<3;j++){
		$('GSBtn'+j).style.background		= '';
		$('GSBtn'+j).style.fontWeight		= 'normal';
		$('zhengquanpic'+j).style.display	= 'none';
	}
	$('GSBtn'+bNum).style.background		= '#ffffff';
	$('GSBtn'+bNum).style.fontWeight		= 'bold';
	$('zhengquanpic'+bNum).style.display	= '';
}

/* 广告位公共js函数 */
var ad_gourl;
var ad_title;
var now 	= new Date();
var year 	= now.getYear();
var month	= now.getMonth()+1;
var day 	= now.getDate();
var d2 		= new Date(year+'/'+month+'/'+day);
/* 广告位公共js函数 */