﻿var FunnyEncode = window.encodeURIComponent ? encodeURIComponent : escape;
var strT_Key="";

function Click_Key(strKey,strT){
	CookListKey(strKey);
	
	if (strT!=undefined) glb_strT=strT;
	
	window.location="/H6.aspx?F=/CMS/Search/List.P6&T="+glb_strT
		+"&Key="+FunnyEncode(strKey);
}

function Key_URL(strKey,strT){
	if (strT==undefined) strT=glb_strT;
	
	var strReturn="";
	if (strKey.substr(0,1)=="#"){
		strKey=strKey.substr(1);
	}
	if (strKey.substr(0,2)=="V:"){
		if (strKey.substr(0,4)=="V:F_"){
			strReturn="/H6.aspx?F=/CMS/Search/View.P6&T="+strT+"&ID="
    			+strKey.substr(4);
		}else{
    		strReturn="/H6.aspx?F=/CMS/Search/List.P6&T="+strT+"&Key="+encodeURI(strKey);
		}
	}else{
		strReturn="/H6.aspx?F=/CMS/Search/List.P6&T="+strT+"&Key="+encodeURI(strKey);
	}
	return strReturn;
}

var glb_Key_Css="";

function WriteKey(strKey,strTitle,Count,strT){
	if (strT==undefined) strT=strT_Key;
	
	if (strTitle==undefined){
		strTitle=strKey;
	}
	
	var strCss="";
	if (glb_Key_Css!=""){
		strCss='style="'+glb_Key_Css+'"';
	}
	
	if (Count==undefined){
		document.write("<A href=\""+Key_URL(strKey,strT)+"\" class=\"t12blue\" "+strCss+">"
			+strTitle+"</A>&nbsp;&nbsp;");
	}else{
		if (Count>100){
			strCss='style="font-size:16px;font-weight:bold;"';
		}else if (Count>10){
			strCss='style="font-size:14px;font-weight:bold;"';
		}else{
			strCss='style="font-size:12px;"';
		}
		document.write("<A href=\""+Key_URL(strKey,strT)+"\" class=\"t12blue\" "+strCss+">"
			+strTitle+"</A>("+Count+")&nbsp;&nbsp;");
	}
}