var arrPicCommend=new Array();
var itabs;
var strDefaultContent;

function LoadPicCommendJs(strKey,obj){
	var objPicCommendJs;
	if (!$("PicCommendJs")){
		objPicCommendJs = document.createElement("script");
		objPicCommendJs.id = "PicCommendJs";
		document.body.appendChild(objPicCommendJs);
	}
	else{
		if (document.all){
			objPicCommendJs = $("PicCommendJs");
		}
		else{
			document.body.removeChild($("PicCommendJs"));
			objPicCommendJs = document.createElement("script");
			objPicCommendJs.id = "PicCommendJs";
			document.body.appendChild(objPicCommendJs);
		}
	}
	objPicCommendJs.src="/jss/PicCommend"+strKey+".js";

	if (document.all){
		objPicCommendJs.onreadystatechange = function(){
			if (objPicCommendJs.readyState=="loaded"){
				ShowTab(obj,strKey)
			}
		}
	}
	else{
		objPicCommendJs["onload"] = function(){
			ShowTab(obj,strKey)
		}
	}
}

function GetCommendContent(strKey,obj){
	var intPicCount = 48;
	var strPicServer = "http://img.4399.net:8080";

	if (strKey=="5Star"){
		return strDefaultContent;
	}

	if (typeof(arrPicCommend[strKey])=="undefined"){
		LoadPicCommendJs(strKey,obj);
		return;
	}

	var strTemp="<UL>";

	for (var i=0;i<arrPicCommend[strKey].length ;i++)	{
		if (i<intPicCount){
			strTemp = strTemp + "<li><a href=\""+(isNaN(arrPicCommend[strKey][i][0])?arrPicCommend[strKey][i][0]:"/flash/"+arrPicCommend[strKey][i][0]+".htm")+"\" target=\"_blank\"><img width=\"100\" height=\"75\" border=\"0\" src=\""+(arrPicCommend[strKey][i][1].indexOf("/")==0?strPicServer:"")+arrPicCommend[strKey][i][1]+"\" /></a><br /><a href=\""+(isNaN(arrPicCommend[strKey][i][0])?arrPicCommend[strKey][i][0]:"/flash/"+arrPicCommend[strKey][i][0]+".htm")+"\" target=\"_blank\">"+arrPicCommend[strKey][i][2]+"</a></li>";
		}
		else{
			strTemp = strTemp + "<li><a href=\""+(isNaN(arrPicCommend[strKey][i][0])?arrPicCommend[strKey][i][0]:"/flash/"+arrPicCommend[strKey][i][0]+".htm")+"\" target=\"_blank\">"+arrPicCommend[strKey][i][2]+"</a></li>";
		}
	}

	strTemp = strTemp + "</UL>";
	return strTemp;
}

function ShowTab(obj,strKey){
	if (typeof(itabs)=="undefined"){
		itabs=$('i_tab').getElementsByTagName("span");
		strDefaultContent = $("pc_htm").innerHTML;
	}
	for(var i=0; i<itabs.length; i++){
		if(itabs[i]==obj){
			itabs[i].className="n1";
			var s = GetCommendContent(strKey,obj);

			if (typeof(s)!="undefined"){
				$('pc_htm').innerHTML=s;
			}
			else{
				return;
			}
		}else{
			itabs[i].className="n2";
		}
	}
}

function ShowTag(strTargetId){
	var tag = document.getElementById("tags").getElementsByTagName("a");
	for(i=1; i<3; i++){
		if(strTargetId=='tagContent'+i){
				tag[i-1].className = "st";
				document.getElementById('tagContent'+i).style.display = "block";
		}else{
				tag[i-1].className = "";
				document.getElementById('tagContent'+i).style.display = "none";
		}
	}
}


function ShowTag2(strTargetId){
	var tag = document.getElementById("tags2").getElementsByTagName("a");
	for(i=3; i<5; i++){
		if(strTargetId=='tagContent'+i){
				tag[i-3].className = "Selected";
				document.getElementById('tagContent'+i).style.display = "block";
		}else{
				tag[i-3].className = "UnSelected";
				document.getElementById('tagContent'+i).style.display = "none";
		}
	}
}