// JavaScript Document
function check_chars() { 
	var str = window.document.contact_form.msg.value;
	
	if (str.length > 500) {
		window.document.contact_form.msg.value = str.substring(0,500);
	} else {		
		document.getElementById("count").innerHTML = 500 - window.document.contact_form.msg.value.length + " characters remaining.";
	}
}

	function trim(txt) {		
		tmp = (txt.replace(/^\W+/,'')).replace(/\W+$/,'');
		return tmp;
	}
	
	function doit() {
		var myname = window.document.contact_form.name.value;
		var myemail = window.document.contact_form.email.value;
		var msg = window.document.contact_form.msg.value;
		myname  = trim(myname);
		myemail = trim(myemail);
		msg = trim(msg);

		if ((myname.length > 0) && (msg.length > 0) && (myemail.length > 0)) {
			return true;
		} else {
			alert("Please enter all your details.");
			return false;
		}

		return false;
	}
	
function show_sub(my_id, a_l)
{
	var pan = document.getElementById(my_id);
	document.getElementById("acc1").style.display = "none";
	document.getElementById("acc2").style.display = "none";
	document.getElementById("acc3").style.display = "none";
	document.getElementById("acc4").style.display = "none";		
	document.getElementById("acc5").style.display = "none";	
	
	document.getElementById("a1").style.fontWeight = "normal";	
	document.getElementById("a2").style.fontWeight = "normal";			
	document.getElementById("a3").style.fontWeight = "normal";	
	document.getElementById("a4").style.fontWeight = "normal";			
	document.getElementById("a5").style.fontWeight = "normal";			
	//document.getElementById("acc4").style.display = "none";
	pan.style.display = "block";
	a_l.style.fontWeight = "bold";
	a_l.style.borderBottom = "none";
}
	

function switch_est(id) {	
	$("#viewer").html("<img src='images/img_loader.gif' />");
	$("#viewer").load("pages/establishments/" + id);
}



