function toggle_versionen(id) {
    if (document.getElementById(id).style.display == "block") {
        document.getElementById(id).style.display = "none";
        document.getElementById("aufruf"+id).innerHTML = "einblenden";
    } else {
        document.getElementById(id).style.display = "block";
        document.getElementById("aufruf"+id).innerHTML = "ausblenden";
    }
}

function submitFormSimple(akt_form)
{
   document.forms[akt_form].submit();
}


function jumpTo(prod_id,bild_id){
    if (document.produkt.block_1) {
        var sel1='&activeitem_1='+document.produkt.block_1.options[document.produkt.block_1.selectedIndex].value;
    } else {
        var sel1='';
    }
    if (document.produkt.block_2) {
        var sel2='&activeitem_2='+document.produkt.block_2.options[document.produkt.block_2.selectedIndex].value;
    } else {
        var sel2='';
    }
    if (document.produkt.block_3) {
        var sel3='&activeitem_3='+document.produkt.block_3.options[document.produkt.block_3.selectedIndex].value;
    } else {
        var sel3='';
    }
    if (document.produkt.block_4) {
        var sel4='&activeitem_4='+document.produkt.block_4.options[document.produkt.block_4.selectedIndex].value;
    } else {
        var sel4='';
    }

   var URL = 'index.php?todo=produkt_ausgeben&bild_id='+bild_id+'&produkt_id='+prod_id+sel1+sel2+sel3+sel4;
   window.location.href = URL;
}

function jumpToRadio(prod_id,bild_id){
    if (document.produkt.block_1) {
        var sel1='&activeitem_1='+document.produkt.block_1.options[document.produkt.block_1.selectedIndex].value;
    } else {
        var sel1='';
    }
    if (document.produkt.block_2) {
        var sel2='&activeitem_2='+document.produkt.block_2.options[document.produkt.block_2.selectedIndex].value;
    } else {
        var sel2='';
    }
    if (document.produkt.block_3) {
        if (document.produkt.block_3.length>1) {
        for (i=0;i<document.produkt.block_3.length;i++){
            if (document.produkt.block_3[i].checked==true) {
                var sel3='&activeitem_3='+document.produkt.block_3[i].value;
            }
        }
        } else {
            var sel3='';
        }
    } else {
        var sel3='';
    }
    if (document.produkt.block_4) {
        if (document.produkt.block_4.length>1) {
        for (i=0;i<document.produkt.block_4.length;i++){
            if (document.produkt.block_4[i].checked==true) {
                var sel4='&activeitem_4='+document.produkt.block_4[i].value;
            }
        }
        } else {
            var sel4='';
        }
    } else {
        var sel4='';
    }

   var URL = 'index.php?todo=produkt_ausgeben&bild_id='+bild_id+'&produkt_id='+prod_id+sel1+sel2+sel3+sel4;
   window.location.href = URL;
}

function galerieColorChange (AnzBilder,AktBild,setzFarbe,scrollFarbe) {
 var i = 0;
 while (i < AnzBilder) {
  if (i == AktBild) {
    document.getElementById("bild_td_"+i).bgColor = setzFarbe;
   } else {
    document.getElementById("bild_td_"+i).bgColor = scrollFarbe;
   }
  i++;
 }
}

//******************************************************************
function open_window(url,w,h,name) {
	if (name=="anzeigen" && w>800)
		{w=840;h=h+140;}
		else{
		if (name=="anzeigen" && h>650)
			{h=740;w=w+40;}
			else
			{w=w+40;h=h+140;}
		}
	abmasse = "width=" + w + ",height=" + h;
	paras = "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0";
	paras_gesamt = paras+","+abmasse;
    window.open(url,name,paras_gesamt);
    }
//******************************************************************

//******************************************************************
function open_window_druck(url,w,h,name) {
	abmasse = "width=" + w + ",height=" + h;
	paras = "toolbar=0,location=0,directories=0,status=0,menubar=1,scrollbars=1,resizable=0";
	paras_gesamt = paras+","+abmasse;
    window.open(url,name,paras_gesamt);
    }
//******************************************************************
function BrowserSniffer() {
   var agent = navigator.userAgent;
   var browserName = navigator.appName;
   var version = parseInt(navigator.appVersion)
   if (browserName == "Microsoft Internet Explorer") this.brows = "IE"
   else if (browserName == "Netscape") this.brows = "NN"
   else this.brows = browserName
   if (agent.indexOf('MSIE 5') != -1) this.ver = 5
   else this.ver = version
   this.IE = (this.brows == "IE" && this.ver >= 4)
   this.IE4 = (agent.indexOf('MSIE 4') != -1)
   this.IE5 = (agent.indexOf('MSIE 5') != -1)
   this.NN = (this.brows == "NN" && this.ver >= 4)
   this.NN4 = (this.brows == "NN" && this.ver == 4)
   this.NN5 = (this.brows == "NN" && this.ver == 5)
}


//******************************************************************
//wird nur bei "Fenster schliessen" für grosse Objektbilder benutzt
function b_design(style,action,text) {
var is = new BrowserSniffer();
	if (is.NN4==true)
		{
		document.write('<font size=1 face=geneva,arial><a href="'+action+'"><b><font size=2 color=#000000>'+text+'</font></b></A></font>');
		}
		else
			{
			document.write('<button style="'+style+'" onClick="'+action+'">'+text+'</button>');
			}
    }
//******************************************************************

//******************************************************************
function validate_produkt_form() {
    if (document.dataform.bereich_id.options[document.dataform.bereich_id.selectedIndex].value==-1) {
        alert('Hinweis: Sie haben keinen Bereich ausgewählt');
    	document.dataform.bereich_id.focus();
    	return false;
    }

}
//******************************************************************
function validate_data_wk(landkuerzel) {


if (document.dataform.email.value==false)
		{
        if (landkuerzel == "de") {
		alert('Hinweis: Ihre E-Mailadresse ist nicht angegeben oder enthält ungültige Sonderzeichen.');
        } 
        
        if (landkuerzel == "en") {
		alert('Please note: You have not entered your e-mail address or it contains illegal characters.');
        }

        if (landkuerzel == "fr") {
		alert('Attention : vous n\'avez pas indiqué votre adresse Email ou utilisé des caractères non autorisés!');
        }

        if (landkuerzel == "nl") {
        alert('Opmerking: Uw e-mailadres is niet ingevuld of bevat ongeldige tekens!');
        }

		document.dataform.email.focus();
		return false;
		}

if (document.dataform.agb.checked==false)
		{

        if (landkuerzel == "de") {
		alert('Hinweis: Sie haben unsere AGB nicht akzeptiert');
        } 
        
        if (landkuerzel == "en") {
		alert('Please note: You have not accepted our Terms and Conditions.');
        }

        if (landkuerzel == "fr") {
        alert('Attention : vous n\'avez pas accepté nos Conditions Générales de ventes');
        }

        if (landkuerzel == "nl") {
		alert('Opmerking: U heeft onze AVW nog niet geaccepteerd!');
        }

		document.dataform.agb.focus();
		return false;
		}


return true;
}






function validate_data_form(name,strasse,plz,ort,telefon,email,anliegen) {
str_name=/^[0-9A-Za-z-. üäöß]{1,50}$/;
str_strasse=/^[0-9A-Za-z-. üäöß]{1,50}$/;
str_plz=/^[0-9A-Za-z-. üäöß]{1,50}$/;
str_ort=/^[0-9A-Za-z-. üäöß]{1,50}$/;
str_telefon=/^[0-9A-Za-z-. üäöß]{1,50}$/;
str_email=/^[0-9A-Za-z-._\@]{1,50}$/;
str_anliegen=/\s/;

if (str_name.test(name)==false)
		{
/*
        if (land == "de") {
        alert('Hinweis: Ihr Name ist nicht angegeben oder enthält ungültige Sonderzeichen.');
        } 
        if (land == "en") {
        alert('Please note: You have not entered your name or it contains illegal characters');
        } 
        if (land == "fr") {
        alert('Attention : vous n\'avez pas indiqué votre nom ou utilisé des caractères non autorisés');
        } 
        if (land == "nl") {
        alert('Opmerking: Uw naam is niet ingevuld of bevat ongeldige tekens!');
        } 

*/
        alert('Hinweis: Ihr Name ist nicht angegeben oder enthält ungültige Sonderzeichen.');
		document.dataform.name.focus();
		return false;
		}

if (str_strasse.test(strasse)==false)
		{
		alert('Hinweis: Ihre Straße ist nicht angegeben oder enthält ungültige Sonderzeichen.');
		document.dataform.strasse.focus();
		return false;
		}
if (str_plz.test(plz)==false)
		{
		alert('Hinweis: Ihre Postleitzahl ist nicht angegeben oder enthält ungültige Sonderzeichen.');
		document.dataform.plz.focus();
		return false;
		}

if (str_name.test(ort)==false) {
        alert('Hinweis: Ihr Ort ist nicht angegeben oder enthält ungültige Sonderzeichen.');
        document.dataform.ort.focus();
        return false;
        }

if (str_telefon.test(telefon)==false) {
        alert('Hinweis: Ihre Telefonnummer ist nicht angegeben oder enthält ungültige Sonderzeichen.');
        document.dataform.telefon.focus();
        return false;
        }

if (str_email.test(email)==false)
		{
		alert('Hinweis: Ihre E-Mailadresse ist nicht angegeben oder enthält ungültige Sonderzeichen.');
		document.dataform.email.focus();
		return false;
		}

if (str_anliegen.test(anliegen)==false)
		{
		alert('Hinweis: Ihre Anliegen ist nicht angegeben oder enthält nur ein Wort oder enthält ungültige Sonderzeichen.');
		document.dataform.anliegen.focus();
		return false;
		}


return true;
}

function validate_agb(agb) {

if (agb==false)
		{
		alert('Hinweis: Sie haben unsere AGB nicht akzeptiert');
		document.dataform.agb.focus();
		return false;
		}

return true;
}
