<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="shortcut icon" type="image/ico" href="<%branding.favicon%>">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=2.0">



<title><%branding.app_short_title%></title>
<style type="text/css">
body {
	margin:0;
	padding:0;
}

</style>


<link rel="stylesheet" href="/others/qqui1/styles.css" type="text/css" media="screen"/>
<link rel="stylesheet" href="/others/qqui1/gallery/gallery.css" type="text/css" media="screen"/>
<link rel="stylesheet" href="/others/qqui1/jquery/jquery-ui.css"/>
<link rel="stylesheet" href="/others/qqui1/uniform/themes/default/css/uniform.default.css" media="screen" />
<link rel="stylesheet" href="/others/qqui1/DataTables/media/css/jquery.dataTables.css" media="screen" />
<link rel="stylesheet" href="/others/qqui1/emoji/emoji.css" type="text/css" />
<link rel="stylesheet" href="/others/qqui1/timepicker/jquery-ui-timepicker-addon.css" type="text/css" />
<link rel="stylesheet" href="/others/qqui1/CSSTree/CSSTree.css"  type="text/css">
<%style_link_inject_point%>
<style type="text/css" class="init"></style>

<style type="text/css">
.ui-accordion .ui-accordion-header {
padding: 0.0em 0.5em 0.0em 1.7em;
}

</style>
<script src="/others/qqui1/math/math.min.js" type="text/javascript"></script>
<script src="/others/qqui1/jquery/external/jquery/jquery.js"></script>
<script src="/others/qqui1/jquery/jquery-ui.min.js"></script>
<script src="/others/qqui1/plugins/jquery.notify.js"></script>
<script src="/others/qqui1/plugins/jquery.simplemodal.js"></script>
<script src="/others/qqui1/SimpleMenu/jquery.menu.js"></script>
<script src="/others/qqui1/timepicker/jquery-ui-sliderAccess.js"></script>
<script src="/others/qqui1/timepicker/jquery-ui-timepicker-addon.js"></script>
<script src="/others/qqui1/uniform/jquery.uniform.min.js"></script>
<script src="/others/qqui1/DataTables/media/js/jquery.dataTables.min.js"></script>
<script src="/others/qqui1/emoji/emoji.js"></script>	    
<%script_link_inject_point%>	
<script type="text/javascript" language="javascript" src="/others/zx/zxDeltaScriptFile.js"></script>	
<script type="text/javascript" language="javascript" src="/others/zx/zxUploader.js"></script>	
<script type="text/javascript" language="javascript" class="init">


var myFaceBookAppID='<%branding.FaceBookAppID%>';
var auto_login_facebook_on_return=false;
var zx_active_page='NONE'; 

<%#run.login_first%>
zx_active_page='#PAGE_1';
console.log("zx_active_page :",zx_active_page );

first_page_rendered=false;
LoadedInstance='';
first_page_container="#maincontainer";
console.log("first_page_rendered:",first_page_rendered);
<%/run.login_first%>  
  
</script>
<SocketStream/>
	
</head>

<body class="no-touch">

<div id="PAGE_3" class="zxPage" style="display: none;"> 
<div style="width: 100%; height: 100%; background: none ;">
<div  id="wrapper"> 
        <input id="auth-code" type="text" autocomplete="off">
		<span class="icon-wrap-lb"><a href="#" language="javascript" id="DebugViewConsole" title="Console"><span class="icon-block-black "></span>Console</a></span>
		<span class="icon-wrap-lb"><a href="#" language="javascript" id="DebugViewErrors" title="Errors"><span class="icon-block-black "></span>Errors</a></span>			
		<span class="icon-wrap-lb"><a href="#" language="javascript" id="DebugViewModel" title="Model"><span class="icon-block-black "></span>Model</a></span>			
		<span class="icon-wrap-lb"><a href="#" language="javascript" id="DebugViewControllers" title="Controllers"><span class="icon-block-black "></span>Controllers</a></span>			
		<span class="icon-wrap-lb"><a href="#" language="javascript" id="DebugViewViews" title="Views"><span class="icon-block-black "></span>Views</a></span>					
		<span class="icon-wrap-lb"><a href="#" language="javascript" id="DebugRebuild" title="Rebuild"><span class="icon-block-black "></span>Rebuild</a></span>					
		<span class="icon-wrap-lb"><a href="#" language="javascript" onclick="return(zx_switch_key());" title="Back To App"><span class="icon-block-black "></span>Web</a></span>			
		<HR/>		
		<div divout="Standard" id="debugBuildNotify"></div>
        <div divout="Standard" id="debugcontainer">		
 </div>
</div>	  
</div>	  

</div><!--PAGE_3 -->

<div id="PAGE_1" class="zxPage" style="display: none;">

<!--[if IE]>
<script type="text/javascript">
window.location.href = "ie.html";
</script>
<![endif]-->

<div id="login-wrapper">
	<div id="login-header" class="top-round">
		<div class="login-left">
			<span class="icon-wrap-lb-less"><span class="icon-block-black key-tw-b"></span><%branding.menu_short_title%></span>
		</div>
		<div class="login-right">
			<a href="#" title="<%branding.menu_short_title%>"><img src="<%branding.menu_image%>" width="55" height="55" alt="<%branding.menu_short_title%>"></a>
		</div>
	</div>
	<div class="login-box bottom-round">		
		<form id="LoginForm" onsubmit="return false" autocomplete="off">
		
		    <INPUT name=Mac type=hidden>
			<INPUT id="LoginMasked" type=hidden>
			<ul>
			    <input id="LoginPage" type="hidden" value="" class="login-text-box usr"  autocomplete="off">
				
				<li><label>Username</label><input id="LoginName" type="text" value="" class="login-text-box"  autocomplete="off"></li>
				<li><label>Password</label><input id="LoginInput" type="text" value="" class="login-text-box usr"  autocomplete="off"></li>
				<li><label>&nbsp;</label><input id="LoginButton" name=Go type="Submit" class="submit-button-login" value="Login" autocomplete="off"></li>								
				<li style="display: none;"><label>&nbsp;</label><fb:login-button scope="public_profile,email" onlogin="checkLoginState();"></fb:login-button></li>
				<li id="InvalidUser" style="display: none;"><span>Invalid Login, Please try again.</span></li>				
				<li style="display: none;"><span id="status"></span></li>				
			</ul>		
		</form>
		<%#run.selfmanage%>
		<a href="#" id="RegisterNewUser" title="Register New User" style="color:white;margin-left:15px;text-decoration: underline;">Register as a new user</a>
		<a href="#" id="ForgotPassword"  title="Forgot Password?"  style="color:white;margin-right:17px;text-decoration: underline;float: right;">Forgot password?</a>
		<%/run.selfmanage%>



<div id="fb-root"></div>		
<br>
	</div>
</div>
<div id="footer-wrap">
	<div id="footer">
		<div class="login-footer-container">
			 <%branding.copyright_title%>
		</div>
	</div>
</div>


  
</div><!--PAGE_1 -->

<div id="PAGE_2" class="zxPage" style="display: none;">  <!--this is matched in serverside_render.js -->
<div divout="Frame" id="framecontainer"></div>
<div divout="Standard" id="maincontainer"></div>
</div><!--PAGE_2 -->	

<div id="PAGE_0" class="zxPage" style="display: none;">
<!--[if IE]>
<script type="text/javascript">
window.location.href = "ie.html";
</script>
<![endif]-->

<div id="login-wrapper">
	<div id="login-header" class="top-round">
		<div class="login-left">
			<span class="icon-wrap-lb-less"><span class="icon-block-black key-tw-b"></span><%branding.menu_short_title%></span>
		</div>
		<div class="login-right">
			<a href="#" title="<%branding.menu_short_title%>"><img src="<%branding.menu_image%>" width="55" height="55" alt="<%branding.menu_short_title%>"></a>
		</div>
	</div>
	<div class="login-box bottom-round">	
		<div align="center">	
		<b><BR>Welcome to <%branding.app_short_title%><BR>
		<BR>	
		Please wait while the application contacts the server..
		<BR><BR><BR>
		</b>
		</div>
	</div>
</div>
<div id="footer-wrap">
	<div id="footer">
		<div class="login-footer-container">
			 <%branding.copyright_title%>
		</div>
	</div>
</div>


  
</div><!--PAGE_0 -->







<div id="PAGE_4" class="zxPage"  style="display: none;">
<div id="login-wrapper">
	<div id="login-header" class="top-round">
		<div class="login-left">
			<span class="icon-wrap-lb-less"><span class="icon-block-black key-tw-b"></span><%branding.menu_short_title%></span>
		</div>
		<div class="login-right">
			<a href="#" title="<%branding.menu_short_title%>"><img src="<%branding.menu_image%>" width="55" height="55" alt="<%branding.menu_short_title%>"></a>
		</div>
	</div>
	<div class="login-box bottom-round">	
		<div align="center">	
		<b><BR>This application is currently undergoing maintenance.<BR>
		<BR>
		This will only take a minute or two, please be patient...
		<BR><BR><BR>
		</b>
		</div>
	</div>
</div>
 
</div><!--PAGE_4 -->	

<%page_inject_point%>

<script type="text/javascript" language="javascript">
   console.log("LoadedInstance:",LoadedInstance);
   		window.addEventListener( "pageshow", function ( event ) {			
		    var historyTraversal = event.persisted || 
				( typeof window.performance != "undefined" && 
				window.performance.navigation.type === 2 );
		    if ( historyTraversal ) {
			// Handle page restore.
			console.log("############# pageshow/restore:",LoadedInstance);
			//LoadFromBrowserBackNavigation();
			//window.location.reload();
		  }
		});
		
    window.onpopstate = function (event) {  
		//console.log("#history.onpopstate:",event);
		if(event.state) {
			if (event.state.cid=="Home")
				window.location.reload();
			else
				zxnav_load(event.state.cid);
		} 
	}
	history.pushState({cid:"Home"}, 'Home','#Home');
		
			
   
   
  // Here we run a very simple test of the Graph API after login is
  // successful.  See statusChangeCallback() for when this call is made.
  function testAPI(Login_response) {
    console.log('Welcome!  Fetching your information.... ');
    FB.api('/me', function(response) {
      console.log('Successful login for: ' , Login_response,response);
	  
      document.getElementById('status').innerHTML = 'Thanks for logging in, ' + response.name + '! ';    	
	  ss.rpc('ServerProcess.FBLoginAction', Login_response,response,'',LoadedInstance,null);
    });
  }

  // This is called with the results from from FB.getLoginStatus().
  function statusChangeCallback(response) {
    console.log('statusChangeCallback');
    console.log(response);
    // The response object is returned with a status field that lets the
    // app know the current login status of the person.
    // Full docs on the response object can be found in the documentation
    // for FB.getLoginStatus().
    if (response.status === 'connected') {
      // Logged into your app and Facebook.
      testAPI(response);
    } else if (response.status === 'not_authorized') {
      // The person is logged into Facebook, but not your app.
      document.getElementById('status').innerHTML = 'Please log ' +
        'into this app.';
    } else {
      // The person is not logged into Facebook, so we're not sure if
      // they are logged into this app or not.
      document.getElementById('status').innerHTML = 'Please log ' +
        'into Facebook.';
    }
  }

  // This function is called when someone finishes with the Login
  // Button.  See the onlogin handler attached to it in the sample
  // code below.
  function checkLoginState() {
    FB.getLoginStatus(function(response) {
      statusChangeCallback(response);
    });
  }

  window.fbAsyncInit = function() {
    
  FB.init({
    appId      : myFaceBookAppID,
    cookie     : true,  // enable cookies to allow the server to access 
                        // the session
    xfbml      : true,  // parse social plugins on this page
    version    : 'v2.2' // use version 2.2
  });

  // Now that we've initialized the JavaScript SDK, we call 
  // FB.getLoginStatus().  This function gets the state of the
  // person visiting this page and can return one of three states to
  // the callback you provide.  They can be:
  //
  // 1. Logged into your app ('connected')
  // 2. Logged into Facebook, but not your app ('not_authorized')
  // 3. Not logged into Facebook and can't tell if they are logged into
  //    your app or not.
  //
  // These three cases are handled in the callback function.

  
  if (auto_login_facebook_on_return)
	  FB.getLoginStatus(function(response) {
		statusChangeCallback(response);
	  });

  };

  // Load the SDK asynchronously
  if (myFaceBookAppID=='') 
		console.log("The developer can set the Facebook app id (myFaceBookAppID) in app.html to enable Facebook login");
  else
	  (function(d, s, id) {
		var js, fjs = d.getElementsByTagName(s)[0];
		if (d.getElementById(id)) return;
		js = d.createElement(s); js.id = id;
		js.src = "//connect.facebook.net/en_US/sdk.js";
		fjs.parentNode.insertBefore(js, fjs);
	  }(document, 'script', 'facebook-jssdk'));


</script>
<%script_run_inline_inject_point%>
</body>
</html>