function openAanbieding() {
	var newWindow;
	var strUrl;

	strUrl = new String('$script_link_voucher');

	newWindow = window.open('$jsbaseurl'+strUrl,'helpfunctie','width=650,height=436,scrollbars=0,resizable=yes');
	newWindow.focus();
}



function launchPhotoSlider(carid){
	var hostName = '';
	if (arguments.length > 1) {
		hostName = arguments[1];
	}

	//if (!document.getElementById('photoslider')){
		var bodytag = document.getElementsByTagName('body')[0];

		var anchorElement = document.createElement('div');
		var alignElement = document.createElement('div');
		var placerElement = document.createElement('div');
		var contentElement = document.createElement('div');

		anchorElement.id = 'PSanchor';
		alignElement.id = 'PSalign';
		placerElement.id = 'PSplacer';
		contentElement.id = 'photoslider';

		bodytag.appendChild(anchorElement);
		anchorElement.appendChild(alignElement);
		alignElement.appendChild(placerElement);
		placerElement.appendChild(contentElement);

		psloader = new SWFObject("/photoxml/PSloader.swf", "photoslider", "440", "400","1","","false");
		psloader.addParam("menu", "false");
		psloader.addParam("wmode", "transparent");
		psloader.addParam("quality", "best");
		psloader.addVariable("xmlfile", hostName + "/photoxml/carphoto?carid=" + carid);
		psloader.write("photoslider");
	//} else {
	//	var divtag = document.getElementById('PSanchor');
	//	divtag.style.display = 'block';
	//}
}
function destroyPhotoSlider(){
	// the old method
	//var divtag=document.getElementById('PSanchor');
	//divtag.style.display = 'none';
	var slider = document.getElementById('photoslider');
	slider.parentNode.removeChild(slider);
	slider = null;
}

function naarRoutenet(intCarId) {

	var newWindow;
	var strUrl;

	if (document.forms['form_routenet'] == ''){
		alert ('U heeft geen postcode opgegeven');
	} else {
		strUrl = new String('http://www.autokopen.nl/occasion/openroutenet.html?');
		strUrl = strUrl + 'carid=' + intCarId;
		strUrl = strUrl + '&zipcode=' + document.forms['form_routenet'].zipcode.value;
	//alert(strUrl);
		newWindow = window.open(strUrl,'routenet','width=800,height=600,scrollbars=yes,resizable=yes');
	  newWindow.focus();
	}
}
function openAanbieding(jsbaseurl, script_link_voucher) {
	var newWindow;
	var strUrl;

	strUrl = new String(script_link_voucher);

	newWindow = window.open(jsbaseurl + strUrl,'helpfunctie','width=650,height=436,scrollbars=0,resizable=yes');
	newWindow.focus();
}

function validate(){
	if(document.infoformulier.f_naam.value == ''){
	 alert('naam is een vereist veld');
	 return false;
	}
	if(document.infoformulier.f_email.value == ''){
	 alert('Email is een vereist veld');
	 return false;
	}
	else{
		var x = document.infoformulier.f_email.value;
		var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
			if (!filter.test(x)){
			 alert('Het emailadres is geen geldig emailadres');
			return false;
			}
	}
}

function carbig(script_link_popup, jsbaseurl) {
	var hwnd;
	var strUrl;

	try {
		strUrl = new String(script_link_popup);
		fotowindow = window.open( jsbaseurl+strUrl,'Fotoscherm','width=735,height=539,scrollbars=no');
	} catch(e) {
		alert('Het gevraagde scherm kon helaas niet worden getoond');
	}

	return true;
}
function mailFriend(script_link_mail, jsbaseurl) {
	try {
		mailwindow = window.open(jsbaseurl+script_link_mail,'Plaatje','width=730,height=560,scrollbars=yes');
	} catch(e) {
		alert('Het gevraagde scherm kon helaas niet worden getoond');
	}

	return true;
}
