﻿// JScript File

$(document).ready(function() {


// ...attach an onclick handler to the Divide button.
$("#Submit").click(function() {
   
var request = $("input#request").val(); 
var email = $("input#emailA").val();
var cid= $("input#CID").val();

var finalData= "request=" + request + '&' + "email=" + email + '&' +  "cid=" + cid;
//alert(finalData);

    $.ajax({  
             url: "/APC.NET/root/pages/gallery/SubmitSNFRequest.aspx",
             processData: false,
             data: finalData,
             cache: false,
             type: "GET",
             dataType: "html",
             beforeSend: function(){ return ValidateForm(request,email);  },
             success: AjaxSucceeded,  
             error: AjaxFailed  
             });  
  });
});
          
          function AjaxSucceeded(result) {  
              document.getElementById('SNFFB').style.display = 'none';
              document.getElementById('didyoumeanc').style.display = 'none';
	          document.getElementById('RNI').style.display = 'block';
                            
          }  

          function AjaxFailed(result) {  
              alert(result.status + ' ' + result.statusText);  
          }
          
          function ValidateForm(Request , Email)
          {
           
           if(Request=="" && Email=="")
           { 
        
           $("div#errorMsg").show();
           $("li#email_error").show();
           $("li#Request_error").show();
           return false;  
           }
      
           if(Email=="")
           {
                $("div#errorMsg").show(); 
                $("li#email_error").show();
              //  $("li#Request_error").Hide();    
               document.getElementById('Request_error').style.display = 'none'; 
                return false ;
           }   
        
           if(Request=="")
           {
                $("div#errorMsg").show(); 
                $("li#Request_error").show();    
                //$("li#email_error").Hide(); 
                 document.getElementById('email_error').style.display = 'none'; 
                return false ;
           }   
            
           return true; 
         
          }
           
  
