﻿function CheckFormKontakt( theform )
{
	var bMissingFields = false;
	var strFields = "";
	
	if( theform.meno.value == '' ){
		bMissingFields = true;
		strFields += "     Meno\n";
	}
	if( theform.email.value == '' ){
		bMissingFields = true;
		strFields += "     Email\n";
	}
	if( theform.odkaz.value == '' ){
		bMissingFields = true;
		strFields += "     Odkaz\n";
	}

	if( bMissingFields ) {
		alert( "Pred odoslaním formulára je potrebné vyplniť naseldujúce položky:\n" + strFields );
		return false;
	}
	
	return true;
}

function CheckFormQuote( theform )
{
	var bMissingFields = false;
	var strFields = "";
	
	if( theform.name.value == '' ){
		bMissingFields = true;
		strFields += "     Your Name\n";
	}
	if( theform.email.value == '' ){
		bMissingFields = true;
		strFields += "     Your Email\n";
	}	
	
	if( theform.description.value == '' ){
		bMissingFields = true;
		strFields += "     Project Description\n";
	}	

	if( bMissingFields ) {
		alert( "We are sorry, but you must provide the following field(s) before continuing:\n" + strFields );
		return false;
	}
	
	return true;
}


function CheckFormRegister( theform )
{
	var bMissingFields = false;
	var strFields = "";
	
	if( theform.user.value == '' ){
		bMissingFields = true;
		strFields += "     Username\n";
	}
	if( theform.pass.value == '' ){
		bMissingFields = true;
		strFields += "     Password\n";
	}
	if( theform.forename.value == '' ){
		bMissingFields = true;
		strFields += "     Forename\n";
	}
	if( theform.surname.value == '' ){
		bMissingFields = true;
		strFields += "     Surname\n";
	}
	if( theform.email.value == '' ){
		bMissingFields = true;
		strFields += "     Email\n";
	}
	if( theform.company.value == '' ){
		bMissingFields = true;
		strFields += "     Company\n";
	}
	if( theform.location.value == '' ){
		bMissingFields = true;
		strFields += "     Location\n";
	}		
        if( theform.terms.checked == false) {
                              bMissingFields = true;
                              strFields += "     Agree To Terms and Conditions\n";
        }
              
	if( bMissingFields ) {
		alert( "We are sorry, but you must provide the following field(s) before continuing:\n" + strFields );
		return false;
	}
	
	return true;
}


function CheckFormPostAdvert( theform )
{
	var bMissingFields = false;
	var strFields = "";
	
	if( theform.n_title.value == '' ){
		bMissingFields = true;
		strFields += "     Advert Title\n";
	}

	if( theform.n_location.value == '' ){
		bMissingFields = true;
		strFields += "     Advert Location\n";
	}

	if( theform.n_type.value == '' ){
		bMissingFields = true;
		strFields += "     Forum\n";
	}

	if( theform.n_cat_title.value == '' ){
		bMissingFields = true;
		strFields += "     Advert Category\n";
	}

	if( theform.n_desc.value == '' ){
		bMissingFields = true;
		strFields += "     Advert Text\n";
	}

	if( bMissingFields ) {
		alert( "We are sorry, but you must provide the following field(s) before continuing:\n" + strFields );
		return false;
	}
	
	return true;
}

function CheckFormPostMessage( theform )
{
	var bMissingFields = false;
	var strFields = "";
	
	if( theform.odkaz.value == '' ){
		bMissingFields = true;
		strFields += "you forgot to type in your message!\n";
	}

	if( bMissingFields ) {
		alert( "We are sorry, but " + strFields );
		return false;
	}
	
	return true;
}

function CheckFormPayments( theform )
{
	var bMissingFields = false;
	var strFields = "";
	
	if( theform.amount.value == '' ){
		bMissingFields = true;
		strFields += "     Amount To be Paid\n";
	}
	if( theform.item_name.value == '' ){
		bMissingFields = true;
		strFields += "     Order Reference or Payment Description\n";
	}

	if( bMissingFields ) {
		alert( "We are sorry, but you must provide the following field(s) before continuing:\n" + strFields );
		return false;
	}
	
	return true;
}

function CheckFormNhs(theForm) {
	if (
	theForm.paying.checked == false &&
	theForm.ex_a.checked == false &&
	theForm.ex_b.checked == false &&
	theForm.ex_c.checked == false &&
	theForm.ex_d.checked == false &&
	theForm.ex_e.checked == false &&
	theForm.ex_f.checked == false &&
	theForm.ex_g.checked == false &&
	theForm.ex_l.checked == false &&
	theForm.ex_x.checked == false &&
	theForm.ex_h.checked == false &&
	theForm.ex_k.checked == false &&
	theForm.ex_m.checked == false &&
	theForm.ex_s.checked == false) 
	{
		alert ('You didn\'t choose any of the checkboxes!');
		return false;
	} else { 	
		return true;
	}
}



