﻿
function sortcols() 
{

    try
    {
        P7_equalCols2(0,'MainLeft','P','rhContent','P');
    }
    catch(err) 
    {
    }


}

function showHeardMoreInfoBox() 
{
    document.getElementById('contactControl_tbxHowHeardMoreInfo').style.display = '';
}



function sendContactForm(sender,args)
{
    // send the form
    var xmlstring = "";
    xmlstring += "<sendContactForm>";

    var ddlTitle = document.getElementById('contactControl_ddlTitle').value;
    var tbxFirstName = document.getElementById('contactControl_tbxFirstName').value;
    var tbxSurname = document.getElementById('contactControl_tbxSurname').value;
    var tbxAddress = document.getElementById('contactControl_tbxAddress').value;
    var tbxPostCode = document.getElementById('contactControl_tbxPostCode').value;

    var tbxDayTel = document.getElementById('contactControl_tbxDayTel').value;
    var tbxEmail = document.getElementById('contactControl_tbxEmail').value;


    var radioPreferredContact = '';
    if (document.getElementById('contactControl_radioPreferredContact_0').checked = true) 
    {
        radioPreferredContact = document.getElementById('contactControl_radioPreferredContact_0').value;
     }
     if (document.getElementById('contactControl_radioPreferredContact_1').checked = true) {
         radioPreferredContact = document.getElementById('contactControl_radioPreferredContact_1').value;
     }
     if (document.getElementById('contactControl_radioPreferredContact_2').checked = true) {
         radioPreferredContact = document.getElementById('contactControl_radioPreferredContact_2').value;
     }
    
    var ddlFirstProperty = document.getElementById('contactControl_ddlFirstProperty').value;
    var ddlSecondProperty = document.getElementById('contactControl_ddlSecondProperty').value;
    var ddlNightsStay = document.getElementById('contactControl_ddlNightsStay').value;

    var tbxPreferredStart = document.getElementById('contactControl_tbxPreferredStart').value;
    var tbxPreferredEnd = document.getElementById('contactControl_tbxPreferredEnd').value;
    var ddlSizeOfGroup = document.getElementById('contactControl_ddlSizeOfGroup').value;

    var tbxSpecRequirements = document.getElementById('contactControl_tbxSpecRequirements').value;
    var ddlHowDidYouHear = document.getElementById('contactControl_ddlHowDidYouHear').value;
    var tbxHowHeardMoreInfo = document.getElementById('contactControl_tbxHowHeardMoreInfo').value;

    var tbxPrefLocations = document.getElementById('contactControl_tbxPrefLocations').value;
    var cbxAgree = document.getElementById('contactControl_cbxAgree').checked;




    var innerxmlstring = "";

    innerxmlstring += "<ddlTitle>" + ddlTitle + "</ddlTitle>";
    innerxmlstring += "<tbxFirstName>"+tbxFirstName+"</tbxFirstName>";
    innerxmlstring += "<tbxSurname>"+tbxSurname+"</tbxSurname>";
    innerxmlstring += "<tbxAddress>"+tbxAddress+"</tbxAddress>";
    innerxmlstring += "<tbxPostCode>"+tbxPostCode+"</tbxPostCode>";
    
    innerxmlstring += "<tbxDayTel>"+tbxDayTel+"</tbxDayTel>";
    innerxmlstring += "<tbxEmail>"+tbxEmail+"</tbxEmail>";
    
    innerxmlstring += "<radioPreferredContact>"+radioPreferredContact+"</radioPreferredContact>";
    innerxmlstring += "<ddlFirstProperty>"+ddlFirstProperty+"</ddlFirstProperty>";
    innerxmlstring += "<ddlSecondProperty>"+ddlSecondProperty+"</ddlSecondProperty>";
    innerxmlstring += "<ddlNightsStay>"+ddlNightsStay+"</ddlNightsStay>";
    
    innerxmlstring += "<tbxPreferredStart>"+tbxPreferredStart+"</tbxPreferredStart>";
    innerxmlstring += "<tbxPreferredEnd>"+tbxPreferredEnd+"</tbxPreferredEnd>";
    innerxmlstring += "<ddlSizeOfGroup>"+ddlSizeOfGroup+"</ddlSizeOfGroup>";    
        
    innerxmlstring += "<tbxSpecRequirements>"+tbxSpecRequirements+"</tbxSpecRequirements>";
    innerxmlstring += "<ddlHowDidYouHear>"+ddlHowDidYouHear+"</ddlHowDidYouHear>";
    innerxmlstring += "<tbxHowHeardMoreInfo>" + tbxHowHeardMoreInfo + "</tbxHowHeardMoreInfo>";
    innerxmlstring += "<tbxPrefLocations>"+tbxPrefLocations+"</tbxPrefLocations>";
    innerxmlstring += "<cbxAgree>" + cbxAgree + "</cbxAgree>";

    
    xmlstring += innerxmlstring;
    xmlstring += "</sendContactForm>";
    var button = document.getElementById('btnSubmit');
    button.disabled = true;
    button.value = 'sending info....';
    
    //debugger

    ret = PageService.sendContactForm(xmlstring, OnSendContactFormComplete, OnWebServiceTimeOut, OnWebServiceError);
}


function OnSendContactFormComplete(args) {
            
    var button = document.getElementById('btnSubmit');

    if (args = 'true') 
    {
        button.value = 'Form Sent Successfully.... Thank you';
        //alert(args);
    }
    else 
    {
        button.value = 'There was a problem sending the form';
    }
}


function OnWebServiceComplete(arg) {
    alert("Generic OnWebServiceComplete");
}

function OnWebServiceTimeOut(arg) {
    alert("TimeOut encountered : " + arg);
}

function OnWebServiceError(arg) {
    alert("Error encountered : " + arg);
}


function viewlocation(locationID) {
    alert('this would show location for ID = ' + +locationID);
}