﻿function disableMoveOperationBtn()
	{
	    if(document.getElementById('ctl00_imgbDelete') != null)
	    {
	        var varDeleteID = document.getElementById('ctl00_imgbDelete');
	        varDeleteID.disabled = 'disabled';
	    }
	    
	    if(document.getElementById('ctl00_ddMoveTo') != null)
	    {
	        var varMoveToID = document.getElementById('ctl00_ddMoveTo');
	        varMoveToID.disabled = 'disabled';
	    }
	    
	    if(document.getElementById('ctl00_ddMarkAs') != null)
	    {
	        var varMarkToID = document.getElementById('ctl00_ddMarkAs');
	        varMarkToID.disabled = 'disabled';
	        
	    }
	}
	
	function enableMoveOperationBtn()
	{
	    if(document.getElementById('ctl00_imgbDelete') != null)
	    {
	        var varDeleteID = document.getElementById('ctl00_imgbDelete');
	        varDeleteID.enabled = 'enabled';
	    }
	    
	    if(document.getElementById('ctl00_ddMoveTo') != null)
	    {
	        var varMoveToID = document.getElementById('ctl00_ddMoveTo');
	        varMoveToID.enabled = 'enabled';
	    }
	    
	    if(document.getElementById('ctl00_ddMarkAs') != null)
	    {
	        var varMarkToID = document.getElementById('ctl00_ddMarkAs');
	        varMarkToID.enabled = 'enabled';
	    }
	}
	
	
function clickButton(e, buttonid){ 
      var bt = document.getElementById(buttonid); 
      if (typeof bt == 'object'){ 
            if(navigator.appName.indexOf("Netscape")>(-1)){ 
                  if (e.keyCode == 13){ 
                        bt.click();                         
                        return false; 
                  } 
            } 
            if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1))
            { 				
                  if (event.keyCode == 13)
                  { 
                        bt.click();                        
                        return false; 
                  } 
            } 
      } 
} 

function clearFields()
{
    var varUserID, varUserIDexist = false,
        varUserPwd, varUserPwdexist = false;
        
        for(i=0;i<document.forms(0).length;i++)
        {   
            if(varUserIDexist == false)
				varUserID = document.forms(0).elements[i];
			
			if(varUserPwdexist == false)
			    varUserPwd = document.forms(0).elements[i];
		
		if(varUserID.id.indexOf("tbUserID") != -1 && varUserIDexist == false)
			    varUserIDexist = true;
			    
	    if(varUserPwd.id.indexOf("tbUserPassword") != -1 && varUserPwdexist == false)
			    varUserPwdexist = true;
	    }
	    
	    varUserID.value = "";
	    varUserPwd.value = "";
	    
	    return false;
}

function setFocus()
	{		
		for(i=0; i<document.forms[0].length; i++)
		{			
			var obj = document.forms[0].elements[i];			
			if(obj.name.indexOf("tbUserID") != -1)
			{					
				obj.focus();
			}
		}
	}
function openHeaders(text)
{
    var varObj = new Object();
    varObj.Msg = text;    
    var theTop=(screen.Height/2) - 350; 
    var theLeft=(screen.width/2) - 300; 	
	window.showModalDialog('DesktopModules/Mail/FullHeaders.aspx',varObj,'menubar:no;toolbar:no;help:no;resizable:no;scroll:no;status:no;dialogWidth:800px;dialogHeight:326px');
	return false;
}

    function NewWin(varfolder, varemlid)
	{		
	    var theTop=(screen.Height/2) - 350; 
        var theLeft=(screen.width/2) - 400; 	
	    var path = "DesktopModules/Mail/PrintMail.aspx?EMLID="+varemlid+"&folder="+varfolder;
		window.open(path,'','width=800, height=700,left='+theLeft+', top='+theTop+',screenX='+theLeft+',screenY='+theTop+',location=no,menubar=no, status=no, toolbar=no, scrollbars=yes, resizable=no');
		return false;
	}
	
    function MimeMessage(varfolder, varemlid)
	{		
	    var theTop=(screen.Height/2) - 350; 
        var theLeft=(screen.width/2) - 300; 	
	    var path = "DesktopModules/Mail/MimeMessage.aspx?EMLID="+varemlid+"&folder="+varfolder;
		window.open(path,'','width=600, height=700, left='+theLeft+', top='+theTop+',screenX='+theLeft+',screenY='+theTop+',location=no,menubar=no, status=no, toolbar=no, scrollbars=yes, resizable=yes');
		return false;
	}	
	
	
	
	function NewAddressWin(address)
	{	
	    var theTop=(screen.Height/2) - 300; 
        var theLeft=(screen.width/2) - 400; 	
	    var path = "DesktopModules/Mail/AddNewAddress.aspx?email="+address;
		window.open(path,'','width=900, height=600, left='+theLeft+', top='+theTop+',screenX='+theLeft+',screenY='+theTop+',location=no,menubar=no, status=no, toolbar=no, scrollbars=yes, resizable=no');
		return false;
	}
	
	function fnComposeWin(react, mid, uid)
	{	
	    try
	    {
	        var theTop=(screen.Height/2) - 300; 
            var theLeft=(screen.width/2) - 400; 	
	        var path = "DesktopModules/Mail/Compose.aspx?ract="+react+"&mid="+mid+"&uid="+uid+"&popw=1";
		    window.open(path,'','width=800, height=600, left='+theLeft+', top='+theTop+',screenX='+theLeft+',screenY='+theTop+',location=no,menubar=no, status=no, toolbar=no, scrollbars=yes, resizable=yes');
		    return false;
		}
		catch(x)
		{
		    alert(x);
		}
	}
	
	function fnComposeMail(email)
	{	
	    try
	    {
	        var theTop=(screen.Height/2) - 300; 
            var theLeft=(screen.width/2) - 400; 	
	        var path = "DesktopModules/Mail/Compose.aspx?comp="+email+"&popw=1";
		    window.open(path,'','width=800, height=600, left='+theLeft+', top='+theTop+',screenX='+theLeft+',screenY='+theTop+',location=no,menubar=no, status=no, toolbar=no, scrollbars=yes, resizable=yes');
		    return false;
		}
		catch(x)
		{
		    alert(x);
		}
	}
	
	
	function openPDFWin(varfolder, varemlid, varemluid)
	{
	    var theTop=(screen.Height/2)-50; 
        var theLeft=(screen.width/2)-50; 	
	    var path = "DesktopModules/Mail/DownloadPDF.aspx?emlid="+varemlid+"&folder="+varfolder+"&emluid="+varemluid;
		window.open(path,'','width=5, height=5, left='+theLeft+', top='+theTop+',screenX='+theLeft+',screenY='+theTop+',location=no,menubar=no, status=no, toolbar=no, scrollbars=no, resizable=no');
		return false;
	}
	
	
	function NewBlockWin(add)
	{			
		window.showModalDialog("DesktopModules/Mail/BlockPopUp.aspx?addr="+add,'','menubar:no;toolbar:no;help:no;resizable:no;scroll:no;status:no;dialogWidth:350px;dialogHeight:150px');
		return false;
	} 
	
	function FlagPopUp(parm,imgid)
	{			
		window.showModalDialog("DesktopModules/Mail/FollowUp.aspx?key="+parm, "zxc",'menubar:no;toolbar:no;help:no;resizable:no;scroll:no;status:no;dialogWidth:455px;dialogHeight:370px');
		//window.location.reload();
		return true;
	} 
	
function fnCheckBox()
	{

	        var cbStatus = document.getElementById("cbselectall");
	        var cbChecked = false;
        	
	        if(cbStatus.type == 'checkbox' && cbStatus.checked == true)
	        {
		        cbChecked = true;
	        }
	        if(cbStatus.type == 'checkbox' && cbStatus.checked == false)
	        {
		        cbChecked = false;
	        }
	        for(i=0;i<document.forms(0).length;i++)
	        {
		        e = document.forms(0).elements[i];
		        e.checked = cbChecked;
	        }
        	
}
    

    function fnReload()
    {
    	window.location.reload();
    }
    
    function fnReadReceiptWindow(varAddress,varid)
    {
        window.showModalDialog("DesktopModules/Mail/ReadReceiptRequest.aspx?addr="+varAddress+"&eid="+varid,'','menubar:no;toolbar:no;help:no;resizable:no;scroll:no;status:no;dialogWidth:350px;dialogHeight:250px');
	    return false;
    }
    


