// JavaScript Document
function check_reg_form(){
	var hows=document.sda_reg_form.how;
	for(var i=0;i<hows.length;i++){
		if(hows[i].checked==true){
			var how=hows[i].value;
		}
	}
	if((document.sda_reg_form.uname.value=="")||(document.sda_reg_form.pass.value=="")||(document.sda_reg_form.repass.value=="")||(document.sda_reg_form.title.value=="")||(document.sda_reg_form.fname.value=="")||(document.sda_reg_form.sname.value=="")||(document.sda_reg_form.designation.value=="")||(document.sda_reg_form.addr.value=="")||(document.sda_reg_form.office.value=="")||(document.sda_reg_form.mobile.value=="")||(document.sda_reg_form.email.value=="")||(document.sda_reg_form.website.value=="")||(document.sda_reg_form.services.value=="")){
		window.alert("Please fill out all of the fields.");
		return false;
	}
	if(document.sda_reg_form.declare.value!="on"){
		window.alert("Please declare the accuracy of your submission by ticking the appropriate box.");
		return false;
	}
	if(document.sda_reg_form.pass.value!==document.sda_reg_form.repass.value){
		window.alert("The password fields do not match.");
		return false;
	}
	if((how=="others")&&(document.sda_reg_form.how_others.value=="")){
		window.alert("Please type how you heard about the award.");
		return false;
	}
	
	return true;
}

function check_login(){
	if((document.sda_login_form.uname.value=="")||(document.sda_login_form.pass.value=="")){
		window.alert("Please type your username and password");
		return false;
	}
	return true;
}

function check_edit_form(){
	if((document.sda_edit_form.title.value=="")||(document.sda_edit_form.client.value=="")||(document.sda_edit_form.challenge.value=="")||(document.sda_edit_form.solution.value=="")){
		window.alert("Please fill out all of the fields.");
		return false;
	}
	return true;
}

function check_add_form(){
	if((document.sda_add_form.title.value=="")||(document.sda_add_form.client.value=="")||(document.sda_add_form.challenge.value=="")||(document.sda_add_form.solution.value=="")){
		window.alert("Please fill out all of the fields.");
		return false;
	}
	return true;
}

function check_dd_reg(){
	if((document.dd_reg.uname.value=='')||(document.dd_reg.company.value=='')||(document.dd_reg.email.value=='')||(document.dd_reg.ph.value=='')){
		window.alert("Please fill out all of the required fields.");
		return false;
	}
	
	var fs=document.dd_reg.fsession;
	for(var i=0;i<fs.length;i++){
		if(fs[i].checked==true){
			var fsession=fs[i].value;
		}
	}
	
	var ss=document.dd_reg.ssession;
	for(var j=0;j<ss.length;j++){
		if(ss[j].checked==true){
			var ssession=ss[j].value;
		}
	}
	var ts=document.dd_reg.tsession;
	for(var k=0;k<ts.length;k++){
		if(ts[k].checked==true){
			var tsession=ts[k].value;
		}
	}
	if(fsession==ssession){
		if(fsession!=0){
			window.alert("Please select a different company for each session!");
			return false;
		}
	}
	if(fsession==tsession){
		if(fsession!=0){
			window.alert("Please select a different company for each session!");
			return false;
		}
	}
	if(tsession==ssession){
		if(tsession!=0){
			window.alert("Please select a different company for each session!");
			return false;
		}
	}
	
	return true;
}
	
	
