String.prototype.trim=function(){return this.replace(/(^\s*)|(\s*$)/g,"");}
String.prototype.getBytes=function(){var cArr=this.match(/[^\x00-\xff]/ig);return this.length+(cArr==null?0:cArr.length);}
Function.prototype.bind=function(scope){var _function=this;return function(){return _function.apply(scope,arguments);}}
function $(o){return document.getElementById(o);}
function $C(searchClass,node,tag){var classElements=new Array();if(node==null)node=document;if(tag==null)tag='*';var els=node.getElementsByTagName(tag);var elsLen=els.length;var pattern=new RegExp("(^|\\s)"+searchClass+"(\\s|$)");for(i=0,j=0;i<elsLen;i++){if(pattern.test(els[i].className)){classElements[j]=els[i];j++;}}return classElements;}
function addEvent(evt,callback){
	if (window.addEventListener) {
        window.addEventListener(evt, callback, false); 
    } else if (window.attachEvent) {
        window.attachEvent("on" + evt, callback);
    }
}
DOMReady = function(f){
	if(typeof f != "function") return; 
	DOMReady.functions = DOMReady.functions || [];
	DOMReady.functions.push(f);
	return DOMReady.checkReady();
};
DOMReady.checkReady = function(){
	if(document && document.getElementsByTagName && document.getElementById && document.body){
		while(DOMReady.functions[0])DOMReady.functions.shift()();
	}else{
		setTimeout("DOMReady.checkReady()",10);
		return null;
	}
}

/* ajax */
function postAjax(url, callback, data)
{
    url += url.indexOf("?") >= 0 ? "&" : "?";
    url += "rd=" + Math.random();
    if (typeof data == 'undefined')
    {
        var data = null;
    }
    method = 'POST';
	
	if (window.XMLHttpRequest)
	{
		var objXMLHttpRequest = new XMLHttpRequest();
	}
	else
	{
		var MSXML = ['MSXML2.XMLHTTP.6.0', 'MSXML2.XMLHTTP.3.0', 'MSXML2.XMLHTTP.5.0', 'MSXML2.XMLHTTP.4.0', 'MSXML2.XMLHTTP', 'Microsoft.XMLHTTP'];
		for(var n = 0; n < MSXML.length; n ++)
		{
			try
			{
				var objXMLHttpRequest = new ActiveXObject(MSXML[n]);        
				break;
			}
			catch(e)
			{
			}
		}
	}
	
    with(objXMLHttpRequest)
    {
        try
        {
            open(method, url, true);
            if (method == 'POST')
            {
                setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8');
            }
            
            send(data);         
			
        }
        catch(e)
		{
			alert(e);
        }
        onreadystatechange = function()
        {
            if (objXMLHttpRequest.readyState == 4)
            {
                callback(objXMLHttpRequest.responseText, objXMLHttpRequest.status);
				delete(objXMLHttpRequest);
            }
        }
    }
}


// 新窗口打开
function own() {
 if (!document.getElementsByTagName) return;
	 var anchors = document.getElementsByTagName("a");
	 for (var i=0; i<anchors.length; i++) {
	   var anchor = anchors[i];
	   if (anchor.getAttribute("href") &&
		 //  anchor.getAttribute("rel") == "external")
			anchor.getAttribute("href") != "javascript:;"
	   )
		 anchor.target = "_blank";
	 }
}

// 浮动跟随
function afollow(){
	/*
	if( document.getElementById('bar') ) {
		document.getElementById('bar').style.top = document.documentElement.scrollTop + document.documentElement.clientHeight - 32 + 'px';	
	}
	if( document.getElementById('leftbar') ) {
		document.getElementById('leftbar').style.top = document.documentElement.scrollTop + 135 +'px';	
	}*/
	
	if( document.getElementById('leftqq') ) {
		document.getElementById('leftqq').style.top = document.documentElement.scrollTop + document.documentElement.clientHeight - (35 + 210) + 'px';	
	}
	if( document.getElementById('leftpanel') ) {
		document.getElementById('leftpanel').style.top = document.documentElement.scrollTop + document.documentElement.clientHeight - (35 + 210 + 400) + 'px';	
	}
}
/** **/
function checkCalls(){
	//   agrIdea
	var name=document.getElementById("name");
	var tel = document.getElementById("tel");
	var yytime = document.getElementById("yytime");
	if(name.value.trim()==""){
		alert("请输入姓名或称呼！");
		name.value=""; name.focus();
		return false;
	}
	if(tel.value.trim()==""){
		alert("请输入联系电话！");
		tel.value=""; tel.focus();
		return false;
	}
	if(yytime.value.trim()==""){
		alert("请输入来院时间！");
		yytime.value=""; yytime.focus();
		return false;
	}
}

function downover(){document.getElementById('leftpanelimg').style.display='none';document.getElementById('yypanel').style.display='block';var t = document.getElementById('leftpanel');t.style.width='200px';t.style.height='400px';}

function downout(){document.getElementById('leftpanelimg').style.display='block';var t = document.getElementById('leftpanel');t.style.width='40px';t.style.height='160px';}


function floats(){
	
	var leftqq = document.createElement("div");
	leftqq.setAttribute('id','leftqq');
	leftqq.style.position = 'fixed';
	leftqq.style.bottom = '35px';
	leftqq.style.left = '0px';
	leftqq.style.width = '145px';
	leftqq.style.height = '210px';
	leftqq.style.overflow = 'hidden';
	leftqq.style.zIndex = '9999';
	leftqq.innerHTML = '<object data="/images/leftqq.swf" type="application/x-shockwave-flash" width="145" height="210"><param name="movie" value="/images/leftqq.swf" /><param name="wmode" value="transparent" /></object>';	
	document.body.appendChild(leftqq);document.body.appendChild( document.createElement("div") );
	/**/
	var leftpanel = document.createElement("div");
	leftpanel.setAttribute('id','leftpanel');
	leftpanel.style.position = 'fixed';
	leftpanel.style.bottom = '240px';
	leftpanel.style.left = '0px';
	leftpanel.style.width = '40px';
	leftpanel.style.height = '160px';
	leftpanel.style.zIndex = '9999';
	leftpanel.style.overflow = 'hidden';
	
	leftpanel.onmouseover = function(){downover();}
	//leftpanel.onmouseout = function(){downout();}

	leftpanel.innerHTML = '<img id="leftpanelimg" src="/images/leftpanel.gif" /><div id="yypanel" style="width:200px;height:400px;background:url(/images/yuyuebg.gif)"><div style="with:200px;height:60px;text-align: right;"><a onclick="downout();"><img src="/images/7.gif" width="11" height="11" style="cursor: pointer;"></a></div><div style="margin-left:5px;"><form name="form1" method="post" action="http://www.0792120.com/plus/yuyue.php" onsubmit="return checkCalls();"><input type="hidden" name="dopost" value="save"><table width="100%"  border="0" cellspacing="1" cellpadding="3"><tr><td height="25">姓名</td><td><input name="name" type="text" id="name" value="" size="20" class="ipt-txt">*</td></tr><tr> <td height="25">性别</td><td><input name="sex" type="radio" id="sex" value="1" class="ipt-txt" checked="checked">男<input name="sex" type="radio" id="sex" value="0" class="ipt-txt">女</td></tr><tr> <td height="25">年龄</td><td><input name="age" type="text" id="age" size="20" class="ipt-txt"></td></tr><tr><td height="25">电话</td><td><input name="tel" type="text" id="tel" size="20" class="ipt-txt">*</td></tr><tr><td height="25">时间</td><td><input name="yytime" type="text" id="yytime" size="20" class="ipt-txt">*</td></tr><tr><td height="25">地址</td><td><input name="address" type="text" id="address" size="20" class="ipt-txt"></td></tr><tr><td height="25">QQ</td><td><input name="qq" type="text" id="qq" size="20" class="ipt-txt"></td></tr><tr><td height="25">科室</td><td> <select name="pid" id="pid" ><option value="1">男科</option><option value="2">妇科</option><option value="3">肛肠科</option><option value="4">腋臭科</option><option value="5">肝病科</option><option value="6">性功能障碍</option><option value="7">生殖整形</option><option value="8">前列腺炎</option><option value="9">生殖感染</option><option value="10">男性不育</option><option value="11">泌尿男科</option><option value="12">意外怀孕</option><option value="13">妇科炎症</option><option value="14">宫颈疾病</option><option value="15">卵巢疾病</option><option value="16">私处整形</option><option value="17">女性不孕</option><option value="18">微创妇科</option><option value="19">其他疾病</option></select></td></tr><tr><td height="25">详情</td><td><textarea name="msg" cols="15" rows="3" id="msg" class="ipt-txt" style="height:70px;"></textarea></td></tr><tr><td height="25"></td><td><input type="submit" name="Submit" value=" 提 交 " class="btn-2"><input type="reset" name="Submit" value=" 重 置 " class="btn-2"></td></tr></table></form></div></div>';

	document.body.appendChild(leftpanel);document.body.appendChild( document.createElement("div") );
	if( navigator.userAgent.indexOf("MSIE 6") != -1 ){
		/*if( document.getElementById('bar') ) document.getElementById('bar').style.position  = 'absolute';
		if( document.getElementById('leftbar') ) document.getElementById('leftbar').style.position  = 'absolute';*/
		if( document.getElementById('leftqq') ) document.getElementById('leftqq').style.position  = 'absolute';
		if( document.getElementById('leftpanel') ) document.getElementById('leftpanel').style.position  = 'absolute';
		addEvent('scroll',afollow);
		addEvent('resize',afollow);
	}
}

function init(){
	floats(); // 浮标
	downover();
}

DOMReady(init);
