    function validate(){
	    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 DeleteOption(ID,PID,NAME,POLLSUBJ) {
    	if (confirm("Delete Poll Option: "+ NAME )) {
    		window.location.replace("option_del.asp?ID=" + ID + "&PID=" + PID + "&POLL_SUBJ=" + POLLSUBJ);
    	}
    }

    function ValidPoll(){
    if (document.frm.title.value=="") {
    	alert("Please enter poll title.")
    	document.frm.title.focus()
    return false }
    if (document.frm.question.value=="") {
    	alert("Please enter poll question.")
    	document.frm.question.focus()
    return false }
    }
    
    function ValidAgent(){
    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.name.value=="") {
    	alert("Please enter agent`s name.")
    	document.frm.name.focus()
    return false }    
    }
    
    
    function DeletePoll(ID,I_NAME) {
    	if (confirm("Delete Poll: "+ I_NAME )) {
    		window.location.replace("poll_del.asp?ID=" + ID );
    	}
    }
    
    function DeleteAgent(ID,I_NAME) {
    	if (confirm("Delete Agent: "+ I_NAME + "\nPlease note that when an agent is deleted, all associated polls are deleted as well.\nContinue ?" )) {
    		window.location.replace("agent_del.asp?ID=" + ID );
    	}
    }

    
    function OptionAddEdit(){
    	if (document.frm.opt.value=="") {
    		alert("Please enter options value.")
    		document.frm.opt.focus()
    	return false }
    	if (document.frm.res.value=="") {
    		alert("Please enter options result such as 0.")
    		document.frm.res.focus()
    	return false }
    }    
    
        
    function MakePrimary(ID) {
    	if (confirm("Make this poll the primary poll ?")) {
    		window.location.replace("poll_primary.asp?ID=" + ID );
    	}
    }

    
    // OPEN NEW WINDOW (centered)
    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(); }
    }


    // ASK BEFORE LOGOUT
    function LogOutVALIDATE() {
    	if (confirm("Would you like to Log Out ?")) {
    		window.location.replace("index.asp?logout=True");
    	}
    }    