/***********************************************
*   Ken Nelson special features!!!
***********************************************/

//global var

var ns = navigator.appName == "Netscape"; 							
// Browser check

function switchLang () {
	engDelimiter = '/eng/';
	freDelimiter = '/fre/';
	newURL = switchLangSearch(engDelimiter, freDelimiter);
	if (newURL != 'null') {
		self.location = newURL;
		return;
	} 
	engDelimiter = "lang=en";
	freDelimeter = "lang=fr";
	newURL = switchLangSearch(engDelimiter, freDelimeter);
	if (newURL != 'null') {
		self.location = newURL;
		return;
	}
	engDelimiter = "_code=en";
	freDelimeter = "_code=fr";
	newURL = switchLangSearch(engDelimiter, freDelimeter);
	if (newURL != 'null') {
		self.location = newURL;
		return;
	}
}



function switchLangSearch (engDelim, freDelim) {
	docURL = document.URL;
	newURL = 'null';
	engPosition = 0;
	frePosition = 0;
	charStart = 0;
	charEnd = docURL.length + 1;
	engDelimiter = engDelim;
	freDelimiter = freDelim;
	do {
		var test = docURL.substr(charStart, engDelimiter.length);
		if (test == engDelimiter) { engPosition = charStart;}
		charStart++;
	}
	while (charStart < charEnd - engDelimiter.length);
	if (engPosition > 0) {
		newURL = docURL.substr(0,engPosition) + freDelimiter + docURL.substr((engPosition + engDelimiter.length),docURL.length);
	} else {
		charStart = 0;
		do {
			var test = docURL.substr(charStart, freDelimiter.length)
			if (test == freDelimiter) { frePosition = charStart;}
			charStart++;
		}
		while (charStart < charEnd - freDelimiter.length);
		if (frePosition > 0) {
			newURL = docURL.substr(0,frePosition) + engDelimiter + docURL.substr((frePosition + freDelimiter.length),docURL.length);
		}
	}
	return newURL;
}


// Pop-up 
	
	var ie5 = (document.all && document.getElementbyID) ? false : true;
	var isMac = (navigator.appVersion.indexOf("Mac") == -1) ? false : true;
	var win, win2;	

	function openWin(url, popWidth, popHeight, popScroll, popStatus) {
		var winName =  "popup";
		// popStatus is a new parameter; it is optional so that old calls will not cause an error
		var statusBar = popScroll; 
		
		if (popStatus != null) { 
			statusBar  = popStatus;
			// 'fix' for Mac IE's problem when including a status bar in the pop up window
			// - the browser chops off the bottom 18 pixels of the window to accomodate for the
			//   the status bar, and so we add 18 pixels to the height			
			if (!ie5 && !ns && isMac) { popHeight += 18; }
		}

		if(win) {
			if(!win.closed) {
				if(win.name == "popup") winName = "popup2";	
			  	win.close(); 
			}			
			win = null;	
		}
		
		win=window.open(url, winName, 'width=' + popWidth + ',height=' + popHeight + ',screenX=300,screenY=180,left=300,top=180,scrollbars=' + popScroll + ',resize=no,status=' + statusBar + '');
		
		if (win.opener == null) win.opener = self;
		win.focus();
	}

	function openWinWithResize(url, popWidth, popHeight, popScroll, popStatus, popResize) {
		var winName =  "popup";
		// popStatus is a new parameter; it is optional so that old calls will not cause an error
		var statusBar = popScroll; 
		
		if (popStatus != null) { 
			statusBar  = popStatus;
			// 'fix' for Mac IE's problem when including a status bar in the pop up window
			// - the browser chops off the bottom 18 pixels of the window to accomodate for the
			//   the status bar, and so we add 18 pixels to the height			
			if (!ie5 && !ns && isMac) { popHeight += 18; }
		}

		if(win) {
			if(!win.closed) {
				if(win.name == "popup") winName = "popup2";	
			  	win.close(); 
			}			
			win = null;	
		}
		win=window.open(url, winName, 'width=' + popWidth + ',height=' + popHeight + ',screenX=300,screenY=180,left=300,top=180,scrollbars=' + popScroll + ',resizable=' + popResize + ',status=' + statusBar);
		
		if (win.opener == null) win.opener = self;
		win.focus();
	}

// end of pop-up

function ParseQueryString(searchStr) {
	var tempStr = window.location.search;
    var startOfString = tempStr.indexOf(searchStr);
    var result = "";
    if (startOfString != -1) {
    	var endOfString = tempStr.indexOf("&",startOfString+searchStr.length+1);
       	if (endOfString != -1) {               
           	result = tempStr.substring(startOfString+searchStr.length+1, endOfString);
    	}
    	else {
    		result = tempStr.substring(startOfString+searchStr.length+1, tempStr.length);
    	}
    }
	return result;
}

// last modified date functions

function en_last_modified() {
    document.write("&copy; Johnson &amp; Johnson Inc. 2001-" + new Date().getFullYear() + "<br />This site is published by McNeil Consumer Healthcare, division of Johnson & Johnson Inc. which is solely responsible for its content.<br /> It is intended for visitors from Canada only.<br /> Last updated: April 28<sup>th</sup>, 2010."); 
}


function fr_last_modified() {
    document.write("&copy; Johnson & Johnson Inc. 2001-" + new Date().getFullYear() + "<br />Ce site est publié par la compagnie de Soins-santé grand public McNeil, division de Johnson & Johnson Inc., seule <br/>responsable de son contenu. Ce site s'adresse aux visiteurs du Canada seulement. <br/>Modifié le 28 avril 2010."); 
}



