/* mouse over color change */

function ColorChange(id,farbe) {

            if (document.getElementById)

            document.getElementById(id).style.backgroundColor=farbe;

else

            if (document.layers)

            document.layers[id].bgColor=farbe;

}

 

function openWindow(url) {

            window.open(url,'popup','width=220,height=150,left=100,top=100,menubar=NO,resizable=NO,scrollbars=NO,status=NO,toolbar=NO,dependent=YES,location=NO');

}

 

function MM_openBrWindow(theURL,winName,features) { //v2.0

  window.open(theURL,winName,features);

}

 

function MM_findObj(n, d) { //v4.0

  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {

    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}

  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];

  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);

  if(!x && document.getElementById) x=document.getElementById(n); return x;

}

function trim(this_value){
	return this_value.replace(/^\s+/g,'').replace(/\s+$/g,'');
}

function sendCallmeForm(){
	df = document.tyo3_Callme;
	msg = '';
	focussedElement = "";
	if(trim(df.name.value).length < 5){
		msg+="- Bitte geben Sie Ihren Namen ein!\n\n";
		focussedElement = focussedElement == '' ? df.name : focussedElement;
	}
	if(trim(df.tel.value).length < 7){
		msg+="- Bitte geben Sie Ihre Telefonnummer ein!\n\n";
		focussedElement = focussedElement == '' ? df.tel : focussedElement;
	}
	
	if(msg == ''){
		df.submit();
	}
	else{
		focussedElement.focus();
		focussedElement.select();
		alert(msg);
	}
} 

function setContact() {

            if (document.URL.indexOf("fehler") != -1) {

                        document.write("<tr><td class=boxform colspan=2><font color=red>Bitte geben Sie Ihren Namen und eine Telefonnummer an!</font></td></tr>");

            }

            

            if (document.URL.indexOf("gesendet") != -1) {

                        document.write("<tr><td class=boxform>Vielen Dank f&uuml;r Ihr Interesse, wir rufen Sie umgehend zur&uuml;ck.</td></tr>");

            }

            else {                                                                          

                        document.write("<form action='form2mail_microsite.php' method='post' name='tyo3_Callme'><tr><td class='boxform'>Name:</td><td align='right' class='boxform'><input type='text' name='name' class='textfield01'></td></tr><tr><td class='boxform'>Telefon:</td><td align='right' class='boxform'><input type='text' name='tel' class='textfield01'></td></tr>");

                        document.write("<script type='text/javascript' language='JavaScript'>");

                        document.write("tomail = entschluesseln('118,101,114,116,114,105,101,98,48,57,64,109,97,114,105,116,46,97,103');");

                        document.write("</script>");

                        document.write("<input type='hidden' name='TO' value='"+tomail+"'>");
						
						/*document.write("<input type='hidden' name='CC' value='"+ccmail+"'>");*/

                        /*document.write("<input type='hidden' name='ABSENDER' value='"+semail+"'>");*/

                        document.write("<input type='hidden' name='SUBJECT' value='Typo3 Microsite | Call me back'>");

                        document.write("<input type='hidden' name='EXIT_PAGE' value='index.php?id=251'>");                 

                        document.write("</form><tr align='right'><td colspan='2' class='boxform'><a href='Javascript:sendCallmeForm();'><img border='0' src='fileadmin/templates/img/b_send.gif' width='49' height='17'></a></td></tr>");

            }

}

function entschluesseln(mail){

            mail = mail.split(",");

            d='';

            for(i=0;i<mail.length;i++){

                        d+="&#"+mail[i]+";";

            }

            return d;

}
