
var lastexpanded = "";

function displaysub(div_ref){
	if (lastexpanded!="") {
		Effect.BlindUp(lastexpanded);
	}
	if (lastexpanded!=div_ref) {
		Effect.BlindDown(div_ref);
		lastexpanded = div_ref;
	}
}


function directory_step1(dirid){
	var url = '../../ajax/directory_update.php?stage=1&dirid='+dirid;
	Modalbox.show(url, {title: 'Directory Update', width: 650});
}

function directory_step2(){
	var string  = $('directory_update').serialize();
	var url = '../../ajax/directory_update.php?'+string;
	//alert(url);
	Modalbox.show(url, {title: 'Directory Update', width: 650});
}

function directory_submit(thisform){
	if(validate_directory(thisform)==true){
		var string  = $('directory_update').serialize();
		var url = '../../ajax/directory_update.php?'+string;
		Modalbox.show(url, {title: 'Directory Update', width: 650});
	}
}

function validate_required(field)
		{
		fieldvalue = document.getElementById(field).value;
			if (fieldvalue==null||fieldvalue=="")
			  {return false}
			else {return true}
		}
		
function validate_directory(thisform)
		{
			with (thisform)
			{
				if (validate_required('detail[username]')==false)
				      {document.getElementById('directory_feedback').innerHTML = '<span class="warning">Please enter your name.</span>';return false}
				if ((validate_required('detail[useremail]')==false) && (validate_required('detail[usernumber]')==false))
				      {document.getElementById('directory_feedback').innerHTML = '<span class="warning">Please enter your phone number OR email address.</span>';return false}
				if (validate_required('detail[relationship]')==false)
				      {document.getElementById('directory_feedback').innerHTML = '<span class="warning">Please enter details of your relationship with the organisation.</span>';return false}
				return true;
			}
		}

/*$$(".tooltip").each( function(link) {
new Tooltip(link, {backgroundColor: "#FC9", borderColor: "#C96", 
		textColor: "#000", textShadowColor: "#FFF"});
});*/

