//Externe Links
function externalLinks() {
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") &&
       anchor.getAttribute("rel") == "out")
     anchor.target = "_blank";
 }
}

// CourseCheck
function poolCheck() {
	if (document.getElementById('ispool')) {
		if (document.getElementById('ispool').value == 'n') {
			document.getElementsByName('submit')[1].disabled = true;
			document.getElementsByName('submit')[1].style.cursor = 'help';
			document.getElementsByName('submit')[1].title = 'Bitte legen Sie ein Schwimmbad an.';
		}
	}
}

// CourseCheck
function courseCheck() {
	if (document.getElementById('iscourse')) {
		if (document.getElementById('iscourse').value == 'n') {
			document.getElementsByName('submit')[0].disabled = true;
			document.getElementsByName('submit')[0].style.cursor = 'help';
			document.getElementsByName('submit')[0].title = 'Bitte legen Sie ein Schwimmbad an.';
		}
	}
}

// Formularkill
function valueKill() {
	if (document.getElementById('input_search_de')) {	
		document.getElementById('input_search_de').onfocus = function() { if (this.value == 'Suche') this.value=''; };
		document.getElementById('input_search_de').onblur = function() { if (this.value == '') this.value = 'Suche'; };
	} else if (document.getElementById('input_search_fr')) {	
		document.getElementById('input_search_fr').onfocus = function() { if (this.value == 'Chercher') this.value=''; };
		document.getElementById('input_search_fr').onblur = function() { if (this.value == '') this.value = 'Chercher'; };
	} else if (document.getElementById('input_search_it')) {	
		document.getElementById('input_search_it').onfocus = function() { if (this.value == 'Cercare') this.value=''; };
		document.getElementById('input_search_it').onblur = function() { if (this.value == '') this.value = 'Cercare'; };
	}
}

// Einbinden der Funktionen
function start () {
	courseCheck();
	poolCheck();
	externalLinks();
	valueKill();
}

window.onload = start;

$(document).ready(function(){
	$('a.liame').nospam({
		replaceText: true,    // BOOLEAN, optional default false. If set to true, replaces matched elements' text with the e-mail address
		filterLevel: 'normal' // STRING, optional accepts 'low' or 'normal', default 'normal'.
													// low: email/domain/tld
													// normal: dlt/niamod/liame (email/domain/tld reversed)	
	})
	return false;
});