	var xmlHttp;
function swap_deal_panel() {
var deal_type =  document.getElementById("deal_type").value;
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
  document.getElementById("dealy_panel").innerHTML="<br>Loading Please Wait ...<BR>";
var url="http://www.igoski.co.uk/deals_panel_ajax.php?type="+deal_type;
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function stateChanged() 
{ 
if (xmlHttp.readyState==4) { 
	document.getElementById("dealy_panel").innerHTML=xmlHttp.responseText;
}

}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}
//document.getElementsByName

function gohere(where) {
//alert("go_where");
//var flight_var = document.getElementById('flight_var').value;
 var radioResults = 'Radio buttons: ';

// alert(document.getElementsByName("flights").length);
    for (var i = 0; i <document.getElementsByName("flights").length; i++ ) {

            if (document.getElementsByName("flights")[i].checked == true) {
				//alert("Checked")
                radioResults = document.getElementsByName("flights")[i].value + ' ';
            }
    }

radioResults = "&flights="+radioResults;
//alert(radioResults);
//for (var i=0; i < document.create_basket_form.flights.length; i++)
//   {
 //  if (document.create_basket_form.flights[i].checked)
  //    {
  //    var rad_val = document.create_basket_form.flights[i].value;
  //    }
  // }
//alert (rad_val);
//alert("the location" + where);
//return false;
//alert("the location" + where);
window.location = where+radioResults; 
return false; 
}
function gohere2(where) {

hu = window.location.search.substring(1);
window.location = where; 
return false; 
}

Date.prototype.getDayName = function(shortName){
    var Days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
    if (shortName) {
        return Days[this.getDay()].substr(0, 3);
    }
    else {
        return Days[this.getDay()];
    }
}
Date.prototype.getMonthName = function(){
    return ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'][this.getMonth()];
}
function testing2(){
    alert("Please Choose a Departure Date")
}

function Get_type(){
    var self_catered = document.request.board.value;
    removeAllOptions(document.request.hol_type);
    addOption(document.request.hol_type, "Choose", "Please Choose", selected);
    var selected = "";
    if (self_catered == "sc") {
        addOption(document.request.hol_type, "Weeksat", "Week (Sat - Sat)", selected);
    }
    
    addOption(document.request.hol_type, "Week", "Week", selected);
    addOption(document.request.hol_type, "Weekend", "Weekend ", selected);
    addOption(document.request.hol_type, "ShortBreak", "Midweek", selected);
    
}

function testing(){
    //alert("HELLO");
    
    /*need to get the details from the choice of date ie if it = 2 3 5 then we change the start date and the amount to add
     "1", "Wed - Sun"
     "2", "Thur - Sun"
     "3", "Sun - Weds"
     "7", "Sun - Sun"
     date_range_start
     Season = 2 then winter 09-10
     Season = 3 the Summer 10
     */
    var date_zero = "";
    var date_zero2 = "";
    var date_vars = "7";
    var Season = document.request.hol_type.value
    var e = new Date('04/19/2011');
    
    if (Season == "NoChoice") {
        var d = new Date('12/05/2010');
        var f = new Date('12/12/2009');
        var day_add = 7;
    }
    if (Season == "Week") {
        var d = new Date('12/05/2010');
        var f = new Date('12/12/2009');
        var day_add = 7;
    }
    
    if (Season == "Weekend") {
        var d = new Date('12/08/2010');
        var thur = new Date('12/09/2010');
        var f = new Date('12/12/2010');
        var day_add = 7;
    }
    
    if (Season == "ShortBreak") {
        var d = new Date('12/05/2010');
        var f = new Date('12/08/2010');
        var day_add = 7;
    }
    if (Season == "Weeksat") {
        var d = new Date('12/04/2010');
        var f = new Date('12/11/2010');
        var day_add = 7;
    }
    
    
    
    
    var i = e;
    removeAllOptions(document.request.holidate);
    do {
    
        if (Season == "Weekend") {
        
            month = d.getMonthName();
            monthf = f.getMonthName();
            monththur = thur.getMonthName();
            if (d.getDate() < 9) {
                date_zero = "0";
            }
            else {
                date_zero = "";
            }
            if (f.getDate() < 9) {
                date_zero2 = "0";
            }
            else {
                date_zero2 = "";
            }
            if (thur.getDate() < 9) {
                date_zero = "0";
            }
            else {
                date_zero = "";
            }
            var the_date_to_match = d.getDate() + "-" + month + "-" + d.getFullYear()
            var selected = "";
            
            addOption(document.request.holidate, d.getDate() + "-" + month + "-" + d.getFullYear(), date_zero + d.getDate() + " " + month + " - " + date_zero2 + f.getDate() + " " + monthf, selected);
            addOption(document.request.holidate, thur.getDate() + "-" + month + "-" + thur.getFullYear(), date_zero + thur.getDate() + " " + month + " - " + date_zero2 + f.getDate() + " " + monthf, selected);
            d.setDate(d.getDate() + 7);
            f.setDate(f.getDate() + 7);
            thur.setDate(thur.getDate() + 7);
            
        }
        else {
        
        
            month = d.getMonthName();
            monthf = f.getMonthName();
            if (d.getDate() < 9) {
                date_zero = "0";
            }
            else {
                date_zero = "";
            }
            if (f.getDate() < 9) {
                date_zero2 = "0";
            }
            else {
                date_zero2 = "";
            }
            var the_date_to_match = d.getDate() + "-" + month + "-" + d.getFullYear()
            var selected = "";
            addOption(document.request.holidate, d.getDate() + "-" + month + "-" + d.getFullYear(), date_zero + d.getDate() + " " + month + " - " + date_zero2 + f.getDate() + " " + monthf, selected);
            d.setDate(d.getDate() + 7);
            f.setDate(f.getDate() + 7);
        }
        
    }
    while (d < e);
}

function popUp(URL){
    day = new Date();
    id = day.getTime();
    eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=450,height=200,left = 490,top = 312');");
}

/***********************************************
 * Ultimate Fade-In Slideshow (v1.51): � Dynamic Drive (http://www.dynamicdrive.com)
 * This notice MUST stay intact for legal use
 * Visit http://www.dynamicdrive.com/ for this script and 100s more.
 ***********************************************/
var fadeimages = new Array()
//SET IMAGE PATHS. Extend or contract array as needed
/*fadeimages[0] = ["../../images/slideshow/photo09.jpg", "http://www.alpineelements.co.uk/activity-holidays/resort/lake-garda.html", "_new"] //plain image syntax
fadeimages[1] = ["../../images/slideshow/photo07.jpg", "http://www.alpineelements.co.uk/activity-holidays/summer-chalet.html", "_new"]
fadeimages[2] = ["../../images/slideshow/photo03.jpg", "http://www.alpineelements.co.uk/activity-holidays/mountain-biking-france.html", "_new"]
fadeimages[3] = ["../../images/slideshow/photo02.jpg", "http://www.alpineelements.co.uk/activity-holidays/activity-holidays-europe.html", "_new"]
fadeimages[4] = ["../../images/slideshow/photo06.jpg", "http://www.alpineelements.co.uk/activity-holidays/alpine-walking.html", "_new"]
fadeimages[5] = ["../../images/slideshow/photo10.jpg", "http://www.alpineelements.co.uk/activity-holidays/family-activity-holidays.html", "_new"]
fadeimages[6] = ["../../images/slideshow/photo04.jpg", "http://www.alpineelements.co.uk/mountain-biking-holidays/cycling-holidays.html", "_new"]
*/
var fadeimages2 = new Array() //2nd array set example. Remove or add more sets as needed.
//SET IMAGE PATHS. Extend or contract array as needed
/*fadeimages2[0] = ["photo1.jpg", "", ""] //plain image syntax
fadeimages2[1] = ["photo2.jpg", "http://www.cssdrive.com", ""] //image with link syntax
fadeimages2[2] = ["photo3.jpg", "http://www.javascriptkit.com", "_new"] //image with link and target syntax
*/
var fadebgcolor = "white"
var fadearray = new Array() //array to cache fadeshow instances
var fadeclear = new Array() //array to cache corresponding clearinterval pointers
var dom = (document.getElementById) //modern dom browsers
var iebrowser = document.all
function fadeshow(theimages, fadewidth, fadeheight, borderwidth, delay, pause, displayorder){
    this.pausecheck = pause
    this.mouseovercheck = 0
    this.delay = delay
    this.degree = 10 //initial opacity degree (10%)
    this.curimageindex = 0
    this.nextimageindex = 1
    fadearray[fadearray.length] = this
    this.slideshowid = fadearray.length - 1
    this.canvasbase = "canvas" + this.slideshowid
    this.curcanvas = this.canvasbase + "_0"
    if (typeof displayorder != "undefined") 
        theimages.sort(function(){
            return 0.5 - Math.random();
        }) //thanks to Mike (aka Mwinter) :)
    this.theimages = theimages
    this.imageborder = parseInt(borderwidth)
    this.postimages = new Array() //preload images
    for (p = 0; p < theimages.length; p++) {
        this.postimages[p] = new Image()
        this.postimages[p].src = theimages[p][0]
    }
    
    var fadewidth = fadewidth + this.imageborder * 2
    var fadeheight = fadeheight + this.imageborder * 2
    
    if (iebrowser && dom || dom) //if IE5+ or modern browsers (ie: Firefox)
        document.write('<div id="master' + this.slideshowid + '" style="position:relative;width:' + fadewidth + 'px;height:' + fadeheight + 'px;overflow:hidden;"><div id="' + this.canvasbase + '_0" style="position:absolute;width:' + fadewidth + 'px;height:' + fadeheight + 'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);opacity:0.1;-moz-opacity:0.1;-khtml-opacity:0.1;background-color:' + fadebgcolor + '"></div><div id="' + this.canvasbase + '_1" style="position:absolute;width:' + fadewidth + 'px;height:' + fadeheight + 'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);opacity:0.1;-moz-opacity:0.1;-khtml-opacity:0.1;background-color:' + fadebgcolor + '"></div></div>')
    else 
        document.write('<div><img name="defaultslide' + this.slideshowid + '" src="' + this.postimages[0].src + '"></div>')
    
    if (iebrowser && dom || dom) //if IE5+ or modern browsers such as Firefox
        this.startit()
    else {
        this.curimageindex++
        setInterval("fadearray[" + this.slideshowid + "].rotateimage()", this.delay)
    }
}

function fadepic(obj){
    if (obj.degree < 100) {
        obj.degree += 10
        if (obj.tempobj.filters && obj.tempobj.filters[0]) {
            if (typeof obj.tempobj.filters[0].opacity == "number") //if IE6+
                obj.tempobj.filters[0].opacity = obj.degree
            else //else if IE5.5-
                 obj.tempobj.style.filter = "alpha(opacity=" + obj.degree + ")"
        }
        else 
            if (obj.tempobj.style.MozOpacity) 
                obj.tempobj.style.MozOpacity = obj.degree / 101
            else 
                if (obj.tempobj.style.KhtmlOpacity) 
                    obj.tempobj.style.KhtmlOpacity = obj.degree / 100
                else 
                    if (obj.tempobj.style.opacity && !obj.tempobj.filters) 
                        obj.tempobj.style.opacity = obj.degree / 101
    }
    else {
        clearInterval(fadeclear[obj.slideshowid])
        obj.nextcanvas = (obj.curcanvas == obj.canvasbase + "_0") ? obj.canvasbase + "_0" : obj.canvasbase + "_1"
        obj.tempobj = iebrowser ? iebrowser[obj.nextcanvas] : document.getElementById(obj.nextcanvas)
        obj.populateslide(obj.tempobj, obj.nextimageindex)
        obj.nextimageindex = (obj.nextimageindex < obj.postimages.length - 1) ? obj.nextimageindex + 1 : 0
        setTimeout("fadearray[" + obj.slideshowid + "].rotateimage()", obj.delay)
    }
}

fadeshow.prototype.populateslide = function(picobj, picindex){
    var slideHTML = ""
    if (this.theimages[picindex][1] != "") //if associated link exists for image
        slideHTML = '<a href="' + this.theimages[picindex][1] + '" target="' + this.theimages[picindex][2] + '">'
    slideHTML += '<img src="' + this.postimages[picindex].src + '" border="' + this.imageborder + 'px">'
    if (this.theimages[picindex][1] != "") //if associated link exists for image
        slideHTML += '</a>'
    picobj.innerHTML = slideHTML
}
fadeshow.prototype.rotateimage = function(){
    if (this.pausecheck == 1) //if pause onMouseover enabled, cache object
        var cacheobj = this
    if (this.mouseovercheck == 1) 
        setTimeout(function(){
            cacheobj.rotateimage()
        }, 100)
    else 
        if (iebrowser && dom || dom) {
            this.resetit()
            var crossobj = this.tempobj = iebrowser ? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
            crossobj.style.zIndex++
            fadeclear[this.slideshowid] = setInterval("fadepic(fadearray[" + this.slideshowid + "])", 50)
            this.curcanvas = (this.curcanvas == this.canvasbase + "_0") ? this.canvasbase + "_1" : this.canvasbase + "_0"
        }
        else {
            var ns4imgobj = document.images['defaultslide' + this.slideshowid]
            ns4imgobj.src = this.postimages[this.curimageindex].src
        }
    this.curimageindex = (this.curimageindex < this.postimages.length - 1) ? this.curimageindex + 1 : 0
}
fadeshow.prototype.resetit = function(){
    this.degree = 10
    var crossobj = iebrowser ? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
    if (crossobj.filters && crossobj.filters[0]) {
        if (typeof crossobj.filters[0].opacity == "number") //if IE6+
            crossobj.filters(0).opacity = this.degree
        else //else if IE5.5-
             crossobj.style.filter = "alpha(opacity=" + this.degree + ")"
    }
    else 
        if (crossobj.style.MozOpacity) 
            crossobj.style.MozOpacity = this.degree / 101
        else 
            if (crossobj.style.KhtmlOpacity) 
                crossobj.style.KhtmlOpacity = this.degree / 100
            else 
                if (crossobj.style.opacity && !crossobj.filters) 
                    crossobj.style.opacity = this.degree / 101
}
fadeshow.prototype.startit = function(){
    var crossobj = iebrowser ? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
    this.populateslide(crossobj, this.curimageindex)
    if (this.pausecheck == 1) { //IF SLIDESHOW SHOULD PAUSE ONMOUSEOVER
        var cacheobj = this
        var crossobjcontainer = iebrowser ? iebrowser["master" + this.slideshowid] : document.getElementById("master" + this.slideshowid)
        crossobjcontainer.onmouseover = function(){
            cacheobj.mouseovercheck = 1
        }
        crossobjcontainer.onmouseout = function(){
            cacheobj.mouseovercheck = 0
        }
    }
    this.rotateimage()
}
function loadImages(){
    if (document.getElementById) { // DOM3 = IE5, NS6
        document.getElementById('hidepage').style.visibility = 'hidden';
    }
    else {
        if (document.layers) { // Netscape 4
            document.hidepage.visibility = 'hidden';
        }
        else { // IE 4
            document.all.hidepage.style.visibility = 'hidden';
        }
    }
}

function checkformPax(form){

    var email = document.finalForm.txtEmail.value;
    var emailconf = document.finalForm.txtEmailconf.value;
    var phone = document.finalForm.txtPhone.value;
    var mobile = document.finalForm.txtMobile.value;
    
    // ** THERE NEEDS TO BE AT LEAST 1 THing here so that we can contact themSTART **
    
    if (email != emailconf) {
        alert("emails do not match")
        return false;
    }
    if (phone == "" && mobile == "") {
        alert("Please Enter a contact Number")
        return false;
    }
    
    //alert email;
    return true;
    
    
}

function checkform(form){
    //	var duration=form.duration.options[form.duration.options.selectedIndex].value;
    var val = form.date_range_start.options[form.date_range_start.options.selectedIndex].value;
    var dates = form.date_range.options[form.date_range.options.selectedIndex].value;
    var destination = form.destination.options[form.destination.options.selectedIndex].value;
    var resort = form.resort.options[form.resort.options.selectedIndex].value;
	 var adults = form.no_adults.options[form.no_adults.options.selectedIndex].value;
	 var children = form.no_children.options[form.no_children.options.selectedIndex].value;
    var group = form.no_adults.options[form.no_adults.options.selectedIndex].value;
    var dep_airport = form.dep_airport.options[form.dep_airport.options.selectedIndex].value;

	group =   (adults * 1) + (children * 1) ;
    // see http://www.thesitewizard.com/archive/validation.shtml
    // for an explanation of this script and how to use it on your
    // own website
    
    // ** START **
    var groups = (form.no_adults.options[form.no_adults.options.selectedIndex].value * 1);
    // alert(tots);

    // see http://www.thesitewizard.com/archive/validation.shtml
    // for an explanation of this script and how to use it on your
    // own website
    
    //now need to check if less than six weeks if so then dothis check else do 
    //CREATE MY VARS
    var ser_date_split = dates.split("+");
    var searchDate = new Date(ser_date_split[0] + "," + ser_date_split[1] + "," + ser_date_split[2]);
    
    //alert(ser_date_split[0]+","+ser_date_split[1]+","+ser_date_split[2])
    //searchDate.setFullYear(ser_date_split[0]+","+ser_date_split[1]+","+ser_date_split[2]);
    //new searchDate(ser_date_split[0]+","+ser_date_split[1]+","+ser_date_split[2]);
    //var myDate2 = new Date(the_string_date);
    var today = new Date();
	var weeks_left = ((searchDate - today)/(1000*60*60*24));
  //  alert(weeks_left)
    if (weeks_left < 45) {
       
	   
    }   else {
   var shit_check = check_pax_allocation(destination, groups);
    if (shit_check != true) {
        if (shit_check != undefined) {
            SelectPaxs2(shit_check[3], shit_check[2]);
            //alert(shit_check[3] +" --" + shit_check[2]);
            form.no_adults.focus();
            return false;
        }
        
    }
      }
    if (resort == 0) {
        alert("No Resort selected");
        form.resort.focus();
        return false;
    }
    
    if (val == 0) {
        alert("Select a Departure Day.");
        form.date_range_start.focus();
        return false;
    }
    if (dates == "") {
        alert("No Dates selected");
        form.date_range.focus();
        return false;
    }
    
    if (destination == 0) {
        alert("No Destination");
        form.destination.focus();
        return false;
    }
    
    if (dep_airport == 0) {
        alert("No Airport");
        form.dep_airport.focus();
        return false;
    }
    
    if (resort == "meribel" && group < 4 && val != 7) {
		if (resort == "meribel" && group < 4 && val != 5) {
        alert("Groups of less than 4 passengers cannot book Meribel Chalets...");
	    removeAllOptions(document.form.no_adults);
      
        addOption(document.form.no_adults, "2", "2");
        addOption(document.form.no_adults, "3", "3");
        addOption(document.form.no_adults, "4", "4");
        addOption(document.form.no_adults, "5", "5");
        addOption(document.form.no_adults, "6", "6");
        addOption(document.form.no_adults, "7", "7");
        addOption(document.form.no_adults, "8", "8");
        addOption(document.form.no_adults, "9", "9");
        addOption(document.form.no_adults, "11", "11");
        addOption(document.form.no_adults, "12", "12");
        addOption(document.form.no_adults, "13", "13");
        addOption(document.form.no_adults, "14", "14");
        addOption(document.form.no_adults, "15", "15");
        addOption(document.form.no_adults, "16", "16");
        addOption(document.form.no_adults, "17", "17");
        addOption(document.form.no_adults, "18", "18");
        addOption(document.form.no_adults, "19", "19");
        addOption(document.form.no_adults, "20", "20");
		  addOption(document.form.no_adults, "4", "4");
        form.destination.focus();
		//alert("Please choose your number of passengers");
        return false;
		}
    }
    
    if (destination == "HOT0000484" && group < 10) {
			if (weeks_left > 45) {
		    alert("Chalet Marcelle has a minimum requirement of 10 Passengers");
			removeAllOptions(document.form.no_adults);
			addOption(document.form.no_adults, "10", "10");
			addOption(document.form.no_adults, "2", "2");
			addOption(document.form.no_adults, "3", "3");
			addOption(document.form.no_adults, "4", "4");
			addOption(document.form.no_adults, "5", "5");
			addOption(document.form.no_adults, "6", "6");
			addOption(document.form.no_adults, "7", "7");
			addOption(document.form.no_adults, "8", "8");
			addOption(document.form.no_adults, "9", "9");
			addOption(document.form.no_adults, "11", "11");
			addOption(document.form.no_adults, "12", "12");
			addOption(document.form.no_adults, "13", "13");
			addOption(document.form.no_adults, "14", "14");
			addOption(document.form.no_adults, "15", "15");
			addOption(document.form.no_adults, "16", "16");
			addOption(document.form.no_adults, "17", "17");
			addOption(document.form.no_adults, "18", "18");
			addOption(document.form.no_adults, "19", "19");
			addOption(document.form.no_adults, "20", "20");
			form.destination.focus();
			return false;
		}
    }
    
    if (destination == "HOT0000534" && group < 10) {
		if (weeks_left > 45) {
	        alert("Chalet Marcelle has a minimum requirement of 10 Passengers");
			removeAllOptions(document.form.no_adults);
			addOption(document.form.no_adults, "10", "10");
			addOption(document.form.no_adults, "2", "2");
			addOption(document.form.no_adults, "3", "3");
			addOption(document.form.no_adults, "4", "4");
			addOption(document.form.no_adults, "5", "5");
			addOption(document.form.no_adults, "6", "6");
			addOption(document.form.no_adults, "7", "7");
			addOption(document.form.no_adults, "8", "8");
			addOption(document.form.no_adults, "9", "9");
			addOption(document.form.no_adults, "11", "11");
			addOption(document.form.no_adults, "12", "12");
			addOption(document.form.no_adults, "13", "13");
			addOption(document.form.no_adults, "14", "14");
			addOption(document.form.no_adults, "15", "15");
			addOption(document.form.no_adults, "16", "16");
			addOption(document.form.no_adults, "17", "17");
			addOption(document.form.no_adults, "18", "18");
			addOption(document.form.no_adults, "19", "19");
			addOption(document.form.no_adults, "20", "20");
			form.destination.focus();
			return false;
		}
    }
    
    if ((destination == "HOT0000487" && group < 12) || (destination == "HOT0000527" && group < 12)) {
        if (val == 7) {
        }
        else {
			if (weeks_left > 45) {
				alert("Chalet Papy has a minimum requirement of 12 Passengers ");
				removeAllOptions(document.form.no_adults);
				addOption(document.form.no_adults, "12", "12");
				addOption(document.form.no_adults, "2", "2");
				addOption(document.form.no_adults, "3", "3");
				addOption(document.form.no_adults, "4", "4");
				addOption(document.form.no_adults, "5", "5");
				addOption(document.form.no_adults, "6", "6");
				addOption(document.form.no_adults, "7", "7");
				addOption(document.form.no_adults, "8", "8");
				addOption(document.form.no_adults, "9", "9");
				addOption(document.form.no_adults, "11", "11");
				addOption(document.form.no_adults, "12", "12");
				addOption(document.form.no_adults, "13", "13");
				addOption(document.form.no_adults, "14", "14");
				addOption(document.form.no_adults, "15", "15");
				addOption(document.form.no_adults, "16", "16");
				addOption(document.form.no_adults, "17", "17");
				addOption(document.form.no_adults, "18", "18");
				addOption(document.form.no_adults, "19", "19");
				addOption(document.form.no_adults, "20", "20");
				form.destination.focus();
				return false;
			}
        }
    }
    
    if ((destination == "HOT0000486" && group < 14) || (destination == "HOT0000539" && group < 12)) {
    
        if (val == 7) {

        }else {
			
			if (weeks_left > 45) {
		
			alert("Chalet Nyon has a minimum requirement of 14 Passengers");
			removeAllOptions(document.form.no_adults);
			addOption(document.form.no_adults, "14", "14");
			addOption(document.form.no_adults, "2", "2");
			addOption(document.form.no_adults, "3", "3");
			addOption(document.form.no_adults, "4", "4");
			addOption(document.form.no_adults, "5", "5");
			addOption(document.form.no_adults, "6", "6");
			addOption(document.form.no_adults, "7", "7");
			addOption(document.form.no_adults, "8", "8");
			addOption(document.form.no_adults, "9", "9");
			addOption(document.form.no_adults, "11", "11");
			addOption(document.form.no_adults, "12", "12");
			addOption(document.form.no_adults, "13", "13");
			addOption(document.form.no_adults, "14", "14");
			addOption(document.form.no_adults, "15", "15");
			addOption(document.form.no_adults, "16", "16");
			addOption(document.form.no_adults, "17", "17");
			addOption(document.form.no_adults, "18", "18");
			addOption(document.form.no_adults, "19", "19");
			addOption(document.form.no_adults, "20", "20");
			form.destination.focus();
			return false;
		}
        }
    }
  form.action ="http://www.igoski.co.uk/booking.html";  
    if (val=="7")
    {

				if (confirm("You have selected a weekly holiday.\n We are going to redirect you to our sister company \n Alpine Elements LTD")) {
				form.action ="http://www.alpineelements.co.uk/activity-holidays-search/booking.php"; 
				} else {
				return false;
				} 

    } else {
    return true;
    }
    
}

function CurrencyFormatted(amount){
    var i = parseFloat(amount);
    if (isNaN(i)) {
        i = 0.00;
    }
    var minus = '';
    if (i < 0) {
        minus = '-';
    }
    i = Math.abs(i);
    i = parseInt((i + .005) * 100);
    i = i / 100;
    s = new String(i);
    if (s.indexOf('.') < 0) {
        s += '.00';
    }
    if (s.indexOf('.') == (s.length - 2)) {
        s += '0';
    }
    s = minus + s;
    return s;
}

function checkform1(form){
    var roomcost = document.create_basket_form.roomcosts.value;
    //single BED
    if (document.create_basket_form.single_drop) {
        var single_value = document.create_basket_form.single_drop.options[document.create_basket_form.single_drop.options.selectedIndex].value;
        var single_num = parseInt(single_value);
        var single_rooms = (single_num * 1);
        var single_cost = (roomcost * single_rooms);
        document.getElementById('total_single').innerHTML = "&pound;" + CurrencyFormatted(single_cost);
        //	need to write the innerhtml here so that we can get the price per room
        //	alert (single_rooms + "single Beds");
    }
    else {
        var single_value = "";
        var single_rooms = 0;
        var single_cost = 0;
    }
    
    //Double Bed	
    if (document.create_basket_form.double_drop) {
        var double_value = document.create_basket_form.double_drop.options[document.create_basket_form.double_drop.options.selectedIndex].value;
        var double_num = parseInt(double_value);
        var double_rooms = (double_num * 2);
        var double_cost = (roomcost * double_rooms);
        document.getElementById('total_double').innerHTML = "&pound;" + CurrencyFormatted(double_cost);
        //alert (double_rooms + "Double Beds");
    }
    else {
        var double_cost = 0;
        var double_value = "";
        var double_rooms = 0;
    }
    
    //Twin Bed
    if (document.create_basket_form.twin_drop) {
        var twin_value = document.create_basket_form.twin_drop.options[document.create_basket_form.twin_drop.options.selectedIndex].value;
        var twin_num = parseInt(twin_value);
        var twin_rooms = (twin_num * 2);
        var twin_cost = (roomcost * twin_rooms);
        document.getElementById('total_twin').innerHTML = "&pound;" + CurrencyFormatted(twin_cost);
        
        //alert (twin_rooms + "Twin beds");
    }
    else {
        var twin_value = "";
        var twin_rooms = 0;
        var twin_cost = 0;
    }
    
    //Triple Bed
    if (document.create_basket_form.triple_drop) {
        var triple_value = document.create_basket_form.triple_drop.options[document.create_basket_form.triple_drop.options.selectedIndex].value;
        var trip_num = parseInt(triple_value);
        var triple_rooms = (trip_num * 3);
        var triple_cost = (roomcost * triple_rooms);
        document.getElementById('total_triple').innerHTML = "&pound;" + CurrencyFormatted(triple_cost);
        //alert (triple_rooms + "Triple beds");
    }
    else {
        var triple_value = "";
        var triple_rooms = 0;
        var triple_cost = 0;
    }
    
    //Quad Bed
    if (document.create_basket_form.quad_drop) {
        var quad_value = document.create_basket_form.quad_drop.options[document.create_basket_form.quad_drop.options.selectedIndex].value;
        var quad_num = parseInt(quad_value)
        var quad_rooms = (quad_num * 4);
        var quad_cost = (roomcost * quad_rooms);
        document.getElementById('total_quad').innerHTML = "&pound;" + CurrencyFormatted(quad_cost);
        //alert (quad_rooms + "Quad Beds");
    }
    else {
        var quad_value = "";
        var quad_rooms = 0;
        var quad_cost = 0;
    }
    // see http://www.thesitewizard.com/archive/validation.shtml
    // for an explanation of this script and how to use it on your
    // own website
    // ** START **
    //we first get the value of the number of adults and make sure that this is the same as the number of beds allocated 
    //if (duration == 0) {
    //alert( "Please Select Duration." );
    // form.duration.focus();
    //  return false ;
    // }
    //now need to add all the numbers together
    var total_beds = (single_rooms + twin_rooms + double_rooms + triple_rooms + quad_rooms);
    var no_adults = getQuerystring('no_adults');
    var total_cost = (single_cost + twin_cost + double_cost + triple_cost + quad_cost);
    //document.getElementById('holiday_total').innerHTML = "&pound;"+total_cost;
    if (total_beds === 0) {
        // alert("Please choose your rooms");
        document.getElementById('room_selection').innerHTML = "Please Choose you rooms";
        return false;
    }
    // alert(no_adults + "Adults");
    //alert(total_beds + "Beds");
    if (no_adults > total_beds) {
        // alert("You have not selected enough accomodation");
        document.getElementById('room_selection').innerHTML = "<font color='red'>You have not selected enough accomodation</font>";
        return false;
    }
    if (no_adults < total_beds) {
        // alert("You have selected to much accomodation");
        document.getElementById('room_selection').innerHTML = "<font color='red'>You have selected too much accomodation</font>";
        return false;
    }
    
    if (no_adults === total_beds) {
        //alert("correct amount");
        
        return true;
    }
    document.getElementById('room_selection').innerHTML = "<font color='green'>You have selected the correct amount</font>";
    return true;
}

function getQuerystring(key, default_){
    if (default_ == null) 
        default_ = "";
    key = key.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
    var regex = new RegExp("[\\?&]" + key + "=([^&#]*)");
    var qs = regex.exec(window.location.href);
    if (qs == null) 
        return default_;
    else 
        return qs[1];
}

function reload(form){
    //alert( "No Airport" );
    var url = window.location.href;
    var nohttp = url.split('//')[1];
    //alert("ELPWsdfsdf");
    //var hostPort = nohttp.split('/')[0];
    //alert(hostPort);
    var hostPort = nohttp.split('/')[1];
    var hostPort1 = hostPort.split('?')[0];
    //alert("hp1"+hostPort1);
    //var hostPort2 = hostPort1.split('?')[0];
    //alert("hp"+hostPort2);
    
    //var duration=form.duration.options[form.duration.options.selectedIndex].value;
    var dates = form.date_range.options[form.date_range.options.selectedIndex].value;
    var group = form.no_adults.options[form.no_adults.options.selectedIndex].value;
    var val = form.date_range_start.options[form.date_range_start.options.selectedIndex].value;
    var destination = form.destination.options[form.destination.options.selectedIndex].value;
    var dep_airport = form.dep_airport.options[form.dep_airport.options.selectedIndex].value;
    var resort = form.resort.options[form.resort.options.selectedIndex].value;
    
    if (group > 7) {
        //alert('index.php?url=group_bookings&date_range_start=' + val + '&no_adults=' + group + '&date_range=' + dates + '&destination=' + destination;);
        alert("Bookings over 8 please contact us on 0844 770 4070");
        return false;
        //self.location= 'index.php?url=group_bookings&date_range_start=' + val + '&no_adults=' + group + '&date_range=' + dates + '&destination=' + destination + '&dep_airport=' + dep_airport;
    }
    else {
        //alert("Norma");
        //			self.location= hostPort1 + '?duration=' + duration +'&date_range_start=' + val + '&no_adults=' + group + '&date_range=' + dates + '&destination=' + destination + '&dep_airport=' + dep_airport;
        self.location = 'http://www.alpineelements.co.uk/ski-weekend-deals/booking.php?duration=2&date_range_start=' + val + '&no_adults=' + group + '&date_range=' + dates + '&resort=' + resort + '&destination=' + destination + '&dep_airport=' + dep_airport;
    }
}

function anyCheck(form){

    var total = 0;
    
    var no_adults = getQuerystring('no_adults');
  

// alert(document.getElementsByName("flights").length);
    for (var i = 0; i <document.getElementsByName("flights").length; i++ ) {

            if (document.getElementsByName("flights")[i].checked == true) {
				//alert("Checked")
                radioResults = document.getElementsByName("flights")[i].value + ' ';
            }
    }

    //alert(oForm1Element.value);
    if (document.getElementsByName("single_drop")) {
        var singles = document.getElementsByName("single_drop").length;
        if (singles === undefined) {
            if (document.getElementsByName("single_drop").checked == true) {
                total += 1;
            }
        }
        
        for (var idx = 0; idx < singles; idx++) {
            if (document.getElementsByName("single_drop")[idx].checked == true) {
                total += 1;
            }
        }
    }


    if (document.getElementsByName("double_drop")) {
        var doubles = document.getElementsByName("double_drop").length;
        if (doubles === undefined) {
            if (document.getElementsByName("double_drop").checked == true) {
                total += 2;
            }
        }
        for (var idx = 0; idx < doubles; idx++) {
            if (document.getElementsByName("double_drop")[idx].checked == true) {
                total += 2;
            }
        }

    }
    
    if (document.getElementsByName("twin_drop")) {
        var twins = document.getElementsByName("twin_drop").length;
        if (twins === undefined) {
            if (document.getElementsByName("twin_drop").checked == true) {
                total += 2;
            }
        }
        for (var idx = 0; idx < twins; idx++) {
            if (document.getElementsByName("twin_drop")[idx].checked == true) {
                total += 2;
            }
        }
    }
    
    if (document.getElementsByName("triple_drop")) {
        var triples = document.getElementsByName("triple_drop").length;
        if (triples === undefined) {
            if (document.getElementsByName("triple_drop").checked == true) {
                total += 3;
            }
        }
        for (var idx = 0; idx < triples; idx++) {
            if (document.getElementsByName("triple_drop")[idx].checked == true) {
                total += 3;
            }
        }
    }
    
    if (document.getElementsByName("quad_drop")) {
        var quads = document.getElementsByName("quad_drop").length;
        if (quads === undefined) {
            if (document.getElementsByName("quad_drop").checked == true) {
                total += 4;
            }
        }
        for (var idx = 0; idx < quads; idx++) {
            if (document.getElementsByName("quad_drop")[idx].checked == true) {
                total += 4;
            }
        }
    }
    
    if (document.getElementsByName("chalet_drop")) {
        var chalet = document.getElementsByName("chalet_drop").length;
        if (chalet === undefined) {
            if (document.getElementsByName("chalet_drop").checked == true) {
                var testmychalet = document.getElementsByName("chalet_drop").value;
                //need to find out the value of the chalet details
                //	alert(testmychalet);
                /*
                 * need to check here whether or not they are
                 * in between the min max range for the chalet
                 * 1. get the value of the min masx from the value of the drop
                 * 2. then see if the
                 */
                var min_max_passenger = testmychalet.split("*");
                //alert(mySplitDestination[4]);
                min_paxs = min_max_passenger[3];
                max_paxs = min_max_passenger[4];
             //   alert("min - "+min_paxs+"  - Max Paxs = "+max_paxs+ "Search Paxs ="+no_adults);
                no_adults = min_paxs;
                if (no_adults >= min_paxs && no_adults <= max_paxs) {
                    //	alert("in the middle");
                    total += no_adults;
                    alert(total);
                    total = no_adults;
                }
                else {
                    total += min_paxs;
                }
                
                
            }
        }
        for (var idx = 0; idx < chalet; idx++) {
            if (document.getElementsByName("chalet_drop")[idx].checked == true) {
                total += 10;
               // alert(document.create_basket_form.chalet_drop[" + idx + "].value);
            }
            
        }
    }
    var dates= URLDecode(querySt("date_range"));
	//alert(dates);
     var ser_date_split = dates.split("+");
    var searchDate = new Date(ser_date_split[0] + "," + ser_date_split[1] + "," + ser_date_split[2]);
    
    //alert(ser_date_split[0]+","+ser_date_split[1]+","+ser_date_split[2])
    //searchDate.setFullYear(ser_date_split[0]+","+ser_date_split[1]+","+ser_date_split[2]);
    //new searchDate(ser_date_split[0]+","+ser_date_split[1]+","+ser_date_split[2]);
    //var myDate2 = new Date(the_string_date);
    var today = new Date();
	var weeks_left = ((searchDate - today)/(1000*60*60*24));


    // var total_beds = (single_rooms + twin_rooms + double_rooms + triple_rooms + quad_rooms);
    
    // var total_cost = (single_cost + twin_cost + double_cost + triple_cost + quad_cost);
    //document.getElementById('holiday_total').innerHTML = "&pound;"+total_cost;
    if (total === 0) {
        alert("Please choose your rooms");
        document.getElementById('room_selection').innerHTML = "Please Choose you rooms";
        return false;
    }
        if (weeks_left > 45) {
    if (no_adults > total) {
        alert("You have not selected enough accomodation");
        document.getElementById('room_selection').innerHTML = "<font color='red'>You have not selected enough accomodation</font>";
        return false;
    }
    
    if (no_adults < total) {
        alert("You have selected to much accomodation");
        document.getElementById('room_selection').innerHTML = "<font color='red'>You have selected too much accomodation</font>";
        return false;
    }
		}
    
    if (no_adults === total) {
        //alert("correct amount");
        return true;
    }

}

function destinationxx(a){
   //alert("The destination is"+a);
   document.getElementById('destination').innerHTML = "<INPUT TYPE=hidden NAME=destination id=destination value=" + a + ">";
    //need to split the string javascript
    //HOT0000486*679*Chalet_Nyon*morzine*12
    var mySplitResults = a.split("*");
    document.create_basket_form.no_adults.value = mySplitResults[4];
    
    return false;
}

function check_pax_allocation(hotel_code, paxs){
    //alert(hotel_code + paxs);
    
    /*
     [0] Resort,
     [1] Chalet Name
     [2] STD Occ
     [3] Min Occ
     [4] Max oCC
     [5] Free Beds
     [6] Hcode
     [7] MW Code
     [8] Start Date
     [9] End date
     */
    //(ae_min, igo_min, hcode, max_occ)
    var Chalets_Array = new Array("2*2*cheapest-hotel*54", "2*2*all_chamonix*20", "2*2*all_la_plagne*15", "2*2*all_les_arcs*14", "2*2*all_les_gets*20", "2*2*all_meribel*20", "2*2*all_tignes*20", "2*2*all_morzine*20", "2*2*all_val_disere*20", "2*2*all_val_thorens*18", "2*2*HOT0000458*20", "2*2*HOT0000459*54", "8*2*HOT0000460*8", "10*2*HOT0000462*10", "4*2*HOT0000470*4", "4*2*HOT0000471*4", "6*2*HOT0000472*6", "6*2*HOT0000473*6", "6*2*HOT0000474*6", "6*2*HOT0000475*6", "8*2*HOT0000477*8", "8*2*HOT0000478*8", "10*2*HOT0000479*10", "12*2*HOT0000480*12", "14*2*HOT0000481*14", "2*2*HOT0000482*12", "2*2*HOT0000483*15", "10*10*HOT0000484*12", "2*4*HOT0000485*24", "4*14*HOT0000486*14", "12*12*HOT0000487*12", "2*2*HOT0000488*18", "16*2*HOT0000489*16", "2*2*HOT0000500*30", "8*8*HOT0000504*8", "2*2*HOT0000505*21", "2*2*HOT0000515*53", "12*2*HOT0000516*12", "8*2*HOT0000517*8", "2*2*HOT0000518*21", "10*2*HOT0000519*10", "12*2*HOT0000520*12", "2*2*HOT0000521*12", "2*2*HOT0000522*17", "2*2*HOT0000529*10", "2*2*HOT0000530*23", "2*2*HOT0000531*16", "12*2*HOT0000466*12", "10*2*HOT0000464*10", "10*2*HOT0000463*10", "2*2*HOT0000541*29", "2*2*HOT0000495*24", "12*2*HOT0000545*12", "2*2*HOT0000465*16", "10*2*HOT0000490*10");
    var chalet_array_final = new Array();
chalet_array_final[0] = 'chamonix,Apartments La Ginabelle,2,2,8,0,0,HOT0000611,MWCODE,0,01/01/1900,01/01/1900,1,SAT,1,WECODE'
chalet_array_final[1] = 'chamonix,Chalet BDN,4,4,8,2,0,HOT0000504,HOT0000533,2,01/01/1900,01/01/1900,0,SUN,0,HOT0000504'
chalet_array_final[2] = 'chamonix,Combined H BDN C BDN,28,26,28,2,0,HOT0000553,MWCODE,0,01/01/1900,01/01/1900,0,SUN,0,WECODE'
chalet_array_final[3] = 'chamonix,Hotel Bdn,2,2,20,0,0,HOT0000458,HOT0000528,2,05/11/2006,29/04/2007,0,SUN,0,HOT0000458'
chalet_array_final[4] = 'courchevel,Apartments Les Chalets du Forum,3,3,10,0,0,HOT0000614,MWCODE,0,01/01/1900,01/01/1900,1,SAT,1,WECODE'
chalet_array_final[5] = 'garda,Hotel Caravel,2,2,30,0,0,HOT0000560,MWCODE,1,01/01/1900,01/01/1900,0,SAT,0,WECODE'
chalet_array_final[6] = 'garda,Hotel Christallo,2,2,50,0,0,HOT0000590,MWCODE,1,01/01/1900,01/01/1900,0,SAT,0,WECODE'
chalet_array_final[7] = 'garda,Hotel Excelsior Bay,2,2,60,0,0,HOT0000589,MWCODE,1,01/01/1900,01/01/1900,0,SAT,0,WECODE'
chalet_array_final[8] = 'garda,Hotel Holiday,2,2,40,0,0,HOT0000593,MWCODE,1,01/01/1900,01/01/1900,0,SAT,0,WECODE'
chalet_array_final[9] = 'garda,Hotel Laura Christina,2,2,40,0,0,HOT0000591,MWCODE,1,01/01/1900,01/01/1900,0,SAT,0,WECODE'
chalet_array_final[10] = 'garda,Hotel Lido Blu,2,2,40,0,0,HOT0000523,MWCODE,1,01/01/1900,01/01/1900,0,SAT,0,WECODE'
chalet_array_final[11] = 'garda,Hotel Paradiso,2,2,10,0,0,HOT0000561,MWCODE,1,01/01/1900,01/01/1900,0,SAT,0,WECODE'
chalet_array_final[12] = 'garda,Hotel Sailing,2,2,10,0,0,HOT0000592,MWCODE,1,01/01/1900,01/01/1900,0,SAT,0,WECODE'
chalet_array_final[13] = 'garda,Hotel Santoni,2,2,10,0,0,HOT0000525,MWCODE,1,01/01/1900,01/01/1900,0,SAT,0,WECODE'
chalet_array_final[14] = 'garda,Hotel Sole,2,2,10,0,0,HOT0000559,MWCODE,1,01/01/1900,01/01/1900,0,SAT,0,WECODE'
chalet_array_final[15] = 'la_plagne,Apartments Le Quartz,8,2,8,0,0,HOT0000626,MWCODE,0,01/01/1900,01/01/1900,1,SAT,1,WECODE'
chalet_array_final[16] = 'la_plagne,Apartments Les Hauts Bois,4,4,10,0,0,HOT0000618,MWCODE,0,01/01/1900,01/01/1900,1,SAT,1,WECODE'
chalet_array_final[17] = 'la_plagne,Chalet Colette,12,2,12,0,0,HOT0000521,MWCODE,0,01/01/1900,01/01/1900,0,SUN,0,WECODE'
chalet_array_final[18] = 'la_plagne,Chalet Hannah,12,2,12,0,0,HOT0000520,MWCODE,0,01/01/1900,01/01/1900,0,SUN,0,WECODE'
chalet_array_final[19] = 'la_plagne,Chalet Jasmine,8,6,8,2,0,HOT0000517,MWCODE,0,01/01/1900,01/01/1900,0,SUN,0,WECODE'
chalet_array_final[20] = 'la_plagne,Chalet Michelle,12,10,12,2,0,HOT0000516,MWCODE,0,01/01/1900,01/01/1900,0,SUN,0,WECODE'
chalet_array_final[21] = 'la_plagne,Combined Collette Hannah,24,20,24,4,0,HOT0000555,MWCODE,0,01/01/1900,01/01/1900,0,SUN,0,WECODE'
chalet_array_final[22] = 'les_arcs,Apartments Les Alpages de Chantel,2,2,9,0,0,HOT0000608,MWCODE,0,01/01/1900,01/01/1900,1,SAT,1,WECODE'
chalet_array_final[23] = 'les_arcs,Chalet Christabelle (Des Neiges),8,0,0,0,0,HOT0000477,MWCODE,0,01/01/1900,01/01/1900,0,SUN,0,WECODE'
chalet_array_final[24] = 'les_arcs,Chalet Ermine,4,4,10,0,0,HOT0000550,HOT0000613,0,01/01/1900,01/01/1900,0,SUN,0,HOT0000611'
chalet_array_final[25] = 'les_arcs,Chalet Etoile (Des Neiges),4,4,15,0,0,HOT0000483,HOT0000614,0,01/01/1900,01/01/1900,0,SUN,0,HOT0000612'
chalet_array_final[26] = 'les_arcs,Chalet Genepi (Des Neiges),4,4,8,2,0,HOT0000478,MWCODE,0,16/12/2006,15/04/2007,0,SUN,0,WECODE'
chalet_array_final[27] = 'les_arcs,Chalet Haute Neiges (Des Neiges),4,4,12,0,0,HOT0000482,HOT0000619,0,16/12/2006,15/04/2007,0,SUN,0,HOT0000618'
chalet_array_final[28] = 'les_arcs,Chalet Karakorum,10,2,10,0,0,HOT0000628,HOT0000617,0,01/01/1900,01/01/1900,0,SUN,0,HOT0000616'
chalet_array_final[29] = 'les_arcs,Chalet Monterosa (Des Neiges),4,4,10,2,0,HOT0000479,MWCODE,0,16/12/2006,15/04/2007,0,SUN,0,WECODE'
chalet_array_final[30] = 'les_deux_alpes,Hotel Genepi,2,2,40,0,0,HOT0000586,MWCODE,2,01/01/1900,01/01/1900,0,SUN,0,WECODE'
chalet_array_final[31] = 'les_gets,Chalet Seigneurie,16,14,16,2,0,HOT0000489,HOT0000540,0,16/12/2006,15/04/2007,0,SUN,0,HOT0000489'
chalet_array_final[32] = 'les_gets,Hotel Alpen Sport,2,2,6,0,0,HOT0000630,MWCODE,0,01/01/1900,01/01/1900,1,SAT,0,WECODE'
chalet_array_final[33] = 'les_gets,Hotel Chamois,2,2,60,0,0,HOT0000459,HOT0000526,2,16/12/2006,15/04/2007,0,SUN,0,HOT0000459'
chalet_array_final[34] = 'les_gets,Hotel Christiania,2,2,51,0,0,HOT0000515,MWCODE,1,01/01/1900,01/01/1900,0,SUN,0,WECODE'
chalet_array_final[35] = 'les_gets,Hotel L\u0027ours Blanc,2,2,44,0,0,HOT0000538,MWCODE,2,01/01/1900,01/01/1900,0,SAT,1,WECODE'
chalet_array_final[36] = 'les_menuires,Apartments Les Alpages De Reberty,2,2,10,0,0,HOT0000619,MWCODE,0,01/01/1900,01/01/1900,1,SAT,1,WECODE'
chalet_array_final[37] = 'mayrhofen,Hotel Brucke,2,2,30,0,0,HOT0000600,MWCODE,1,01/01/1900,01/01/1900,0,SAT,0,WECODE'
chalet_array_final[38] = 'mayrhofen,Hotel Garni Strass,2,2,60,0,0,HOT0000599,MWCODE,1,01/01/1900,01/01/1900,0,SAT,0,WECODE'
chalet_array_final[39] = 'mayrhofen,Hotel Strass,2,2,10,0,0,HOT0000598,MWCODE,1,01/01/1900,01/01/1900,0,SAT,0,WECODE'
chalet_array_final[40] = 'meribel,Apartment Les Fermes de Meribel,2,2,10,0,0,HOT0000613,MWCODE,0,01/01/1900,01/01/1900,1,SAT,1,WECODE'
chalet_array_final[41] = 'meribel,Apartments La Tueda,7,2,7,0,0,HOT0000625,MWCODE,0,01/01/1900,01/01/1900,1,SAT,1,WECODE'
chalet_array_final[42] = 'meribel,Apartments Les Crets,3,3,6,0,0,HOT0000622,MWCODE,0,01/01/1900,01/01/1900,1,SAT,1,WECODE'
chalet_array_final[43] = 'meribel,Chalet Castor,4,4,10,2,0,HOT0000519,HOT0000579,0,01/01/1900,01/01/1900,0,SUN,0,HOT0000519'
chalet_array_final[44] = 'meribel,Chalet Cretet,10,8,10,2,0,HOT0000624,HOT0000610,0,01/01/1900,01/01/1900,0,SUN,0,HOT0000607'
chalet_array_final[45] = 'meribel,Chalet Lou Trave,4,4,18,0,0,HOT0000522,HOT0000564,0,01/01/1900,01/01/1900,0,SUN,0,HOT0000522'
chalet_array_final[46] = 'meribel,Chalet Marcelle,4,4,10,2,0,HOT0000484,HOT0000534,0,16/12/2006,22/04/2007,0,SUN,0,HOT0000484'
chalet_array_final[47] = 'meribel,Chalet Martine,4,4,24,0,0,HOT0000485,HOT0000535,0,16/12/2006,22/04/2007,0,SUN,0,HOT0000485'
chalet_array_final[48] = 'meribel,Chalet Nathalie,4,4,15,0,0,HOT0000531,HOT0000536,0,01/01/1900,01/01/1900,0,SUN,0,HOT0000531'
chalet_array_final[49] = 'meribel,Chalet Sabine (6),4,4,6,1,0,HOT0000570,HOT0000608,0,01/01/1900,01/01/1900,0,SUN,0,HOT0000605'
chalet_array_final[50] = 'meribel,Chalet Sabine (7),4,4,7,1,0,HOT0000547,HOT0000609,0,01/01/1900,01/01/1900,0,SUN,0,HOT0000606'
chalet_array_final[51] = 'meribel,Combined Martine Marcelle,34,30,34,4,0,HOT0000554,MWCODE,0,01/01/1900,01/01/1900,0,SUN,0,WECODE'
chalet_array_final[52] = 'meribel,Combined Sabine,13,11,13,2,0,HOT0000571,MWCODE,0,01/01/1900,01/01/1900,0,SUN,0,WECODE'
chalet_array_final[53] = 'meribel,Hotel Mottaret,2,2,8,0,0,HOT0000631,MWCODE,0,01/01/1900,01/01/1900,0,SAT,0,WECODE'
chalet_array_final[54] = 'morzine,Chalet Alt Pic,10,10,10,0,0,HOT0000617,HOT0000604,2,01/01/1900,01/01/1900,0,SUN,0,HOT0000603'
chalet_array_final[55] = 'morzine,Chalet Nyon,14,12,14,2,0,HOT0000486,HOT0000539,2,16/12/2006,15/04/2007,0,SUN,0,HOT0000486'
chalet_array_final[56] = 'morzine,Chalet Papy,12,10,12,2,0,HOT0000487,HOT0000527,0,05/11/2006,29/04/2007,0,SUN,0,HOT0000487'
chalet_array_final[57] = 'morzine,Chalet St Johan,2,2,10,0,0,HOT0000623,HOT0000602,2,01/01/1900,01/01/1900,0,SUN,0,HOT0000601'
chalet_array_final[58] = 'morzine,Chalet Well,18,2,18,0,0,HOT0000488,HOT0000537,2,16/12/2006,15/04/2007,0,SUN,0,HOT0000488'
chalet_array_final[59] = 'morzine,Hotel Alte Neve,2,2,8,0,0,HOT0000633,MWCODE,0,01/01/1900,01/01/1900,0,SAT,0,WECODE'
chalet_array_final[60] = 'sainte_foy,Chalet Bonhomie,10,8,10,2,0,HOT0000490,MWCODE,0,16/12/2006,15/04/2007,0,SUN,0,WECODE'
chalet_array_final[61] = 'st_anton,Chalet Sophia,18,2,18,0,0,HOT0000610,MWCODE,0,01/01/1900,01/01/1900,0,SUN,0,WECODE'
chalet_array_final[62] = 'st_anton,Hotel Alpenhoff,2,2,12,0,0,HOT0000629,MWCODE,0,01/01/1900,01/01/1900,0,SUN,0,WECODE'
chalet_array_final[63] = 'tignes,Apartments L Ecrin Des Neiges,2,2,10,0,0,HOT0000620,MWCODE,0,01/01/1900,01/01/1900,1,SAT,1,WECODE'
chalet_array_final[64] = 'tignes,Chalet Caroline,16,2,16,0,0,HOT0000465,MWCODE,0,05/11/2006,29/04/2007,0,SUN,0,WECODE'
chalet_array_final[65] = 'tignes,Chalet Josephine,10,8,10,2,0,HOT0000463,MWCODE,2,05/11/2006,29/04/2007,0,SUN,0,WECODE'
chalet_array_final[66] = 'tignes,Chalet Lavachey,33,2,33,0,0,HOT0000541,MWCODE,0,01/01/1900,01/01/1900,0,SUN,0,WECODE'
chalet_array_final[67] = 'tignes,Chalet Napoleon,10,8,10,2,0,HOT0000464,MWCODE,2,05/11/2006,29/04/2007,0,SUN,0,WECODE'
chalet_array_final[68] = 'tignes,Chalet Neve,25,2,25,0,0,HOT0000495,MWCODE,0,05/11/2006,29/04/2007,0,SUN,0,WECODE'
chalet_array_final[69] = 'tignes,Chalet Waterloo,12,10,12,2,0,HOT0000466,MWCODE,2,05/11/2006,29/04/2007,0,SUN,0,WECODE'
chalet_array_final[70] = 'tignes,Combined Josephine Napolean,20,18,20,0,0,HOT0000552,MWCODE,0,01/01/1900,01/01/1900,0,SUN,0,WECODE'
chalet_array_final[71] = 'tignes,Hotel Nevada Suites,2,2,10,0,0,HOT0000605,MWCODE,0,01/01/1900,01/01/1900,0,SAT,1,WECODE'
chalet_array_final[72] = 'val_disere,Apartments La Daille,7,2,7,0,0,HOT0000627,MWCODE,0,01/01/1900,01/01/1900,1,SAT,1,WECODE'
chalet_array_final[73] = 'val_disere,Apartments Les Chalets du Laisant,2,2,8,0,0,HOT0000621,MWCODE,0,01/01/1900,01/01/1900,1,SAT,1,WECODE'
chalet_array_final[74] = 'val_disere,Chalet Bonne Neiges,11,8,11,0,0,HOT0000596,MWCODE,0,01/01/1900,01/01/1900,0,SUN,0,WECODE'
chalet_array_final[75] = 'val_disere,Chalet Champagne (1),8,8,8,0,0,HOT0000544,MWCODE,0,01/01/1900,01/01/1900,0,SUN,0,WECODE'
chalet_array_final[76] = 'val_disere,Chalet Champagne (2),6,6,6,0,0,HOT0000573,MWCODE,0,01/01/1900,01/01/1900,0,SUN,0,WECODE'
chalet_array_final[77] = 'val_disere,Chalet Fjord,4,4,41,0,0,HOT0000609,HOT0000621,0,01/01/1900,01/01/1900,0,SUN,0,HOT0000620'
chalet_array_final[78] = 'val_disere,Combined Champagne,14,12,14,2,0,HOT0000574,MWCODE,0,01/01/1900,01/01/1900,0,SUN,0,WECODE'
chalet_array_final[79] = 'chamonix,All Chalets,60,2,60,0,0,all_chamonix,all_chamonix,99,12-12-09,24-04-10,0,ALL,0,ALL'
chalet_array_final[80] = 'courchevel,All Chalets,60,2,60,0,0,all_courchevel,all_courchevel,99,12-12-09,24-04-10,0,ALL,0,ALL'
chalet_array_final[81] = 'garda,All Chalets,60,2,60,0,0,all_garda,all_garda,99,12-12-09,24-04-10,0,ALL,0,ALL'
chalet_array_final[82] = 'la_plagne,All Chalets,60,2,60,0,0,all_la_plagne,all_la_plagne,99,12-12-09,24-04-10,0,ALL,0,ALL'
chalet_array_final[83] = 'les_arcs,All Chalets,60,2,60,0,0,all_les_arcs,all_les_arcs,99,12-12-09,24-04-10,0,ALL,0,ALL'
chalet_array_final[84] = 'les_deux_alpes,All Chalets,60,2,60,0,0,all_les_deux_alpes,all_les_deux_alpes,99,12-12-09,24-04-10,0,ALL,0,ALL'
chalet_array_final[85] = 'les_gets,All Chalets,60,2,60,0,0,all_les_gets,all_les_gets,99,12-12-09,24-04-10,0,ALL,0,ALL'
chalet_array_final[86] = 'les_menuires,All Chalets,60,2,60,0,0,all_les_menuires,all_les_menuires,99,12-12-09,24-04-10,0,ALL,0,ALL'
chalet_array_final[87] = 'mayrhofen,All Chalets,60,2,60,0,0,all_mayrhofen,all_mayrhofen,99,12-12-09,24-04-10,0,ALL,0,ALL'
chalet_array_final[88] = 'meribel,All Chalets,60,2,60,0,0,all_meribel,all_meribel,99,12-12-09,24-04-10,0,ALL,0,ALL'
chalet_array_final[89] = 'morzine,All Chalets,60,2,60,0,0,all_morzine,all_morzine,99,12-12-09,24-04-10,0,ALL,0,ALL'
chalet_array_final[90] = 'sainte_foy,All Chalets,60,2,60,0,0,all_sainte_foy,all_sainte_foy,99,12-12-09,24-04-10,0,ALL,0,ALL'
chalet_array_final[91] = 'st_anton,All Chalets,60,2,60,0,0,all_st_anton,all_st_anton,99,12-12-09,24-04-10,0,ALL,0,ALL'
chalet_array_final[92] = 'tignes,All Chalets,60,2,60,0,0,all_tignes,all_tignes,99,12-12-09,24-04-10,0,ALL,0,ALL'
chalet_array_final[93] = 'val_disere,All Chalets,60,2,60,0,0,all_val_disere,all_val_disere,99,12-12-09,24-04-10,0,ALL,0,ALL'
chalet_array_final[94] = 'avoriaz,All Chalets,60,2,60,0,0,all_avoriaz,all_avoriaz,99,12-12-09,24-04-10,0,ALL,0';
    
    
    if (hotel_code != "") {
        for (x in chalet_array_final) {
            myString = new String(chalet_array_final[x])
            z = (myString.indexOf(hotel_code));
            
            if (z < 0) {
                // alert("not found it");
            }
            else {
                //alert("found it");
                
                var mySplitResult = chalet_array_final[x].split(",");
                
                
                /*
                 1. need to get the value of the initial search
                 2. then check if its the minimum number
                 3. if ok then continue
                 4. if not change the value to the correct number and then return false
                 5. show the maximum number
                 */
				 var departure = document.getElementById('date_range_start').value;
				 if (departure != 5)
				 {

		
						if (parseInt(paxs) < parseInt(mySplitResult[3])) {
							alert("The Minimum Occupancy " + mySplitResult[3] + " persons \n Please search again \n If you are experiencing difficulty \nplease call 0844 770 4070 and \speak to a sales representative  ");
							return mySplitResult;
						}
                else //(ae_min, igo_min, hcode, max_occ)
							 if (parseInt(paxs) > parseInt(mySplitResult[4])) {
								alert("The Maximum Occupancy " + mySplitResult[4] + " persons \n Please search again \n If you are experiencing difficulty \nplease call 0844 770 4070 and \speak to a sales representative   ");
								return mySplitResult;
								
							}
                    else {
                    // return true; 
                    }
							 }
                
                
            }
        }
    }
    
}

