var c_var=new Array();

// ==============File load===============================
function include_dom(script_filename){
    var html_doc = document.getElementsByTagName('head')[0];
    js = document.createElement('script');
    js.type = "text/javascript";
    js.src = script_filename;
    html_doc.appendChild(js);
    return false;
}

function file_path(path){
sessvars.a_lang=path
include_dom(path+"/content.js")
	if (sessvars.a_menu!="") {
		include_dom(path+"/"+sessvars.a_menu+"_content.js")
	} else {
		include_dom(path+"/0_content.js")
	}
}	

// ==============language switch========================
function change_lang(lang){
    if (lang.length > 0) {
       sessvars.a_lang=lang  
       window.location.reload()
       window.location.reload()
    }
}

//==============menu switch===========================
function change_content(mpoint){
    if (mpoint.length > 0) {
       sessvars.a_menu=mpoint  
       window.location.reload()
       window.location.reload()
    }
}       

// =============Check data from sessvars======================
if (sessvars.a_menu === undefined) {sessvars.a_menu="0";}
if (sessvars.a_lang!=undefined){
	 file_path(sessvars.a_lang)
} else switch (navigator.language) {
	case "el-GR": case "el": file_path("he"); break;
	case "es-ES": case "es": file_path("es"); break;
	case "fr-FR": case "fr": file_path("fr"); break;
	case "hu-HU": case "hu": file_path("hu"); break;
	case "it-IT": case "it": file_path("it"); break;
	case "ltg-LV": case "ltg": file_path("ltg"); break;
	case "lv-LV": case "lv": file_path("lv"); break;
	case "ru-RU": case "ru": file_path("ru"); break;
	case "uk-UA": case "uk": file_path("uk"); break;
	default: file_path("en")
}
 
// ================Get vars function==========================              
function gv(kv){
    if (c_var[kv]){
        document.write(c_var[kv])
    } else {
        document.write(kv)
    }
}
