function chClass(obj,isHover){
	if(isHover){
		obj.className = obj.className+'-hover';
	}else{
		obj.className = SuchenUndErsetzen(obj.className, '-hover', '') ;
	}



}

function SuchenUndErsetzen(QuellText, SuchText, ErsatzText)
		        {   // Erstellt von Ralf Pfeifer
		            // Fehlerpruefung
		            if ((QuellText == null) || (SuchText == null))           { return null; }
		            if ((QuellText.length == 0) || (SuchText.length == 0))   { return QuellText; }

		            // Kein ErsatzText ?
		            if ((ErsatzText == null) || (ErsatzText.length == 0))    { ErsatzText = ""; }

		            var LaengeSuchText = SuchText.length;
		            var LaengeErsatzText = ErsatzText.length;
		            var Pos = QuellText.indexOf(SuchText, 0);

		            while (Pos >= 0)
		            {
		                QuellText = QuellText.substring(0, Pos) + ErsatzText + QuellText.substring(Pos + LaengeSuchText);
		                Pos = QuellText.indexOf(SuchText, Pos + LaengeErsatzText);
		            }
		            return QuellText;
		        } // -->


 
function toggleBox(id){
	var  div = document.getElementById(id);
	 
	if(div.style.visibility == 'hidden'){
		var togglerEl = document.getElementById('toggler_'+id);
		togglerEl.className = 'toggler active';
		toggleDiv(id,"open");
	}else{
		var togglerEl = document.getElementById('toggler_'+id);
		togglerEl.className = 'toggler inactive';
		toggleDiv(id,"close");
	}
	return false;
}

// The class name of toggle objects which will be initially hidden
var toggleDivClassName = "toggle";
// This controls how slowly the div initially starts moving.
// Lower values case a slower initial move speed. Must be > 1
var toggleDivSpeedMultiplier = 2;
// The delay between each move.
var toggleDivDelay = 10;

// If you only want one toggle DIV to be open at any time, set this to true
var toggleDivOnlyOneOpen = false;

// An array to hold references to all toggleDiv objects on the page
var toggleDivs = new Array();
// Contains the IDs of divs currently being toggled, so you can't stop one mid-open or close
var togglingDivs = new Object();
var origHeights = new Array();

function closeAll(className,letOpenId){
	var elements = new Array();
	elements = getElementsByClassName(className);
	letOpenEl = document.getElementById(letOpenId);
	commentsEl = document.getElementById('ipas_box_comments');
	var count=elements.length;
	for (i=0; i<count; i++){
		origHeights[elements[i].id] = elements[i].offsetHeight;
		if(elements[i] != letOpenEl && elements[i] != commentsEl )
			closeElement(elements[i]);
	}
}

function closeElement(element){ 
	element.style.position = "absolute";
	element.style.visibility = "hidden";
	var togglerEl = document.getElementById('toggler_'+element.id);
	togglerEl.className = 'toggler inactive';
 
	
}

function getElementsByClassName(class_name)
      {
        var all_obj,ret_obj=new Array(),j=0,teststr;

        if(document.all)all_obj=document.all;
        else if(document.getElementsByTagName && !document.all)
          all_obj=document.getElementsByTagName("*");

        for(i=0;i<all_obj.length;i++)
        {
          if(all_obj[i].className.indexOf(class_name)!=-1)
          {
            teststr=","+all_obj[i].className.split(" ").join(",")+",";
            if(teststr.indexOf(","+class_name+",")!=-1)
            {
              ret_obj[j]=all_obj[i];
              j++;
            }
          }
        }
        return ret_obj;
      }
 
function toggleDiv(divId,action) {
	var d = document.getElementById(divId);
	//if (d==null || d.tagName!="DIV" || !d.offsetHeight || togglingDivs[divId]) { return; }

	d.style.overflow = "hidden";
	if (action=="open" || (typeof(action)=="undefined" && d.style.visibility=="hidden")) {
	 
		// open it
		 
		var height = 1;
		d.style.height = height+"px";
		d.style.visibility = "visible";
		d.style.position="static";
		togglingDivs[divId] = true;
		 setTimeout("toggleObject('"+divId+"','open',"+origHeights[d.id]+","+height+")",toggleDivDelay);
	 }
	 else if (action=="close" || (typeof(action)=="undefined" && d.style.visibility=="visible")) {
		// close it
		 
		 
		 var height = origHeights[d.id];
		 togglingDivs[divId] = true;
		 setTimeout("toggleObject('"+divId+"','close',"+origHeights[d.id]+","+height+")",toggleDivDelay);
	 }
}


function toggleObject(divId, openClose, originalHeight, height) {
	 var d = document.getElementById(divId);
	  if (d==null || d.tagName!="DIV") { return; }
	 
	 if (openClose=="open") {
		  height = height * toggleDivSpeedMultiplier;
		  if (height > originalHeight) {
			  d.style.height = originalHeight+"px";
			  d.style.overflow = "visible";
			  delete togglingDivs[divId];

		  }else {
			 d.style.height = height+"px";
			 setTimeout("toggleObject('"+divId+"','"+openClose+"',"+originalHeight+","+height+")",toggleDivDelay);
		 }
	 }
	 else {
		 height = height * (1/toggleDivSpeedMultiplier);
		 if (height <= 1) {
			 d.style.position = "absolute";
			 d.style.visibility = "hidden";
			 d.style.height = originalHeight+"px";
			 delete togglingDivs[divId];
		 }
		 else {
			 d.style.height = height+"px";
			 setTimeout("toggleObject('"+divId+"','"+openClose+"',"+originalHeight+","+height+")",toggleDivDelay);
		 }
	 }
}
