	/*This is a JavaScript library that will allow you to track the time when a browser is illegally closed without logout*/
	
	function IllegalCloseWin(str,i)
	{
		/*if (event.clientY<0)
		{
			window.location.href="BrowserClose.aspx";
			alert(str);
		}*/	
		
		if (!(window.event.clientX > 125 && window.event.clientX < 174))
		{	
			if (window.event.clientX > 0 && window.event.clientY < 0)
			{
				window.location.href="BrowserClose.aspx";
				if (window.event.clientX>0 && window.event.clientX<52)
				{
					if (i==1)
						alert("When you have finished please select the option on the screen that says Exit Training Course");
				}
				else
				{
					if (window.event.clientX>1000)
					{	
					    if(str!="" && str!=null)
					    {
							alert(str);
							
						}
						
					}
				}
				/* This is for Case Study Popup Window open and close */
				//casewindow=window.open('PreviewContentLibrary.aspx?PopUP=1', 'CustomPopup', 'width=600, height=450, menubar=no,left=200,top=200,resizable=yes,scrollbars=yes');
				//if(casewindow.closed==false)
				//{
					//casewindow.close();
				//}
				CaseStudyOpenClose();		
			}						
		}
		
	}
	
	
	function ClearDirOnCloseWin()
	{
	    if (window.event.clientX>0 && window.event.clientY < 0)
		{	
		    window.location.href="BrowserClose.aspx?s=1";
		}
	}
	
	function CaseStudyOpenClose()
	{
		casewindow=window.open('PreviewContentLibrary.aspx?PopUP=1', 'CustomPopup', 'width=0, height=0, menubar=no,left=1000,top=1000,resizable=yes,scrollbars=yes');
		if(casewindow.closed==false)
		{
			casewindow.close();
		}
	}
	function CloseWin()
	{
	 
		//if (window.event.clientX > 1000 && window.event.clientY < 0)
			//self.close();
	}
	
	
	/* Disable the contrl N features and BackSpace feature*/		
    function DisableKey(intmsg,i)
	{
		
		if (event.ctrlKey && event.keyCode==78)
		{
		
			//alert (event.ctrlKey);
			//alert (event.keyCode);
			event.keyCode=0;
			if (intmsg == 1)
			{
				alert ('This feature is disabled.');
			}
			if (intmsg == 2)
			{
				alert ('This feature is disabled.');
			}
			if (intmsg == 3 || intmsg == 0)
			{
				alert ('This feature is disabled.');
			}
			return false;
		}
		if (i==1)
		{
			if (event.keyCode==8)
			{
				window.location.href="BrowserClose.aspx";
				alert("When you have finished please select the option on the screen that says Exit Training Course");
			}
		}
		if (event.altKey && event.keyCode==115)
		{
			window.location.href="BrowserClose.aspx";
			alert('Next time please logout using the Logout option within the system.');
		}	
				
	}		
	
	//This Method is Used to Check wheather the entered value are numeric or not
	//Created by Rajkumar on 02_07_2008
	function NumericValidationCheck() {
				var lKeyCode;
				lKeyCode = event.keyCode;
				if( lKeyCode < 48 || lKeyCode > 57 )
					event.keyCode = null;
			}
			
	//'Created by Rajkumar for Bug "B-639 No wrapping entry field in " on 04_07_2008
	function remarksLength(LebelText,TextboxID,maxLength)
				{
				var maxlength = new Number(maxLength); 
					if(document.getElementById(TextboxID).value.length > maxlength){
						alert('"' + LebelText + '" can not be more than ' + maxLength + ' characters');
						document.getElementById(TextboxID).value = document.getElementById(TextboxID).value.substring(0,maxlength);
						document.getElementById(TextboxID).focus();
					return false;
				}
			}		
			
			
	//'Created by Rajkumar for Bug "B-639 No wrapping entry field in " on 08_07_2008
		//This Script helps to Check the number of characters entered into the TextBox when user peste data from 
		//Clipboard
		
		function Paste_Event(LebelText,TextboxID,maxLength)
			{
				var maxlength = new Number(maxLength); 
				var PasteData = window.clipboardData.getData("Text");
				
				if(document.getElementById(TextboxID).value == ''){
				
					if(PasteData.length > maxlength){
							alert('"' + LebelText + '" can not be more than ' + maxLength + ' characters');	
							document.getElementById(TextboxID).value = PasteData.substring(0,maxlength);
							document.getElementById(TextboxID).focus();
						return false;
					}
				}	
				else{
				
				PasteData = document.getElementById(TextboxID).value + PasteData
				
					if(PasteData.length > maxlength){
							alert('"' + LebelText + '" can not be more than ' + maxLength + ' characters');	
							document.getElementById(TextboxID).value = PasteData.substring(0,maxlength);
							document.getElementById(TextboxID).focus();
						return false;
					}
					
					
				}	
			}
			
		/*Created by Rajkumar for Bug "B-627 Incorrectly getting "logged in twice message" on 18_07_2008
		This Function Restricts The Pages to go to its previous State when browser BackButtons is clicked
		*/
		
		function DisableBrowserBackSpace(){
           if(window.history.forward(1) != null){
				window.history.forward(1);
			}
		}
		
		/*Created by Rajkumar for Bug "B-627 Incorrectly getting "logged in twice message" on 18_07_2008
		This Function Refresh the Opener Page
		*/
		function RefreshParent(){
		window.opener.location.href = window.opener.location.href;
		}
		
		//This method helps to handles PopUp pages when user closes the page by clicking on the x button
		function UpDateFlag(pButtonID){
		var lflag;
		lflag=document.getElementById(pButtonID).getAttribute("flag") 
			if(lflag){
				document.getElementById(pButtonID).setAttribute("flag","false")
				lflag1=document.getElementById(pButtonID).getAttribute("flag")   
			} 
		}
		
		function PageCloseHandler(pButtonID){
			var lflag;
			lflag=document.getElementById(pButtonID).getAttribute("flag")  
				if(lflag=="true"){
				RefreshParent();
				}
			}
		
	    /*Created by Rajkumar on 12_02_2009
		This Function Restricts The Pages to go to its previous State when browser BackButtons is clicked
		*/
        function DisablingBackFunctionality()
        {
            var URL;
            var i ;
            var QryStrValue;
            
            URL=window.location.href ;
            i=URL.lastIndexOf("?");
            QryStrValue=URL.substring(i+1);
          
                if (QryStrValue!='X')
                {
                    window.location=URL + "?X";
                }
        }

    //The following function can be used to select or unselect checkboxes in panels.
    function CheckUncheck(pCheckBoxList,pCheckUncheck,pStatus){
			
        var lCheckBoxList = document.getElementById(pCheckBoxList);
        var lCheckUncheck=document.getElementById(pCheckUncheck);
        var lchkBoxCount= lCheckBoxList.getElementsByTagName('input');

        for(var i=0;i<lchkBoxCount.length;i++) 
        {
            if(pStatus){
                if(lCheckUncheck.checked){
                    lchkBoxCount[i].checked =false;
                }else{
                    lchkBoxCount[i].checked =true;
                }  
            }else{
                if(lCheckUncheck.checked){
                    lchkBoxCount[i].checked =true;
                }else{
                    lchkBoxCount[i].checked =false;
                }  
            }    
        }
        
    }    
        
