function popupvertrek(sUrl,sWidth,sHeight) {
	var oWin = window.open(sUrl,'profile','height='+sHeight+',width='+sWidth+',scrollbars=yes,location=no,resize=yes');
	oWin.moveTo(150, 150)
	oWin.focus();
}

function getFrame(){
	if(this.name!="vpMainFrame"){
		cURL = document.location;
		document.location="../webfront/redirect.asp?rc=100&url=" + cURL
		}
}

function getFrameHeight(){    
    if(document.location.href.indexOf('localhost') == -1 && document.location.href.indexOf('http://') > -1)
    {
         if(document.location.href.indexOf('vakanties.vertrekpunt.nl') > -1 ||document.location.href.indexOf('vakantiestest.vertrekpunt.nl') > -1)
         {
             var debug = '';
             var su = 'su=zoek-en-boek';
             if (document.location.href.indexOf('su=') > -1) {
                 su = '';
             }
             if(document.location.href.indexOf('vakantiestest.vertrekpunt.nl') > -1)
             {
                debug= '&test=true';
             }
		if(parent.location.href!=document.location.href){			
					//alert('setheight');
                    parent.setHeight(); 	
		   
			
              }else{
               var s = window.location.search.replace("?","") ;
               if(s=="")document.location.href = "http://www.vertrekpunt.nl/webfront/base.asp?" + su + debug;
               else document.location.href = "http://www.vertrekpunt.nl/webfront/base.asp?" + s + "&" + su + debug;
              } 
	      var loadingElement = parent.document.getElementById('loading');
		if(loadingElement!=null)loadingElement.parentNode.removeChild(loadingElement);
         }
    } 
}

/*function getFrameHeight(){
 if(document.location.href.indexOf('vakanties.vertrekpunt.nl')>-1||document.location.href.indexOf('vakantiestest.vertrekpunt.nl')>-1 || document.location.href.indexOf('vertrekpunttest.dynapax.nl')>-1) 
{
  var debug= '';
  if(document.location.href.indexOf('vakantiestest.vertrekpunt.nl')>-1)
  debug= '&debug=true';
  if(parent.location.href!=document.location.href){
	
   parent.setHeight(); 
  }else{
	if(document.location.href.indexOf('vertrekpunttest.dynapax.nl') == -1)
{
   var s = window.location.search.replace("?","") ;
   if(s=="")document.location.href = "http://www.vertrekpunt.nl/webfront/base.asp?su=zoek-en-boek" + debug
   else document.location.href = "http://www.vertrekpunt.nl/webfront/base.asp?" + s + "&su=zoek-en-boek" + debug;
}
  } 
 }
 
}*/

/*Redirect Functie voor partners die ze kunnen gebruiken om binnen 
hun eigen site naar een pagina te gaan met hun eigen Iframe. 
*/
function PartnerRedirect(frm, url)
{
	//url van de resultaatpagina.
	var partnerUrl = 'http://www.[partner].nl/test.aspx&url=' 
	var fd = new FormData(frm);		
	//hier wordt de pagina gelinkt naar de resultaatpagina
	top.location.href = partnerUrl + url + '/result.aspx?' + fd.toQueryString();	
}

function checkBookingVertrek(frm)
{
	var idname;
	var value;
	var strMsg ='';
	var blnCheck =true;
	var title = '';
	var allInputFields = document.all ?    document.all.tags('INPUT') :    document.getElementsByTagName ?     document.getElementsByTagName('INPUT') : new Array();
	for (var i = 0; i < allInputFields.length; i++)
	{
		idname = allInputFields[i].id;
		value = allInputFields[i].value;
		title = allInputFields[i].title;
		switch(idname)
		{
			case 'required':
				if(isEmpty(value))
				{
					strMsg += title  + ' is verplicht.\n';
					blnCheck = false;
				}
				break;
			case 'email':
				if(isEmpty(value))
				{
					strMsg += title  + ' is verplicht.\n';
					blnCheck = false;
				} else {
					if(!checkMail(value))
					{
						strMsg += title  + ' is een ongeldig emailadres.\n';
						blnCheck = false;
					}			
				}
				break;
			case 'postcode':
				if(isEmpty(value))
				{
					strMsg += title  + ' is verplicht.\n';
					blnCheck = false;
				} else {
					/*if(!checkPostcode(value))
					{
						strMsg += title  + ' is  een ongeldige postcode.\n';
						blnCheck = false;
					}*/
				}
				break;
			case 'phone':
				if(isEmpty(value))
				{
					strMsg += title  + ' is verplicht.\n';
					blnCheck = false;
				} else {
					if(!checkPhone(value))
					{
						strMsg += title  + ' is  een ongeldige telefoonnummer.\n';
						blnCheck = false;
					} else {
						if(value.length < 10)
						{
							strMsg += title  + ' dient minimaal 10 cijfers te zijn.\n';
							blnCheck = false;
						} 
					}
				}
				break;
			case 'date':
				if(!isDate(value))
				{
					strMsg += title  + ' is een ongeldige datum.\n';
					blnCheck = false;
				}
				break;
			case 'checked':
				if(!allInputFields[i].checked)
				{
					strMsg += 'U dient akkoord te gaan met de algemene voorwaarden.\n';
					blnCheck = false;
				}				
				break;
			case 'newsletter':
				frm.elements['bookingdata/newsletter'].value=0;
				if(allInputFields[i].checked)
				{
					frm.elements['bookingdata/newsletter'].value=1;
				}	
				break;
			case 'ccrequired':	
			case 'ccnumber':						
				if(getRadioValue(frm.elements['bookingdata/paymenttype'])== 0)
				{
					if(isEmpty(value))
					{
						strMsg += title  + ' is verplicht.\n';
						blnCheck = false;
					} else{
						if (idname == 'ccnumber')
						{
							if(!checkNumeric(value))
							{
								strMsg += title  + ' dient numeriek te zijn.\n';
								blnCheck = false;
							} 
						}
					}
				}
				break;	
			case 'paymentrequired':			
				var paymenttype = getRadioValue(frm.elements['bookingdata/paymenttype']);				
				if(paymenttype == null || paymenttype < 0)
				{
						strMsg += title  + ' is verplicht.\n';
						blnCheck = false;
				}
				break;			

			case 'bankrequired':
			case 'banknumber':						
				if(getRadioValue(frm.elements['bookingdata/paymenttype'])== 1)
				{
					if(isEmpty(value))
					{
						strMsg += title  + ' is verplicht.\n';
						blnCheck = false;
					} else{
						if (idname == 'banknumber')
						{
							if(!checkNumeric(value))
							{
								strMsg += title  + ' dient numeriek te zijn.\n';
								blnCheck = false;
							} 
						}
					}
				}
				break;
		    case 'carrental':
			   if(value == 1)
			   {
			        if(createOrder() == false)
			        {
			            blnCheck = false;
			        } 
			   }
			   break;
         case 'cardetails':
            //alert(allInputFields[i].value);
            allInputFields[i].value = g_strCardetails;
            //alert(g_strCardetails);
            break;	

		}		
	}
	
	if (blnCheck)
	{
		frm.submit();
	} else {
		alert(strMsg);
	}
	return blnCheck;
}

//functie voor extra invoerveld "waar kent u vertrektpunt van"

function checkContact(strValue){
	if(strValue=="-"||strValue=="Netwerk, vrienden, kennissen, familie"){
		document.getElementById("hoecontact_anders").style.display = "none";
		document.getElementById("hoecontact_anders").value="";
	}else{
		document.getElementById("hoecontact_anders").style.display = "block";
	}
}

function showAccoPropShow(bool){
    if(bool)
    {
		document.getElementById("searchaccoprops").style.display = "block";
		document.getElementById("searchaccoprops").style.visibility = "visible";
		document.getElementById("searchaccopropsimagehide").style.display = "block";
		document.getElementById("searchaccopropsimagehide").style.visibility = "visible";
		
	    document.getElementById("searchaccopropsimageshow").style.display = "none";
	    document.getElementById("searchaccopropsimageshow").style.visibility = "hidden";			
		
		
    }else {
	    document.getElementById("searchaccoprops").style.display = "none";
	    document.getElementById("searchaccoprops").style.visibility = "hidden";			
	    document.getElementById("searchaccopropsimagehide").style.display = "none";
	    document.getElementById("searchaccopropsimagehide").style.visibility = "hidden";		
  		document.getElementById("searchaccopropsimageshow").style.display = "block";
		document.getElementById("searchaccopropsimageshow").style.visibility = "visible";

	}
}
