function centerWindow(url, name, w, h, scroll, menu, resizable)
{
	// if width or height specified as zero, then use parent's width and height

	if (w == 0)
		w = getWindowWidth  () - 20;
	if (h == 0)
		h = getWindowHeight () - 60;

	if (window.screen)
	{
		var chasm = screen.availWidth;
		var mount = screen.availHeight;
		
		winprops = 'width=' + w + ',height=' + h + ',left=' + ((chasm - w - 10) * .5) + ',top=' + ((mount - h - 30) * .5) + 
			',scrollbars=' + scroll + ',menubar=' + menu + ',resizable=' + resizable;
		oHTMLWin = window.open(url, name, winprops);
		oHTMLWin.window.focus();
	}
}


function centerWindowWToolbar(url, name, w, h, scroll, menu, resizable)
{
	// if width or height specified as zero, then use parent's width and height

	if (w == 0)
		w = getWindowWidth  ();
	if (h == 0)
		h = getWindowHeight ();

	if (window.screen)
	{
		var chasm = screen.availWidth;
		var mount = screen.availHeight;
		
		winprops = 'width=' + w + ',height=' + h + ',left=' + ((chasm - w - 10) * .5) + ',top=' + ((mount - h - 30) * .5) + 
			',scrollbars=' + scroll + ',menubar=' + menu + ',resizable=' + resizable + 'toolbar=yes,status=no,location=yes';
		oHTMLWin = window.open(url, name, winprops);
		oHTMLWin.window.focus();
	}
}


function selectOptionLink(oProdLineSelect)
{
	newLocation = oProdLineSelect.options[oProdLineSelect.selectedIndex].value;
	if (newLocation.indexOf("olaydefinity") > 0)  {
		callOlayWindow(newLocation);
	}
	else
	{
		if  ( newLocation.indexOf("http")==0 ) {
			selRetailer = newLocation; 
			newUrl = '/ca_en/popup/leavingsite.jsp?retailerURL=' + selRetailer;
			callRetailerWindow(newUrl);
		}
		else
			window.location = newLocation;
	}
}

function changeCssClass (someid, clsname)
{
	obj = document.getElementById(someid);
	if (obj)
	{
		obj.className = clsname;
	}
}

function clearIt(formName)
{
	eval("document."+formName).srch_query.value = "";
}

function submitForm(formName) 
{
	eval("document."+formName).submit();
}

function callRetailerWindow(page)
{
	//centerWindow(url, "popupWndName", width, height, scroll, menu, resizeable);
	//var url="/popup/onlineretailer.jsp";
	centerWindow(page, "onlineretailer", 470, 400, "no", "no", "no");
}

function callOlayWindow(page)
{
	//centerWindow(url, "popupWndName", width, height, scroll, menu, resizeable);
	//var url="/popup/onlineretailer.jsp";
	centerWindowWToolbar(page, "onlineretailer", 1170, 600, "yes", "yes", "yes");

}

function setDivDisplay(divid, disp)
{
	d = document.getElementById(divid);
	if (d && d.style)
	{
		d.style.display = disp;
	}
}

function submitPidList(formName, inputPageNum)
{
	inPidList = 'pidlist' + inputPageNum;
	objInPidList = document.getElementById(inPidList);

	objPageNum = document.getElementById("pagenum");
	objPidList = document.getElementById("pidlist");

	if (objPageNum && objPidList)
	{
		objPidList.value = objInPidList.value ;
		objPageNum.value = inputPageNum ;
	}

	eval("document."+formName).submit();
}

function chInputValue(formName,inputName,inputValue)
{
	obj = document.getElementById(inputName);
	if (obj)
	{
		obj.value = inputValue;
	}
	eval("document."+formName).submit();
}

function getWindowWidth ()
{
  // Returns width of current browser window. If browser is really old, then defaults 630. 
  var width = 630;

  if (parseInt(navigator.appVersion) > 3)
    if (navigator.appName=="Netscape")
      width = window.innerWidth;
    else if (navigator.appName.indexOf("Microsoft") != -1)
      width = document.body.offsetWidth;
  return (width);
}

function getWindowHeight ()
{
  // Returns height of current browser window. If browser is really old, then defaults 450. 
  var height = 450;

  if (parseInt(navigator.appVersion) > 3)
    if (navigator.appName=="Netscape")
      height = window.innerHeight;
    else if (navigator.appName.indexOf("Microsoft") != -1)
      height = document.body.offsetHeight;
  return (height);
}


