function positionEspanolHome() {
	document.getElementById('espanol').style.left = parseInt((document.documentElement.scrollWidth - 807)/2) + 706 + "px";
	document.getElementById('espanol').style.visibility = 'visible';
}

function positionEspanol() {
	document.getElementById('espanol').style.left = parseInt((document.documentElement.scrollWidth - 807)/2) + 706 + "px";
	document.getElementById('espanol').style.visibility = 'visible';
}

var baseFooterFontSize = 10;
var baseCopyFontSize = 11;
var baseCopyFontSize12 = 12;

function adjustFontSize(whichDirection) {
	//Standard 'gray fontsize11' body copy
	arr = document.getElementById("container").getElementsByTagName("div");
	copyblocks = new Array();
	
	for (var i = 0; i < arr.length; i++) {
		if (arr[i].className == "copy") {
			copyblocks.push(arr[i]);
		}
	}

	//Blue subheaders 'blue fontsize11 bold'
	arr = document.getElementById("container").getElementsByTagName("span");

	for (var i = 0; i < arr.length; i++) {
		if (arr[i].className == "blue fontsize11 bold") {
			copyblocks.push(arr[i]);
		}
	}

	//Sitemap sections
	arr = document.getElementById("container").getElementsByTagName("a");

	for (var i = 0; i < arr.length; i++) {
		if (arr[i].className == "sitemapsubsection") {
			copyblocks.push(arr[i]);
		}
	}
		
	//Blue subheaders 'blue fontsize12 bold'
	arr = document.getElementById("container").getElementsByTagName("span");
	copyblocks12 = new Array();
	
	for (var i = 0; i < arr.length; i++) {
		if (arr[i].className == "blue fontsize12 bold") {
			copyblocks12.push(arr[i]);
		}
	}

	//Standard 'gray fontsize12' body copy
	arr = document.getElementById("container").getElementsByTagName("td");
	
	for (var i = 0; i < arr.length; i++) {
		if (arr[i].className == "gray fontsize12") {
			copyblocks12.push(arr[i]);
		}
	}

	//Sitemap sections
	arr = document.getElementById("container").getElementsByTagName("a");
	
	for (var i = 0; i < arr.length; i++) {
		if (arr[i].className == "sitemapsection") {
			copyblocks12.push(arr[i]);
		}
	}
		
	if (whichDirection == "+") {
		if ((parseInt(baseCopyFontSize)+1) == 15) {
			return;
		} else {
			baseCopyFontSize = (parseInt(baseCopyFontSize)+1) +'px';
			baseCopyFontSize12 = (parseInt(baseCopyFontSize12)+1) +'px';
			baseFooterFontSize = (parseInt(baseFooterFontSize)+1) +'px';
		}
	} else {
		if (parseInt(baseCopyFontSize) >= 10) {
			baseCopyFontSize = (parseInt(baseCopyFontSize)-1) +'px';
			baseCopyFontSize12 = (parseInt(baseCopyFontSize12)-1) +'px';
			baseFooterFontSize = (parseInt(baseFooterFontSize)-1) +'px';
		} else {
			return;
		}
	}
	
	for (var i = 0; i < copyblocks.length; i++) {
		copyblocks[i].style.fontSize = baseCopyFontSize;
	}
	
	for (var i = 0; i < copyblocks12.length; i++) {
		copyblocks12[i].style.fontSize = baseCopyFontSize12;
	}

	document.getElementById("footer").style.fontSize = baseFooterFontSize;
	setLeftRightShadowHeight();
}

function newWindow(url,name,w,h,t,m,s,r,st,l,d,c) {
	var windowOptions = "width=" + w + "," +
	"height=" + h + "," +
	"toolbar=" + t + "," +
	"menubar=" + m +"," +
	"scrollbars=" + s + "," +
	"resizable=" + r + "," +
	"status=" + st + "," +
	"location=" + l + "," +
	"directories=" + d + "," +
	"copyhistory=" + c;
	window.open(url, name, windowOptions);
}

function printBathroomResults(city, state, zipCode) {
	newWindow('/generic.jhtml?id=imodium/include/3_5_1.inc&city=' + city + '&state=' + state + '&zipCode=' + zipCode,'bathroomresults',659,625,0,0,1,0,0,0,0,0);
}

function printPage() {
    var agt = navigator.userAgent.toLowerCase(); 
    var is_win = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) );
    var is_mac    = (agt.indexOf("mac")!=-1);
    var macos  = (is_mac && ((agt.indexOf("mac os") != -1) || (agt.indexOf("macos") != -1) || this.ie));
    var macosx = (macos && ((agt.indexOf("os x") != -1) || (agt.indexOf("osx") != -1)));

	if(macosx || is_win ){
		window.print();
	} else {
		alert("To print this page, press 'command+P'.")
	}
}

function rollover(which, state) {
        if (document.images) {
			ext = which.src.substring(which.src.lastIndexOf("."));
			if (state == "ro") {
				if (which.src.lastIndexOf('_ro') >= 1) {
					which.src = which.src.substring(0,which.src.lastIndexOf('.') - 3) + "_ro" + ext;
				} else {
					which.src = which.src.substring(0,which.src.lastIndexOf('.')) + "_ro" + ext;
				}
			} else {
				which.src = which.src.substring(0,which.src.lastIndexOf('_')) + ext;
			}
        }
}
////////////////////////////
/// EXIT POPUP FUNCTION
////////////////////////////

function newWin(WinURL, WinNAME, WinWIDTH, WinHEIGHT, WinRESIZE, WinSCROLL, WinTOOLBAR)
{	
	/*	variables passed by the link calling the function	*/
	var URL = WinURL;
	var WINDOW_NAME = WinNAME;
	var POPUP_WIDTH = WinWIDTH;
	var POPUP_HEIGHT = WinHEIGHT;
	var POPUP_RESIZE = WinRESIZE;
	var POPUP_SCROLL = WinSCROLL;
	var POPUP_TOOLBAR = WinTOOLBAR;

	/*	window properties that determine the window attributes depending on what values are passed by the link calling the function	*/
	var window_toolbar = POPUP_TOOLBAR;
	var window_resize = POPUP_RESIZE;
	var window_scroll = POPUP_SCROLL;
	var window_width = POPUP_WIDTH;
	var window_height = POPUP_HEIGHT;
	var screen_balance_w = ((screen.width)-(window_width))/2;
	var screen_balance_h = ((screen.height)-(window_height))/2;
	var set_top = screen_balance_h;
	var set_left = screen_balance_w;	

	win = window.open(URL,WINDOW_NAME,'resizable=' + window_resize + ',toolbar=' + window_toolbar + ',scrollbars=' + window_scroll + ',width=' + window_width + ',height=' + window_height + ',top=' +  set_top + ',left=' + set_left + '');
	win.focus();
}


// functions used in "our products" section pages
var _pageID = "";
function showInfoDiv(_link){
	closeInfoDiv();
	if (_link != "benefits"){
		
			if(document.getElementById('div_benefits')){
				document.getElementById('div_benefits').style.display = "none";
			}
			document.getElementById('prodDesc').style.display = "block";
	}
	if (_link != "dispose"){
		if(document.getElementById('div_dispose')){
			document.getElementById('div_dispose').style.display = "none";
		}
			document.getElementById('prodDesc').style.display = "block";
	}
	
	if(_link == "benefits") {
			if(document.getElementById('div_benefits')){
			document.getElementById('div_benefits').style.display = "block";
			}
			document.getElementById('prodDesc').style.display = "none";
		}
	if(_link == "dispose") {
		if(document.getElementById('div_dispose')){
			document.getElementById('div_dispose').style.display = "block";
		}
			document.getElementById('prodDesc').style.display = "none";
	}
	
	// page tracker function fired basing on the tab	
	if(_link == "overview"){
		pageTracker._trackPageview("/OurProducts/"+_pageID+"/Overview");
	}
	if(_link == "availability"){
		pageTracker._trackPageview("/OurProducts/"+_pageID+"/AvailableAs");
	}
	if(_link == "directions"){
		pageTracker._trackPageview("/OurProducts/"+_pageID+"/Directions");
	}
	if(_link == "ingredients"){
		pageTracker._trackPageview("/OurProducts/"+_pageID+"/Ingredients");
	}
	if(_link == "warnings"){
		pageTracker._trackPageview("/OurProducts/"+_pageID+"/Warnings");
	}
	if(_link == "storage"){
		pageTracker._trackPageview("/OurProducts/"+_pageID+"/Storage");
	}
	if(_link == "benefits"){
		pageTracker._trackPageview("/OurProducts/"+_pageID+"/MSRBenefits");
	}
	if(_link == "dispose"){
		pageTracker._trackPageview("/OurProducts/"+_pageID+"/dispose");
	}
	// page tracker function
	
	document.getElementById(_link).className = "item1on";
	document.getElementById('div_'+_link).style.display = "block";
}

function closeInfoDiv(){
	var _alink = document.getElementsByTagName('a');
	for(i=0; i<_alink.length; i++){
		if(_alink[i].className == "item1on"){
			_alink[i].className = "item1";
		}
	}
	
	if (document.getElementById('div_overview')){
		document.getElementById('div_overview').style.display = "none";
	}
	if (document.getElementById('div_availability')){
		document.getElementById('div_availability').style.display = "none";
	}
	if (document.getElementById('div_directions')){
		document.getElementById('div_directions').style.display = "none";
	}
	if (document.getElementById('div_ingredients')){
		document.getElementById('div_ingredients').style.display = "none";
	}
	if (document.getElementById('div_availability')){
		document.getElementById('div_availability').style.display = "none";
	}
	if (document.getElementById('div_warnings')){
		document.getElementById('div_warnings').style.display = "none";
	}
	if (document.getElementById('div_storage')){
		document.getElementById('div_storage').style.display = "none";
	}
	if (document.getElementById('div_benefits')){
		document.getElementById('div_benefits').style.display = "none";
	}
	if (document.getElementById('div_dispose')){
		document.getElementById('div_dispose').style.display = "none";
	}
}

// new functions - VCIM-CCN-0021

var prevImgSrc = "";
function chgSrc(elmID, chg){ // hover effect for the Homepage Tout images
	if(chg == "y"){
		var elmSrc = document.getElementById(elmID).src;
		prevImgSrc = elmSrc;
		var _ext = elmSrc.length -4;
		var hoverImgSrc = elmSrc.substring(0, _ext)+"_hover.jpg";
		document.getElementById(elmID).src = hoverImgSrc;
	}
	else{
		document.getElementById(elmID).src = prevImgSrc;
	}
}

// sets the height of left and right shadow strips of the content panel - page.jhtml
function setLeftRightShadowHeight(){
		document.getElementById('ltShadow').style.height = "";
		document.getElementById('rtShadow').style.height = "";
		
		var _getTop = document.getElementById('topShadow').getBoundingClientRect();
		var _getBot = document.getElementById('botShadow').getBoundingClientRect();
	
		var _setHt = (parseInt(_getBot.bottom) - parseInt(_getTop.bottom));

		document.getElementById('ltShadow').style.height = _setHt+"px";
		document.getElementById('rtShadow').style.height = _setHt+"px";	
}