<!--

var Cookie = {
pref:'',last:null,
cnfg:function(a1) {
    var Bool={secure:1}, text='';
    if (''+a1!==a1) for (var k in a1) if (a1[k]) text += '; '+(
        Bool[k] ? k : k+'='+(
            k!='expires'||isNaN(a1[k]) ? a1[k] : this.date(a1[k])
        )
    );
    return this.pref = text||a1||text;
},
make:function(a1,a2,a3) {
    document.cookie = this.last=escape(a1)+'='+escape(a2)+this.cnfg(a3);
    return this.read(a1) == a2;
},
date:function(a1) {
    var D = new Date();
    D.setTime(D.getTime()+(a1||0)*86400000);
    return D.toGMTString();
},
read:function(a1) {
    var F=' '+document.cookie+';', S=F.indexOf(' '+(a1=escape(a1)));
    return S==-1 ? null : unescape(
        F.substring(a1=S+a1.length+2,F.indexOf(';',a1))
    );
}
}

function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}

function secure(theElement){

	var theProtocol = location.protocol;
	var theHost = location.host;
	var secureServer = "";
	var theAction = theElement.action;
	var theHREF = theElement.href;
	var secureAction = "";
	var secureHREF = "";
    
	if (theHost == 'www.moviewatcher.com' || theHost == 'moviewatcher.com' || theHost == 'new.moviewatcher.com')
		secureServer = "https://"+theHost;
	else if (theHost == 'www.amctheatres.com' || theHost == 'amctheatres.com')
		secureServer = "https://"+theHost;
	else if (theHost == 'stage.moviewatcher.com')
		secureServer = "https://stage.moviewatcher.com";
	else if (theHost == 'stage.amctheatres.com')
		secureServer = "https://stage.amctheatres.com";
    
	if (theProtocol == 'http:'){ 
	
		// switch up form actions
		if (theAction != null) {
			if (theAction.match(/http:/))
				secureAction = theAction.replace(/http:/,"https:");
			else if (theAction.match(/https:/))
				return;
			else
				secureAction = secureServer + theAction;
				
		// switch up links
		} else if (theHREF != null) {
			if (theHREF.match(/http:/))
				secureHREF = theHREF.replace(/http:/,"https:");
			else if (theHREF.match(/https:/))
				return;
			else
				secureHREF = secureServer + theHREF;
		}
        
		// apply the altered attributes
		if (theHost == 'www.moviewatcher.com' || theHost == 'moviewatcher.com' || theHost == 'stage.moviewatcher.com' || theHost == 'www.amctheatres.com' || theHost == 'amctheatres.com' || theHost == 'stage.amctheatres.com' || theHost == 'new.moviewatcher.com') {
			if (theElement.action != null)
				theElement.action = secureAction;
			if (theElement.href != null)
				theElement.href = secureHREF;
			return true;
		}
		
	}
}


function unsecure(theElement){

	var theProtocol = location.protocol;
	var theHost = location.host;
	var unsecureServer = "";
	var theAction = theElement.action;
	var theHREF = theElement.href;
	var unsecureAction = "";
	var unsecureHREF = "";
    
	if (theHost == 'www.moviewatcher.com' || theHost == 'moviewatcher.com' || theHost == 'new.moviewatcher.com')
		unsecureServer = "http://"+theHost;
	else if (theHost == 'www.amctheatres.com' || theHost == 'amctheatres.com')
		unsecureServer = "http://"+theHost;
	else if (theHost == 'stage.moviewatcher.com')
		unsecureServer = "http://stage.moviewatcher.com";
	else if (theHost == 'stage.amctheatres.com')
		unsecureServer = "http://stage.amctheatres.com";
    
	if (theProtocol == 'https:'){ 
	
		// switch up form actions
		if (theAction != null) {
			if (theAction.match(/https:/))
				unsecureAction = theAction.replace(/https:/,"http:");
			else if (theAction.match(/http:/))
				return;
			else
				unsecureAction = unsecureServer + theAction;
				
		// switch up links
		} else if (theHREF != null) {
			if (theHREF.match(/https:/))
				unsecureHREF = theHREF.replace(/https:/,"http:");
			else if (theHREF.match(/http:/))
				return;
			else
				unsecureHREF = unsecureServer + theHREF;
		}
        
		// apply the altered attributes
		if (theHost == 'www.moviewatcher.com' || theHost == 'moviewatcher.com' || theHost == 'stage.moviewatcher.com' || theHost == 'www.amctheatres.com' || theHost == 'amctheatres.com' || theHost == 'stage.amctheatres.com' || theHost == 'new.moviewatcher.com') {
			if (theElement.action != null)
				theElement.action = unsecureAction;
			if (theElement.href != null)
				theElement.href = unsecureHREF;
			return true;
		}
		
	}
}

function unsecureThisPage() {

    var newLocationHref = location.href;

    if (location.protocol == 'https:') {
        newLocationHref = newLocationHref.replace("https:", "http:");
        location.replace(newLocationHref);
    }
	 
    return true;
	 
}


//-->
