/*********************************************/


		
		////session time out coding
		//var sessionTimeout='10000'
		//var sessionTimeout='<%=SessionTimeout%>'
		//timerMain=setInterval('chkSession()',sessionTimeout);
		
		var isLoggedIn=false;
		var  hh, wnd="";
		var strPath="../";
        var timerMain = null;		
        
		function Login()
		{   
		   isLoggedIn=true;
		   
		   if(timerMain)
		   {
		        clearInterval(timerMain);
		   }
		   timerMain = setInterval('chkSession()',sessionTimeout);
		}
		
		function Logout()
		{		   
		    isLoggedIn=false;
		}
		function chkSession()
		{
		
		    
		    if(isLoggedIn==false)
		    {
		        return;
		    }
		   
			
			var hWidth="310px";
		    var hHeight="50px";
		
			hPageTitle = "Session TimeOut";
			
				
				if (window.showModalDialog)
				{
					 wnd = window.showModalDialog(strPath +'frmSessionTimeOut.aspx?SECTION='+strSection,hPageTitle,'dialogHeight:' + hHeight + ';dialogWidth:' + hWidth + ';edge:Raised;help:No;scroll:0;resizable:No;status:No;dialogLeft:330px;dialogTop:325px;');
					 //alert(wnd);
					 //alert(strSection);
					 SetName(wnd);
				}
				else
				{
					var i;
					for(i=0;i<document.all.length;i++)
					{
						if(document.all(i).type == "submit")
						{
							document.all(i).disabled="true";
						}
						else if(document.all(i).type == "text")
						{
							document.all(i).readOnly="true";
						}
						else if(document.all(i).type == "checkbox")
						{
							document.all(i).disabled="true";
						}
						else if(document.all(i).type == "radio")
						{
							document.all(i).disabled="true";
						}
						else if(document.all(i).type == "button")
						{
							document.all(i).disabled="true";
						}
						else if(document.all(i).type == "image")
						{
							document.all(i).disabled="true";
						}
						else if(document.all(i).getAttribute("href") != null)
						{							
							if(document.all(i)!="[object HTMLLinkElement]")
							{
								disableAnchor(document.all(i),true);
							}
						}
						
					}
					var iLeft = (screen.width  - hWidth) / 2 ;
					var iTop  = (screen.height - hHeight) / 2 ;

					var sOptions = "modal,toolbar=false,location=false,directories=false,status=false,menubar=false,scrollbars=no,resizable=no" ;
					sOptions += ",width=" + hWidth ;
					sOptions += ",height=" + hHeight ;
					sOptions += ",left=330px";
					sOptions += ",top=225px";

					// Open the browser window.
					//winHandle = window.open(strPath +'frmsessionOutSrc.aspx?SECTION='+strSection, hPageTitle, sOptions ) ;
					//winHandle.focus();
					
				
				//alert(wnd)
				/*
				if(wnd=="logoff")
				{
					if(strREP == "1")
					{
						window.parent.location.href="../../grossier/login.aspx";
					}
					else if(strREP=="2")
					{
						window.parent.location.href = "../../admin/login.aspx";
					}
					else
					{
						if(strSection=="GOREP")
						{
							window.parent.location.href="../Logout.aspx";
						}
						else if(strSection == "GO")
						{
							window.parent.location.href="Logout.aspx";
						}
						else
							window.parent.location.href=strLoginPath+"login.aspx";
					}
				}
				else if(wnd=="continue")
				{					
					window.location.href = window.location.href;
				}
				else
				{
					if ( typeof(window.parent.winClose) == 'function' || typeof(window.parent.winClose) == 'object')
						window.parent.winClose();
					else
						window.parent.close();
				}	
				*/	
			}
		}
		
		function SetName(strName)
		{
		    var wnd=strName;
		    
			if(wnd=="logoff" || wnd == undefined)
			{
			
			    var oXmlHttp = this.GetHttpRequest() ; 
                LoadUrl("../frmSessionOutSrc.aspx?FunctionName=logout","function"); 
			    if ( strSection.toUpperCase() == "SCHOOLADMIN")
			    {
			        window.parent.location.href="../SchoolAdmin/Default.aspx";
			    }
			    else if ( strSection.toUpperCase() == "MANAGEMENT")
			    {
			        window.parent.location.href="../Management/Default.aspx";
			    }			    
			    else if ( strSection == "WEB")
			    {
			        window.parent.location.href=schoolUrl;
			    }
			    else if(strSection.toUpperCase() == "WEBADMIN")
			    {			    
			        window.parent.location.href="../WebAdmin/Default.aspx";			    
			    }			    
		    }
		    if(wnd=="continue")
		    {
		         //window.parent.location.href="../Web/Default.aspx";
		        if ( strSection.toUpperCase() == "SCHOOLADMIN")
			    {
			      LoadUrl("AdminDefault.aspx?Control=UserManual","function"); 
			      //window.parent.location.href="../SchoolAdmin/AdminDefault.aspx?Control=UserManual";
			    }
			    if ( strSection.toUpperCase() == "MANAGEMENT")
			    {
			      LoadUrl("MGMAdminDefault.aspx?Control=UserManual","function"); 
			      //window.parent.location.href="../SchoolAdmin/AdminDefault.aspx?Control=UserManual";
			    }
			    else if ( strSection.toUpperCase() == "WEB")
			    {
			        LoadUrl("webdefault.aspx","function"); 
			        //window.parent.location.href='../web/webdefault.aspx';
			    }
			    else if(strSection.toUpperCase() == "WEBADMIN")
			    {	
			        LoadUrl("AdminDefault.aspx?Control=UserManual","function"); 
			        //window.parent.location.href="../WebAdmin/AdminDefault.aspx?Control=UserManual";
			    }			    
		    }		
		}
		
		function disableAnchor(obj, disable)
		{
			if(disable){
				var href = obj.getAttribute("href");
				if(href && href != "" && href != null){
				obj.setAttribute('href_bak', href);
				}
				obj.removeAttribute('href');			
			}
			else{
				obj.setAttribute('href', obj.attributes['href_bak'].nodeValue);			
			}
		}

	
/************************************/
