﻿<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl">
	<xsl:import href="Footer.xslt"/>
	<xsl:output method="xml" indent="yes"/>

	<xsl:template match="/">
		<xsl:variable name="color">
			<xsl:choose>
				<xsl:when test="(/AjaxRequest/Settings/LoginPanel/Coachsimple/@collapse='true'  or /AjaxRequest/Settings/LoginPanel/Coachsimple/@collapse='link')  and /AjaxRequest/Settings/LoginPanel/Coachsimple/Color[text()]">
					<xsl:value-of select="/AjaxRequest/Settings/LoginPanel/Coachsimple/Color"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:text>#4CAF50</xsl:text>
				</xsl:otherwise>
			</xsl:choose>

		</xsl:variable>
		<style type="text/css">
			
			.btn-success.btn-arrow-bottom:before {
			border-top: 6px solid <xsl:value-of select="$color"></xsl:value-of>;
      bottom: -6px;
      }

      @media (min-width: 768px) {
      .enterprise-popup  .modal-dialog {
      width: 900px;

      }
      }
    </style>
		<xsl:variable name="LogoPath" select="/AjaxRequest/Settings/Logo/LogoURL"></xsl:variable>
		<xsl:variable name="ReturnPath" select="/AjaxRequest/ReturnPath"></xsl:variable>
		<xsl:variable name="TemplatePathURL" select="/AjaxRequest/TemplateURL"></xsl:variable>
		<xsl:variable name="HostName" select="/AjaxRequest/HostName"></xsl:variable>
		<xsl:variable name="DomainName" select="AjaxRequest/Settings/DomainName"></xsl:variable>
		<xsl:variable name="IsSecureConnection" select="/AjaxRequest/IsSecureConnection"></xsl:variable>
    <xsl:variable name="PortalList" select="/AjaxRequest/PortalList"></xsl:variable>
    
     <xsl:variable name="Email" select="/AjaxRequest/Email"></xsl:variable>
     <xsl:variable name="Password" select="/AjaxRequest/Password"></xsl:variable>
     <xsl:variable name="SecertHash" select="/AjaxRequest/SecertHash"></xsl:variable>
     <xsl:variable name="IssueTime" select="/AjaxRequest/IssueTime"></xsl:variable>
    
    <xsl:variable name="Protocol">
            <xsl:choose>
                <xsl:when test="$IsSecureConnection = 1">
                    <xsl:text>https://</xsl:text>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:text>http://</xsl:text>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:variable>		
		<xsl:variable name="AndroidURL">
			<xsl:choose>
				<xsl:when test="/AjaxRequest/Settings/Mobile/AndroidDownloadURL[text()]">
					<xsl:value-of select="/AjaxRequest/Settings/Mobile/AndroidDownloadURL"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:text>https://play.google.com/store/apps/details?id=com.lifespace</xsl:text>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>

		<xsl:variable name="IOSURL">
			<xsl:choose>
				<xsl:when test="/AjaxRequest/Settings/Mobile/IOSDownloadURL[text()]">
					<xsl:value-of select="/AjaxRequest/Settings/Mobile/IOSDownloadURL"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:text>https://itunes.apple.com/us/app/coach-simple-coaching-software/id579885991?mt=8</xsl:text>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>

		<xsl:variable name="SAMLActive">
			<xsl:choose>
				<xsl:when test="/AjaxRequest/Settings/SAML/ButtonOnLogin[text()]">
					<xsl:value-of select="/AjaxRequest/Settings/SAML/ButtonOnLogin"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:number value="0"/>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>

		<xsl:variable name="SAMLButtonText">
			<xsl:choose>
				<xsl:when test="/AjaxRequest/Settings/SAML/SSOButtonText[text()]">
					<xsl:value-of select="/AjaxRequest/Settings/SAML/SSOButtonText"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:text>SignIn with SSO</xsl:text>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<xsl:variable name="SAMLButtonColor">
			<xsl:choose>
				<xsl:when test="/AjaxRequest/Settings/SAML/SSOButtonColor[text()]">
					<xsl:value-of select="/AjaxRequest/Settings/SAML/SSOButtonColor"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:text>#4173ae;</xsl:text>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>

		<xsl:variable name="clsCollapse">
			<xsl:choose>
				<xsl:when test="/AjaxRequest/Settings/LoginPanel/Coachsimple/@collapse='true' or  /AjaxRequest/Settings/LoginPanel/Coachsimple/@collapse='link'">
					<xsl:text>none</xsl:text>
				</xsl:when>
				<xsl:otherwise>
					<xsl:text></xsl:text>
				</xsl:otherwise>
			</xsl:choose>

		</xsl:variable>
			

		<!-- header part -->
		<header>
			<!-- logo -->
			<div class="row padding_container">
				<div class="col-sm-12">
					<img src="{$LogoPath}" class="img-responsive auto_image htImg"></img>
				</div>
			</div>
			<!-- end -->
		</header>
		<!-- header end -->
		<!-- content part -->

		<div class="container wrap">
			<div class="row">
				<!-- for form -->
				<div class="col-md-6">
					<h1 class="wel text-secondary">Log In</h1>
					<!-- form -->
					<form id="form1" role="form" onsubmit=" return Login_validateForm()" action="Login.aspx" method="post" class="form_change">
						<input type="hidden" class="display_none" id="email3" name="mode" value="1" />
						<input type="hidden" class="display_none" id="Remchecked" name="RemPassword"  />
						<xsl:if test="$SAMLActive = 1">
							<div>
								<input type="button" id="btnSAMLSSO"
									   style="background-color: {$SAMLButtonColor};  width: 100% !important;  height: 47px;    font-family: 'PT Sans',sans-serif;     font-size: 16px; 
									   color: #FFFFFF;    text-align: center;    cursor: pointer;border-width:0px;    padding: 10px;    font-weight: normal;    border-radius: 6px;    margin-bottom: 10px;"
									   class="textCenter fonts13px" value="{$SAMLButtonText}"
									   onclick="parent.window.location.href='saml20'"/>
							</div>
							<div id="divSeparationBar" name="divSeparationBar">
								<table class="tableMaster">
									<tr>
										<td width="40%" style="border-bottom:1px solid;"></td>
										<td width="20%" rowspan="2" style="text-align:center">OR</td>
										<td width="40%" style="border-bottom:1px solid;"></td>
									</tr>
									<tr>
										<td width="40%"></td>
										<td width="20%"></td>
										<td width="40%"></td>
									</tr>
								</table>
							</div>

						</xsl:if>
            <xsl:if test="$SAMLActive = 2">
              <div>
                <input type="button" id="btnSAMLSSO"
									   style="background-color: {$SAMLButtonColor};  width: 100% !important;  height: 47px;    font-family: 'PT Sans',sans-serif;     font-size: 16px; 
									   color: #FFFFFF;    text-align: center;    cursor: pointer;border-width:0px;    padding: 10px;    font-weight: normal;    border-radius: 6px;    margin-bottom: 10px;"
									   class="textCenter fonts13px" value="{$SAMLButtonText}"
									   onclick="openPopUpSession('{$DomainName}')"/>
                
              </div>              
              <div id="divSeparationBar" name="divSeparationBar">
                <table class="tableMaster">
                  <tr>
                    <td width="40%" style="border-bottom:1px solid;color:#ccc"></td>
                    <td width="20%" rowspan="2" style="text-align:center;color:#ccc">or</td>
                    <td width="40%" style="border-bottom:1px solid;color:#ccc"></td>
                  </tr>
                  <tr>
                    <td width="40%"></td>
                    <td width="20%"></td>
                    <td width="40%"></td>
                  </tr>
                </table>
              </div>

            </xsl:if>
						<xsl:choose>
							<xsl:when test="/AjaxRequest/Settings/LoginPanel/Coachsimple/@collapse='true'">
								<div style="text-align:center;" >
									<button  onclick="this.style.display='none'; return expandLogin('loginForm')" class="btn btn-arrow btn-arrow-bottom btn-success btn-outline"
									style="text-align: center;  border-radius: 6px;  background-color:{$color} ;  border: none;   color: white;
    font-family: 'PT Sans',sans-serif!important;   padding: 12px;   text-align: center;   text-decoration: none;   display: inline-block;  font-size: 16px;    margin: 4px 0px;
    font-weight: normal!important;  cursor: pointer;    width: 100%;">
										<xsl:value-of select="/AjaxRequest/Settings/LoginPanel/Coachsimple/Text"/>
									</button>
								</div>
							</xsl:when>
							<xsl:when test="/AjaxRequest/Settings/LoginPanel/Coachsimple/@collapse='link'">
								<div style="text-align:center;" >
									<a  onclick="this.style.display='none'; return expandLogin('loginForm')" class=""
									style="color:{$color};cursor:pointer;font-size:14px">
										<xsl:value-of select="/AjaxRequest/Settings/LoginPanel/Coachsimple/Text"/>
									</a>
								</div>
							</xsl:when>
						</xsl:choose>



						<div id="loginForm" style="display:{$clsCollapse}">
							<div class="form-group">
								<label for="email" class="sr-only">Email address:</label>
								<input type="email" class="form-control form_height" id="email" name="email" placeholder="Email Address" required=""></input>
							</div>
							<div class="form-group">
								<label for="pwd" class="sr-only">Password:</label>
								<input type="password" class="form-control form_height" id="password" name="Password" placeholder="Password" required=""></input>
							</div>
							<label class="rem text-tertiary">
								<input type="checkbox" value="" class="chekbox text-tertiary"  id="RemPassword" checked="true">Remember Password</input>
							</label>
							<label class="pull-right text-tertiary" data-toggle="modal" data-target="#myModal" onclick="clear_errorMessage()">
								<a href="#" class="col text-tertiary">Forgot your password?</a>
							</label>
							<br />
							<div class=" col-md-12 col-xs-12" id="lblErrMessage"></div>
							<br />
							<input type="hidden" value="{$ReturnPath}" name="returnPath" id="returnPath"></input>
							<button type="submit" class="btn log btn btn-secondary" id="Submit">Log In</button>
						</div>
						<div class="row center" style="display:none">
							<!-- for icon -->
							<div class="col-md-8 col-xs-8">
								<ul class="list-inline pos">
									<li>
										<a href="#">
											<img src="{$Protocol}{$HostName}/image/facebook.png" class="img-responsive"></img>
										</a>
									</li>
									<li>
										<a href="#">
											<img src="{$Protocol}{$HostName}/image/twitter.png" class="img-responsive"></img>
										</a>
									</li>
								</ul>
							</div>
							<!-- end -->
							<!-- for signup -->
							<div class="col-md-4 col-xs-4">
								<button type="Signup" class="btn sign">Sign up</button>
							</div>
							<!-- end -->
						</div>
					</form>
					<!-- end form -->
				</div>
				<!-- end -->
				<!-- for slider -->
				<div class="col-sm-6 slider">
					<!-- slider code -->
					<div id="myCarousel" class="carousel slide" data-ride="carousel" >
						<!-- Indicators -->
						<ol class="carousel-indicators">
							<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
							<li data-target="#myCarousel" data-slide-to="1"></li>
						</ol>
						<!-- Wrapper for slides -->
						<div class="carousel-inner" role="listbox">
							<!--<div class="item active">
								<img src="image/image1.jpg" alt=""></img>
							</div>

							<div class="item">
								<img src="image/image2.jpg" alt=""></img>
							</div>-->


							<xsl:for-each select="/AjaxRequest/Settings/Slider/Image">
								<xsl:variable name="image" select="."/>
								<xsl:if test="position()=1">
									<div class="item active">
										<img src="{$image}" alt="demo" class="img-responsive" usemap="#image-map"></img>
										<map name="image-map">
											<area target="_Blank" alt="" title="" href="{$AndroidURL}" coords="35,240,166,281" shape="rect"/>
											<area target="_Blank" alt="" title="" href="{$IOSURL}" coords="34,291,168,332" shape="0"/>
										</map>
									</div>
								</xsl:if>
								<xsl:if test="position() &gt;1">
									<div class="item">
										<img src="{$image}" alt="demo" class="img-responsive"></img>
									</div>
								</xsl:if>
							</xsl:for-each>
						</div>
					</div>
					<!-- end -->
				</div>
				<!-- end -->
			</div>
		</div>

		<!-- content end -->
		<!-- footer -->
		<xsl:call-template name="Footer">

		</xsl:call-template>
    <!--EnterPrise Portal Modal Setup-->
    <div class="modal fade enterprise-popup" id="enterpriseportals" role="dialog">
      <div class="modal-dialog">
        <div class="modal-content">
          <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal"></button>
            <span  class="right-align" data-dismiss="modal">X</span>
            <h4 class="modal-title text-center">Choose Your Platform</h4>
            
          </div>
          <label class="pull-right " data-toggle="modal" data-target="#enterpriseportals" style="display: none" id="enterprise_Click">
            <a href="#" class="col"></a>
          </label>
          <br />
          <div class="modal-body">
         
           <form id="portalForm" role="form" onsubmit="return Login_validateForm()" action="PortalAuth.aspx" method="post">
            <div class="row outer-thumbs">           
                <input type="hidden" style="display: none" id="enterpriseportal" name="enterpriseportal" value=""></input>
                <input type="hidden" style="display: none" id="portalurl" name="portalurl" value=""></input>
                <input type="hidden" style="display: none" id="redirectemail" name="email" value="{$Email}"></input>
                <input type="hidden" style="display: none" id="redirectpassword" name="password" value="{$Password}"></input>
                <input type="hidden" style="display: none" id="issueat" name="issueat" value="{$IssueTime}"></input>
                <input type="hidden" style="display: none" id="issuemaptimeat" name="issuemaptimeat" value=""></input>
                <input type="hidden" style="display: none" id="code" name="code" value="{$SecertHash}"></input>
                  <xsl:for-each select="$PortalList/Portals/Portal">
                  <xsl:variable name="postion" select="position() - 1"/>                    
                  <div class="img-thumbs">             
                   <a  id="enterprise{$postion}_Click" onclick="InvokeEnterPrise_Portal('{MasterPortalItemID}','{TargetURL}')">               
                      <img id="portalimg{$postion}" src="{BrandLogoSmallURL}" onerror="getInitials('{BrandKey}','portalimg{$postion}')"/>
                      <p>
                         <xsl:value-of select="BrandKey"/>
                      </p>
                    </a>
                </div>
               </xsl:for-each> 
              </div>
       
           </form>
               
            
          </div>

          <!--<div class="modal-footer">
            <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
          </div>-->
        </div>
      </div>
    </div>
		<div class="modal fade mrginModl" id="myModal" role="dialog" style="margin-top:0px!important">

			<div class="modal-dialog">


				<!-- Modal content-->
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal"></button>
						<h4 class="modal-title text-center">Forgot Password</h4>
					</div>
					<div class="modal-header" id="OutputMess">
					</div>
					<input type="email" style="display: none" id="email1" name="mode" value="1"></input>
					<div class="modal-body">

						<div class="form-group">
							<label for="email" class="sr-only">Email address:</label>
							<input type="email" class="form-control form_height" id="ResetEmail" placeholder="Email Address" required=""></input>
							<span class="validation" id="Forgotpass_email">This field is required.</span>
						</div>
						<div class="form-group text-center">
							<button type="Signup" class="btn btn-info sign mrgin btn btn-secondary" onclick="User_ResetPassword('ResetEmail','OutputMess')">Reset Password</button>

						</div>
					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
					</div>
				</div>

			</div>
		</div>

		<div class="modal fade" id="resetPassModal" role="dialog">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal"></button>
						<h4 class="modal-title text-center">Reset Password</h4>
					</div>
					<label class="pull-right " data-toggle="modal" data-target="#resetPassModal" style="display: none" id="trigger_Click">
						<a href="#" class="col"></a>
					</label>
					<br />
					<div class="modal-body">
						<form id="formreset" action="Login.aspx" method="post" onsubmit="return validateReset_Form()">
							<input type="hidden" style="display: none" id="Hidden1" name="mode" value="2"></input>

							<div class="form-group">
								<div class="col-md-12">

									<div class="col-md-12" id="ResetPossword_Mess"></div>
								</div>
								<div class="col-md-6">
									<label for="email" class="sr-only">Email:</label>

									<input type="password" class="form-control form_height" id="resetPassword" placeholder="Password" required=""></input>
									<span class="validation" id="resetPass">This field is required.</span>
								</div>
								<div class="col-md-6">
									<label for="email" class="sr-only">Confirm Email:</label>
									<input type="password" class="form-control form_height" id="ConfirmresetPassword" placeholder="Confirm Password" name="ResetPassword" required=""></input>
									<span class="validation" id="ConfirmresetPass">
										Password must be of
										length 6 or more.
									</span>
									<span class="validation" id="passNotMatch">Password does not match the confirm password.</span>
								</div>
							</div>

							<div class="form-group text-center mrgin-top">
								<button type="submit" class="btn btn-info sign mrgin-top">Reset</button>
							</div>
						</form>
					</div>

					<div class="modal-footer">
						<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
					</div>
				</div>
			</div>
		</div>
		<!-- footer end -->
		<div class="modal fade" id="TicketExpired" role="dialog">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal"></button>
						<h4 class="modal-title text-center">Reset Password</h4>
					</div>
					<label class="pull-right display_none" data-toggle="modal" data-target="#TicketExpired" id="TicketExpired_Click">
						<a href="#" class="col"></a>
					</label>
					<br />
					<div class="modal-body">
						<form id="form2">
							<div class="form-group">
								<div class="col-md-12 Text_color" id="Div2">
									Sorry, your ticket has expired. Please click the link in Password Reminder
									email within 15 minutes after receiving it.
								</div>
							</div>
						</form>
					</div>

					<div class="modal-footer">
						<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
					</div>
				</div>
			</div>
		</div>
		<div class="modal fade" id="resetSuccessful" role="dialog">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal"></button>
						<h4 class="modal-title text-center">Reset Password Confirmation</h4>
					</div>
					<label class="pull-right display_none" data-toggle="modal" data-target="#resetSuccessful" id="resetSuccessful_Click">
						<a href="#" class="col"></a>
					</label>
					<br />
					<div class="modal-body">
						<form id="form2">
							<div class="form-group">
								<div class="col-md-12 Text_color" id="resetpass_Message">

								</div>
							</div>
						</form>
					</div>

					<div class="modal-footer">
						<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
					</div>
				</div>
			</div>
		</div>

		<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
		<!--<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>-->
		<!--<script type="text/javascript" src="/Website/DesktopModules/LifeSpaceTemplates/Web/JavaScripts/Jquery.1.11.3/jquery.min.js"></script>-->
		<!-- Include all compiled plugins (below), or include individual files as needed -->
		<!--<script src="js/bootstrap.min.js"></script>-->
		<script type="text/javascript">
      $(document).ready(function () {
      $('.carousel').carousel({
      interval: 8000
      });

      $('.carousel').carousel('cycle');
      });
      function postSAMLResponse(responseData)
      {
      var form = document.createElement("form");
      var element1 = document.createElement("input");
      element1.setAttribute("type", "hidden");
      form.method = "POST";
      form.action = "saml20";

      element1.value = responseData;
      element1.name = "SAMLResponse";
      form.appendChild(element1);

      document.body.appendChild(form);

      form.submit();
      }
      function openPopUpSession(samlDomainName)
      {
      var __CHILD_WINDOW_HANDLE_2 = null;
      var myWidth = 1050, myHeight = 550;
      var left = (screen.width - myWidth) / 2;
      var top = (screen.height - myHeight) / 4;

      __CHILD_WINDOW_HANDLE_2 = window.open('https://www.coachsimple.net/saml20.aspx?SAMLDomain='+samlDomainName, '_blank', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=' + myWidth + ', height=' + myHeight + ', top=' + top + ', left=' + left);
      window.addEventListener('message', function (e) {
          if (event.origin.toLowerCase() !== "https://www.coachsimple.net")
           return;
          postSAMLResponse(e.data);
          
      }, false);
      }
    </script>
		<script type="text/javascript" src="{$TemplatePathURL}/Web/JavaScripts/imageMapResizer.min.js"></script>
		<script type="text/javascript">
			$(document).ready(function(){

			$('map').imageMapResize( );

			<!--/*var width = $(window).width();
			if (width <= 600) {
			setTimeout(function(){
			$("map[name=applink] area#a").attr('coords', $($("map[name=image-map] area")[0]).attr('coords'));
			$("map[name=applink] area#b").attr('coords', $($("map[name=image-map] area")[1]).attr('coords'));
			}, 2000);
			}*/-->
			});
		</script>
	</xsl:template>
</xsl:stylesheet>
