var ProgressText;
var PageLoadTime=new Date().getTime();
var iTimerSession ;
var earliestStartDate;
var latestSelectableDate;
var msgInvalDtFormat;
var msgOutOfRangeDt;
var invalidCharEmailMsg;

/*Adding indexOf functionality in Array object as a patch*/
if(!Array.indexOf)
{
    Array.prototype.indexOf = function(obj, start) 
  {       
          for(var i=(start||0); i<this.length; i++)
        {     
            if(this[i]==obj)
             {  
              return i;          
             }     
        }  
   }

}
function Logout()
{
	location.href = "TARedirect.aspx" ;
}

//Customer functionalities
function CustLogin()
{
	location.href = "Login.aspx";
}

function CustLogout()
{
	location.href = "UserRedirect.aspx";
}

function CustUpdateProfile()
{
	location.href = "AccessController.aspx?functionality=UPDATEPROFILE";
}

function CustRegistration()
{
	location.href = "Registration.aspx";
}

function CustMyArea()
{
	location.href = "AccessController.aspx?functionality=MYAREA";
}

function GLBCheckTimeout( p_iTime )
{
	var curTime;
	curTime = new Date().getTime();
	if( eval( curTime - PageLoadTime ) > p_iTime * 60 * 1000 )
	{
		PageLoadTime = curTime;
		window.clearInterval(iTimerSession);		
		document.getElementById( "imgTimeOut" ).src="TimeOut.aspx";
		var url=location.href;
		if(url.indexOf("MyArea")>0)
			location.href = "Login.aspx?SiteGuid="+document.getElementById( "hdnSiteGuid" ).value;
	}
}

function ResetTimer()
{
	PageLoadTime = new Date().getTime();   
}


function HideTab( tabValue )
{
	document.getElementById( "tableProgressBar" ).getElementsByTagName( "TD" )[ tabValue ].style.display = "none";
}

/*************************FUNCTION TO HANDLE '<' CHARACTER ********************/

function ValidateMessage(control)
 {
	var message = document.getElementById(control);
	if(message !=null)
	 {	
	   var msg=message.value;
	   while(msg.indexOf("<") > -1) 
	   { 
	   	 msg = msg.replace("<","&lt;"); 
		 message.value=msg;
	   } 
	}
}


/*******************************FOR EMAIL VERIFICATION******************************************/
function ValidateEmail(ControlVal,Rowind)
{		
	if (Rowind!=null && Rowind!="")
	{
		ControlVal = Rowind + "_" + ControlVal;
	}
	var control = document.getElementById(ControlVal);
	var strEmail=control.value;
	if (strEmail=="" || strEmail==null)
		return true;
	
	var isErrorOccurred;
	var at="@";
	var dot="." ;
	var lat=strEmail.indexOf(at) ;
	var lstr=strEmail.length ;
	var ldot=strEmail.indexOf(dot) ;
	
	if (strEmail.indexOf(at)==-1)
	{
		
		if(typeof (isErrorOccurred) != null)
			isErrorOccurred = true;
		
		alert(InvalidEmail);
		control.select();
		control.focus();	
		return false;
	}

	if (strEmail.indexOf(at)==-1 || strEmail.indexOf(at)==0 || strEmail.indexOf(at)==lstr)
	{
		
		if(isErrorOccurred != null)
			isErrorOccurred = true;			
		alert(InvalidEmail);
		control.select();
		control.focus();		   
		return false;
	}

	if (strEmail.indexOf(dot)==-1 || strEmail.indexOf(dot)==0 || strEmail.indexOf(dot)==lstr-1)
	{
		
		if(isErrorOccurred != null)
			isErrorOccurred = true;
		
		alert(InvalidEmail);
		control.select();
		control.focus();	
		return false;
	}

	if (strEmail.indexOf(at,(lat+1))!=-1)
	{
		
		if(isErrorOccurred != null)
			isErrorOccurred = true;			
		alert(InvalidEmail);
		control.select();
		control.focus();	
		return false;
	}

	if (strEmail.substring(lat-1,lat)==dot || strEmail.substring(lat+1,lat+2)==dot)
	{
		
		if(isErrorOccurred != null)
			isErrorOccurred = true;
		
		alert(InvalidEmail);
		control.select();
		control.focus();	
		return false;
	}

	if (strEmail.indexOf(dot,(lat+2))==-1)
	{
		
		if(isErrorOccurred != null)
			isErrorOccurred = true;
		
		alert(InvalidEmail);
		control.select();
		control.focus();	
		return false;
	}

	if (strEmail.indexOf(" ")!=-1)
	{
		
		if(isErrorOccurred != null)
			isErrorOccurred = true;			
		alert(InvalidEmail);
		control.select();
		control.focus();	
		return false;
	}
    
    var filterCharacters = new Array("\\","(",")","[","]",",",";",":",'"',"<",">");
	for(iCount=0;iCount<filterCharacters.length;iCount++)
    {
        if(strEmail.indexOf(filterCharacters[iCount])!=-1)
        {
	        alert(invalidCharEmailMsg + " " + filterCharacters[iCount]);
	        control.select();
	        control.focus();
	        return false;
        }
    }	
    
	return true;					
}

/**********       FUNCTION TO CHECK THE OCCURRENCE OF WILD CHARACTERS**************************/


	function FilterWildCharacters(Control,AllowedList,Rowind)
	{
		var strValue;
		if (Rowind !="")
	    {
		 Control = Rowind + "_" + Control;
		 strValue = document.getElementById(Control).value;
	    }
		else
		 strValue = document.getElementById(Control).value;
		var allowedListArray=AllowedList.split(",");
		if(allowedListArray.length>1)
			{for(var i=0;i<allowedListArray.length;i++)
			{
				if(allowedListArray[i]=="")
				allowedListArray[i]=",";
			}
		}
		var wildCharacters = new Array( "^","~",'"',"`","<",">","%","@","#","$","&","*","{","}","[","]","?",",",".",";",":","'","/","|","!","(",")","_","-","+","=");
		var index="";
		if(AllowedList.length>0)
		{
			for(count=0;count<allowedListArray.length;count++)
			{
			  index= wildCharacters.indexOf(allowedListArray[count]);
			   if ( index == null )
			   {
				continue ;
			   }
			  wildCharacters.splice(index,1);
			}   
		}
		if(strValue!="")
		  {
			 for(iCount=0;iCount<wildCharacters.length;iCount++)
			 {
				if(strValue.indexOf(wildCharacters[iCount])!=-1)
				{
					alert(invalidCharacterMsg + " " + wildCharacters[iCount]);
					document.getElementById(Control).select();
					document.getElementById(Control).focus();
					return false;
					
				}
			 }
	       }  
        return true;
    }
function FilterWildCharacters(Control,AllowedList,Rowind,invalidCharacterMsg)
{
	var strValue;
	if (Rowind !="")
    {
	 Control = Rowind + "_" + Control;
	 strValue = document.getElementById(Control).value;
    }
	else
	 strValue = document.getElementById(Control).value;
	var allowedListArray=AllowedList.split(",");
	if(allowedListArray.length>1)
		{for(var i=0;i<allowedListArray.length;i++)
		{
			if(allowedListArray[i]=="")
			allowedListArray[i]=",";
		}
	}
	var wildCharacters = new Array( "^","~",'"',"`","<",">","%","@","#","$","&","*","{","}","[","]","?",",",".",";",":","'","/","|","!","(",")","_","-","+","=");
	var index="";
	if(AllowedList.length>0)
	{
		for(count=0;count<allowedListArray.length;count++)
		{
		  index= wildCharacters.indexOf(allowedListArray[count]);
		   if ( index == null )
		   {
			continue ;
		   }
		  wildCharacters.splice(index,1);
		}   
	}
	if(strValue!="")
	  {
		 for(iCount=0;iCount<wildCharacters.length;iCount++)
		 {
			if(strValue.indexOf(wildCharacters[iCount])!=-1)
			{
				alert(invalidCharacterMsg + " " + wildCharacters[iCount]);
				document.getElementById(Control).select();
				document.getElementById(Control).focus();
				return false;
				
			}
		 }
       }  
    return true;
}
function FilterNumeric(Control,Rowind,invalidCharacterMsg)
{
	var strValue;
	if (Rowind !="")
    {
	 Control = Rowind + "_" + Control;
	 strValue = document.getElementById(Control).value;
    }
	else
	 strValue = document.getElementById(Control).value;
	
	var numbers = new Array( "1","2","3","4","5","6","7","8","9","0");
	if(strValue!="")
	  {
		 for(iCount=0;iCount<numbers.length;iCount++)
		 {
			if(strValue.indexOf(numbers[iCount])!=-1)
			{
				alert(invalidCharacterMsg + " " + numbers[iCount]);
				document.getElementById(Control).select();
				document.getElementById(Control).focus();
				return false;
				
			}
		 }
       }  
    return true;
}
function getGridItemId( gridId , rowId , controlId )
	{
		var gridItemPrefix = gridId + '__ctl' ;
		var controlPrefix = '_'+controlId ;
		var controlId = gridItemPrefix + rowId + controlPrefix ;
		
		if( document.getElementById( controlId ) == null )
		{
			if( parseInt ( rowId , 10 ) < 10 )
			{
				gridItemPrefix = gridId + '_ctl0' ;
				controlId = gridItemPrefix + rowId + controlPrefix ;
			}
			else
			{
				gridItemPrefix = gridId + '_ctl' ;
				controlId = gridItemPrefix + rowId + controlPrefix ;
			}  			
		}
		return controlId ;	
	}	


function getGridChildItemString( gridId , rowId , controlId, renderStyle )
	{
		var gridItemPrefix = gridId + '__ctl' ;
		var controlPrefix = '_'+controlId ;
		var controlId = gridItemPrefix + rowId + controlPrefix ;
		
		if (renderStyle == '__')
		{
			controlId = gridItemPrefix + rowId + controlPrefix ;
		}
		else
		{
			if( parseInt ( rowId , 10 ) < 10 )
			{
				gridItemPrefix = gridId + '_ctl0' ;
				controlId = gridItemPrefix + rowId + controlPrefix ;
			}
			else
			{
				gridItemPrefix = gridId + '_ctl' ;
				controlId = gridItemPrefix + rowId + controlPrefix ;
			}  
		}
		return controlId ;	
	}
	
function CreateProgressTab()
{
    
    var progressDiv = document.getElementById( "loading" );
    var pageDiv = document.getElementById( "mainContent" );
   
    if( pageDiv != null && progressDiv !=null )
    {
        pageDiv.style.display = "none";
        progressDiv.style.display = "block";
        progressDiv.className = "ProgressBar";
    }
//   try
//   {
//    if( progressDiv != null )
//    {
//        progressDiv.style.display = "block";
//        progressDiv.className = "ProgressBar";
//        ProgressText = ProgressText == null ? "<B>Your page is now loading </B><br><p><img src=" + "./Languages/eng/mattglass.gif" + "  width=80px height=80px border=0 style=cursor:hand ></p><p>Thank you for your patience. </P>" :ProgressText; 
//         
//         for( count=0;count<100;count++ )
//         {
//           progressDiv.innerHTML = ProgressText;
//         }
//    }
//   }
//   catch(e)
//   {
//   }

}

function CreateProgressTabFromIFrame()
{
    var mainTable = parent.document.getElementsByTagName( "TABLE" )[0] ;
    var mainTableRowCount = mainTable.getElementsByTagName( "TR" ).length ;
    
    
  if( navigator.userAgent.split( "MSIE" ).length > 1 )
 {
	for( count =2 ; count< mainTable.rows.length -2 ; count++ )
    {
		
        if( mainTable.rows( count ) != null )
        {
			     
			  mainTable.rows( count ).style["display"] = "none" ;
         }
    }
    mainTable.rows( 1 ).style["display"] = "block" ;
    mainTable.rows( 0 ).style["display"] = "block";
    mainTable.rows( mainTable.rows.length -1 ).style["display"] = "block" ;
    mainTable.rows( mainTable.rows.length -2 ).style["display"] = "block";
    for( count =0 ; count < 100 ; count++ )
    {        
		if(ProgressText != null)
			mainTable.rows(1).firstChild.innerHTML = ProgressText ; 
		else       
			mainTable.rows(1).firstChild.innerHTML = "<B>Your page is now loading </B><br><p><img src=" + 
"./Languages/eng/mattglass.gif" + "  width=80px height=80px border=0 style=cursor:hand ></p><p>Thank you for your patience. </P>" ;
	
		mainTable.rows(1).firstChild.className="ProgressBar";
    }
    return true ;
  }
  else
  {
	
    {
   for( count =0 ; count< mainTable.rows.length  ; count++ )
		
        if( mainTable.rows[ count ] != null )
        {
			  try
			  {   
				mainTable.rows[ count ].style.display = "none";
			  }
			  catch( e )
			  {
			  
			  }
         }
    }
    
    
       for( count =0 ; count < 100 ; count++ )
        {        
                
            if(ProgressText != null)
                mainTable.rows[1].firstChild.innerHTML  = ProgressText ; 
            else       
                mainTable.rows[1].firstChild.innerHTML  = "<B>Your page is now loading </B><br><p><img src=" + 
    "./Languages/eng/mattglass.gif" + "  width=80px height=80px border=0 style=cursor:hand ></p><p>Thank you for your patience. </P>" ;
        
            mainTable.rows[1].firstChild.className="ProgressBar";
            mainTable.rows[1].firstChild.style.width="100%" ;
             mainTable.rows[1].firstChild.align = "center" ;
             mainTable.align = "center" ;
             mainTable.rows[1].align= "center" ;
        }
    
    mainTable.rows[ 1 ].style.display = "block" ;
    mainTable.rows[ 0 ].style.display = "block" ;
    mainTable.rows[ mainTable.rows.length -1 ].style.display = "block";
    mainTable.rows[ mainTable.rows.length -2 ].style.display = "block";
    return true ;
  }
}

function BuildProgressTab()
{
	var mainTable = document.getElementsByTagName( "TABLE" )[0] ;
    var mainTableRowCount = mainTable.getElementsByTagName( "TR" ).length ;
	var tableRow = document.createElement( "TR" );
    tableRow.id= "tabProgress";
    tableRow.style.display = "none" ;
   	var tableCell = document.createElement( "TD" ) ;
    tableCell.align = "center";
    tableCell.className = "ProgressBar" ;
    tableRow.appendChild( tableCell );
    tableCell.innerHTML = ProgressText;
    mainTable.tBodies[0].insertBefore( tableRow ,mainTable.rows(1) );
    
    return false ;
         
}	

function ShowProgressTab()
{
	setTimeout( "CreateProgressTab()" , 500 );
	return true;
}
//This function checks whether the date as user input is in correct format(i.e. dd/MM/yyyy) or not
function ChkDate(objName) 
{
	var strDate;
	var strDateArray;
	var strDay;
	var strMonth;
	var strYear;
	var intday;
	var intMonth;
	var intYear;
	var datefield = objName;
//	var strSeparatorArray = new Array("/","-"," ",".");
    var strSeparatorArray = new Array("/");
	var intElementNr;
	var err = 0;
	
	strDate = datefield.value;
	if (strDate.length < 1) 
	{
		return true;
	}
	for (intElementNr = 0; intElementNr < strSeparatorArray.length; intElementNr++) 
	{
		if (strDate.indexOf(strSeparatorArray[intElementNr]) != -1) 
		{
			strDateArray = strDate.split(strSeparatorArray[intElementNr]);
			if (strDateArray.length != 3) 
			{
				err = 1;
				return false;
			}
			else 
			{
				strDay = strDateArray[0];
				strMonth = strDateArray[1];
				strYear = strDateArray[2];
				break;
			}
		}
	}
	if(strDateArray == null)
	    return false;
	if (strDay.length == 1) 
	{
		strDay = '0' + strDay;
	}
	if (strMonth.length == 1) 
	{
		strMonth = '0' + strMonth;
	}
	if (strYear.length == 2) 
	{
		strYear = '20' + strYear;
	}
	
	intday = parseInt(strDay, 10);
	if (isNaN(intday)) 
	{
		err = 2;
		return false;
	}
	intMonth = parseInt(strMonth, 10);
	if (isNaN(intMonth)) 
	{
		err = 3;
		return false;
	}
	intYear = parseInt(strYear, 10);
	if (isNaN(intYear)) 
	{
		err = 4;
		return false;
	}
	if (intMonth>12 || intMonth<1) 
	{
		err = 5;
		return false;
	}
	if ((intMonth == 1 || intMonth == 3 || intMonth == 5 || intMonth == 7 || intMonth == 8 || intMonth == 10 || intMonth == 12) && (intday > 31 || intday < 1)) 
	{
		err = 6;
		return false;
	}
	if ((intMonth == 4 || intMonth == 6 || intMonth == 9 || intMonth == 11) && (intday > 30 || intday < 1)) 
	{
		err = 7;
		return false;
	}
	if (intMonth == 2) 
	{
		if (intday < 1) 
		{
			err = 8;
			return false;
		}
		if (LeapYear(intYear) == true) 
		{
			if (intday > 29) 
			{
				err = 9;
				return false;
			}
		}
		else 
		{
			if (intday > 28) 
			{
				err = 10;
				return false;
			}
		}
	}
	datefield.value = strDay + strSeparatorArray[intElementNr] + strMonth + strSeparatorArray[intElementNr] + strYear;
	return true;
}
//This function checks whether the year is LeapYear or not
function LeapYear(intYear) 
{
	if (intYear % 100 == 0) 
	{
		if (intYear % 400 == 0) 
		{	
			return true; 
		}
	}
	else 
	{
		if ((intYear % 4) == 0) 
		{ return true; 
		}
	}
	return false;
}
//This function will validate whether date provided by the user is within the range for the site in proper format or not.
//The function expects the textbox control object for the date to be validated.
function ValidateDate(date) 
{
	var stDtInfo;
	var endDtInfo;
	var selDtInfo;
	if(date != null && date.value.length > 0)
	{
		if(ChkDate(date) == true)
		{
			//var strSeparatorArray = new Array("/","-"," ",".");
			var strSeparatorArray = new Array("/");
			var intElementNr;
			
			for (intElementNr = 0; intElementNr < strSeparatorArray.length; intElementNr++) 
			{
				if (earliestStartDate.indexOf(strSeparatorArray[intElementNr]) != -1) 
				{
					stDtInfo = earliestStartDate.split(strSeparatorArray[intElementNr]);
					break;
				}
			}
			for (intElementNr = 0; intElementNr < strSeparatorArray.length; intElementNr++) 
			{
				if (latestSelectableDate.indexOf(strSeparatorArray[intElementNr]) != -1) 
				{
					endDtInfo = latestSelectableDate.split(strSeparatorArray[intElementNr]);
					break;
				}
			}
			for (intElementNr = 0; intElementNr < strSeparatorArray.length; intElementNr++) 
			{
				if (date.value.indexOf(strSeparatorArray[intElementNr]) != -1) 
				{
					selDtInfo = date.value.split(strSeparatorArray[intElementNr]);
					break;
				}
			}
			if( stDtInfo != null && stDtInfo.length ==3 && selDtInfo != null && selDtInfo.length == 3 
				&& endDtInfo != null && endDtInfo.length == 3)
			{		
			    if( isNaN(selDtInfo[0]) ||  isNaN(selDtInfo[1])||  isNaN(selDtInfo[2]))
			    {
		            if( msgInvalDtFormat != null && msgInvalDtFormat.length > 0)
			            alert(msgInvalDtFormat);
			        else
				        alert("Please provide Date in dd/MM/yyyy format.");
			        date.focus();
			        return false;
			    }
				var stDay = parseInt(stDtInfo[0], 10);
				var stMon = parseInt(stDtInfo[1], 10);
				var stYr = parseInt(stDtInfo[2], 10);
				var endDay = parseInt(endDtInfo[0], 10);
				var endMon = parseInt(endDtInfo[1], 10);
				var endYr = parseInt(endDtInfo[2], 10);
				var selDay = parseInt(selDtInfo[0], 10);
				var selMon = parseInt(selDtInfo[1], 10);
				var selYr = parseInt(selDtInfo[2], 10);			
				
				
				if((selYr < stYr) || (selYr == stYr && selMon < stMon) || (selYr == stYr && selMon == stMon && selDay < stDay)
					||(endYr < selYr) || (selYr == endYr && endMon < selMon) || (selYr == endYr && selMon == endMon && endDay < selDay))
				{
					if(msgOutOfRangeDt != null && msgOutOfRangeDt.length > 0)
					{
					    msgOutOfRangeDt = msgOutOfRangeDt.replace("%SD",earliestStartDate);
					    msgOutOfRangeDt = msgOutOfRangeDt.replace("%ED",latestSelectableDate);						
					    alert(msgOutOfRangeDt);
					}    
					else
						alert("Please provide a Date between " + earliestStartDate + " and " + latestSelectableDate);
					
					date.focus();
					selDtInfo = null;
					stDtInfo = null;
					endDtInfo = null;
					return false;
				}
			
				selDtInfo = null;
				stDtInfo = null;
				endDtInfo = null;
			}
			return true;
		}
		else
		{
			if( msgInvalDtFormat != null && msgInvalDtFormat.length > 0)
				alert(msgInvalDtFormat);
			else
				alert("Please provide Date in dd/MM/yyyy format.");
			date.focus();
			return false;
		}
	}
	return true;
} 

function populateQASAddress(cmbAdd,txtAdd1,txtAdd2,txtCity,txtState,txtPstCd)
{
    var address = document.getElementById( cmbAdd );
    var addressLine1 = document.getElementById( txtAdd1 );
    var addressLine2 = document.getElementById( txtAdd2 );
    var city = document.getElementById( txtCity );
    var state = document.getElementById( txtState );
    var postCode = document.getElementById( txtPstCd );
    var addressArray=address.value.split(';');
    if(addressArray.length==4)
    { 
		if (addressLine1!=null)
		{
			addressLine1.value = addressArray[0];
		}
		if (addressLine2!=null)
		{
			addressLine2.value="";
		}
		if (city!=null)
		{
			city.value=addressArray[1];
		}
		if (state!=null)
		{
			state.value=addressArray[2];
		}  
		if (postCode!=null)
		{
			postCode.value=addressArray[3];
		}
    }
    else if (addressArray.length==5)
    {
		if (addressLine1!=null)
		{
			addressLine1.value = addressArray[0];
		}
		if (addressLine2!=null)
		{
			addressLine2.value = addressArray[1];
		}
		if (city!=null)
		{
			city.value=addressArray[2];
		}        
		if (state!=null)
		{
			state.value=addressArray[3];
		}  
		if (postCode!=null)
		{
			postCode.value=addressArray[4];
		}
    }
    else if (addressArray.length==3)
    {
		    if (addressLine1!=null)
		    {
			    addressLine1.value = addressArray[0];
			    addressLine1.style.display="block";
		    }
		    if (addressLine2!=null)
		    {
			    addressLine2.value = "";
			    addressLine2.style.display="block";
		    }
		    if (city!=null)
		    {
			    city.value=addressArray[1];
			    city.style.display="block";
		    }        
		    if (state!=null)
		    {
			    state.value="";
			    state.style.display="block";
		    }  
		    if (postCode!=null)
		    {
			    postCode.value=addressArray[2];
			    postCode.style.display="block";
		    }
        }        
    return false;
}
function RedirectToPage(pageURL)
{
	document.location.href = pageURL;
	return false;
}
function OpenPopUpWindow(url,winName,features,w,h) 
{ 	
	LeftPosition = (screen.width)?(screen.width-w)/2:100;
	TopPosition = (screen.height)?(screen.height-h)/2:100;
	var windowFeature = new Array();
	windowFeature.push(features);
	windowFeature.push(',top=');
	windowFeature.push(TopPosition);
	windowFeature.push(',left=');
	windowFeature.push(LeftPosition);
	window.open(url,winName,windowFeature.join(''));
	windowFeature = null;
}
function TrimString(str)
{
	while(str.charAt(0)==' ')str=str.substring(1,str.length);
	while(str.charAt(str.length-1)==' ')str=str.substring(0,str.length-1);
	return(str);
}
function ValidateRetrivePassword(UserId)
{
    var valid =checkMandatoryAttr(UserId,emptyUserIdMsg);
    return valid;    
}  
function ValidateLogin(UserId,Password)
{	
    var valid=checkMandatoryAttr(UserId,emptyUserIdMsg)&& checkMandatoryAttr(Password,emptyPwdMsg);
	return valid;	
}
function checkMandatoryAttr(ctrlnm,errormsg)
{
    var ctrl=document.getElementById(ctrlnm);
    if(ctrl!=null && TrimString(ctrl.value)==""  && ctrl.getAttribute("mandatory")=="Y")
    {
        alert(errormsg);
        ctrl.focus();
        return false;
    }
    return true;
}
function ImageReload(imgControl,altSrc)
{
    imgControl.src = altSrc;
}
function DisableRightclick()
{
	return false;
}
function DisableF5Refresh(e)
{
    var forbiddenkeys = new Array('r','n','t');
	var key;
	var isCtrl;
	if( window.event)
	{
		key = window.event.keyCode;
		if(window.event.ctrlKey)
			isCtrl = true;
		else
			isCtrl = false;
	}
	else
	{
		key = e.which;
		if(e.ctrlKey)
			isCtrl = true;
		else
			isCtrl = false;
	}
	if(isCtrl)
	{
		for(i=0; i<forbiddenkeys.length; i++)
		{
			if(forbiddenkeys[i].toLowerCase() == String.fromCharCode(key).toLowerCase())
			{
				return false;
			}
		}
	}
	else if(String.fromCharCode(key).toLowerCase() == "t" || String.fromCharCode(key).toLowerCase() == "r")
	{
	    if( window.event)
	    {
	        window.event.keyCode = 0;
	        window.event.cancelBubble = true;
	        window.event.returnValue = false;
	    }
	    else if (e.preventDefault) 
	    {
            e.preventDefault();
            e.stopPropagation();
            e.cancelBubble = true;
            e.returnValue = false;
        }	
        return false;	     
	}
	return true;
}
function AssociateDisableRefreshFunc()
{
    document.oncontextmenu = DisableRightclick;
	if (navigator.appName=="Netscape") 
	{
        document.addEventListener("keypress",DisableF5Refresh,false);
    }
	document.onkeydown = DisableF5Refresh;
}
// Added For CR-89
function DefaultImageReload(imgControl,imgSrc,imgWidth)
{
    imgControl.src = imgSrc;
    if(imgWidth != 'auto')
    imgControl.style.width = imgWidth;    
   
}
// Added For CR-89 _ End