function klappen(a){
  var e=document.getElementById(a);
  if(!e)return true;
  if(e.style.display=="none"){
    e.style.display="block"
  } else {
    e.style.display="none"
  }
  return true;
}


function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function eintrag() {
	alert("Item has been added to your shopping cart!");
}

function checksuche() {
	if ((document.sucheingabe.mass.value == '0') && (document.sucheingabe.mark.value == '0') && (document.sucheingabe.farb.value == '0')) {
		alert ("Please enter a keyword.");
		return false;
	}
}

function checkstichwort() {
	if (document.stichwortsuche.suchwort.value == ""){
		alert ("Please enter a keyword.");
		return false;
	}
}	

function checkbutton() {
	var count = 0;
	var text1 = "";
	var iCheck = true;

	text = new Array(2);

	    if (document.bestellversand.agb.checked == false) {
		text[count] = "Before placing an order you must agree to our Terms and Conditions.";
		count += 1;
	}

	if (count >= 2) text1 = "\n"
	else text1 = "\n"

	for (i=0; i < count; i++) {
		text1 += "- " + text[i] + "\n";
	}

	if (count == 0) {
          	return "<? echo $_PHPSELF ?>";

	} else {
		alert(text1);
		return false;
	}
}

function checkfelder_preisvorschlag() {
	var count = 0;
	var text1 = "";
	var iCheck = true;

	text = new Array(3);

	iCheck = true;
	for(i=0;i<document.preisvorschlagversand.vorschlagname.value.length;i++) {
		if (document.preisvorschlagversand.vorschlagname.value.substr(i,1) != ' ') iCheck = false;
	}
	
	if (document.preisvorschlagversand.vorschlagname.value == "") {
		text[count] = "Name";
		count += 1;
	}
	
	if (document.preisvorschlagversand.vorschlagmail.value == "") {
		text[count] = "E-Mail Address";
		count += 1;
	}
	
	if (document.preisvorschlagversand.vorschlagpreis.value == "") {
		text[count] = "Your price request";
		count += 1;
	}

	if (count >= 2) text1 = "Please fill in the missing information:\n"
	else text1 = "Please fill in the missing information:\n"

	for (i=0; i < count; i++) {
		text1 += "- " + text[i] + "\n";
	}

	if (count == 0) return "preisvorschlag_versand.php";
	else {
		alert(text1);
		return false;
	}
}


function checkfelder_passwort() {
	var count = 0;
	var text1 = "";
	var iCheck = true;

	text = new Array(2);

	iCheck = true;
	for(i=0;i<document.passwortversand.email.value.length;i++) {
		if (document.passwortversand.email.value.substr(i,1) != ' ') iCheck = false;
	}
	
	if (document.passwortversand.email.value == "") {
		text[count] = "E-Mail Address";
		count += 1;
	}

	if (count >= 2) text1 = "Please fill in the missing information:\n"
	else text1 = "Please fill in the missing information:\n"

	for (i=0; i < count; i++) {
		text1 += "- " + text[i] + "\n";
	}

	if (count == 0) return "login.php";
	else {
		alert(text1);
		return false;
	}
}

function checkfelder_login() {
	var count = 0;
	var text1 = "";
	var iCheck = true;

	text = new Array(2);

	iCheck = true;
	for(i=0;i<document.logineingabe.kundennummer.value.length;i++) {
		if (document.logineingabe.kundennummer.value.substr(i,1) != ' ') iCheck = false;
	}
	if ((document.logineingabe.kundennummer.value == '') || (iCheck)) {
		text[count] = "E-Mail or Customer-ID";
		count += 1;
	}

	if (document.logineingabe.password.value == "") {
		text[count] = "Password";
		count += 1;
	}

	if (count >= 2) text1 = "Please fill in the missing information:\n"
	else text1 = "Please fill in the missing information:\n"

	for (i=0; i < count; i++) {
		text1 += "- " + text[i] + "\n";
	}

	if (count == 0) return "login.php";
	else {
		alert(text1);
		return false;
	}
}

function checkfelder_formular() {
	var count = 0;
	var text1 = "";
	var iCheck = true;

	text = new Array(8);

	iCheck = true;
         for(i=0;i<document.registrierversand.vorname.value.length;i++) {
		if (document.registrierversand.vorname.value.substr(i,1) != ' ') iCheck = false;
	}
	if ((document.registrierversand.vorname.value == '') || (iCheck)) {
		text[count] = "First Name";
		count += 1;
	}

         if ((document.registrierversand.name.value == '') || (iCheck)) {
		text[count] = "Last Name";
		count += 1;
	}

	if (document.registrierversand.strasse.value == "") {
		text[count] = "Street";
		count += 1;
	}

         if (document.registrierversand.plz.value == "") {
		text[count] = "Postal Code";
		count += 1;
	}

         if (document.registrierversand.ort.value == "") {
		text[count] = "City";
		count += 1;
	}
	
		if (document.registrierversand.land.value == "") {
		text[count] = "Country";
		count += 1;
	}

         if (document.registrierversand.email.value == "") {
		text[count] = "E-Mail";
		count += 1;
	}

         if (document.registrierversand.passwort.value == "") {
		text[count] = "Password";
		count += 1;
	}
	
	if (document.registrierversand.passwort.value != document.registrierversand.bestpasswort.value) {
		text[count] = "Password confirmation does not match.";
		count += 1;
	}

	if (count >= 2) text1 = "Please fill in the missing information:\n"
	else text1 = "Please fill in the missing information:\n"

	for (i=0; i < count; i++) {
		text1 += "- " + text[i] + "\n";
	}

	if (count == 0) {
          	return "https://hansecars.com/en/anmeldung_02.php";

	} else {
		alert(text1);
		return false;
	}
}

function checkfelder_empfehlung() {
	var count = 0;
	var text1 = "";
	var iCheck = true;

	text = new Array(4);

	iCheck = true;
         for(i=0;i<document.empfehlungversand.absendname.value.length;i++) {
		if (document.empfehlungversand.absendname.value.substr(i,1) != ' ') iCheck = false;
	}
	if ((document.empfehlungversand.absendname.value == '') || (iCheck)) {
		text[count] = "Your Name";
		count += 1;
	}

         if ((document.empfehlungversand.empfname.value == '') || (iCheck)) {
		text[count] = "Name of Recipient";
		count += 1;
	}

	if (document.empfehlungversand.absendmail.value == "") {
		text[count] = "Your E-Mail Adress";
		count += 1;
	}

         if (document.empfehlungversand.empfmail.value == "") {
		text[count] = "E-Mail Adress of Recipient";
		count += 1;
	}

    if (count >= 2) text1 = "Please fill in the missing information:\n"
	else text1 = "Please fill in the missing information:\n"

	for (i=0; i < count; i++) {
		text1 += "- " + text[i] + "\n";
	}

	if (count == 0) {
          	return "empfehlung_versand.php";

	} else {
		alert(text1);
		return false;
	}
}

function checkfelder_kontakt() {
	var count = 0;
	var text1 = "";
	var iCheck = true;

	text = new Array(6);

	iCheck = true;
         for(i=0;i<document.kontaktversand.kvorname.value.length;i++) {
		if (document.kontaktversand.kvorname.value.substr(i,1) != ' ') iCheck = false;
	}
	if ((document.kontaktversand.kvorname.value == '') || (iCheck)) {
		text[count] = "First Name";
		count += 1;
	}

         if ((document.kontaktversand.kname.value == '') || (iCheck)) {
		text[count] = "Last Name";
		count += 1;
	}

	if (document.kontaktversand.kstrasse.value == "") {
		text[count] = "Street";
		count += 1;
	}

         if (document.kontaktversand.kplz.value == "") {
		text[count] = "Postal Code";
		count += 1;
	}

         if (document.kontaktversand.kort.value == "") {
		text[count] = "City";
		count += 1;
	}

         if (document.kontaktversand.kemail.value == "") {
		text[count] = "E-Mail";
		count += 1;
	}

    if (count >= 2) text1 = "Please fill in the missing information:\n"
	else text1 = "Please fill in the missing information:\n"

	for (i=0; i < count; i++) {
		text1 += "- " + text[i] + "\n";
	}

	if (count == 0) {
          	return "kontat_versand.php";

	} else {
		alert(text1);
		return false;
	}
}

var ew = null;
function zoomFenster(datei,x,y,alt,scbar,id) {
	var tmpX = x+52;
	var tmpY = y+90;
	if (id > 0) tmpY = tmpY+20;
	var tmpSc = "no";
	if (tmpY > 500) {
		tmpY = 500;
		tmpSc = "yes";
		tmpX += 52;
	}
	if (scbar == 1) {
		tmpSc = "yes";
		tmpX += 52;
	}
	if (ew != null) if (!ew.closed) ew.close();
	ew = window.open('zoom.php?id=' + id + '&hoch=' + y + '&breit=' + x + '&bild=' + datei + '&titel=' + alt,'Bildvergroesserung','left=' + ((screen.availWidth/2)-tmpX/2) + ',top=' + ((screen.availHeight/2)-tmpY/2) + ',marginwidth=0 marginheight=0,leftmargin=0,topmargin=0,scrollbars=' + tmpSc + ',status=no,width=' + tmpX + ',height=' + tmpY + ',resizable=no');
	if (ew.opener==null) ew.opener=self;
	if (vn >= "4") ew.moveTo((screen.availWidth/2)-tmpX/2,(screen.availHeight/2)-tmpY/2);
	return;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function initPage()
{
oMyDiv = document.getElementById( "myDiv" );

isScrolling = false;

DX = 10; 
DELAY = 50;

};

function scroll2Left( evt )
{
	if ( evt )
		isScrolling = true;

	if ( isScrolling )
	{
		if ( oMyDiv.scrollTop > 0 )
		{
			oMyDiv.scrollTop -= DX;
			window.setTimeout( "scroll2Left()", DELAY );
		};
	};
};

function scroll2Right( evt )
{
		if ( evt )
			isScrolling = true;
		
		if ( isScrolling )
		{		
			oMyDiv.scrollTop += DX;
			window.setTimeout( "scroll2Right()", DELAY );
		};

};

function stopScrolling()
{
	isScrolling = false;
}
