
/*menu*/
var $ = function(id){ return document.getElementById(id)};
function submenu(menu_no){
$("first_"+menu_no).className=($("first_"+menu_no).className =='')?'on':'';	
$("second_"+menu_no).style.display=($("second_"+menu_no).style.display =='none')?'':'none';
}

var sb = 0;
var sba = 0;
function mychg(m){
    if(sba==1) {
	sbb=$("lm"+m).style.display;
	$("lm"+m).style.display=sbb=="none"?"block":"none";
	$("father"+m).className=$("father"+m).className==""?"on":"";
	}
	else {
    if(sb!=0){ 
	$("lm"+sb).style.display="none";
	$("father"+sb).className="";
	}
    if(sb!=m){
        $("lm"+m).style.display="block";
		$("father"+m).className="on";
        sb=m;
    }
    else sb=0;
	}
}
//block & hidden
function BlockOrHidden(ID){
	var str_id = ID.split( "," );

	for( var i = 0; i < str_id.length; i++ ){
		var URL = $( str_id[i] ).getElementsByTagName("script");
		var URLLength = URL[0].src.length;
		var cmsLength = $( str_id[i] ).innerHTML.length;
		var cutLength = cmsLength - URLLength;
		
		if(cutLength != 47){
			$( str_id[i] ).style.display = "block";
		}else{
		$( str_id[i] ).style.display = "none";	
		}
 	}
}


//
function  show(id) { 
var menu = document.getElementById(id);
menu.style.display = "block"; 
}  

function hide (id){
var menu = document.getElementById(id);
menu.style.display = "none"; 
}


//Back to Top
var persistclose=0 //����0��1. ����1�Ļ� һ������ʾ�ֶ��ر�, ����һ�ε��Ժ󲻻�����ʾ��COOKIE��
var startX = 72 //����ˮƽ���
var startY = 325 //���ô�ֱ���
var verticalpos="fromtop" //"fromtop"��������� "frombottom" ���������

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function get_cookie(Name) {
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) {
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}
function staticbar(){
	barheight=document.getElementById("floatbar").offsetHeight
	var ns = (navigator.appName.indexOf("Netscape") != -1) || window.opera;
	var d = document;
	function ml(id){
		var el=d.getElementById(id);
		if (!persistclose || persistclose && get_cookie("remainclosed")=="")
		el.style.visibility="visible"
		if(d.layers)el.style=el;
		el.sP=function(x,y){this.style.right=x+"px";this.style.top=y+"px";};
		el.x = startX;
		if (verticalpos=="fromtop")
		el.y = startY;
		else{
		el.y = ns ? pageYOffset + innerHeight : iecompattest().scrollTop + iecompattest().clientHeight;
		el.y -= startY;
		}
		return el;
	}
	window.stayTopLeft=function(){
		if (verticalpos=="fromtop"){
		var pY = ns ? pageYOffset : iecompattest().scrollTop;
		ftlObj.y += (pY + startY - ftlObj.y)/5;
		}
		else{
		var pY = ns ? pageYOffset + innerHeight - barheight: iecompattest().scrollTop + iecompattest().clientHeight - barheight;
		ftlObj.y += (pY - startY - ftlObj.y)/5;
		}
		ftlObj.sP(ftlObj.x, ftlObj.y);
		setTimeout("stayTopLeft()", 5);
	}
	ftlObj = ml("floatbar");
	stayTopLeft();
}
function backToTop() {
	 var x1 = x2 = x3 = 0; var y1 = y2 = y3 = 0;
	 if (document.documentElement) { x1 = document.documentElement.scrollLeft || 0; y1 = document.documentElement.scrollTop || 0;}
	 if (document.body) { x2 = document.body.scrollLeft || 0; y2 = document.body.scrollTop || 0;}
	 x3 = window.scrollX || 0;
	 y3 = window.scrollY || 0;
	 var x = Math.max(x1, Math.max(x2, x3));
	 var y = Math.max(y1, Math.max(y2, y3));
	 window.scrollTo(Math.floor(x / 2), Math.floor(y / 2));
	 if (x > 0 || y > 0) { window.setTimeout("backToTop()", 5);}
}
	
	function dhmenuchg(obj,n){
		var dhdiv = obj.getElementsByTagName("div")[0];
		var dhul = obj.getElementsByTagName("ul")[0];
		dhdiv.className = n==1?"dh_topdiv_on":"dh_topdiv";
		dhul.style.display = n==1?"block":"none";
	}
	function dhmenuchg2(obj,n){
		
		var dhul = obj.getElementsByTagName("ul")[0];
		var dha = obj.getElementsByTagName("a")[0];
		obj.style.position = n==1?"relative":"";
		dhul.style.display = n==1?"block":"none";
		dha.className = n==1?"dh_a_on":"";
	}// JavaScript Document

//output Q&A 
function setWBtxt(wb_m){
if (wb_m==0) return;
var wbt = Array();
var wbl = Array();
for(i=1;i<6;i++){                      
	wbt[i] = Array();
	wbl[i] = Array();
	}

wbt[1][1] = "PLZ HELP ME!!!";                                     //items
wbl[1][1] = "http://help.91.com/answer/2009/02/18/1704.shtml";
wbt[1][2] = "Why can't I pick up items??";
wbl[1][2] = "http://help.91.com/answer/2009/02/19/1710.shtml";
wbt[1][3] = "how to trade items with someone?";
wbl[1][3] = "http://help.91.com/answer/2009/02/19/1711.shtml";

wbt[2][1] = "3rd Summon quest";                                   //features
wbl[2][1] = "http://help.91.com/answer/2009/01/14/1188.shtml";
wbt[2][2] = "Where can i get quest?";
wbl[2][2] = "http://help.91.com/answer/2008/09/23/303.shtml";
wbt[2][3] = "How to quit the Legion?";
wbl[2][3] = "http://help.91.com/answer/2009/02/19/1716.shtml";
wbt[2][4] = "How to get married in game?";
wbl[2][4] = "http://help.91.com/answer/2009/02/19/1717.shtml";
wbt[2][5] = "Why there is no TG room in CT?";
wbl[2][5] = "http://help.91.com/answer/2008/12/10/996.shtml";

wbt[3][1] = "A mage or a warrior";                    //Skill
wbl[3][1] = "http://help.91.com/answer/2009/05/17/4056.shtml";
wbt[3][2] = "New Mage How to get new skills";
wbl[3][2] = "http://help.91.com/answer/2008/12/02/768.shtml";
wbt[3][3] = "What am I doing wrong?";
wbl[3][3] = "http://help.91.com/answer/2008/12/02/759.shtml";
wbt[3][4] = "How can I level up in game?";
wbl[3][4] = "http://help.91.com/answer/2008/10/07/666.shtml";
wbt[3][5] = "What classes can you play in Crazy Tao?";
wbl[3][5] = "http://help.91.com/answer/";

wbt[4][1] = "How do I make SaintKylin's stars go up?";                    //Pets
wbl[4][1] = "http://help.91.com/answer/2008/12/02/769.shtml";
wbt[4][2] = "about pet";
wbl[4][2] = "http://help.91.com/answer/2008/12/23/1036.shtml";
wbt[4][3] = "how can you obtain pets?";
wbl[4][3] = "http://help.91.com/answer/2008/12/02/763.shtml";
wbt[4][4] = "Registering Pets";
wbl[4][4] = "http://help.91.com/answer/2008/12/02/760.shtml";
wbt[4][5] = "What pet should i get?";
wbl[4][5] = "http://help.91.com/answer/2008/11/10/753.shtml";

wbt[5][1] = "patch doesnt work";                                              //Others
wbl[5][1] = "http://help.91.com/answer/2009/07/10/15014.shtml";
wbt[5][2] = "why does this game not work for?";
wbl[5][2] = "http://help.91.com/answer/2009/07/10/15042.shtml";
wbt[5][3] = "DirectX error";
wbl[5][3] = "http://help.91.com/answer/2009/07/23/16196.shtml";

for(k=1;k<wbt[wb_m].length;k++){
	document.writeln("<a href=\""+ wbl[wb_m][k] +"\" target=\"_self\">"+ wbt[wb_m][k] +"<\/a><br \/>");
	}
}  

//Output Screenshots
function setSStxt(wb_m){
  var jsurl = "http://p.images.91.com/album91e_js/special/ct"
  var jstag ="<script language=\"JavaScript\" type=\"text\/javascript\""
  var ss = jstag+" src=\""+jsurl + wb_m +".js"+"\"><\/script>"
  document.writeln(ss);
}


