	function Toggle(obj){
	    var objId = document.getElementById(obj);
	    objId.style.display = (objId.style.display == "none")?"":"none"; 
	}

    function ValidEvent(){
    if (document.frm.title.value=="") {
    	alert("Please enter event title.")
    	document.frm.title.focus()
    return false }
    }
    	
	
	function checkIt(string){
		place = detect.indexOf(string) + 1;
		thestring = string;
		return place;
	}
	
    function taLimit() {
    	var taObj=event.srcElement;
    	if (taObj.value.length==255*1) return false;
    }
    
    function taCount(visCnt) { 
    	var taObj=event.srcElement;
    	if (taObj.value.length>255*1) taObj.value=taObj.value.substring(0,255*1);
    	if (visCnt) visCnt.innerText=255-taObj.value.length;
    }
	

	function ValidEmailgrp(){
		if (document.frm.groups.value=="") {
			alert("Please select groups to email.")
			document.frm.groups.focus()
		return false }
		if (document.frm.title.value=="") {
			alert("Please enter email title.")
			document.frm.title.focus()
		return false }
		if (document.frm.des.value=="") {
			alert("Please enter email content.")
			document.frm.des.focus()
		return false }
	}
	
	function ValidLoginMain(){
	    if (document.frm.username.value=="") {
	    	alert("Please enter your username.")
	    	document.frm.username.focus()
	    return false }
	    if (document.frm.password.value=="") {
	    	alert("Please enter your password.")
	    	document.frm.password.focus()
	    return false }
	} 
	
	function ValidReminder(){
	    if (document.frm.username.value=="") {
	    	alert("Please enter your username.")
	    	document.frm.username.focus()
	    return false }
	    if (document.frm.email.value=="") {
	    	alert("Please enter your email address.")
	    	document.frm.email.focus()
	    return false }
	} 
	
	function DelFile(ID, CID) {
		if (confirm("Delete File ?")) {
			window.location.replace("file_del.asp?ID=" + ID + "&CID=" + CID );
		}
	}
	    function NewWindow(mypage, myname, w, h, scroll) {
	    	var winl = (screen.width - w) / 2;
	    	var wint = (screen.height - h) / 2;
	    	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll
	    	win = window.open(mypage, myname, winprops)
	    	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
	    }
	
	function ValidSettings(){
	if (document.frm.path.value=="") {
		alert("Please enter path value.")
		document.frm.path.focus()
	return false }
	if (document.frm.url.value=="") {
		alert("Please enter URL value.")
		document.frm.url.focus()
	return false }
	if (document.frm.email.value=="") {
		alert("Please enter email address.")
		document.frm.email.focus()
	return false }
	if (document.frm.smtp.value=="") {
		alert("Please enter smtp server address.")
		document.frm.smtp.focus()
	return false }
	}
	
	function LogOut() {
		if (confirm("Do you want to log out ?")) {
			window.location.replace("index.asp?Logout=True");
		}
	}
	
	function validateGroupAdd(){
		if (document.frm.name.value=="") {
			alert("Please enter group name.")
			document.frm.name.focus()
		return false }
	}
	
	
	function validateAgentAdd(){
		if (document.frm.name.value=="") {
			alert("Please enter agent name.")
			document.frm.name.focus()
		return false }
		if (document.frm.username.value=="") {
			alert("Please enter desired username.")
			document.frm.username.focus()
		return false }
		if (document.frm.password.value=="") {
			alert("Please enter desired password.")
			document.frm.password.focus()
		return false }	
		if (document.frm.email.value=="") {
			alert("Please enter agent email address.")
			document.frm.email.focus()
		return false }	
	}
	
	function validateAgentEdit(){
		if (document.frm.name.value=="") {
			alert("Please enter agent name.")
			document.frm.name.focus()
		return false }
		if (document.frm.password.value=="") {
			alert("Please enter desired password.")
			document.frm.password.focus()
		return false }	
		if (document.frm.email.value=="") {
			alert("Please enter agent email address.")
			document.frm.email.focus()
		return false }	
	}
	
	function validateCalEdit(){
		if (document.frm.name.value=="") {
			alert("Please enter calendar name.")
			document.frm.name.focus()
		return false }
		if (document.frm.password.value=="") {
			alert("Please enter desired password.")
			document.frm.password.focus()
		return false }	
		if (document.frm.des.value=="") {
			alert("Please enter calendar description.")
			document.frm.des.focus()
		return false }	
	}
	
	function validateCalAdd(){
		if (document.frm.name.value=="") {
			alert("Please enter calendar name.")
			document.frm.name.focus()
		return false }
		if (document.frm.username.value=="") {
			alert("Please enter desired username.")
			document.frm.username.focus()
		return false }	
		if (document.frm.password.value=="") {
			alert("Please enter desired password.")
			document.frm.password.focus()
		return false }	
	}
	
	
	function DelGroup(ID,NAME) {
		if (confirm("Delete Group: "+ NAME + " ? All calendars in this group will be unassigned.")) {
			window.location.replace("group_del.asp?ID=" + ID );
		}
	}
	
	
	function DelAgent(ID,NAME) {
		if (confirm("Delete Agent: "+ NAME + " ?" )) {
			window.location.replace("agent_del.asp?ID=" + ID );
		}
	}
	
	function DelCal(ID,NAME) {
		if (confirm("Delete Calendar: "+ NAME + " ?" )) {
			window.location.replace("cal_del.asp?ID=" + ID);
		}
	}
	
	function MakeActive(ID,NAME,REST) {
		if (confirm("Activate Calendar: "+ NAME + " ?" )) {
			window.location.replace("toogle.asp?a=1&ID=" + ID + REST);
		}
	}
	
	function MakeInactive(ID,NAME,REST) {
		if (confirm("Deactivate Calendar: "+ NAME + " ?" )) {
			window.location.replace("toogle.asp?a=0&ID=" + ID + REST);
		}
	}