﻿// JavaScript Document

var isIE=(document.all&&document.getElementById&&!window.opera)?true:false; 
var isMozilla=(!document.all&&document.getElementById&&!window.opera)?true:false; 
var isOpera=(window.opera)?true:false;
var seturl='url(#default#homepage)';
var weburl='http://www.0769woman.com';
var webname='东莞妇科网';

function setHomepage()
{	if(isMozilla){
		try {netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");} 
		catch (e){alert("此操作被浏览器拒绝！\n请在浏览器地址栏输入“about:config”并回车\n然后将[signed.applets.codebase_principal_support]设置为'true'");}
		var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
		prefs.setCharPref('browser.startup.homepage',weburl);
	}
	if(isIE){
		this.homepage.style.behavior=seturl;this.homepage.sethomepage(weburl); 
	}
}

function addfavorite()

{
	if(isMozilla){
		if (document.all){ window.external.addFavorite(weburl,webname);}
		else if (window.sidebar){ window.sidebar.addPanel(webname, weburl,"");}
	}
	if(isIE){window.external.AddFavorite(weburl, webname);}	
}


 function OnSearchSubmit(nodeid)
{
   var keyword=document.getElementById("Keyword"+nodeid).value;
   if(keyword==''||keyword==null||keyword=='填写您想搜索的关键词')
  {
      alert("请填写您想搜索的关键词");
       return ;
    }else{
    if(nodeid==0){window.location="/search.aspx?searchtype=0&Keyword="+escape(keyword);
    }    else{window.location="/search.aspx?searchtype=1&ModelId=1&nodeid="+nodeid+"&Keyword="+escape(keyword)+"&fieldOption=title";}
    }
}

 function OnSearchSubmits(nodeid)
{
   var keyword=document.getElementById("Keyword"+nodeid).value;
   if(keyword==''||keyword==null||keyword=='填写您想搜索的关键词')
  {
      alert("请填写您想搜索的关键词");
       return ;
    }else{
                           
         window.location=" /search.aspx?searchtype=1&ModelId=1&nodeid="+nodeid+"&Keyword="+escape(keyword)+"&fieldOption=title";
    }
}

function openwin(QQ,title){
var Win=window.open('http://wpa.qq.com/msgrd?V=1&amp;Uin='+QQ+'&amp;Site=东莞国境口岸医院-'+title+'&amp;Menu=yes');
  Win.opner=document.window;
  Win.focus();
  }

function settab(name,cursel,n){
 for(i=1;i<=n;i++){
  var menu=document.getElementById(name+i);
  var con=document.getElementById(""+name+"_"+i);
  menu.className=i==cursel?"hover":"";
  con.style.display=i==cursel?"block":"none";
 }
}

function ntabs(thisObj,Num){
if(thisObj.className == "active")return;
var tabObj = thisObj.parentNode.id;
var tabList = document.getElementById(tabObj).getElementsByTagName("li");
for(i=0; i <tabList.length; i++)
{
 if (i == Num)
 {
 thisObj.className = "active";
 document.getElementById(tabObj+"_content"+i).style.display = "block";
 }else{
 tabList[i].className = "normal";
 document.getElementById(tabObj+"_content"+i).style.display = "none";
 }
}
}

//双击鼠标滚动屏幕的代码
var currentpos,timer;
getViewPortScrollY = function()
{
    var scrollY = 0;
    if ((document.documentElement) && (document.documentElement.scrollTop))
    {
        scrollY = document.documentElement.scrollTop;
    }
    else if ((document.body) && (document.body.scrollTop))
    {
        scrollY = document.body.scrollTop;
    }
    else if (window.pageYOffset)
    {
        scrollY = window.pageYOffset;
    }
    else if (window.scrollY)
    {
        scrollY = window.scrollY;
    }
    return scrollY;
}; 
function initialize()
{
timer=setInterval ("scrollwindow ()",30);
}
function sc()
{
clearInterval(timer);
}
function scrollwindow()
{
currentpos=getViewPortScrollY();
window.scroll(0,++currentpos);
if (currentpos !=getViewPortScrollY())
sc();
}
document.onmousedown=sc;
document.ondblclick=initialize;


/*
objs:要修改样式的元素
index:当前要修改的索引
count:同类型的元素的长度
value:已选择的元素的value
objs2:需更改显示方式的元素
reversible:标识点击一个已选定元素时,是否将它还原
*/
function tab(objs,index,count,value,objs2,reversible){
    tab_SetStyle(objs,index,count,value,reversible);
    tab_SetDisp(objs2,index,count,reversible);                           
}

function tab_SetStyle(objs,index,count,value,reversible){
	if(value==""||count==0)
		return;
	
    var objAry = objs.split("|");
    var values = value.split("|");
    //未实现多元素

    for(var i=0;i<objAry.length;i++){
		var prop = "className",vIndex = 0;

		if(values[i].indexOf("$")!=-1){	//设置对指定属性设定值
			prop = values[i].split("$")[0];
			vIndex = 1;
		}

		var selected = (eval("$(objAry[i]+index)."+prop) == values[i].split("$")[vIndex]);

		if(selected && !reversible)
			return;
		
		var falseValue = "";
		for(var j=1;j<=count;j++){
			if($(objAry[i]+j) == null)
				continue;
			if(eval("$(objAry[i]+j)."+prop) != values[i].split('$')[vIndex])
				falseValue = eval("$(objAry[i]+j)."+prop);
		}
		
        for(var j=1;j<=count;j++){
			if($(objAry[i]+j) == null)
				continue;
            eval("$(objAry[i]+j)."+prop+"=falseValue;");
        }
        
		if(!reversible || !selected)
			eval("$(objAry[i]+index)."+prop+"=values[i].split('$')[vIndex];");
    }
}

function tab_SetDisp(objs,index,count,reversible){
	if(count==0) return;
	if(objs == null || objs == "") return;
    var objAry = objs.split("|");
    if($(objAry[0]+index) == null)
		return;
    var temp = $(objAry[0]+index).style.display;
    var selected = (temp == "block" || temp == "");
    if(selected && !reversible)
		return;

    for(var i=0;i<objAry.length;i++){	
        for(var j=1;j<=count;j++){
			if($(objAry[i]+j) == null)
				continue;
            $(objAry[i]+j).style.display = "none";
        }
        if(!reversible || !selected)
			$(objAry[i]+index).style.display = "block";
    }
}

function $(){
return document.getElementById(arguments[0]);
}


var Invite_ToRight=1;
var Invite_left=10;
var Invite_ToBottom=1;
var Invite_top=10;
var LiveAutoInvite0='您好，来自%IP%的朋友'; 
var LiveAutoInvite1='来自首页自动邀请的对话';
var LiveAutoInvite2='<B><FONT color=#ff0000>网络预约全院治疗费、手术费减免30%！</FONT></B><BR><FONT color=#ff00ff>1.国际男科生殖健康公益普查活动：男科10大项男科检查费全免。</FONT><BR><FONT color=#ff00ff>2.2010年健康心愿年活动：<br>a.白带常规、乳腺手诊、巴氏涂片、子宫附件B超、阴道镜检查全免.b.乙肝五项、肝功能、彩超费用全免.c.肛肠科专家检查费全免.d.耳鼻喉科专家检查费全免。</FONT><BR>温馨提示:<BR>如果您有任何的健 康疑问，请接受此邀请。医院权威专家将为您在线免费解答，并为您的隐 私保密！<FONT color=#ff0000>健康咨询QQ：139500120</FONT>';
var LrinviteTimeout=15;