/* Datenschutzüberprüfung */

function checkDS() {
	if($('ds').checked) {
		if(typeof($('campaign')) != undefined ) {
			$('campaign').submit();
		} else  if(typeof($('wsireporter')) != undefined ) {
			$('wsireporter').submit();
		} else if(typeof($('englischtest')) != undefined ) {
			$('englischtest').submit();
		}  else  if(typeof($('gutschein')) != undefined ) {
			$('gutschein').submit();
		} else if(typeof($('anmelden')) != undefined ) {
			$('anmelden').submit();
		} else if(typeof($('newsletter')) != undefined ) {
			$('newsletter').submit();
		} else if(typeof($('kontakt')) != undefined ) {
			$('kontakt').submit();
		} else if(typeof($('callback')) != undefined ) {
			$('callback').submit();
		}
	} else {
		alert('Si Prega di confermare il consenso al trattamento dei dati per poter procedere.');
	}
}


/*****************************
			Routenplaner 
*****************************/

function checkRouting()
{
	f = document.getElementById("route_calculator");
	saddr = f.street.value + ",+" + f.city.value + ",+" + "Italia";
	f.saddr.value = saddr;
	return false;
}


/******************************
		Gutschein Popup
******************************/

function gutschein($uniquekey) {
	popup = window.open("/offerte-speciali/il-voucher-online/il-voucher-online.php?id=" + $uniquekey, "Gutschein", "left=10, top=10, width=600, height=850");
	popup.focus();
	//popup.print(); Darf er erst bei ge?ffnetem Fenster machen...
}


function checksonstiges(that)
{
   if ( that.value == 10 )
   {
      document.getElementById('sonstigesdiv').style.display = '';
   }
   else
   {
      document.getElementById('sonstigesdiv').style.display = 'none';      
      document.getElementById('sonstiges').value = '';      
   }
}

var sessionName;
var sessionID;
function initWebsite(sess_name, sess_id)
{
   sessionName = sess_name;
   sessionID   = sess_id;
}



function ajaxCallPhpFunc (namespace, phpFunction, stringParameters, onComplete) {
   
   //var stringParameters = sessionName + '=' + sessionID + '&' + stringParameters;
   var stringParameters = stringParameters;

   var myAjax = new Ajax.Request( '/includes/php/ajax/phpCallFunction.php?namespace=' + namespace + '&phpFunction=' + phpFunction, {
      method: 'post', 
      asynchronous: true, 
      parameters: stringParameters,
      onComplete: onComplete
   });
}

function ajaxCallPhpFuncCampa (namespace, phpFunction, stringParameters, onComplete) {
   
   //var stringParameters = sessionName + '=' + sessionID + '&' + stringParameters;
   var stringParameters = stringParameters;

   var myAjax = new Ajax.Request( '/includes/php/ajax/phpCallFunctionCampa.php?namespace=' + namespace + '&phpFunction=' + phpFunction, {
      method: 'post', 
      asynchronous: true, 
      parameters: stringParameters,
      onComplete: onComplete
   });
}

/* */

function mach_rewrite_link(url) {
	url = url.replace(/ä/g, "ae");
	url = url.replace(/ü/g, "ue");
	url = url.replace(/ö/g, "oe");
	
	url = url.replace(/Ä/g, "Ae");
	url = url.replace(/Ü/g, "Ue");
	url = url.replace(/Ö/g, "Oe");
	
	url = url.replace(/\\/g, "");
	url = url.replace(/'/g, "");
	url = url.replace(/&quot;/g, "");
	url = url.replace(/&amp;/g, "");
	url = url.replace(/<br>/g, "");
	url = url.replace(/[()]/g, "");
	url = url.replace(/[^a-zA-Z0-9]/g, "-");
	
	url = url.toLowerCase();

	return (url);
}

/******************************
		E-Mail-Adresse verstecken
******************************/

function sendmailto(mail1,mail2)
{
	document.location.replace('mailto:'+mail1+'@'+mail2);
}

/******************************
		Englischtest
******************************/

function etNextQuestion() {
	document.englischtest.submit();
}

function hideETButton() {
	$('etSubmitButton').style.display = 'none';

}
