/**
 * @author Ben J Walker, Resound Design 2008
 * 
 */

function validate_purchase_form()
{

	
    valid = true;

    if ( document.purchase_form.name.value == "" || document.purchase_form.email.value == "" || document.purchase_form.phone.value == "" )
    {
        
        valid = false;
    }   


	apos = document.purchase_form.email.value.indexOf("@");
	dotpos = document.purchase_form.email.value.lastIndexOf(".");
	
	
	if (document.purchase_form.email.value != "")
	{
		if (apos < 1 || dotpos - apos < 2) {
			valid = false;
		}
	}

	if(valid == false)
	{
		alert ( "Please make sure all fields marked with * are complete and valid." );
	}
    
    
   // showLoader(valid);
    
    
    return valid;
}

function validate_purchase_form_temp()
{

	
    valid = true;

    if ( document.purchase_form.name.value == "" || document.purchase_form.email.value == "" || document.purchase_form.phone.value == "" )
    {
        
        valid = false;
    }   

    if (document.purchase_form.include_cd.checked == 1)
	{
		if ( document.purchase_form.postal_address.value == "" )
		{
			valid = false;
		}
		
	}

	apos = document.purchase_form.email.value.indexOf("@");
	dotpos = document.purchase_form.email.value.lastIndexOf(".");
	
	
	if (document.purchase_form.email.value != "")
	{
		if (apos < 1 || dotpos - apos < 2) {
			valid = false;
		}
	}

	if(valid == false)
	{
		alert ( "Please make sure all fields marked with * are complete and valid." );
	}
    
    
   // showLoader(valid);
    
    
    return valid;
}

function validate_search_form()
{

	
    valid = true;

    if ( document.search_form.phrase.value == "Search Products..." || document.search_form.phrase.value == "" || document.search_form.phrase.value == " " )
    {
        
        valid = false;
    }   

	if(valid == false)
	{
		alert ( "You didn't type anything in the search box." );
	}
    
    
   // showLoader(valid);
    
    
    return valid;
}

function validate_contact_form ( )
{
    valid = true;

    if ( document.contact_form.name.value == "" || document.contact_form.message.value == "" || document.contact_form.email.value == "" || document.contact_form.captcha_code.value == "" )
    {
        alert ( "Please make sure all details marked with * are complete." );
        valid = false;
    }   
   
    
    return valid;
}

function showTab(div_id)
{
	document.getElementById("overview").style.display = 'none';	
	document.getElementById("features").style.display = 'none';	
	document.getElementById("sysreqs").style.display = 'none';	
	
	document.getElementById("overview_tab").setAttribute("class", ""); 			
	document.getElementById("features_tab").setAttribute("class", ""); 			
	document.getElementById("sysreqs_tab").setAttribute("class", ""); 					
	
	tab_id = div_id + "_tab";

	document.getElementById(div_id).style.display = 'block';	
	document.getElementById(tab_id).setAttribute("class", "selected"); 		

}
