	function sn(n)
	{
		for (i=2;i<=16;i+=2) {
			if (i == n) {
			getObject("z1_"+i).className="xyl4 lh22 bg01";
			getObject("z1_"+(i-1)).style.display="none"
			getObject("z1_"+(i+1)).style.display="none"
			if(n!=2) getObject("z1_1").style.display=""
			}
			else
			{
			getObject("z1_"+i).className="xyl1 lh22";
			getObject("z1_"+(i+1)).style.display=""
			}
		}
		if( n == 2)
			getObject('searchFM').action = "/alusearch/school_search.jsp";
		else if(n == 4)
			getObject('searchFM').action = "/alusearch/class_search.jsp";
		else if(n == 6)
			getObject('searchFM').action = "/alusearch/cm_search.jsp";
		else
			getObject('searchFM').action = "/alusearch/msg_search.jsp";
		
	}
	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;
    }
}

	function menu(n) {
		var menutab = new Array ("menutab1","menutab2","menutab3")
		var mt = new Array ("mt1","mt2","mt3")
		for (var i=0;i<=3;i++) {
			if (i==n) {
				getObject(mt[i]).className="menubg a"
				getObject(menutab[i]).style.display=""
			}else
			{
				getObject(mt[i]).className="b"
				getObject(menutab[i]).style.display="none"
			}
		}
		
	}

function highlight(which,color){
	if (document.all||document.getElementById)
	which.style.backgroundColor=color
}

function extmenu(menuname,id){
	{   if ( menuname.style.display=="none" )
		{  menuname.style.display=""
			eval("peak"+id+".src=''")
		}
		else
		{  menuname.style.display="none"
			eval("peak"+id+".src='';")
		}
	}
}

function showLifes(parentid) {
	var lifesDiv = getObject('lifesDiv');
	if(lifesDiv.style.display == 'none'){
		var lifesImg = getObject(parentid);	
		lifesDiv.style.left = (findPosX(lifesImg)-80)+"px";
		lifesDiv.style.top = (findPosY(lifesImg)+5)+"px";
		lifesDiv.style.display = '';
	}else{
		lifesDiv.style.display = 'none';	
	}
}
function findPosX(obj) {
	var curleft = 0;
	if (obj.offsetParent) {
		while (obj.offsetParent) {
			curleft += obj.offsetLeft;
			obj = obj.offsetParent;
		}   
	} else if (obj.x) curleft += obj.x;
	return curleft;
}   
function findPosY(obj) {
	var curtop = 0;
	if (obj.offsetParent) {
		while (obj.offsetParent) {
			curtop += obj.offsetTop;
			obj = obj.offsetParent;
		}   
	} else if (obj.y) curtop += obj.y;
	return curtop;
}
function openwindow(url,name,w,h) {
	window.open(url,name,"top=150,left=300,width="+w+",height="+h+",toolbar=no,menubar=no,titlebar=no,scrollbars=no,resizable=no,center:yes");
}

function browserDetect(){
	var sUA = navigator.userAgent.toLowerCase();
	var sIE = sUA.indexOf("msie");
	var sOpera = sUA.indexOf("opera");
	var sMoz = sUA.indexOf("gecko");
	if (sOpera != -1) return "opera";
	if (sIE != -1){
		nIeVer = parseFloat(sUA.substr(sIE + 5));
		if (nIeVer >= 6) return "ie6";
		else if (nIeVer >= 5.5) return "ie55";
		else if (nIeVer >= 5 ) return "ie5";
	}
	if (sMoz != -1)	return "moz";
	return "other";
};
function isIE(){return browserDetect().indexOf('ie') > -1;};

var Browser = new Object();
Browser.isIE = window.ActiveXObject ? true : false;


function getIcon() {
	var ret = openDialog('','upicon','440','470');
	if(ret!=undefined) {
		$('iconimg').src  = ret + "?v=" + Math.floor(100 * Math.random() + 1);
	}
}

function openChat(classuuid){
	window.open('?classuuid='+classuuid,'','top=0,left=0,toolbar=0,status=1,location=0,menubar=0,scrollbars=1,resizable=1,width='+(screen.availWidth-10)+',height='+(screen.availHeight-50));
}
function setCookie(c_name,value,expiredays)
{
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie=c_name+ "=" +escape(value)+
		((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}
function getCookie(c_name)
{
	if (document.cookie.length>0)
	{
		c_start=document.cookie.indexOf(c_name + "=");
		if (c_start!=-1)
		{ 
			c_start=c_start + c_name.length+1 ;
			c_end=document.cookie.indexOf(";",c_start);
			if (c_end==-1) c_end=document.cookie.length;
			return unescape(document.cookie.substring(c_start,c_end));
		} 
	}
	return "";
}
function getClassCookie()
{
	username=getCookie('class_search');
	if (username!=null && username!=""){
		var classuuid = username.split(",");
		for(var i=0;i<classuuid.length;i++){
			if(classuuid[i]!='null')
				document.write(classuuid[i]+"<br>");
		}
	}
}




function setClassCookie(cid)
{
	if(cid == '') return;
	username=getCookie('class_search');
	var v = cid;
	if (username!=null && username!=""){
		if(username.indexOf(","+cid)>=0) return;
		var classuuid = username.split(",");
		for(var i=0;i<classuuid.length && i < 9 ;i++){
			v += "," + classuuid[i] ;
		}
	}
	setCookie('class_search',v,3000);
}
function adjustImg(src) {try{ var iw=400; if(screen.width==1024) iw=450; if(src.width>iw) src.width=iw;}catch(e){}}


//add by shichq 20071205
//the length of the string 
String.prototype.strLen=function(){
	var len=0;
	var charStr;
	for(var i=0;i<this.length;i++){
		charStr=this.charCodeAt(i);
		if(charStr>127){
			len=len+2;
		}else{
			len=len+1;
		}
	}
	return len;
}

//Add by ShiChq on date of 2007.11.5
//Email:xiaoshi0201@sohu.com
//trim
String.prototype.trim=function()
{return this.replace(/(^\s*)|(\s*$)/g,"");}

function getPath( obj ){
  if( obj ){
    if( window.navigator.userAgent.indexOf("MSIE") >=1 ){
      obj.select();
      return document.selection.createRange().text;
    }
    else if( window.navigator.userAgent.indexOf("Firefox") >=1 ){
        if(obj.files){
          return obj.files.item(0).getAsDataURL();
        }
        return obj.value;
      }
    return obj.value;
  }
}  