///vars for accordion menu
var accordionsetting = {
    headerclass: "accordion_header",
    contentclass: "accordion_subheader",
    revealtype: "click",
    collapseprev: true,
    defaultexpanded: [5],
    onemustopen: false,
    animatedefault: false,
    persiststate: true,
    toggleclass: ["openpet", ""],
    togglehtml: ["suffix", "<img src=\"/images/accordion_imgs/arrow_close.jpg\"/>", "<img src=\"/images/accordion_imgs/arrow_open.jpg\"/>"],
    animatespeed: "slow",
    oninit:function(expandedindices){
    },
    onopenclose:function(header, index, state, isuseractivated){
    }
}
var accordionsetting_offer = {
    headerclass: "accordion_header_offer",
    contentclass: "accordion_subheader_offer",
    revealtype: "click",
    collapseprev: true,
    defaultexpanded: [0],
    onemustopen: false,
    animatedefault: false,
    persiststate: true,
    toggleclass: ["openpet", ""],
    togglehtml: ["suffix", "<img src=\"/images/accordion_imgs/arrow_close.jpg\"/>", "<img src=\"/images/accordion_imgs/arrow_open.jpg\"/>"],
    animatespeed: "slow",
    oninit:function(expandedindices){
    },
    onopenclose:function(header, index, state, isuseractivated){
    }
}
//accordion for restaurants & Bars
var accordionsetting_pages = {
    headerclass: "accordion_header_pages",
    contentclass: "accordion_subheader_pages",
    revealtype: "click",
    collapseprev: true,
    defaultexpanded: [-1],
    onemustopen: false,
    animatedefault: false,
    persiststate: true,
    toggleclass: ["openpet", ""],
    togglehtml: ["suffix", "<img src=\"/images/accordion_imgs/bch_arrow_down.jpg\"/>", "<img src=\"/images/accordion_imgs/bch_arrow_up.jpg\"/>"],
    animatespeed: "slow",
    oninit:function(expandedindices){
    },
    onopenclose:function(header, index, state, isuseractivated){
    }
}
//accordion for restaurants & Bars
var accordionsetting_more = {
    headerclass: "accordion_header_more",
    contentclass: "accordion_subheader_more",
    revealtype: "click",
    collapseprev: true,
    defaultexpanded: [-1],
    onemustopen: false,
    animatedefault: false,
    persiststate: true,
    toggleclass: ["openpet", ""],
    togglehtml: ["prefix", "<img src=\"/images/accordion_imgs/more_btn.jpg\"/>", "<img src=\"/images/accordion_imgs/less_btn.jpg\"/>"],
    animatespeed: "slow",
    oninit:function(expandedindices){
    },
    onopenclose:function(header, index, state, isuseractivated){
    }
}

//for rollovers
function toggleButtons(imgId) { 
    obj = document.getElementById(imgId);
    obj.isSelected = ((obj.src.indexOf('off') != -1) ? true : false);
    obj.src = "images/button_" + imgId + ( (obj.src.indexOf('off') !=-1) ? "_on.gif" : "_off.gif");
}

function SwapImg(imgID, img)
{
    obj = document.getElementById(imgId);

    if (obj.isSelected) return;

    obj.src = img;
}

//Browser Support Code
function ajax_change_display_Function(div_name,content_name){
    var ajaxRequest;  // The variable that makes Ajax possible!
    try{
        // Opera 8.0+, Firefox, Safari
        ajaxRequest = new XMLHttpRequest();
    } catch (e){
        // Internet Explorer Browsers
        try{
            ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try{
                ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e){
                // Something went wrong
                alert("Your browser is not supported!");
                return false;
            }
        }
    }
    // Create a function that will receive data sent from the server
    ajaxRequest.onreadystatechange = function(){
        if (ajaxRequest.readyState==1 || ajaxRequest.readyState=="loading")
        //if AJAX state is loading (loading)
        {
            document.getElementById(div_name).innerHTML="<table width=\"100\" border=\"0\" cellspacing=\"15\"><tr><td align=\"left\"><img src=\"/swf/preloader.gif\"/></td></tr></table>" ;
            //get element where the id is “Result”, in this case it goes to the <div> tag
            //send the loading image (loading.gif) that show us the data is being prepared
        }
        if(ajaxRequest.readyState == 4){
            var ajaxDisplay = document.getElementById(div_name);
            ajaxDisplay.innerHTML = ajaxRequest.responseText;
        }
    }
    ajaxRequest.open("GET", content_name, true);
    ajaxRequest.send(null);
    set_swf_var(content_name);
    return false;
}

function set_swf_var(str){
    if(window.main_movie) window.document["main_movie"].SetVariable("page_name", str);
    if(document.main_movie) document.main_movie.SetVariable("page_name", str);

}

//Ajax select room fuction
function ajax_room_selection_Function(div_name, page_name, room_id, selected_action){
    var ajaxRequest;  // The variable that makes Ajax possible!
    try{
        // Opera 8.0+, Firefox, Safari
        ajaxRequest = new XMLHttpRequest();
    } catch (e){
        // Internet Explorer Browsers
        try{
            ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try{
                ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e){
                // Something went wrong
                alert("Your browser is not supported!");
                return false;
            }
        }
    }

    // Create a function that will receive data sent from the server
    ajaxRequest.onreadystatechange = function(){
        if (ajaxRequest.readyState==1 || ajaxRequest.readyState=="loading")
        //if AJAX state is loading (loading)
        {
            document.getElementById(div_name).innerHTML="<table width=\"100\" border=\"0\" cellspacing=\"15\"><tr><td align=\"left\"><img src=\"/swf/preloader.gif\"/></td></tr></table>" ;
            //get element where the id is “Result”, in this case it goes to the <div> tag
            //send the loading image (loading.gif) that show us the data is being prepared
        }
        if(ajaxRequest.readyState == 4){
            var ajaxDisplay = document.getElementById(div_name);
            ajaxDisplay.innerHTML = ajaxRequest.responseText;
        }
    }
    var queryString = "?room_id=" + room_id + "&selected_action=" + selected_action + "&";
    ajaxRequest.open("GET", page_name + queryString, true);
    ajaxRequest.send(null);

    //repeat the Ajax function for the room selected box
    var ajaxRequest_selected;  // The variable that makes Ajax possible!
    try{
        // Opera 8.0+, Firefox, Safari
        ajaxRequest_selected = new XMLHttpRequest();
    } catch (e){
        // Internet Explorer Browsers
        try{
            ajaxRequest_selected = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try{
                ajaxRequest_selected = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e){
                // Something went wrong
                alert("Your browser is not supported!");
                return false;
            }
        }
    }

    // Create a function that will receive data sent from the server
    ajaxRequest_selected.onreadystatechange = function(){
        if (ajaxRequest_selected.readyState==1 || ajaxRequest_selected.readyState=="loading")
        //if AJAX state is loading (loading)
        {
            document.getElementById('div_rooms_selected').innerHTML="<table width=\"100\" border=\"0\" cellspacing=\"15\"><tr><td align=\"left\"><img src=\"/swf/preloader.gif\"/></td></tr></table>" ;
            //get element where the id is “Result”, in this case it goes to the <div> tag
            //send the loading image (loading.gif) that show us the data is being prepared
        }
        if(ajaxRequest_selected.readyState == 4){
            var ajaxDisplay = document.getElementById('div_rooms_selected');
            ajaxDisplay.innerHTML = ajaxRequest_selected.responseText;
        }
    }
    var queryString = "?room_id=" + room_id + "&selected_action=" + selected_action + "&";
    ajaxRequest_selected.open("GET", '/includes/boxes/box_selected_rooms.php' + queryString, true);
    ajaxRequest_selected.send(null);

    return false;
}

//Browser Support Code
function ajax_delete_room_selection_Function(div_name, page_name, room_id, selected_action){     
    var ajaxRequest;  // The variable that makes Ajax possible!
    try{
        // Opera 8.0+, Firefox, Safari
        ajaxRequest = new XMLHttpRequest();
    } catch (e){
        // Internet Explorer Browsers
        try{
            ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try{
                ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e){
                // Something went wrong
                alert("Your browser is not supported!");
                return false;
            }
        }
    }
    // Create a function that will receive data sent from the server
    ajaxRequest.onreadystatechange = function(){
        if (ajaxRequest.readyState==1 || ajaxRequest.readyState=="loading")
        //if AJAX state is loading (loading)
        {
            document.getElementById(div_name).innerHTML="<table width=\"100\" border=\"0\" cellspacing=\"15\"><tr><td align=\"left\"><img src=\"/swf/preloader.gif\"/></td></tr></table>" ;
            //get element where the id is “Result”, in this case it goes to the <div> tag
            //send the loading image (loading.gif) that show us the data is being prepared
        }
        if(ajaxRequest.readyState == 4){
            var ajaxDisplay = document.getElementById(div_name);
            ajaxDisplay.innerHTML = ajaxRequest.responseText;
        }
    }         
    ajaxRequest.open("GET", content_name, true);
    ajaxRequest.send(null);    
    return false;
}


function MM_findObj(n, d) { //v4.01
    var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
        d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
    if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
    for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
    if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
    var i,p,v,obj,args=MM_showHideLayers.arguments;
    for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
        if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
        obj.visibility=v; }
}

function pollC(id, load, page_name){
    if (!load&&document.getElementById(id)){
        document.getElementById(id).id='';
        return;
    }else if (load&&document.getElementById(id)){
        if (id=='unique_1')
        select_init(page_name);
        return;	
    }else if (load&&!document.getElementById(id)){
        setTimeout("pollC('"+id+"', 'load', '"+page_name+"')", 60);
    }	
}

function select_init(page_name){	
    if(page_name=="the_hotel"){
        ddaccordion.init(accordionsetting);
        $("a[id='tab_under_construction']").colorbox({width:"900", height:"536", slideshow:false});
		$('.title').tipsy({gravity: 'w'});      
    }else if (page_name=="restaurants_bars"){
        ddaccordion.init(accordionsetting_pages);
    }
    else if (page_name=="golf"){
        ddaccordion.init(accordionsetting_pages);
    }
    else if (page_name=="serenity_plus"){
        ddaccordion.init(accordionsetting_pages);
    }
    else if (page_name=="miniclub"){
        ddaccordion.init(accordionsetting_pages);
    }
    else if (page_name=="sports_activities"){
        ddaccordion.init(accordionsetting_pages);
    }
    else if (page_name=="room_rates"){
        $("a[id='virtual_tour_room']").colorbox(); 
        $("a[id='hotel_rates']").colorbox(); 
        $("a[id='ask_for_quote']").colorbox({width:"740", height:"80%", iframe:true, slideshow:false}); 
        $("a[id='watch_video']").colorbox({width:"615", height:"480", iframe:true});
        ddaccordion.init(accordionsetting_more);  
        slider_init();
    }
    else if (page_name=="spa"){
        $("a[rel='spa_gallery']").colorbox({slideshow:true});
        $("a[id='google_maps']").colorbox({width:"710", height:"590", iframe:true});
        $("a[id='offers_conditions']").colorbox();
    }	
    else if (page_name=="wellness"){
        $("a[rel='spa_gallery']").colorbox({slideshow:true});
    }
    else if (page_name=="special_offers"){
        $("a[id='see_conditions']").colorbox({width:"740", height:"80%", iframe:true, slideshow:false});
        $("a[id='ask_for_quote_spo']").colorbox({width:"740", height:"80%", iframe:true, slideshow:false});
    }
    else if (page_name=="offres_special"){
        $("a[id='offers_conditions']").colorbox();       
    }    
    //delete the room features box in the left column
    if(page_name!="room_rates"){
        document.getElementById( 'div_rooms_features' ).innerHTML = '';
    }
    return false;
}

function ajax_form_submission_Function(div_name, called_page_name, query_variables){
    var ajaxRequest;  // The variable that makes Ajax possible!
    try{
        // Opera 8.0+, Firefox, Safari
        ajaxRequest = new XMLHttpRequest();
    } catch (e){
        // Internet Explorer Browsers
        try{
            ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try{
                ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e){
                // Something went wrong
                alert("Your browser is not supported!");
                return false;
            }
        }
    }
    // Create a function that will receive data sent from the server
    ajaxRequest.onreadystatechange = function(){
        if (ajaxRequest.readyState==1 || ajaxRequest.readyState=="loading")
        //if AJAX state is loading (loading)
        {
            document.getElementById(div_name).innerHTML="<table width=\"100\" border=\"0\" cellspacing=\"15\"><tr><td align=\"left\"><img src=\"/swf/preloader.gif\"/></td></tr></table>" ;
        }
        if(ajaxRequest.readyState == 4){
            var ajaxDisplay = document.getElementById(div_name);
            ajaxDisplay.innerHTML = ajaxRequest.responseText;
        }
    }

    var queryString = "?"+ query_variables +"&";
    //alert(called_page_name + queryString);
    ajaxRequest.open("GET", called_page_name + queryString, true);
    ajaxRequest.send(null);
    return false;
}


//Browser Support Code
function ajax_room_rates_filter_Function(div_name, room_rate_page_name, query_variables){
    var ajaxRequest;  // The variable that makes Ajax possible!
    try{
        // Opera 8.0+, Firefox, Safari
        ajaxRequest = new XMLHttpRequest();
    } catch (e){
        // Internet Explorer Browsers
        try{
            ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try{
                ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e){
                // Something went wrong
                alert("Your browser is not supported!");
                return false;
            }
        }
    }
    // Create a function that will receive data sent from the server
    ajaxRequest.onreadystatechange = function(){
        if (ajaxRequest.readyState==1 || ajaxRequest.readyState=="loading")
        //if AJAX state is loading (loading)
        {
            document.getElementById(div_name).innerHTML="<table width=\"100\" border=\"0\" cellspacing=\"15\"><tr><td align=\"left\"><img src=\"/swf/preloader.gif\"/></td></tr></table>" ;
        }
        if(ajaxRequest.readyState == 4){
            var ajaxDisplay = document.getElementById(div_name);
            ajaxDisplay.innerHTML = ajaxRequest.responseText;
        }
    }

    var queryString = "?"+ query_variables +"&";
    //alert(room_rate_page_name + queryString);
    ajaxRequest.open("GET", room_rate_page_name + queryString, true);
    ajaxRequest.send(null);
    return false;
}


function submit_room_rates_form_function(form_name){  
    var submited_values = "";     
    pollC('unique_1','','the_hotel');
    submited_values = get_form_elements_detail(form_name);
    ajax_room_rates_filter_Function('filtered_rooms', '/includes/room_filters.php' , submited_values);
    pollC('unique_1', 'load','room_rates');    
    return false;
}

function submit_brochure_request_form_function(form_name){  
    var submited_brochure_request_values = "";   
    if(validate_form(form_name)==true){
        submited_brochure_request_values = get_form_elements_detail(form_name);
        $('<a tabindex="3"/>').colorbox({width:"700", height:"80%", iframe:true, href:"/request_brochure.php?"+ submited_brochure_request_values , open:true}); return false;
    }
    return false;	
}

function submit_contact_form_function(div_name, call_page, form_name, caller_page_name){    
    var submited_cotact_us_values = ""; 
    if(validate_form(form_name)==true){
        submited_cotact_us_values = get_form_elements_detail(form_name);
        $('<a tabindex="2"/>').colorbox({width:"750", height:"80%", iframe:true, href:"/contact_us.php?"+ submited_cotact_us_values , open:true}); return false;
    }
    return false;    
}

function submit_hotel_booking_form_function(form_name){  
    //    var  = "";   
    if(validate_form(form_name)==true){
        //  submited_hotel_booking_values = get_form_elements_detail(form_name);
        //code to open quotation form in the light box
        //$('<a tabindex="1"/>').colorbox({width:"700", height:"80%", iframe:true, href:"/quote_request.php?"+ submited_hotel_booking_values , open:true}); return false;
        return true;
    }
    return false;    
}

function submit_hotel_search_form_function(form_name){  
    var submited_hotel_search_values = "";   
    if(validate_form(form_name)==true){
        submited_hotel_search_values = get_form_elements_detail(form_name);
        //code to open quotation form in the light box
        $('<a tabindex="4"/>').colorbox({width:"700", height:"80%", iframe:true, href:"/quote_request_tailormade.php?"+ submited_hotel_search_values , open:true}); return false;
    }
    return false;    
}


function open_special_offer_swf(special_code){  
    //code to open quotation form in the light box
    $('<a tabindex="5"/>').colorbox({width:"700", height:"80%", iframe:true, href:"/quote_request.php?spo="+ special_code , open:true});
}

function submit_newsletter_form_function(div_name, call_page, form_name){    
    var submited_newsletter_values = "";   
    if(validate_form(form_name)==true){
        submited_newsletter_values = get_form_elements_detail(form_name);
        ajax_form_submission_Function(div_name, call_page, submited_newsletter_values);
    }
    return false;	
}


function submit_send_friend_form_function(div_name, call_page, form_name){  
    var submited_send_friend_values = "";   
    if(validate_form(form_name)==true){
        submited_send_friend_values = get_form_elements_detail(form_name);
        ajax_form_submission_Function(div_name, call_page, submited_send_friend_values);
    }
    return false;	
}

function submit_quote_request_tailormade_function(form_name, call_page, div_name){  
    var submited_squote_request_tailormade_values = "";   
    if(validate_form(form_name)==true){
        submited_squote_request_tailormade_values = get_form_elements_detail(form_name);
        ajax_form_submission_Function(div_name, call_page, submited_squote_request_tailormade_values)
    }
    return false;	
}
function submit_quote_request_groups_function(form_name, call_page, div_name){  
    var submited_squote_request_groups_values = "";   
    if(validate_form(form_name)==true){
        submited_squote_request_groups_values = get_form_elements_detail(form_name);
        ajax_form_submission_Function(div_name, call_page, submited_squote_request_groups_values)
    }
    return false;	
}


function submit_quote_request_function(form_name, call_page, div_name){  
    var submited_quote_request_values = "";   
    if(validate_form(form_name)==true){
        submited_quote_request_values = get_form_elements_detail(form_name);
        ajax_form_submission_Function(div_name, call_page, submited_quote_request_values)
    }
    return false;    
}


function submit_request_brochure_form_function(form_name, call_page, div_name){  
    var submited_request_brochure_values = "";   
    if(validate_form(form_name)==true){
        submited_request_brochure_values = get_form_elements_detail(form_name);
        //alert(submited_request_brochure_values);
        ajax_form_submission_Function(div_name, call_page, submited_request_brochure_values)
    }
    return false;	
}


function submit_request_info_RPM_form_function(form_name, call_page, div_name){  
    var submited_request_info_values = "";   
    if(validate_form(form_name)==true){
        submited_request_info_values = get_form_elements_detail(form_name);
        //alert(submited_request_brochure_values);
        ajax_form_submission_Function(div_name, call_page, submited_request_info_values)
    }
    return false;    
}

function get_form_elements_detail(form_name){    
    var detailed_url = "";
    var form_value = "";
    for (i=0; i<form_name.elements.length; i++){
        if(form_name.elements[i].name.substring(0,3)=="chk" ){
            if(form_name.elements[i].checked){
                detailed_url =  detailed_url + "&" + form_name.elements[i].name + "=yes";
            }else{
                detailed_url =  detailed_url + "&" + form_name.elements[i].name + "=no";
            }
        }else{

            if(form_name.elements[i].name=="rdb_wed_period"){
                if(form_name.elements[i].checked){
                    detailed_url =  detailed_url + "&wed_period=" + form_name.elements[i].value;
                }
            }else{   
                form_name.elements[i].value = form_name.elements[i].value.replace("'"," ");
            }
            
            detailed_url =  detailed_url + "&" + form_name.elements[i].name + "=" + form_name.elements[i].value.replace(/\n/gi, "<br/>\n");
        }
    }
    // alert (detailed_url);         
    return detailed_url;
}


//email validation function
function validate_email(field,alerttxt){
    with (field){
        apos=value.indexOf("@")
        dotpos=value.lastIndexOf(".")
        if (apos<1||dotpos-apos<2){
            alert(alerttxt);
            return false
        }else{
            return true
        }
    }
}

function validate_required(field,alerttxt){
    with (field){
        if (value==null||value==""){
            alert(alerttxt);
            return false;
        }
        else{
            return true
        }
    }
}

function validate_form(thisform){
    for (i=0; i<thisform.elements.length; i++){
        if(thisform.elements[i].name=="txt_email"){
            if (validate_email(thisform.elements[i],email_err)==false)
            {thisform.elements[i].focus();return false;}
        }                
        if(thisform.elements[i].name=="txt_family_name"){
            if (validate_required(thisform.elements[i],family_name_err)==false)
            {thisform.elements[i].focus();return false;}
        }
        if(thisform.elements[i].name=="txt_first_name"){
            if (validate_required(thisform.elements[i],first_name_err)==false)
            {thisform.elements[i].focus();return false;}
        }
        if(thisform.elements[i].name=="txt_contact_us_message"){
            if (validate_required(thisform.elements[i],msg_err)==false)
            {thisform.elements[i].focus();return false;}
        }

        //############################# brochure request form ############################				
        if(thisform.elements[i].name=="txt_brochure_email"){
            if (validate_email(thisform.elements[i],email_err)==false)
            {thisform.elements[i].focus();return false;}
        }

        //######################### eof brochure request form ############################	
        //############################# newsletter submission form #######################			
        if(thisform.elements[i].name=="txt_newsletter_familyname"){
            if (validate_required(thisform.elements[i],family_name_err)==false)
            {thisform.elements[i].focus();return false;}
        }
        if(thisform.elements[i].name=="txt_newsletter_firstname"){
            if (validate_required(thisform.elements[i],first_name_err)==false)
            {thisform.elements[i].focus();return false;}
        }
        if(thisform.elements[i].name=="txt_newsletter_email"){
            if (validate_email(thisform.elements[i],email_err)==false)
            {thisform.elements[i].focus();return false;}
        }
        //######################### eof newsletter submission form #######################
        //############################# quotation form #################################            
        if(thisform.elements[i].name=="cbo_quote_destination"){
            if (thisform.elements[i].value=="default"){
                alert (destination_err);
                thisform.elements[i].focus();
                return false;
            }
        }
        if(thisform.elements[i].name=="cbo_daily_budget"){
            if (validate_required(thisform.elements[i],daily_budget_err)==false)
            {thisform.elements[i].focus();return false;}
        }
        if(thisform.elements[i].name=="HotelID"){
            if (validate_required(thisform.elements[i],"Select Hotel")==false)
            {thisform.elements[i].focus();return false;}
        }                
        if(thisform.elements[i].name=="txt_start_date"){
            if (validate_required(thisform.elements[i],arrival_date_err)==false)
            {thisform.elements[i].focus();return false;}
        }
        if(thisform.elements[i].name=="txt_end_date"){
            if (validate_required(thisform.elements[i],departure_date_err)==false)
            {thisform.elements[i].focus();return false;}
        }
        if(thisform.elements[i].name=="DateIn"){
            if (validate_required(thisform.elements[i],arrival_date_err)==false)
            {thisform.elements[i].focus();return false;}
        }
        if(thisform.elements[i].name=="DateOut"){
            if (validate_required(thisform.elements[i],departure_date_err)==false)
            {thisform.elements[i].focus();return false;}
        }    


        if(thisform.elements[i].name=="txt_num_adults"){
            if (validate_required(thisform.elements[i],num_adults_err)==false)
            {thisform.elements[i].focus();return false;}
        }
        if(thisform.elements[i].name=="txt_adults_per_room"){
            if (validate_required(thisform.elements[i],adults_per_room_err)==false)
            {thisform.elements[i].focus();return false;}
        }
        //****************************  personal details ***************************
        if(thisform.elements[i].name=="txt_firstname"){
            if (validate_required(thisform.elements[i],firstname_err)==false)
            {thisform.elements[i].focus();return false;}
        }
        if(thisform.elements[i].name=="txt_lastname"){
            if (validate_required(thisform.elements[i],lastname_err)==false)
            {thisform.elements[i].focus();return false;}
        }
        if(thisform.elements[i].name=="txt_address"){
            if (validate_required(thisform.elements[i],address_err)==false)
            {thisform.elements[i].focus();return false;}
        }                
        //######################### eof quotation form ################################
        //############################# send friend form #################################			
        if(thisform.elements[i].name=="txt_send_friend_name"){
            if (validate_required(thisform.elements[i],your_name_err)==false)
            {thisform.elements[i].focus();return false;}
        }
        if(thisform.elements[i].name=="txt_send_friend_email"){
            if (validate_email(thisform.elements[i],your_email_err)==false)
            {thisform.elements[i].focus();return false;}
        }
        if(thisform.elements[i].name=="txt_send_friend_friend_name"){
            if (validate_required(thisform.elements[i],your_friends_name_err)==false)
            {thisform.elements[i].focus();return false;}
        }
        if(thisform.elements[i].name=="txt_send_friend_friend_email"){
            if (validate_email(thisform.elements[i],your_friends_email_err)==false)
            {thisform.elements[i].focus();return false;}
        }
        if(thisform.elements[i].name=="txt_send_friend_subject"){
            if (validate_required(thisform.elements[i],subject_err)==false)
            {thisform.elements[i].focus();return false;}
        }				
        //######################### eof send friend form #################################

    }
    return true;
}

function transfer_status(cbo_transfer_value, form_pointer){
    if(cbo_transfer_value=="yes"){
        form_pointer.rdb_transfer[0].disabled=false;
        form_pointer.rdb_transfer[1].disabled=false;
        form_pointer.txt_arrival_flight.disabled=false;
        form_pointer.txt_departure_flight.disabled=false;
        form_pointer.cbo_tranfer_type.disabled=false;
    }else{
        //the checkbox was unchecked
        form_pointer.rdb_transfer[0].disabled=true;
        form_pointer.rdb_transfer[1].disabled=true;
        form_pointer.txt_arrival_flight.disabled=true;
        form_pointer.txt_departure_flight.disabled=true;
        form_pointer.cbo_tranfer_type.disabled=true;
    }    
    return true;  
}



var cX = 0; var cY = 0; var rX = 0; var rY = 0;
function UpdateCursorPosition(e){ cX = e.pageX; cY = e.pageY;}
function UpdateCursorPositionDocAll(e){ cX = event.clientX; cY = event.clientY;}
if(document.all) { document.onmousemove = UpdateCursorPositionDocAll; }
else { document.onmousemove = UpdateCursorPosition; }
function AssignPosition(d) {
    if(self.pageYOffset) {
        rX = self.pageXOffset;
        rY = self.pageYOffset;
    }
    else if(document.documentElement && document.documentElement.scrollTop) {
        rX = document.documentElement.scrollLeft;
        rY = document.documentElement.scrollTop;
    }
    else if(document.body) {
        rX = document.body.scrollLeft;
        rY = document.body.scrollTop;
    }
    if(document.all) {
        cX += rX;
        cY += rY;
    }
    d.style.left = (cX+10) + "px";
    d.style.top = (cY+10) + "px";
}
function HideContent(d) {
    if(d.length < 1) { return; }
    document.getElementById(d).style.display = "none";
}
function ShowContent(d) {
    if(d.length < 1) { return; }
    var dd = document.getElementById(d);
    AssignPosition(dd);
    dd.style.display = "block";
}
function ReverseContentDisplay(d) {
    if(d.length < 1) { return; }
    var dd = document.getElementById(d);
    AssignPosition(dd);
    if(dd.style.display == "none") { dd.style.display = "block"; }
    else { dd.style.display = "none"; }
}


//////////////////////////////////
var currObg;              // stores the current object being manipulated (leftSlider or rightSlider object)
var leftPos = 0;          // the current left position after mouse is released
var rightPos = 200;       // the current right position after mouse is released
var sliderWidth = 7;      // the width of the sliders (includes borders)
var sliderBarWidth = 200; // the width of the slider bar (does not include borders)
var mouseStart = -99999   // an arbitrary number used to show that it is the first time we are hitting the moveSlider1 function.
var pos;                  // position with offset used during the move 
var min = 100;            // minimum value of the data 
var max = 300;            // maximum value of the data

/* funciton moveSlider(obj)
parameter obj - object reference to the calling object
This function sets the resets the starting mouse position and sets the document 
methods used to watch for mouse events.
*/
function moveSlider(obj) {
    mouseStart = -99999;   // set the beginning mouse position to an unlikely number.
    currObj = obj;         // set the currObj variable to the object that was clicked
    document.onmousemove = moveSlider1; // set the onmousemove method to the function that moves the slider
    document.onmouseup = moveDone;   // set the onmouseup method to the function that stops listening for the mousemove and reclaculates the data
}

/* function moveslider1
This function is called by the mousemove event
checks the current mouse position and compares it 
to the mouse position when the move was started.
uses the difference as an offset from the slider's
staring position to move the slider with the mouse
*/
function moveSlider1(e){
    if (!e) var e = window.event;  // if IE, then we need to assign e
    if (e.pageX) posX = e.pageX;   // FF, opera, netscape
    else if (e.clientX) {          // IE
        posX = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;  
    }
    if (mouseStart == -99999) mouseStart = posX;  // -99999 is an arbitrary number.  It is unlikely to be hit 
    var offset = posX - mouseStart; // determine the difference from where the mouse started to where it is now
    if (currObj.id=="sliderLeft") {  // If we are moving the left slider
        pos = leftPos + offset;        // the new position should be the current left position + the offset
        if (pos < 0) pos = 0;          // if this makes the left position less than 0 then use 0
        if (pos > rightPos - sliderWidth) pos = rightPos - sliderWidth; // if the position would put us past the right slider then move up to the right slider
        document.getElementById('leftX').value = pos/sliderBarWidth * (max-min) + min; // put the new left position in a text box to be viewed. (this is not required)
    }
    else {
        pos = rightPos + offset   // the new position should be the current right position + the offset
        if (pos < leftPos + sliderWidth) pos = leftPos + sliderWidth;  // if the new position would take us past the left slider then move next to the left slider
        if (pos > sliderBarWidth ) pos = sliderBarWidth ;  // if the new position is past the end of the bar, position at the end of the bar.
        document.getElementById('rightX').value = pos/sliderBarWidth * (max-min) + min;  // put the new right position in a text box to be viewed. (this is not required)
    }        
    currObj.style.left = pos + "px";  // move the slider to the new position
}

/* function moveDone()
sets the current left/right position memory variable.
clears the mouse monitoring methods.
Calls the function to recaculate the data
*/
function moveDone(e) {
    alert("yes");
    if (currObj.id == "sliderLeft") leftPos = pos;    // set the current left position to the value of pos
    else rightPos = pos;                              // set the current right position to the value of pos
    document.onmousemove = function() {};             // stop listening for a mousemove event
    document.onmouseup = function() {};               // stop listening for a mouseup event
}

//Browser Support Code
function ajax_wedding_package_Function(selected_id, div_name){
    var ajaxDiveName='ajax_'+div_name+'_Div';    
    var ajaxRequest;  // The variable that makes Ajax possible!
    try{
        // Opera 8.0+, Firefox, Safari
        ajaxRequest = new XMLHttpRequest();
    } catch (e){
        // Internet Explorer Browsers
        try{
            ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try{
                ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e){
                // Something went wrong
                alert("Your browser is not supported!");
                return false;
            }
        }
    }

    // Create a function that will receive data sent from the server
    ajaxRequest.onreadystatechange = function(){
        if (ajaxRequest.readyState==1 || ajaxRequest.readyState=="loading"){
            //if AJAX state is loading (loading)
            document.getElementById(ajaxDiveName).innerHTML="<table width=\"580\" border=\"0\" cellspacing=\"10\"><tr><td align=\"center\"><img src=\"/swf/preloader.gif\"/></td></tr></table>" ;
            //get element where the id is “Result”, in this case it goes to the <div> tag
            //send the loading image (loading.gif) that show us the data is being prepared
        }
        if(ajaxRequest.readyState == 4){
            //document.getElementById(ajaxDiveName).innerHTML=html;
            var ajaxDisplay = document.getElementById(ajaxDiveName);
            ajaxDisplay.innerHTML = ajaxRequest.responseText;
            //loadobjs('/js/tabcontent_init.js')
        }
    }

    //reset the combo box
    if(selected_id==""){
        document.getElementById('cb_hotels').selectedIndex= 0;
    }

    if(div_name=="hotel_details_1" || div_name=="hotel_details_2"){
        var queryString = selected_id;
    }

    if(div_name=="hotel_details_1" || div_name=="hotel_details_2"){
        ajaxRequest.open("GET", "/includes/packages_wedding.php?" + queryString, true);   
    }

    ajaxRequest.send(null);

    return false;
}

function display_hotel_package(div_name,form_name,hotel_package_details){
 //   alert(get_form_elements_detail(form_name));
    return ajax_wedding_package_Function(get_form_elements_detail(form_name) , div_name);
}

//code for renwal
function ajax_renewal_package_Function(selected_id, div_name){
    var ajaxDiveName='ajax_'+div_name+'_Div';    
    var ajaxRequest;  // The variable that makes Ajax possible!
    try{
        // Opera 8.0+, Firefox, Safari
        ajaxRequest = new XMLHttpRequest();
    } catch (e){
        // Internet Explorer Browsers
        try{
            ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try{
                ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e){
                // Something went wrong
                alert("Your browser is not supported!");
                return false;
            }
        }
    }

    // Create a function that will receive data sent from the server
    ajaxRequest.onreadystatechange = function(){
        if (ajaxRequest.readyState==1 || ajaxRequest.readyState=="loading"){
            //if AJAX state is loading (loading)
            document.getElementById(ajaxDiveName).innerHTML="<table width=\"580\" border=\"0\" cellspacing=\"10\"><tr><td align=\"center\"><img src=\"/swf/preloader.gif\"/></td></tr></table>" ;
            //get element where the id is “Result”, in this case it goes to the <div> tag
            //send the loading image (loading.gif) that show us the data is being prepared
        }
        if(ajaxRequest.readyState == 4){
            //document.getElementById(ajaxDiveName).innerHTML=html;
            var ajaxDisplay = document.getElementById(ajaxDiveName);
            ajaxDisplay.innerHTML = ajaxRequest.responseText;
            //loadobjs('/js/tabcontent_init.js')
        }
    }

    //reset the combo box
    if(selected_id==""){
        document.getElementById('cb_hotels').selectedIndex= 0;
    }

    if(div_name=="hotel_details_1" || div_name=="hotel_details_2"){
        var queryString = selected_id;
    }

    if(div_name=="hotel_details_1" || div_name=="hotel_details_2"){
        ajaxRequest.open("GET", "/includes/packages_renewal.php?" + queryString, true);   
    }

    ajaxRequest.send(null);

    return false;
}

function display_hotel_package_renewal(div_name,form_name,hotel_package_details){
    return ajax_renewal_package_Function(get_form_elements_detail(form_name) , div_name);
}


function delete_div_content(div_name) {
    document.getElementById(div_name).innerHTML ="";
    //return false;
}

//jquery dropdown language main anim
var jmenu={
    effect: 'fade',           /* default animation effect */
    duration: 400,         /* default duration */
    set: function (settings)
    {
       try
        {
            if (settings.animation == 'show') { this.effect='show'; }
            if (settings.animation == 'slide') { this.effect='slide'; }
            if (settings.animation == 'fade') { this.effect='fade'; }
        } catch (e) {}
        
        try
        {
            this.duration=settings.duration;
        } catch (e) {} 
    },
    fix_pos:function(elem)
    {
        if ($(elem).parent('ul').parent('li').length)
        {
            $(elem).children('ul').eq(0).css({marginTop:0});
        } else
        {
            $(elem).children('ul').eq(0).css({'top':25});
        }
    },
    show:function(elem)
    {
        if (this.effect=='fade') { $(elem).children('ul').eq(0).stop(1,1).fadeIn(this.duration); }
        else if (this.effect=='slide') {$(elem).children('ul').eq(0).stop(1,1).slideDown(this.duration); }
        else if (this.effect=='show') { $(elem).children('ul').eq(0).stop(1,1).show(this.duration); }
    },
    hide: function(elem)
    {
        $(elem).children('ul').eq(0).stop(1,1).fadeOut(100);
    }
}

jQuery.fn.jmenu=function(settings)
{
    jmenu.set(settings);
    
    $(this).find('li').each(function()
    {
            $(this).hover(
                function()
                {
                    jmenu.fix_pos(this);
                    jmenu.show(this);
                },
                function()
                {
                    jmenu.hide(this);
                }
            );
    });
}
//eof jquery main anim


function switchContentlanguage(language){
 var tableau = document.getElementsByName("contenu_lang[]");
 	for(var i=0;i < tableau.length;i++){
		var id = tableau[i].id;
		if(id==language){
			document.getElementById(id).style.display='block';
		}else{
			document.getElementById(id).style.display='none';
		}
	}
}
