// JavaScript Document
var listType = 0;
var loginNum = 0;
var isLogined;

function checkT(str){
	return /^[0-6]+$/.test(str);
}

function getArgs(){
	var sA = location.search.toLowerCase().split("?t=");
	if(2!=sA.length) return;
	if(!checkT(sA[1].substr(0,1))) return;
	listType = sA[1].substr(0,1);
}
//getArgs();

function userLoginShow(){
	if(!isLogined){
		document.write("&nbsp;&nbsp;<a href=\"/yreg.htm\" target=\"_blank\">注册医生会员</a>");
		document.write("&nbsp;&nbsp;<a href=\"/preg.htm\" target=\"_blank\">注册普通会员</a>");
	}
}

function checkusercookies(){
	var cstr,name,pos,start,end,temp,i;
	cstr = document.cookie.replace(/\s/ig,"");
	temp = (cstr.length - cstr.replace(/ask1user1userid=/ig,"").length)/16;
	name = "ask1user1userid=";
	
	for(i=0;i<temp;i++){
		var pos = cstr.indexOf(name,cstr.indexOf(name)*i+15*i);
		if(-1!=pos){
			start = pos + name.length;
			end = cstr.indexOf(";",start);
			if(-1==end) end = cstr.length;
			if(""!=cstr.substring(start,end)) return true;
		}
	}
	return false;
}

function getCookie(cn){
    var dc=document.cookie;
    var prefix=cn+"=";
    var begin=dc.indexOf("; "+prefix);
    if(begin==-1){
        begin=dc.indexOf(prefix);
        if(begin!=0)return null;
    }
    else{
        begin+=2;
    }
    var end=document.cookie.indexOf(";",begin);
    if(end==-1){
        end=dc.length;
    }
    return unescape(dc.substring(begin+prefix.length,end));
}

function ASKLOGINCOMMONCHECK(){
	if(""==TRIM(document.getElementById("username"+loginNum).value)){
		alert("请填写会员名！");
		document.getElementById("username"+loginNum).focus();
		return false;
	}
	if(""==TRIM(document.getElementById("userpass"+loginNum).value)){
		alert("请填写会员密码！");
		document.getElementById("userpass"+loginNum).focus();
		return false;
	}
	return true;
}

function SHOWLOGIN(){
	if(document.getElementById("loginpage"+loginNum).style.visibility=="hidden"){
		document.getElementById("loginTable"+loginNum).style.display="";
		document.getElementById("loginpage"+loginNum).style.visibility="visible";
		document.getElementById("Layer1"+loginNum).style.visibility="visible";
		document.getElementById("coveriframe"+loginNum).height=document.body.scrollHeight;
		document.getElementById("coveriframe"+loginNum).width=document.body.scrollWidth;
	}else{
		document.getElementById("loginpage"+loginNum).style.visibility="hidden";
		document.getElementById("Layer1"+loginNum).style.visibility="hidden";
		document.getElementById("loginTable"+loginNum).style.display="none";
	}
}