function validate_login_form()
{
    valid = true;

    if ( document.login_form.username.value == "" || document.login_form.password.value == "")
    {
        alert ( "Please provide both your username and password." );
        valid = false;
    }   
    

    return valid;
}

function validate_forgot_password_form()
{
    valid = true;

    if ( document.forgot_password_form.fpwd_username.value == "" || document.forgot_password_form.fpwd_email.value == "")
    {
        alert ( "Please complete all fields marked with *." );
        valid = false;
    }   

    return valid;
}



function validate_registration_form()
{
    valid = true;

    if ( document.registration_form.username.value == "" || document.registration_form.password.value == "" || document.registration_form.monkey.value == "" || document.registration_form.email.value == "" || document.registration_form.first_name.value == "" || document.registration_form.last_name.value == "" || document.registration_form.dob.value == "")
    {
        alert ( "Please complete all fields marked with *." );
        valid = false;
    }   
    
    if ( document.registration_form.password.value != document.registration_form.monkey.value)
    {
        alert ( "Your passwords do not match." );
        valid = false;
    }   
    

    return valid;
}

function validate_account_form()
{
    valid = true;

    if ( document.account_form.email.value == "" || document.account_form.first_name.value == "" || document.account_form.last_name.value == "" || document.account_form.dob.value == "")
    {
        alert ( "Please complete all fields marked with *." );
        valid = false;
    }   
    

    

    return valid;
}

function validate_comment_form()
{
    valid = true;

    if ( document.comment_form.content.value == "" )
    {
        alert ( "You didn't say anything!" );
        valid = false;
    }   
    

    

    return valid;
}


function validate_contact_form()
{
	
	valid = true;


	if(document.contact_form.contact_name.value == "" || document.contact_form.address.value == "" || document.contact_form.message.value == "")
	{
	    alert("Please complete all fields.");
	    valid = false;
	}
    else if(document.contact_form.message.value.length>400)
    {
		alert ( "Your message must be less than 400 characters." );
		valid = false;
    }
    	

	return valid;

}






function showLogin()
{

	document.getElementById('loginSmall').style.display = 'inline';
		
	document.getElementById('search').style.display = 'none';
	

}

function showSearch()
{

	document.getElementById('loginSmall').style.display = 'none';
	
	//document.getElementById('loginName').style.display = 'none';
	
	document.getElementById('search').style.display = 'inline';
	
	
	//document.getElementById('loginName').style.display = 'none';
	

}

function showSearch_loggedin()
{


	
	//document.getElementById('loginName').style.display = 'none';
	
	document.getElementById('search').style.display = 'inline';
	
	
	//document.getElementById('loginName').style.display = 'none';
	

}

function hideMsg()
{

	//document.getElementById('msgBar').style.display = 'none';

}

function removeMsg()
{

	//if(document.getElementById('msgBar').innerHTML != "")
	//{
	//	document.getElementById('msgBar').style.display = 'block';
	//}
	
	//setTimeout('hideMsg()', 5000);

}

function validate_password_form()
{
    valid = true;

    if ( document.password_form.cur_pwd.value == "" || document.password_form.new_pwd.value == "" || document.password_form.monkey_pwd.value == "" )
    {
        alert ( "Please complete all fields marked with *." );
        valid = false;
    }   
    
    if ( document.password_form.new_pwd.value != document.password_form.monkey_pwd.value)
    {
        alert ( "Your passwords do not match." );
        valid = false;
    }   
    

    return valid;
}

function validate_images_form()
{
    valid = true;

    
    if ( document.images_form.replace_main.checked == 1 )
    {
 	if ( document.images_form.main.value == "" )
 	{
 		alert ( "Please complete all fields marked with *." );
        	valid = false;
 	}
 
    }
    
    
 
   

    return valid;
}



function popup(page)
{
	window.open(page,'newwindow','scrollbars=yes,status=no,width=700,height=500')
}


function logout(name)
{
	if(confirm("Are you sure you want to log out, " + name + "?"))
	{
		location.href = "logout.php?stage=process";
	}

}



