// JavaScript Document

function popfunc(URL, breite, hoehe)
{
	if (!breite){var breite=420;}
	if (!hoehe)	{var hoehe=415;}

	var top=(screen.availHeight-hoehe)/2;
	var left=(screen.availWidth-breite)/2;
	popwin=window.open(URL,'popname',"height="+hoehe+", width="+breite+",menubar=0,resizable=0,scrollbars=0,status=0,titlebar=0,toolbar=0,left="+left+",top="+top+"");
	popwin.focus();
}

function poptext(URL, breite, hoehe)
{
	if (!breite){var breite=420;}
	if (!hoehe)	{var hoehe=415;}

	var top=(screen.availHeight-hoehe)/2;
	var left=(screen.availWidth-breite)/2;
	popwin=window.open(URL,'popname',"height="+hoehe+", width="+breite+",menubar=0,resizable=1,scrollbars=1,status=1,titlebar=0,toolbar=0,left="+left+",top="+top+"");
	popwin.focus();
}

function getImgByName(name){
	for(var i=0; i<document.images.length; i++){
		if (document.images[i].name==name){
			return eval(document.images[i]);
		}
	}
}

function resizeForImg(){
	var img = getImgByName("bild");
	var breite = img.width+20;
	var hoehe = img.height+60;
	window.resizeTo(breite, hoehe);
	window.moveTo((screen.width-breite)/2, (screen.height-hoehe)/2);
	self.focus();
}

function flip(name, mode){ 
	//aufruf: onMouseOver="flip('name')" onMouseOut="flip('name')"
	//wenn gewünscht kann in mode direkt noch "over" oder "out" angegeben werden
	//alert(name);
  var img=getImgByName(name);
  var src_str=img.src;
	//Sucht, ob in src des files der String "_over.gif" vorkommt...
	if (src_str.match(/_over\.gif$/)){
		var ausdruck = /^(.*)_over\.gif$/;
		ausdruck.exec(src_str);
		//...und ersetzt ihn wenn ja durch ".gif"
		if (mode!='over'){
			img.src = RegExp.$1 + ".gif";
		}
	} else {
		//wenn nicht wird ".gif"...
		var ausdruck = /^(.*)\.gif$/;
		ausdruck.exec(src_str);
		//...durch "_over.gif" ersetzt
		if (mode!='out'){
			img.src = RegExp.$1 + "_over.gif";
		}
	}
}

function m1Hover(name,anzItems){
	for (var i=1; i<=anzItems; i++){
		eval("flip('i_m"+i+"','out')");
	}//for (var i=1; i<=anzItems; i++){
	if (name != "none"){
    flip(name, 'over');
  }
}

function preloadImages(prefix){
	for(var i=0; i<document.images.length; i++){
		if (eval("document.images[i].name.match(/^"+prefix+"/)")){
			var ausdruck = /^(.*)\.gif$/;
			ausdruck.exec(document.images[i].src);
			temp = new Image(); temp.src = RegExp.$1 + "_over.gif";
		}
	}
}

//Daten und E-Mail Adresse verifizieren----------------------------------------------------------------------------

function verified(special){
	var missing_data="";
	if (document.form1.vorname.value == "") missing_data=missing_data+"Vorname\n";
	if (document.form1.nachname.value == "") missing_data=missing_data+"Nachname\n";

	if (special=="large"){
		if (document.form1.strasse.value == "") missing_data=missing_data+"Straße\n";
		if (document.form1.plz.value == "") missing_data=missing_data+"PLZ\n";
		if (document.form1.ort.value == "") missing_data=missing_data+"Ort\n";
		if (mailified(document.form1.mail.value) == false) missing_data=missing_data+"E-Mail Adresse\n";
	}

	if (special=="katalog"){
		if (document.form1.anrede.options.selectedIndex == 0) missing_data = missing_data+"Anrede\n";
		if (document.form1.strasse.value == "") missing_data=missing_data+"Straße\n";
		if (document.form1.hausnummer.value == "") missing_data=missing_data+"Hausnummer\n";
		if (document.form1.plz.value == "") missing_data=missing_data+"Postleitzahl\n";
		if (document.form1.ort.value == "") missing_data=missing_data+"Ort\n";
		if (document.form1.anzahl_Blickachsen4.value=="" 
		    && 	document.form1.anzahl_Blickachsen5.value=="" 
		    && 	document.form1.anzahl_Blickachsen3.value=="" 
		    && 	document.form1.anzahl_Voss.value=="" 
		    && 	document.form1.anzahl_Kaminski_78.value=="" 
		    && 	document.form1.anzahl_Kaminski_Danzas_macabras.value=="" 
		    && 	document.form1.anzahl_Ballesteros.value=="" 
		    && 	document.form1.anzahl_Penck.value=="" 
		    && 	document.form1.anzahl_Luepertz.value=="" 
		    && 	document.form1.anzahl_Tadei.value=="" 
		    && 	document.form1.anzahl_Plensa.value=="" 
		    &&  document.form1.anzahl_Nash.value=="" 
		    && 	document.form1.anzahl_Kaminski_MonographieFabriceHergott.value=="" 
		    && 	document.form1.anzahl_Nadal.value=="" 
		    && 	document.form1.anzahl_Hall.value=="" 
		    && 	document.form1.anzahl_Blickachsen2.value==""
		    && 	document.form1.anzahl_plensa_2005.value==""
		    && 	document.form1.anzahl_venet_2003.value==""
			&& 	document.form1.anzahl_Blickachsen1.value==""
			&& 	document.form1.anzahl_nash_monografie.value==""
			&& 	document.form1.anzahl_nash_trunks_thicken.value==""
			&& 	document.form1.anzahl_Blickachsen6.value==""
      && 	document.form1.anzahl_Blickachsen7.value==""
			&& 	document.form1.anzahl_laura_ford_wander.value==""		
			) missing_data=missing_data+"Anzahl der gewünschten Kataloge\n";

	}

	if (missing_data==""){
		return true;
	}else{
		alert("Folgende Daten müssen korrekt angegeben werden:\n\n"+missing_data);
		return false;
	}
}

function verified_en(special){
	var missing_data="";
	if (document.form1.vorname.value == "") missing_data=missing_data+"First Name\n";
	if (document.form1.nachname.value == "") missing_data=missing_data+"Last Name\n";
	if (special=="large"){
		if (document.form1.strasse.value == "") missing_data=missing_data+"Street\n";
		if (document.form1.plz.value == "") missing_data=missing_data+"Post Code \n";
		if (document.form1.ort.value == "") missing_data=missing_data+"Town/City\n";
		if (mailified(document.form1.mail.value) == false) missing_data=missing_data+"E-Mail Adress\n";
	}

	if (special=="katalog"){
		if (document.form1.anrede.options.selectedIndex == 0) missing_data = missing_data+"Title\n";
		if (document.form1.strasse.value == "") missing_data=missing_data+"Street\n";
		if (document.form1.hausnummer.value == "") missing_data=missing_data+"House Number\n";
		if (document.form1.plz.value == "") missing_data=missing_data+"Post Code\n";
		if (document.form1.ort.value == "") missing_data=missing_data+"Town/City\n";
		if (document.form1.anzahl_Blickachsen4.value=="" && document.form1.anzahl_Blickachsen3.value=="" && document.form1.anzahl_Blickachsen2.value=="") missing_data=missing_data+"Number of catalogues wanted\n";
	}

	if (missing_data==""){
		return true;
	}else{
		alert("The following details must be entered:\n\n"+missing_data);
		return false;
	}
}

function mailified(adresse)
{
Suche = /..+@..+\...+/;
Ergebnis = Suche.test(adresse);
if (Ergebnis == true)
	{
		return true;
	}
else 
	{
	return false;
	}
}

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 YY_showHideLayers(L2show, L2hide) { //v3.01
//copyright (c)1998-2000 Yaromat.com
  if (document.layers){ //ns
    for (i=0; i<(document.layers.length); i++){
      if (document.layers[i].name.search(L2hide) != -1){document.layers[i].visibility = 'hide';}
      if (document.layers[i].name.search(L2show) != -1){document.layers[i].visibility = 'show';}
    }
  }else
    if (document.getElementById){ //mz
    var yydiv = document.getElementsByTagName("DIV");
    for (i=0; i<(yydiv.length); i++){
      if (yydiv[i]) {var yydivname = yydiv[i].id;} else {var yydivname = '';}
      if (yydivname.search(L2hide) != -1) document.getElementById(yydivname).style.visibility = 'hidden';
      if (yydivname.search(L2show) != -1) document.getElementById(yydivname).style.visibility = 'visible';
    }
  }else
  if (document.all != null){ //ie
    var yydiv = document.all.tags("DIV");
    for (i=0; i<(yydiv.length); i++){
      if (yydiv[i]) {var yydivname = yydiv[i].id;} else {var yydivname = '';}
      if (yydivname.search(L2hide) != -1) document.all[yydivname].style.visibility = 'hidden';
      if (yydivname.search(L2show) != -1) document.all[yydivname].style.visibility = 'visible';
        }
  }
}
