// JavaScript Document

//this function writes the breadcrumbs
function breadCrumbs(delimiterStr) {
loc2 = window.location.toString();
loc = loc2.toLowerCase();
subs = loc.substr(7).split("/"); // Makes the assumption that the first 7 characters are "HTTP://"
    //document.write("<a href=\"" + getLoc(subs.length - 1) + "\">Home</a> " + delimiterStr + " ");
    a = (loc.indexOf('index.') == -1) ? 1 : 2;
    if (subs[subs.length-1].length == 0) {
    a++;
}
for (i = 1; i < (subs.length - a); i++) {
    subs[i] = makeCaps(unescape(subs[i]));
    // new code here to rename service to correct name irrespective of directory structure
    b = (subs[i].toLowerCase() == 'healthpromotion') ? 'Health Promotion Service' : subs[i];
    document.write("<a href=\"" + getLoc(subs.length - i - 2) + ".\">" + b + "</a> " + delimiterStr + " ");
}
// new code here to strip service name prefix (27 chars) from title
document.write(Right(document.title,document.title.length-27));
}
function makeCaps(a) {
    g = a.split("_");
    for (l = 0; l < g.length; l++) {
    g[l] = g[l].toUpperCase().slice(0, 1) + g[l].slice(1);
}
return g.join(" ");
}
function getLoc(c) {
    var d = "";
    if (c > 0) {
    for (k = 0; k < c; k++) {
    d = d + "../";
    }
}
return d;
}
function Right(str, n){
    if (n <= 0)
       return "";
    else if (n > String(str).length)
       return str;
    else {
       var iLen = String(str).length;
       return String(str).substring(iLen, iLen - n);
    }
}
//this funtion allows a web page open in a new window
function newWindowMedia(url) {
	link = window.open(url,"Link","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=775,height=500,left=150,top=50");
}