mc_meta.inc.js 5.01 KB
var var_meta;
var var_metaMenu;
var var_metaContent;
var var_show;

var var_ProfileID;
var var_Lang;
var var_Host;
var var_url;

var var_helpIndexHtml;
var var_searchIndexHtml;
var obj_metaNames = new Object();

function fnc_mkMetaHead(param_kind){
	switch(param_kind){
		case "help" :	{
							return '<a class="metaHead" href="javascript:fnc_mkHelpIndex()">'+obj_lang['helpIndex']+'</a> '+obj_lang['help'];
						}
		case "search" :	{
							return '<a class="metaHead" href="javascript:fnc_mkSearchIndex()">'+obj_lang['newSearch']+'</a> '+obj_lang['search'];
						}
		case "tag" :	{
							if(!window.document.getElementById("Taglist") || window.document.getElementById("Taglist").style.display=="none"){
								return obj_lang['tagcloud'];
							}
							else{
								return '<a class="metaHead" href="javascript:fnc_showTagcloud()">'+obj_lang['tagcloud']+'</a> '+obj_lang['tagcloud'];
							}
						}
		default : break;
	}
}
function fnc_mkHelpIndex(){
	window.document.getElementById("help").innerHTML=var_helpIndexHtml;
}
function fnc_mkSearchIndex(){
	window.document.getElementById("search").innerHTML=var_searchIndexHtml;
}
function fnc_showTagcloud(){
	fnc_simpleHideOrShow("Taglist");
	fnc_simpleHideOrShow("TagcloudHidden");
}

function fnc_initMeta(param_id, param_host, param_lang, param_url){
	var_ProfileID=param_id;
	var_Host = param_host+unescape("/");
	var_Lang=param_lang;
	var_url=param_url;

	obj_metaNames["clipboard"] = obj_lang['clipboard'];
	obj_metaNames["help"] = fnc_mkMetaHead("help");
	obj_metaNames["info"] = obj_lang['infobox'];
	obj_metaNames["search"] = fnc_mkMetaHead("search");
	obj_metaNames["tag"] = fnc_mkMetaHead("tag");;
	obj_metaNames["jsMeta"] = obj_lang['jsMeta'];

	var_meta = document.getElementById("Meta");
	if(!(navigator.appName == "Microsoft Internet Explorer")){
	  var_meta.style.position="fixed";
	}
	var_metaMenu = var_meta.getElementsByTagName("div")[0];
	var_metaContent = var_meta.getElementsByTagName("div")[1];

	var tmp_metali = var_metaMenu.getElementsByTagName("ul")[0].getElementsByTagName("li");

	for(i = tmp_metali.length - 1; i >= 0; i--){
	  tmp_metali[i].getElementsByTagName("a")[0].setAttribute("href", "javascript:fnc_showMeta('"+tmp_metali[i].getElementsByTagName("a")[0].getAttribute("name")+"')");
	}
	var_helpIndexHtml = window.document.getElementById("help").innerHTML;
	var_searchIndexHtml = window.document.getElementById("search").innerHTML;


	if(var_metaContent.style.display=="block"){
		tmp_kind = self.location.href.split('&m[');

		if(tmp_kind.length > 1){
			tmp_kind = tmp_kind[1].split(']');
			window.document.getElementById("metaClose").setAttribute("href", "javascript:fnc_showMeta('"+tmp_kind[0]+"')");
			var_show = tmp_kind[0];
		}
	}

}
function fnc_setProfileID(param_id){
	var_ProfileID=param_id;
}
function fnc_showMeta(kind, param_bc){
	if(var_metaContent.style.display=="block"){
		if(var_show==kind){
			var_metaContent.style.display="none";
			var_meta.style.zIndex="0";
			var_metaContent.style.zIndex="-1";
			//window.document.getElementById(kind).style.display="none";
			window.document.getElementsByTagName('div')[kind].style.display="none";
		}
		else{
			//window.document.getElementById(kind).style.display="block";
			//window.document.getElementById(kind).style.zIndex="2";
			//window.document.getElementById(var_show).style.display="none";
			window.document.getElementsByTagName('div')[kind].style.display="block";
			window.document.getElementsByTagName('div')[kind].style.zIndex="2";
			fnc_mkMetaContent(kind, param_bc);
			window.document.getElementsByTagName('div')[var_show].style.display="none";
		}
	}
	else{
		var_metaContent.style.display="block";
		var_metaContent.style.zIndex="2";
		var_meta.style.zIndex="2";
		//window.document.getElementById(kind).style.display="block";
		document.getElementsByTagName('div')[kind].style.display="block";
		fnc_mkMetaContent(kind, param_bc);
	}
	var_show = kind;

	if(var_metaContent.style.display=="block"){
		window.document.getElementById("metaClose").setAttribute("href", "javascript:fnc_showMeta('"+kind+"')");
	}
}
function fnc_mkMetaContent(kind, param_bc){

	fnc_getMetaHead(kind,param_bc);

	switch(kind){
		case "clipboard" : {
								fnc_xmlChooserShowBC(var_ProfileID, "Clipboard", "clipboard");
								break;
							}
		case "help" : {

								if(window.document.getElementById("help").innerHTML=="")
									fnc_mkHelpIndex();

								break;
							}
		case "search" : {

								if(window.document.getElementById("search").innerHTML=="")
									fnc_mkSearchIndex();

								break;
							}
		default : 		{
							break;
						}
	}
}
function fnc_getMetaHead(param_kind, param_bc){

	tmp_head=window.document.getElementById("metaHead");
	tmp_head.lastChild.innerHTML="";
	if(param_bc == 'FileBC'){
		var tmp_a = window.document.createElement("a");
		tmp_a.className="metaHead";
		tmp_a.innerHTML=obj_lang['new'+param_bc];
		tmp_a.href="javascript:mk_makeNewContent('FileBC','jsMeta')";
		tmp_a.title = obj_lang['new'+param_bc];
		tmp_head.lastChild.appendChild(tmp_a);
	}
	tmp_head.lastChild.innerHTML+=obj_metaNames[param_kind];
}