// JavaScript Document
function showText(show) {
	emailbox = document.getElementById('email');
	
	if (show) {
		if (emailbox.value == "Ihre eMail Adresse") {
			emailbox.value = "";
			emailbox.style.fontStyle = "normal";
			emailbox.style.color = "#000000";
		}
	} else {
		if (emailbox.value == "") {
			emailbox.value = "Ihre eMail Adresse";
			emailbox.style.fontStyle = "italic";
			emailbox.style.color = "#888888";
		}
	}
}

function showEMail() {
	myblock = document.getElementById('showemail');
	
	if (myblock.style.display=='none')
		myblock.style.display="";
	else
		myblock.style.display="none";
	
}

function sendNotify() {
	var xmlHttp = null;
	try {
		// Mozilla, Opera, Safari sowie Internet Explorer (ab v7)
		xmlHttp = new XMLHttpRequest();
	} catch(e) {
		try {
			// MS Internet Explorer (ab v6)
			xmlHttp  = new ActiveXObject("Microsoft.XMLHTTP");
		} catch(e) {
			try {
				// MS Internet Explorer (ab v5)
				xmlHttp  = new ActiveXObject("Msxml2.XMLHTTP");
			} catch(e) {
				xmlHttp  = null;
			}
		}
	}
	
	// '/tieranzeigen' +
	
	if (xmlHttp) {
		xmlHttp.open('GET', 'http://' + window.location.hostname +  '/notify.php?email=' + encodeURIComponent(document.getElementById('email').value) , true);
		xmlHttp.onreadystatechange = function () {
			if (xmlHttp.readyState == 4) {
				//alert(xmlHttp.responseText);
				if (xmlHttp.responseText == "1") {
					document.getElementById('showemailerr').style.display="none";
					
					document.getElementById('showemail').innerHTML="<table width=100% cellpadding=0 cellspacing=5><tr><td colspan=2>Sie werden von uns 1x taglich über neue Anzeigen aus dieser Kategorie informiert!</td></tr></table>";
				} else {
					document.getElementById('showemailerr').style.display="";
				}
			}
		};
		xmlHttp.send(null);
	}
}
