 
 
 
    function checkDestination () {
       
        if (document.getElementById('code').value.length == 0 ) {
            window.alert("Please select one of the Resorts from the dropdown list.");
            return false;
        }
        return true;        
    }
    
    function DoEmailSubscribe(emailAddress){
       // url:    URL to invoke
       // params: string object to pass to the remote URL
    
       // Add some parameters to the query string
       var pageUrl = "Index.aspx?subscribe="+emailAddress;
    
       // Initialize the XmlHttp object
        try {
            //Mozilla Browsers
            //alert("Try the basic one");
            xmlRequest = new XMLHttpRequest();
        } 
        catch (e) {
            try {
                //IE
                xmlRequest = new ActiveXObject("Microsoft.XMLHTTP");
            } 
            catch (e) {
                //Something else that won't work with this code...
                xmlRequest=false;
            }
        } 
        // Post our XmlRequest and get our desired string
        //alert("Go on make the request" + pageUrl);
        xmlRequest.open("GET", pageUrl, false);
        xmlRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        xmlRequest.send(null);
    
        // Return the XmlHttp object
        return xmlRequest;
    }
    
    
    function emailSubscribe(){
    	
        var emailAddress = document.getElementById('txtEmailAddress').value;
        if (isValidEmail(emailAddress)) {
    	    //Get the value of the selected item
    	    var xml = DoEmailSubscribe(emailAddress);
    	    //Place data in a string
    	    var stringData = xml.responseText;
    	   // window.alert("string data:" + stringData);
    	    if (stringData == 'SUCCESS') {
    		 document.getElementById('email_ok_box').style.display = 'block';
    		 document.getElementById('txtEmailAddress').value = "";
    	    }
    	    else if (stringData == 'DUPLICATE') {
    	    		 document.getElementById('email_duplicate_box').style.display = 'block';
    	    		 document.getElementById('txtEmailAddress').value = "";
    	    }
    	    else {
    	    	 document.getElementById('email_fail_box').style.display = 'block';
    	    }
        }
        else {
        	window.alert("Please enter a valid email address.");
        }
    	
    }
    
    function isValidEmail(str) {
       return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
     
}
