<html>
<head>
<title>Attachment Blocking - Rule Edit</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!--BASE HREF="$$BASE_URL$$"-->
<link href="css/trend-style-new.css" rel="stylesheet" type="text/css">
<script language="JavaScript" src="javascripts/TmCube_Common.js"></script>
<script language="JavaScript" src="javascripts/TmCube_Tree.js"></script>
<script language="JavaScript" src="javascripts/policy.js"></script>
<script language="JavaScript" src="javascripts/localization.js"></script>
<script language="JavaScript" src="javascripts/trend-ui-new.js"></script>
<script language="JavaScript" src="javascripts/OLH_Mapping.js"></script>
<script language="JavaScript" src="javascripts/Server_Role_Dependency.js"></script>
<script language="JavaScript" type="text/JavaScript">
<!--

var strCurrentTag = 'Target';
var bInitialList = false; // flag the whether listbox initiallized for the step 1

var objRule = new CRule(); //store the Rule info
var addExceptionIndex = -1; //store the current edit exception index in objRule.exceptionList

//for the exception List
var vRecordPerPage = 10;       
var nCurrentPage = 1;          
var bIsRealTime = $$IS_REALTIME$$;

// for Account String join
var lenLength = 6;
var lenType = 2;

// for add/edit exception page change
var gbLastIsAnySiteToAccount = false;
var gstrLastSiteId = "";
var gExcetpionOperate = "";
var OPER_ADD = "ADD";
var OPER_EDIT = "EDIT";

function jsInitPage() 
{ 
  if (!bIsRealTime)
  {
     document.getElementById('QuarantineAction').style.display = "";
     // show notify to violator
     document.getElementById('notifyViolatorDIV1').style.display = "";
     document.getElementById('notifyViolatorDIV2').style.display = "";

     document.getElementById('txtDeleteAction').innerText = STR_ACTION_DELETE;    
  }

  setOptionValueEx(document.fmMain.optViolatorMessageType,STR_AB_NOTIFY_MSG,STR_AB_NOTIFY_MSG); 
//  SeletctPage(); 
   setOptionValueEx(document.fmMain.optAdminMessageType,STR_AB_NOTIFY_MSG,STR_AB_NOTIFY_MSG); 
   setOptionValueEx(document.fmMain.optSNMPMessageType,STR_AB_NOTIFY_MSG,STR_AB_NOTIFY_MSG);

   var vPage = "10,20,50,100,All";
   if(document.fmMain.optRecordPerPage.length == 0)
   {
       setOptionValue(document.fmMain.optRecordPerPage,vPage,false);
   }
   parseExceptions();
   jsPage(1);
   setListboxUI(document.getElementById("lstAvailableAccount"),document.getElementById("divAvailableAccountInner"),document.getElementById("divAvailableAccountOuter"));
   setListboxUI(document.getElementById("lstSelectedAccount"),document.getElementById("divSelectedAccountInner"),document.getElementById("divSelectedAccountOuter"));
   jsAnysiteCheck();
   jsAnyoneCheck();
   jsUIDependency();
   setUIItemsChecked(fmMain.chkScanOLE, fmMain.chkOLE_items, false);
}
function parseExceptions()
{
    var ExceptionsString = document.getElementById("ExceptionsString").value;
    if (ExceptionsString == "")
        return;
    objRule.parseString(ExceptionsString);
}
function jsChangeTag(strTag)
{
    strCurrentTag = strTag;
}

function jsCancel() 
{
    window.location.href = '$$REDIRECT_TO_PAGE$$';
}

function jsCheckInput()
{
    //1. File Blocking setting
    var VerifySetting = true;
	
	//Check whether "Attachment types" or "Attachment names" is selected if "Specific attachments" is selected
	if(!document.getElementById("chkSpecifiedType").checked && !document.getElementById("chkSpecifiedName").checked){
        setUITagDisplay(1,4,'Target');
        alert(STR_WARN_SPECIFIC_ATT);
        return false;
    }
    	// Check Specific file extensions to block
	if(VerifySetting && document.fmMain.chkSpecifiedExtension.checked && document.getElementById("lstSpecifiedExtension").options.length <1){
	    setUITagDisplay(1,4,'Target');
	    if (document.getElementById("tabSpecifiedName_items").style.display == "none"){	        
	        setUIMoreDisplay(document.getElementById("tabSpecifiedName"));
	        jsInitListbox("tabSpecifiedName");
	    }
	    jsFocus(document.fmMain.txtSpecifiedExtension);
	    alert(STR_WARN_SPECIFIC_EXTENSIONNAME);
	    return false;
	}
	// Check Attachment names to block
	if(VerifySetting && document.fmMain.chkSpecifiedAttachment.checked && document.getElementById("lstSpecifiedAttachment").options.length <1){
	    setUITagDisplay(1,4,'Target');
	    if (document.getElementById("tabSpecifiedName_items").style.display == "none"){	        
	        setUIMoreDisplay(document.getElementById("tabSpecifiedName"));
	        jsInitListbox("tabSpecifiedName");
	    }
	    jsFocus(document.fmMain.txtSpecifiedAttachment);
	    alert(STR_WARN_SPECIFIC_FILENAME);
	    return false;
	}
    
    //2. Name
	var strRuleName = document.getElementById("RuleName").value;
    if (!checkNumberRange(strRuleName.length,0,INT_LMAX_CF_NAME,STR_WARN_RULE_NAME,false))
    {
        jsFocus(document.getElementById("RuleName"));
        return false;
    }
    var re = /^\s*$/;
	if(re.test(strRuleName))
	{
	   alert(STR_WARN_RULE_NAME_IS_SPACE);
	   jsFocus(document.getElementById("RuleName"));
       return false;
	}
	// description
	var strDescription = document.getElementById("RuleDescription").value;
	if(strDescription.length >= INT_LMAX_CF_DESCRIPTION)
	{
		alert(STR_WARN_RULE_DESCRIPTION);
		jsFocus(document.getElementById("RuleDescription"));
		return false;
	}
    //3. Notification
    if(document.getElementById("chkNotifyAdmin").checked){
	    if(document.fmMain.txtNotifyAdminTo1.value == ""){
	        alert(STR_ERR_NOTIFY_ADMIN_ACCOUNT);
	        setUITagDisplay(4,4,'Notification');
	        if(document.getElementById("tabNotifyAdmin_items").style.display=="none")
	                document.getElementById("tabNotifyAdmin").onclick();
		    jsFocus(document.fmMain.txtNotifyAdminTo1);
		    return false;
	    }
	}
    
	if(document.getElementById("chkNotifySNMP").checked){
	    if (!document.fmMain.txtSNMPIP.value.length){
	            alert(STR_ERR_BLANK_IPADDRESS);
	            if(document.getElementById("tabSNMP_items").style.display=="none")
	                document.getElementById("tabSNMP").onclick();
	            jsFocus(document.fmMain.txtSNMPIP);
	            return false;
	    }
	    if (!checkIPAddressFormat(document.fmMain.txtSNMPIP.value,STR_ERR_INVALID_IPADDRESS,false)) {
		    setUITagDisplay(4,4,'Notification');
		    if(document.getElementById("tabSNMP_items").style.display=="none")
	                document.getElementById("tabSNMP").onclick();
		    jsFocus(document.fmMain.txtSNMPIP);
		    return false;
	    }
	    if (!checkNumberRange(document.fmMain.txtSNMPCommunity.value.length,INT_NMIN_SNMP,INT_NMAX_SNMP,STR_WARN_SNMP,false)) {
		    setUITagDisplay(4,4,'Notification');
		    if(document.getElementById("tabSNMP_items").style.display=="none")
	                document.getElementById("tabSNMP").onclick();
		    jsFocus(document.fmMain.txtSNMPCommunity);
		    return false;
	    }
 		if (document.getElementById("txtSNMPMessage").value.length == 0)
		{
			alert(STR_ERR_BLANK_MESSAGE);
			setUITagDisplay(4,4,'Notification');
			jsFocus(document.fmMain.txtSNMPMessage);
			return false;
		}       
    }
	if (!checkNumberRange(document.fmMain.txtNotifyAdminSettingsPeriod.value,INT_NMIN_NOTI_PERIOD,INT_NMAX_NOTI_PERIOD,STR_WARN_NOTI_PERIOD,false)) {
		setUITagDisplay(4,4,'Notification');
		if (document.getElementById("tabNotifyAdmin_items").style.display == "none") setUIMoreDisplay(document.getElementById("tabNotifyAdmin"));
		jsFocus(document.fmMain.txtNotifyAdminSettingsPeriod);
		return false;	
	}
	if (!checkNumberRange(document.fmMain.txtNotifyAdminSettingsOccurence.value,INT_NMIN_NOTI_OCCUR,INT_NMAX_NOTI_OCCUR,STR_WARN_NOTI_OCCUR,false)) {
		setUITagDisplay(4,4,'Notification');
		if (document.getElementById("tabNotifyAdmin_items").style.display == "none") setUIMoreDisplay(document.getElementById("tabNotifyAdmin"));
		jsFocus(document.fmMain.txtNotifyAdminSettingsOccurence);
		return false;	
	}
	if (!checkMultiEmailPatternFormat(document.fmMain.txtNotifyAdminTo1.value,STR_ERR_INVALID_EMAIL) ||
		!checkNumberRange(document.fmMain.txtNotifyAdminTo1.value.length,1,INT_LMAX_EM_ADDR_M,STR_WARN_EM_ADDR_M)) {
		setUITagDisplay(4,4,'Notification');
		if (document.getElementById("tabNotifyAdmin_items").style.display == "none") setUIMoreDisplay(document.getElementById("tabNotifyAdmin"));
		jsFocus(document.fmMain.txtNotifyAdminTo1);
		return false;
	}

	if (!checkNumberRange(document.getElementById("txtNotifyAdminMessage").value.length,0,INT_LMAX_EM_CONTENT,STR_WARN_EM_CONTENT)) {
		setUITagDisplay(4,4,'Notification');
		if (document.getElementById("tabNotifyAdmin_items").style.display == "none") setUIMoreDisplay(document.getElementById("tabNotifyAdmin"));
		jsFocus(document.getElementById("txtNotifyAdminMessage"));
		return false;
	}
    if (!checkNumberRange(document.getElementById("txtNotifyViolatorMessage").value.length,0,INT_LMAX_EM_CONTENT,STR_WARN_EM_CONTENT)) {
		setUITagDisplay(4,4,'Notification');
		if (document.getElementById("tabNotifyViolator_items").style.display == "none") setUIMoreDisplay(document.getElementById("tabNotifyViolator"));
		jsFocus(document.getElementById("txtNotifyViolatorMessage"));
		return false;
	}			
	if (!checkNumberRange(document.getElementById("txtSNMPMessage").value.length,0,INT_LMAX_EM_CONTENT,STR_WARN_EM_CONTENT)) {
		setUITagDisplay(4,4,'Notification');
		if (document.getElementById("tabSNMP_items").style.display == "none") setUIMoreDisplay(document.getElementById("tabSNMP"));
		jsFocus(document.getElementById("txtSNMPMessage"));
		return false;
	}
	
	if (!checkNumberRange(document.getElementById("txtOLELayer").value,20,1,STR_WARN_OLE_LAYER, false)) {
		setUITagDisplay(1,4,'Target');
		if (document.getElementById("tabOLEOption_items").style.display == "none") setUIMoreDisplay(document.getElementById("tabOLEOption"));
		jsFocus(document.getElementById("txtOLELayer"));
		return false;
	}
    
    return true;
} 
function jsSubmit() 
{
    if (!jsCheckInput())return false;
    setOption2Selected(document.fmMain.lstSpecifiedExtension);
	setOption2Selected(document.fmMain.lstSpecifiedAttachment);
    
    document.getElementById("ExceptionsString").value = objRule.ToString();
    document.getElementById("DelExceptionIds").value = objRule.deleteExceptions;
    jsAddCSRFToken(document.fmMain);
    document.fmMain.submit();
}

//for step1 file blocking
function jsAddExtension(oSource,oTarget,sID) 
{
	oSource.value = setTrim(oSource.value);
	if (oSource.value.length==0) return false;
	if(oSource.value.indexOf(".")>-1){
	    alert(STR_ERR_INVALID_EXTENSION);
		oSource.focus();oSource.select();
	    return false;
	}
	var vntName = oSource.value.split(";");
	if (!checkNumberRange(oTarget.length+vntName.length,INT_AB_ENTENSION_MAX,1,STR_ERR_AB_EXTENSION_COUNT)) return false;
	for (var i=0;i<vntName.length;i++) 
    {
		if (!checkExtensionFormat(vntName[i],STR_ERR_INVALID_EXTENSION))
        {
		    oSource.focus();oSource.select(); return false;
        }
		if (vntName[i].length > INT_LONG_EXTENSION_MAX) 
        {
            alert(STR_ERR_INVALID_EXTENSION);oSource.focus();oSource.select(); return false;
        }
	}
	
	var nTemp = 0;
	var sTemp1 = "";
	var sTemp2 = "";
	oSource.value = "";
	for (var i=0;i<vntName.length;i++) 
    {
		sTemp1 = "";
		sTemp2 = setTrim(vntName[i]);
		if (sTemp2 != "") {
			for (var j=0;j<sTemp2.length;j++) 
            {
				nTemp = sTemp2.charCodeAt(j);
				if (nTemp>=97 && nTemp<=122) nTemp = nTemp - 32;
				sTemp1 = sTemp1 + String.fromCharCode(nTemp);
			}
			oSource.value = sTemp1;
			document.getElementById("lst"+sID).style.width = null;
			setUIMoveItem(oSource,oTarget,true);
			setListboxUI(document.getElementById("lst"+sID),document.getElementById("div"+sID+"Inner"),document.getElementById("div"+sID+"Outer"));
		}
	}
}

function jsDelExtension(oTarget,sID) 
{
	document.getElementById("lst"+sID).style.width = null;
	setUIDelfromList(oTarget);
	setListboxUI(document.getElementById("lst"+sID),document.getElementById("div"+sID+"Inner"),document.getElementById("div"+sID+"Outer"));
}

function jsAddAttachment(oSource,oTarget,sID)
{
	oSource.value = setTrim(oSource.value);
	if (oSource.value.length==0) return false;
	if (oSource.value.length > 255){alert(STR_WARN_FILENAME_LENGTH);oSource.focus();oSource.select(); return false;};
	if (!checkNumberRange(oTarget.length+1,INT_AB_FILENAME_MAX,1,STR_ERR_AB_FILENAME_COUNT)) return false;
	//oSource.value=oSource.value.toUpperCase();
	var sTemp1 = "";
	var sTemp2 = oSource.value;
	var nTemp = 0;
	for (var i=0;i<sTemp2.length;i++) {
		nTemp = sTemp2.charCodeAt(i);
		if (nTemp>=97 && nTemp<=122) nTemp = nTemp - 32;
		sTemp1 = sTemp1 + String.fromCharCode(nTemp);
	}
	oSource.value = sTemp1;
	if (!checkAttachFileName(oSource.value,STR_ERR_INVALID_FILENAME)) return false;
	
	document.getElementById("lst"+sID).style.width = null;
	setUIMoveItem(oSource,oTarget,true);
	setListboxUI(document.getElementById("lst"+sID),document.getElementById("div"+sID+"Inner"),document.getElementById("div"+sID+"Outer"));
}

function jsDelAttachment(oTarget,sID) {
	document.getElementById("lst"+sID).style.width = null;
	setUIDelfromList(oTarget);
	setListboxUI(document.getElementById("lst"+sID),document.getElementById("div"+sID+"Inner"),document.getElementById("div"+sID+"Outer"));
}

function jsInitListbox() 
{
    if (bInitialList) return;
    setListboxUI(document.getElementById("lstSpecifiedExtension"),document.getElementById("divSpecifiedExtensionInner"),document.getElementById("divSpecifiedExtensionOuter"));
    setListboxUI(document.getElementById("lst"+"SpecifiedAttachment"),document.getElementById("div"+"SpecifiedAttachment"+"Inner"),document.getElementById("div"+"SpecifiedAttachment"+"Outer"));
    bInitialList = true;    
}
//for step 2
function jsAddException()
{
    gExcetpionOperate = OPER_ADD;
    addExceptionIndex = objRule.AddException();
    currentEditException = objRule.getException(addExceptionIndex);
    TmCube_Tree.isPolicyTree = true;
    TmCube_Tree.onload(); //initialize the site tree
    jsShowSpecifySites();
}
function jsChgRate(nRate,nIndex)
{
   if(nRate == "All"){nRate = objRule.length();}
   document.fmMain.optRecordPerPage.options[nIndex].selected = true;
   vRecordPerPage = nRate;
   jsPage(1);
}
function jsShowSpecifySites()
{
    //Hide Targ3_items, menu, policyBrief
    var tabTarg = document.getElementById("Tag2_items");
    var menu = document.getElementById("menu");
    var policyBrief = document.getElementById("policyBrief");
    tabTarg.style.display = "none";
    menu.style.display = "none";
    policyBrief.style.display = "none";

    //Hide add Policy button
    var editPolicyButton = document.getElementById("editPolicyButton");
    editPolicyButton.style.display = "none";

    //change subTitle
    var subTitle_editPolicy = document.getElementById("subTitle_editPolicy");
    var subTitle_specifySites = document.getElementById("subTitle_specifySites");
    var subTitle_specifyAccounts = document.getElementById("subTitle_specifyAccounts");
    subTitle_editPolicy.style.display = "none";
    subTitle_specifyAccounts.style.display = "none";
    subTitle_specifySites.style.display = "";

    //show page
    var specifyAccounts = document.getElementById("specifyAccounts");
    var specifySites = document.getElementById("specifySites");
    specifySites.style.display = "";
    specifyAccounts.style.display = "none";

    //show add/edit Exception button
    if(gExcetpionOperate == OPER_ADD)
    {
        var addExceptionButton = document.getElementById("addExceptionButton");
        addExceptionButton.style.display = "";
        var backButton = document.getElementById("exception_backButton");
        var submitButton = document.getElementById("exception_submitButton");
        var nextButton = document.getElementById("exception_nextButton");
        backButton.disabled = true;
        submitButton.style.display = "none";
        nextButton.style.display = "";
    }
    if(gExcetpionOperate == OPER_EDIT)
    {
        //show edit Exception button
        var editExceptionButton = document.getElementById("editExceptionButton");
        editExceptionButton.style.display = "";

        var editBackButton = document.getElementById("editBackButton");
        var editSubmitButton = document.getElementById("editSubmitButton");
        var editNextButton = document.getElementById("editNextButton");
        editBackButton.disabled = true;
        editSubmitButton.style.display = "none";
        editNextButton.style.display = "";
    }
}
function jsShowSpecifyAccounts()
{
    // Is any site to specify account
    var objAnysite = document.getElementsByName("rdAnysite");
    var bIsAnysite = objAnysite[0].checked;
    
    var ftADAccount = document.getElementById("ftADAccount");
    var lstSearchType = document.getElementById("lstSearchType");
    
    if(bIsAnysite) //only show ad search
    {        
        ftADAccount.style.display = "";
        lstSearchType.style.display = "none";

        if (!gbLastIsAnySiteToAccount && gstrLastSiteId!="")
        {
            if (confirm(STR_CONFIRM_ALL_SITE))
            {clearSPAccountSelected();}
            else return;
        }
    }
    else  //show ad & sp search
    {
        if(TmCube_Tree.currentSiteId == "")
        {
            alert(STR_ALERT_EXCEPTION_NO_SITE);
            return;
        }
        if(TmCube_Tree.currentSiteId != gstrLastSiteId)
        {
            clearSPAccountSelected();
        }
        ftADAccount.style.display = "none";
        lstSearchType.style.display = "";
    }
    gbLastIsAnySiteToAccount = bIsAnysite;
    gstrLastSiteId = TmCube_Tree.currentSiteId;
    
    //Hide Targ3_items, menu, policyBrief
    var tabTarg = document.getElementById("Tag2_items");
    var menu = document.getElementById("menu");
    var policyBrief = document.getElementById("policyBrief");
    tabTarg.style.display = "none";
    menu.style.display = "none";
    policyBrief.style.display = "none";
 
 
    //Hide add Policy button
    var editPolicyButton = document.getElementById("editPolicyButton");
    editPolicyButton.style.display = "none";

    //change subTitle
    var subTitle_editPolicy = document.getElementById("subTitle_editPolicy");
    var subTitle_specifySites = document.getElementById("subTitle_specifySites");
    var subTitle_specifyAccounts = document.getElementById("subTitle_specifyAccounts");
    subTitle_editPolicy.style.display = "none";
    subTitle_specifyAccounts.style.display = "";
    subTitle_specifySites.style.display = "none";

    //show page
    var specifyAccounts = document.getElementById("specifyAccounts");
    var specifySites = document.getElementById("specifySites");
    specifySites.style.display = "none";
    specifyAccounts.style.display = "";

    //show add/edit Exception button
    if(gExcetpionOperate == OPER_ADD)
    {
        var addExceptionButton = document.getElementById("addExceptionButton");
        addExceptionButton.style.display = "";
        var backButton = document.getElementById("exception_backButton");
        var submitButton = document.getElementById("exception_submitButton");
        var nextButton = document.getElementById("exception_nextButton");
        backButton.disabled = false;
        submitButton.style.display = "";
        nextButton.style.display = "none";
    }
    if(gExcetpionOperate == OPER_EDIT)
    {
        //show edit Exception button
        var editExceptionButton = document.getElementById("editExceptionButton");
        editExceptionButton.style.display = "";

        var editBackButton = document.getElementById("editBackButton");
        var editSubmitButton = document.getElementById("editSubmitButton");
        var editNextButton = document.getElementById("editNextButton");
        editBackButton.disabled = false;
        editSubmitButton.style.display = "";
        editNextButton.style.display = "none";
    }

   setListboxUI(document.getElementById("lstAvailableAccount"),document.getElementById("divAvailableAccountInner"),document.getElementById("divAvailableAccountOuter"));
   setListboxUI(document.getElementById("lstSelectedAccount"),document.getElementById("divSelectedAccountInner"),document.getElementById("divSelectedAccountOuter"));
    
}
function jsAddExceptionFinished()
{
     // Save Account
    var strAccountDisplayOld = currentEditException.strAccountDisplay;
    var strAccountGuidsOld = currentEditException.strAccountGuids;
    getAccountResult(currentEditException);
    if(currentEditException.strAccountGuids == "")
    {
        // Rollback
        currentEditException.strAccountDisplay = strAccountDisplayOld;
        currentEditException.strAccountGuids = strAccountGuidsOld;
        alert(STR_ALERT_EXCEPTION_NO_ACCOUNT);
        return;
    }

    gbLastIsAnySiteToAccount = false;
    gstrLastSiteId = "";
    gExcetpionOperate = "";
    
    var objException = currentEditException;
    
    getTreeResult(objException);           //.........
   
    clearSpecialSitesPage();               //.........
    clearSpecialAccountPage();             //.........

    //show Targ3_items, menu, policyBrief
    var tabTarg = document.getElementById("Tag2_items");
    var menu = document.getElementById("menu");
    var policyBrief = document.getElementById("policyBrief");
    tabTarg.style.display = "";
    menu.style.display = "";
    policyBrief.style.display = "";
    
    //show add Policy button
    var editPolicyButton = document.getElementById("editPolicyButton");
    editPolicyButton.style.display = "";

    //change subTitle
    var subTitle_editPolicy = document.getElementById("subTitle_editPolicy");
    var subTitle_specifySites = document.getElementById("subTitle_specifySites");
    var subTitle_specifyAccounts = document.getElementById("subTitle_specifyAccounts");
    subTitle_editPolicy.style.display = "";
    subTitle_specifyAccounts.style.display = "none";
    subTitle_specifySites.style.display = "none";
    
    //Hide page
    var specifyAccounts = document.getElementById("specifyAccounts");
    var specifySites = document.getElementById("specifySites");
    specifySites.style.display = "none";
    specifyAccounts.style.display = "none";

    //Hide add Exception button
    var addExceptionButton = document.getElementById("addExceptionButton");
    addExceptionButton.style.display = "none";

    jsPage(1);                //.........
}
function jsAddExceptionCanceled()
{
   gbLastIsAnySiteToAccount = false;
   gstrLastSiteId = "";
   gExcetpionOperate = "";

    objRule.RemoveException(addExceptionIndex);
    currentEditException = null;
    
    clearSpecialSitesPage();               //.........
    clearSpecialAccountPage();             //.........

    //show Targ3_items, menu, policyBrief
    var tabTarg = document.getElementById("Tag2_items");
    var menu = document.getElementById("menu");
    var policyBrief = document.getElementById("policyBrief");
    tabTarg.style.display = "";
    menu.style.display = "";
    policyBrief.style.display = "";

    //show add Policy button
    var editPolicyButton = document.getElementById("editPolicyButton");
    editPolicyButton.style.display = "";

    //change subTitle
    var subTitle_editPolicy = document.getElementById("subTitle_editPolicy");
    var subTitle_specifySites = document.getElementById("subTitle_specifySites");
    var subTitle_specifyAccounts = document.getElementById("subTitle_specifyAccounts");
    subTitle_editPolicy.style.display = "";
    subTitle_specifyAccounts.style.display = "none";
    subTitle_specifySites.style.display = "none";
    //Hide page
    var specifyAccounts = document.getElementById("specifyAccounts");
    var specifySites = document.getElementById("specifySites");
    specifySites.style.display = "none";
    specifyAccounts.style.display = "none";

    //Hide add Exception button
    var addExceptionButton = document.getElementById("addExceptionButton");
    addExceptionButton.style.display = "none";

}
function getTreeResult(objException)
{
    var rdAnysite = document.getElementsByName("rdAnysite");
 
    objException.vcGuidStore = new Array; //clearn the result;
    if (rdAnysite[0].checked)
    {
        objException.vcGuidStore.push(STR_ANYSITE);
        objException.strSiteDisplay = STR_ANYSITE;
    }
    else
    {
        var strDisplay = TmCube_Tree_getTreeResult(objException.vcGuidStore);
        objException.strSiteDisplay = strDisplay;
    }       
}
function getAccountResult(objExcetpion)
{
    var strAccountIds = "";         //    32 08478a42db8cf3140a5ff23c95c1aa65f    32 06e27fdf8b64b0647af939fc30b567555
    var strsAccoutDisplay = "";     //testAccount1;testAccount2
    var rdAnyone = document.getElementsByName("rdAnyone");
    if(rdAnyone[0].checked)
    {
        strAccountIds = STR_ANYONE;
        strsAccoutDisplay = STR_ANYONE;
    }
    else
    {
        var lstSelectedAccount = document.getElementById("lstSelectedAccount");

        for (var i=0; i<lstSelectedAccount.options.length; ++i)
        {
            var opt = lstSelectedAccount.options[i];
            strAccountIds += opt.value;
            strsAccoutDisplay += opt.innerText;
            strsAccoutDisplay +=";"
         }
    }
    objExcetpion.strAccountDisplay = strsAccoutDisplay;
    objExcetpion.strAccountGuids = strAccountIds;    
}
function clearSpecialSitesPage()
{
    var treepanel = document.getElementById("Tree__treepanel");
    treepanel.innerHTML = "";
    
    var rdAnysite = document.getElementsByName("rdAnysite");
    var objInputSearch = document.getElementById("siteSearchInput");
    
    rdAnysite[1].checked = true;
    objInputSearch.value = "";
    jsAnysiteCheck();    
}
function clearSPAccountSelected()
{
    var objInputSearch = document.getElementById("txtSearch");
    var lstSearchType = document.getElementById("lstSearchType");
    var lstAvailableAccount = document.getElementById("lstAvailableAccount");
    var lstSelectedAccount =  document.getElementById("lstSelectedAccount");

    objInputSearch.value="";
    lstSearchType.options[0].checked = true;
    
    jsClearList(lstAvailableAccount);
    for (var i=document.getElementById("tabAvailableAccountList").rows.length;i>0;i--) {
		    document.getElementById("tabAvailableAccountList").deleteRow(i-1);
	}

    var i=document.getElementById("tabSelectedAccountList").rows.length;
    while(i>0)
    {

        var objRow = document.getElementById("tabSelectedAccountList").rows[i-1];
        var objCell =  objRow.cells[0];
        var objImg = objCell.getElementsByTagName("img")[0];
        
        if (objImg.src.indexOf("SP_user.gif") !=-1 ||
            objImg.src.indexOf("sp_group.gif") !=-1 ) //ad user group
        {
            lstSelectedAccount.remove(i-1);
            document.getElementById("tabSelectedAccountList").deleteRow(i-1);
        }
        i--;
    }
}

function clearSpecialAccountPage()
{
    var rdAnyone = document.getElementsByName("rdAnyone");
    var objInputSearch = document.getElementById("txtSearch");
    var chkUser = document.getElementById("chkUser");
    var chkGroup = document.getElementById("chkGroup");
    var lstSearchType = document.getElementById("lstSearchType");
    var lstAvailableAccount = document.getElementById("lstAvailableAccount");
    var lstSelectedAccount =  document.getElementById("lstSelectedAccount");

rdAnyone[1].checked = true;
    objInputSearch.value="";
    chkUser.checked = true;
    chkGroup.checked = true;
    lstSearchType.options[0].checked = true;
    jsClearList(lstAvailableAccount);
    for (var i=document.getElementById("tabAvailableAccountList").rows.length;i>0;i--) {
		    document.getElementById("tabAvailableAccountList").deleteRow(i-1);
	}
    
    jsClearList(lstSelectedAccount);
    for (var i=document.getElementById("tabSelectedAccountList").rows.length;i>0;i--) {
		    document.getElementById("tabSelectedAccountList").deleteRow(i-1);
	}
    
   setListboxUI(document.getElementById("lstAvailableAccount"),document.getElementById("divAvailableAccountInner"),document.getElementById("divAvailableAccountOuter"));
   setListboxUI(document.getElementById("lstSelectedAccount"),document.getElementById("divSelectedAccountInner"),document.getElementById("divSelectedAccountOuter"));
   jsAnyoneCheck();
    
}

// show exceptions of pageNum in the exceptionList
function jsPage(pageNum)
{
    var nTotalCount = objRule.length();
    var nTotalPage = Math.ceil(nTotalCount/vRecordPerPage);
    if (pageNum == -1)
        pageNum =  nTotalPage;
	if (pageNum < 1) { pageNum=1; } 
	if( pageNum > nTotalPage)
	    pageNum = nTotalPage;
	if (!checkNumberRange(pageNum,nTotalPage,1,STR_ERR_INVALID_LOG_PAGE_NUM)){return;}
    nCurrentPage = pageNum;
    var countStart = vRecordPerPage * (nCurrentPage-1) + 1;
    var countEnd = vRecordPerPage * nCurrentPage > nTotalCount ? nTotalCount : vRecordPerPage * nCurrentPage  ;
    //set delete button status
    if (!objRule.hasChecked())
    {
        setUIFunctionLink(false,"cmdDelItem1");
        setUIFunctionLink(false,"cmdDelItem2");
    }
    else 
    {
        setUIFunctionLink(true,"cmdDelItem1");
        setUIFunctionLink(true,"cmdDelItem2");
    }
    if (nTotalCount == 0)
    {
        countStart = 0;
        countEnd = 0;
        nTotalPage = 0;
        nCurrentPage = 0;
    }
    //set countStart, countEnd, nTotalCount, nCurrentPage, nTotalPage to the page
    var labRecordS = document.getElementById("labRecordS1");
    var labRecordE = document.getElementById("labRecordE1");
    var labTotalRec =  document.getElementById("labTotalRec1");
    var txtPageNum = document.getElementById("txtPageNum1");
    var labTotalPage = document.getElementById("labTotalPage1");
    labRecordS.innerText = countStart;
    labRecordE.innerText = countEnd;
    labTotalRec.innerText = nTotalCount;
    txtPageNum.value = nCurrentPage;
    labTotalPage.innerText = nTotalPage;
    labRecordS = document.getElementById("labRecordS2");
    labRecordE = document.getElementById("labRecordE2");
    labTotalRec =  document.getElementById("labTotalRec2");
    txtPageNum = document.getElementById("txtPageNum2");
    labTotalPage = document.getElementById("labTotalPage2");
    labRecordS.innerText = countStart;
    labRecordE.innerText = countEnd;
    labTotalRec.innerText = nTotalCount;
    txtPageNum.value = nCurrentPage;
    labTotalPage.innerText = nTotalPage;

   //show exceptions of current page
    var tableExplist = document.getElementById("tabList");
    clearTable(tableExplist); //clear the exception list table, reserve the head
    var style = "data2b";
    if (countStart <= 0)return;
    for (var i = countStart; i<= countEnd; i++)
    {   
        var objExp = objRule.getException(i -1);
        
        if(0 == (i % 2))
        {
            style = "data2b";
        }
        else 
        {
            style = "data1b";
        }
        var trExp = tableExplist.insertRow(-1);
        var tdCheck = trExp.insertCell(-1);
        var tdSites = trExp.insertCell(-1);
        
        tdCheck.setAttribute("width","4%");
        TmCube_Tree_setClassName(tdCheck,style);
		var chkAllChecked = true;
        if (objExp.bIsChecked)
        {
            tdCheck.innerHTML = "<input type=\"checkbox\" name=\"chkItems\" value=\""+objExp.id+"\" onclick='jsItem_Check(fmMain.chkSelectAll,\""+objExp.id+"\")' checked >";
        }
        else
        {
		    chkAllChecked = false;
            tdCheck.innerHTML = "<input type=\"checkbox\" name=\"chkItems\" value=\""+objExp.id+"\" onclick='jsItem_Check(fmMain.chkSelectAll,\""+objExp.id+"\");'>";
        }
        fmMain.chkSelectAll.checked = chkAllChecked;
        TmCube_Tree_setClassName(tdSites, style);
        var sep = (objExp.IsAnySite() ? ";":"");
        tdSites.innerHTML = "<a href=\"javascript:jsEditException('"+objExp.id+"');\">"+wrapStr(objExp.strSiteDisplay,INT_SITE_DISPLAY_LEN)+sep+wrapStr(objExp.strAccountDisplay,INT_ACCOUNT_DISPLAY_LEN)+"</a>";
    }
}

function jsItem_Check(oAll, exceptionId)
{
    objRule.checked(exceptionId);
    oAll.checked = objRule.allChecked();
    jsPage(nCurrentPage);
}

function jsSelectAll()
{
   var bCheckedAll = fmMain.chkSelectAll.checked;
    var exceplength = objRule.length();
	if(exceplength==0)
	  {
	     setUIFunctionLink(false,"cmdDelItem1");
		 setUIFunctionLink(false,"cmdDelItem2");
		 return;
	  }
	var countStart = vRecordPerPage * (nCurrentPage-1);
    var countEnd = vRecordPerPage * nCurrentPage > exceplength ? exceplength : vRecordPerPage * nCurrentPage;
	objRule.checkRange(countStart,countEnd,bCheckedAll);	
    jsPage(nCurrentPage);
}

function jsDelItem()
{
    objRule.actionDelete();
    jsPage(1);
    fmMain.chkSelectAll.checked = false;
}
function jsKeyPressEvent(e,nValue){
    var key = window.event ? e.keyCode : e.which;
    if(key == 13)
        jsPage(nValue);
}
function wrapStr(str, len)
{
    var ret = str;
    if (str.length > len)
        ret = str.substring(0,len-3) + "...";
    return ret;
}
//clear the table data, reserve the head
function clearTable(table)
{
    while(table.rows.length >1)
    {
        var tr = table.rows[1];
        tr.parentNode.removeChild(tr);
    }
}
//for edit exception sites/account
function jsEditException(exceptionId)
{
    gExcetpionOperate = OPER_EDIT;
    currentEditException = objRule.searchException(exceptionId);
    // initialize sites  
    var rdAnysite = document.getElementsByName("rdAnysite");
    if (currentEditException.IsAnySite())
    {   
        gbLastIsAnySiteToAccount = true;
        gstrLastSiteId = "";
        rdAnysite[0].checked = true;
    }
    else
    {
        gbLastIsAnySiteToAccount = false;
        gstrLastSiteId = currentEditException.getCurrentSiteId();
        rdAnysite[1].checked = true;
    }
    jsAnysiteCheck();
    TmCube_Tree.isPolicyTree = true;
    TmCube_Tree.onload(); //initialize the site tree  

    // initialize account
    var rdAnyone = document.getElementsByName("rdAnyone");
    if (currentEditException.IsAnyone())
    {   
        rdAnyone[0].checked = true;
    }
    else
    {
        rdAnyone[1].checked = true;
            
        var vecAccountStr = new Array;
        var vecAccountDisplay = new Array;
        currentEditException.getAccountArray(vecAccountStr, vecAccountDisplay);
        var lstExistAccount = document.getElementById("lstExistAccount");
        jsClearList(lstExistAccount);
        for (var i=0; i<vecAccountStr.length && i<vecAccountDisplay.length; i++)
        {
            var strAccount = vecAccountStr[i];
            var strName = vecAccountDisplay[i];
            var strType = setTrim(strAccount.substr(lenLength, lenType));
            lstExistAccount.options[lstExistAccount.options.length] = new Option(strName, parseInt(strType) + "\t" + strAccount);
        }
        jsAddExistAccount();
    }
    jsAnyoneCheck();


    jsShowSpecifySites();
}


function jsEditExceptionFinished()
{
     // Save Account
    var strAccountDisplayOld = currentEditException.strAccountDisplay;
    var strAccountGuidsOld = currentEditException.strAccountGuids;
    getAccountResult(currentEditException);
    if(currentEditException.strAccountGuids == "")
    {
        // Rollback
        currentEditException.strAccountDisplay = strAccountDisplayOld;
        currentEditException.strAccountGuids = strAccountGuidsOld;
        alert(STR_ALERT_EXCEPTION_NO_ACCOUNT);
        return;
    }

    gbLastIsAnySiteToAccount = false;
    gstrLastSiteId = "";
    gExcetpionOperate = "";

    // Save Site
    getTreeResult(currentEditException);

    currentEditException = null; 

    //change subTitle
    var subTitle_specifySites = document.getElementById("subTitle_specifySites");
    var subTitle_specifyAccounts = document.getElementById("subTitle_specifyAccounts");
    var subTitle_editSites = document.getElementById("subTitle_editSites");
    var subTitle_editAccounts = document.getElementById("subTitle_editAccounts");
    subTitle_specifyAccounts.style.display = "none";
    subTitle_specifySites.style.display = "none";
    subTitle_editSites.style.display = "none";
    subTitle_editAccounts.style.display = "none";

    //Hide page
    var specifyAccounts = document.getElementById("specifyAccounts");
    var specifySites = document.getElementById("specifySites");
    specifySites.style.display = "none";
    specifyAccounts.style.display = "none";

    //Hide edit Exception button
    var editExceptionButton = document.getElementById("editExceptionButton");
    editExceptionButton.style.display = "none";

    
    clearSpecialSitesPage();               //.........
    clearSpecialAccountPage(); 
    jsPage(1);
     
    //show Targ3_items, menu, policyBrief
    var tabTarg = document.getElementById("Tag2_items");
    var menu = document.getElementById("menu");
    var policyBrief = document.getElementById("policyBrief");
    tabTarg.style.display = "";
    menu.style.display = "";
    policyBrief.style.display = "";
    
    //show edit button
    var editPolicyButton = document.getElementById("editPolicyButton");
    editPolicyButton.style.display = ""; 
}

function jsEditExceptionCancel()
{
    currentEditException = null; 
    
    gbLastIsAnySiteToAccount = false;
    gstrLastSiteId = "";
    gExcetpionOperate = "";
    
    //change subTitle
    var subTitle_specifySites = document.getElementById("subTitle_specifySites");
    var subTitle_specifyAccounts = document.getElementById("subTitle_specifyAccounts");
    var subTitle_editSites = document.getElementById("subTitle_editSites");
    var subTitle_editAccounts = document.getElementById("subTitle_editAccounts");
    subTitle_specifyAccounts.style.display = "none";
    subTitle_specifySites.style.display = "none";
    subTitle_editSites.style.display = "none";
    subTitle_editAccounts.style.display = "none";

    //Hide page
    var specifyAccounts = document.getElementById("specifyAccounts");
    var specifySites = document.getElementById("specifySites");
    specifySites.style.display = "none";
    specifyAccounts.style.display = "none";

    //Hide edit Exception button
    var addExceptionButton = document.getElementById("editExceptionButton");
    addExceptionButton.style.display = "none";

    
    clearSpecialSitesPage();            
    clearSpecialAccountPage();             

    jsPage(1);                
    
    //show Targ3_items, menu, policyBrief
    var tabTarg = document.getElementById("Tag2_items");
    var menu = document.getElementById("menu");
    var policyBrief = document.getElementById("policyBrief");
    tabTarg.style.display = "";
    menu.style.display = "";
    policyBrief.style.display = "";

    //show edit button
    var editPolicyButton = document.getElementById("editPolicyButton");
    editPolicyButton.style.display = ""; 

}
function jsSearchSite(inputId)
{
    var str=document.getElementById(inputId).value;
    TmCube_Tree_UrlSearch(str);
}
//step4 notification page
function jsUIDependency()
{
     //Violator Notification
	 if(!bIsRealTime)
	 {
	    document.getElementById("txtNotifyViolatorSubject").disabled = (!document.getElementById("chkNotifyViolator").checked);
	    document.getElementById("optViolatorMessageType").disabled = (!document.getElementById("chkNotifyViolator").checked);
	    document.getElementById("txtNotifyViolatorMessage").disabled = (!document.getElementById("chkNotifyViolator").checked);
	 }
	//Administrator Notification
	document.getElementById("txtNotifyAdminTo1").disabled = (!document.getElementById("chkNotifyAdmin").checked);
	document.getElementById("txtNotifyAdminSubject").disabled = (!document.getElementById("chkNotifyAdmin").checked);
	document.getElementById("optAdminMessageType").disabled = (!document.getElementById("chkNotifyAdmin").checked);
	document.getElementById("txtNotifyAdminMessage").disabled = (!document.getElementById("chkNotifyAdmin").checked);
	var settingRadio = document.getElementsByName("optNotifyAdminSettings");
	for(var i = 0;i<settingRadio.length;i++)
	    settingRadio[i].disabled= (!document.getElementById("chkNotifyAdmin").checked);	
	document.getElementById("txtNotifyAdminSettingsPeriod").disabled = (!document.getElementById("chkNotifyAdmin").checked);
	document.getElementById("optNotifyAdminSettingsPeriodUnit").disabled = (!document.getElementById("chkNotifyAdmin").checked);
	document.getElementById("txtNotifyAdminSettingsOccurence").disabled = (!document.getElementById("chkNotifyAdmin").checked);
	//SNMP Notification
	document.getElementById("txtSNMPIP").disabled = (!document.getElementById("chkNotifySNMP").checked);
	document.getElementById("txtSNMPCommunity").disabled = (!document.getElementById("chkNotifySNMP").checked);
	document.getElementById("optSNMPMessageType").disabled = (!document.getElementById("chkNotifySNMP").checked);
	document.getElementById("txtSNMPMessage").disabled =!document.getElementById("chkNotifySNMP").checked ;  
}
// For account search
function jsAddSelectedAccount() {
    var oSourceList = document.getElementById("lstAvailableAccount");
    var oList = document.getElementById("lstSelectedAccount");
    var oTable = document.getElementById("tabSelectedAccountList");

	var nCount = 0;
	for (var i=0;i<oSourceList.options.length;i++) {
		if (oSourceList.options[i].selected) 
		{
		    nCount++;
		    for(var j=0;j<oList.options.length;j++)
		    {
		       var LItem = oList.options[j].value.split(String.fromCharCode(9));
		       var SItem = oSourceList.options[i].value.split(String.fromCharCode(9));
		       var Lguid=LItem[1];
		       var Sguid=SItem[1];
		       if(Lguid==Sguid)
		       {   
		           oSourceList.options[i].selected=false;
		       }
		    }
		}
	}
	if (nCount==0) return;
	
	for (i=0;i<oSourceList.options.length;i++) {
		if (oSourceList.options[i].selected) 
		{
		   jsAddItemOnce(oList,oTable,oSourceList.options[i].value);
		}
	}
    setListboxUI(document.getElementById("lstAvailableAccount"),document.getElementById("divAvailableAccountInner"),document.getElementById("divAvailableAccountOuter"));
    setListboxUI(document.getElementById("lstSelectedAccount"),document.getElementById("divSelectedAccountInner"),document.getElementById("divSelectedAccountOuter"));

}

function jsRemoveSelectedAccount()
{
   jsRemove();
   setListboxUI(document.getElementById("lstSelectedAccount"),document.getElementById("divSelectedAccountInner"),document.getElementById("divSelectedAccountOuter"));
}
function jsRemove()
{
    var oList = document.getElementById("lstSelectedAccount");
    var oTable = document.getElementById("tabSelectedAccountList");

    for (var i=0;i<oList.options.length;i++) 
	{
		if (oList.options[i].selected)
		{
			oList.remove(i);
			oTable.deleteRow(i);
		//    setListboxUI(document.getElementById("lstSelectedAccount"),document.getElementById("divSelectedAccountInner"),document.getElementById("divSelectedAccountOuter"));

            jsRemove();
		}
	}
   
}

function jsSearchAccount(txtKeyword) {
    var strKeyword = document.getElementById(txtKeyword).value;	
	document.getElementById("btnSearchAccount").disabled = true;
    var bUser = document.getElementById("chkUser").checked;
    var bGroup = document.getElementById("chkGroup").checked;
    if (!bUser &&  !bGroup) 
    {
        alert(STR_ALERT_SEARCHACCOUNT_NO_TYPE);
       	document.getElementById("btnSearchAccount").disabled = false;
        return;
    }
    var searchType = document.getElementById("lstSearchType").value;
    if(searchType == "1") //search AD
    {
        ifmAccount.jsGetAccount(strKeyword, bUser, bGroup);
    }
    else
    {
         ifmAccount.jsGetAccount(strKeyword, 0, 0, bUser, bGroup, TmCube_Tree.currentSiteId);
    }
}

function jsAddSearch() {
	if (window.ifmAccount.document.fmMain.txtResultCount.value > INT_NMAX_SEARCH_RESULT) {
		alert(STR_WARN_SEARCH_RESULT_OVER);
		window.ifmAccount.document.fmMain.lstResult.options.length = INT_NMAX_SEARCH_RESULT;
	}
	//alert(window.ifmAccount.document.fmMain.txtResultCount.value);
	// empty the list box
	document.getElementById("btnSearchAccount").disabled = false;
	jsClearList(document.getElementById("lstAvailableAccount"));
	
    for (var i=document.getElementById("tabAvailableAccountList").rows.length;i>0;i--) {
		    document.getElementById("tabAvailableAccountList").deleteRow(i-1);
	}
	document.getElementById("lstAvailableAccount").style.width = "";
	document.getElementById("lstAvailableAccount").style.height= "";
    	
	// Add Search List, [NAME][GUID][TYPE]
	var vItem;
	var vTemp;
	var vIndex;
    var sDetail="";

	for (var i=0;i<window.ifmAccount.document.fmMain.lstResult.options.length;i++) {
		vTemp = window.ifmAccount.document.fmMain.lstResult.options[i].value;
		vItem = vTemp.split(String.fromCharCode(9));
		var vName = vItem[0];
        
		vIndex = setUIAddItemWithValue(vName,vTemp,document.getElementById("lstAvailableAccount"));
		sDetail = setHTMLString(sDetail);
		switch(vItem[2])                                       //Account type:ad user,ad group,special group,smtp address
		{
		     case "0":
		       vTemp= "<img src='images/ad_user.gif' onmouseout='hideToolTip(\"ifmToolTip\");' onmouseover='showToolTip1(event,\"ifmToolTip\",300,100,\"Detail\",\"\");'>";//\"Detail\",\""+sDetail+"\");'> ";
		       break;
		    case "1":
		       vTemp = "<img src='images/ad_group.gif' onmouseout='hideToolTip(\"ifmToolTip\");' onmouseover='showToolTip1(event,\"ifmToolTip\",300,100,\"Detail\",\"\");'>";//\"Detail\",\""+sDetail+"\");'> ";
		       break;
		    case "2":case "4":
		       vTemp= "<img src='images/SP_user.gif' onmouseout='hideToolTip(\"ifmToolTip\");' onmouseover='showToolTip1(event,\"ifmToolTip\",300,100,\"Detail\",\"\");'>";//\"Detail\",\""+sDetail+"\");'> ";
               break;
            case "3":
		       vTemp= "<img src='images/sp_group.gif' onmouseout='hideToolTip(\"ifmToolTip\");' onmouseover='showToolTip1(event,\"ifmToolTip\",300,100,\"Detail\",\"\");'>";//\"Detail\",\""+sDetail+"\");'> ";
		       break;
		}
		insertTableRowByIndex(document.getElementById("tabAvailableAccountList"),vTemp,"",vIndex);
	}
	//jsContactListUI(document.getElementById("lst"+oSearchlocal),document.getElementById("div"+oSearchlocal),document.getElementById("div"+oSearchlocal+"List"));
    setListboxUI(document.getElementById("lstAvailableAccount"),document.getElementById("divAvailableAccountInner"),document.getElementById("divAvailableAccountOuter"));
}
function insertTableRowByIndex(oTable,sText,sValue,nIndex) {
	if (oTable == null || sText == "" || nIndex < 0) { return; }
	
	var oRow = oTable.insertRow(nIndex);
	var oCell = oRow.insertCell(0);
	oCell.className = "listNormal";
	oCell.innerHTML = sText;
	oCell.title = sValue;
}
// like "    32 08478a42db8cf3140a5ff23c95c1aa65f"
function joinAccountString(vtype,vguid)
{
    var iLen = vguid.length;
    var retValue="";
        
    //the first 6 bytes used to recode the lenght of each item.   
	var nLen=iLen;
	var j=0;
    if (nLen == 0)j =1;
    else
    {
	    while(parseInt(nLen)/10!=0) 
        {
            nLen=parseInt(nLen)/10;
            j++;
        }
    }
    for(;j<lenLength;j++)       
        retValue+=" ";
    retValue+=iLen;
    
    j=0;
    nLen = vtype;
    if (nLen == 0)j =1;
    else
    {
	    while(parseInt(nLen)/10!=0) 
        {
            nLen=parseInt(nLen)/10;
            j++;
        }
    }
    for(;j<lenType;j++)       
        retValue+=" ";
    retValue+=vtype;

    retValue+=vguid;
    return retValue; 
}
function jsAddItemOnce(oList, oTable, ItemValue)
{
    var vItem;
    var vTemp;
    var vIndex;
    var sDetail="";
    
    vTemp = ItemValue;
    vItem = vTemp.split(String.fromCharCode(9));
    var vName = vItem[0];
	var vGuid = vItem[1];
    var vType = vItem[2];
    var vValue = joinAccountString(vType,vGuid);
    vIndex = setUIAddItemWithValue(vName,vValue,oList);
   
    sDetail = setHTMLString(sDetail);
    switch(vItem[2])                                       //Account type:ad user,ad group,special group,smtp address
	{
	    case "0":
	       vTemp = "<img src='images/ad_user.gif' onmouseout='hideToolTip(\"ifmToolTip\");' onmouseover='showToolTip1(event,\"ifmToolTip\",300,100,\"Detail\",\"\");'>"; // \"Detail\",\""+sDetail+"\");'> ";
	       break;
	    case "1":
	       vTemp = "<img src='images/ad_group.gif' onmouseout='hideToolTip(\"ifmToolTip\");' onmouseover='showToolTip1(event,\"ifmToolTip\",300,100,\"Detail\",\"\");'>"; // \"Detail\",\""+sDetail+"\");'> ";
	       break;
	    case "2":case "4":
		       vTemp= "<img src='images/SP_user.gif' onmouseout='hideToolTip(\"ifmToolTip\");' onmouseover='showToolTip1(event,\"ifmToolTip\",300,100,\"Detail\",\"\");'>";//\"Detail\",\""+sDetail+"\");'> ";
               break;
        case "3":
		       vTemp= "<img src='images/sp_group.gif' onmouseout='hideToolTip(\"ifmToolTip\");' onmouseover='showToolTip1(event,\"ifmToolTip\",300,100,\"Detail\",\"\");'>";//\"Detail\",\""+sDetail+"\");'> ";
		       break;
	} 
    insertTableRowByIndex(oTable,vTemp,"",vIndex); 

}
function jsClearList(oTarget) {
	// Clear List
	for (var i=oTarget.length;i>0;i--) {
		oTarget.remove(i-1);
	}
}
function jsAnysiteCheck()
{
    var objAnysite = document.getElementsByName("rdAnysite");
    
    var inputSearch = document.getElementById("siteSearchInput");
    var btnSearchSite = document.getElementById("btnSearchSite"); 
    if(objAnysite[0].checked)
    {
        btnSearchSite.disabled = true;
        inputSearch.disabled = true;
        TmCube_Tree.disabled = true;
    }
    else
    {
        btnSearchSite.disabled = false;
        inputSearch.disabled = false;
        TmCube_Tree.disabled = false;
    }
}
function jsAnyoneCheck()
{
    var objAnyone = document.getElementsByName("rdAnyone");
    var tableAnyone = document.getElementById("tabAnyone");
    var btnSearchAccount = document.getElementById("btnSearchAccount");
    var btnAddAccount = document.getElementById("btnAddAccount");
    var btnRemoveAccount = document.getElementById("btnRemoveAccount");
    var lstAvailableAccount = document.getElementById("lstAvailableAccount");
    var lstSelectedAccount = document.getElementById("lstSelectedAccount");
    var inputSearch = document.getElementById("txtSearch"); 
    if(objAnyone[0].checked)
    {
        btnSearchAccount.disabled = true;    
        tableAnyone.disabled = true;    
        btnAddAccount.disabled = true;    
        btnRemoveAccount.disabled = true;    
        lstAvailableAccount.disabled = true;    
        lstSelectedAccount.disabled = true;    
        inputSearch.disabled = true;    
    }
    else
    {
        btnSearchAccount.disabled = false;    
        tableAnyone.disabled = false;    
        btnAddAccount.disabled = false;    
        btnRemoveAccount.disabled = false;    
        lstAvailableAccount.disabled = false;    
        lstSelectedAccount.disabled = false;
        inputSearch.disabled = false;
    }
}
function jsAddExistAccount()
{
    var srcList = document.getElementById("lstExistAccount");
    var sDetail="";
	for (var i=0;i<srcList.options.length;i++) {
		vTemp = srcList.options[i].value;    //type\tAccountstring
		vItem = vTemp.split(String.fromCharCode(9));
		var vName = srcList.options[i].innerText;
        var vValue = vItem[1];
		vIndex = setUIAddItemWithValue(vName,vValue,document.getElementById("lstSelectedAccount"));
		
        sDetail = setHTMLString(sDetail);
		switch(vItem[0])                                       //Account type:ad user,ad group,special group,smtp address
		{
		     case "0":
		       vTemp= "<img src='images/ad_user.gif' onmouseout='hideToolTip(\"ifmToolTip\");' onmouseover='showToolTip1(event,\"ifmToolTip\",300,100,\"Detail\",\"\");'>";//\"Detail\",\""+sDetail+"\");'> ";
		       break;
		    case "1":
		       vTemp = "<img src='images/ad_group.gif' onmouseout='hideToolTip(\"ifmToolTip\");' onmouseover='showToolTip1(event,\"ifmToolTip\",300,100,\"Detail\",\"\");'>";//\"Detail\",\""+sDetail+"\");'> ";
		       break;
		    case "2":case "4":
		       vTemp= "<img src='images/SP_user.gif' onmouseout='hideToolTip(\"ifmToolTip\");' onmouseover='showToolTip1(event,\"ifmToolTip\",300,100,\"Detail\",\"\");'>";//\"Detail\",\""+sDetail+"\");'> ";
               break;
            case "3":
		       vTemp= "<img src='images/sp_group.gif' onmouseout='hideToolTip(\"ifmToolTip\");' onmouseover='showToolTip1(event,\"ifmToolTip\",300,100,\"Detail\",\"\");'>";//\"Detail\",\""+sDetail+"\");'> ";
		       break;
		}
		insertTableRowByIndex(document.getElementById("tabSelectedAccountList"),vTemp,"",vIndex);
    }
    
}

function jsOpenOnlineHelp()
{
	var helppage="";	
	if(window.location.search.indexOf("&",window.location.search.indexOf("Subject=")+8)>-1)
	{
	    winSubject = window.location.search.substring((window.location.search.indexOf("Subject=")+8),window.location.search.indexOf("&",window.location.search.indexOf("Subject=")+8));
	}
	else
	{
	    winSubject = window.location.search.substring((window.location.search.indexOf("Subject=")+8),window.location.search.length);
	}

	helppage = "Attachmentblocking_Edit_Policy.htm";

	jsMapOnlineHelp(helppage);
}

function jsCheckRuleDescriptionLength(obj, eve)
{
	if(obj.value.length >= INT_LMAX_CF_DESCRIPTION)
	{
		if(window.event) 
			event.returnValue = false; // IE
		else {			
			// if firefox, you must deliver 'event' as a parameter
			eve.preventDefault(); // firefox
		}
	}	
}

//-->
</script>
<style id="CompCSS" type="text/css">

.tabbedPane
{
 position : relative;
 padding : 10px;
 border : 1px solid #666666;
}
/* Compnent : Tree */
div.lineIE
{
	margin-top:-3px;
	height : 18px;
	FONT-SIZE: 10px;
	FONT-FAMILY: "Verdana", "Arial", "Helvetica", "sans-serif";
	word-wrap: normal;
	white-space : nowrap;
}
div.lineNS
{
	height : 18px;
	FONT-SIZE: 10px;
	FONT-FAMILY: "Verdana", "Arial", "Helvetica", "sans-serif";
	word-wrap: normal;
	white-space : nowrap;
}
div.subitems
{
    padding-left: 16px;
    FONT-SIZE: 10px;
    FONT-FAMILY: "Verdana", "Arial", "Helvetica", "sans-serif";
	background-image:url(./images/tree_line2.gif);
    background-repeat:repeat-y;
}
div.bottomsubitems
{
    padding-left: 16px;
    FONT-SIZE: 10px;
	FONT-FAMILY: "Verdana", "Arial", "Helvetica", "sans-serif";
}

div.root
{
	overflow : auto;
	border : 1px solid;
	padding:2px;
}
.iconbutton
{
	cursor : hand;
}
</style>

</head>
<body onLoad="jsInitPage();">
<form id="fmMain" name="fmMain" action="$$FORM_ACTION$$" method="POST">
<input type="hidden" name="RuleId" value="$$RULE_ID$$">
<input type="hidden" id="ExceptionsString" name="ExceptionsString" value="$$EXCEPTIONS_STRING$$">
<input type="hidden" id="DelExceptionIds" name="DelExceptionIds" value="">
<input type="hidden" id="txtSSTaskName" name="txtSSTaskName" value="$$SS_TASK_NAME$$" />
<input type="hidden" id="txtSSTaskBehavior" name="txtSSTaskBehavior" value="$$SS_TASK_BEHAVIOR$$" />
<!--Page Title-->

<table width="650" border="0" cellspacing="0" cellpadding="0">
<tr><td class="content-title">$$AB_CONTENT_TITLE$$: Edit Policy</td>
	<td align="right" valign="bottom">
		<a href="javascript:jsOpenOnlineHelp();" class="moretestblue">
		<img src="images/question.gif" border="0"> Help</a></td></tr>
<tr><td colspan="2" height="4"></td></tr>
<tr><td colspan="2" height="1" background="images/dot.gif"></td></tr>
<tr><td colspan="2" height="10"></td></tr>
</table>
<!--/Page Title-->

<table width="650" border="0" cellpadding="0" cellspacing="0">
   <tr id="subTitle_editPolicy"><td  class="data1"><a href="javascript:jsCancel();"><u>Policy List </u></a>&gt;$$RULE_NAME$$</td></tr>

   <tr id="subTitle_specifySites" style="display:none"><td  class="data1"><a href="javascript:jsCancel();"><u>Policy List </u></a>&gt; <a href="javascript:jsAddExceptionCanceled();"><u>Exceptions</u></a>&gt; Specify Sites</td></tr>
   <tr id="subTitle_specifyAccounts" style="display:none"><td  class="data1"><a href="javascript:jsShowFirstStep();"><u>Policy List </u></a>&gt; <a href="javascript:jsAddExceptionCanceled();"><u>Exceptions</u></a>&gt; Specify Accounts</td></tr>
   <tr id="subTitle_editSites" style="display:none"><td  class="data1"><a href="javascript:jsShowFirstStep();"><u>Policy List </u></a>&gt; <a
   href="javascript:jsEditExceptionCancel();"><u>Exceptions</u></a>&gt; Edit Sites</td></tr>
   <tr id="subTitle_editAccounts" style="display:none"><td  class="data1"><a href="javascript:jsShowFirstStep();"><u>Policy List </u></a>&gt; <a
   href="javascript:jsEditExceptionCancel();"><u>Exceptions</u></a>&gt; Edit Accounts</td></tr>
   <tr><td>
       <table id="policyBrief">
       <tr><td colspan="2" class="data1"><span class="style11"> 
           <input name="optPolicyEnabled" type="checkbox"  $$OPT_POLICY_ENABLED$$/> 
           </span>Enable this policy </td></tr> 
       <tr><td colspan="2"><img src="images/1space_cui.gif" width="1" height="10"></td></tr> 
       <tr><td colspan="2" class="data1">
           <table border="0" cellspacing="0" cellpadding="0"> 
           <tr> 
              <td width="18" class="data1">&nbsp;</td> 
              <td width="102" class="button">Policy name:</td> 
              <td width="524" class="data1"><input id="RuleName" name="RuleName" class="button" value="$$RULE_NAME$$" size="80" /></td> 
            </tr> 
            <tr> 
              <td valign="top" class="data1">&nbsp;</td> 
              <td valign="top" class="button">Description:</td> 
              <td class="data1"><textarea name="RuleDescription" id="RuleDescription" cols="80" rows="4" class="button" onKeyPress="jsCheckRuleDescriptionLength(this,event);" >$$RULE_DESCRIPTION$$</textarea></td> 
            </tr> 
            <tr> 
              <td valign="top" class="data1">&nbsp;</td> 
              <td valign="top" class="data1">Priority:</td> 
              <td class="data1"><span class="button">$$RULE_ORDER$$</span></td> 
            </tr> 
            </table> 
            </td> 
        </tr>
        </table>
    </td></tr>
    <tr><td  height="10"></td></tr>
    <tr><td>
       <table id="menu" width="100%" border="0" cellpadding="0" cellspacing="0">
		<!--||TABS(First active)||-->
		<tr><td background="images/tab_background_cui.gif">
			<table border="0" cellpadding="0" cellspacing="0">
			<tr><td><img id="Tag1_imgS" src="images/tab_active1_left_cui.gif" style="vertical-align:top"></td>
				<td valign="top" nowrap id="Tag1" style="background-image:url(images/tab_active_background_cui.gif)" class="tabactive" onClick="jsChangeTag('Target');">Target</td>
				<td><img id="Tag1_imgE" src="images/tab_active_right_cui.gif" style="vertical-align:top"></td>
                <td><img id="Tag2_imgS" src="images/tab_inactive2_left_cui.gif" style="vertical-align:top"></td>
				<td valign="top" nowrap id="Tag2" style="background-image:url(images/tab_inactive_background_cui.gif)" class="tabinactive"
                onclick="jsChangeTag('Exceptions');"><a class="subnavselect" href="javascript:setUITagDisplay(2,4,STR_TAG_EXCEPTIONS);">Exceptions</a></td>
				<td><img id="Tag2_imgE" src="images/tab_inactive_right_cui.gif" style="vertical-align:top"></td>
				<td><img id="Tag3_imgS" src="images/tab_inactive2_left_cui.gif" style="vertical-align:top"></td>
				<td valign="top" nowrap id="Tag3" style="background-image:url(images/tab_inactive_background_cui.gif)" class="tabinactive"
                onclick="jsChangeTag('Action');"><a class="subnavselect" href="javascript:setUITagDisplay(3,4,STR_TAG_ACTION);">Action</a></td>
				<td><img id="Tag3_imgE" src="images/tab_inactive_right_cui.gif" style="vertical-align:top"></td>
				<td><img id="Tag4_imgS" src="images/tab_inactive2_left_cui.gif" style="vertical-align:top"></td>
				<td valign="top" nowrap id="Tag4" style="background-image:url(images/tab_inactive_background_cui.gif)" class="tabinactive"
                onclick="jsChangeTag('Notification');"><a class="subnavselect" href="javascript:setUITagDisplay(4,4,STR_TAG_NOTIFICATION);">Notification</a></td>
				<td><img id="Tag4_imgE" src="images/tab_inactive_right_cui.gif" style="vertical-align:top"></td></tr>
			</table></td>
			<td align="right" background="images/tab_background_cui.gif"><img src="images/tab_right_corner_cui.gif" style="vertical-align:top"></td>
        </tr>
	   </table>
   </td></tr>
   
<!--step 1 -->
    <tr><td>
        <table id="Tag1_items"  width="100%" border="0" cellpadding="0" cellspacing="0" class="border">
		<!--||Block these files||-->
	        <tr><td width="50%" class="tableheadergreyS">Block these files</td></tr>
		
		    <tr><td>
                <table width="100%" border="0" cellpadding="0" cellspacing="0" style="padding:1">				
				    <tr><td colspan="3" height="25" style="padding-left:5px;">Specific Files</td></tr>
				    <tr><td width="20"></td>
					    <td width="20"><input type="checkbox" id="chkSpecifiedType" name="chkSpecifiedType" $$OPT_SPECIFIED_ATTACH_TYPES_ENABLED$$ onClick="setUIChecked(this.checked,fmMain.chkSpecified);"></td>
					    <td width="100%">File types 
					            <span id="tabSpecifiedType" class="more-out" onMouseOver="setUIMoreOverOut(this,true);"
                                onMouseOut="setUIMoreOverOut(this,false);" onClick="setUIMoreDisplay(this);">
					            <img id="tabSpecifiedType_icon" src="images/more_down_out.gif">
					            Show details
					            </span>
					     </td></tr>										
				    <tr><td colspan="3">
                        <table id="tabSpecifiedType_items" style="display:none" width="100%" border="0" cellpadding="0" cellspacing="0">
						    <tr><td width="40"></td>
								<td>$$SPECIFIED_FILE_TYPES$$</td></tr>
			            </table>
                    </td></tr>
		            <tr><td width="20"></td>
		                <td width="20"><input type="checkbox" id="chkSpecifiedName" name="chkSpecifiedName" $$OPT_SPECIFIED_ATTACH_NAMES_ENABLED$$ onClick="setUIChecked(this.checked,fmMain.chkSpecifiedName_items);"></td>
		                <td>File names
                        <span id="tabSpecifiedName" class="more-out" onMouseOver="setUIMoreOverOut(this,true);" onMouseOut="setUIMoreOverOut(this,false);"
                        onclick="setUIMoreDisplay(this);jsInitListbox();">
			                <img id="tabSpecifiedName_icon" src="images/more_down_out.gif">
					            Show details
		                </span>
			            </td>
                   </tr>
		           <tr><td colspan="3">
                       <table id="tabSpecifiedName_items" style="display:none" width="100%" border="0" cellpadding="0" cellspacing="0">
			           <tr>
                           <td width="40"></td>
				           <td>
                               <table border="0" cellpadding="0" cellspacing="0">
				                   <tr><td><input type="checkbox" id="chkSpecifiedName_items" name="chkSpecifiedExtension" $$OPT_EXTENSION_ENABLED$$ onClick="setUIItemsChecked(fmMain.chkSpecifiedName,fmMain.chkSpecifiedName_items,false);"></td>
					                   <td colspan="2">Specific file extensions to block (use ; to separate entries)</td></tr>
					               <tr><td width="20"></td>
						               <td><input type="text" class="text" name="txtSpecifiedExtension" style="width:100%"></td>
						               <td><input type="button" class="text" value="Add" style="width:50" onClick="jsAddExtension(fmMain.txtSpecifiedExtension,fmMain.lstSpecifiedExtension,'SpecifiedExtension');"></td></tr>
					               <tr>
                                       <td></td>
					                   <td>
                                       <table border="1" cellpadding="0" cellspacing="1">
                                       <tr><td>
									       <div id="divSpecifiedExtensionOuter" name="divSpecifiedExtensionOuter" style="overflow:auto;width:300;height:100">
									       <table border="0" cellpadding="0" cellspacing="0">
                                               <tr><td>
                                                   <div id="divSpecifiedExtensionInner" name="divSpecifiedExtensionInner" style="position:relative;overflow:hidden">
											       <select class="text" id="lstSpecifiedExtension" name="lstSpecifiedExtension" multiple style="position:relative">$$SPECIFIED_ALL_EXTENSIONS$$</select>
											       </div>
                                               </td></tr>
									      </table>
                                          </div>
                                       </td></tr>
						               </table>
                                       </td>
						               <td valign="top"><input type="button" class="text" value="Delete" style="width:50" onClick="jsDelExtension(fmMain.lstSpecifiedExtension,'SpecifiedExtension');"></td>
                                   </tr>
				                   <tr><td><input type="checkbox" id="chkSpecifiedName_items" name="chkSpecifiedAttachment" $$OPT_FILENAME_ENABLED$$ onClick="setUIItemsChecked(fmMain.chkSpecifiedName,fmMain.chkSpecifiedName_items,false);"></td>
						               <td colspan="2">File names to block</td></tr>
					               <tr><td></td>
						               <td><input type="text" class="text" name="txtSpecifiedAttachment" id="txtSpecifiedAttachment" style="width:100%"></td>
						               <td><input type="button" class="text" value="Add" style="width:50" onClick="jsAddAttachment(fmMain.txtSpecifiedAttachment,fmMain.lstSpecifiedAttachment,'SpecifiedAttachment');"></td></tr>
					               <tr><td></td>
						               <td>
                                       <table border="1" cellpadding="0" cellspacing="1">
                                           <tr><td>
								           <div id="divSpecifiedAttachmentOuter" name="divSpecifiedAttachmentOuter" style="overflow:auto;width:300;height:100">
								           <table border="0" cellpadding="0" cellspacing="0">
                                               <tr><td>
									           <div id="divSpecifiedAttachmentInner" name="divSpecifiedAttachmentInner" style="position:relative;overflow:hidden">
									           <select class="text" id="lstSpecifiedAttachment" name="lstSpecifiedAttachment" multiple
                                               style="position:relative">$$SPECIFIED_ALL_FILENAMES$$</select>
									           </div>
                                               </td></tr>
								          </table>
                                          </div>
                                       </td></tr>
						               </table>
                                       </td>
						               <td valign="top"><input type="button" class="text" value="Delete" style="width:50" onClick="jsDelAttachment(fmMain.lstSpecifiedAttachment,'SpecifiedAttachment');"></td>
                                   </tr>
				               </table>
                           </td></tr>
		               </table>
                  </td></tr>
               <tr><td><input type=checkbox id="chkScanZip" name="chkScanZip" value="scan_any_compressed_file" $$OPT_SCAN_ZIP_CHECKED$$></td>
					<td colspan="2">Block compressed files containing the specific file types or names</td>
				</tr>
				<tr><td><input type=checkbox id="chkScanOLE" name="chkScanOLE" onClick="setUIChecked(this.checked,fmMain.chkOLE_items);"></td>
					<td colspan="2">Block OLE containers containing the specific file types or names								
					            <span id="tabOLEOption" class="more-out" onMouseOver="setUIMoreOverOut(this,true);"
                                onMouseOut="setUIMoreOverOut(this,false);" onClick="setUIMoreDisplay(this);">
					            <img id="tabOLEOption_icon" src="images/more_down_out.gif">
					            Show details
					            </span></td></td>
				</tr>
                <tr><td colspan="3">
                        <table id="tabOLEOption_items" style="display:none" width="100%" border="0" cellpadding="0" cellspacing="0">
						    <tr><td width="20"></td>
								<td>
								<table border="0" cellpadding="0" cellspacing="0">
									<tr>
						               <td colspan="2"><input type="checkbox" id="chkOLE_items" name="chkOLEMS" $$OPT_OLE_TYPE_MS_ENABLED$$ onClick="setUIItemsChecked(fmMain.chkScanOLE, fmMain.chkOLE_items, false);">Microsoft documents</td>
									</tr>
									<tr>
						               <td colspan="2"><input type="checkbox" id="chkOLE_items" name="chkOLEPDF" $$OPT_OLE_TYPE_PDF_ENABLED$$ onClick="setUIItemsChecked(fmMain.chkScanOLE, fmMain.chkOLE_items, false);">Adobe Portable Document Format (.pdf)</td>
									</tr>
				                    <tr>
					                   <td width="150">Maximum OLE layers:</td>
									   <td><input type="number" class="text" id="txtOLELayer" name="txtOLELayer" value="$$VAL_OLE_LAYER$$" style="width:40">(1-20)</td>
								    </tr>
				               </table>
							</td></tr>
			            </table>
                </td></tr>
               </table>
            </td></tr>
        </table>
     
<!--step 2-->
        <table id="Tag2_items"  style="display:none" width="100%" border="0" cellpadding="0" cellspacing="0" class="border">
        <!--||Exceptions||-->
        <tr><td width="50%" class="tableheadergreyS">Exclude these sites and accounts</td></tr>
        <tr><td>
            <table width="100%" border="0" cellpadding="0" cellspacing="0">
		    <tr><td>
                <table width="100%" border="0" cellspacing="0" cellpadding="0">
				<tr>
                    <td class="data2">
                    <table border="0" cellspacing="0" cellpadding="0">
					    <tr height="25">
							<td nowrap><a id="cmdAddItem1" href="javascript:jsAddException();" class="databutton"><img id="cmdAddItem1_img" src="images/icon_add_rule.gif" class="vAlignMid"> Add</a></td>
							<td>&nbsp;</td>
							<td nowrap><a id="cmdDelItem1" href="javascript:jsDelItem();" class="databutton"><img id="cmdDelItem1_img" src="images/icon_delete.gif" class="vAlignMid">Delete</a></td>
					        <td>&nbsp;</td>
					 
							<td>&nbsp;</td>
                        </tr>
					</table>
                    </td>
					<td class="data2" align="right">
                    <table border="0" cellspacing="0" cellpadding="0">
						<tr><td nowrap align="right">
							<table  border="0" cellpadding="0" cellspacing="0" ><tr><td nowrap><font id="labRecordS1" name="labRecordS1">0</font> - <font id="labRecordE1" name="labRecordE1">0</font> of <font id="labTotalRec1" name="labTotalRec1">0</font></td>
						
							<td><img src="images/pagination-beginning.gif" style="cursor:pointer" onClick="jsPage(1);" class="vAlignMid"></td>
							<td><img src="images/pagination-previous.gif" style="cursor:pointer" onClick="jsPage(parseInt(nCurrentPage)-1);" class="vAlignMid"></td>						
							<td>Page</td>
							<td><input type="text" size="3" class="text" id="txtPageNum1" name="txtPageNum1" value="0" onKeyPress="jsKeyPressEvent(event,this.value);" /></td>
							<td>of</td>
							<td><font id="labTotalPage1" name="labTotalPage1">0</font></td>
							<td><img src="images/pagination-next.gif" style="cursor:pointer" onClick="jsPage(parseInt(nCurrentPage)+1);" class="vAlignMid"></td>
							<td><img src="images/pagination-end.gif" style="cursor:pointer" onClick="jsPage(-1);" class="vAlignMid"></td></tr></table>
					    </td></tr>
				    </table>
                    </td>
                </tr>
			    </table>
            </td></tr>
		    <tr><td>
                <table width="100%" border="0" cellpadding="0" cellspacing="0" id="tabList" name="tabList">				
				<tr>
                    <td class="grey2" width="4%"><input type="checkbox" name="chkSelectAll" onClick="javascript:jsSelectAll();"></td>
                    <td class="grey2-end" align="center">Exceptions</td>
                </tr>
		        </table>
            </td></tr>
		    <tr><td class="border3">
                <table width="100%" border="0" cellspacing="0" cellpadding="0">
				    <tr>
                    <td class="data2">
                    <table border="0" cellspacing="0" cellpadding="0">
						<tr height="25">
							<td nowrap><a id="cmdAddItem2" href="javascript:jsAddException();" class="databutton"><img id="cmdAddItem2_img" src="images/icon_add_rule.gif" class="vAlignMid"> Add</a></td>
							<td>&nbsp;</td>
							<td nowrap><a id="cmdDelItem2" href="javascript:jsDelItem();" class="databutton"><img id="cmdDelItem2_img" src="images/icon_delete.gif" class="vAlignMid">Delete</a></td>
							<td>&nbsp;</td>
							<td>&nbsp;</td>
                        </tr>
				    </table>
                    </td>
					<td class="data2" align="right">
                    <table border="0" cellspacing="0" cellpadding="0">
						<tr><td nowrap align="right">
							<table  border="0" cellpadding="0" cellspacing="0" ><tr><td nowrap><font id="labRecordS2" name="labRecordS2">0</font> - <font id="labRecordE2" name="labRecordE2">0</font> of <font id="labTotalRec2" name="labTotalRec2">0</font></td>
					
							<td><img src="images/pagination-beginning.gif" style="cursor:pointer" onClick="jsPage(1);" class="vAlignMid"></td>
							<td><img src="images/pagination-previous.gif" style="cursor:pointer" onClick="jsPage(parseInt(nCurrentPage)-1);" class="vAlignMid"></td>
							<td>Page</td>
							<td><input type="text" size="3" class="text" id="txtPageNum2" name="txtPageNum2" value="0" onKeyPress="jsKeyPressEvent(event,this.value);" /></td>
							<td>of</td>
							<td><font id="labTotalPage2" name="labTotalPage2">0</font></td>
							<td><img src="images/pagination-next.gif" style="cursor:pointer" onClick="jsPage(parseInt(nCurrentPage)+1);" class="vAlignMid"></td>
							<td><img src="images/pagination-end.gif" style="cursor:pointer" onClick="jsPage(-1);" class="vAlignMid"></td></tr></table></td></tr>
				    </table>
                    </td>
                    </tr>	
			    </table>
            </td></tr>
			<tr><td class="data2c" align="right">Rows per page: 
			    <select id="optRecordPerPage" name="optRecordPerPage" class="text" onChange="jsChgRate(this.options[this.selectedIndex].text,this.selectedIndex);"></select>
            </td></tr>
		    </table>
            </td></tr>
        </table>
<!--step 3-->
        <table id="Tag3_items"  style="display:none" width="100%" border="0" cellpadding="0" cellspacing="0" class="border">
        <tr><td width="50%" class="tableheadergreyS">Action Settings</td></tr>
        <tr><td>
            <table width="100%" border="0" cellpadding="0" cellspacing="2">
			 <tr id="QuarantineAction" style="display:none">
                <td width="2%"><input id="optQuarantine" type=radio name="optActionType" value="quarantine" onClick="jsUIDependency();" $$ACTION_QUARANTINE_ITEM_CHECKED$$></td>
			    <td width="15%">Quarantine</td>
                <td width="90%"></td></tr>
			<tr>
            <tr>
                <td id="radioDeleteAllAction" height="20" width="2%"><input type=radio id="rdoDeleteAll" name="optActionType" value="delete"
                onClick="jsUIDependency();" $$ACTION_DELETE_ALL_CHECKED$$></td>
				<td width="15%" id="txtDeleteAction">Block file</td>
                <td width="90%"></td></tr>					
            <tr id="PassAction">
                <td width="2%"><input type=radio name="optActionType" value="pass" onClick="jsUIDependency();" $$ACTION_PASS_CHECKED$$></td>
			    <td width="15%">Pass</td>
                <td width="90%"></td></tr>                 
		    <tr height="5"><td colspan="2"></td></tr>
		    <tr><td colspan="2">&nbsp;<b>AND</b></td></tr>
		    <tr height="5"><td colspan="2"></td></tr>
		    <tr><td height="20"><input type=radio name="optActionNotify" value="notify_enabled" $$NOTIFY_ENABLED$$></td>
		        <td>Notify</td></tr>
		    <tr><td height="20"><input type=radio name="optActionNotify" value="notify_disabled" $$NOTIFY_DISABLED$$></td>
			    <td>Do not notify</td></tr>				
			</table>
        </td></tr>
        
        </table>
<!--step 4-->
        <table id="Tag4_items"  style="display:none" width="100%" border="0" cellpadding="0" cellspacing="0" class="border">
        <!--Notification.htm_partial-->
		$$NOTIFICATION_PAGE$$
        </table>
    </td></tr>

<!--step2 specify sites (default:display=none)-->
    <tr><td>
        <table id="specifySites" style="display:none" width="100%" border="0" cellpadding="0" cellspacing="0" class="border">
        <tr><td width="50%" class="tableheadergreyS">Specify sites</td></tr>
        <tr><td class="data1"><input type="radio" name="rdAnysite" value="1" onClick="jsAnysiteCheck()">All sites</td></tr>
        <tr><td class="data1"> <input type="radio" name="rdAnysite" value="0" onClick="jsAnysiteCheck()" checked>Specify a site's URL:<span class="data1">
                      <input type="text" class=button size=30 name="siteSearchInput" id="siteSearchInput"> 
                      <input name="btnSearchSite" type="button" class="button" value="Search" id="btnSearchSite" onClick="jsSearchSite('siteSearchInput');" style="width:50px"> 
                     </span></td></tr> 
        <tr><td></td></tr>
        <tr><td class="data1">&nbsp;&nbsp;&nbsp;&nbsp;Select sites:</td></tr>
        <tr><td>
              <div id="Tree__treepanel" style="position:relative;left:20px;width:550; height:380;border :1px solid Silver;; overflow:auto;height:252px">Please
                  wait...</div>
        </td></tr>
        <tr height="10"><td></td></tr>
        </table>
    </td></tr>
<!--step2 specify accounts (default:display=none)-->
 <tr><td>
        <table id="specifyAccounts" style="display:none" width="100%" border="0" cellpadding="0" cellspacing="0" class="border">
        <tr><td class="tableheadergreyS" >Select Accounts</td></tr>
		<tr><td height="5" ></td></tr>
        <tr><td>
        <table  border="0" cellpadding="0" cellspacing="0">
        <tr><td colspan="2"><input name="rdAnyone" type="radio" value="1"  onclick="jsAnyoneCheck()">Anyone</td></tr>
        <tr><td colspan="2"><input name="rdAnyone" type="radio" value="0" onClick="jsAnyoneCheck()" checked="checked">Specific Accounts</td></tr>		
		
        <tr>
            <td width="40"></td>
            <td>
            <table id="tabAnyone" style="margin-left:20px;">
            <tr><td colspan="2" class="data1">Search for <font id="ftADAccount">AD user(s)/group(s):</font> 
                                <select class="button" name="lstSearchType" id="lstSearchType"> 
                                  <option value="1">AD user(s)/group(s)</option> 
                                  <option value="0">SharePoint user(s)/group(s)</option> 
                                </select> 
                <input type=text class="text" id="txtSearch" name="txtSearch" style="width:220" ><input type=button class="text" value="Search" id="btnSearchAccount" name="btnSearchAccount" onClick="jsSearchAccount('txtSearch');"></td></tr>
		    <tr><td colspan="2"><table border="0" cellpadding="0" cellspacing="0" ><tr><td nowrap>Search in:</td>
                                <td><input type=checkbox id="chkUser" name="chkUser" CHECKED></td><td> Users</td>
	                            <td><input type=checkbox id="chkGroup" name="chkGroup" CHECKED></td><td> Groups</td></tr>
								</table>
	        </td></tr>
            <tr><td>&nbsp;</td>
		        <td>
                <table id="tabSpecial" width="100%" border="0" cellpadding="0" cellspacing="0">					
		        <tr><td class="data1">
                    <table  id="tab1" width="280" height="240" class="border" cellpadding="0" cellspacing="0" >
					<tr><td class="grey-end" height="18">Available Account(s)</td></tr>
					<tr><td>
                        <div id="divAvailableAccountOuter" style="overflow:auto;width:280;height:240">
						<table  border="0" cellpadding="0" cellspacing="0">
						<tr><td valign="top">
                            <table id="tabAvailableAccountList" border="0" cellpadding="0" cellspacing="0">
                            </table>
                            </td>
							<td valign="top" width="100%">
                            <div id="divAvailableAccountInner" style="position:relative;overflow:hidden;width:100%">
							<select id="lstAvailableAccount" name="lstAvailableAccount" multiple style="position:relative;top:-3;left:-3;font-size:13px;">
							</select>
                            </div>
                            </td>
                        </tr>
						</table>
                        </div>
                    </td></tr>
					</table>
					</td> 
					<td>
                    <table id="tab1_button">
                    <tr>
                    <td class="data1" valign="middle">
						<input type=button id="btnAddAccount" class="text" value="Add &gt;&gt;"  style="width:80px" onClick="jsAddSelectedAccount();"><br/>
						<input type=button id="btnRemoveAccount"class="text" value="&lt;&lt; Remove" style="width:80px" onClick="jsRemoveSelectedAccount();">
                    </td></tr>
                    <!--
				    <tr height="40px"><td></td></tr>	
                    <tr>
                    <td class="data1" valign="middle">
						<input type=button id="tab1_import" class="text" value="Import"  style="width:80px" onclick="jsImportAccount();"><br/>
						<input type=button id="tab1_export" class="text" value="Export"  style="width:80px" onclick="jsExportAccount();">
                    </td></tr>
                    -->
					</table>
					</td>      
					<td>
                    <table width="280" height="240" border="0" cellpadding="0" cellspacing="0" class="border">
					<tr><td class="grey-end" height="18">Selected Account(s)</td></tr>
					<tr><td valign="top">
                        <div id="divSelectedAccountOuter" style="overflow:auto;width:280;height:240;position:relative">
					    <table  border="0" cellpadding="0" cellspacing="0">
					    <tr><td  valign="top">
                            <table id="tabSelectedAccountList" border="0" cellpadding="0" cellspacing="0" valign="top">
                            </table>
                            </td>								                     
					    	<td valign="top" width="100%">
							<div id="divSelectedAccountInner" style="position:relative;overflow:hidden;width:100%">	
                            <select id="lstSelectedAccount" name="lstSelectedAccount" style="position:relative;top:-3;left:-3;font-size:13px;" multiple>
                            
                            </select>
                            <select id="lstExistAccount" style="display:none"></select>
                            </div>
                            </td>
					    </tr>
                        </table>
					    </div>
                    </td></tr>
					</table>
					</td>
					<td>&nbsp;</td>
			    </tr>
				</table>
            </td></tr>
			</table>
        </td></tr>
		</table></td></tr>				         
		<tr><td height="10" ></td></tr>
		<tr><td height="1"  background="images/dot.gif"></td></tr>
		
	 	<tr><td>
            <table>
            <tr>
                <td nowrap><img src="images/ad_user.gif" alt="AD Users" align="absmiddle"></td>
                <td nowrap class="data1"><span>-AD User</span></td>
                <td width="22" align="right" nowrap><img src="images/ad_group.gif" alt="AD Groups" align="absmiddle"></td>
                <td nowrap class="data1"><span>-AD Group</span></td>
                <td width="22" align="right" nowrap><img src="images/SP_user.gif" alt="SharePoint User" align="absmiddle"></td>
                <td nowrap class="data1"><span>-SharePoint User</span></td>
                <td width="22" align="right" nowrap><img src="images/sp_group.gif" alt="SharePoint Group" align="absmiddle"></td>
                <td nowrap class="data1"><span>-SharePoint Group</span></td>
            </tr>	
	 	    </table>
        </td></tr>
        
        </table>
    </td></tr>
</table>
<!--add Exception button-->
<table id="addExceptionButton"  style="display:none" width="540" border="0" cellspacing="0" cellpadding="0"> 
  <tr> 
    <td height="28" valign="bottom">
      <input name="exception_backButton" id="exception_backButton" type="button" class="button" value="&lt; Back" onClick="jsShowSpecifySites()" style="width:50px">
      <input name="exception_submitButton" id="exception_submitButton" type="button" class="button" onClick="jsAddExceptionFinished()" value="Finish" style="width:50px">  
      <input name="exception_nextButton" id="exception_nextButton" type="button" class="button" onClick="jsShowSpecifyAccounts()" value="Next &gt" style="width:50px"> 
&nbsp;
      <input name="cancelButton" type="button" class="button" onClick="jsAddExceptionCanceled()" value="Cancel" style="width:50px">
    </td> 
  </tr> 
</table>

<!--edit Exception button-->
<table id="editExceptionButton"  style="display:none" width="540" border="0" cellspacing="0" cellpadding="0"> 
  <tr> 
    <td height="28" valign="bottom">
      <input name="editBackButton" id="editBackButton" type="button" class="button" onClick="jsShowSpecifySites()" value="&lt; Back" style="width:50px">
      <input name="editSubmitButton" id="editSubmitButton" type="button" class="button" onClick="jsEditExceptionFinished()" value="Finish" style="width:50px">  
      <input name="editNextButton" id="editNextButton" type="button" class="button" onClick="jsShowSpecifyAccounts()" value="Next &gt" style="width:50px">
      <!--
      <input name="editSiteSaveButton" id="editSiteSaveButton" type="button" class="button" onClick="jsEditSiteSave()" value="Save" style="width:50px">  
      <input name="editAccountSaveButton" id="editAccountSaveButton" type="button" class="button" onClick="jsEditAccountSave()" value="Save" style="width:50px">  
      -->
&nbsp;
      <input id="btnExpEditCancel" name="btnExpEditCancel" type="button" class="button" onClick="jsEditExceptionCancel()" value="Cancel" style="width:50px">
    </td> 
  </tr> 
</table>

<!--edit Policy button-->
<table id="editPolicyButton" width="540" border="0" cellspacing="0" cellpadding="0"> 
  <tr> 
    <td height="28" valign="bottom">
      <input name="submitButton" id="submitButton" type="button" class="button" onClick="jsSubmit()" value="Save" style="width:50px">  
&nbsp;
      <input name="cancelButton" type="button" class="button" onClick="jsCancel()" value="Cancel" style="width:50px">
    </td> 
  </tr> 
</table>


</form>
<iframe id="ifmAccount" name="ifmAccount" src="$$ACCOUNT_SEARCH_CGI_URL$$" frameBorder="0" width="0" height="0" style="display:none"/>
<iframe id="ifmToolTip" name="ifmToolTip" src="html/ToolTip.htm" frameborder="0" style="z-index:10000;position:absolute;width:0;height:0;overflow:hidden"/>
</body>
</html>

