﻿// JScript File

function SendEmail(){
         msg = "<div><span><b>Name : " + $("#txtName").val() + "</b></span></div><br />";
         msg = msg+"<div><span><b>Email : " + $("#txtEmail").val() + "</b></span></div><br />";         
         msg = msg+"<div><span><b>Mobile : " + $("#txtMobile").val()+"</b></span></div><br/>";
         if(!IsEmpty($("#txtRemarks").val()))         {
           msg=msg+"<div><span><b>Remarks : " + $("#txtRemarks").val()+"</b></span></div><br/>";
         }
     $("#hdSendEmail").val("true");
     $("#hdMessage").val(msg);
     $("#hdSubject").val("Request For  Services");
     $("#hdFrom").val($("#txtEmail").val());
     $("#form1").submit();
    } 
    
    function Validation(){   
             if(IsEmpty($("#txtName").val())){
                 ShowError("Please enter Name");
                 $("#txtName").focus();
                 return false;
            }           
           if(IsEmpty($("#txtEmail").val())){
               ShowError("Please enter Email");
               $("#txtEmail").focus();
                 return false;
            }            
           if(!IsValidEmailId($("#txtEmail").val()))
            {
                ShowError("Invalid Email Id");
                $("#txtEmail").focus();
              return false;
            }
            if(IsEmpty($("#txtMobile").val()))
            {
              ShowError("Please enter Mobile No");
               $("#txtMobile").focus();
                 return false;
            } 
            if(!IsValidPhoneNo($("#txtMobile").val()))  
            {
               ShowError("Invalid Mobile No");
                $("#txtMobile").focus();
              return false;
            }   			
            $('#errorBlock').attr("style", "display:none;color:Red;");
            SendEmail();            
        }
    
    function ShowError(str)
    {
        $('#errorBlock').attr("style", "display:inline;color:Red;");
            $('#errorBlock').html(str);
    }                
    
    $(document).ready(function() {
        hu = window.location.search.substring(1);
        s="";
        if(!IsEmpty(hu))
        {
            gy = hu.split("&");
            if(gy.length>0){
                ft = gy[0].split("="); 
                if(ft[1]=="true")
                {
                    s="Email Sent Successfully";
                }
                else
                {
                    s="Email Could not send right now";
                }
                $('#errorBlock').attr("style", "display:inline;color:Red;");   
            $('#errorBlock').html(s);    
            }
        }
 });
