/*Kracht JS functions*/


function submit_login_form(the_form){


      if (((the_form.elements['user'].value=='') && (the_form.elements['pass'].value=='')) || ((the_form.elements['user'].value=='Benutzername') && (the_form.elements['pass'].value=='Passwort')) || ((the_form.elements['user'].value=='username') && (the_form.elements['pass'].value=='password')) ){
        document.location="index.php?id=distributor_zugang";
      }
      else{
        the_form.submit();    
       }


  //alert(form_element.name);
  //ancestors = form_element.ancestors();
  
   //i =form_element.ancestors()[4];   
   //alert(ancestors);

 // for (i=0; i<ancestors.size(); i++){
   //this way we identify a form - could not find documentation for the right way 
   //alert(ancestors[i].readAttribute('method'));
   //if (ancestors[i].readAttribute('method') == 'post'){ 
     // the_form = ancestors[i];
      //if ((the_form.elements['user'].value=='') && (the_form.elements['pass'].value=='')){
       // document.location="index.php?id=distributor_zugang";
     // }
   //   else{
     //   ancestors[i].submit();    
   //    }
 //   }  
  
  //}
}


function get_param( name )
{
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    return "";
  else
    return results[1];
}

/*top-Menu - level 1*/

function top_1_on(element){
	element.style.backgroundColor = '#ececec';
	if (element.parentNode.nextSibling) {
		element.parentNode.nextSibling.childNodes[0].style.backgroundColor="#E7E7E7";
		element.parentNode.nextSibling.childNodes[0].style.backgroundImage="";
	}
	if (element.parentNode.previousSibling) {
		element.parentNode.previousSibling.childNodes[0].style.backgroundColor="#E7E7E7";
		element.parentNode.previousSibling.childNodes[0].style.backgroundImage="";
	}
}

function top_1_off(element){
	element.style.backgroundColor = 'transparent';
	if (element.parentNode.nextSibling) {
		element.parentNode.nextSibling.childNodes[0].style.backgroundColor="transparent";
		element.parentNode.nextSibling.childNodes[0].style.backgroundImage="url(fileadmin/template/main/pics/transparent_bg.png)";
	}
	if (element.parentNode.previousSibling) {
		element.parentNode.previousSibling.childNodes[0].style.backgroundColor="transparent";
		element.parentNode.previousSibling.childNodes[0].style.backgroundImage="url(fileadmin/template/main/pics/transparent_bg.png)";
	}
}