
	function GuessSetting() {
		if (confirm("Click OK to continue in guessing your settings. \nDoing so will overwrite your current Help Desk settings. Continue ?")) {
			window.location.replace("index.asp?guess=1");
		}
	}
			
	function ApplyDraftsQ() {
		if (confirm("Leave without saving and do a draft lookup ?")) {
		window.location.replace("lookup_draft.asp?GM=1");
			}
		return false; 
	}		
	
	function ApplySolutionQ() {
		if (confirm("Leave without saving and do a solution lookup ?")) {
		window.location.replace("lookup_solution.asp?IID=" + TempIssueID);
			}
		return false;  
	}		
	
					

	function ShowPreview(Content) {
		var winl = (screen.width - 550) / 2;
		var wint = (screen.height - 380) / 2;
		winprops = 'height=380,width=550,top='+wint+',left='+winl+',scrollbars=yes,resizable=no,status=0'
		var hWndPreviewWindow = window.open("","Preview",winprops);
	    hWndPreviewWindow.document.open();
	    hWndPreviewWindow.document.writeln('<HTML><HEAD><TITLE>Email Message Template Preview</TITLE></HEAD>');
	    hWndPreviewWindow.document.writeln('<BODY BGCOLOR="White">');
		hWndPreviewWindow.document.writeln(Content); 
		hWndPreviewWindow.document.writeln('</BODY></HTML>');
	    hWndPreviewWindow.document.close();
	}

    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 DeleteDesigner(ID,NAME) {
    	if (confirm("Delete field: "+ NAME + " ?" )) {
    		window.location.replace("del.asp?ID=" + ID );
    	}
    }   
	
	function LeaveForDuplicate(ID) {
		if (confirm("Leave without saving and prepare a duplicate of this issue for public KB ?")) {
			window.location.replace("issue_add.asp?DDID=" + ID );
		}
	}	

    function RelateIssues(ID) {
    	if (confirm("Leave without saving the issue and continue to issue relations utility ?")) {
    		window.location.replace("issue_family.asp?ID=" + ID );
    	}
    }  	
	
    function ReassignThisIssue(ID, REP, CATE) {
    	if (confirm("Leave without saving the issue and reassign this issue ?")) {
    		window.location.replace("reassign.asp?ID=" + ID + "&rep=" + REP + "&cate=" + CATE);
    	}
    }  		
	
	function ValidSettings(){
		if (document.frm.PATH.value=="") {
			alert("Please enter application upload folder path.")
			document.frm.PATH.focus()
		return false }
		if (document.frm.URL.value=="") {
			alert("Please enter application upload folder url.")
			document.frm.URL.focus()
		return false }
		if (document.frm.P_PATH.value=="") {
			alert("Please enter public upload folder path.")
			document.frm.P_PATH.focus()
		return false }
		if (document.frm.P_URL.value=="") {
			alert("Please enter public upload folder url.")
			document.frm.P_URL.focus()
		return false }
		if (document.frm.M_SIZE.value=="") {
			alert("The maximum file size must be defined in KB's (numbers) and should not be more then 2500.")
			document.frm.M_SIZE.focus()
		return false }
		if (document.frm.A_EXT.value=="") {
			alert("Please enter allowed file extensions separated by a comma.")
			document.frm.A_EXT.focus()
		return false }				
	}
	
	function ValidUplCate(){
		if (document.frm.name.value=="") {
			alert("Please enter category name.")
			document.frm.name.focus()
		return false }
		if (document.frm.des.value=="") {
			alert("Please enter category description.")
			document.frm.des.focus()
		return false }
	}

	function ValidUpload(){
		if (document.frm.cate.value=="") {
			alert("Please select category to upload to.")
			document.frm.cate.focus()
		return false }
		if (document.frm.des.value=="") {
			alert("Please enter the file description.")
			document.frm.des.focus()
		return false }
	}

    // 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";
        }
    }
    
	// SHOW OR HIDE SECTION WIHT ICON
    function ShowHidePlusMinus(nr,IMG,URL){
        if(document.getElementById(nr).style.display=="none")
        {
            document.getElementById(nr).style.display='';
			document.getElementById(IMG).src= URL + 'minus_tree.gif';			
        } else {
            document.getElementById(nr).style.display="none";
			document.getElementById(IMG).src= URL + 'plus_tree.gif';
        }
    }	
		
    function DeleteFilePublic(ID, IID, strQ) {
    	if (confirm("Delete this file ?" )) {
    		window.location.replace("del_file_public.asp?ID=" + ID + "&IID=" + IID + strQ);
    	}
    }
	
	
    function DeletePOP(ID,I_NAME) {
    	if (confirm("Delete POP3 server reference ?" )) {
    		window.location.replace("del.asp?ID=" + ID );
    	}
    }

	function ValidatePOP(){
	if (document.frm.pop_name.value=="") {
		alert("Please enter name.")
		document.frm.pop_name.focus()
	return false }
	if (document.frm.host.value=="") {
		alert("Please enter host.")
		document.frm.host.focus()
	return false }
	if (document.frm.username.value=="") {
		alert("Please enter username.")
		document.frm.username.focus()
	return false }
	if (document.frm.password.value=="") {
		alert("Please enter password.")
		document.frm.password.focus()
	return false }
	}

	// Check Browser
	function checkIt(string)
	{
		place = detect.indexOf(string) + 1;
		thestring = string;
		return place;
	}


    // TOOGLE VALIDATION
    function ConfirmPublicToogle(ID,S,U,C,A,P,ST,STAR,O,SCRIPT_NAME, OTHER) {
    	if (confirm("Are you sure you want to toggle the issue public availability status ?")) {
    		window.location.replace("toogle_book.asp?ID=" + ID + "&sort=" + S + "&u=" + U + "&cate=" + C + "&agent=" + A + "&prio=" + P + "&status=" + ST + "&Start=" + STAR + "&Offset=" + O + "&sn=" + SCRIPT_NAME + "&other=" + OTHER);
    	}
    }

    // TOOGLE MAX. EXPOSURE
    function ConfirmMaxExposure(ID,S,U,C,A,P,ST,STAR,O,SCRIPT_NAME, OTHER) {
    	if (confirm("Are you sure you want to toggle the issue maximum exposure status ?")) {
    		window.location.replace("toogle_maxe.asp?ID=" + ID + "&sort=" + S + "&u=" + U + "&cate=" + C + "&agent=" + A + "&prio=" + P + "&status=" + ST + "&Start=" + STAR + "&Offset=" + O + "&sn=" + SCRIPT_NAME + "&other=" + OTHER);
    	}
    }
    
    // VALIDATE MEMO FORM
    function ValidMemoSend(){
        if (document.frm.title.value=="") {
        	alert("Please enter memo title.")
        	document.frm.title.focus()
        return false }
        if (document.frm.msg.value=="") {
        	alert("Please enter memo content.")
        	document.frm.msg.focus()
        return false }
    }

    // VALIDATE PASSWORD REMINDER
    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 ClaimIssue(ID) {
    	if (confirm("Are you sure you want to claim this issue, and accept responsibility for it?")) {
    		window.location.replace("issue_claim.asp?ID=" + ID );
    	}
    }

	
    // APPLY TEMPALTES
    function ApplyTemplates() {
    	if (confirm("Apply default templates ?")) {
    		window.location.replace("index.asp?default=true" );
    	}
    }
    
    // DELETE SECURITY LEVEL
    function DeleteLevel(ID,I_NAME) {
    	if (confirm("Delete Security Level: "+ I_NAME+" ?\nAgents with this security level will be assigned Administrator security level instead." )) {
    		window.location.replace("del.asp?ID=" + ID );
    	}
    }

    // ADD USER FROM ISSUE EDIT SCREEN
    function AddUserIssue(ID) {
    	if (confirm("Add issue submitter as a contact in your contact book ?")) {
    		window.location.replace("../tool/contact/contact_add_auto.asp?ID=" + ID );
    	}
    }

    // VALIDATE LEVEL
    function validateLevel(){
        if (document.frm.name.value=="") {
        	alert("Please enter security level name.")
        	document.frm.name.focus()
        return false }
    }
    // CHECK ALL \\
    function checkAll(field) {
		for (i = 0; i < field.length; i++)
		field[i].checked = true ;
    }
    
    // UNCHECK ALL \\
    function uncheckAll(field) {
		for (i = 0; i < field.length; i++)
		field[i].checked = false ;
    }
    
    // ADD NEW AGENT FORM VALIDATION \\
    function ValidateAddAgent(){
    	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 name.")
    		document.frm.name.focus()
    	return false }
    	if (document.frm.email.value=="") {
    		alert("Please enter agent email address.")
    		document.frm.email.focus()
    	return false }
    }
    
    // VALIDATE URL - EDIT ISSUE SCREEN ONLY \\
    function ValidateURL(URL){
    	if (document.frm.cf6.value=="") {
    		alert("The URL is not available.")
    		document.frm.cf6.focus()
    	return false 
    	} else {
    		window.open(URL)
    		return true
    	}
    }
    
    // ADD NEW CONTACT FORM VALIDATION \\
    function ValidateAddContact(){
    	if (document.frm.name.value=="") {
    		alert("Please enter contact name.")
    		document.frm.name.focus()
    	return false }
    }
    
    // ADD NEW CONTACT FORM VALIDATION \\
    function ValidateUpload(){
    	if (document.frm.FILE1.value=="") {
    		alert("Please select file to upload.")
    		document.frm.FILE1.focus()
    	return false }
    }
    
    // MASS EMAIL FORM VALIDATION \\
    function ValidateMassEmail(){
    	if (document.frm.subject.value=="") {
    		alert("Please enter mass email subject.")
    		document.frm.subject.focus()
    	return false }
    	if (document.frm.msg.value=="") {
    		alert("Please enter mass email content.")
    		document.frm.msg.focus()
    	return false }	
    }
    
    // ADD NEW CATEGORY FORM VALIDATION \\
    function ValidateAddCate(){
    	if (document.frm.name.value=="") {
    		alert("Please enter desired category name.")
    		document.frm.name.focus()
    	return false }
    }
    
    // LOGIN FORM VALIDATION \\
    function ValidateLogin(){
    	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 }	
    }
    
    // TO-DO ADD ITEM VALIDATION \\
    function ValidateAddToDo(){
    	if (document.frm.title.value=="") {
    		alert("Please enter to-do item title.")
    		document.frm.title.focus()
    	return false }
    	if (document.frm.todo.value=="") {
    		alert("Please enter to-do item content.")
    		document.frm.todo.focus()
    	return false }	
    }
    
    
    // ADD DRAFT FORM VALIDATION \\
    function ValidateAddDraft(){
    	if (document.frm.title.value=="") {
    		alert("Please enter draft subject.")
    		document.frm.title.focus()
    	return false }
    }
    
    
    // ADD ISSUE FORM VALIDATION \\
    function ValidateAddIssue(){
    	if (document.frm.title.value=="") {
    		alert("Please enter issue title.")
    		document.frm.title.focus()
    	return false }	
    }
    
    // ADD EXTENDED ISSUE FORM VALIDATION \\
    function ValidateAddIssueEx(){
    	if (document.frm.name.value=="") {
    		alert("Please enter customer name.")
    		document.frm.name.focus()
    	return false }
    	if (document.frm.email.value=="") {
    		alert("Please enter customer email address.")
    		document.frm.email.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.title.value=="") {
    		alert("Please enter issue title.")
    		document.frm.title.focus()
    	return false }
		if ((document.frm.username.value.length < 5) || (document.frm.username.value.length > 25)) {
		    alert("The username must be between 5 and 25 characters in length.")
    		document.frm.username.focus()
			return false }	
		if ((document.frm.password.value.length < 5) || (document.frm.password.value.length > 25)) {
		    alert("The password must be between 5 and 25 characters in length.")
    		document.frm.password.focus()
			return false }				
		
    }
    
    
    // EDIT ISSUE FORM VALIDATION \\
    function ValidateEditIssue(){
    	if (document.frm.title.value=="") {
    		alert("Please enter issue title.")
    		document.frm.title.focus()
    	return false }
    }
    
    // CONFIRM LOG DELETE
    function DeleteLog(ID) {
    	if (confirm("Are you sure you want to delete log ID: " + ID + " ?")) {
    		window.location.replace("del.asp?ID=" + ID);
    	}
    }
    
    // CONFIRM USER DELETE
    function DeleteUser(USER_NAME) {
    	if (confirm("Are you  sure you want to delete user: " + USER_NAME + " ?\nDeleting a user profile will cause all associated issues to be deleted as well.")) {
    		window.location.replace("user_del.asp?ID=" + USER_NAME);
    	}
    }
    
    // CONFIRM COMMENT DELETE
    function DeleteComment2(ID) {
    	if (confirm("Are you  sure you want to delete the comment ?" )) {
    		window.location.replace("del.asp?ID=" + ID);
    	}
    }    
    
	

    // CONFIRM COMMENT DELETE
    function DeleteComment(ID,ISSUE) {
    	if (confirm("Are you  sure you want to delete the comment ?" )) {
    		window.location.replace("comment_del.asp?ID=" + ID + "&issue=" + ISSUE);
    	}
    }
    function DeleteCommentView(ID,ISSUE) {
    	if (confirm("Are you  sure you want to delete the comment ?" )) {
    		window.location.replace("comment_del.asp?MODE=View&ID=" + ID + "&issue=" + ISSUE);
    	}
    }    
	
	
    // CONFIRM CATEGORY DELETE
    function DeleteCategory(ID,CATE_NAME) {
    	if (confirm("Deleting a category will cause the deletion of all issues associated with this category.\n\nDelete category: " + CATE_NAME + " ?" )) {
    		window.location.replace("cate_del.asp?ID=" + ID );
    	}
    }
    
    // CONFIRM UPLOAD CATEGORY DELETE
    function DeleteUplCate(ID,CATE_NAME) {
    	if (confirm("Delete Category: " + CATE_NAME + " ?\n\nAll associated files will be deleted as well." )) {
    		window.location.replace("del.asp?ID=" + ID );
    	}
    }
    
    // CONFIRM CONTACT DELETE
    function DeleteContact(ID,CATE_NAME) {
    	if (confirm("Delete contact: " + CATE_NAME + " ?" )) {
    		window.location.replace("del.asp?ID=" + ID );
    	}
    }
    
    // CONFIRM UPLOADED FILE DELETE
    function DeleteUplFile(ID, CID) {
    	if (confirm("Delete this file ?" )) {
    		window.location.replace("del_file.asp?ID=" + ID + "&CID=" + CID);
    	}
    }
    
    // CONFIRM AGENT DELETE
    function DeleteAgent(ID,AGENT_NAME) {
    	if (confirm("Before deleting an agent you should re-assign his/her issues to another agent,\nUsing the Re-Assign Agent to Agent tool on the bottom of this page.\n\nFailure to do so will result in issues being not assigned to anybody, even though they may be resolved.\n\nDelete agent: " + AGENT_NAME + " ?" )) {
    		window.location.replace("del.asp?ID=" + ID );
    	}
    }
	
    // CONFIRM AGENT DELETE
    function DeleteAgentOwn(ID,AGENT_NAME) {
    	if (confirm("You are about to delete your own agent profile, once you do this you will be logged out and won't be able to login with this profile.\n\nDelete agent: " + AGENT_NAME + " ?" )) {
    		window.location.replace("del.asp?ID=" + ID );
    	}
    }	
    
    // CONFIRM DRAFT DELETE
    function DeleteDraft(ID,DRAFT_NAME) {
    	if (confirm("Delete draft: " + DRAFT_NAME + " ?" )) {
    		window.location.replace("del.asp?ID=" + ID );
    	}
    }
    
    // CONFIRM ISSUE DELETE
    function DeleteIssue(ID,ISSUE_NAME) {
    	if (confirm("Delete issue: " + ISSUE_NAME + " ?" )) {
    		window.location.replace("del.asp?ID=" + ID );
    	}
    }
    
    // CONFIRM TO_DO ITEM DELETE
    function DeleteToDo(ID,TODO_NAME) {
    	if (confirm("Delete to-do item: " + TODO_NAME + " ?" )) {
    		window.location.replace("del.asp?ID=" + ID );
    	}
    }
    
    // CONFIRM GLOSSARY DELETE
    function DeleteGlossary(ID,NAME) {
    	if (confirm("Delete glossary: " + NAME + " ?" )) {
    		window.location.replace("del.asp?ID=" + ID );
    	}
    }
    
    // CONFIRM LOG-OUT
    function ConfirmLogOut(URL) {
    	if (confirm("Are you sure you want to log-out ?" )) {
    		window.location.replace(URL);
    	}
    }
    
    // JAVA SCRIPT REDIRECTION OF DROP DOWN MENU ON TOOLS TAB
    function formHandler(form){
    	var URL = document.form.site.options[document.form.site.selectedIndex].value;
    	window.location.href = URL;
    }
    
    // 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(); }
    }
    
    // VALIDATE GOTO ISSUE FORM
    function ValidGOTO(){
    if (document.frmGoTO.ID.value=="") {
    	alert("Please enter desired issue ID to go to.")
    	document.frmGoTO.ID.focus()
    return false }
    }
    
    
    // VALIDATE GOTO ISSUE FORM
    function ValidSEARCH(){
        if (document.frmSearch.searchfor.value=="") {
        	alert("Please enter phrase to search for.")
        	document.frmSearch.searchfor.focus()
        return false }
    }
    
    // VALIDATE BIG SEARCH
    function ValidSEARCHBIG(){
        if (document.frm.searchfor.value=="") {
        	alert("Please enter phrase to search for.")
        	document.frm.searchfor.focus()
        return false }
    }

