﻿function showTip(obj,txt){
		if(obj.init) return;
	obj.init = function(){
		var thisObj = this;
		var str = thisObj.innerHTML;
		thisObj.style.position = "relative";
		var div = document.createElement("div");
		div.className = "tip-bg";
		div.innerHTML = "<div class=\"tip-text\">&nbsp;" + txt + "&nbsp;</div>";
		thisObj.insertBefore(div,thisObj.firstChild);

			//thisObj.innerHTML = "<div class=\"tip-bg\"><div class=\"tip-bulb\">&nbsp;" + txt + "&nbsp;</div></div>" + str;

		thisObj.getElementsByTagName ('div')[0].style.display = 'none';
		thisObj.showTip();
			
		thisObj.onmouseover = thisObj.showTip;
		thisObj.onmouseout = thisObj.hideTip;
	}
	obj.showTip = function(){

		var thisObj = this;
		clearTimeout(thisObj.timeout);
		thisObj.timeout = setTimeout(function(){
			thisObj.getElementsByTagName ('div')[0].style.display='block';
		},200);
	}
	obj.hideTip = function(){
		var thisObj = this;
		clearTimeout(thisObj.timeout);
		thisObj.getElementsByTagName ('div')[0].style.display='none'
	}
	obj.init();
}
function show_tbl(pre,n,select_n){
	for(i=1;i<=n;i++){
		var tbl= document.getElementById(pre+i);
		tbl.style.display="none";
        if(i==select_n){
			tbl.style.display="block";
		}
	}
}
function SelectLetter(linkID)
{
	var i = 0;
	document.getElementById("Letter_"+linkID).innerHTML = String.fromCharCode(linkID+64);
	for(i=1;i<=26;i++)
	{
		if(i!=linkID)
		{
			document.getElementById("Letter_"+i).innerHTML = '<a href="/Letter/'+String.fromCharCode(i+64)+'.html" target="LetterList" OnClick="javascript:SelectLetter('+i+');">'+String.fromCharCode(i+64)+'</a>';
		}
	}
	if(linkID==0)
	{
	   show_tbl('LetterList_',2,1);
	   document.getElementById("Letter_0").innerHTML = 'HOT!';
	}
	else 
	{
	   show_tbl('LetterList_',2,2);
	   document.getElementById("Letter_0").innerHTML = '<a href="javascript:SelectLetter(0);">HOT!</a>';
	}
}
function SelectType(linkID,pre)
{
	var tlist = new Array('热血类','校园类','推理类','机战类','冒险类','运动类','耽美类','搞笑类','科幻类','魔幻类','恐怖类','社会类','爱情类','武侠类','温情类');
	var i = 0;
	document.getElementById(pre+"_"+linkID).innerHTML = tlist[linkID-1];
	for(i=1;i<=15;i++)
	{
		if(i!=linkID)
		{
			document.getElementById(pre+"_"+i).innerHTML = '<a href="/'+pre+'/'+i+'.html" target="'+pre+'List" OnClick="javascript:SelectType('+i+',\''+pre+'\');">'+tlist[i-1]+'</a>';
		}
	}
}
function initial()
{
    var tList = new Array('热血类','校园类','推理类','机战类','冒险类','运动类','耽美类','搞笑类','科幻类','魔幻类','恐怖类','社会类','爱情类','武侠类','温情类');
    var t = GetArgsFromHref(location.href, 'tid');
    var l = GetArgsFromHref(location.href, 'l');
    var i=0;
    //字母部分
    for(i=1;i<=26;i++)
    {
        if(String.fromCharCode(i+64)==l) //当前字母
        {
            document.getElementById('lMenu_'+String.fromCharCode(i+64)).className="Tab_middle3 block_place2";
            document.getElementById('lMenu_'+String.fromCharCode(i+64)).innerHTML = String.fromCharCode(i+64);
            document.getElementById('lTab_'+String.fromCharCode(i+64)).className="Tab_space2 Tab2_frame";
            document.getElementById('lTab_'+String.fromCharCode(i+64)).style.backgroundColor="#FFFFFF";
        }
        else
        {
            document.getElementById('lMenu_'+String.fromCharCode(i+64)).className="block_place2";
            document.getElementById('lMenu_'+String.fromCharCode(i+64)).innerHTML = '<a href="javascript:redirect(\'l\',\''+String.fromCharCode(i+64)+'\');" class="Tab1">'+String.fromCharCode(i+64)+'</a>';
            document.getElementById('lTab_'+String.fromCharCode(i+64)).className="Tab_space2";
            document.getElementById('lTab_'+String.fromCharCode(i+64)).style.backgroundColor="#CCCCCC";
        }
    }
    if(l=='*'||l=='')
    {
            document.getElementById('lMenu_*').className="Tab_middle3 block_place2";
            document.getElementById('lMenu_*').innerHTML = 'ALL';
            document.getElementById('lTab_*').className="Tab2_frame";
            document.getElementById('lTab_*').style.backgroundColor="#FFFFFF";
    }
    else
    {
            document.getElementById('lMenu_*').className="block_place2";
            document.getElementById('lMenu_*').innerHTML = '<a href="javascript:redirect(\'l\',\'*\');" class="Tab1">ALL</a>';
            document.getElementById('lTab_*').className="Tab_space2";
            document.getElementById('lTab_*').style.backgroundColor="#CCCCCC";
    }
    //类别部分
    if(t!=-1&&t!='')
    {
        document.getElementById('tMenu_'+t).innerHTML = tList[t-1];
        document.getElementById('tMenu_-1').innerHTML = '<a href="javascript:redirect(\'tid\',-1);">全 部</a>';
    }
    else document.getElementById('tMenu_-1').innerHTML = "全 部";
    for(i=1;i<=15;i++)
    {
        if(i!=t)
            document.getElementById('tMenu_'+i).innerHTML = '<a href="javascript:redirect(\'tid\','+i+');">'+tList[i-1]+'</a>';
    }
}