a = 4 
var slump = Math.random();
var talet = Math.round(slump * (a-1))+1;
function create(){this.src = '';} 

b = new Array()
for(var i=1; i<=a; i++) { b[i] = new create(); }

b[1].src = "/WebSkin/default/head1.css";
b[2].src = "/WebSkin/default/head2.css";
b[3].src = "/WebSkin/default/head3.css";
b[4].src = "/WebSkin/default/head4.css";

var visa = "";
visa += b[talet].src;

function SetCookie(name,value){
  var argv=SetCookie.arguments;
  var argc=SetCookie.arguments.length;
  var expires=(2<argc)?argv[2]:null;
  var path=(3<argc)?argv[3]:null;
  var domain=(4<argc)?argv[4]:null;
  var secure=(5<argc)?argv[5]:false;
  document.cookie=name+"="+escape(value)+((expires==null)?"":("; expires="+expires.toGMTString()))+((path==null)?"":("; path="+path))+((domain==null)?"":("; domain="+domain))+((secure==true)?"; secure":"");
} 

//改变字体的大小，有大、小、中
function doZoom(z){
  if("14"==z){
    document.getElementById("zoom").style.fontSize="1.2em";
	document.getElementById("zoom").style.lineHeight="1.6em";
  }else if("16"==z){
	document.getElementById("zoom").style.fontSize="1.4em";
	document.getElementById("zoom").style.lineHeight="1.8em";
  }else{
	document.getElementById("zoom").style.fontSize="1.0em";
	document.getElementById("zoom").style.lineHeight="1.4em";
  }
}

function externalLinks() {
  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.target = "_blank";
  }
}

function TopicDeleteReco(IdList){
    if(IdList == "") return false;
    if(confirm("MM"))
    {
        self.location.href = "/TM_CMS/Resource_Process.aspx?Work=DeleteReco&IdList=" + IdList;
    }else{
        return false;
    }
}

function OpenWin(win,url,w,h)
{
    parameter = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width="+w+",height="+h+"";
    return window.open(url,win,parameter);
}

function AjaxObj(){
  var A=null; 
  try { 
  A=new ActiveXObject("Msxml2.XMLHTTP"); 
  }catch(e){ 
    try{ 
      A=new ActiveXObject("Microsoft.XMLHTTP"); 
    }catch(oc){ 
      A=null;
    } 
  } 
  if ( !A && typeof XMLHttpRequest != "undefined" ) { A=new XMLHttpRequest(); } 
  return A 
}


function AjaxOnload(url,innerID){
  var http = AjaxObj();
  http.open("GET",url,false);
  http.setRequestHeader("If-Modified-Since","0");
  http.send(null);
  var str = http.responseText;
  document.getElementById(innerID).innerHTML = str;
}


function ShowClassMenu(num,sum,type){
if (type==1){
	for (i=1;i<sum+1;i++){
		if (i==num){
            document.getElementById('ClassMenu' + i).style.display="block";
		}else{
            document.getElementById('ClassMenu' + i).style.display="none";
		}
	}
	return false;
}else{
	for (i=1;i<sum+1;i++){
		if (i==num){
	    	if (document.getElementById('ClassMenu' + i).style.display=="none"){
                document.getElementById('ClassMenu' + i).style.display="block";
		    }else{
                document.getElementById('ClassMenu' + i).style.display="none";
			}
		}
	}
	return false;
}
}

//Flash输出
function SWFObject(s,w,h){
  document.writeln("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0' width='"+w+"' height='"+h+"' title=''>");
  document.writeln("<param name='movie' value='"+s+"' />");
  document.writeln("<param name='quality' value='high' />");
  document.writeln("<param name='wmode' value='transparent' />");
  document.writeln("<embed src='"+s+"' quality='high' wmode='transparent' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='"+w+"' height='"+h+"'></embed>");
  document.writeln("</object>");
}


//当用户登录后，在页头提示的欢迎信息
function GetTimeShowMSg(){
  now = new Date(),hour = now.getHours()
  if(hour < 12){
    document.write("Good morning!")
  }else if(hour < 17){
    document.write("Good afternoon!")
  }else if(hour < 24){
	document.write("Good evening!")
  }else{
	document.write("Have a rest!")
  }
}


//页头下拉菜单控制
function showMenulist(m,k,s){
  var list1=document.getElementById("menulist0");
  var list2=document.getElementById("menulist1");
  if(0==m){
    if("sh"==s){
      k.className="liover";
	  list1.style.display="block";
	}else{
	  k.className="";
	  list1.style.display="none";
	}
  }
  if(1==m){
    if("sh"==s){
      k.className="liover";
	  list2.style.display="block";
	}else{
	  k.className="";
	  list2.style.display="none";
	}
  }
}

function autoHeightMen(){
  //页面高度自适应浏览器高度，页尾自动底部
  if(document.body.clientHeight<document.documentElement.clientHeight){
	 document.getElementById("main").style.height=(document.documentElement.clientHeight-291)+"px"; 
  }
}
//页面加载时就执行的函数
function autoLoadF(){
  externalLinks();
  autoHeightMen();
}
window.onload=autoLoadF;
