function togglecheckbox(){
	if (document.forms['fdz_myform'].elements['subject'][0].checked){
	document.forms['fdz_myform'].elements['entercomp'].checked = false;
	document.forms['fdz_myform'].elements['entercomp'].disabled=true;
	}else{
	document.forms['fdz_myform'].elements['entercomp'].disabled = false;	
	}
}

function checkmail(){
if (checkEmail(document.getElementById('myemail').value) == false){
alert("Please enter a valid email address.")
document.getElementById('myemail').select()
return false;
}
return true;
}

function clearForm() {
	document.getElementById('myemail').value = "";
}

var errorMessage = "";

function validateForm() {
if (document.getElementById('name').value == ''){
	errorMessage += "Name field is required\n";
}

if (document.getElementById('email').value == '') {
	errorMessage += "Email address field is required\n";
}else{
	if (checkEmail(document.getElementById('email').value) == false) {
		errorMessage += "Email address field does not contain a valid email address\n";
	}
}
//show area message area

	if (errorMessage == '') {
		return true;
	} else {
		alert(errorMessage);
		errorMessage = "";
		return false;
	}
}

//check for null values

function trim(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}

function checkEmail(str) {
		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   //alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    
		    return false
		 }

 		 return true					
	}
	
	function hideLayer(whichLayer) {
	var oDiv = findObj(whichLayer);
	if (oDiv) {
		if (oDiv.style) {
			oDiv = oDiv.style;
		}
		oDiv.display = 'none';
	} else {
		alert('Couldn\'t find object '+whichLayer);
	}
}
function showLayer(whichLayer) {
	var oDiv = findObj(whichLayer);
	scroll(0,0);
	if (oDiv) {
		if (oDiv.style) {
			oDiv = oDiv.style;
		}
		oDiv.display = 'block';
	} else {
		alert('Couldn\'t find object '+whichLayer);
	}
}
function findObj(theObj, theDoc) {
	var p, i, foundObj;
	if (!theDoc) {
		theDoc = document;
	}
	if ((p=theObj.indexOf("?"))>0 && parent.frames.length) {
		theDoc = parent.frames[theObj.substring(p+1)].document;
		theObj = theObj.substring(0, p);
	}
	if (!(foundObj=theDoc[theObj]) && theDoc.all) {
		foundObj = theDoc.all[theObj];
	}
	for (i=0; !foundObj && i<theDoc.forms.length; i++) {
		foundObj = theDoc.forms[i][theObj];
	}
	for (i=0; !foundObj && theDoc.layers && i<theDoc.layers.length; i++) {
		foundObj = findObj(theObj, theDoc.layers[i].document);
	}
	if (!foundObj && document.getElementById) {
		foundObj = document.getElementById(theObj);
	}
	return foundObj;
}
