/**
 ******************************************************************
 *              Philipp Knöller Software Entwicklung              *
 *                        Framework Funktor                       *
 *                           Version 0.9b                         *
 *                                                                * 
 *                  http://pksoftware.de/funktor                  *
 *                                                                *
 ******************************************************************
 * 
 * $Id: FFLangKeySearch.js,v 1.1.2.1 2008/02/24 15:24:14 pknoeller Exp $
 * 
 * Functions for AJAX Requests
 * 
 * @author Philipp Knoeller
 * @copyright Copyright &copy; 2006, Philipp Knoeller
 * @link http://pksoftware.de/funktor
 * @version 1.0.0.3
 * @package funktor_ffmain
 * @subpackage js
 */

/**
 * Class FAjax represents an AJAX request
 */ 
function FAjax(nUrl, sendRid){

	 this.requestUrl=nUrl;
     this.getString=null;
     this.postString=null;
     this.searchTimer=null;
     this.http_request = false;
     this.requestId=0;
     this.sendRid=sendRid;

    /**
     * initializes a browser specific http request object
     * @author Philipp Knoeller
     */
    this.prepareRequest=function() {

        this.http_request = false;

        if (window.XMLHttpRequest) { // Mozilla, Safari,...
            this.http_request = new XMLHttpRequest();
            if (this.http_request.overrideMimeType) {
                this.http_request.overrideMimeType('text/xml');
                
            }
        } 
        else if (window.ActiveXObject) { // IE
            try {
                this.http_request = new ActiveXObject("Msxml2.XMLHTTP");
            } 
            catch (e) {
                try {
                    this.http_request = new ActiveXObject("Microsoft.XMLHTTP");
                } 
                catch (e) {}
            }
        }

        if (!this.http_request) {
            alert('Cannot create XMLHTTP instance.');
            return false;
        }
   };
 
 /**
  * sets the get string
  */
 this.setGetString=function(ngs){
 	this.getString=ngs;
 };
 
 /**
  * sets the post string
  */
 this.setPostString=function(nps){
 	this.postString=nps;
 }
 
 /**
  * sets the url of the next request
  */
  this.setUrl=function(ngs){
 	this.requestUrl=ngs;
 };
 
 /**
 * Sends a new request, "overrides" any other requests 
 * @author Philipp Knoeller
 * @param method request method 'GET' or 'POST'
 */
 this.request=function(xmlExspected, method, responseFunction, errorFunction, customUrl, customGet, customPost){
         method=method.toUpperCase();
         if(!((method=='GET') || (method=='POST'))) alert('Invalid request method: '+method);
         
         this.prepareRequest();
         
         this.requestId++;
         
         var httpRequest=this.http_request;
         var finalRequestId=this.requestId;
         this.http_request.onreadystatechange=function(){
         	  if ( (httpRequest.readyState == 4) &&
                   (httpRequest.status == 200) ) {
                        return responseFunction(xmlExspected ? 
                                                httpRequest.responseXML : 
                                                httpRequest.responseText, finalRequestId);
              }
 	          
 	          if(!errorFunction) return false;        
              
              return errorFunction(httpRequest.readyState, httpRequest.status);
 	                   
         };
         
         
         var ridAdd="";
         if(this.sendRid) ridAdd+="ff_rid="+this.requestId+"&";
         
         var finalUrl=(customUrl ? customUrl :this.requestUrl);
         var finalGet=(customGet ? customGet : this.getString);
         var finalPost=(customPost ? customPost : this.postString);
         
         if(finalGet) finalUrl+=(-1 == finalUrl.indexOf("?") ? "?" : "&") + finalGet;
         
         this.http_request.open(method, finalUrl, true);
         
         if(method=='POST'){ 
	          this.http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	          this.http_request.setRequestHeader("Content-length", finalPost.length);
	          this.http_request.setRequestHeader("Connection", "close"); 
         }
         
         this.http_request.send(finalPost ? finalPost : null);
         
         return true;
 }        
 
 /**
  * Sends a request OLD
  * @deprecated use this.request instead
  */
 this.sendRequest=function(method, responseFunction, customUrl, customGet, customPost){
         this.prepareRequest();
         this.requestId++;
         var fixId=this.requestId;
         var ht=this.http_request;
         this.http_request.onreadystatechange=function(){
         	  if (ht.readyState == 4) {
                   if (ht.status == 200) {
                        var xmldoc = ht.responseXML;
                        //xml_decode(xmldoc);

                        return responseFunction(xmldoc, fixId);
                   }
                   return false;
 	          }
 	          else{         
                   return false; //setFirstNodeValue(searchHintElement, 'xx'+f);f++;
 	          }         
         };
         
         
         var ridAdd="";
         if(this.sendRid) ridAdd+="ff_rid="+this.requestId+"&";
         
         var finalUrl=(customUrl ? customUrl :this.requestUrl);
         var finalGet=(customGet ? customGet : this.getString);
         var finalPost=(customPost ? customPost : this.postString);
         
         this.http_request.open(method, finalUrl+(finalGet ? (-1==finalUrl.indexOf("?") ? "?" : "&")+finalGet : ""), true);
         
         if(method.toUpperCase()=='POST'){ 
          this.http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
          this.http_request.setRequestHeader("Content-length", finalPost.length);
          this.http_request.setRequestHeader("Connection", "close"); 
         }
         
         this.http_request.send(finalPost ? finalPost : null);
         
         return true;
 };  

 /**
 * Returns the id of the last request
 */
 this.getRequestId=function(){
 	  return this.requestId;
 }

 this.setRequestId=function(nr){
 	  this.requestId=nr;
 }

 
 /**
 * Starts a request with a delay
 */
 this.search_once=function(searchFunction, delay){
 	   window.setTimeout(searchFunction, delay);
 }
 
 /**
 * Starts a timer request
 */
 this.start_search=function(searchFunction, searchInterval){
       this.searchTimer=window.setInterval(searchFunction, searchInterval);
 };
 
 /**
 * Stops a timer request
 */
 this.stop_search=function(){
 	  window.clearInterval(this.searchTimer);
 	  this.searchTimer=null;
 };
 



}

function ffHasInputChanged(textFieldId, minLength, notValue,doNotCacheField){
    var field=gE(textFieldId);
    var newSearchString=field.type=='checkbox' ? (field.checked?'1':'0') : field.value;
    var oldSearchString=getFieldCache(textFieldId);
    if ( (oldSearchString!=newSearchString) &&
             ((null==minLength) || (newSearchString.length>=minLength)) &&
             ((null==notValue) || newSearchString!=notValue) ) {
              
              if(!doNotCacheField) setFieldCache(textFieldId, newSearchString);
              return newSearchString;
              }
               return null;
}

 /**
 * fuellt eine <select> Box mit <entry>s aus einer xml
 * der nodeValue wir zum Label der <option>s, der Inhalt der "value" attribute der <entry>s wird zum "value" der <option>s
 * @author Philipp Knöller
 * @param ressource xmldoc XML document root node
 * @param string searchSelectBox id of the <select> box which should contain the result
 * @deprecated use ffArrayToSelectBox instead
 */
  function xmlToSelectBox(xmldoc, selectBoxId, containerDivId){
   	     var entrys=xmldoc.getElementsByTagName("entry");
         return ffArrayToSelectBox(entrys, selectBoxId, containerDivId, 'Keine passenden Eintraege'); 
                //alert(root_node.firstChild.data);
               // alert(http_request.responseText);
   }
   
   /**
 * fills a <select> box with data from an array
 * if sourceArray is a dom object, the value attribute will become the value of the option. The firstChild.nodeValue will become the label of the option.
 * If sourceArray is a normal object the property names will be the values of the options, and the property values will be the label of the options
 * @author Philipp Knöller
 * @param ressource xmldoc XML document root node
 * @param string searchSelectBox id of the <select> box which should contain the result
 * @deprecated use ffArrayToSelectBox instead
 */
   function ffArrayToSelectBox(sourceArray, selectBoxId, containerDivId, noResultLabel){
         gE(containerDivId).style.display='block';
         
         if(sourceArray.length==0){
                   deleteAllOptions(selectBoxId);
                   if(noResultLabel)
                       addOption(selectBoxId, noResultLabel, NaN, false, false);
                   else    
                       gE(containerDivId).style.display='none';
                   return false;
         }
         else{
                   var newOptions=new Array();
                   for(var i=0; i<sourceArray.length; i++){
                         
                         var newOptionValue=null;
                         var newOptionLabel=null;
                         //alert(sourceArray[i]);
                         if(!sourceArray[i].value){
                             newOptionValue=sourceArray[i].getAttribute('value');
                             newOptionLabel=sourceArray[i].firstChild.nodeValue;
                         }
                         else{
                             newOptionValue=sourceArray[i].value;
                             newOptionLabel=sourceArray[i].label;
                         }        
                         newOptions[i]=new NewOptionsArray(newOptionLabel, newOptionValue);
                   }
                   fillSelect(selectBoxId, newOptions);
                   return true;
         }
   }      
         
   function ffSelectBoxToTextField(selectBox, textField){
   	    document.getElementById(textField).value=getSelectedOptionLabel(selectBox);
   }
   
   function ffFormSubmit(formId, selectBox, textField){
   	    ffSelectBoxToTextField(selectBox, textField);
   	    document.getElementById(formId).submit();
   }
   
   function ffEntityDecode(string){
   	   	    string=string.replace("&auml;", "ä");
   	   	    string=string.replace("&ouml;", "ö");
   	   	    string=string.replace("&uuml;", "ü");   	   	    
   	   	    string=string.replace("&szlig;", "ß");   	   	    
   	   	    string=string.replace("&Auml;", "Ä");
   	   	    string=string.replace("&Ouml;", "Ö");
   	   	    string=string.replace("&Uuml;", "Ü");   	   	    
   	   	    return string;
   }	   	    /**
 ******************************************************************
 *              Philipp Knoeller Software Entwicklung             *
 *                        Framework Funktor                       *
 *                           Version 1.0                          *
 *                                                                * 
 *                  http://pksoftware.de/funktor                  *
 *                                                                * 
 *                       ALL RIGHTS RESERVED                      *
 *                                                                *
 ******************************************************************
 * 
 * $Id: FBrowser.js,v 1.1.2.4 2008/03/22 00:14:40 pknoeller Exp $
 * 
 * @author Philipp Knoeller
 * @copyright Copyright &copy; 2006, Philipp Knoeller
 * @link http://pksoftware.de/funktor
 * @version 1.0.0.2
 * @package funktor_ffmain
 * @subpackage js
 */

/**
 * Is Internet Explorer?
 */
function isIE(){ return !window.opera && navigator.userAgent.indexOf("MSIE") !=-1;}

isNS4 = (document.layers) ? 1 : 0;
isIE4 = (document.all) ? 1 : 0;
isW3C = (document.getElementById && !document.all) ? 1 : 0;

/**
 * function for retrieving the browser's calculated CSS property values
 */
function getCalculatedProperty(objName, property) {

    // ***** W3C Compatible DOM (NN6, Mozilla 16, etc.) *****

    if (isW3C) {
        docObj = document.getElementById(objName);
		
        if (property == "visibility") {
	        cssp = docObj.style.visibility;
	        return (cssp == "") ? "inherit" : cssp;
	    }

	    if (property == "clip") {
	        cssp = docObj.style.clip;

	        if (cssp == "") {
		       cssStr = "rect(0px "; 
		       cssStr += getCalculatedProperty(objName, "width") + " ";
		       cssStr += getCalculatedProperty(objName, "height") + " ";
		       cssStr += "0px)";
		       return cssStr;
	        }
	        return cssp;
	    }

	    if (property == "zIndex") {
	       cssp = docObj.style.zIndex;
	       return (cssp == "") ? "inherit" : cssp;
	    }

	    cssp = document.defaultView.getComputedStyle(docObj, "").getPropertyValue(property);

	    return (cssp == "") ? "unknown" : cssp;
    }

    // ***** Netscape Navigator 4+ DOM *****

    if (isNS4) {
	    docObj = document.layers[objName];

	    if (property == "visibility") {
	          cssp = docObj.visibility;
	          return (cssp == "hide") ? "hidden" : (cssp == "show") ? "visible" : "inherit";
	    }

	    if (property == "clip") {
	          cssStr = "rect(" + docObj.clip.top + "px ";
	          cssStr += docObj.clip.right + "px ";
	          cssStr += docObj.clip.bottom + "px ";
	          cssStr += docObj.clip.left + "px)";
	          return cssStr;
	    }

	    if ((property == "width") || (property == "height")) {
	         return eval("docObj.clip." + property) + "px";
	    }

	    if (property == "top") property = "pageY";
	    if (property == "left") property = "pageX";

	    cssp = eval("docObj." + property);

	    if (property != "zIndex") cssp += "px";

	    return cssp;
    }

    // ***** Internet Explorer 4+ DOM *****

    if (isIE4) {
	     if (property == "width") return eval(objName + ".offsetWidth") + "px";

	     if (property == "height") return eval(objName + ".offsetHeight") + "px";

	     if (property == "clip") {
	          cssp = eval(objName + ".style.clip");

	          if (cssp == "") {
		           cssStr = "rect(0px ";
		           cssStr += getCalculatedProperty(objName, "width") + " ";
		           cssStr += getCalculatedProperty(objName, "height") + " ";
		           cssStr += "0px)";
		           return cssStr;
	          }
	          return cssp;
	     }

	     if (property == "top") return eval(objName + ".offsetTop") + 'px';

	     if (property == "left") return eval(objName + ".offsetLeft") + 'px';

        // Else, use 'currentStyle' to find the rest

	     return eval(objName + ".currentStyle." + property);
    }
}

/**
 * ermittelt die aktuelle Breite eines Elements (Laufzeit)
 * @author Philipp Knöller
 */
function getComputedWidth(elementId){
	  var el=document.getElementById(elementId);
      
      return isIE() ? el.offsetWidth : getPxValue(document.defaultView.getComputedStyle(el, null).getPropertyValue("width"));
}

/**
 * ermittelt die aktuelle Hoehe eines Elements (Laufzeit)
 * @author Philipp Knöller
 */
function getComputedHeight(elementId){
	  var el=document.getElementById(elementId);
      
      return isIE() ? el.offsetHeight : getPxValue(document.defaultView.getComputedStyle(el, null).getPropertyValue("height"));
}

/**
 * ermittelt die aktuelle X-Position eines Elements (Laufzeit)
 * @author Philipp Knöller
 */
function getComputedLeft(elementId){
	    var el=document.getElementById(elementId);
      
        return isIE() ? el.offsetLeft : getPxValue(document.defaultView.getComputedStyle(el, null).getPropertyValue("left"));
}

/**
 * ermittelt die aktuelle X-Position eines Elements (Laufzeit)
 * @author Philipp Knöller
 */
function getComputedTop(elementId){
	    var el=document.getElementById(elementId);
      
        return isIE() ? el.offsetTop : getPxValue(document.defaultView.getComputedStyle(el, null).getPropertyValue("top"));
}

function getCurrentStyle(elementId, attr){
	    var el=document.getElementById(elementId);
      
        return getPxValue(isIE() ? el.currentStyle[attr] : document.defaultView.getComputedStyle(el, null).getPropertyValue(attr));
}        

///////////////////////////////////////////
/////Window and Page Dimensions////////////
///////////////////////////////////////////

/**
 * returns the dimensions of the browser window
 */
function getWindowDimensions(){
   var x,y;

   if (self.innerHeight){ // all except Explorer
	   x = self.innerWidth;
	   y = self.innerHeight;
   }
   else if (document.documentElement && document.documentElement.clientHeight){ // Explorer 6 Strict Mode
	   x = document.documentElement.clientWidth;
	   y = document.documentElement.clientHeight;
   }
   else if (document.body){  // other Explorers
	   x = document.body.clientWidth;
	   y = document.body.clientHeight;
   }
   var dimensions=new Array(x,y);
   return dimensions;
}

/**
 * returns the dimensions of the visible page in the browser
 */
function getPageDimensions(){
   var x,y;
   var test1 = document.body.scrollHeight;
   var test2 = document.body.offsetHeight
   if (test1>test2) { // all but Explorer Mac
	     x = document.body.scrollWidth;
	     y = document.body.scrollHeight;
   }
   else{ // Explorer Mac; would also work in Explorer 6 Strict, Mozilla and Safari
	     x = document.body.offsetWidth;
	     y = document.body.offsetHeight;
   }
   var dimensions=new Array(x,y);
   return dimensions;
}

/**
* Returns the size of the viewport(visible area) of the browser
**/
function getVisiblePageSize(){
       var dim=new Object();
       //dim.width=document.body.scrollWidth ? document.body.scrollWidth :document.body.offsetWidth;
       //dim.height=document.body.scrollHeight ? document.body.scrollHeight : document.body.offsetHeight;
       
		if (self.innerHeight) // all except Explorer
		{
			dim.width = self.innerWidth;
			dim.height = self.innerHeight;
		}
		else if (document.documentElement && document.documentElement.clientHeight)
			// Explorer 6 Strict Mode
		{
			dim.width = document.documentElement.clientWidth;
			dim.height = document.documentElement.clientHeight;
		}
		else if (document.body) // other Explorers
		{
			dim.width = document.body.clientWidth;
			dim.height = document.body.clientHeight;
		}
       return dim;
}
       
///////////////////////////////////////////
/////////////Text Selection////////////////
///////////////////////////////////////////
 
var selStart=true;
var dissel=true;

document.onselectstart=selectStart;
if (window.sidebar){
    document.onmousedown=disableselect;
    document.onclick=reEnable;
}

function selectStart(e){
    return selStart;
}

function disableselect(e){
    return dissel;
}

function reEnable(){
    return true;
}

/**
 * enables/disables text selection
 */
function setTextSelectEnabled(tEnabled){
    selStart=tEnabled;
    dissel=tEnabled;
} 

/**
 * enables/disables text selection for special element
 */ 
function disableSelection(element) {
    element.onselectstart = function() {
        return false;
    };
    element.unselectable = "on";
    element.style.MozUserSelect = "none";
    element.style.cursor = "default";
} 

///////////////////////////////////////////
/////////////Event Handling////////////////
///////////////////////////////////////////

/**
 * adds an event handler
 */
function addEventHandler(obj, evType, fn, useCapture) {
    if (obj.addEventListener) {
       obj.addEventListener(evType, fn, useCapture);
       return true;
    } 
    else if (obj.attachEvent) {
       var r = obj.attachEvent('on'+evType,fn);
       return r;
    } 
    else {
       obj['on'+evType] = fn;
    }
}

function getShiftAltCtrl(e) {
	 var ctrlPressed=0;
	 var altPressed=0;
	 var shiftPressed=0;
	
	 if (parseInt(navigator.appVersion)>3) {
	
	  var evt = navigator.appName=="Netscape" ? e:event;
	
	  if (navigator.appName=="Netscape" && parseInt(navigator.appVersion)==4) {
		   // NETSCAPE 4 CODE
		   var mString =(e.modifiers+32).toString(2).substring(3,6);
		   shiftPressed=(mString.charAt(0)=="1");
		   ctrlPressed =(mString.charAt(1)=="1");
		   altPressed  =(mString.charAt(2)=="1");
		   self.status="modifiers="+e.modifiers+" ("+mString+")";
	  }
	  else {
		   // NEWER BROWSERS [CROSS-PLATFORM]
		   shiftPressed=evt.shiftKey;
		   altPressed  =evt.altKey;
		   ctrlPressed =evt.ctrlKey;
		   self.status=""
		    +  "shiftKey="+shiftPressed 
		    +", altKey="  +altPressed 
		    +", ctrlKey=" +ctrlPressed 
	  }
	//  if (shiftPressed || altPressed || ctrlPressed) 
	//	   alert ("Mouse clicked with the following keys:\n"
	//	    + (shiftPressed ? "Shift ":"")
	//	    + (altPressed   ? "Alt "  :"")
	//	    + (ctrlPressed  ? "Ctrl " :"")
	//	   )
	 }
	 return new Array(shiftPressed, altPressed, ctrlPressed);
}

var FFUniBrowser={
    /**
    * Mouse positions
    */
    mouseX:0,
    mouseY:0,
    
    /**
    * Gets the mouseX coordinate from the event
    */
	_mouseX:function(evt) {
	    if (!evt){
	          evt = window.event; 
	    }      
	    if (evt.pageX){
	          return evt.pageX; 
	    }
	    else if (evt.clientX){
	          return evt.clientX + 
	                 (document.documentElement.scrollLeft ?  
	                  document.documentElement.scrollLeft : 
	                  document.body.scrollLeft); 
	    }
	    else{ return 0;}
	}, 

	/**
	* Gets the mouseY coordinate from the event
	*/
	_mouseY:function(evt) {
	    if (!evt){
	          evt = window.event; 
	    }      
	    
	    if (evt.pageY){
	          return evt.pageY; 
	    }
	    else if (evt.clientY){ 
	          return evt.clientY + FFUniBrowser.getScrollY(); 
	    }
	    else{ return 0; }
	}, 
	
	refreshMouseCoordinates:function(evt){
	    FFUniBrowser.mouseX=FFUniBrowser._mouseX(evt);
         FFUniBrowser.mouseY=FFUniBrowser._mouseY(evt); 
	},
	
	//Scroll Wert erfassen
	getScrollY:function(){
	    return (document.documentElement.scrollTop ? 
	                  document.documentElement.scrollTop : 
	                  document.body.scrollTop);
	},
	
	setScrollY:function(newTop){
	   if(document.documentElement.scrollTop) 
	                  document.documentElement.scrollTop=newTop; 
	   else document.body.scrollTop=newTop;
	   return true;
	},
	
	//Scroll Wert erfassen
	getScrollX:function(){
	    return (document.documentElement.scrollLeft ? 
	                  document.documentElement.scrollLeft : 
	                  document.body.scrollLeft);
	},
	
    /**
    * determines the absolute position of a non absolute object
    * @author Philipp Knoeller
    * @return Object with left and top attributes
    */
    getCurrentLocation:function(obj){
         var pos = {left:0, top:0};
	     if(typeof obj.offsetLeft != 'undefined'){
		     while (obj){
		          pos.left += obj.offsetLeft;
		          pos.top += obj.offsetTop;
		          obj = obj.offsetParent;
		     }
	    }
		else{
			   pos.left = obj.left ;
			   pos.top = obj.top ;
		}
		return pos;
    }
};	/////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////Tabellen///////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////

function createTd(tr, content, className, id){
    var td1 = document.createElement("td");
    var td1Text = document.createTextNode(content);
    td1.appendChild(td1Text); 
    tr.appendChild(td1);
    if(className){
         var classAtt=document.createAttribute('class');
         classAtt.nodeValue=className;
         td1.setAttributeNode(classAtt);
    }
    return td1;
}

function createTdF(fd, tr, content, className, id){
    var td1 = fd.createElement("td");
    var td1Text = fd.createTextNode(content);
    td1.appendChild(td1Text); 
    tr.appendChild(td1);
    if(className){
         var classAtt=fd.createAttribute('class');
         classAtt.nodeValue=className;
         td1.setAttributeNode(classAtt);
    }
    return td1;
}

function createTr(tableId, index, trClass){
   var tr = frameDocument.getElementById(tableId).insertRow(index);
   var trClass=frameDocument.createAttribute('class');
   trClass.nodeValue=trClass;
   tr.setAttributeNode(trClass);
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////Text Felder////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////








    	 
 

function setFirstNodeValue(id, value){
    document.getElementById(id).firstChild.nodeValue=value;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////Auswahllisten bearbeiten/////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////

//Fuegt eine Option hinzu
function addOption(listId, newLabel, newValue, a, b){
    var newPos=document.getElementById(listId).length;
	document.getElementById(listId).options[newPos]=new Option(newLabel, newValue, a, b);
}

//loesch alle Eintraege
function deleteAllOptions(listId){
    var dl=document.getElementById(listId).length;
    for(i=0; i<dl; i++){
	      document.getElementById(listId).options[document.getElementById(listId).length-1]=null;
	}

}

//Selektiert alle Eintraege einer Liste
function selectAllOptions(listId){
	for(i=0; i<document.getElementById(listId).length; i++){
	      document.getElementById(listId).options[i].selected='selected';
	}
}

//loescht eine option
function deleteOption(listId, index){
	document.getElementById(listId).options[index]=null;
}

//loescht eine option
function deleteLastOption(listId){
	document.getElementById(listId).options[document.getElementById(listId).options.length-1]=null;
}

function setOption(listId, index, label, value, selected){
    document.getElementById(listId).options[index].firstChild.nodeValue=label; 
    document.getElementById(listId).options[index].value=value; 
    if(selected){
    document.getElementById(listId).options[index].selected='selected';
    }
}

function getSelectSelectedIndex(selectId){
	 return document.getElementById(selectId).selectedIndex;
}

function setSelectOptionSelected(selectId, optionsIndex, selected){
	 document.getElementById(selectId).options[optionsIndex].selected=selected ? 'selected' : '';   
}

function setToggleSelected(inputName, index){
     document.getElementsByName(inputName)[index].checked='1';
}

function getSelectOptionValue(selectId, optionIndex){
	    return document.getElementById(selectId).options[optionIndex].value;
}

function getSelectOptionLabel(selectId, optionIndex){
	    return document.getElementById(selectId).options[optionIndex].firstChild.nodeValue;
}

function getOptionValue(listId, index){
    return document.getElementById(listId).options[index].value;
}

function getSelectedOptionLabel(listId){
    return document.getElementById(listId).options[document.getElementById(listId).selectedIndex].firstChild.nodeValue;
}

function getOptionValues(listId){
    var options=document.getElementById(listId).options;
    var returnArray=new Array();
    for(var i=0; i<options.length; i++){
         if(options[i].value!='NaN'){
         returnArray.push(options[i].value);
         }
    }
    return returnArray;
}

function getSelectOptionsLength(listId){
    return document.getElementById(listId).options.length;
}

function NewOptionsArray(label, value){
    this.label=label;
    this.value=value;
}

function fillSelect(listId, newOptions){
    var oldLength=getSelectOptionsLength(listId);
    for(var i=0; i<newOptions.length; i++){
         var label=newOptions[i].label;
         var value=newOptions[i].value;
         if(i<oldLength){
              setOption(listId, i, label, value, i==0);
         }
         else{
              addOption(listId, label, value, i==0, i==0);
         }
    }
    if(newOptions.length<oldLength){
         for(var i=newOptions.length; i<oldLength; i++){
              deleteLastOption(listId);
         }
    }
}


var FFForms={

   clearTextField:function(id){
         gE(id).value='';
   }   

};






/**
 ******************************************************************
 *              Philipp Knoeller Software Entwicklung              *
 *                        Framework Funktor                       *
 *                           Version 0.9b                         *
 *                                                                * 
 *                  http://pksoftware.de/funktor                  *
 *                                                                *
 ******************************************************************
 * 
 * $Id: FFLangKeySearch.js,v 1.1.2.1 2008/02/24 15:24:14 pknoeller Exp $
 * 
 * Functions for Funktor GUI Elements
 * 
 * @author Philipp Knoeller
 * @copyright Copyright &copy; 2006, Philipp Knoeller
 * @link http://pksoftware.de/funktor
 * @version 1.0.0.1
 */
 
 /**
  * verschiebt ein Element einer Select Box nach oben / unten
  * @author Philipp Knöller
  */
 function fSwapOption(selectBoxId, upDown){
    var selIndex=getSelectSelectedIndex(selectBoxId);
	var selLength=getSelectOptionsLength(selectBoxId);
	//alert(selEl);
	if(selIndex!=-1 && selLength>0){
    	   var selLabel=getSelectOptionLabel(selectBoxId, selIndex);
           var selValue=getSelectOptionValue(selectBoxId, selIndex);
    	   if(selValue!='NaN'){
    	   	   var swapIndex=selIndex;

    	       if(upDown==1){
    	   	      if(selIndex<selLength-1){
    	   	      	    swapIndex=selIndex+1;
    	   	      } 	    
    	       }
    	       else{
    	       	  if(selIndex>0){
    	   	      	    swapIndex=selIndex-1;
    	   	      }
    	       }   
    	   	   
    	   	   if(swapIndex!=selIndex){
    	   	      	    var swapLabel=getSelectOptionLabel(selectBoxId, swapIndex);
    	   	      	    var swapValue=getSelectOptionValue(selectBoxId, swapIndex);
    	   	      	     setSelectOptionSelected(selectBoxId, swapIndex, false);
      	   	      	    setSelectOptionSelected(selectBoxId, selIndex,  false);
    	   	      	    setOption(selectBoxId, swapIndex, selLabel, selValue, true);
      	   	      	    setOption(selectBoxId, selIndex, swapLabel, swapValue, false);
    	   	   }
    	       
    	   }
	}
}

/**
* aktualisiert eine n-Liste
* @author Philipp Knöller
*/
function refreshCats(catSelectName, nr, leaveDefault, dsArray, dsLabelArray, dsValue, readyValue, rdsValue){
	var select0=gE(catSelectName + 'Select0').value;
	if(nr==0){
	     if(!leaveDefault){
	          var firstOptionValue=getOptionValue(catSelectName + 'Select0', 0);
	          if(firstOptionValue==dsValue){
	               deleteOption(catSelectName + 'Select0', 0);
	          }
	     }
	     if(select0!=dsValue&&select0!=rdsValue){
	          var selVal=cats[select0];
	          if(selVal.length>0){
	               var i=1;
	               var newOptions=new Array(new NewOptionsArray('[auswählen...]', dsValue));
	               for(var v in selVal){
	                    newOptions[i]=new NewOptionsArray(catLabels[v], v);
		                i++;
	               }
	               fillSelect(catSelectName + 'Select1', newOptions);
	               gE(catSelectName + 'Select1').style.visibility='visible';
	          }
	          else{
	              deleteAllOptions(catSelectName + 'Select1');
	              addOption(catSelectName + 'Select1', '[Fertig]', readyValue, true, true);
		          document.getElementById(catSelectName + 'Select1').style.visibility='hidden';
		          deleteAllOptions(catSelectName + 'Select2');
                  addOption(catSelectName + 'Select2', '[Fertig]', readyValue, true, true);
		          document.getElementById(catSelectName + 'Select2').style.visibility='hidden';
	          }
	     }
	     else{
	          deleteAllOptions(catSelectName + 'Select1');
	          addOption(catSelectName + 'Select1', dsLabelArray[1], dsArray[1] ? rdsValue : dsValue, true, true);
	          deleteAllOptions(catSelectName + 'Select2');
	          addOption(catSelectName + 'Select2', dsLabelArray[2], dsArray[2] ? rdsValue : dsValue, true, true);
	          gE(catSelectName + 'Select1').style.visibility='hidden';
	          gE(catSelectName + 'Select2').style.visibility='hidden';
	     }
	}
	else{
	    var select1=gE(catSelectName + 'Select1').value;
	    var selVal1=cats[select0][select1];
	   
        if(selVal1.length > 0){ //JavaScript sieht einen Array als object
	          var newOptions=new Array(new NewOptionsArray('[auswählen...]', dsValue));
	          for(i=0; i<selVal1.length; i++){
	               var v1=cats[select0][select1][i];
		           newOptions[i+1]=new NewOptionsArray(catLabels[v1], v1);
		      }
		      fillSelect(catSelectName + 'Select2', newOptions);
		      gE(catSelectName + 'Select2').style.visibility='visible';
	    }
	    else{
	          deleteAllOptions(catSelectName + 'Select2');
	          addOption(catSelectName + 'Select2', '[Fertig]', readyValue, true, true);
		      document.getElementById(catSelectName + 'Select2').style.visibility='hidden';
	    }    
	}
	
	//alert(selVal);
}

//#################Countdown

//Zeit herunterzaehlen
var ct;

//Countdown objekt
function CountdownTimer(h, m ,s){
         this.h=h;
         this.m=m;
         this.s=s;
         this.timer=null;
}

//Startet den Countdown
function startCountdown(h, m ,s){
         ct=new CountdownTimer(h, m, s);
         inte=window.setInterval("runDown()", 1000);
         ct.timer=inte;
}

//Zaelt runter(1 Sekunde)
function runDown(){
         ct.s--;
         if(ct.s<0){ 
              ct.s=59; 
              ct.m--
              if(ct.m<0){
                   ct.h--;
                   if(ct.h<0){
                        ct.h=0; 
                        window.clearInterval(ct.timer);
                   }
             }
         }
         document.getElementById('ctHSpan').firstChild.nodeValue=ct.h;
         document.getElementById('ctMSpan').firstChild.nodeValue=ct.m;
         document.getElementById('ctSSpan').firstChild.nodeValue=ct.s;
}  

//######################################
//##################Buttons#############
//######################################

function ffButtonChangeState(buttonId, newState){
    changeImgSrc(buttonId+'_img', buttonId+'_'+newState);
}     


//######################Drop Down Menu
/**
 * Functions to create, display and hide a drop down menu
 * @author Lyuben Manolov
 */
var FFDropDownMenu={
/**
 * Function creates the content of the drop down menu and fills it wit links from the DataCacheArray 
 * @param dataCacheClass class name from the DataCacheArray (dataCacheClass, [link label], [link href])
 */
createFFDropDownMenu:function(dataCacheClass){
	var ffMenuContainerArray = getDataCacheArray(dataCacheClass);
	var tableBody = document.getElementById('ffDropDownMenuTableBody');
	if(tableBody.rows.length > 0){
		var rows = tableBody.rows.length;
		for(var i=0;i<rows;i++){
			tableBody.removeChild(tableBody.rows[tableBody.rows.length-1]);
		}
	}
	for(var element in ffMenuContainerArray){
		var tr = document.createElement('tr');
		tableBody.appendChild(tr);
		var td = document.createElement('td');
		tr.appendChild(td);
		var link = document.createElement('a');
		var linkText = document.createTextNode(element);
		link.href = ffMenuContainerArray[element];
		link.appendChild(linkText);
		td.appendChild(link);
		td.onmouseover = function(){ FFDropDownMenu.showFFDropDownMenu(); }
		td.onmouseout = function(){FFDropDownMenu.closeFFDropDownMenu(); }
	}
	var obj = document.getElementById('ffDropDownMenuCell_'+dataCacheClass);
	var pos = FFUniBrowser.getCurrentLocation(obj);
	var height = getComputedHeight('ffDropDownMenuCell_'+dataCacheClass);
	gE('ffDropDownMenuTable').style.top = pos.top+height+'px';
	gE('ffDropDownMenuTable').style.left = pos.left+'px';
	gE('ffDropDownMenuTable').style.display = "block";
},

/*
 * Function displays the DropDownMenuContainer
 */
showFFDropDownMenu:function(){
	gE('ffDropDownMenuTable').style.display = "block";
},

/*
 * Function hides the DropDownMenuContainer
 */
closeFFDropDownMenu:function(){
	gE('ffDropDownMenuTable').style.display = "none";
}
};	    /////////////////////////////////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////AJAX////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////////////////////////////////
 
 /**
  * depricated
  */
 var http_request = false;

    function prepareRequest() {

        http_request = false;

        if (window.XMLHttpRequest) { // Mozilla, Safari,...
            http_request = new XMLHttpRequest();
            if (http_request.overrideMimeType) {
                http_request.overrideMimeType('text/xml');
                // zu dieser Zeile siehe weiter unten
            }
        } else if (window.ActiveXObject) { // IE
            try {
                http_request = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                try {
                    http_request = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e) {}
            }
        }

        if (!http_request) {
            alert('Ende :( Kann keine XMLHTTP-Instanz erzeugen');
            return false;
        }
   }
 
 function sendRequest(func, method, requestUrl){
         prepareRequest();
         http_request.onreadystatechange=func;
         http_request.open(method, requestUrl, true);
         http_request.send(null);
 }  
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////Image Cache///////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////    
    
//Array zum Cachen von Grafiken
var imageCache=new Array();

//schreibt ein Bild in den Image Cache
function setImageCache(cacheId, cacheSrc){
    imageCache[cacheId]=new Image();
    imageCache[cacheId].src=cacheSrc;
}

function changeImgSrc(imgId, cacheId){
   if(imageCache[cacheId]) document.getElementById(imgId).src=imageCache[cacheId].src;
}

var dataImageCache=new Array();
function createDataImageCacheClass(dataClass){
	  dataImageCache[dataClass]=new Array();

}

function setDataImageCacheSrc(dataClass, dataId, dataValue){
	 dataImageCache[dataClass][dataId]=new Image();
     dataImageCache[dataClass][dataId].src=dataValue;
}

function getDataImageCache(dataClass, dataId){
	 return dataImageCache[dataClass][dataId];
}

function getDataImageCacheArray(dataClass){
	 return dataImageCache[dataClass];
}

function getDataImageCacheArrayLength(dataClass){
	// alert(dataImageCache);
	 var a=dataImageCache[dataClass];
	 alert(dataImageCache[dataClass].join('a'));
	 return a.length;
}

function changeDataImgSrc(imgId, dataClass, dataId){
	//alert(dataImageCache[dataClass][dataId].src);
	 document.getElementById(imgId).src=dataImageCache[dataClass][dataId].src;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////URL Cache///////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////

//URL Cache
var urlCache=new Array();

function setUrlCache(cacheId, cacheUrl){
    urlCache[cacheId]=cacheUrl;
}

function getUrlCache(cacheId){
    return urlCache[cacheId];
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////Field Cache///////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////

//URL Cache
var fieldCache=new Array();

function setFieldCache(cacheId, cacheField){
    fieldCache[cacheId]=cacheField;
}

function getFieldCache(cacheId){
    return fieldCache[cacheId];
}

/**
* JavaScript DataCache for transfer custom data from html(php) to javascript
* @author Philipp Knoeller
*/
var dataCache=new Object();

/**
* @deprecated not needed anymore
*/
function createDataCacheClass(dataClass){
	  dataCache[dataClass]=new Object();
}

/**
* Puts a key/value pair to a dataClass of the DataCache
* If the dataClass does not exist, it will be created
* @author Philipp Knoeller
*/
function setDataCache(dataClass, dataId, dataValue){
	 if(!dataCache[dataClass]) dataCache[dataClass]=new Object();
	 dataCache[dataClass][dataId]=dataValue;
}

/**
* Gets a value of an entry of the class dataClass from the DataCache
* @author Philipp Knoeller
* @return mixed the value
*/
function getDataCache(dataClass, dataId){
	 return dataCache[dataClass][dataId];
}

/**
* Gets the content of a whole dataClass as an array
* @return array content of the dataClass
*/
function getDataCacheArray(dataClass){
	 return dataCache[dataClass];
}



/**
 ******************************************************************
 *              Philipp Knöller Software Entwicklung              *
 *                        Framework Funktor                       *
 *                           Version 0.9b                         *
 *                                                                * 
 *                  http://pksoftware.de/funktor                  *
 *                                                                *
 ******************************************************************
 * 
 * FUtils.js
 * 
 * @author Philipp Knöller
 * @copyright Copyright &copy; 2006, Philipp Knöller
 * @link http://pksoftware.de/funktor
 */

/**
 * PHP equivalent function for formating numbers
 * @author Philipp Knoeller
 */
function number_format (number, decimals, dec_point, thousands_sep){
	  var exponent = "";
	  var numberstr = number.toString ();
	  var eindex = numberstr.indexOf ("e");
	  if (eindex > -1){
	    exponent = numberstr.substring (eindex);
	    number = parseFloat (numberstr.substring (0, eindex));
	  }
	  
	  if (decimals != null){
	    var temp = Math.pow (10, decimals);
	    number = Math.round (number * temp) / temp;
	  }
	  var sign = number < 0 ? "-" : "";
	  var integer = (number > 0 ? 
	      Math.floor (number) : Math.abs (Math.ceil (number))).toString ();
	  
	  var fractional = number.toString ().substring (integer.length + sign.length);
	  dec_point = dec_point != null ? dec_point : ".";
	  fractional = decimals != null && decimals > 0 || fractional.length > 1 ? 
	               (dec_point + fractional.substring (1)) : "";
	  if (decimals != null && decimals > 0){
	       for (i = fractional.length - 1, z = decimals; i < z; ++i)
	          fractional += "0";
	  }
	  
	  thousands_sep = (thousands_sep != dec_point || fractional.length == 0) ? 
	                  thousands_sep : null;
	  if (thousands_sep != null && thousands_sep != ""){
		   for (i = integer.length - 3; i > 0; i -= 3)
	           integer = integer.substring (0 , i) + thousands_sep + integer.substring (i);
	  }
	  
	  return sign + integer + fractional + exponent;
}

/**
 * replaces a substring with another
 */
function replaceIt(string, suchen, ersetzen) {
    var ausgabe = "" + string;
    while (ausgabe.indexOf(suchen)>-1) {
         pos= ausgabe.indexOf(suchen);
         ausgabe = "" + (ausgabe.substring(0, pos) + ersetzen + 
         ausgabe.substring((pos + suchen.length), ausgabe.length));
    }
    return ausgabe;
}

/**
* cut off the px 
*/
function getPxValue(rawPx){
    if(rawPx==null){ return 0;}
    var tempX=rawPx.split('px');
    if(tempX.length==1){
         return tempX[0]=='px'?0:tempX[0];
    }
    else{
         return parseInt(tempX[0]);
    }
}

/**
 * Short form for document.getElementById
 */
function gE(elementId) { return document.getElementById(elementId); }

/**
 * Short form for document.getElementsByTagName
 */
function gT(tagName) { return document.getElementsByTagName(tagName); }
/**
 ******************************************************************
 *              Philipp Knoeller Software Entwicklung              *
 *                        Framework Funktor                       *
 *                           Version 0.9b                         *
 *                                                                * 
 *                  http://pksoftware.de/funktor                  *
 *                                                                *
 ******************************************************************
 * 
 * $Id: FFLangKeySearch.js,v 1.1.2.1 2008/02/24 15:24:14 pknoeller Exp $
 * 
 * Module for managing Popups and Snap-Windows
 * 
 * @author Philipp Knoeller
 * @copyright Copyright &copy; 2006, Philipp Knoeller
 * @link http://pksoftware.de/funktor
 * @version 1.0.0.2
 * @package funktor_ffmain
 * @subpackage js
 */

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////Mouse Koordinaten////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////




//Maus Modus: normal, move
var windowMouseMode='normal';
var moveWindowId=null;









//////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////Window Blinking///////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////



//Componenten die blinken wollen (nach vollstaängigen Laden der seite + timeout) 
var wantBlinkWindows=new Array();
//Componenten die geschlossen werden wollen (nach vollstaängigen Laden der seite + timeout)
var wantCloseWindows=new Array();

//Alle Componenten der Seite
var xComponents=new Array();
function XComponent(componentId, componentType, shemeId, isMinimizable){
    this.componentId=componentId;
    this.componentType=componentType;
    this.width=0;
    this.blinkState=0;
    this.blinkTimer=null;
    this.shemeId=shemeId;
    this.isMinimizable=isMinimizable;
}

/**
* ein Component im JS System registrieren
*/
function registerComponent(componentId, componentType, shemeId, isMinimizable){
    var component=new XComponent(componentId, componentType, shemeId, isMinimizable);
    xComponents[componentId]=component;
}



/**
* setzt den Component auf die Blink Liste
*/
function setWindowBlink(windowId, timeout){
    wantBlinkWindows[windowId]=timeout;
}

/**
* setzt den Component auf die Schliess Liste
*/
function setWindowClose(windowId, timeout){
    wantCloseWindows[windowId]=timeout;
}

/**
* Component invertieren
*/
function invertComponent(componentId, invShemeId){
         var componentData=xComponents[componentId];
         if((componentData.blinkState%2)==0){
         	if(document.getElementById('xwindow_'+componentId+'_arrow_bg')){
              gE('xwindow_'+componentId+'_arrow_bg').style.display='none';
         	}
              setWindowShemeVariant(componentId, 'gelb');
         }
         else{
              resetWindowColors(componentId);
         }
         
         componentData.blinkState++;
         if(componentData.blinkState==4){
              window.clearInterval(componentData.blinkTimer);
         }
}

/**
* Component nach Verzoegerungs blinken lassen
*/
function startBlinkOnce(componentId, timeout){
        window.setTimeout("startStartBlink('"+componentId+"')", timeout);
}

/**
* Component sofort blinken lassen
*/
function startStartBlink(componentId, invShemeId){
	     if(xComponents[componentId]){
             var componentData=xComponents[componentId];
             if(componentData.blinkTimer){
                   window.clearInterval(componentData.blinkTimer);
                   componentData.blinkTimer=null;
                   componentData.blinkState=0;
             }
             componentData.blinkTimer=window.setInterval("invertComponent('"+componentId+"', '"+invShemeId+"')", 200);
	     }
}        

/**
* Componenten nach Verzoegerung schliessen(verstecken)
*/
function closeWindow(windowId, closeSeconds){
         window.setTimeout("gE('"+windowId+"').style.display='none';", closeSeconds*1000);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////Fester klappen///////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////

/**
* Standard Container ist der Zielcontainer wenn Zielcontainer nicht bestimmt werden kann
*/
var defaultContainerId=null;

/**
*setzt den Standard Container der aktuellen Seite
*/
function setDefaultContainer(containerId){
    defaultContainerId=containerId;
}

/**
*setzt den Standard Container der aktuellen Seite EINMAL
*/
function setDefaultContainerOnce(containerId){
    if(defaultContainerId==null){
         defaultContainerId=containerId;
    }
}

/**
*klappt ein Fenster auf/zu
*/
function klappWindow(windowId){
        if(windowMouseMode!='move'){
              setMinimized(windowId, !isMinimized(windowId));        
        }
}

//setzt die Eigenschaften des Fensters
function setWindowState(windowId, isMinimized, isAbsolut, isClosed){
       setMinimized(windowId, isMinimized);
}

/**
*prueft ob ein Fenster zugeklappt ist
*/
function isMinimized(windowId){
	var windowContentId='xw_window_'+windowId+'_content';
    if(!document.getElementById(windowContentId)){
         return false;
    }     
    return document.getElementById(windowContentId).style.display=='none';
}

/**
*minimiert ein Fenster
*/
function setMinimized(windowId, isMinimized){
	  var windowContentId='xw_window_'+windowId+'_content';
      if(!xComponents[windowId].isMinimizable && !document.getElementById(windowContentId)){
         return false;
      }
    //  if(isMinimized){
    //  	    xComponents[windowId].width=getComputedWidth(windowId);
    //  }
      document.getElementById(windowContentId).style.display=isMinimized==1?'none':'';
    //  if(!isMinimized){
    //  	     document.getElementById(windowId).style.width=xComponents[windowId].width+'px';
    //  }
      
      var arrowImgId='xw_window_'+windowId+'_arrow_bg';
      if(document.getElementById(arrowImgId)){
                document.getElementById(arrowImgId).className='xw_window_arrow_bg_' + (isMinimized==1 ? 'down' : 'up');
      }
      return true;
}

function setAllMinimized(isMinimized){
      for(var windowId in xComponents){
         component=xComponents[windowId];
         if((component.componentType=='xwindowsWindow') && component.isMinimizable=='1'){
              setMinimized(windowId, isMinimized);
         }
     }
}
var allMinimizedStatus=0;
function swapAllWindows(){
     var allOpen=0;
     var allClosed=0;
     for(var componentId in xComponents){
         component=xComponents[componentId];
         if(component.isMinimizable){
              var isMinimizedS=isMinimized(componentId);
              if(isMinimizedS){
                   allClosed++;
              }
              else{
                   allOpen++;
              }
         }
     }
         
     
     setAllMinimized(allOpen>allClosed ? 1 : 0);
//     document.getElementById('windowControlMinMaxIcon').src=imageCache[allMinimizedStatus ? 'xwindow_blue_arrowDown' : 'xwindow_blue_arrowUp'].src;
}
/**
*prueft ob ein Fenster in einem Container ist
*/
function isInContainer(windowId){
    if(!document.getElementById(windowId)){
       return false;
    }
    return document.getElementById(windowId).parentNode.className=='xwindowsContainer';
}

/**
*prueft on Object ein Container ist
*/
function isContainer(objectId){
    return document.getElementById(objectId).className=='xwindowsContainer';
}

/**
*prueft on Object ein Container ist
*/
function isWindow(objectId){
    return xComponents[objectId] && xComponents[objectId].componentType=='xwindowsWindow';
}

    
/**
*Funktion wird aufgerufen, wenn Maus Klick auf Fenster Titelleiste losgelassen wird
* klappt dieses Fenster(windowId) auf/zu wenn kein Fenster verschoben wird
* fuegt das verschobene Fenster vor diesem Fenster (windowId) ein
*/
function windowTitleMouseUp(windowId){
    if(windowMouseMode!='move'){
              if(xComponents[windowId].isMinimizable){
                   klappWindow(windowId);
              }
              windowMouseMode='normal';
         }
         else{
              if(isInContainer(windowId)){     
              windowBodyMouseUp(windowId);
              }
         } 
}

/**
*Funktion wird aufgerufen, wenn Maus Taste auf Fenster Titelleiste runtergedrueckt wurde
* setzt dieses Fenster(windowId) als "Verschiebe" Fenster
* speichert aktuelle Mauskoordinaten
*/
function windowTitleMouseDown(windowId){
    if(isInContainer(windowId)){     
         FFWindows.oldMouseX=FFUniBrowser.mouseX;
         FFWindows.oldMouseY=FFUniBrowser.mouseY;
         
         windowMouseMode='mouseDown';
         moveWindowId=windowId;
         
         setTextSelectEnabled(false);
    }
}



/**
*Funktion wird aufgerufen, wenn Maus Taste ueber Fenster Content losgelassen wird
*fuegt "Verschiebe" Fenster vor diesem Fenster(windowId) ein, falls Fenster verschoben wird
*/
function windowBodyMouseUp(windowId){
         if(windowMouseMode=='move'){
              if(isInContainer(windowId)){     
              if(windowId!=moveWindowId){
              
              resetWindowColors(moveWindowId);
              var moveWindow=document.getElementById(moveWindowId);
              moveWindow.style.position='';
              moveWindow.style.width='';
              
              moveWindowId=null;
              windowMouseMode='normal';
              
              var windowBottom=document.getElementById(windowId);
              windowBottom.style.borderColor='red';
              windowBottom.style.borderTopStyle='none';
              
              targetContainerId=windowBottom.parentNode.id;
              document.getElementById(targetContainerId).insertBefore(moveWindow, windowBottom);
              setTextSelectEnabled(true);
              
//            gE('inviteUserTextField').value=targetContainerId;
//            document.getElementById(targetContainerId).appendChild(moveWindow);
              
              }
              }
         }
}          

/**
*Funktion wird aufgerufen, wenn Maus Taste ueber restlicher Seite losgelassen wird
*/
function bodyMouseUp(){
        containerMouseUp(defaultContainerId);
}


         
/**
* setzt das Fenster auf Normal Farben zurueck
*/
function resetWindowColors(windowId){

        setWindowShemeVariant(windowId, xComponents[windowId].shemeId);         
        //if(xComponents[windowId].componentType=='xwindowsWindow'){
        if(document.getElementById('xwindow_'+windowId+'_arrow_bg')){
        document.getElementById('xw_window_'+windowId+'_arrow_bg').style.display='';              
        }
        //}
}

function setWindowShemeVariant(windowId, shemeId){
        document.getElementById(windowId).className=shemeId;
        return true;
}       

/**
*Funktion wird aufgerufen, wenn Maus Taste ueber einem Container losgelassen wird
* fuegt "Verschiebe" Fenster an letzter Stelle des Containers ein
*/
function containerMouseUp(containerId){
        if(windowMouseMode=='move'){
              resetWindowColors(moveWindowId);
              
              
              document.getElementById(moveWindowId).style.position='';
              document.getElementById(moveWindowId).style.width='';
              container= document.getElementById(containerId);
              container.appendChild(document.getElementById(moveWindowId));
              moveWindowId=null;
              windowMouseMode='normal';
            
              setTextSelectEnabled(true);
//              document.getElementById(containerId).style.borderColor='red';
            //  document.getElementById(containerId).style.backgroundColor='transparent';
              
         }
}

/**
*Funktion wird aufgerufen, wenn Maus ueber einem Container bewegt wird
*/
function containerMouseOver(containerId){
 
        if(windowMouseMode=='move'){
               //gE('inviteUserTextField').value='a' + containerId;
            //  document.getElementById(containerId).style.backgroundColor='red';
    //          document.getElementById(containerId).style.borderTopStyle='solid';
  //            document.getElementById(containerId).style.borderTopWidth='1px';
        }
}

/**
*Funktion wird aufgerufen, wenn Maus einen Container verlaesst
*/
function containerMouseOut(containerId){
        if(windowMouseMode=='move'){
             // document.getElementById(containerId).style.backgroundColor='transparent';
//              document.getElementById(containerId).style.borderTopStyle='none';
              
        }
}

/**
*Funktion wird aufgerufen, wenn Maus Taste ueber Fenster Content bewegt wird
* zeigt den oberen Rahmen des Fensters rot an
*/
function windowMouseMove(windowId){
         if(windowMouseMode=='move'){
              if(isInContainer(windowId)){     
                    if(windowId!=moveWindowId){
                           document.getElementById(windowId).style.borderColor='red';
                           document.getElementById(windowId).style.borderTopStyle='solid';
                    }
              }
         }
         
         //alert(autoOpen);
}

/**
*Funktion wird aufgerufen, wenn Maus den Fenster Koerper verlaesst
* schaltet den oberen Rahmen des Fensters wieder transparent
*/

function windowMouseOut(windowId){
        if(windowMouseMode=='move'){
              if(isInContainer(windowId)){     
              if(windowId!=moveWindowId){
              document.getElementById(windowId).style.borderColor='red';
              document.getElementById(windowId).style.borderTopStyle='none';
              }
              }
         }
         
}

/**
* aendert den Status eines Fensters inklusive Eltern Container
*/
function changeWindowState(windowId, containerId, containerIndex, isMinimized, isAbsolut, isClosed){
              if(document.getElementById(containerId) && isInContainer(windowId)){
                   container= document.getElementById(containerId);
                   if(document.getElementById(windowId)){
                        container.appendChild(document.getElementById(windowId));
                        setWindowState(windowId, isMinimized, isAbsolut, isClosed);
                   }
              }
}

/**
*speichert die States der Fenster einer Seite via AJAX auf dem Server ab
*/
function saveWindowsStates(saveWindowsUrl, userId, pageId){
         var getAdd='';
         
         var allCon=new Array();
         var allCells=document.getElementsByTagName('td');
         for(var i=0; i<allCells.length; i++){
              if(allCells[i].className=='xwindowsContainer'){
                   allCon.push(allCells[i].id);
              }
         }
         
         var allContainer=document.getElementsByTagName('div');
         for(var i=0; i<allContainer.length; i++){
              if(allContainer[i].className=='xwindowsContainer'){
                   allCon.push(allContainer[i].id);
              }
         }
         
         for(var i=0; i<allCon.length;i++){
                 var con=document.getElementById(allCon[i]);
                 var components=con.childNodes;
                 for(var j=0; j<components.length; j++){
                        if(xComponents[components[j].id] && xComponents[components[j].id].componentType=='xwindowsWindow'){
                        getAdd = getAdd + '&' + components[j].id  + '=' + allCon[i] + ',' + j + ',' +(isMinimized(components[j].id) ? 1 : 0)+',0,0';
                        }
                 }              
         }
         
         var sa=new FAjax(saveWindowsUrl, false);
         sa.setGetString('sId='+userId+'&pageId='+pageId + getAdd);
         if(!sa.sendRequest('GET', saveWindowsStatesResponse)){
                    prepareTitleTable('hintsSliderTable', 'white', '', 'Hinweis', '');
                  	addTitleTableSubRow('hintsSliderTable', '', 'Die Fenster konnten nicht gespeichert werden.');
                  	showSliderWindow('hintsSliderWindow', 0.1, 10)
         }
}

/**
* gibt die Antwort der Fenster State Speicherung zurueck
*/
function saveWindowsStatesResponse() {
        prepareTitleTable('hintsSliderTable', 'white', '', 'Hinweis', '');
        addTitleTableSubRow('hintsSliderTable', '', entrys[0].getAttribute('an') + ' Fenster wurden gespeichert.');
        showSliderWindow('hintsSliderWindow', 0.1, 10);             
} 



//////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////Content Select Fenster///////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////

var winsels=new Array();

function registerWinsel(winselId){
	  
	      winsels[winselId]=new Array();
	  
}

function registerWinselWindow(winselId, windowId){
	  winsels[winselId].push(windowId);
}

//versteckt alle Eingabefenster im Tagebuch
function hideWinselWindows(winselId){
        //alert(winselId);
	    var allWindows=winsels[winselId];
	     
        for(var i=0; i<allWindows.length; i++){
              gE(allWindows[i]).style.display='none';
        }
}

function ff_show_switch_option(switchId){
       ff_change_switch_option(switchId, gE('ff_switch_'+switchId).value);
}

function ff_change_switch_option(switchId, optionKey){
       hideWinselWindows(switchId);
	   gE('ff_switch_option_'+optionKey).style.display='';	 
	   gE('ff_switch_'+switchId).value=optionKey;
}

function ff_lock_switch(switchId, isLocked){
	   gE('ff_switch_'+switchId).disabled=isLocked? 'disabled': '';
}




/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////Popups//////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
function setPopupVisible(popupId, isVisible){
	 var popupLayer=document.getElementById(popupId+'Layer');
     
     var selectBoxes=document.getElementsByTagName('select');
     if(isVisible){
         
                 for(var j=0; j<selectBoxes.length; j++){
                        if(selectBoxes[j].style.zIndex!='300'){  //z-index:300 ist im Moment Kriterium für in jedem Fall sichtbar bleiben
                        selectBoxes[j].style.visibility='hidden';
                        }
                 }
         
         if(popupLayer){        
             var popupLayerStyle=popupLayer.style;
             var dimensions=getWindowDimensions();
             var pageDim=getPageDimensions();
             popupLayerStyle.width=dimensions[0]+'px';
             popupLayerStyle.height=pageDim[1]+'px';
             popupLayerStyle.display='';
         }
         gE(popupId).style.display='';
     }
     else{
         
         for(var j=0; j<selectBoxes.length; j++){
                        selectBoxes[j].style.visibility='visible';
         }
         if(popupLayer){
         	 var popupLayerStyle=popupLayer.style;
             popupLayerStyle.width='0px';
             popupLayerStyle.height='0px';
             popupLayerStyle.display='none';
         }
         gE(popupId).style.display='none';
     }            
}



////////////////////////////////////////////////////////////////////////////////
////////////////////FFWindow////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////

var FFWindows={
         oldMouseX:0,
         oldMouseY:0,
         
         bodyOnloadWindowJobs:function(){
	         for(var windowId in wantBlinkWindows){
	              startBlinkOnce(windowId, wantBlinkWindows[windowId]);
	         } 
	         
	         for(var windowId in wantCloseWindows){
	              closeWindow(windowId, wantCloseWindows[windowId]);
	         }
	    },
	    
	    bodyOnmousemoveWindowJobs:function(){
	             var mX=FFUniBrowser.mouseX;
                 var mY=FFUniBrowser.mouseY;
	             var wantMove=false;
		         //windowsMouseMode auf "move" setzen falls Maus bei gerueckter Maustaste bewegt wird
		         if(windowMouseMode=='mouseDown'){
		              if((Math.abs(FFWindows.oldMouseX-mX)>20)||(Math.abs(FFWindows.oldMouseY-mY)>20)){
		                   wantMove=true;
		              }
		         }
         
		         //Fenster auf "move" Modus setzen
		         if(wantMove){
		              windowMouseMode="move";
		              document.getElementById(moveWindowId).style.position='absolute';
		              if(document.getElementById('xwindow_'+moveWindowId+'_arrow_bg')){
		              gE('xwindow_'+moveWindowId+'_arrow_bg').style.display='none';
		              }
		              setWindowShemeVariant(moveWindowId, 'gelb');
		         }
		         
		         //Fenster bewegen falls windowMouseMode="move"
		         if(windowMouseMode=='move'){
		                   document.getElementById(moveWindowId).style.left=mX+13+'px';
		                   document.getElementById(moveWindowId).style.top=mY+13+'px';
		                  // document.getElementById(moveWindowId).style.width=300+'px';
		         }
         }
}



/**
 ******************************************************************
 *              Philipp Knoeller Software Entwicklung              *
 *                        Framework Funktor                       *
 *                           Version 0.9b                         *
 *                                                                * 
 *                  http://pksoftware.de/funktor                  *
 *                                                                *
 ******************************************************************
 * 
 * $Id: FFLangKeySearch.js,v 1.1.2.1 2008/02/24 15:24:14 pknoeller Exp $
 * 
 * Module for managing Slider-Windows
 * 
 * @author Philipp Knoeller
 * @copyright Copyright &copy; 2006, Philipp Knoeller
 * @link http://pksoftware.de/funktor
 * @version 1.0.0.2
 * @package funktor_ffmain
 * @subpackage js
 */
 
var FF_SLIDER_MAX_DIRECTION=1000;

/**
* Array for all slider window objects
**/
var ffSliderWindows=new Array();

/**
* Data holder for a slider window
*/
function SliderWindow(sliderId){
	this.sliderId=sliderId;
	
	this.width=null;
	this.height=null;
	
	this.side=null;
	this.timer=null;
	this.direction=0;
	this.waitTime=0;
	this.step=0;
	
	this.init=function(side, xy, slideStep, waitTime){
	     if(!side) side='top';
	     if(!xy) xy=0;
	     if(!slideStep) slideStep=4;
	     if(!waitTime) waitTime=1000;
	     
	     this.side=side;
	     this.direction=0;
         this.waitTime=waitTime;
	     
	     var sliderStyle=document.getElementById(this.sliderId).style;
	     var pageDim=getVisiblePageSize(); 
	     var scrollY=FFUniBrowser.getScrollY();	    
	     var scrollX=FFUniBrowser.getScrollX();
	     this.height=getComputedHeight(this.sliderId);
	     this.width=getComputedWidth(this.sliderId);
	            
	     
	     if(this.side=='top'){
	         sliderStyle.top=(scrollY-this.height-40)+'px';
	         this.step=slideStep;
	         if(xy) sliderStyle.left=xy+'px';
         }
         else if(this.side=='bottom'){
            sliderStyle.top=(pageDim.height+scrollY+40)+'px';
            this.step=-slideStep;
            if(xy) sliderStyle.left=xy+'px';
         }
         else if(this.side=='left'){
            sliderStyle.left=(scrollX-this.width-40)+'px';
            this.step=slideStep;
            if(xy) sliderStyle.top=xy+'px';
         }
         else if(this.side=='right'){
            sliderStyle.left=(pageDim.width+scrollX+40)+'px';
            this.step=-slideStep;
            if(xy) sliderStyle.top=xy+'px';
         }
         
         
         
	}
	
	this.isHorOrVert=function(){
	     return this.side=='left' || this.side=='right';
	}
	
	this.closeWindow=function(){
		 this.direction=this.waitTime;
	}
	
	this.getOpenLimit=function(newLeftTop){
	    var scrollY=FFUniBrowser.getScrollY();
	    var scrollX=FFUniBrowser.getScrollX();
	     var pageDim=getVisiblePageSize();
	    if(this.side=='top'){
	          return newLeftTop>scrollY ? scrollY : null;
	    }      
	    else if(this.side=='bottom'){
	          var limit=pageDim.height+scrollY-this.height;
	          return newLeftTop<limit ? limit : null;
	    }
	    else if(this.side=='left'){
	          return newLeftTop>scrollX ? scrollX : null;
	    }      
	    else if(this.side=='right'){
	          var limit=pageDim.width+scrollX-this.width;
	          return newLeftTop<limit ? limit : null;
	    }      
	 }    
	 
	 this.getCloseLimit=function(newLeftTop){
	      var scrollY=FFUniBrowser.getScrollY();
	      var scrollX=FFUniBrowser.getScrollX();
	     var pageDim=getVisiblePageSize();
	      if(this.side=='top'){ 
	          var limit=-(this.height+20);
	          return newLeftTop< limit ? limit : null;
	      }
	      else if(this.side=='bottom'){
	           var limit=pageDim.height+scrollY+20;
	           return newLeftTop>limit ? limit : null;
	      }
	      else if(this.side=='left'){ 
	          var limit=-(this.width+20);
	          return newLeftTop< limit ? limit : null;
	      }
	      else if(this.side=='right'){
	           var limit=pageDim.width+scrollX+20;
	           return newLeftTop>limit ? limit : null;
	      }
	          
	 }   
	 
	 this.openStep=function(){
	             var sliderStyle=document.getElementById(this.sliderId).style;
      	         var isHor=this.isHorOrVert();
      	         var oldLeftTop=getPxValue(isHor ? sliderStyle.left : sliderStyle.top);
      	         var newLeftTop=oldLeftTop+parseInt(this.step);
      	         var limit=this.getOpenLimit(newLeftTop);
      	         if(null != limit){
		         	   if(isHor)
		         	   sliderStyle.left=limit + 'px';
		         	   else
		         	   sliderStyle.top=limit + 'px';
		     	       
		     	       this.direction++;
		     	 }
		         else if(this.direction==0){
	                  if(isHor)
		         	   sliderStyle.left=newLeftTop + 'px';
		         	   else
		         	   sliderStyle.top=newLeftTop + 'px';	   
		         }
      }	
      
      this.closeStep=function(){
                 var sliderStyle=document.getElementById(this.sliderId).style;
	              var isHor=this.isHorOrVert();
	              var oldLeftTop=getPxValue(isHor ? sliderStyle.left : sliderStyle.top);
	             this.direction=this.waitTime;
		         var newLeftTop=oldLeftTop-parseInt(this.step);
	     	     var limit=this.getCloseLimit(newLeftTop);
	     	     if(null!=limit){ 
		                window.clearInterval(this.timer);
		                gE(this.sliderId).style.display='none';
		         }
		         else{
		         	   if(isHor)
		         	   sliderStyle.left=newLeftTop + 'px';
		         	   else
		         	   sliderStyle.top=newLeftTop + 'px';	      
		         }
      }	      
      
      this.slideStep=function(){
               if(this.direction<this.waitTime)
      	         this.openStep();
	           else  
	             this.closeStep();
	  }          
}



/**
* Registers/Shows a slider window
*/
function registerSliderWindow(sliderWindowId, intervalSeconds, slideStep, waitTime, xy, side){

	     gE(sliderWindowId).style.display='';
	     
	     if(!ffSliderWindows[sliderWindowId]){
	            ffSliderWindows[sliderWindowId]=new SliderWindow(sliderWindowId);
	     }
	     
	     
	     var sliderWindow=ffSliderWindows[sliderWindowId];
	     
	     sliderWindow.init(side, xy, slideStep, waitTime==0 ? Math.max(30, sliderWindow.height/4) : waitTime);
         if(intervalSeconds) sliderWindow.timer=window.setInterval("sliderWindowTimer('"+sliderWindowId+"')", intervalSeconds*1000);
         
}

/**
* Variable for universal slider timer
**/
var sliderWindowsTimer;

/**
* Starts the universal slider timer. It is responsible for all slider windows who do not have own timers.
**/
function startSliderTimer(intervalSeconds){
	  sliderWindowsTimer=window.setInterval("showSliderWindows()", intervalSeconds*1000)
}

/**
* Stops the universal slider timer
**/
function stopSliderTimer(){
	  window.clearInterval(sliderWindowsTimer);
}

/**
* Timer function for universal slider timer
**/
function showSliderWindows(){
	//alert(ffSliderWindows['instant_messaging']);
	  for(var wId in ffSliderWindows){
	  	     if(!ffSliderWindows[wId].timer) sliderWindowTimer(wId);
	  }
	
}

/**
* Timer function for a slider window
*/
function sliderWindowTimer(sliderWindowId){
	     if(!ffSliderWindows[sliderWindowId]) return;
	     ffSliderWindows[sliderWindowId].slideStep();
}

/**
* Makes a slider to close itself
*/
function closeSlideWindow(sliderWindowId){
	   if(!ffSliderWindows[sliderWindowId]) return;
	   ffSliderWindows[sliderWindowId].closeWindow();
}/**
 ******************************************************************
 *              Philipp Knoeller Software Entwicklung             *
 *                        Framework Funktor                       *
 *                           Version 1.0                          *
 *                                                                * 
 *                  http://pksoftware.de/funktor                  *
 *                                                                * 
 *                       ALL RIGHTS RESERVED                      *
 *                                                                *
 ******************************************************************
 * 
 * $Id: Funktor.php,v 1.1.2.61 2008/02/10 00:37:40 pknoeller Exp $
 * 
 * @author Philipp Knoeller
 * @copyright Copyright &copy; 2006, Philipp Knoeller
 * @link http://pksoftware.de/funktor
 * @version 1.0.0.3
 * @package funktor_ffim
 * @subpackage js
 */

/**
 * fills IM Slider Window
 * @author Philipp Knöller
 * @access private
 */
  function _ffFillImWindow(xmldoc, requestId){
  	   var status=xmldoc.getElementsByTagName("status");
  	   
  	   if(status.length>0){
  	   var statusId=status[0].getAttribute('status_id');
  	   var statusMsg=status[0].getAttribute('status_msg');
  	   
  	   var actionStatusId=status[0].getAttribute('action_status');
  	   
  	   if(statusId=='MESSAGE_LIST'){
	  	   var entrys=xmldoc.getElementsByTagName("im");
	  	   for(var j=0; j<entrys.length; j++){
	  	   	    var entry=entrys[j];
	  	   	    var i=entry.getAttribute("id");
	  	        if(!ffSliderWindows['instant_messaging_'+ i]){
	  	             ffCreateImWindow('instant_messaging_'+ i, i);
	  	             registerSliderWindow('instant_messaging_'+ i, null, 20, 100000,20,'right');
	  	             gE('instant_messaging_'+ i+'_sender').firstChild.nodeValue=entry.getAttribute("from");
	  	             //gE('instant_messaging_'+ i+'_receiver').value=entry.getAttribute("from_id");
	   	             gE('instant_messaging_'+ i+'_sender_subject').firstChild.nodeValue=entry.getAttribute("subject");
	   	           	 gE('instant_messaging_'+ i+'_subject').value="Re: "+entry.getAttribute("subject");
	  	             gE('instant_messaging_'+ i+'_sender_text').innerHTML=entry.firstChild.nodeValue;
	  	             
	  	             
	  	             
	  	        }
	  	   }
  	   }
  	   
  	   if(actionStatusId!='NO_ACTION'){
  	          // alert(statusMsg);
  	          showHintMessage('Hinweis', actionStatusId);
  	   }
  	   }
  }
  
  /**
   * Funktor Ajax Objekt
   */
  var ffImService=new FAjax(null);
  
  /**
   * Message check 
   * @author Philipp Knöller
   * @access private
   */
  function _ffImService(){
  	     //ffImService.setGetString('sm=ass&search='+sString);
        // alert('f');
         ffImService.sendRequest('GET', _ffFillImWindow);
  }
  
  function ffImMarkAsRead(windowId, msgId){
  	     ffImService.sendRequest('GET', _ffFillImWindow, null, 'action=updateMessage&mi='+msgId);
  	     closeSlideWindow(windowId);
  }
  
  function ffImAnswer(windowId, msgId){
  	     var answerSubject=gE(windowId+'_subject').value;
  	     var answerText=gE(windowId+'_text').value;
  	     
  	     ffImService.sendRequest('POST', _ffFillImWindow, null, 'action=sendMessage&mi='+msgId, 'subject='+answerSubject+'&text='+answerText);
  	     closeSlideWindow(windowId);
  }
  
  /**
   * starts IM Service
   * @author Philipp Knöller
   * @access public
   */
  function ffStartImService(url, interval){
  	   ffImService.setUrl(url);
  	   ffImService.start_search(_ffImService, interval*1000);
  	   _ffImService();
  } 
  
  /**
   * stops IM Service
   */
  function ffStopImService(){
      ffImService.stop_search();
      
  }
  
  

  


	
	function gotoPage(pageCode, parameter){
		var x='/'+pageCode+'.htm';
		if(parameter){
			   x=x+'?'+parameter;
		}
		window.location.href=x;
	}
		


