//PARA LEER LOS PARAMETROS DE IT
function getUrlVars()
	{
		var vars = [], hash;
		var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
		for(var i = 0; i < hashes.length; i++)
		{
			hash = hashes[i].split('=');
			vars.push(hash[0]);
			vars[hash[0]] = hash[1];
		}
		return vars;
	}

//Variables globales
//para parametros
var first;//Destination
var second;//Resort
var third;//CheckInDate
var fourth;//CheckOutDate
var fifth;//NumUnits
var sixth;//CouponCode
//var seventh;//ynBanner

var myselect;//=document.getElementById("PropertyID");
var destiny;//=document.booknow.DestinationID;
var currentDateCheckIn;// = document.booknow.CheckinDate.value;
var currentDateCheckOut;// = document.booknow.CheckoutDate.value;
var cuponCode;//=sixth;

var checkInTmp = new Date();
var checkOutTmp = new Date();

//DECLARAMOS LAS COOKIES
/*var cookieWholeSaler;
var cookiePeopleID;
var cookieWholeSalerInfo;
var cookieYNBanner;
var cookie1;
var cookie2;
*/

function getParameters(){	
	//IMPORTANTE CUANDO LEEMOS ESTOS SON LOS PARAMETROS
	//Y CUANDO ENVIAMOS A DATAPROCESS
	first = getUrlVars()["Destination"];
	
	// To get the second parameter
	second = getUrlVars()["Resort"];
	third = getUrlVars()["CheckInDate"];
	fourth = getUrlVars()["CheckOutDate"];
	fifth = getUrlVars()["NumUnits"];
	sixth = getUrlVars()["CouponCode"];
	//seventh = getUrlVars()["PeopleID"];
	//eighth = getUrlVars()["ynBanner"];
	
	
	//AGREGAR LOS OTROS PARAMETROS DE PEOPLE ID Y YNBANNER
	
	myselect=document.getElementById("PropertyID");
	//AUTOSETTERS PARAMETERS
	//pasamos como parametros las variables que recuperamos de dataprocess.aspx (cookies)
		switch (first) { 
			default:
				document.booknow.DestinationID.selectedIndex=1;
				//alert(first);
			break
			
			case "4": //En caso de que sea  St Maarten
				document.booknow.DestinationID.selectedIndex=2;
				//alert(first);
			break;
			
			case "5": //en caso de que sea Curacao
				document.booknow.DestinationID.selectedIndex=3;
				//alert(first);
			break;
		
		}
		
				switch (second) { 
					//Aqui valido si el parametro que viene es VACIO entonces le asignamos 0 = All Resorts
					default: 
						 var i;
						  for (i = myselect.length - 1; i>=0; i--) {
							if (myselect.options[i]) {
							  myselect.remove(i);
							}
						  }
						  try
			  			{
						myselect.add(new Option("ALL RESORTS", "0"), myselect.options[0]);
						myselect.add(new Option("The Royal Haciendas", "9"), myselect.options[1]);
						myselect.add(new Option("The Royal Cancun", "11"), myselect.options[2]); 
						myselect.add(new Option("The Royal Sands", "5"), myselect.options[3]); 
						myselect.add(new Option("The Royal Mayan", "2"), myselect.options[4]); 
						myselect.add(new Option("The Royal Caribbean", "3"), myselect.options[5]); 
						myselect.add(new Option("The Royal Islander", "4"), myselect.options[6]);
						break 
						}
						
						catch (e)
			  			{
						myselect.add(new Option("ALL RESORTS", "0"), 0);
						myselect.add(new Option("The Royal Haciendas", "9"),1);
						myselect.add(new Option("The Royal Cancun", "11"),2); 
						myselect.add(new Option("The Royal Sands", "5"),3); 
						myselect.add(new Option("The Royal Mayan", "2"),4); 
						myselect.add(new Option("The Royal Caribbean", "3"),5); 
						myselect.add(new Option("The Royal Islander", "4"),6);
						break
							}
					//En caso de que sea 9 TRHaciendas	
					case "9":
						 var i;
						  for (i = myselect.length - 1; i>=0; i--) {
							if (myselect.options[i]) {
							  myselect.remove(i);
							}
						  }
						try
			  			{
							myselect.add(new Option("The Royal Haciendas", "9"), myselect.options[0]);
							myselect.add(new Option("ALL RESORTS", "0"), myselect.options[1]);
							myselect.add(new Option("The Royal Cancun", "11"), myselect.options[2]); 
							myselect.add(new Option("The Royal Sands", "5"), myselect.options[3]); 
							myselect.add(new Option("The Royal Mayan", "2"), myselect.options[4]); 
							myselect.add(new Option("The Royal Caribbean", "3"), myselect.options[5]); 
							myselect.add(new Option("The Royal Islander", "4"), myselect.options[6]);
							break 
						}
						catch (e)
			  			{
							myselect.add(new Option("The Royal Haciendas", "9"), 0);
							myselect.add(new Option("ALL RESORTS", "0"),1);
							myselect.add(new Option("The Royal Cancun", "11"),3); 
							myselect.add(new Option("The Royal Sands", "5"),4); 
							myselect.add(new Option("The Royal Mayan", "2"), 5); 
							myselect.add(new Option("The Royal Caribbean", "3"), 5); 
							myselect.add(new Option("The Royal Islander", "4"), 6);
							break 
							}
						
						case "11":
						 var i;
						  for (i = myselect.length - 1; i>=0; i--) {
							if (myselect.options[i]) {
							  myselect.remove(i);
							}
						  }
						  try
			  			{
						myselect.add(new Option("The Royal Cancun", "11"), myselect.options[0]); 
						myselect.add(new Option("The Royal Haciendas", "9"), myselect.options[1]);
						myselect.add(new Option("ALL RESORTS", "0"), myselect.options[2]);
						myselect.add(new Option("The Royal Sands", "5"), myselect.options[3]); 
						myselect.add(new Option("The Royal Mayan", "2"), myselect.options[4]); 
						myselect.add(new Option("The Royal Caribbean", "3"), myselect.options[5]); 
						myselect.add(new Option("The Royal Islander", "4"), myselect.options[6]);
						break 
						}
						
						catch (e)
			  			{
							myselect.add(new Option("The Royal Cancun", "11"), 0); 
						myselect.add(new Option("The Royal Haciendas", "9"), 1);
						myselect.add(new Option("ALL RESORTS", "0"), 2);
						myselect.add(new Option("The Royal Sands", "5"), 3); 
						myselect.add(new Option("The Royal Mayan", "2"),4); 
						myselect.add(new Option("The Royal Caribbean", "3"), 5); 
						myselect.add(new Option("The Royal Islander", "4"), 6);
						break 
						}
						
						case "5":
						 var i;
						  for (i = myselect.length - 1; i>=0; i--) {
							if (myselect.options[i]) {
							  myselect.remove(i);
							}
						  }
						  try
			  			{
						myselect.add(new Option("The Royal Sands", "5"), myselect.options[0]); 
						myselect.add(new Option("The Royal Cancun", "11"), myselect.options[1]); 
						myselect.add(new Option("The Royal Haciendas", "9"), myselect.options[2]);
						myselect.add(new Option("ALL RESORTS", "0"), myselect.options[3]);
						myselect.add(new Option("The Royal Mayan", "2"), myselect.options[4]); 
						myselect.add(new Option("The Royal Caribbean", "3"), myselect.options[5]); 
						myselect.add(new Option("The Royal Islander", "4"), myselect.options[6]);
						break 
						}
						
						catch (e)
			  			{
						myselect.add(new Option("The Royal Sands", "5"), 0); 
						myselect.add(new Option("The Royal Cancun", "11"), 1); 
						myselect.add(new Option("The Royal Haciendas", "9"), 2);
						myselect.add(new Option("ALL RESORTS", "0"), 3);
						myselect.add(new Option("The Royal Mayan", "2"), 4); 
						myselect.add(new Option("The Royal Caribbean", "3"), 5); 
						myselect.add(new Option("The Royal Islander", "4"), 6);
						break 
						}
						
						case "2":
						 var i;
						  for (i = myselect.length - 1; i>=0; i--) {
							if (myselect.options[i]) {
							  myselect.remove(i);
							}
						  }
						  try
			  			{
						  myselect.add(new Option("The Royal Mayan", "2"), myselect.options[0]); 
						myselect.add(new Option("The Royal Sands", "5"), myselect.options[1]); 
						myselect.add(new Option("The Royal Cancun", "11"), myselect.options[2]); 
						myselect.add(new Option("The Royal Haciendas", "9"), myselect.options[3]);
						myselect.add(new Option("ALL RESORTS", "0"), myselect.options[4]);
						myselect.add(new Option("The Royal Caribbean", "3"), myselect.options[5]); 
						myselect.add(new Option("The Royal Islander", "4"), myselect.options[6]);
						break 
						}
						catch (e)
			  			{
							myselect.add(new Option("The Royal Mayan", "2"), 0); 
						myselect.add(new Option("The Royal Sands", "5"), 1); 
						myselect.add(new Option("The Royal Cancun", "11"), 2); 
						myselect.add(new Option("The Royal Haciendas", "9"), 3);
						myselect.add(new Option("ALL RESORTS", "0"), 4);
						myselect.add(new Option("The Royal Caribbean", "3"),5); 
						myselect.add(new Option("The Royal Islander", "4"), 6);
						break 
						}
						
						case "3":
						 var i;
						  for (i = myselect.length - 1; i>=0; i--) {
							if (myselect.options[i]) {
							  myselect.remove(i);
							}
						  }
						  try
			  			{
						myselect.add(new Option("The Royal Caribbean", "3"), myselect.options[0]); 
						myselect.add(new Option("The Royal Mayan", "2"), myselect.options[1]); 
						myselect.add(new Option("The Royal Sands", "5"), myselect.options[2]); 
						myselect.add(new Option("The Royal Cancun", "11"), myselect.options[3]); 
						myselect.add(new Option("The Royal Haciendas", "9"), myselect.options[4]);
						myselect.add(new Option("ALL RESORTS", "0"), myselect.options[5]);
						myselect.add(new Option("The Royal Islander", "4"), myselect.options[6]);
						break 
						}
						
						catch (e)
			  			{
							myselect.add(new Option("The Royal Caribbean", "3"), 0); 
						myselect.add(new Option("The Royal Mayan", "2"), 1); 
						myselect.add(new Option("The Royal Sands", "5"), 2); 
						myselect.add(new Option("The Royal Cancun", "11"), 3); 
						myselect.add(new Option("The Royal Haciendas", "9"), 4);
						myselect.add(new Option("ALL RESORTS", "0"), 5);
						myselect.add(new Option("The Royal Islander", "4"), 6);
						break 
							}
						
						case "4":
						 var i;
						  for (i = myselect.length - 1; i>=0; i--) {
							if (myselect.options[i]) {
							  myselect.remove(i);
							}
						  }
						  try{
						myselect.add(new Option("The Royal Islander", "4"), myselect.options[0]);
						myselect.add(new Option("The Royal Caribbean", "3"), myselect.options[1]); 
						myselect.add(new Option("The Royal Mayan", "2"), myselect.options[2]); 
						myselect.add(new Option("The Royal Sands", "5"), myselect.options[3]); 
						myselect.add(new Option("The Royal Cancun", "11"), myselect.options[4]); 
						myselect.add(new Option("The Royal Haciendas", "9"), myselect.options[5]);
						myselect.add(new Option("ALL RESORTS", "0"), myselect.options[6]);
						break 
						  }
						  
						  catch (e)
			  			{
							myselect.add(new Option("The Royal Islander", "4"), 0);
						myselect.add(new Option("The Royal Caribbean", "3"), 1); 
						myselect.add(new Option("The Royal Mayan", "2"), 2); 
						myselect.add(new Option("The Royal Sands", "5"), 3); 
						myselect.add(new Option("The Royal Cancun", "11"), 4); 
						myselect.add(new Option("The Royal Haciendas", "9"), 5);
						myselect.add(new Option("ALL RESORTS", "0"), 6);
						break 
							}
						  
						case "6":
						 var i;
						  for (i = myselect.length - 1; i>=0; i--) {
							if (myselect.options[i]) {
							  myselect.remove(i);
							}
						  }
							try
							{
								myselect.add(new Option("Simpson Bay Resort & Marina", "6"), myselect.options[0]); 
								myselect.add(new Option("The Villas at Simpson\r\Bay Resort & Marinas", "10"), myselect.options[1]); 
								myselect.add(new Option("ALL RESORTS", "0"), myselect.options[2]);
								break 
							}
							
							catch (e)
							{
								myselect.add(new Option("Simpson Bay Resort & Marina", "6"), 0); 
								myselect.add(new Option("The Villas at Simpson\r\Bay Resort & Marinas", "10"), 1); 
								myselect.add(new Option("ALL RESORTS", "0"),2);
								break
								}
						
						case "10":
						 var i;
						  for (i = myselect.length - 1; i>=0; i--) {
							if (myselect.options[i]) {
							  myselect.remove(i);
							}
						  }
						  try{
							myselect.add(new Option("The Villas at Simpson\r\Bay Resort & Marinas", "10"), myselect.options[0]); 
							myselect.add(new Option("Simpson Bay Resort & Marina", "6"), myselect.options[1]); 
							myselect.add(new Option("ALL RESORTS", "0"), myselect.options[2]);
						break 
						  }
						  
						  catch (e){
							myselect.add(new Option("The Villas at Simpson\r\Bay Resort & Marinas", "10"), 0); 
							myselect.add(new Option("Simpson Bay Resort & Marina", "6"), 1); 
							myselect.add(new Option("ALL RESORTS", "0"), 2);
						break 
						  }
						  
						case "7":
						 var i;
						  for (i = myselect.length - 1; i>=0; i--) {
							if (myselect.options[i]) {
							  myselect.remove(i);
							}
						  }
						  try{
							myselect.add(new Option("The Royal Sea Aquarium", "7"), myselect.options[0]); 
						break 
						  }
						  catch (e){
							myselect.add(new Option("The Royal Sea Aquarium", "7"), 0); 
						break 
						  }
					}
			
				if(third=="" || undefined  || false){
						//si viene vacio debemos asignarle unas fechas
						//aqui reasignamos la fecha de checkout tomando la fecha actual + 2 días y para el checkout 4 días más
						checkInTmp=((checkInTmp.getMonth()+1) + "/" + (checkInTmp.getDate() +1) + "/" + checkInTmp.getFullYear());
						document.booknow.CheckinDate.value=checkInTmp;	
					}
					else{
						//si tiene contenido entonces asignale el valor ke trae al textfield
						document.booknow.CheckinDate.value=third;
					}
				
						
					if(fourth=="" || undefined  || false){
						checkOutTmp=((checkOutTmp.getMonth()+1) + "/" + (checkOutTmp.getDate() +2) + "/" + checkOutTmp.getFullYear());
						document.booknow.CheckoutDate.value=checkOutTmp;
						}
						else {
							//si tiene contenido entonces asignale el valor ke trae al textfield
							document.booknow.CheckoutDate.value=fourth;
							}
							
							
						switch (fifth){						
							default:
							document.booknow.UnitsNum.selectedIndex=0;
							break
							
							case "2": 
							document.booknow.UnitsNum.selectedIndex=1;
							break
							
							case "3":
							document.booknow.UnitsNum.selectedIndex=2;
							break
							
							}	
						
								if(sixth=== undefined){
									document.booknow.CouponCode.value="";
									//alert("EL NUEVO VALOR DE COUPON CODE ES -> "+ document.booknow.CouponCode.value)
									}else {
										document.booknow.CouponCode.value=sixth;
										//alert("EL NUEVO VALOR DE COUPON CODE ES -> "+sixth)
										}
						
						
						
	
}
/*******************************************************************************************************/


/* LEYENDO COOKIES */
function getCookie (name,subvalue) {
		name = name + "=";
		
		var carray = document.cookie.split(';');
 
		for(var i=0;i < carray.length;i++) {
			var c = carray[i];
			while (c.charAt(0)==' ') c = c.substring(1,c.length);
			if (c.indexOf(name) == 0)  return c.substring(name.length,c.length);
		} 
		return null;
	}
	
/*******************************************************************************************************/
$(document).ready(function() {
	 
	//RANGE DATE CODE
	var dates = $( "#CheckinDate, #CheckoutDate" ).datepicker({
	defaultDate: "+1d",
	changeMonth: true,
	changeYear:true,
	numberOfMonths: 1,
	dateFormat: 'mm/dd/yy',
	changeMonth: true,
	showOn: 'button',
	buttonImageOnly: true,
	buttonImage: 'http://www.royalresorts.com/booking-engine/images/calendar.png',
	showAnim: 'slide',
	autosize:false,
	showWeek: false,
		onSelect: function( selectedDate ) {
			var option = this.id == "CheckinDate" ? "minDate" : "maxDate",
				instance = $( this ).data( "datepicker" ),
				date = $.datepicker.parseDate(
					instance.settings.dateFormat ||
					$.datepicker._defaults.dateFormat,
					selectedDate, instance.settings );
			dates.not( this ).datepicker( "option", option, date );
			}
	});
	getParameters();
	
	
	if(document.booknow.CheckinDate.value && third ===undefined ){
		//si viene vacio debemos asignarle unas fechas
		//aqui reasignamos la fecha de checkout tomando la fecha actual + 2 días y para el checkout 4 días más
		checkInTmp=((checkInTmp.getMonth()+1) + "/" + (checkInTmp.getDate() +1) + "/" + checkInTmp.getFullYear());
		document.booknow.CheckinDate.value=checkInTmp;	
		//alert(document.booknow.CheckinDate.value);
		}
		else{
			//document.booknow.CheckinDate.value=third;	
		}
		
	if(document.booknow.CheckoutDate.value && fourth ===undefined){
		checkOutTmp=((checkOutTmp.getMonth()+1) + "/" + (checkOutTmp.getDate() +2) + "/" + checkOutTmp.getFullYear());
			document.booknow.CheckoutDate.value=checkOutTmp;	
		}else{
			document.booknow.CheckoutDate.value=fourth;
			//alert(document.booknow.CheckoutDate.value);
			}
			
		//LEEMOS LAS COOKIES DE LOS AFILIADOS
		//cookieWholeSalerInfo = getCookie("WholesalerPeopleId");
		//cookieWholeSaler = getCookie("WholeSalerYnBanner");
		//valor ynBanner=1PeopleId=1059379
		//cookie1= cookieWholeSaler.split("=");
		//cookie1= cookieWholeSalerInfo.substring(9,cookieWholeSalerInfo.length);
		
		//cookie2 = cookieWholeSaler.substring(9, cookieWholeSaler.length);
		//alert(cookie2);
		
			
		
		//alert("EXTRACCION COOKIES -> "+  "PeopleID -> " +cookie1 + "ynBanner -> " + cookie2)
	
 });


 
 //AUTOMATIC FILL 
 function alertselected(selectobj){
	 	
		myselect=document.getElementById("PropertyID");
		
		//Cancun
		if(selectobj.selectedIndex==1){
			//para eleminar todos los registros
			var i;
			  for (i = myselect.length - 1; i>=0; i--) {
				if (myselect.options[i]) {
				  myselect.remove(i);
				}
			  }
			  
			  try
			  {
			  // for IE earlier than version 8
			  	myselect.add(new Option("ALL RESORTS", "0"), myselect.options[0]);
				myselect.add(new Option("The Royal Haciendas", "9"), myselect.options[1]);
				myselect.add(new Option("The Royal Cancun", "11"), myselect.options[2]); 
				myselect.add(new Option("The Royal Sands", "5"), myselect.options[3]); 
				myselect.add(new Option("The Royal Mayan", "2"), myselect.options[4]); 
				myselect.add(new Option("The Royal Caribbean", "3"), myselect.options[5]); 
				myselect.add(new Option("The Royal Islander", "4"), myselect.options[6]); 
			  }
			catch (e)
			  {
			  myselect.add(new Option("ALL RESORTS", "0"), 0);
				myselect.add(new Option("The Royal Haciendas", "9"), 1);
				myselect.add(new Option("The Royal Cancun", "11"), 2); 
				myselect.add(new Option("The Royal Sands", "5"), 3); 
				myselect.add(new Option("The Royal Mayan", "2"), 4); 
				myselect.add(new Option("The Royal Caribbean", "3"), 5); 
				myselect.add(new Option("The Royal Islander", "4"), 6); 
			  }
			}
			
		
		//St. Maarten
		if(selectobj.selectedIndex==2){
			//para eleminar todos los registros
			  var i;
			  for (i = myselect.length - 1; i>=0; i--) {
				if (myselect.options[i]) {
				  myselect.remove(i);
				}
			  }
				  try{
					myselect.add(new Option("ALL RESORTS", "0"), myselect.options[0]);
					myselect.add(new Option("Simpson Bay Resort & Marina", "6"), myselect.options[1]); 
					myselect.add(new Option("The Villas at Simpson\r\Bay Resort & Marinas", "10"), myselect.options[2]); 
				  }
				  catch(e){
					myselect.add(new Option("ALL RESORTS", "0"), 0);
					myselect.add(new Option("Simpson Bay Resort & Marina", "6"), 1); 
					myselect.add(new Option("The Villas at Simpson\nBay Resort & Marina", "10"), 2); 
				  }
			  }
			
		
		//Curacao
		if(selectobj.selectedIndex==3){
			//para eleminar todos los registros
			  var i;
			  for (i = myselect.length - 1; i>=0; i--) {
				if (myselect.options[i]) {
				  myselect.remove(i);
					}
			  }
			  try{
			 	myselect.add(new Option("The Royal Sea Aquarium", "7"), myselect.options[0]); 
			  }
			  catch(e){
				  myselect.add(new Option("The Royal Sea Aquarium", "7"), 0); 
				  }
			
			}
		
	}
 
 
 //VALIDATIONS
 function checkDate(){
	
	//DESTINATION
	destiny = document.booknow.DestinationID;
	
	//si resulta falso envia alerta
	if(destiny.value=="false" || destiny.length==0){
		alert("Please choose a destination") 
		document.booknow.DestinationID.selectedIndex=1;
      	destiny.focus() 
      	return 0; 
		}
	
		
	
	//RESORTS
	var resorts = document.booknow.PropertyID;
	//si resulta falso envia alerta
	if(resorts.value=="false" || resorts.length==0){
		alert("Please choose a resort") 
      	resorts.focus() 
      	return 0; 
		}
		
	
	//CHECKIN - OUT
	var currentDateCheckIn = document.booknow.CheckinDate.value;
	var currentDateCheckOut = document.booknow.CheckoutDate.value;
	
	if (currentDateCheckIn.length==0){ 
      	 alert("Please choose a Check In date") 
      	 document.booknow.CheckinDate.focus()		 
      	 return 0; 
   	}
	
	if (currentDateCheckOut.length==0){ 
      	 alert("Please choose a Check Out date") 
      	 document.booknow.CheckoutDate.focus() 		 
      	 return 0; 
   	}


	//valido las unidades
   	units = document.booknow.UnitsNum.value 
   	units = validarEntero(units)
	
	
   	document.booknow.UnitsNum.value=units 
   	if (units=="" || 0){ 
      	 alert("Please enter a number between 1 - 3") 
      	 document.booknow.UnitsNum.focus() 
      	 return 0; 
   	}else{ 
      	 if (units>4){ 
         	 alert("The maximum number of units is 3") 
         	 document.booknow.UnitsNum.focus() 
         	 return 0; 
      	 } 
   	} 
	
	
	//HIDDEN FIELDS
	//UNA VEZ QUE LEEMOS LAS COOKIES LAS VAMOS HA ASIGNAR A LOS HIDDEN FIELDS
	//document.booknow.PeopleID.value=cookie1;//cookiePeopleID;
	
	/*if(cookie2==""){
			document.booknow.ynBanner.value="0";
			//alert("EL VALOR ACTUAL DE YNBANNER ES -> "+ document.booknow.ynBanner.value)
			}else{
				document.booknow.ynBanner.value=cookie2;//cookieYNBanner;
				}*/
			
	
	
	//verificamos si viene con algunos de estos valores MBRO / REFERRAL	
	if(sixth=="MBRO" || "REFERRAL"){
		///cuponCode=sixth;
		document.booknow.CouponCode.value=sixth;
		}
		
		if(sixth=== undefined){
			document.booknow.CouponCode.value="";
			//alert("EL NUEVO VALOR DE COUPON CODE ES -> "+ document.booknow.CouponCode.value)
			}
			
		/*if(cookie2=== undefined){
			document.booknow.ynBanner.value="0";
			alert("EL NUEVO VALOR DE YNBANNER ES -> "+ document.booknow.ynBanner.value)
			}*/
			
	//alert("DESTINO="+destiny.value+" RESORT ="+resorts.value+ "CHECK IN = "+currentDateCheckIn+ " CHECK OUT = "+currentDateCheckOut+ " UNITS = "+units+ " PEOPLEID = "+ document.booknow.PeopleID.value+ " YNBANNER = "+ document.booknow.ynBanner.value+ "COUPONCODE = " + document.booknow.CouponCode.value)

   	document.booknow.submit(); 
	
	// INTEGERS VALIDATION -->
	function validarEntero(valor){ 
		  //intento convertir a entero. 
		 //si era un entero no le afecta, si no lo era lo intenta convertir 
		 valor = parseInt(valor) 
	
		  //Compruebo si es un valor numérico 
		  if (isNaN(valor)) { 
				//entonces (no es numero) devuelvo el valor cadena vacia 
				return "" 
		  }else{ 
				//En caso contrario (Si era un número) devuelvo el valor 
				return valor 
		  } 
	}
	
	
	}

