function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if 
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers) 
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
document.oncontextmenu=new Function("return false")
function openWin(theURL,winName,wWidth,wHeigt) 
	{
	sWidth = wWidth;
	sHeight = wHeigt;
	pTop = (screen.height) ? (screen.height-wHeigt)/2 : 0;
	pLeft =  (screen.width) ? (screen.width-sWidth)/2 : 0;
	settings = 'height='+sHeight+',width='+sWidth+',top='+pTop+',left='+pLeft+',toolbar=0,location=0,status=1,menubar=0,scrollbars=1,resizable=0'
	window.open(theURL,winName,settings);
}
function trim(str)
{
  return str.replace(/^\s+|\s+$/g, '');
}
function echeck(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("Email anda salah!")
	return false
	}
	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
	alert("Email anda salah!")
	return false
	}
	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
	alert("Email anda salah!")
	return false
	}
	if (str.indexOf(at,(lat+1))!=-1){
	alert("Email anda salah!")
	return false
	}
	if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
	alert("Email anda salah!")
	return false
	}
	if (str.indexOf(dot,(lat+2))==-1){
	alert("Email anda salah!")
	return false
	}
	if (str.indexOf(" ")!=-1){
	alert("Email anda salah!")
	return false
	}
	return true
}
function cekContact(theForm) 
{
	if(trim(theForm.nama.value) == "" || trim(theForm.nama.value) == "-") 
	{
		alert("Isikan nama anda!");
		theForm.nama.focus();
		return(false);
	}
	if(trim(theForm.email.value) == "") 
	{
		alert("Isikan email anda!");
		theForm.email.focus();
		return(false);
	}	
	if (trim(theForm.email.value)!="") 
	{
		if (echeck(theForm.email.value)==false)
		{
			theForm.email.focus()
			return(false)
		}
	}	
	if(trim(theForm.pesan.value) == "" || trim(theForm.pesan.value) == "-") 
	{
		alert("Tuliskan pesan/komentar anda!");
		theForm.pesan.focus();
		return(false);
	}
	if(trim(theForm.sccode.value) == "" || trim(theForm.sccode.value) == "-") 
	{
		alert("Ketikkan kode validasi!");
		theForm.sccode.focus();
		return(false);
	}
	return (true);
	}
function cekGuestbook(theForm) 
{
	if(trim(theForm.nama.value) == "" || trim(theForm.nama.value) == "-") 
	{
		alert("Ketikkan nama anda!");
		theForm.nama.focus();
		return(false);
	}
	if(trim(theForm.kota.value) == "" || trim(theForm.kota.value) == "-") 
	{
		alert("Ketikkan nama kota anda!");
		theForm.kota.focus();
		return(false);
	}
	if (trim(theForm.email.value)!="") 
	{
	if (echeck(theForm.email.value)==false)
	{
		theForm.email.focus()
		return(false)
	}
	}
	if(trim(theForm.pesan.value) == "" || trim(theForm.pesan.value) == "-") 
	{
		alert("Tuliskan komentar/pesan anda!");
		theForm.pesan.focus();
		return(false);
	}
	if(trim(theForm.sccode.value) == "" || trim(theForm.sccode.value) == "-") 
	{
		alert("Ketikkan kode validasi!");
		theForm.sccode.focus();
		return(false);
	}
	return (true);
}
function limitText(limitField, limitNum) {
	if (limitField.value.length > limitNum) {
		limitField.value = limitField.value.substring(0, limitNum);
	} 
}