function speedEntrance(){
	var ceDiv = document.createElement("div");
	ceDiv.className = "speedLinkBg";
	if($$("speedLink")){
		$$E.addEvent($$("speedLink"), "mouseover", seOver);
		$$E.addEvent($$("speedLink"), "mouseout", seOut);
	}
	function seOver(){
		$$("entrance").style.display = "block";
		$$("head_rtip").appendChild(ceDiv);
		$$D.addClass($$("speedLink"),"speedLink color_blue");
	}
	function seOut(){
		$$("entrance").style.display = "none";
		$$("head_rtip").removeChild(ceDiv);
		$$D.removeClass($$("speedLink"),"speedLink color_blue");
	}
}
$$E.addEvent(this, "load", speedEntrance);
function titleTip(){
	var otitle = document.getElementsByTagName("a");
	var cdiv=document.createElement("div");
	cdiv.setAttribute("id", "divTip");
	for(var i=0;i<otitle.length;i++){
		otitle[i].onmouseover=function(e){
			e = e || window.event;
			this.t = this.title;
			if(this.t&&(this.t.indexOf('titleTip=')>-1)){	
				var pattern = /titleTip=/;
				var result = this.t.replace(pattern,"");
				this.title = "";
				document.body.appendChild(cdiv);
				$$("divTip").innerHTML = result;
				$$("divTip").style.top = ($$D.rect(this).top +10) + "px";
				$$("divTip").style.left = ($$D.rect(this).right +10) + "px";
			}
		}
		otitle[i].onmouseout=function(){
			if(this.t&&(this.t.indexOf('titleTip=')>-1)){
				document.body.removeChild(cdiv);
				this.title = this.t;
			}
		}
	}
}
$$E.addEvent(this, "load", titleTip);
function openLoginWindow(){
	var sHeight;
	if(window.screen.availHeight > document.body.scrollHeight){
		sHeight = window.screen.availHeight; 
	}
	else{
		sHeight = document.body.scrollHeight;
	}	
	var maskObj = document.createElement("div");
        maskObj.setAttribute('id','BigDiv');
		if($$B.ie){
			maskObj.style.position = "absolute";
			maskObj.style.height = sHeight + "px";
		}
		else{
			maskObj.style.position = "fixed";
			maskObj.style.height = "100%";
		}
		maskObj.style.top = "0";
		maskObj.style.left = "0";
		maskObj.style.background = "#e6f2f8";
		maskObj.style.filter = "Alpha(opacity=50)";
		maskObj.style.opacity = "0.5";
		maskObj.style.width = "100%";
		maskObj.style.zIndex = "100";
	var maskDiv = document.createElement("div");
		maskDiv.setAttribute('id','MyDiv');
		maskDiv.style.position = "absolute";
		maskDiv.style.top = "0";
		maskDiv.style.left = "0";
		maskDiv.style.width = "316px";
		maskDiv.style.height = "300px";
		maskDiv.style.zIndex = "101";
	document.body.appendChild(maskObj);
	document.body.appendChild(maskDiv);
	if($$B.ie6){
		for(var i=0;i<$$.T("select").length;i++){
			$$.T("select")[i].style.visibility = "hidden";
		}
	}
	var strHtml = '<div class="olw_tit"><div class="close"><a href="javascript:closeLoginWindow();"></a></div></div>';
		strHtml += '<div class="olw_content"><iframe class="olwFrame" id="loginFrameContent" src="login/loginWindow.html" width="100%" height="100%" scrolling="no" frameborder="0"></iframe></div>';
	maskDiv.innerHTML = strHtml;
	var MyDiv_w = $$D.getStyle($$("MyDiv"),"width");
	var MyDiv_h = $$D.getStyle($$("MyDiv"),"height");
		MyDiv_w = parseInt(MyDiv_w,10);
		MyDiv_h = parseInt(MyDiv_h,10);
	var width = $$D.pageWidth(); 
	var height = $$D.pageHeight();
	var left = $$D.getScrollLeft();
	var top = $$D.getScrollTop();
	$$("MyDiv").style.left = left + (width / 2) - (MyDiv_w / 2) + "px";
	$$("MyDiv").style.top =  top + (height / 2) - (MyDiv_h / 2) + "px";
}
function closeLoginWindow(){
	document.body.removeChild($$("BigDiv")); 
	document.body.removeChild($$("MyDiv"));
	if($$B.ie6){
		for(var i=0;i<$$.T("select").length;i++){
			$$.T("select")[i].style.visibility = "";
		}
	}
}
window.onresize = window_onscroll;
window.onscroll = window_onscroll;
function window_onscroll(){
	if($$("MyDiv")){
		var MyDiv_w = $$D.getStyle($$("MyDiv"),"width");
		var MyDiv_h = $$D.getStyle($$("MyDiv"),"height");
			MyDiv_w = parseInt(MyDiv_w,10);
			MyDiv_h = parseInt(MyDiv_h,10);
		var width = $$D.pageWidth(); 
		var height = $$D.pageHeight();
		var left = $$D.getScrollLeft();
		var top = $$D.getScrollTop();
		$$("MyDiv").style.left = left + (width / 2) - (MyDiv_w / 2) + "px";
		$$("MyDiv").style.top =  top + (height / 2) - (MyDiv_h / 2) + "px";
	}
}
function reinitIframe(obj){
	try{
		var bHeight = $$(obj).contentWindow.document.body.scrollHeight;
		var dHeight = $$(obj).contentWindow.document.documentElement.scrollHeight;
		var height = Math.max(bHeight, dHeight);
		$$(obj).height = height;
	}
	catch (ex){}
}
window.setInterval("reinitIframe('loginFrameContent')", 200);
var opCard = function(){
	this.bind = new Array();
	this.style = new Array();
	this.index = 0;
	this.overStyle = false;
	this.overChange = false;
	this.menu = false;	
	this.auto = [false, 1000];
	this.timerID = null;
	this.menutimerID = null;	
}
opCard.prototype.creat = function(){
	var pattern = /./;
	if(this.bind[1].indexOf(".")!=-1){
		var arrMenu = $$D.getElementsByClassName($$(this.bind[0]),"*",this.bind[1].replace(pattern,""));
	}
	else{
		var arrMenu = $$(this.bind[0]).getElementsByTagName(this.bind[1]);
	}
	if(this.bind[3].indexOf(".")!=-1){
		var arrInfo = $$D.getElementsByClassName($$(this.bind[2]),"*",this.bind[3].replace(pattern,""));
	}
	else{
		var arrInfo = $$(this.bind[2]).getElementsByTagName(this.bind[3]);	
	}
	var my = this, i;
	var argLen = arguments.length;
	var arrM = new Array();
	var l = arrMenu.length;
	if(l!=arrInfo.length){alert("菜单和内容必须拥有相同的数量\n如果需要，你可以放一个空的在那占位。")}
	if(this.menu){this.auto=false;this.overChange=true;}
	for(i=0;i<l;i++){
		arrMenu[i].cName = arrMenu[i].className;
		arrMenu[i].className = (i!=this.index || this.menu)?getClass(arrMenu[i],this.style[0]):getClass(arrMenu[i],this.style[1]);
		
		if(i!=this.index || this.menu){arrInfo[i].style.display="none"};
		arrMenu[i].index = i;
		arrInfo[i].index = i;
		
		if(this.overChange){
			arrMenu[i].onmouseover = function(){changeOption(this);my.menu?changeMenu(1):autoStop(this, 0);}
			arrMenu[i].onmouseout = function(){changeOption(this);my.menu?changeMenu(0):autoStop(this, 1);}
		}
		else{
			arrMenu[i].onclick = function(){changeOption(this);autoStop(this, 0);if(argLen==1){func()}}
			if(this.overStyle){
				arrMenu[i].onmouseover = function(){changeTitle(this, 2);autoStop(this, 0);}
				arrMenu[i].onmouseout = function(){changeTitle(this, 0);autoStop(this, 1);}
			}
			else{
				if(this.auto[0]){
					arrMenu[i].onmouseover = function(){autoStop(this, 0);}
					arrMenu[i].onmouseout = function(){autoStop(this, 1);}
				}
			}
		}
		if(this.auto[0] || this.menu){
			arrInfo[i].onmouseover = function(){my.menu?changeMenu(1):autoStop(this, 0);}
			arrInfo[i].onmouseout = function(){my.menu?changeMenu(0):autoStop(this, 1);}
		}
	}
	if(this.auto[0]){
		this.timerID = setTimeout(autoMove,this.auto[1]);
	}
	function autoMove(){
		var n;
		n = my.index + 1;
		if(n==l){n=0};
		changeOption(arrMenu[n]);
		my.timerID = setTimeout(autoMove,my.auto[1]);
	}	
	function autoStop(obj, num){
		if(!my.auto[0]){return;}
		num == 0 ? clearTimeout(my.timerID) : my.timerID = setTimeout(autoMove,my.auto[1]);
	}	
	function changeOption(obj){
		arrMenu[my.index].className = getClass(arrMenu[my.index],my.style[0]);
		arrInfo[my.index].style.display = "none";
		obj.className = getClass(obj,my.style[1]);
		arrInfo[obj.index].style.display = "";
		my.index = obj.index;
	}
	function changeTitle(obj, num){
		if(!my.overStyle){return;};
		if(obj.index!=my.index){obj.className = getClass(obj,my.style[num])}
	}	
	function changeMenu(num){
		if(!my.menu){return;}
		num==0?my.menutimerID = setTimeout(menuClose,1000):clearTimeout(my.menutimerID)
	}	
	function menuClose(){
		arrInfo[my.index].style.display = "none";
		arrMenu[my.index].className = my.style[0];
	}	
	function getClass(o, s){
		if(o.cName==""){return s}
		else{return o.cName + " " + s}
	}
}
