function validate_gig_form()
{

    tinyMCE.triggerSave();

    valid = true;

    if ( document.gig_form.title.value == "" || document.gig_form.start_date.value == "" || document.gig_form.venue.value == "")
    {
        alert ( "Please complete all fields marked with *." );
        valid = false;
    }   
    

    return valid;
}



function validate_page_form()
{

    tinyMCE.triggerSave();

        valid = true;
    
        if ( document.page_form.parent_id.selectedIndex == 1 || document.page_form.title.value == "" || document.page_form.title.value == " " || document.page_form.title.value == "  " )
        {
            alert ( "Please complete all fields marked with *." );
            valid = false;
        }   
        
    
    return valid;
}



function validate_news_form()
{
    
    tinyMCE.triggerSave();
    
    valid = true;

    if ( document.news_form.date.value == "" || document.news_form.title.value == "")
    {
        alert ( "Please complete all fields marked with *." );
        valid = false;
    }   
    

    return valid;
}


function validate_mailing_form()
{
    valid = true;

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

    return valid;
}


function validate_sendall_form()
{

    tinyMCE.triggerSave();

    valid = true;

    if ( document.sendall_form.subject.value == "" )
    {
        alert ( "Please complete all fields marked with *." );
        valid = false;
    }   
    

    return valid;
}


function validate_contactform ( )
{
    valid = true;

    if ( document.contact_form.name.value == "" || document.contact_form.message.value == "" || document.contact_form.email.value == "" )
    {
        alert ( "Please make sure all details marked with * are complete." );
        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 popup(page) 
{
     window.open(page,'newwindow','scrollbars=yes,status=no,width=500,height=350,title="Popup"')
}	


function validate_archive_form()
{


    valid = true;

    if ( document.archive_form.date.value == "" || document.archive_form.title.value == "")
    {
        alert ( "Please complete all fields marked with *." );
        valid = false;
    }   
    

    return valid;
}


function validate_file_form()
{
    
    
    valid = true;

    if (  document.file_form.title.value == "" || document.file_form.file.value == "" || document.file_form.archive_id.selectedIndex == 0 || document.file_form.archive_id.selectedIndex == 1 )
    {
        alert ( "Please complete all fields marked with *." );
        valid = false;
    }   
    

    return valid;
}

function validate_edit_file_form()
{
    
    
    valid = true;

    if (  document.edit_file_form.title.value == "" || document.edit_file_form.archive_id.selectedIndex == 0 || document.edit_file_form.archive_id.selectedIndex == 1 )
    {
        alert ( "Please complete all fields marked with *." );
        valid = false;
    }   
    
    if ( document.edit_file_form.replace.checked == 1 )
    {
 	if ( document.edit_file_form.file.value == "" )
 	{
 		alert ( "Please complete all fields marked with *." );
        	valid = false;
 	}
 
    }    
    

    return valid;
}
