var ns = document.layers;
var moz = document.getElementById && !document.all;
var ie = document.all;

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 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(x){
  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";
  } else {
  	areaObj.display = "block";
  	areaObj2.display = "none";
  }
}
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_edit").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(what).style;
  if (areaObj.display == "block") {
  	areaObj.display = "none";
  } else {
  	areaObj.display = "block";
  }
}
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 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";
  }
}