function validate_required(field,alerttxt)
{
with (field)
  {
  if (value==null||value=="")
    {
    alert(alerttxt);return false;
    }
  else
    {
    return true;
    }
  }
}
function validate_email(field,alerttxt)
{
with (field)
  {
  apos=value.indexOf("@");
  dotpos=value.lastIndexOf(".");
  if (apos<1||dotpos-apos<2)
    {alert(alerttxt);return false;}
  else {return true;}
  }
}

function validate_form(thisform)
{
with (thisform)
  {
  if (validate_required(name,"Name must be filled out!")==false)
  {name.focus();return false;}
  }
  
  with (thisform)
  {
  if (validate_email(email,"Not a valid e-mail address!")==false)
    {email.focus();return false;}
  }
  
 with (thisform)
  {
  if (validate_required(address,"Address must be filled out!")==false)
  {address.focus();return false;}
  }
  
   with (thisform)
  {
  if (validate_required(phone,"Phone must be filled out!")==false)
  {phone.focus();return false;}
  }
  
   with (thisform)
  {
  if (validate_required(message,"Message Code must be filled out!")==false)
  {message.focus();return false;}
  }   
}






function quote_form(thisform)
{
with (thisform)
  {
  if (validate_required(name,"Name must be filled out!")==false)
  {name.focus();return false;}
  }
  with (thisform)
  {
  if (validate_required(name,"lname must be filled out!")==false)
  {lname.focus();return false;}
  }
  
  with (thisform)
  {
  if (validate_email(email,"Not a valid e-mail address!")==false)
    {email.focus();return false;}
  }
  
  with (thisform)
  {
  if (validate_required(phone,"Phone must be filled out!")==false)
  {phone.focus();return false;}
  }
   
}










function validate_formg(thisform)
{
with (thisform)
  {
  if (validate_requiredg(name,"Name must be filled out!")==false)
  {name.focus();return false;}
  }
  
    
  
  with (thisform)
  {
  if (validate_requiredg(username,"Location must be filled out!")==false)
  {username.focus();return false;}
  }
  
  
   with (thisform)
  {
  if (validate_email(email,"Not a valid e-mail address!")==false)
    {email.focus();return false;}
  }

   with (thisform)
  {
  if (validate_requiredg(password,"Password must be filled out!")==false)
  {password.focus();return false;}
  }
  
  
     with (thisform)
  {
  if (validate_requiredg(repassword,"Confirm password must be filled out!")==false)
  {repassword.focus();return false;}
  }
  
    
  
   with (thisform)
  {
  if (validate_requiredg(security_code,"security_code must be filled out!")==false)
  {security_code.focus();return false;}
  } 
 }



function validate_form5(thisform)
{
    with (thisform)
  {
  if (validate_email(email,"Not a valid e-mail address!")==false)
    {email.focus();return false;}
  }

 
 }






function Show(div1,div2,div3)
{
	var theDiv1 = document.getElementById(div1);
	var theDiv2 = document.getElementById(div2);
	
	
	if (theDiv1.style.display == 'none') {
		theDiv1.style.display = 'block';	
		theDiv2.style.display = 'none';
		
	}
}


function MM_swapImage() 
	{ //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
   }
 

var tblId;

function tableOver(tblId)
{
	var o1 = document.getElementById(tblId);
	o1.className = "tablerollover ";
}

function tableOut(tblId)
{
	var o1 = document.getElementById(tblId);
	o1.className = "tablerollout ";
}


function ShowHome(div)
{
	var theDiv = document.getElementById(div);
	
	if (theDiv.style.display == 'none') {
		theDiv.style.display = 'block';	
	} else

		theDiv.style.display = 'none';
}

function PostNewTopic(div,div2)
{
	var theDiv = document.getElementById(div);
	var theDiv2 = document.getElementById(div2);
	
	if (theDiv2.style.display == 'none') {
		theDiv2.style.display = 'block';
	} else
		theDiv.style.display = 'block';
		theDiv2.style.display = 'none';
}

function AddForumComment(div,div2)
{
	var theDiv = document.getElementById(div);
	var theDiv2 = document.getElementById(div2);
	
	if (theDiv2.style.display == 'none') {
		theDiv2.style.display = 'block';
	} else
		theDiv.style.display = 'block';
		theDiv2.style.display = 'none';
}

function confirmForumPostLogin()
{
	if (confirm('Please login your ASB Web Design Account for post new Comment. If you want to go login page, click ok')) {
		window.location.href = 'login.php';
	}
}

function confirmForumViewLogin()
{
	if (confirm('Please login your ASB Web Design Account for post new Comment. If you want to go login page, click ok')) {
		window.location.href = 'login.php';
	}
}
