// list of http/https redirects

var protocol = document.location.protocol.toLowerCase();
var host = document.location.hostname.toLowerCase();
var path = document.location.pathname.toLowerCase();
var queryString = document.location.search.toLowerCase();

var https = [];
https.push('/eclub/');
https.push('/redroyalty/');
https.push('/redroyalty/default.aspx');
https.push('/redroyalty/joinstep2.aspx');
https.push('/redroyalty/joinstep3.aspx');
https.push('/redroyalty/joinstep4.aspx');
https.push('/redroyalty/joinconfirm.aspx');
https.push('/redroyalty/login.aspx');
https.push('/eclub/register.aspx');
https.push('/eclub/thankyou.aspx');
https.push('/redroyalty/card/');
https.push('/redroyalty/profile.aspx');

var requireHTTPS = false;
for(var i=0; i<https.length; i++){
	if(https[i] == path){
		requireHTTPS = true;
	}
}

if(requireHTTPS && protocol != "https:"){
	document.location.href = "https://"+host+path+queryString;
}
if(!requireHTTPS && protocol != "http:"){
	document.location.href = "http://"+host+path+queryString;
}
