function HideLoader(){	document.getElementById("PreloadPic").className = "hideMe";}

function HideObj(ObjName){
	//alert(ObjName);
	document.getElementById (ObjName).style.visibility = "hidden";	
}
function KillObj(ObjName){
	document.getElementById (ObjName).style.display = "none";	
}
function ActObj(ObjName){
	document.getElementById (ObjName).style.display = "inline-block";
}

function ToggleObj(ObjName){
	var OBJ = document.getElementById (ObjName);
	var NewDis= "none";	
	if (OBJ.style.display  == "none"){ NewDis="inline-block"; }
	OBJ.style.display = NewDis;	
}

function showJSM(){
	KillObj('MemberDD');
	ActObj('JSMDD');
}

function FEcho(TEXT){
	alert(TEXT);
}


function CenterMe(){
return;
	var CBox = document.getElementById("ContentDiv");

	if (screen.width <=  1499)
	{
		CorrLeft = ((screen.width - 16 )- 1499	) /2;		//16 = scrollbar.width			
	}else{
		CorrLeft = 0;
	}
	
	 CBox.style.marginLeft =  CorrLeft+"px";	
	
	if (screen.height > 770){
		 CBox.style.marginTop = "0px";		
	}
	
	CorrW = (screen.width - 16-CorrLeft);
	CBox.style.width 	= CorrW+"px";		//error in Moz		
/*	CBox.style.overflowX 	= "hidden";
	CBox.style.overflowY	= "visible";
*/	
	/* Hide Preloader */
	
	
}


//alert("loaded FTools.js");

function SelectSelect(SelOb,Target ) 
{ 
	 var chosenoption=SelOb.options[SelOb.selectedIndex] ; //this refers to "selectmenu"
	 if (chosenoption.value!="nothing"){
		//alert( chosenoption.value);
		window.location.href ="index.php?target="+Target+"&Member=" + chosenoption.value;
	 }
}




function ElVal(SetValue,ObjectID,SelectThisID){
	//alert (ObjectID + " -> " +SetValue + " ThisIs "+SelectThisID );
	document.getElementById (ObjectID).value = SetValue;	
}



function DelQ(BLUB){
	return window.confirm("Eintrag '"+ BLUB +"' wirklich löschen?.");
}



function CoSwitch(ID,MNAME){
	
	document.getElementById('JSM_DropDown_c').style.display="none";
	
	//alert("!!");
	
	var Selected = getElementsByStyleClass("orange_c JSM_Link_c SelectedC","a");		//altes deselektieren
	if (Selected.length == 1){
		Selected[0].className="orange_c JSM_Link_c";
	}
	//alert("2");
	document.getElementById(ID).className="orange_c JSM_Link_c SelectedC";		//Select ist selected

	//alert("c");
	var ZE = document.getElementById("JSMSell_c");
	//alert(ZE + ZE.innerHTML +ID+"N");
	ZE.innerHTML= MNAME;
	
	
	//dynamiccontentNS6("CoSelId",MNAME)
	
	document.getElementById("MemberOption").value=ID;
}



function getElementsByStyleClass (className,TAG) {
  var all = document.all ? document.all :
    document.getElementsByTagName(TAG ); 
 // alert(all + " len = " + all.length); 
  var elements = new Array();
  for (var e = 0; e < all.length; e++){
  
    if (all[e].className == className){
      elements[elements.length] = all[e];
    }  
  }
  
  return elements;
}


function dynamiccontentNS6(elementid,content){
if (document.getElementById && !document.all){
rng = document.createRange();
el = document.getElementById(elementid);
rng.setStartBefore(el);
htmlFrag = rng.createContextualFragment(content);
while (el.hasChildNodes())
el.removeChild(el.lastChild);
el.appendChild(htmlFrag);
}
}


function dump(obj) {
    var out = '';
    for (var i in obj) {
        out += i + ": " + obj[i] + "\n";
    }

    alert(out);

    // or, if you wanted to avoid alerts...

    var pre = document.createElement('pre');
    pre.innerHTML = out;
    document.body.appendChild(pre)
}

function toggleAnd(ObjId,OutId){
	ToggleObj(ObjId);
	 var d;
	 d = setTimeout("OutsideKill('"+ObjId+"')",500);	
}

function OutsideKill(KillObjID){
	document.onclick = function(evt) {	
	    if(clickedOutsideElement(KillObjID,evt)){
		KillObj(KillObjID);		
		document.onclick ="";
		//alert("out"+KillObjID);
	    }
	}
}

function clickedOutsideElement(elemId,evt) {
   var theElem = "";
   
   if(window.event){
	   theElem = getEventTarget(window.event);
   } else{
	   theElem = getEventTarget(evt);
   }
   
    while(theElem != null) {
        if(theElem.id == elemId)
            return false;
        theElem = theElem.offsetParent;
    }
    return true;
}

function getEventTarget(evt) {
    var targ = (evt.target) ? evt.target : evt.srcElement;
    if(targ != null) {
        if(targ.nodeType == 3)
            targ = targ.parentNode;
    }
    return targ;
}
