function istEmail(feld) {
	// werden regular expressions unterstuetzt?
	var supported = 0;
	if (window.RegExp) {
	var tempStr = "a";
	var tempReg = new RegExp(tempStr);
	if (tempReg.test(tempStr)) supported = 1;
	}
	if (!supported) 
	return (feld.indexOf(".") > 2) && (feld.indexOf("@") > 0);
	var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
	var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$");
	return (!r1.test(feld) && r2.test(feld));
}
function testEmail(str) {
	if (!istEmail(str)) {
	alert("Sie haben eine falsche eMail-Adresse eingegeben!\nBitte korrigieren Sie Ihre Eingabe.");
	return false;
	}
	else { return true; }
}
function open_window(datei,b,h) {
	newWindow=window.open(datei,"popup","width="+b+",height="+h+",status=no,scrollbars=yes,location=no,resizable=yes,menubar=no,toolbar=no,directories=no");
	newWindow.focus();
}
function maillink (n,d,cl) {
	document.write('<a ');
	if (cl!="") document.write('class="'+cl+'" ');
	document.write('href="mailto:' + n + '@' + d + '">');
	document.write(n + '@' + d + '</a>');
}
/* Angebote */
function tashowdetails(dividnr,angebotid){
	divid='tadetail'+dividnr;
	divid2='tadetail2x'+dividnr;
	if (document.getElementById(divid).style.display == "none" || document.getElementById(divid).style.display == "" ){
		document.getElementById(divid).style.display="block";
		document.getElementById(divid2).style.display="block";
		taloaddetails(angebotid);
	} else {
		document.getElementById(divid).style.display="none";
		document.getElementById(divid2).style.display="none";
	}
}
function taloaddetails(angebotid) {
	var zeit = new Date();
	var ms = zeit.getMilliseconds();
	document.getElementById(divid).innerHTML='... Daten werden geladen ...';
	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;
	        }
	    }
	}
	if (xmlHttp) {
	    xmlHttp.open('GET', '/topdeals_ajax.php?angebotid='+angebotid+'&ms='+ms, true);
	    xmlHttp.onreadystatechange = function () {
	        if (xmlHttp.readyState == 4) {
				resultText = xmlHttp.responseText;
	            document.getElementById(divid).innerHTML=resultText;
	        }
	    };
	    xmlHttp.send(null);
	}
}
function seldatum(data){
	var datum=document.formdatum.fdatum.options[document.formdatum.fdatum.selectedIndex].value;
	var newurl=document.URL;
	var found = newurl.match(/\//g);
	if (datum!="") datum='/'+datum;
	if (found.length==6) newurl=newurl.replace(/\/([^\/]*)\/([^\/]*)$/,datum+"/$2");
		else newurl=newurl.replace(/\/([^\/]*)$/,datum+"/$1");
	newurl=newurl.replace(/reisen\-([^\/]*)\.html$/,"reisen-"+data+".html");
	document.location.href=newurl;
}
