function checkSSL(ssl,newLocation)  {

var currentLocation = window.location.href;
var protocol = window.location.protocol;
var host = window.location.host;

//var ssl = false;

//<rde-dm:attribute mode="condition" source="content" attribute="ssl" op="eq" value="true">
//ssl = true;
//</rde-dm:attribute>

var redirect = false;
var appServerHost = ((host == "172.18.201.164:8080")||(host == "172.18.201.165:8080"));
//var newLocation = host+"/#RDE-REQUEST:rdePrefix/#/xchg/#RDE-REQUEST:rdeSessionID/#/#RDE-REQUEST:rdeProjectID/#/#RDE-REQUEST:rdeXslID/#/#RDE-REQUEST:rdeCurrentXmlId/#";

// Remove the port number from the newLocation value passed from a MAC.
newLocation = newLocation.replace(/:{1}(80|443){1}\/{1}/,'/');
 
if(protocol == "http:" && ssl)  {
    redirect = true;
    newLocation = "https://"+newLocation;
}else if(protocol == "https:" && !ssl)  {
    redirect = true;
    newLocation = "http://"+newLocation;
}

if(redirect && !appServerHost)  {
    var ver = parseInt(navigator.appVersion, 10);
    if ( ((navigator.appName == "Netscape") && (ver >= 3)) ||
         ((navigator.appName == "Microsoft Internet Explorer") && (ver >= 4)) )  {
      location.replace(newLocation);
    }else  {
      location = newLocation;
    };
}

}
