/* GOOGLE ANALYTICS */
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-20570191-1']);
  _gaq.push(['_setDomainName', '.wetterspiegel.de']);
  _gaq.push(['_setAllowHash', 'false']);
  _gaq.push(['_trackPageview']);
  _gaq.push(['_trackPageLoadTime']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
/* GOOGLE ANALYTICS */

var win = null;
function openPopup(popup_name,popup_url,popup_width,popup_height,popup_scrollbars,popup_toolbar,popup_status) {
	popup_left = (screen.width)  ? (screen.width  - popup_width) / 2  : 0;
	popup_top  = (screen.height) ? (screen.height - popup_height) / 2 : 0;
	settings   = 'height='+popup_height+',width='+popup_width+',top='+popup_top+',left='+popup_left+',scrollbars='+popup_scrollbars+',toolbar='+popup_toolbar+',status='+popup_status+',resizable=yes';
	win = window.open(popup_url,popup_name,settings);
	if(win.window.focus)
		win.window.focus();
}


function webcamformSenden() {
	if(document.anmeldung.link_cam.value=="" || document.anmeldung.link_cam.value.length<3) {
			document.anmeldung.link_cam.value="Bitte geben Sie einen Link an!";
			document.anmeldung.link_cam.focus();
			document.anmeldung.link_cam.select();
			return false;
	}else {
		if(document.anmeldung.link_cam.value.indexOf('png')==-1 && document.anmeldung.link_cam.value.indexOf('jpg')==-1 && document.anmeldung.link_cam.value.indexOf('gif')==-1) {
					document.anmeldung.link_cam.value="Bitte geben Sie einen Link an!";
					document.anmeldung.link_cam.focus();
					document.anmeldung.link_cam.select();
					return false;
		}else {
			if(document.anmeldung.bezeichnung.value=="" || document.anmeldung.bezeichnung.value.length<3) {
				document.anmeldung.bezeichnung.value="Bitte geben Sie eine Bezeichnung an!";
				document.anmeldung.bezeichnung.focus();
				document.anmeldung.bezeichnung.select();
				return false;
			}else {
				if(document.anmeldung.vorname.value=="" || document.anmeldung.vorname.value.length<3) {
					document.anmeldung.vorname.value="Bitte geben Sie einen Vornamen an!";
					document.anmeldung.vorname.focus();
					document.anmeldung.vorname.select();
					return false;
				}else {
					if(document.anmeldung.nachname.value=="" || document.anmeldung.nachname.value.length<3) {
						document.anmeldung.nachname.value="Bitte geben Sie einen Nachnamen an!";
						document.anmeldung.nachname.focus();
						document.anmeldung.nachname.select();
						return false;
					}else {
						if(document.anmeldung.email.value=="" || document.anmeldung.email.value.indexOf('@')==-1 || document.anmeldung.email.value.length<7) {
							document.anmeldung.email.value="Bitte geben Sie eine E-Mail Adresse an!";
							document.anmeldung.email.focus();
							document.anmeldung.email.select();
							return false;
						}else
								document.anmeldung.submit();
					}
				}
			}
		}
	}
}

function CheckTerminpunktprognose(){
	var error=0;
	var message="";
	document.getElementById('fehler_tpp').innerHTML="";
	
	if(document.frmterminpunktprognose.breite.value=="" || document.frmterminpunktprognose.breite.value=="Breite") {
				document.frmterminpunktprognose.breite.value="Breite";
				document.frmterminpunktprognose.breite.focus();
				document.frmterminpunktprognose.breite.select();
				document.frmterminpunktprognose.breite.style.color="#E08422";
				error=1;
	}else {
		var breite_komma = document.frmterminpunktprognose.breite.value.replace(/,/g, ".");
		if(breite_komma > 83.1 || breite_komma <23.7) {
			message +="Gültige Breite von 24 bis 83.<br>";
			error=1;
		}
	}
	
	if(document.frmterminpunktprognose.laenge.value=="" || document.frmterminpunktprognose.laenge.value=="Länge") {
				document.frmterminpunktprognose.laenge.value="Länge";
				document.frmterminpunktprognose.laenge.focus();
				document.frmterminpunktprognose.laenge.select();
				document.frmterminpunktprognose.laenge.style.color="#E08422";
				error=1;
	}else {
		var laenge_komma = document.frmterminpunktprognose.laenge.value.replace(/,/g, ".");
		if(laenge_komma > 67.2 || laenge_komma <-37.8) {
			message +="Gültige Länge von -38 bis 67.<br>";
			error=1;
		}
	}
	if(document.frmterminpunktprognose.hoehe.value=="" || document.frmterminpunktprognose.hoehe.value=="Höhe") {
				document.frmterminpunktprognose.hoehe.value="Höhe";
				document.frmterminpunktprognose.hoehe.focus();
				document.frmterminpunktprognose.hoehe.select();
				document.frmterminpunktprognose.hoehe.style.color="#E08422";
				error=1;
	}else {
		var hoehe_komma = document.frmterminpunktprognose.hoehe.value.replace(/,/g, ".");
		if(hoehe_komma > 5500 || hoehe_komma <-100) {
			message +="Gültige Höhe von -100m bis 5500m.";
			error=1;
		}
	}



	if (error==0){
		document.frmterminpunktprognose.submit();
		return true;
	} else {
	document.getElementById('fehler_tpp').innerHTML=message;
	}
	//return false;

}

/***************************
Terminpunktprognose
***************************/
function show(welement){
	document.getElementById(welement+'_exp').style.display="block";
	document.getElementById(welement+'_plus').style.display="none";
	document.getElementById(welement+'_minus').style.display="inline";
}

function hide(welement){
	document.getElementById(welement+'_exp').style.display="none";
	document.getElementById(welement+'_plus').style.display="inline";
	document.getElementById(welement+'_minus').style.display="none";
}

// Eingabe (Zahlen) in NaviBox überprüfen
function CheckZahl(elem) {
	var eingabe= document.getElementById(elem).value;
	if (eingabe.length > 0){
		var Wert = eingabe, chkZ = 1;
		for (i=0;i<Wert.length;++i){
			if (Wert.charAt(i) < "0" || Wert.charAt(i) > "9" ) {
				if (Wert.charAt(i)!="," && Wert.charAt(i)!="-" && Wert.charAt(i)!="."){
				//eingabe.length = 0;
				document.getElementById(elem).value = eingabe.substr(0,eingabe.length-1);
				}
			}
		}
	}
}

