function SubmitCheckBlogPost(){
  if (document.myform.bName.value==""){
    alert("Your name is required.");
    document.myform.bName.focus();
    return false;
  }
  if (document.myform.bCategory.value==999){
    alert("Please select a category");
    document.myform.bCategory.focus();
    return false;
  } 

  if (!emailValidate2('myform','bEmail'))
  {
    document.myform.bEmail.focus();
    return false;
  }

  if (document.myform.bTitle.value==""){
    alert("Please provide text for the blog title.");
    document.myform.bTitle.focus();
    return false;
  }  
  if (document.myform.bDescription.value==""){
    alert("Please provide the blog description.");
    document.myform.bDescription.focus();
    return false;
  }  
}

function SubmitCheckBlogPostComment(){
  if (document.myform.bName.value==""){
    alert("Your name is required.");
    document.myform.bName.focus();
    return false;
  }
  if (!emailValidate2('myform','bEmail'))
  {
    document.myform.bEmail.focus();
    return false;
  }
  if (document.myform.bDescription.value==""){
    alert("Please provide the blog description.");
    document.myform.bDescription.focus();
    return false;
  }  
}

function checkContactForm(){
  if (document.forms[0].tName.value==""){
    alert("Your name is required.");
    document.forms[0].tName.focus();
    return false;
  }
  if (!emailValidate2('myform','tEmail'))
  {
    document.forms[0].tEmail.focus();
    return false;
  }
  if (document.forms[0].tComment.value==""){
    alert("Please provide your comment/question.");
    document.forms[0].tComment.focus();
    return false;
  }  
}

/**
 * DHTML email validation script. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/)
 */
function emailValidate(form_id,email) {
   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   var address = document.forms[form_id].elements[email].value;
   if(reg.test(address) == false) {
      alert('Please provide a valid email address');
      return false;
   }
}
function emailValidate2(form_id,email) {
   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   var address = document.forms[form_id].elements[email].value;
   if(reg.test(address) == false) {
	  alert('Please provide a valid email address');	   
      return false;
   } else {
		return true;   
   }
}
function echeck(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					
}

