function toggleNewAgent(agent_id) {
	var newAgent = document.getElementById('new_agent');

	if(agent_id == 'new')
	{	
		if(newAgent.style.display == 'none')
			new Effect.Appear('new_agent');
		
		document.getElementById('AgentName').value = '';
	}
	else 
		new Effect.Fade('new_agent');
}
function showGoogleMap(id) {
	window.open('/developmentprops/map/'+id,'pop_up','height=450,width=600,location=no');
}
function zoomImage(id) {
	window.open('/developmentprops/zoom/'+id,'pop_up','height=600,width=600,location=no');
}

function showMarkdown()
{
	link = document.getElementById('link-text');
	
	if(document.getElementById('markdown').style.display == 'none')
	{
		new Effect.Appear('markdown');
		link.innerHTML = 'hide formatting options';
	}
	else
	{
		new Effect.Fade('markdown');
		link.innerHTML = 'view formatting options';
	}
}
/** CONTACT FORM VALIDATION **/
function validateContact(){
	
	var form = $('contact');
	var name = $('name');
	var phone = $('phone');
	var email = $('email');
	var message = $('comments');
	
	if (name.value == "") { alert("Name is Required"); name.cssText = "border: 1px solid red;"; return false; };
	if (phone.value == "") { alert("Phone number is Required"); phone.cssText = "border: 1px solid red;"; return false; };
	if (email.value == "") { alert("E-Mail is Required"); email.cssText = "border: 1px solid red;"; return false; };
	if (isEmail(email.value) == false) { alert("E-Mail is not Valid"); email.cssText = "border: 1px solid red;"; return false; };
	if (message.value == "") { alert("Comments is Required"); message.cssText = "border: 1px solid red;"; return false; };
	
	form.submit();
	return true;
	
}

/** E-MAIL VALIDATION */
function isEmail(string) {
	if (string.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
	return true;
	else
	return false;
}
