//<![CDATA[
//AUTHOR:JULLYCAT(ZHANGYANJUN)
$=function(id){
	return document.getElementById(id);
}

var num=5;
 function ww(str,id)
 {
    for(var i=0;i<5;i++)
	{
	    document.getElementById(str+i).style.display="none";
	}
	
    document.getElementById(str+id).style.display="block";
 }

/**�Զ�����������
 * @param {Object} namespace �Զ�������
 */
Namespace = new Object();
Namespace.register = function(namespace){
	var nsArray = namespace.split('.');
	var sEval = "";
    var sNS = "";
	for (var i = 0; i < nsArray.length; i++){
        if (i != 0) sNS += ".";
        sNS += nsArray[i];
        sEval += "if (typeof(" + sNS + ") == 'undefined') " + sNS + " = new Object();"
    }
    if (sEval != "") eval(sEval);
}

/**
 * ������Array����)չunite������
 * @method unite ����concat����FF��֧��concat��
 * @param (arg) arg����Ҫ��ӵ��������
 */
Array.prototype.unite = function(arg){
	var temparg = new Array();
	var len1 = this.length;
	var len2 = arg.length;
	for(var i=0;i<(len1+len2);i++){
		if(i<len1) this[i] = this[i];
		else this[i] = arg[i-len1];
	}
	return this;
}

/**
 * ������)չadd����.
 * @method add ����push,��Ҫ��ӵ�Ԫ��ͬԪ������бȽϣ����û����ֵͬ��׷�ӣ��������׷��;
 * @param {Object} obj ��Ҫadd�Ķ���.
 */
Array.prototype.add = function(obj){
	var add_flag = true;
	for(var i=0;i<this.length;i++){
		if(this[i]==obj){
			add_flag = false;
			break;
		}
	}
	if(add_flag==true){
		this[this.length] = obj;
	}
}

Namespace.register("Hc.widget.cookie");
Namespace.register("Hc.widget.movebox");
Namespace.register("Hc.util.setDiv");
Namespace.register("Hc.util.move");
Namespace.register("Hc.util.showDiv");
Namespace.register("Hc.util.hotClass");
Namespace.register("Hc.widget.hotword");
/**
 *Ӧ���෽������
 */
(function(){
	Hc.widget.cookie = {
		/**
		 * ��������޸�cookie.
		 * @param {Object} name cookie��.
		 * @param {Object} value cookieֵ.
		 * @param {Object} time ��Чʱ�䵥λΪ����.
		 */
		newAndModif:function(name,value,time){
			if(time!=null&&this.time!=''){
				document.cookie = name+"="+value+"; expires="+this.createTime(time)+";";
			}else{
				document.cookie = name+"="+value+"; expires=Fri, 31 Dec 2100 23:59:59 GMT;";
			}
		},
		/**
		 * ����cookie����Чʱ��.
		 * @param {Object} time
		 */
		createTime:function(time){
			var nowTime = new Date();
			time = parseInt(time)*24*60*60*1000 + parseInt(nowTime.getTime());
			var needTime = new Date(time);
			return needTime.toGMTString();
		},
		getValue:function(name){
			if(document.cookie != null){
				var cookieStrArr = document.cookie.split("; ");
				for(var i=0;i<cookieStrArr.length;i++){
					if(cookieStrArr[i].split("=")[0]==name){
						return cookieStrArr[i].split("=")[1];
					}
				}
			}else{
				return null;
			}
		}
	}
})();

/*
 *
 *
 */
 (function(){
	
	Hc.util.hotClass = {
		/*@method initAttention(),��ʼ���ȴ�չ������a������¼�
		 *@param (cookie��ǰ׺��,��Ҫ��ȡ�ȴʵĸ���id,�ȴ���ʾ��id,�ȴ���ʾ���id,��Ҫ��ȡ�ȴʵ��ϼ�tagName,��ʾ�ȴʵ�������)
		 */
		 concat : function(arg1,arg2){
			var arg = new Array();
			var len1 = arg1.length;
			var len2 = arg2.length;
			for(var i=0;i<(len1+len2);i++){
				if(i<len1) arg[i] =arg1[i];
				else arg[i] = arg2[i-arg1.length];
			}
			arg1 = arg
			return arg1;
		},
		initAttention:function(cookiename,mainbox,disbox,conbox,tagName,max){
			var curObj = this;
			var parCodes;
			var childCodes = new Array;
			var temparr1=new Array,temparr2 = new Array;
			var hotwords = new Array();
			if(Hc.widget.cookie.getValue(cookiename) != null){
				var hotwords = curObj.getCookievalue(cookiename);
				curObj.getAttention(hotwords,conbox);
			}else{
					$(disbox).style.display = "none";
			}
			parCodes = $(mainbox).getElementsByTagName(tagName);
			for(var i=0;i<parCodes.length;i++){
				temparr = parCodes[i].getElementsByTagName("A");
				childCodes = this.concat(childCodes,temparr);
			}
			for(var j=0;j<childCodes.length;j++){
				childCodes[j].n = childCodes[j].childNodes[0].nodeValue;
				childCodes[j].u = childCodes[j].href;
				childCodes[j].onclick = function(){
					var curhotwords = new Array();
					curhotwords = curObj.getCookievalue(cookiename);
					curObj.setAttention(cookiename,curhotwords,this.u,this.n,max);
				}
			}
			
		},
		/*@method getCookievalue(),��ȡcookieֵ�ĺ�׺������Hc.widget.hotword���������
		 *@param (cookie��ǰ׺��)
		 */
		getCookievalue:function(cookiename){
			var word,hotword;
			var hotwords = new Array();
			if(Hc.widget.cookie.getValue(cookiename)!=null){
				var cookieValue = unescape(Hc.widget.cookie.getValue(cookiename));
				var wordarr = cookieValue.split("&");
				for(var i=0;i<wordarr.length;i++){
					word = wordarr[i].split("|");
					hotword = new Hc.widget.hotword(word[0],word[1]);
					hotwords.push(hotword);
				}
			}
			return hotwords;
		},
		/*@method setAttenttion(),��ȡ�����ȴ�
		 *@param (cookie��ǰ׺��,�����ȴ�����,��ǰ�¼������Ķ���,�ȴ�������)
		 */
		setAttention:function(cookiename,arg,aurl,aword,max){
			var hotwords = new Array;
			var hotword = new Hc.widget.hotword(aword,aurl);
			var cookiestr = "";
			var flag = true;
			for(var i=0;i<arg.length;i++){
				hotwords[i] = arg[i];
			}
			if ((hotwords.length<max) && (hotwords.length!=0))
			{
				for(var j=0;j<hotwords.length;j++){
					if((hotwords[j].name == hotword.name) && (hotwords[j].url == hotword.url)){
//						flag=false;
						hotwords.splice(j,1);
					}
				}
//				if(flag) 
					hotwords.unshift(hotword);
			}else{
				hotwords.push(hotword);
				if(hotwords.length==max){
					hotwords.shift();
				}
			}
			for(var n=0;n<hotwords.length;n++){
				cookiestr = cookiestr + hotwords[n].name + "|" + hotwords[n].url +"&"
			}
			cookiestr = escape(cookiestr.substring(0,cookiestr.length-1));
			Hc.widget.cookie.newAndModif(cookiename,cookiestr);
		},
		/*@method getAttention(),
		 *@param (�����ȴ�����,�ȴ���ʾ����id)
		 */
		getAttention:function(arg,conbox){
			var wordstr = "";
			for(var j=0;j<arg.length;j++){
				wordstr = wordstr + "<a href=\"" + arg[j].url + "\">" + arg[j].name + "</a> | ";
				if (((j+1)%3 == 0) || (j==arg.length-1))
				{
					wordstr = wordstr.substring(0,wordstr.length-3);
					wordstr = wordstr + "<br />";
				}
			}
			$(conbox).innerHTML = wordstr;
			
		}
	}
 })();

/*
 *�ع�DIVλ�õľ�̬��
 *@class setDiv
 */
(function(){
	var initheight,totalheight;
	Hc.util.setDiv = {
		/**
		 *��ʼ��������ʾDOM����
		 *@method init
		 *@param (el,con,nums,overclassname,outclassname,speed,maxheight) tabǰ׺����ʾ����ǰ׺��tab�����tab��ʽ���뿪tab��ʽ�������ٶȣ���ʾ���ݿ�߶�
		 */
		init:function(el,con,nums,overclassname,outclassname,speed,maxheight){
			var arg = new Array();
			for(i=0;i<arguments.length;i++){
				arg[i] = arguments[i];
			}
			for(j=1;j<=parseInt(arg[2]);j++){
				tagBox = $(arg[0] + j);
				hidBox = $(arg[1] + j);
				tagBox.m = j;
				hidBox.m = j;
				tagBox.onmouseover=function(){Hc.util.showDiv.slideshow(arg,this.m);};
				tagBox.onmouseout=function(){Hc.util.showDiv.slideshow(arg,this.m);};
				hidBox.onmouseover=function(){Hc.util.showDiv.slideshow(arg,this.m);};
//				hidBox.onmouseout=function(){Hc.util.showDiv.slideshow(arg,this.m);};
			}
			Hc.util.showDiv.slideshow(arg,1);
		},
		/**
		 *�����ƶ�DOM����
		 *@method build
		 *@param (el,className,targetName) ������󣬼��ƶ�����ʹ�õ���ʽ���ƶ������tagName
		 */
		build:function(el,className,targetName,cookiename,mspace){
			totalheight = 0;
			var ctrHeight;
			var mb_arr = new Array();
			var childtag = el.getElementsByTagName(targetName);
			for(i=0;i<childtag.length;i++){
				if(childtag[i].className==className){
					with(childtag[i].style){
						position = "absolute";
						top = totalheight + "px";
					}
					if(childtag[i].scrollHeight==0) ctrHeight = parseInt(childtag[i].style.height);
					else ctrHeight = childtag[i].scrollHeight;
					if(mspace!=null && mspace!="") totalheight = totalheight + ctrHeight + mspace;
					else totalheight = totalheight + ctrHeight;
					mb_arr[mb_arr.length] = childtag[i].id;
				}
			}
			el.style.height = totalheight + "px";
			Hc.util.move.init(el,mb_arr,cookiename);
		},
		/**
		 *��ȡcookie�����ƶ�DOM����
		 *@method rebuild
		 *@param (movebox,cookieValue) �������cookie��ȡ����ַ�
		 */
		rebuild:function(movebox,cookieValue,cookiename,mspace){
			var ctrHeight;
			var totalheight = 0;
			var mb_arr = cookieValue.split("&");
			for(var i=0;i<mb_arr.length;i++){
				$(mb_arr[i]).style.position = "absolute";
				$(mb_arr[i]).style.top = totalheight + "px";
				if(parseInt($(mb_arr[i]).scrollHeight)==0) {ctrHeight = parseInt($(mb_arr[i]).style.height);}
				else ctrHeight = $(mb_arr[i]).scrollHeight;
				if(mspace!=null && mspace!="") totalheight = totalheight + ctrHeight + mspace;
				else totalheight = totalheight + ctrHeight;
			}
			movebox.style.height = totalheight + "px";
			Hc.util.move.init(movebox,mb_arr,cookiename);
		},

		/**
		 *tabЧ��DOM�����ʼ��
		 *@method tabDivinit
		 *@param (nums,tab,con,curClassName,speed,oEvent) tab����tabǰ׺����ʾ����ǰ׺��tab��ǰʱ����ʽ���л��ٶȣ����ÿ����л����¼���tab�ǵ�ǰ��ʽ
		 */
		tabDivinit:function(nums,tab,con,curClassName,speed,oEvent,outcname){
			var t = oEvent;
			var arg = new Array;
			for(i=0;i<arguments.length;i++){
				arg[i] = arguments[i];
			}
			for(var j=0;j<arg[0];j++){
				var curtab = $(arg[1] + j);
				curtab.n = j;
				switch(t){
					case 'click':
						curtab.onclick = function(){Hc.util.showDiv.show(arg,this.n);};
						break;
					default:
						curtab.onmouseover = function(){Hc.util.showDiv.show(arg,this.n);};
						break;
				}
			}
			return arg;
		}
	};
})();

/**
 *��ʾ������
 *@class showDiv
 */
(function(){
	var pos;
	var showpos;
	Hc.util.showDiv = {
		/**
		 *tab�л����ƣ������¼�������
		 *@param arg��������,idΪ��ǰ�����ı��
		 */
		show:function(arg,id){
			var curtab,curobj;
			curobj = this;
			var useArg = new Array;
			for(j=0;j<arg.length;j++){
				useArg[j] = arg[j];
			}
			for(var i=0;i<useArg[0];i++){
				curtab = $(useArg[1] +i);
				if(i==id){ 
					curtab.className = useArg[3];
					$(useArg[2]+i).style.display = "block";
				}else{
					curtab.className = useArg[6];
					$(useArg[2]+i).style.display = "none";
				}
			}	
		},

		/**
		 *tab�Զ��л����ƣ������¼��Զ�����
		 *@param arg��������
		 */
		autoshow:function(arg){
			var time1,curobj,curtab,curnum,bpos;
			curnum = 1;
			curobj = this;
			bpos = 0;
			var useArg = new Array;
			for(j=0;j<arg.length;j++){
				useArg[j] = arg[j];
			}
			this.show(useArg,0);
			function ctrl(){
				time1 = setInterval(function(){
					if(curnum>=useArg[0]) curnum=0;
					bpos = curnum;
					curobj.show(useArg,curnum);
					curnum++;
				},useArg[4])
			}
			ctrl();
			for(var i=0;i<useArg[0];i++){
				curtab = $(useArg[1] +i);
				switch(useArg[5]){
					case 'click':
						curtab.onclick = function(){curobj.show(useArg,this.n);};
						curtab.onmouseover = function(){clearInterval(time1);bpos=this.n;}
						break;
					default:
						curtab.onmouseover = function(){clearInterval(time1);curobj.show(useArg,this.n);bpos=this.n;};
						break;
				}
				$(useArg[2] +i).onmouseover = function(){clearInterval(time1);bpos++;}
				$(useArg[2] +i).onmouseout = function(){
//					bpos++;
//					if(bpos==useArg[0]) bpos=0;
//					curobj.show(useArg,bpos);
					curnum = bpos;
					ctrl();
				}
				curtab.onmouseout = function(){
//					if(bpos==useArg[0]) bpos=0;
//					curobj.show(useArg,bpos);
					curnum = bpos;
					ctrl();
				}
			}
		},
		/**
		 *��onmouseover��onmouseout�¼�������������ʾ
		 *@param arg�������࣬id��tab�ĺ�׺����
		 */
		slideshow:function(arg,id){
			var curobj = new Array();
			for(j=0;j<arg.length;j++){
				curobj[j] = arg[j];
			}
			var tagBox,hidBox;
			var ctrl = 0;
			if((id!=pos)||(pos==null)){
				for(i=1;i<=parseInt(curobj[2]);i++){
					tagBox = $(curobj[0] + i);
					hidBox = $(curobj[1] + i);
					if(i==id){
						pos=id;
						tagBox.className = curobj[3];
						hidBox.style.display = "block";
	/*���õ���Ч��
//						hidBox.style.overflow = "hidden";
//						hidBox.style.height = "0px";
//						var time1 = setInterval(function(){
//							var ids = id;
//							ctrl +=	curobj[5];
//							if(ctrl>curobj[6]) {
//								clearInterval(time1);
//								ctrl = curobj[6];
//							}
//							$(curobj[1] + ids).style.height = ctrl  + "px";
//						},30);
	*/
						hidBox.style.height = curobj[6] + "px";
					}else{
							hidBox.style.height = "0px";
							tagBox.className = curobj[4];
							hidBox.style.display = "none";
					}
				}
			}
		}
		
	}
})();

/**
 *�ƶ���
 *@class move
 */
(function(){
	var movebox = null;
	var moveboxs = new Array();
	var oStart,oEnd,oStartY,oEndY;
	var speed = 10;
	var mflag = true;
	Hc.util.move = {
		/**
		 *���movebox����
		 *@param id �ƶ���ĸ���
		 *@param �ƶ���id
		 */
		init:function(id,mb_arr,cookiename){
			
			var movebox = new Hc.widget.movebox(id);
			for(var i=0;i<mb_arr.length;i++){
				movebox.list.push($(mb_arr[i]));
			}
			movebox.cookieid = cookiename;
			moveboxs.push(movebox);
		},

		/**
		 * �����ƶ���ǰ�������������е�λ�ã������������λ��.
		 * @method moveUp 
		 * @param {Object} m_b movebox��DOM����.
		 * @param {Object} now ��ǰ׼���ƶ���DOM����,����m_b����.
		 */
		moveUp:function(m_b,now){
			if(mflag){
			oStart=null;
			oEnd=null;
			oStartY=null;
			oEndY=null;
			var changepoint = new Array();
			movebox = this.isHave(m_b);
			if(this.getUp(now)!=null){
				changepoint = this.getUp(now);
				oStart = changepoint[0];
				oEnd = changepoint[1];
				oStartY = parseInt(oEnd.style.top);
				oEndY = parseInt(oStart.style.top);
				oStart.style.zIndex = "0";
				oEnd.style.zIndex = "360";
				oStart.style.filter="alpha(opacity=10)";
				this.startmoving();
				this.endmoving();
				oStart.style.filter="alpha(opacity=100)";
			}
			this.change(oEnd,oStart);
			Hc.widget.cookie.newAndModif(movebox.cookieid,this.toString(),30);
			}
			
		},
		/**
		 *�����ƶ���ǰ�������������е�λ�ã������������λ��.
		 *@method moveDown 
		 */
		moveDown:function(m_b,now){
		if(mflag){
			oStart=null;
			oEnd=null;
			oStartY=null;
			oEndY=null;
			var changepoint = new Array();
			movebox = this.isHave(m_b);
			if(this.getDown(now)!=null){
				changepoint = this.getDown(now);
				oStart = changepoint[0];
				oEnd = changepoint[1];
				oStartY = parseInt(oEnd.style.top);
				oEndY = parseInt(oStart.style.top);
				oStart.style.zIndex = "360";
				oEnd.style.zIndex = "0";
				oEnd.style.filter="alpha(opacity=10)";
				this.startmoving();
				this.endmoving();
				oEnd.style.filter="alpha(opacity=100)";
			}
			this.change(oEnd,oStart);
			Hc.widget.cookie.newAndModif(movebox.cookieid,this.toString(),30);
		}
			
		},
		/**
		 *��һ����ƶ���λ
		 */
		startmoving:function(){
			var con = this;
			yStart = parseInt(oStart.style.top);
			yEnd = oStartY+(oEnd.scrollHeight-oStart.scrollHeight);
			if(yStart<yEnd){
				this.moveY(oStart,1,speed,yEnd);
				setTimeout(function(){con.startmoving()},1);
				mflag = false;
			}
			if(yStart>yEnd){
				this.moveY(oStart,2,speed,yEnd);
				setTimeout(function(){con.startmoving()},1);
				mflag = false;
			}
			if(yStart==yEnd){
				mflag = true;
			}
		},
		/**
		 *��һ���ƶ���λ
		 */
		endmoving:function(){
			yStart = parseInt(oEnd.style.top);
			yEnd = parseInt(oEndY);
			var con = this;
			if(yStart<yEnd){
				this.moveY(oEnd,1,speed,yEnd);
				setTimeout(function(){con.endmoving()},1);
				mflag = false;
			}
			if(yStart>yEnd){
				this.moveY(oEnd,2,speed,yEnd);
				setTimeout(function(){con.endmoving()},1);
				mflag = false;
			}
			if(yStart==yEnd){
				mflag = true;
			}
		},
		/**
		 *������obj��topֵ
		 *@method moveY
		 */
		moveY:function(obj,ySpeenType,speed,yEnd){
			if(ySpeenType==1){
				if((parseInt(obj.style.top)+speed)>yEnd){
					obj.style.top = yEnd+"px";
				}else{
					obj.style.top = parseInt(obj.style.top)+speed+"px";
				}
			}
			if(ySpeenType==2){
				if((parseInt(obj.style.top)-speed)<yEnd){
					obj.style.top = yEnd+"px";
				}else{
					obj.style.top = parseInt(obj.style.top)-speed+"px";
				}
			}
		},
		/**
		 *��ȡ�ƶ�������movebox����list�е�λ��
		 *@method getIndex 
		 *@param �ƶ�����
		 */
		getIndex:function(moveObj){
			for(var i=0;i<movebox.list.length;i++){
				if(movebox.list[i]==moveObj){
					return i;
				}
			}
			return -1;
		},
		/**
		 *��ȡmoveboxs��movebox����
		 *@param m_b���ƶ���ĸ���
		 */
		isHave:function(m_b){
			for(var i=0;i<moveboxs.length;i++){
				if(moveboxs[i].name==$(m_b.id)){
					return moveboxs[i];
				}
			}
		},
		/**
		 * ���ϻ�ȡ��ǰ������ٽ�Ķ���.
		 * @method getUp 
		 * @param {Object} now ��ǰ����.
		 */
		getUp:function(now){
			var arrm = new Array();
			for(var i=0;i<movebox.list.length;i++){
				if(movebox.list[i]==now){
					if(i>0){
						arrm[0] = movebox.list[i-1];
						arrm[1] = movebox.list[i];
						return arrm;
					}else{
						return null;
					}
				}
			}
		},
		/**
		 * ���»�ȡ��ǰ������ٽ�Ķ���.
		 * @method getDown 
		 * @param {Object} now ��ǰ����.
		 */
		getDown:function(now){
			var arrm = new Array();
			for(var i=0;i<movebox.list.length;i++){
				if(movebox.list[i]==now){
					if(i<movebox.list.length-1){
						arrm[0] = movebox.list[i];
						arrm[1] = movebox.list[i+1];
						return arrm;
					}else{
						return null;
					}
				}
			}
		},
		/**
		 *�ı��ƶ�������movebox.list�е�λ��
		 *@method change
		 *@param (start,end)�ƶ���}�����
		 */
		change:function(start,end){
			var s_index = this.getIndex(start);
			var e_index = this.getIndex(end);
			if(s_index!=-1&&e_index!=-1){
				movebox.list[s_index] = end;
				movebox.list[e_index] = start;
				movebox.version++;
			}
		},
		/**
		 *��movebox�����е�list����ֵ��&l�ӷ����ַ�
		 *@method toString
		 */
		toString:function(){
			var tempStr = "";
			for(var i=0;i<movebox.list.length;i++){
				tempStr = tempStr + movebox.list[i].id + "&";
			}
			tempStr = tempStr.substring(0,tempStr.length-1);
			return tempStr;
		}
	};
})();




/**
 * �ƶ��������.
 * @class movebox
 * @param {Object} name ���movebox��ID���.
 */
Hc.widget.movebox = function(name){
	this.name = name;
	this.list = new Array();
	this.size = 0;
	this.version = 0;
	this.obj = null;
	this.cookieid = null;
}

Hc.widget.hotword = function(name,url){
	this.name = name;
	this.url = url;
}
//]]>

/**--------------------------------չ����Ч-----------------------------------**/

function $(obj) {
	return document.getElementById(obj);
}
function tag(elem,name) {
	return (elem || document).getElementsByTagName(name);
}
function tab(id,cur) {
	var lis=tag($(id),"h4");
	for(var i=0;i<lis.length;i++) {
		lis[i].id=i;
		lis[i].style.cursor="pointer";
		lis[i].onclick=function () {
			for(var j=0;j<lis.length;j++) {
				if(this.id==j) {
					if($("tag"+j).style.display=="none") {
						lis[j].className=cur;
						$("tag"+j).style.display="block";
					} else {
						lis[j].className="";
						$("tag"+j).style.display="none";
					}
				} else {
					lis[j].className="";
					$("tag"+j).style.display="none";
				}
			}
		}
	}
}
/**--------------------------------չ����Ч-----------------------------------**/
var act;
function over(s,nMax){
  var obj=document.getElementById(s);
  var h = parseInt(obj.offsetHeight);
  if (h < nMax){
    obj.style.height = (h + 2)+"px";
    clearTimeout(act);
    act = setTimeout("over('"+s+"',"+nMax+")", 10);
  }
}
function out(s,nMin){
  var obj=document.getElementById(s);
  var h = parseInt(obj.offsetHeight);
  if (h > nMin){
    obj.style.height = (h - 2)+"px";
    clearTimeout(act);
    act = setTimeout("out('"+s+"',"+nMin+")", 10);
  }
}
/**------------------�л���Ч-------------------------**/
function bjq(id)
{ document.getElementById("tubjj").className="bjqp"+id;}

/**------------------����Ϲ�-------------------------**/
/**------------------�л���Ч-------------------------**/
function bjqq(id)
{ document.getElementById("hciframecc").className="bjqpp"+id;}

/**------------------����Ϲ�-------------------------**/
