
    /*
    
    This file controls the switching between http: and https: on the Online@Dalearning site
    
    It checks the current protocol and URL for each request, and will switch TO https
    if the current protocol is http and the url meets one of the specified conditions
    
    It will switch back to http if the current prodocol is https and the url does not
    contain one of the specified conditions.
    
    This script needs to be maintained if new pages are added to the site which require 
    a secure connection. Make sure that if you add a rule causing a switch to https that
    you also add a corresponding rule that will force the switch back to http when the 
    user navigates away from that page.
         
  
  */  
 
  
  	if(location.href.toLowerCase().indexOf('dacp.dalearning-online.org.uk') > -1)  
         location.href = location.href.replace('dacp.dalearning-online.org.uk','online.dacmt-acquisition.org.uk');
         
    if(location.protocol.toLowerCase() =='http:')     
     location.href = location.href.replace('http:','https:');    
         
  /*  
  
  
    if(location.protocol.toLowerCase() =='http:' && 
        (location.href.toLowerCase().indexOf('register') > -1 || 
	       location.href.toLowerCase().indexOf('admin') > -1 || 
	       location.href.toLowerCase().indexOf('host') > -1 || 
	       location.href.toLowerCase().indexOf('login') > -1 || 
       	 location.href.toLowerCase().indexOf('registration') > -1 || 
       	 location.href.toLowerCase().indexOf('changeusername') > -1 ||
       	 location.href.toLowerCase().indexOf('changepassword') > -1 ||
       	 location.href.toLowerCase().indexOf('tabid/200') > -1 || 
       	 location.href.toLowerCase().indexOf('/cipspilot/') > -1 || 
       	 location.href.toLowerCase()== 'http://online.dacmt-acquisition.org.uk/home/tabid/36/default.aspx' || 
       	 location.href.toLowerCase()== 'http://online.dacmt-acquisition.org.uk/default.aspx' || 
       	 location.href.toLowerCase()== 'http://online.dacmt-acquisition.org.uk/'))  
         location.href = location.href.replace('http:','https:');

    if(location.protocol.toLowerCase() =='https:' && 
    		 location.href.toLowerCase().indexOf('register') == -1 &&
    		 location.href.toLowerCase().indexOf('admin') == -1 && 
    		 location.href.toLowerCase().indexOf('host') == -1 && 
         location.href.toLowerCase().indexOf('login') == -1 && 
         location.href.toLowerCase().indexOf('registration') == -1 && 
         location.href.toLowerCase().indexOf('changeusername') == -1 &&
         location.href.toLowerCase().indexOf('changepassword') == -1 &&
         location.href.toLowerCase().indexOf('tabid/200') == -1 && 
         location.href.toLowerCase().indexOf('/cipspilot/') == -1 && 
         location.href.toLowerCase()!= 'https://online.dacmt-acquisition.org.uk/home/tabid/36/default.aspx' &&  
         location.href.toLowerCase()!= 'https://online.dacmt-acquisition.org.uk/default.aspx' && 
         location.href.toLowerCase()!= 'https://online.dacmt-acquisition.org.uk/' 
         )
         location.href = location.href.replace('https:','http:');
         
  */
