 

    // unblock when ajax activity stops 

    $().ajaxStop($.unblockUI); 

 

    function test(){ 
        $.ajax({url:'wait.php',cache: false }); 
    } 

 

    $(document).ready(function() { 

        $('#pageDemo1').click(function() { 

            $.blockUI(); 

            test(); 

        }); 

        $('#pageDemo2').click(function() { 

            $.blockUI({ message: '<h1><img src="busy.gif" /> Just a moment...</h1>' }); 

            test(); 

        }); 

        $('#pageDemo3').click(function() { 

            $.blockUI({ css: { backgroundColor: '#f00', color: '#fff' } }); 

            test(); 

        }); 

 

        $('#contactbutton').click(function() { 

            $.blockUI({ message: $('#contact') }); 

            test(); 

        }); 

    }); 

 

function validateQuickContactForm(){
	var er=0;
	
	if(er == 0 && document.getElementById('email').value == ''){
		document.getElementById('showError').innerHTML="Email is blank";
		document.getElementById('email').style.borderColor="red";
		er=1;
	}else{
		document.getElementById('email').style.borderColor="#C3C3C3";
	}
	
	
	if(er == 0){			
		dd=validateEmail(document.getElementById('email').value);
		if(dd == false){
			er=1;	
			document.getElementById('showError').innerHTML="Invalid Email";
			document.getElementById('email').style.borderColor="red";
		}				
	}
		
		
	
	if(er == 0 && document.getElementById('captchaText').value == ''){
		document.getElementById('showError').innerHTML="Enter the text as it is shown in the box";
		document.getElementById('captchaText').style.borderColor="red";
		er=1;
	}else{
		document.getElementById('captchaText').style.borderColor="#C3C3C3";
	}
	
	if(er == 0)
		return true; 
	else
		return false;
		
	
	
}




function validateEmail (str) {
		
		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   //alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   //alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    //alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		   // alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    //alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		   // alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		   // alert("Invalid E-mail ID")
		    return false
		 }

 		 return true					
}