/************************************************************************
Author: Kong Georges
***********************************************************************/

var targetjArray = new Array();
targetjArray['ok']=0;

function SetSlide()
{   
    if (isLocked)
        return;
    else
        isLocked = this.parentNode;          
    for (i=0 ;i < menuObjArray[0].length; i++)
    {
        if (menuObjArray[3][i] == this.parentNode)
        {
            if (menuObjArray[5][i] == null)
                menuObjArray[5][i] = setInterval("RunSlide(" + i + ")", slideDelay);
            break;
        }
    }

}



function UpdateUserCookie(aryIndex)
{
    date = new Date();
    date.setTime(date.getTime() + (1000 * 60 * 60 * 24 * 30)); 
    document.cookie = "xpMenuCookv2" + "=" + escape(menuObjArray[4].toString()) + "; expires=" + date.toGMTString();  
   
}

function checknewpage(name, anzahl)
{
		if(anzahl==""){
			anzahl=2;
		}
        if(targetjArray['ok']<anzahl){
        	targetjArray['ok']++;
        }else{
			/*alert("a");*/
           for (var i = 0; i <= 50; i++){
              if(document.links[i]){
                document.links[i].target="";
              }else break;
           }//end for
          //alert(document.forms['myform'].method);
        }//end else
}



function ChangeStyle()
{
    className = String(this.className);
   
    if (className.substring(className.length - 4, className.length) == "Over")
        this.className = className.substring(0,className.length - 4);
    else
        this.className = this.className + "Over";
   //  alert(this.className);
}



/* beginn help functions for suchmaschine */
function simpleKey(e)
{
/*alert(e.which);*/
 switch (emod) {
   case "W3C":

  //ctrl+s 
if(e.ctrlKey&&(e.which==88))
  document.getElementById('Eingabefeld1').focus();


//ctrl+k  category     
if(e.ctrlKey&&(e.which==75))
	setTimeout("document.getElementById('category').focus();",1); 

 //ctrl+t       
if(e.ctrlKey&&(e.which==222))
  document.getElementById('ort').focus();

 //ctrl+z
if(e.ctrlKey&&(e.which==90))
  document.getElementById('plz').focus();

 //ctrl+a
if(e.ctrlKey&&(e.which==65)){
	document.getElementById('bl').focus();
        return false;
}
//ctrl+u
if(e.ctrlKey&&(e.which==192)){
  document.getElementById('suchen').focus();
  submit_searchform();
}

//ENTER
if(e.which==13){
  document.getElementById('suchen').focus();
  submit_searchform();
}

 break;


case "NN4":
  //ctrl+s
if(((e.modifiers & Event.ALT_MASK) == Event.ALT_MASK)&&(e.which==88))
 document.getElementById('Eingabefeld1').focus();

  //ctrl+k category
if(((e.modifiers & Event.ALT_MASK) == Event.ALT_MASK)&&(e.which==75))
    document.getElementById('category').focus();

  //ctrl+t
if(((e.modifiers & Event.ALT_MASK) == Event.ALT_MASK)&&(e.which==222))
      document.getElementById('ort').focus();

  //ctrl+z
if(((e.modifiers & Event.ALT_MASK) == Event.ALT_MASK)&&(e.which==90))
        document.getElementById('plz').focus();

  //ctrl+a
if(((e.modifiers & Event.ALT_MASK) == Event.ALT_MASK)&&(e.which==65)){
        document.getElementById('bl').focus();
        return false;
}
  //ctrl+u
if(((e.modifiers & Event.ALT_MASK) == Event.ALT_MASK)&&(e.which==192)){
        document.getElementById('suchen').focus();
		submit_searchform();
}

if(e.which==13){
        document.getElementById('suchen').focus();
		submit_searchform();
}


break;



//###############

case "IE4+":
    e = window.event;
  //ctrl+s
    if(e.ctrlKey&&(e.keyCode==88))
    document.getElementById('Eingabefeld1').focus();

  //ctrl+k  category
    if(e.ctrlKey&&(e.keyCode==75))
    document.getElementById('category').focus();

  //ctrl+t
      if(e.ctrlKey&&(e.keyCode==222))
      document.getElementById('ort').focus();

  //ctrl+z
        if(e.ctrlKey&&(e.keyCode==90))
        document.getElementById('plz').focus();

  //ctrl+a
        if(e.ctrlKey&&(e.keyCode==65)){
        document.getElementById('bl').focus();
        return false;
}
//ctrl+ö
        if(e.ctrlKey&&(e.keyCode==192)){
        	document.getElementById('suchen').focus();
			submit_searchform();
		}
		
//Enter
        if(e.keyCode==13){
        	document.getElementById('suchen').focus();
			submit_searchform();
		}


  break;

default:
alert(emod);
//################  
  
  }//end switch
  //return false;
  }//end function simpleKey

function onloadH(e)
{
   /*get the event model*/
   emod = (e) ? (e.eventPhase) ? "W3C" : "NN4" : (window.event) ? "IE4+" : "unknown";

   /*A*/
   
   if (emod == "NN4") {
      document.captureEvents(Event.KEYDOWN); }

    document.onkeydown = simpleKey;
    return true;
}
/* end help functions for suchmaschine */

function selectWert(sObj) {
	if(!sObj || sObj == "undefined"){
			return "";
	}
	with (sObj) return options[selectedIndex].value;
}

function radioWert(rObj) {
	return false;
	if(!rObj || rObj == "undefined"){
			return "";
	}
    for (var i=0; i<rObj.length; i++) if (rObj[i].checked) return rObj[i].value;
    return false;
}
  
function input_changed() {
	// since onchange() doesn't seem to work properly everywhere, we do this
	var changed = false;
	
	changed = changed | (input.searchstring != document.forms["suchformular"].searchstring.value);
	changed = changed | (input.cat != selectWert(document.forms["suchformular"].cat));
	changed = changed | (input.bl != selectWert(document.forms["suchformular"].bl));
	changed = changed | (input.sort != radioWert(document.forms["suchformular"].sort));
	changed = changed | (input.plz != document.forms["suchformular"].plz.value);
	changed = changed | (input.ort != document.forms["suchformular"].ort.value);
	changed = changed | (input.target != radioWert(document.forms["suchformular"].target));
	changed = changed | (input.amount_window != document.forms["suchformular"].amount_window.value);
	
	return changed;
}

function submit_searchform(){
	if(!input_changed()) {
		return false;
	} else {
		document.getElementById("zwischenspeicher").innerHTML = "<input type='hidden' name='zs' value='1' />";
		document.suchformular.submit();	
		/* zwischengespeicherte ergebnisse müssen gelöscht werden*/
	}
}

function submit_ortswahl(plz_ort){
	var teile = plz_ort.split("||");
	document.getElementById("ort").value = teile[1];
/*	document.getElementById("plz").value = teile[0];*/
	document.getElementById("zwischenspeicher").innerHTML = "<input type='hidden' name='zs' value='1' />";
	document.suchformular.submit();	
	document.getElementById("ortswahl").style.top ="-1000px";
}

function open_ortswahl(){
	document.getElementById("ortswahl").style.top ="220px";
}

