﻿

var XmlHttp;

//Creating and setting the instance of appropriate XMLHTTP Request object to a “XmlHttp” variable  
function CreateXmlHttp() {
    //Creating object of XMLHTTP in IE
    try {
        XmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch (e) {
        try {
            XmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
        catch (oc) {
            XmlHttp = null;
        }
    }
    //Creating object of XMLHTTP in Mozilla and Safari 
    if (!XmlHttp && typeof XMLHttpRequest != "undefined") {
        XmlHttp = new XMLHttpRequest();
    }
}

//Returns the node text value 
function GetInnerText(node) {
    return (node.textContent || node.innerText || node.text);
}

//Called when response comes back from server
function HandleResponse() {
    // To make sure receiving response data from server is completed	
    if (XmlHttp.readyState == 4)
     {	// To make sure valid response is received from the server, 200 means response received is OK
        if (XmlHttp.status == 200)
        { 
                //SetProductBySeriesId(XmlHttp.responseXML.documentElement)
                if(XmlHttp.responseText=="Sucess")
                {
                     document.getElementById("divMsgBox").style.display = "block"; 
                }
                else
                {
                
                }
        }
        else 
        {
            alert("There was a problem retrieving data from the server.");
        }
    }
}
 

function SendQuestionaire(siteurl,firstName,businesName,email,phonenumber,comments) 
{
    //var requestUrl = SiteMainURL + "GetAjaxData.aspx?AjaxSeriesId=" + encodeURIComponent(SeriesId);
    //var requestUrl = "http://localhost/testsite/WebDesignQuestionnaireSendMail.aspx?hotelName=test";
    
    var requestUrl = siteurl +  "SendMailr.aspx?firstName=" + encodeURIComponent(firstName) + "&businesName=" + encodeURIComponent(businesName) + "&email=" + encodeURIComponent(email)+ "&Phone=" + encodeURIComponent(phonenumber)
        + "&Comments=" + encodeURIComponent(comments) ;
    
    CreateXmlHttp();
    // If browser supports XMLHTTPRequest object
    if (XmlHttp) {
        //Setting the event handler for the response
        XmlHttp.onreadystatechange = HandleResponse;

        //Initializes the request object with GET (METHOD of posting), 
        //Request URL and sets the request as asynchronous.
        XmlHttp.open("GET", requestUrl, true);

        //Sends the request to server
        XmlHttp.send(null);
 }
    
    }
    function SendStart(siteurl,firstName, LastName, title, email, phonenumber,faxnumber,businesName,website,address,city,state,zip,know,comments) 
{
    //var requestUrl = SiteMainURL + "GetAjaxData.aspx?AjaxSeriesId=" + encodeURIComponent(SeriesId);
    //var requestUrl = "http://localhost/testsite/WebDesignQuestionnaireSendMail.aspx?hotelName=test";
    
    var requestUrl = siteurl +  "SendMail.aspx?firstName=" + encodeURIComponent(firstName)+ "&LastName=" + encodeURIComponent(LastName) + "&title=" + encodeURIComponent(title) + "&email=" + encodeURIComponent(email)+ "&phonenumber=" + encodeURIComponent(phonenumber)
        +"&faxnumber=" + encodeURIComponent(faxnumber) +"&businesName=" + encodeURIComponent(businesName) +"&website=" + encodeURIComponent(website)
        +"&address=" + encodeURIComponent(address)  +"&city=" + encodeURIComponent(city)+"&state=" + encodeURIComponent(state)
       +"&zip=" + encodeURIComponent(zip)  +"&know=" + encodeURIComponent(know)
         +"&comments=" + encodeURIComponent(comments) ;
    
    CreateXmlHttp();
    // If browser supports XMLHTTPRequest object
    if (XmlHttp)
     {
        //Setting the event handler for the response
        XmlHttp.onreadystatechange = HandleResponse;

        //Initializes the request object with GET (METHOD of posting), 
        //Request URL and sets the request as asynchronous.
        XmlHttp.open("GET", requestUrl, true);

        //Sends the request to server
        XmlHttp.send(null);
    }
    }
    
    function SendQuestionaire(siteurl,firstName,businesName,email,phonenumber,comments) 
{
    //var requestUrl = SiteMainURL + "GetAjaxData.aspx?AjaxSeriesId=" + encodeURIComponent(SeriesId);
    //var requestUrl = "http://localhost/testsite/WebDesignQuestionnaireSendMail.aspx?hotelName=test";
    
    var requestUrl = siteurl +  "SendMail.aspx?firstName=" + encodeURIComponent(firstName) + "&businesName=" + encodeURIComponent(businesName) + "&email=" + encodeURIComponent(email)+ "&Phone=" + encodeURIComponent(phonenumber)
        + "&Comments=" + encodeURIComponent(comments) ;
    
    CreateXmlHttp();
    // If browser supports XMLHTTPRequest object
    if (XmlHttp) {
        //Setting the event handler for the response
        XmlHttp.onreadystatechange = HandleResponse;

        //Initializes the request object with GET (METHOD of posting), 
        //Request URL and sets the request as asynchronous.
        XmlHttp.open("GET", requestUrl, true);

        //Sends the request to server
        XmlHttp.send(null);
 }
    
    }
     



 