var ns = document.layers;
var moz = document.getElementById && !document.all;
var ie = document.all;

var protok = window.location.protocol + '//';
if(protok=='')protok='http://';
if(window.location.hostname.indexOf("www.")!=-1){
var myJsDomain=protok+"www."+window.location.hostname;
}else{
var myJsDomain=protok+window.location.hostname;
}
//alert(myJsDomain);
function setNexDate(nexDateIs){
document.news.added.value = nexDateIs;
}
function setNewNexDate(nexDateIs,myID){
  var sInput = ("document.nexRTEFORM_"+myID+".added");
  sInput = eval(sInput);
  sInput.value = nexDateIs;
}
function setNexDateRGdate(nexDateIs){
  document.nex.rechnungsDatum.value = nexDateIs;
}
function setNexDateRGdue(nexDateIs){
  document.nex.rechnungsFalligkeit.value = nexDateIs;
}
function setNexDateRGdeliv(nexDateIs){
  document.nex.rechnungsLieferungAm.value = nexDateIs;
}
function setNexDateRGpayed(nexDateIs){
  document.nex.rechnungsBezahltAm.value = nexDateIs;
}
function setNexDateAGval(nexDateIs){
  document.angebotForm.angebotsGultigkeit.value = nexDateIs;
}
function setNexDateAGdate(nexDateIs){
  document.angebotForm.angebotsDatum.value = nexDateIs;
}

function _nexGE(obj){
	return document.getElementById(obj);
}
function str_replace(search, replace, subject) {
	try{
    return subject.split(search).join(replace);
  } catch(E){
  	return subject;
  }
}
function trimString (str) {
  str = this != window? this : str;
  return str.replace(/^\s+/g, '').replace(/\s+$/g, '');
}
String.prototype.trim = trimString;



function isset(varname){
  return(typeof(window[varname])!='undefined');
}

function getElementsByClassName(clsName){
    var retVal = new Array();
    var elements = document.getElementsByTagName("*");
    for(var i = 0;i < elements.length;i++){
        if(elements[i].className.indexOf(" ") >= 0){
            var classes = elements[i].className.split(" ");
            for(var j = 0;j < classes.length;j++){
                if(classes[j] == clsName)
                    retVal.push(elements[i]);
            }
        }
        else if(elements[i].className == clsName)
            retVal.push(elements[i]);
    }
    return retVal;
}

document.getElementsByClassName = function(clsName){
	return getElementsByClassName(clsName);
}
function setNexKTprice(ertrag,kosten){
  document.ktForm.einzelgewinn.value = ertrag;
  document.ktForm.selbstkosten.value = kosten;
}


function getNexRTE(nexRTIs,x) {
  var sInput = ("document.nexRTEFORM_"+x);
  sInput = eval(sInput);
  sInput.content.value = nexRTIs;
  sInput.submit();
}
function submitRTEForm_orig(x){
  var sInput = ("document.nexRTEFORM_"+x);
  sInput = eval(sInput);
  sInput.submit();
}
var trigger_langID;
function submitRTEForm(x){
	if(window.location.search.indexOf('content_det')!=-1){
		cID=x;
		var langID=trigger_langID;
	  	var turl='admin.php?a=content_update&categoryID=".$categoryID."&languCode=".$languCode."&contentlanguID='+langID+'&page=".$page."&howMany=".$howMany."';
		turl += '&contentID='+cID+'';
		turl += '&ajaxOut=1';
		turl += '&changeHeader='+escape(document.getElementById('changeHeader_'+cID+'').value);
		turl += '&headerSize='+document.getElementById('headerSize_'+cID+'').value;
		turl += '&linkID='+document.getElementById('linkID_'+cID+'').value;
		turl += '&changeUserRight='+document.getElementById('changeUserRight_'+cID+'').value;
		turl += '&css='+escape(document.getElementById('css_'+cID+'').value);
		turl += '&contentChangeActive='+document.getElementById('online_'+cID+'').value;
		document.getElementById('cid'+cID+'_status').innerHTML = 'loading';
		ajaxpage(turl,'cid'+cID+'_status');
		var objt=document.getElementById('cid'+cID+'_status');
		var teID='cid'+cID+'_status';
		var out;
		succ_mid = teID;
		succ_cID = cID;
		setTimeout('checkSuccess()',2000);
	} else {
		var sInput = ("document.nexRTEFORM_"+x);
		  sInput = eval(sInput);
		  sInput.submit();
	}
}



function getFlashMovieObject(movieName)
{
  if (window.document[movieName]) 
  {
    return window.document[movieName];
  }
  if (navigator.appName.indexOf("Microsoft Internet")==-1)
  {
    if (document.embeds && document.embeds[movieName])
      return document.embeds[movieName]; 
  }
  else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
  {
    return document.getElementById(movieName);
  }
}



function triggerNexRTEupdate(x){
  var Wert = "update";
  
  /*
  
  if (ns){
    var sInput = ("document.embeds['nexRTE_"+x+"']");	
  }else if (moz){ 
    var sInput = ("document.embeds['nexRTE_"+x+"']");
    var sInput = document.getElementById("nexRTE_"+x);
  //hier landet safari, Mozilla
  }else if (ie){
    var sInput = ("document.nexRTE_"+x);	  
  }
  var sInput = ("window.document.nexRTE_"+x);
  sInput = eval(sInput);
  */
  sInput = getFlashMovieObject("nexRTE_"+x);
  
  sInput = eval(sInput);
  sInput.SetVariable("/:jQuery",Wert);
}
function triggerNexRTEinsert(x){
  var Wert = "insert";
  if (ns){
    var sInput = ("document.embeds['nexRTE_"+x+"']");	
  }else if (moz){ 
    var sInput = ("document.embeds['nexRTE_"+x+"']");	  
  }else if (ie){
    var sInput = ("document.nexRTE_"+x);	  
  }
  sInput = eval(sInput);
  sInput.SetVariable("/:jQuery",Wert);
}
function openArea(what) {
  var areaObj = document.getElementById("cid"+what).style;
  var areaObj2 = document.getElementById("rid"+what).style;
  if (areaObj.display == "block") {
  	areaObj.display = "none";
  	//areaObj2.display = "block";
  	areaObj2.border = "0px";
  } else {
  	areaObj.display = "block";
  	//areaObj2.display = "none";
  	areaObj2.border = "3px solid #f00";
  }
}
function rover(what) {
  var areaObj = document.getElementById("stat"+what).style;
  if (areaObj.display == "inline") {
  	areaObj.display = "none";
  } else {
  	areaObj.display = "inline";
  }
}
function glossrover(what) {
  var areaObj = document.getElementById("g_"+what).style;
  if (areaObj.display == "block") {
  	areaObj.display = "none";
  } else {
  	areaObj.display = "block";
  }
}
var nexNewWin;

function nexpopup(theurl,thename,params)
{
	nexNewWin = window.open('',thename,params);
}
function openProp(what) {
	
  var areaObj = document.getElementById("properties_link").style;
  areaObj.display = "none";
  var areaObj = document.getElementById("properties_live").style;
  areaObj.display = "none";  
  var areaObj = document.getElementById("properties_seo").style;
  areaObj.display = "none";
  var areaObj = document.getElementById("properties_meta").style;
  areaObj.display = "none";
  var areaObj = document.getElementById("properties_geo").style;
  areaObj.display = "none";
  var areaObj = document.getElementById("properties_sitemap").style;
  areaObj.display = "none";  
  var areaObj = document.getElementById("properties_admin").style;
  areaObj.display = "none";
  var areaObj = document.getElementById("properties_sidebar").style;
  areaObj.display = "none";
  
  var areaObj = document.getElementById(what).style;
  areaObj.display = "block";

}
function genericshowhide(what,blocknone) {
  var areaObj = document.getElementById(what).style;
  areaObj.display = blocknone;
}
function genericrover(what) {
  var areaObj = document.getElementById("g_"+what).style;  
  var areaObjS = document.getElementById("iS_"+what).style;
  var areaObjH = document.getElementById("iH_"+what).style;
  if (areaObj.display == "block") {
  	areaObj.display = "none";
  	areaObjS.display = "inline";
  	areaObjH.display = "none";
  } else {
  	areaObj.display = "block";
  	areaObjS.display = "none";
  	areaObjH.display = "inline";
  }
}
function animate()
{
	var elem = document.getElementById('progress');
	if(elem != null) {
		if (pos==0) len += dir;
		if (len>32 || pos>251) pos += dir;
		if (pos>251) len -= dir;
		if (pos>251 && len==0) pos=0;
		elem.style.left = pos;
		elem.style.width = len;
	}
}
function remove_loading() {
	this.clearInterval(t_id);
	var targelem = document.getElementById('loader_container');
	targelem.style.display='none';
	targelem.style.visibility='hidden';
	
	var targelem2 = document.getElementById('maincontent');
	targelem2.style.display='block';
	targelem2.style.visibility='visible';
}
function changecss(theC,element,value) {
	var cssRules;
	if (document.all) {
		cssRules = 'rules';
	}
	else if (document.getElementById) {
		cssRules = 'cssRules';
	}
	for (var S = 0; S < document.styleSheets.length; S++){
		for (var R = 0; R < document.styleSheets[S][cssRules].length; R++) {
			if (document.styleSheets[S][cssRules][R].selectorText == theC) {
				document.styleSheets[S][cssRules][R].style[element] = value;
			}
		}
	}	
}

function openCatList(what) {
	
  var areaObj = document.getElementById("catList_structure").style;
  areaObj.display = "none";
  var areaObj = document.getElementById("catList_newest").style;
  areaObj.display = "none";
  var areaObj = document.getElementById("catList_lastadded").style;
  areaObj.display = "none";
  var areaObj = document.getElementById("catList_mostviewed").style;
  areaObj.display = "none";
  var areaObj = document.getElementById("catList_mostunique").style;
  areaObj.display = "none";
  
  var areaObj = document.getElementById(what).style;
  if (areaObj.display == "block") {
  	areaObj.display = "none";
  } else {
  	areaObj.display = "block";
  }
}

function nexElectorSeek(Wert,FeldID)
{
	for(i=0; i<document.getElementById(FeldID).options.length; i++)
	{
		if(Wert.substr(0, Wert.length).toLowerCase()==document.getElementById(FeldID).options[i].text.substr(0, Wert.length).toLowerCase() && Wert.length!=0)
		{
			document.getElementById(FeldID).options[i].selected = true;
			break;
		}
	}
}
function setoffset ( selectedtype )
{
document.nexecutive1.offset.value = selectedtype ;
document.nexecutive1.wizard.value = true ;
document.nexecutive1.submit();
}

function toggleArea(what) {
  var areaObj = document.getElementById("cid"+what).style;
  if (areaObj.display == "block") {
  	areaObj.display = "none";
  } else {
  	areaObj.display = "block";
  }
}



var delay = "2";  //############# How long before window appears (seconds)
var winw = "280"; //############# How wide should your window be (pixels)
var winh = "320"; //############# How tall should the window be (pixels)


//############# Auto centering DHTML popup window by Dave lauderdale
//############# Originally published at www.digi-dl.com


var ie=(document.all);
var ns=(document.layers);
var ns6=(document.getElementById && !ie);
var calculate=ns? "" : "px"
function loadElement(){
if(!ns && !ie && !ns6) return;
if(ie) popup=eval('document.all.elementDiv.style');
else if(ns) popup=eval('document.layers["elementDiv"]');
else if(ns6) popup=eval('document.getElementById("elementDiv").style');
if (ie||ns6) popup.visibility="visible";
else popup.visibility ="show";
displayElement()
}
function displayElement(){
var agent=navigator.userAgent.toLowerCase();
if (ie){
	documentWidth = (centerElement().offsetWidth)/2+centerElement().scrollLeft-(winw/2);
	documentHeight = (centerElement().offsetHeight)/2+centerElement().scrollTop-(winh/2);
}
else if (ns){
	documentWidth=window.innerWidth/2+window.pageXOffset-(winw/2);
	documentHeight=window.innerHeight/2+window.pageYOffset-(winh/2);
}
else if (ns6){
	documentWidth=self.innerWidth/2+window.pageXOffset-(winw/2);
	documentHeight=self.innerHeight/2+window.pageYOffset-(winh/2);
}
popup.left = documentWidth+calculate;
popup.top = documentHeight+calculate;
setTimeout("displayElement()",100);
}
function centerElement(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}
function closeElement(){
	if (ie||ns6) { popup.display="none"; } 
	else { popup.visibility ="hide"; }
}



var myCurrentHash = str_replace("#","",window.location.hash);
var myNewHash=str_replace("#","",window.location.hash);
var myHashHistory = new Array(myCurrentHash);
var no_hash_change=false;
var iframesfix=false;

var detect = navigator.userAgent.toLowerCase();
var iframeid = 'ajax_back_frame_controll';
if(detect.indexOf("msie")!=-1) {	
	iframesfix = true;
	addEvent(window, "load", creatAjaxControllerFrame);
}
function setHash(new_hash) {
	window.location.hash=new_hash;			
}
function checkWhetherChanged(){
	if(myNewHash != myCurrentHash) {
//		if(iframesfix)AjaxIframesFixer(iframeid);
//		if(iframesfix==false){
			//firefox und co
			if(myCurrentHash.indexOf('|||@|||')!=-1){
				temp = myCurrentHash.split('|||@|||');
				no_hash_change=true;
				ajaxpage(temp[0],temp[1]);
				myNewHash=myCurrentHash;
			} else if(iframesfix==false){
				if(window.location.href.indexOf('#')!=-1){
					if(window.location.hash=='')				
					history.back();
				}
			} else {
			//	if(document.frames[iframeid].getLocation()==''){		
			//		history.back();
			//	}
			}
//		} else {
			
//		}
	}
//	alert('out');
	if(iframesfix==false){
		myCurrentHash = str_replace("#","",window.location.hash);
	} else {
		try{
			if(document.frames[iframeid].getFreshness()=='altered'){
				myCurrentHash = document.frames[iframeid].getLocation();
				//setTimeout("getNewHashFromFrame()",500);
			//	alert(myCurrentHash +' - '+myNewHash);
			}
		}
		catch(E){
			
		}
	}
	setTimeout("checkWhetherChanged()", 200);
}

function getNewHashFromFrame(){
	myCurrentHash = document.frames[iframeid].getLocation();
}
checkWhetherChanged();


function AjaxIframesFixer(iframeid) {
	if (document.getElementById(iframeid)) {
		
		var temp_hash = str_replace("#","",myNewHash);
		if(temp_hash.length>0)
		document.getElementById(iframeid).src=""+myJsDomain+"/ajax_back_button_helper.php?hash="+escape(temp_hash)+"&r="+Math.random();
		
	} else {
		if(iframesfix) {
			
			
			AjaxIframesFixer(iframeid);
		}
	}
}

function creatAjaxControllerFrame(){
	
	var neuIframe = document.createElement("IFRAME");
	neuIframe.setAttribute("src", ""+myJsDomain+"/ajax_back_button_helper.php?hash="+escape(str_replace("#","",window.location.hash))+"&r="+Math.random());
	neuIframe.setAttribute("name", iframeid);
	neuIframe.setAttribute("style", "");
	neuIframe.setAttribute("width", 100);
	neuIframe.setAttribute("height", 100);
	neuIframe.setAttribute("id", iframeid);
	try{
		neuIframe.name=iframeid;
		neuIframe.id=iframeid;
		neuIframe.style.display="none";
	}catch(E){
		
	}
//	alert(document.getElementsByTagName(iframeid)[0]).src;
	var divs = document.getElementsByTagName("BODY")
	divs[0].appendChild(neuIframe);
	try{
		document.frames[iframeid].setFreshness('refreshed');
	}catch(E){
		
	}
	try{
		//document.frames[iframeid].style.display="none";
		document.getElementById(iframeid).style.display="none";
	}catch(E){
		
	}
	setTimeout("hideAjaxControllerFrame()",500);
}

function hideAjaxControllerFrame(){
	try{
		document.getElementById(iframeid).style="display:none;";
		var ifr = document.getElementsByTagName("IFRAME");
		ifr[(ifr.length-1)].style="display:none;";
	}
	catch(E){
		
	}
}

var disable_ajax_back=true;
var prot = window.location.protocol + '//';

var loadedobjects=""
if(window.location.hostname.indexOf("www.")!=-1){
var rootdomain=prot+window.location.hostname;
}else{
var rootdomain=prot+"www."+window.location.hostname;
}

function ajaxpage(url, containerid){
myCurrentHash=url+'|||@|||'+containerid;
if(window.location.href.indexOf('admin.php')!=-1 || disable_ajax_back==true){
	no_hash_change = true;
}
myNewHash = myCurrentHash;
if(iframesfix){
	try{
		document.frames[iframeid].setFreshness('loading');
	}
	catch(E){}
}
if(!no_hash_change){
	setHash(myNewHash);
} else {	
	//no_hash_change=false;
}

	
var page_request = false;
if (window.XMLHttpRequest){
	// if IE7, Mozilla, Safari etc
	page_request = new XMLHttpRequest();
}else if (window.ActiveXObject){ // if IE
	try {
	page_request = new ActiveXObject("Msxml2.XMLHTTP");
	} 
	catch (e){
		try{
		page_request = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch (e){}
	}
}else{
return false;
}
page_request.onreadystatechange=function(){
	loadpage(page_request, containerid);
}
page_request.open('GET', url, true);
page_request.send(null);
}

function loadpage(page_request, containerid){
	if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1)){
		try{
			document.getElementById(containerid).innerHTML=page_request.responseText;
			
		}
		catch(E){
			
		}
		
		if(iframesfix){
			try{
				document.frames[iframeid].setFreshness('altered');
				document.frames[iframeid].setLocation(myCurrentHash);
				if(!no_hash_change)
					AjaxIframesFixer(iframeid);
			}
			catch(E){
				
			}
		}
		no_hash_change=false;
	}
}

function loadobjs(){
if (!document.getElementById)
return
for (i=0; i<arguments.length; i++){
var file=arguments[i]
var fileref=""
if (loadedobjects.indexOf(file)==-1){ //Check to see if this object has not already been added to page before proceeding
if (file.indexOf(".js")!=-1){ //If object is a js file
fileref=document.createElement('script')
fileref.setAttribute("type","text/javascript");
fileref.setAttribute("src", file);
}
else if (file.indexOf(".css")!=-1){ //If object is a css file
fileref=document.createElement("link")
fileref.setAttribute("rel", "stylesheet");
fileref.setAttribute("type", "text/css");
fileref.setAttribute("href", file);
}
}
if (fileref!=""){
document.getElementsByTagName("head").item(0).appendChild(fileref)
loadedobjects+=file+" " //Remember this object as being already added to page
}
}
}


/***Combo Menu Load Ajax snippet**/
function ajaxcombo(selectobjID, loadarea){
var selectobj=document.getElementById? document.getElementById(selectobjID) : ""
if (selectobj!="" && selectobj.options[selectobj.selectedIndex].value!="")
ajaxpage(selectobj.options[selectobj.selectedIndex].value, loadarea)
}




/*********** Test Funcs Backbutton Ajax ***************/
/* CROSS-BROWSER EVENT HANDLER */
		function addEvent(obj, evType, fn){
			 if (obj.addEventListener){
				 obj.addEventListener(evType, fn, true);
				 return true;
			 } else if (obj.attachEvent){
				 var r = obj.attachEvent("on"+evType, fn);
				return r;
			 } else {
				return false;
			 }
		}
	/* END EVENT HANDLER */
	
	

/***** TEST ENDE ***************/


function nexRegAJU(u,p,px,um,uvn,unn,myDomain,referTo,mode){
 if(p==px){
 	var url_string = prot+myDomain+'/index.php?i=regmodes&userUser='+u+'&userPass='+p+'&userPass2='+px+'&userMail='+um+'&userVorname='+uvn+'&userNachname='+unn;
 	if(mode=='plain'){
		ajaxpage(url_string,'aj_register_div');
		window.location=referTo;
	} else if(mode=='full'){
 	alert(referTo+' --- '+myDomain);
		ajaxpage(url_string,'aj_register_full_div');
		window.location=referTo;
	}
	
 //	alert(referTo+' --- '+myDomain);
 } else {
	alert('Beide Passwörter müssen übereinstimmen');
 }
}
function nexLogAJU(u,p,myDomain,referTo){
 ajaxpage(prot+myDomain+'/logIn.php?userUser='+u+'&userPass='+p,'aj_login_div');
 window.location=referTo;
}
function nexBlockTextfieldCount(f,c,maxc) {
	//f = feld; c= ID des Fortschrittsbalkens; maxc = Maximale Zeichen
	 var fWidth = parseInt(f.offsetWidth); 
	 var ccnt = f.value.length;
	 if (ccnt > maxc) { 
	 	f.value = f.value.substring(0, maxc); 
	 } else { 
	 	var perc = parseInt(100 - (( maxc - ccnt) * 100)/maxc) ; 
	 //	document.getElementById(c).style.width = parseInt((fWidth*perc)/100)+"px"; 
	 	document.getElementById(c).style.width = parseInt(100-perc)+"%"; 
	 	document.getElementById(c).innerHTML="Verf&uuml;gbar: "+(100-perc)+"% ("+(maxc-ccnt)+"/"+maxc+")";
	 	setPercColor(document.getElementById(c),perc); 
	 } 
}
function setPercColor(obj,perc){
	obj.style.background = "rgb(80%,"+(100-perc)+"%,"+(50-(perc/2))+"%)";
}
function setCheckedValue(radioObj, newValue) {
	if(!radioObj)
		return;
	var radioLength = radioObj.length;
	if(radioLength == undefined) {
		radioObj.checked = (radioObj.value == newValue.toString());
		return;
	}
	for(var i = 0; i < radioLength; i++) {
		radioObj[i].checked = false;
		if(radioObj[i].value == newValue.toString()) {
			radioObj[i].checked = true;
		}
	}
}
function stripTags (t) {
	while (t.match(/<.*>/)) t = t.replace(/<[^>]*>/, "");
	return t;
}
function trim (t) {
	return t.replace(/^[ \r\n\t]*/, "").replace(/[ \r\n\t]*$/, "");
}

function getCookieVal (offset) { 
var endstr = document.cookie.indexOf (";", offset); 
if (endstr == -1) 
endstr = document.cookie.length; 
return unescape(document.cookie.substring(offset, endstr));
}
function GetCookie (name) { 
var arg = name + "="; 
var alen = arg.length; 
var clen = document.cookie.length; 
var i = 0; 
while (i < clen) { 
var j = i + alen; 
if (document.cookie.substring(i, j) == arg) 
return getCookieVal (j); 
i = document.cookie.indexOf(" ", i) + 1; 
if (i == 0) break; 
} 
return '';
}
function SetCookie (name, value) { 
var argv = SetCookie.arguments; 
var argc = SetCookie.arguments.length; 
var expires = (argc > 2) ? argv[2] : null; 
var path = (argc > 3) ? argv[3] : null; 
var domain = (argc > 4) ? argv[4] : null; 
var secure = (argc > 5) ? argv[5] : false; 
document.cookie = name + "=" + escape (value) + 
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
//((path == null) ? "" : ("; path=" + path)) + 
"; path=/" +
((domain == null) ? "" : ("; domain=" + domain)) + 
((secure == true) ? "; secure" : "");
}
function DeleteCookie (name) { 
var exp = new Date(); 
exp.setTime (exp.getTime() - 1); 
var cval = GetCookie (name); 
document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}

function in_array(item,arr) {
for(p=0;p<arr.length;p++) if (item == arr[p]) return true;
return false;
}

function insertAfter_id(childID,content,newID,newClass) {
divC = document.getElementById(childID);
divN = document.createElement("div");
document.getElementById('inner_properties_edit').insertBefore(divN, document.getElementById(childID));
divN.innerHTML = content;
divN.id = newID;
//if(!newClass=="notset")divN.className = newClass;
return true;
}
function delete_id(myID) {
 var id=myID, selObj;
 if (document.all)
  { selObj=eval("document.all."+id);
      selObj.outerHTML="";
  }
  else
  { selObj=document.getElementById(id); 
      selObj.parentNode.removeChild(selObj);
  }
}

function unselect_selection(){
	
	try{
		window.execCommand("Unselect");
	} catch (E){
		try{
			oTextRange = window.getSelection();
			oTextRange.collapseToStart();
		}
		catch(E){
			
		}
	}
//oTextRange = document.selection.createRange()
//oTextRange.expand("word")
//oTextRange.execCommand("unselect")
}

function get_html_translation_table(table, quote_style) {
    // Returns the translation table used by htmlspecialchars() and htmlentities()
    // 
    // +    discuss at: http://kevin.vanzonneveld.net/techblog/article/javascript_equivalent_for_phps_get_html_translation_table/
    // +       version: 810.2018
    // +   original by: Philip Peterson
    // +    revised by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // %          note: It has been decided that we're not going to add global
    // %          note: dependencies to php.js. Meaning the constants are not
    // %          note: real constants, but strings instead. integers are also supported if someone
    // %          note: chooses to create the constants themselves.
    // %          note: Table from http://www.the-art-of-web.com/html/character-codes/
    // *     example 1: get_html_translation_table('HTML_SPECIALCHARS');
    // *     returns 1: {'"': '&quot;', '&': '&amp;', '<': '&lt;', '>': '&gt;'}
    
    var entities = {}, histogram = {}, decimal = 0, symbol = '';
    var constMappingTable = {}, constMappingQuoteStyle = {};
    var useTable = {}, useQuoteStyle = {};
    
    useTable      = (table ? table.toUpperCase() : 'HTML_SPECIALCHARS');
    useQuoteStyle = (quote_style ? quote_style.toUpperCase() : 'ENT_COMPAT');
    
    // Translate arguments
    constMappingTable[0]      = 'HTML_SPECIALCHARS';
    constMappingTable[1]      = 'HTML_ENTITIES';
    constMappingQuoteStyle[0] = 'ENT_NOQUOTES';
    constMappingQuoteStyle[2] = 'ENT_COMPAT';
    constMappingQuoteStyle[3] = 'ENT_QUOTES';
    
    // Map numbers to strings for compatibilty with PHP constants
    if (!isNaN(useTable)) {
        useTable = constMappingTable[useTable];
    }
    if (!isNaN(useQuoteStyle)) {
        useQuoteStyle = constMappingQuoteStyle[useQuoteStyle];
    }
    
    if (useTable == 'HTML_SPECIALCHARS') {
        // ascii decimals for better compatibility
        entities['60'] = '&lt;';
        entities['62'] = '&gt;';
        entities['38'] = '&amp;';
    } else if (useTable == 'HTML_ENTITIES') {
        // ascii decimals for better compatibility
	    entities['38'] = '&amp;';
	    entities['60'] = '&lt;';
	    entities['62'] = '&gt;';
	    entities['160'] = '&nbsp;';
	    entities['161'] = '&iexcl;';
	    entities['162'] = '&cent;';
	    entities['163'] = '&pound;';
	    entities['164'] = '&curren;';
	    entities['165'] = '&yen;';
	    entities['166'] = '&brvbar;';
	    entities['167'] = '&sect;';
	    entities['168'] = '&uml;';
	    entities['169'] = '&copy;';
	    entities['170'] = '&ordf;';
	    entities['171'] = '&laquo;';
	    entities['172'] = '&not;';
	    entities['173'] = '&shy;';
	    entities['174'] = '&reg;';
	    entities['175'] = '&macr;';
	    entities['176'] = '&deg;';
	    entities['177'] = '&plusmn;';
	    entities['178'] = '&sup2;';
	    entities['179'] = '&sup3;';
	    entities['180'] = '&acute;';
	    entities['181'] = '&micro;';
	    entities['182'] = '&para;';
	    entities['183'] = '&middot;';
	    entities['184'] = '&cedil;';
	    entities['185'] = '&sup1;';
	    entities['186'] = '&ordm;';
	    entities['187'] = '&raquo;';
	    entities['188'] = '&frac14;';
	    entities['189'] = '&frac12;';
	    entities['190'] = '&frac34;';
	    entities['191'] = '&iquest;';
	    entities['192'] = '&Agrave;';
	    entities['193'] = '&Aacute;';
	    entities['194'] = '&Acirc;';
	    entities['195'] = '&Atilde;';
	    entities['196'] = '&Auml;';
	    entities['197'] = '&Aring;';
	    entities['198'] = '&AElig;';
	    entities['199'] = '&Ccedil;';
	    entities['200'] = '&Egrave;';
	    entities['201'] = '&Eacute;';
	    entities['202'] = '&Ecirc;';
	    entities['203'] = '&Euml;';
	    entities['204'] = '&Igrave;';
	    entities['205'] = '&Iacute;';
	    entities['206'] = '&Icirc;';
	    entities['207'] = '&Iuml;';
	    entities['208'] = '&ETH;';
	    entities['209'] = '&Ntilde;';
	    entities['210'] = '&Ograve;';
	    entities['211'] = '&Oacute;';
	    entities['212'] = '&Ocirc;';
	    entities['213'] = '&Otilde;';
	    entities['214'] = '&Ouml;';
	    entities['215'] = '&times;';
	    entities['216'] = '&Oslash;';
	    entities['217'] = '&Ugrave;';
	    entities['218'] = '&Uacute;';
	    entities['219'] = '&Ucirc;';
	    entities['220'] = '&Uuml;';
	    entities['221'] = '&Yacute;';
	    entities['222'] = '&THORN;';
	    entities['223'] = '&szlig;';
	    entities['224'] = '&agrave;';
	    entities['225'] = '&aacute;';
	    entities['226'] = '&acirc;';
	    entities['227'] = '&atilde;';
	    entities['228'] = '&auml;';
	    entities['229'] = '&aring;';
	    entities['230'] = '&aelig;';
	    entities['231'] = '&ccedil;';
	    entities['232'] = '&egrave;';
	    entities['233'] = '&eacute;';
	    entities['234'] = '&ecirc;';
	    entities['235'] = '&euml;';
	    entities['236'] = '&igrave;';
	    entities['237'] = '&iacute;';
	    entities['238'] = '&icirc;';
	    entities['239'] = '&iuml;';
	    entities['240'] = '&eth;';
	    entities['241'] = '&ntilde;';
	    entities['242'] = '&ograve;';
	    entities['243'] = '&oacute;';
	    entities['244'] = '&ocirc;';
	    entities['245'] = '&otilde;';
	    entities['246'] = '&ouml;';
	    entities['247'] = '&divide;';
	    entities['248'] = '&oslash;';
	    entities['249'] = '&ugrave;';
	    entities['250'] = '&uacute;';
	    entities['251'] = '&ucirc;';
	    entities['252'] = '&uuml;';
	    entities['253'] = '&yacute;';
	    entities['254'] = '&thorn;';
	    entities['255'] = '&yuml;';
    } else if (useTable == 'HTML_UMLAUTE') {
        // ascii decimals for better compatibility
	    entities['161'] = '&iexcl;';
	    entities['162'] = '&cent;';
	    entities['163'] = '&pound;';
	    entities['164'] = '&curren;';
	    entities['165'] = '&yen;';
	    entities['166'] = '&brvbar;';
	    entities['167'] = '&sect;';
	    entities['168'] = '&uml;';
	    entities['169'] = '&copy;';
	    entities['170'] = '&ordf;';
	    entities['171'] = '&laquo;';
	    entities['172'] = '&not;';
	    entities['173'] = '&shy;';
	    entities['174'] = '&reg;';
	    entities['175'] = '&macr;';
	    entities['176'] = '&deg;';
	    entities['177'] = '&plusmn;';
	    entities['178'] = '&sup2;';
	    entities['179'] = '&sup3;';
	    entities['180'] = '&acute;';
	    entities['181'] = '&micro;';
	    entities['182'] = '&para;';
	    entities['183'] = '&middot;';
	    entities['184'] = '&cedil;';
	    entities['185'] = '&sup1;';
	    entities['186'] = '&ordm;';
	    entities['187'] = '&raquo;';
	    entities['188'] = '&frac14;';
	    entities['189'] = '&frac12;';
	    entities['190'] = '&frac34;';
	    entities['191'] = '&iquest;';
	    entities['192'] = '&Agrave;';
	    entities['193'] = '&Aacute;';
	    entities['194'] = '&Acirc;';
	    entities['195'] = '&Atilde;';
	    entities['196'] = '&Auml;';
	    entities['197'] = '&Aring;';
	    entities['198'] = '&AElig;';
	    entities['199'] = '&Ccedil;';
	    entities['200'] = '&Egrave;';
	    entities['201'] = '&Eacute;';
	    entities['202'] = '&Ecirc;';
	    entities['203'] = '&Euml;';
	    entities['204'] = '&Igrave;';
	    entities['205'] = '&Iacute;';
	    entities['206'] = '&Icirc;';
	    entities['207'] = '&Iuml;';
	    entities['208'] = '&ETH;';
	    entities['209'] = '&Ntilde;';
	    entities['210'] = '&Ograve;';
	    entities['211'] = '&Oacute;';
	    entities['212'] = '&Ocirc;';
	    entities['213'] = '&Otilde;';
	    entities['214'] = '&Ouml;';
	    entities['215'] = '&times;';
	    entities['216'] = '&Oslash;';
	    entities['217'] = '&Ugrave;';
	    entities['218'] = '&Uacute;';
	    entities['219'] = '&Ucirc;';
	    entities['220'] = '&Uuml;';
	    entities['221'] = '&Yacute;';
	    entities['222'] = '&THORN;';
	    entities['223'] = '&szlig;';
	    entities['224'] = '&agrave;';
	    entities['225'] = '&aacute;';
	    entities['226'] = '&acirc;';
	    entities['227'] = '&atilde;';
	    entities['228'] = '&auml;';
	    entities['229'] = '&aring;';
	    entities['230'] = '&aelig;';
	    entities['231'] = '&ccedil;';
	    entities['232'] = '&egrave;';
	    entities['233'] = '&eacute;';
	    entities['234'] = '&ecirc;';
	    entities['235'] = '&euml;';
	    entities['236'] = '&igrave;';
	    entities['237'] = '&iacute;';
	    entities['238'] = '&icirc;';
	    entities['239'] = '&iuml;';
	    entities['240'] = '&eth;';
	    entities['241'] = '&ntilde;';
	    entities['242'] = '&ograve;';
	    entities['243'] = '&oacute;';
	    entities['244'] = '&ocirc;';
	    entities['245'] = '&otilde;';
	    entities['246'] = '&ouml;';
	    entities['247'] = '&divide;';
	    entities['248'] = '&oslash;';
	    entities['249'] = '&ugrave;';
	    entities['250'] = '&uacute;';
	    entities['251'] = '&ucirc;';
	    entities['252'] = '&uuml;';
	    entities['253'] = '&yacute;';
	    entities['254'] = '&thorn;';
	    entities['255'] = '&yuml;';
    } else {
        throw Error("Table: "+useTable+' not supported');
        return false;
    }
    
    if (useQuoteStyle != 'ENT_NOQUOTES') {
        entities['34'] = '&quot;';
    }
    
    if (useQuoteStyle == 'ENT_QUOTES') {
        entities['39'] = '&#039;';
    }
    
    // ascii decimals to real symbols
    for (decimal in entities) {
        symbol = String.fromCharCode(decimal)
        histogram[symbol] = entities[decimal];
    }
    
    return histogram;
}



function html_entity_decode_umlaute( string, quote_style ) {
   

    var histogram = {}, symbol = '', tmp_str = '', i = 0;
    tmp_str = string.toString();
    
    if (false === (histogram = get_html_translation_table('HTML_UMLAUTE', quote_style))) {
        return false;
    }
    
    for (symbol in histogram) {
        entity = histogram[symbol];
        tmp_str = tmp_str.split(entity).join(symbol);
    }
    
    return tmp_str;
}

function htmlentities_umlaute (string, quote_style) {

    var histogram = {}, symbol = '', tmp_str = '', i = 0;
    tmp_str = string.toString();
    
    if (false === (histogram = get_html_translation_table('HTML_UMLAUTE', quote_style))) {
        return false;
    }
    
    for (symbol in histogram) {
        entity = histogram[symbol];
        tmp_str = tmp_str.split(symbol).join(entity);
    }
    
    return tmp_str;
}



function html_entity_decode( string, quote_style ) {
    // Convert all HTML entities to their applicable characters
    // 
    // +    discuss at: http://kevin.vanzonneveld.net/techblog/article/javascript_equivalent_for_phps_html_entity_decode/
    // +       version: 810.2018
    // +   original by: john (http://www.jd-tech.net)
    // +      input by: ger
    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +    revised by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   bugfixed by: Onno Marsman
    // +   improved by: marc andreu
    // +    revised by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // -    depends on: get_html_translation_table
    // *     example 1: html_entity_decode('Kevin &amp; van Zonneveld');
    // *     returns 1: 'Kevin & van Zonneveld'

    var histogram = {}, symbol = '', tmp_str = '', i = 0;
    tmp_str = string.toString();
    
    if (false === (histogram = get_html_translation_table('HTML_ENTITIES', quote_style))) {
        return false;
    }
    
    for (symbol in histogram) {
        entity = histogram[symbol];
        tmp_str = tmp_str.split(entity).join(symbol);
    }
    
    return tmp_str;
}

function htmlentities (string, quote_style) {
    // Convert all applicable characters to HTML entities
    // 
    // +    discuss at: http://kevin.vanzonneveld.net/techblog/article/javascript_equivalent_for_phps_htmlentities/
    // +       version: 810.2018
    // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +    revised by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: nobbler
    // +    tweaked by: Jack
    // +   bugfixed by: Onno Marsman
    // +    revised by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // -    depends on: get_html_translation_table
    // *     example 1: htmlentities('Kevin & van Zonneveld');
    // *     returns 1: 'Kevin &amp; van Zonneveld'

    var histogram = {}, symbol = '', tmp_str = '', i = 0;
    tmp_str = string.toString();
    
    if (false === (histogram = get_html_translation_table('HTML_ENTITIES', quote_style))) {
        return false;
    }
    
    for (symbol in histogram) {
        entity = histogram[symbol];
        tmp_str = tmp_str.split(symbol).join(entity);
    }
    
    return tmp_str;
}

function htmlspecialchars (string, quote_style) {
    // Convert special characters to HTML entities
    // 
    // +    discuss at: http://kevin.vanzonneveld.net/techblog/article/javascript_equivalent_for_phps_htmlspecialchars/
    // +       version: 810.2018
    // +   original by: Mirek Slugen
    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   bugfixed by: Nathan
    // +   bugfixed by: Arno
    // +    revised by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // -    depends on: get_html_translation_table
    // *     example 1: htmlspecialchars("<a href='test'>Test</a>", 'ENT_QUOTES');
    // *     returns 1: '&lt;a href=&#039;test&#039;&gt;Test&lt;/a&gt;'

    var histogram = {}, symbol = '', tmp_str = '', i = 0;
    tmp_str = string.toString();
    
    if (false === (histogram = get_html_translation_table('HTML_SPECIALCHARS', quote_style))) {
        return false;
    }
    
    for (symbol in histogram) {
        entity = histogram[symbol];
        tmp_str = tmp_str.split(symbol).join(entity);
    }
    
    return tmp_str;
}

function htmlspecialchars_decode(string, quote_style) {
    // Convert special HTML entities back to characters
    // 
    // +    discuss at: http://kevin.vanzonneveld.net/techblog/article/javascript_equivalent_for_phps_htmlspecialchars_decode/
    // +       version: 810.2018
    // +   original by: Mirek Slugen
    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   bugfixed by: Mateusz "loonquawl" Zalega
    // +      input by: ReverseSyntax
    // +      input by: Slawomir Kaniecki
    // +      input by: Scott Cariss
    // +      input by: Francois
    // +   bugfixed by: Onno Marsman
    // +    revised by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // -    depends on: get_html_translation_table
    // *     example 1: htmlspecialchars_decode("<p>this -&gt; &quot;</p>", 'ENT_NOQUOTES');
    // *     returns 1: '<p>this -> &quot;</p>'

    var histogram = {}, symbol = '', tmp_str = '', i = 0;
    tmp_str = string.toString();
    
    if (false === (histogram = get_html_translation_table('HTML_SPECIALCHARS', quote_style))) {
        return false;
    }
    
    for (symbol in histogram) {
        entity = histogram[symbol];
        tmp_str = tmp_str.split(entity).join(symbol);
    }
    
    return tmp_str;
}

function utf8_decode ( str_data ) {
    // http://kevin.vanzonneveld.net
    // +   original by: Webtoolkit.info (http://www.webtoolkit.info/)
    // +      input by: Aman Gupta
    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: Norman "zEh" Fuchs
    // +   bugfixed by: hitwork
    // +   bugfixed by: Onno Marsman
    // *     example 1: utf8_decode('Kevin van Zonneveld');
    // *     returns 1: 'Kevin van Zonneveld'
 
    var tmp_arr = [], i = ac = c1 = c2 = c3 = 0;
 
    str_data += '';
 
    while ( i < str_data.length ) {
        c1 = str_data.charCodeAt(i);
        if (c1 < 128) {
            tmp_arr[ac++] = String.fromCharCode(c1);
            i++;
        } else if ((c1 > 191) && (c1 < 224)) {
            c2 = str_data.charCodeAt(i+1);
            tmp_arr[ac++] = String.fromCharCode(((c1 & 31) << 6) | (c2 & 63));
            i += 2;
        } else {
            c2 = str_data.charCodeAt(i+1);
            c3 = str_data.charCodeAt(i+2);
            tmp_arr[ac++] = String.fromCharCode(((c1 & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
            i += 3;
        }
    }
 
    return tmp_arr.join('');
}

function utf8_encode ( string ) {
    // Encodes an ISO-8859-1 string to UTF-8
    // 
    // +    discuss at: http://kevin.vanzonneveld.net/techblog/article/javascript_equivalent_for_phps_utf8_encode/
    // +       version: 810.621
    // +   original by: Webtoolkit.info (http://www.webtoolkit.info/)
    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: sowberry
    // +    tweaked by: Jack
    // +   bugfixed by: Onno Marsman
    // *     example 1: utf8_encode('Kevin van Zonneveld');
    // *     returns 1: 'Kevin van Zonneveld'

    string = (string+'').replace(/\r\n/g,"\n");
    var utftext = "";
    var start, end;
    var stringl = 0;

    start = end = 0;
    stringl = string.length;
    for (var n = 0; n < stringl; n++) {
        var c1 = string.charCodeAt(n);
        var enc = null;

        if (c1 < 128) {
            end++;
        } else if((c1 > 127) && (c1 < 2048)) {
            enc = String.fromCharCode((c1 >> 6) | 192) + String.fromCharCode((c1 & 63) | 128);
        } else {
            enc = String.fromCharCode((c1 >> 12) | 224) + String.fromCharCode(((c1 >> 6) & 63) | 128) + String.fromCharCode((c1 & 63) | 128);
        }
        if (enc != null) {
            if (end > start) {
                utftext += string.substring(start, end);
            }
            utftext += enc;
            start = end = n+1;
        }
    }

    if (end > start) {
        utftext += string.substring(start, string.length);
    }

    return utftext;
}
function getRecursiveOffsetY(inputObj){
  var returnValue = inputObj.offsetTop;
  while((inputObj = inputObj.offsetParent) != null){
  	returnValue += inputObj.offsetTop;
  }
  return returnValue;
}
function getRecursiveOffsetX(inputObj){
  var returnValue = inputObj.offsetLeft;
  while((inputObj = inputObj.offsetParent) != null)returnValue += inputObj.offsetLeft;
  return returnValue;
}
function clearSelection () {
if (document.selection)
document.selection.empty();
else if (window.getSelection)
window.getSelection().removeAllRanges();
}

function disableSelection(target){
if (typeof target.onselectstart!="undefined") //IE route
	target.onselectstart=function(){return false}
else if (typeof target.style.MozUserSelect!="undefined") //Firefox route
	target.style.MozUserSelect="none"
else //All other route (ie: Opera)
	target.onmousedown=function(){return false}
//target.style.cursor = "default"
}

function enableSelection(target){
if (typeof target.onselectstart!="undefined") //IE route
	target.onselectstart=function(){return true}
else if (typeof target.style.MozUserSelect!="undefined") //Firefox route
	target.style.MozUserSelect="auto"
else //All other route (ie: Opera)
	target.onmousedown=function(){return true}
//target.style.cursor = "default"
}
var nexDragSelectionTimer = null;
 var nex_dragobj = null;var nex_dragx = 0;var nex_dragy = 0;var nex_posx = 0;var nex_posy = 0;var nex_dragmode = 'all';
 function nex_draginit() {document.onmousemove = nex_drag_rr;document.onmouseup = nex_dragstop;}
 function nex_drag_rr(ereignis) {nex_drag(ereignis);try{startMoveSlider(ereignis);}catch(E){}}
 function nex_dragstart(obj) {clearSelection ();nex_dragmode = "all";nex_dragobj = document.getElementById(obj);nex_dragx = nex_posx - nex_dragobj.offsetLeft;nex_dragy = nex_posy - nex_dragobj.offsetTop;}
 function nex_dragstartx(obj) {clearSelection ();nex_dragmode = "x";nex_dragobj = document.getElementById(obj);nex_dragx = nex_posx - nex_dragobj.offsetLeft;}
 function nex_dragstarty(obj) {clearSelection ();nex_dragmode = "y";nex_dragobj = document.getElementById(obj);nex_dragy = nex_posy - nex_dragobj.offsetTop;}
 function nex_dragstop() {if(nex_dragobj!=null){clearSelection ();}nex_dragobj=null;}
 function nex_drag(ereignis) {nex_posx = document.all ? window.event.clientX : ereignis.pageX;nex_posy = document.all ? window.event.clientY : ereignis.pageY;if(nex_dragobj != null) {if(nex_dragmode == "all" || nex_dragmode == "x"){nex_dragobj.style.left = (nex_posx - nex_dragx) + "px";}if(nex_dragmode == "all" || nex_dragmode == "y"){nex_dragobj.style.top = (nex_posy - nex_dragy) + "px";}}}


nex_draginit();


