﻿function IsLen(fld, minlen, maxlen, msg)
{
    if(fld.value.length < minlen || fld.value.length > maxlen)
    {
        alert(msg);
        fld.focus();
        return false;
    }
    return true;
}
function IsInt(fld,msg)
{
    var regex = /^[0-9]*$/;
    if(!regex.test(fld.value))
    {
        alert(msg);
        fld.focus();
        return false;
    }
    return true;
}
            
            
function showAlert(msg, url) {
    alert(msg); 
    if (url != '') {
        redirectWindow(url);
    }
}

function redirectWindow(url) {
    if (navigator.appName == 'Microsoft Internet Explorer') {
        location.href(url);
    }
    else if (navigator.appName == 'Netscape') {
        window.open(url, '_parent', 1);
        window.close();
    }
}

function deleteRecord(url) {
    if (confirm("Want to delete clicked record?")) {
        redirectWindow(url);
    }
}



    function HideDiv(divId,Url)
    {
       window.setTimeout("closeDiv('"+ divId +"','"+ Url +"');", 1000);
    }
    
    function closeDiv(divId,URL){
    
    document.getElementById(divId).style.display="none";
        if(URL != '')
        {
         window.location.href=URL;
        }
    }
    function Login()
	
		 {
		
		if (document.getElementById("ctl00_Top1_txtEmail").value=='')
		    {
		        alert("E-Mail Address cannot be blank");
		        document.getElementById("ctl00_Top1_txtEmail").focus();
		        return false;
		    }
		   var msg = ''
		    if (document.getElementById("ctl00_Top1_txtEmail").value!='')
	        {
	            regex = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/ //new RegExp(pattern);
	                if (!regex.test(document.getElementById("ctl00_Top1_txtEmail").value))
					        {
						        msg=msg + "Please enter a valid E-Mail Address,\nfor example : \n     yourname@domain.com  OR\n     yourid@yourdomain.co.in  OR\n     yourid.somname@domain.co.in\n "
						        alert(msg);
						        document.getElementById("ctl00_Top1_txtEmail").focus();
						        return false;
					        } 
             }
               
		 if (document.getElementById("ctl00_Top1_txtpwd1").value=='')
		    {
		        alert("Password Cannot be blank");
		        document.getElementById("ctl00_Top1_txtpwd1").focus();
		        return false;
		    }
		    {
		     var btn = document.getElementById("ctl00_Top1_btnLogin");
             btn.click();
		    }
           }

    function Contact()
		   {
		      if (document.getElementById("ctl00_ContentPlaceHolder1_txtname").value=='')
		    {
		        alert("Full Name cannot be blank");
		        document.getElementById("ctl00_ContentPlaceHolder1_txtname").focus();
		        return false;
		    }
		      if (document.getElementById("ctl00_ContentPlaceHolder1_txtphone").value=='')
		    {
		        alert("Phone No. cannot be blank");
		        document.getElementById("ctl00_ContentPlaceHolder1_txtphone").focus();
		        return false;
		    }
		   
		      if (document.getElementById("ctl00_ContentPlaceHolder1_txtemail").value=='')
		    {
		        alert("E-Mail Address cannot be blank");
		        document.getElementById("ctl00_ContentPlaceHolder1_txtemail").focus();
		        return false;
		    }
		   var msg = ''
		    if (document.getElementById("ctl00_ContentPlaceHolder1_txtemail").value!='')
	        {
	            regex = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/ //new RegExp(pattern);
	                if (!regex.test(document.getElementById("ctl00_ContentPlaceHolder1_txtemail").value))
					        {
						        msg=msg + "Please enter a valid E-Mail Address,\nfor example : \n     yourname@domain.com  OR\n     yourid@yourdomain.co.in  OR\n     yourid.somname@domain.co.in\n "
						        alert(msg);
						        document.getElementById("ctl00_ContentPlaceHolder1_txtemail").focus();
						        return false;
					        } 
		    }
		     
		  }
		  function Newsletter() {

		      if (document.getElementById("ctl00_RightCtrl1_txtNewsLetter").value == '') {
		          alert("E-Mail Address cannot be blank");
		          document.getElementById("ctl00_RightCtrl1_txtNewsLetter").focus();
		          return false;
		      }
		      var msg = ''
		      if (document.getElementById("ctl00_RightCtrl1_txtNewsLetter").value != '') {
		          regex = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/ //new RegExp(pattern);
		          if (!regex.test(document.getElementById("ctl00_RightCtrl1_txtNewsLetter").value)) {
		              msg = msg + "Please enter a valid E-Mail Address,\nfor example : \n     yourname@domain.com  OR\n     yourid@yourdomain.co.in  OR\n     yourid.somname@domain.co.in\n "
		              alert(msg);
		              document.getElementById("ctl00_RightCtrl1_txtNewsLetter").focus();
		              return false;
		          }
		      }

		      
		  }
