
	function VerifySuggestSettings() {
		if (confirm("Are you sure you want to use the suggested settings \nand replace the settings below ?")) {
			window.location.replace("setup.asp?s=1");
		}
	}

	function MakeVisibleOrHide(nr){
		if(document.getElementById("REQ_PAY").checked == true)
		{
            document.getElementById(nr).style.display=''  ;
			return false
        } else {
            document.getElementById(nr).style.display="none";
			return false
        }					
	}
	
	function Toggle(obj){
	    var objId = document.getElementById(obj);
	    objId.style.display = (objId.style.display == "none")?"":"none"; 
	}
		
	function ValidUpload(){
		if (document.frm.des.value=="") {
			alert("Please enter brief file description.")
			document.frm.des.focus()
		return false }
		if (document.frm.cate.value=="") {
			alert("Please select the category the file will belong to.")
			document.frm.cate.focus()
		return false }
		if (document.frm.group.value=="") {
			alert("Please select one or more groups the file will belong to.")
			document.frm.group.focus()
		return false }
	}
	
    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 show(object) {
    	if (document.layers && document.layers[object] != null)
    	    document.layers[object].visibility = 'visible';
    	else if (document.all)
    	    document.all[object].style.visibility = 'visible';
    }
    function hide(object) {
    	if (document.layers && document.layers[object] != null)
    	    document.layers[object].visibility = 'hidden';
    	else if (document.all)
    	    document.all[object].style.visibility = 'hidden';
    }

	// CHECK BROWSER
	function checkIt(string)
	{
		place = detect.indexOf(string) + 1;
		thestring = string;
		return place;
	}
	
	// GET USERNAME
    function SetUsernameGenerator() {
    	if (confirm("Please note, you won't be able to edit the username after you save this profile. Continue ?")) {
    		document.frm.username.value = getPassword(10, 0, 0, 0, 1, 0, 0, 0, 1, 0);
    	}
    }

    // GET RANDOM NUMERO
	function getRandomNum(lbound, ubound) {
		return (Math.floor(Math.random() * (ubound - lbound)) + lbound);
	}
	
    // GET RANDOM CHAR
    function getRandomChar(number, lower, upper, other, extra) {
		var numberChars = "0123456789";
		var lowerChars = "abcdefghijklmnopqrstuvwxyz";
		var upperChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
		var otherChars = "`~!@#$%^&*()-_=+[{]}\\|;:'\",<.>/? ";
		var charSet = extra;
		if (number == true)
		charSet += numberChars;
		if (lower == true)
		charSet += lowerChars;
		if (upper == true)
		charSet += upperChars;
		if (other == true)
		charSet += otherChars;
		return charSet.charAt(getRandomNum(0, charSet.length));
	}
    
    // GENERATE PASSWORD
	function getPassword(length, extraChars, firstNumber, firstLower, firstUpper, firstOther,
		latterNumber, latterLower, latterUpper, latterOther) {
		var rc = "";
		if (length > 0)
		rc = rc + getRandomChar(firstNumber, firstLower, firstUpper, firstOther, extraChars);
		for (var idx = 1; idx < length; ++idx) {
		rc = rc + getRandomChar(latterNumber, latterLower, latterUpper, latterOther, extraChars);
		}
		return rc;
	}

    // SHOW OR HIDE SECTION
    function ShowHide(nr){
        if(document.getElementById(nr).style.display=="none")
        {
            document.getElementById(nr).style.display=''  ;
        } else {
            document.getElementById(nr).style.display="none";
        }
    }

    // VALID Security
	function ValidateSecurityAddEdit(){
		if (document.frm.name.value=="") {
			alert("Please enter security level name.")
			document.frm.name.focus()
		return false }
	}
	
    // VALID LOGIN
    function ValidateAminLogin(){
        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 }
    }
    
    // FOCUS ON USERNAME (LOGIN)
    function sf(){document.frm.username.focus();}
        	function movepic(img_name,img_src){
        	document[img_name].src=img_src;
    }

    // VALID UPLOAD
    function ValidateUpload(){
        if (document.frm.FILE1.value=="") {
        	alert("Please select a file from your computer that contains the members' information.")
        	document.frm.FILE1.focus()
        return false }
    }

    // CHECK ALL COLUMNS
    function ShowAllColumns() {
        document.getElementById("U1").checked = true;
        document.getElementById("U2").checked = true;
        document.getElementById("U3").checked = true;
        document.getElementById("U4").checked = true;
        document.getElementById("U5").checked = true;
        document.getElementById("U6").checked = true;
        document.getElementById("U7").checked = true;
        document.getElementById("U8").checked = true;
        document.getElementById("U9").checked = true;
		document.getElementById("U10").checked = true;
    }

    // CHECK SEND EMAIL FORM
    function ValidateSendOutEmail(){
        if (document.frm.subject.value=="") {
        	alert("Please enter email subject.")
        	document.frm.subject.focus()
        return false }
        if (document.frm.msg.value=="") {
        	alert("Please enter email content.")
        	document.frm.msg.focus()
        return false }
    }

    // SETUP VALIDATION
    function ValidateSetup(){
        if (document.frm.upl_p.value=="") {
        	alert("Please enter upload path.")
        	document.frm.upl_p.focus()
        return false }
        if (document.frm.upl_u.value=="") {
        	alert("Please enter upload URL.")
        	document.frm.upl_u.focus()
        return false }                
        if (document.frm.syseml.value=="") {
        	alert("Please enter system email address.")
        	document.frm.syseml.focus()
        return false }
        if (document.frm.domain_url.value=="") {
        	alert("Please enter domain URL.")
        	document.frm.domain_url.focus()
        return false }        
        if (document.frm.log_out.value=="") {
        	alert("Please enter log out URL.")
        	document.frm.log_out.focus()
        return false }                
        if (document.frm.smtp.value=="") {
        	alert("Please enter STMP address.")
        	document.frm.smtp.focus()
        return false }
    }

    // APPLY TEMPLATES
    function ApplyTemplates() {
    	if (confirm("Apply default templates ?")) {
    		window.location.replace("setup_templates.asp?APPLYD=True");
    	}
    }
	
	// PURGE LOGS 
    function PurgeLogsPublic(ID, N) {
    	if (confirm("Purge custom page user logs, for this member only ?")) {
    		window.location.replace("user_logs_public_purge.asp?ID=" + ID + "&n=" + N);
    	}
    }	

    // PURGE LOGS 
    function PurgeLogs(ID) {
    	if (confirm("Purge user logs, for this member only ?")) {
    		window.location.replace("user_logs_purge.asp?ID=" + ID );
    	}
    }

    // VALIDATE TEMPLATES
    function ValidTEMPLATES(){
        if (document.frm.msg1.value=="") {
        	alert("Please enter Registration Template.")
        	document.frm.msg1.focus()
        return false }
        if (document.frm.msg2.value=="") {
        	alert("Please enter Authentication Template.")
        	document.frm.msg2.focus()
        return false }
        if (document.frm.msg3.value=="") {
        	alert("Please enter Password Reminder Template.")
        	document.frm.msg3.focus()
        return false }
        if (document.frm.msg4.value=="") {
        	alert("Please enter Expired User Template.")
        	document.frm.msg4.focus()
        return false }
        if (document.frm.msg5.value=="") {
        	alert("Please enter Blocked Trigger Template.")
        	document.frm.msg5.focus()
        return false }
    }

    // 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(); }
    }
    
    // OPEN NEW WINDOW (centered)
    function NewWindow2(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+',resizable=yes'
    	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");
    	}
    }

    // ASK BEFORE EXPORTING
    function ExportVALIDATE() {
    	if (confirm("Would you like to export all users ?")) {
    		window.location.replace("export.asp");
    	}
    }

    // VALID NEWSLETTER FORM
    function ValidNEWSLETTER(){
        if (document.frm.title.value=="") {
        	alert("Please enter newsletter title.")
        	document.frm.title.focus()
        return false }
        if (document.frm.summary.value=="") {
        	alert("Please enter newsletter summary.")
        	document.frm.summary.focus()
        return false }		
    }

    // VALID GROUP
    function ValidGROUP(){
        if (document.frm.name.value=="") {
        	alert("Please enter the name.")
        	document.frm.name.focus()
        return false }
    }
    
    // VALID POLICE
    function ValidPolice(){
        if (document.frm.name.value=="") {
        	alert("Please enter policy name.")
        	document.frm.name.focus()
        return false }
        if (document.frm.des.value=="") {
        	alert("Please enter policy description.")
        	document.frm.des.focus()
        return false }
    }    
    
    // VALID FOOTER SEARCH FORM
    function ValidSEARCH(){
        if (document.frmsearch.SEARCH_FOR.value=="") {
        	alert("Please enter some text to search for.")
        	document.frmsearch.SEARCH_FOR.focus()
        return false }
    }    

    // VALIDATE GOTO USER ID FORM
    function ValidGOTO(){
        if (document.frmGoTo.ID.value=="") {
        	alert("Please enter desired user ID to goto.")
        	document.frmGoTo.ID.focus()
        return false }
    }
    
	function DeleteFile(ID, sNAME, CID) {
    	if (confirm("Delete file: " + sNAME + " ?" )) {
    		window.location.replace("repos_file_del.asp?ID=" + ID + "&CID=" + CID );
    	}
    }	
	
	
    function DeleteSecurity(ID, sNAME) {
    	if (confirm("Delete security level: " + sNAME + " ?" )) {
    		window.location.replace("security_del.asp?ID=" + ID );
    	}
    }
	
		
    function DeleteRepos(ID, sNAME) {
    	if (confirm("Delete File Category: " + sNAME + " ?" )) {
    		window.location.replace("repos_del.asp?ID=" + ID );
    	}
    }
	
	
    // DELTE TRIGGER VERIFICATION
    function DeleteTRIGGER(ID) {
    	if (confirm("Delete trigger ?" )) {
    		window.location.replace("block_del.asp?ID=" + ID );
    	}
    }

    // DELTE NEWSLETTER VERIFICATION
    function DeleteNews(ID,NAME) {
    	if (confirm("Delete newsletter: "+ NAME + " ?" )) {
    		window.location.replace("news_del.asp?ID=" + ID );
    	}
    }


    // DELTE USER VERIFICATION
    function DeleteOwnUser(ID,NAME) {
    	if (confirm("You are about to delete your own profile.\n Please make sure that you have access to the administration even after you delete this profile.\n You should first add new administrator profile before deleting this one." )) {
    		window.location.replace("user_del.asp?ID=" + ID );
    	}
    }


    // DELTE USER VERIFICATION
    function DeleteUser(ID,NAME) {
    	if (confirm("Delete member: "+ NAME + " ?" )) {
    		window.location.replace("user_del.asp?ID=" + ID );
    	}
    }
	
	// DELETE FIELD	
    function DeleteDesigner(ID,NAME) {
    	if (confirm("Delete field: "+ NAME + " ?" )) {
    		window.location.replace("designer_del.asp?ID=" + ID );
    	}
    }    

	// DELTE GROUP VERIFICATION
    function DeleteCate(ID,NAME) {
    	if (confirm("Delete Category: "+ NAME + " ?" )) {
    		window.location.replace("repos_del.asp?ID=" + ID );
    	}
    }    
	
	
    // DELTE GROUP VERIFICATION
    function DeleteGroup(ID,NAME) {
    	if (confirm("Delete group: "+ NAME + " ?" )) {
    		window.location.replace("cate_del.asp?ID=" + ID );
    	}
    }    

    // DELTE GROUP VERIFICATION
    function DeletePolice(ID,NAME) {
    	if (confirm("Delete policy: "+ NAME + " ?" )) {
    		window.location.replace("police_del.asp?ID=" + ID );
    	}
    }      
    
    // VALIDATE ADD & EDIT USER    
    function ValidateUserEdit(){
        if (document.frm.name.value=="") {
        	alert("Please enter username. Use between 5 and 25 characters.")
        	document.frm.name.focus()
        return false }
        if (document.frm.password.value=="") {
        	alert("Please enter desired password. Use between 5 and 25 characters.")
        	document.frm.password.focus()
        return false }
        if (document.frm.email.value=="") {
        	alert("Please enter user's email address.")
        	document.frm.email.focus()
        return false }
    }
 
    // VALIDATE ADD
    function ValidateUser(){
        if (document.frm.name.value=="") {
        	alert("Please enter user's name.")
        	document.frm.name.focus()
        return false }
        if (document.frm.username.value=="") {
        	alert("Please enter desired username. Use between 5 and 25 characters.")
        	document.frm.username.focus()
        return false }
        if (document.frm.password.value=="") {
        	alert("Please enter desired password. Use between 5 and 25 characters.")
        	document.frm.password.focus()
        return false }
        if (document.frm.email.value=="") {
        	alert("Please enter user's email address.")
        	document.frm.email.focus()
        return false }
    }

    // VALIDATE URL 
    function ValidateURL(URL){
    	if (document.frm.url.value=="") {
    		alert("The web site URL is empty.")
    		document.frm.url.focus()
    	return false 
    	} else {
    		window.open(URL)
    		return true
    	}
    }

