dd=document;
NS=(dd.layers)?1:0;IE=(dd.all)?1:0;
DOM=(dd.getElementById)?1:0

function showLayer(L){ 
if(NS)dd.layers[L].display='show'; 
else if (IE)obg=dd.all[L]; 
else obg=dd.getElementById(L); 
if(!NS)obg.style.display='block' 
}

function hideLayer(L){ 
if(NS)dd.layers[L].display='hide'; 
else if (IE)obg=dd.all[L]; 
else obg=dd.getElementById(L); 
if(!NS)obg.style.display='none' 
}

function div_desc()
{
showLayer('desc')
hideLayer('highlights')
hideLayer('directions')
hideLayer('ingredients')
}

function div_highlights()
{
showLayer('highlights')
hideLayer('desc')
hideLayer('directions')
hideLayer('ingredients')
}

function div_directions()
{
showLayer('directions')
hideLayer('desc')
hideLayer('highlights')
hideLayer('ingredients')
}

function div_ingredients()
{
showLayer('ingredients')
hideLayer('desc')
hideLayer('highlights')
hideLayer('directions')
}

function div_tab1()
{
showLayer('tab1')
hideLayer('tab2')
hideLayer('tab3')
hideLayer('tab4')
}

function div_tab2()
{
showLayer('tab2')
hideLayer('tab1')
hideLayer('tab3')
hideLayer('tab4')
}

function div_tab3()
{
showLayer('tab3')
hideLayer('tab1')
hideLayer('tab2')
hideLayer('tab4')
}

function div_tab4()
{
showLayer('tab4')
hideLayer('tab1')
hideLayer('tab2')
hideLayer('tab3')
}

function div_prodsub1()
{
showLayer('prodsub1')
hideLayer('prodsub2')
hideLayer('prodsub3')
hideLayer('prodsub4')
}

function div_prodsub2()
{
showLayer('prodsub2')
hideLayer('prodsub1')
hideLayer('prodsub3')
hideLayer('prodsub4')
}

function div_prodsub3()
{
showLayer('prodsub3')
hideLayer('prodsub1')
hideLayer('prodsub2')
hideLayer('prodsub4')
}

function div_prodsub4()
{
showLayer('prodsub4')
hideLayer('prodsub1')
hideLayer('prodsub2')
hideLayer('prodsub3')
}

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();
}

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'.")
	}
}

/* new functions VGLB-SRN-0135 */
function showSubNav(_opt){
	closeSubNav();
	var _optLength = document.getElementsByName(_opt);
	for (i=0; i<_optLength.length; i++){
		if(_optLength[i]){
			_optLength[i].style.display = "block";
		}
	}
}

var _subNavArray = new Array('sub1','sub2','sub3','sub4');
function closeSubNav(){
	for(i=0; i<_subNavArray.length; i++){
		var _optLength = document.getElementsByName(_subNavArray[i]);
		for (j=0; j<_optLength.length; j++){
			if(_optLength[j]){
				_optLength[j].style.display = "none";
			}
			else{break;}
		}
	}
}

function showProdTab(_whichTab){
	var _url = document.location.href;

	closeProdTabs();	
	if(_url.indexOf("prd_dm_spf_lotion.inc")!= -1){
		document.getElementById('tabs').src = "/images/lubriderm/product_tabspf"+_whichTab+".gif";
	}
	else{
		document.getElementById('tabs').src = "/images/lubriderm/product_tabs"+_whichTab+".gif";
	}
	
	_whichTab = "prodTab"+_whichTab;
	if(document.getElementById(_whichTab)){
		document.getElementById(_whichTab).style.display = "block";
	}	
}

function closeProdTabs(){
	document.getElementById('prodTab').style.display = "none";
	document.getElementById('prodTab1').style.display = "none";
	document.getElementById('prodTab2').style.display = "none";
	document.getElementById('prodTab3').style.display = "none";
}

var _prevImg = "";
function chgHover(_img,chg){		
	var nImg = _img.src;
	if (chg == "y"){
		_prevImg = _img.src;
		var extIndex = nImg.indexOf(".gif");
		var nImg1 = nImg.substring(0,extIndex);
		_img.src = nImg1+"_hover.gif";
	} else if (chg == "ss"){
		_prevImg = _img.src;
		var extIndex = nImg.indexOf(".gif");
		var nImg1 = nImg.substring(0,extIndex);
		_img.src = nImg1+"1_hover.gif";
	}
	else{
		_img.src = _prevImg;
		_prevImg = "";
	}
}

/* new functions VGLB-SRN-0135 */

// used in Homepage for the coupon popup div
function clsCouponPop(){
	if(document.getElementById('popBG')){
		document.getElementById('popBG').style.visibility = "hidden";
	}
	if(document.getElementById('couponPop')){
		document.getElementById('couponPop').style.visibility = "hidden";
	}
}

function setCouponPopPos(){
	var _x = (parseInt(screen.availWidth)-286)/2;
	document.getElementById('popBG').style.left = _x+"px";
	document.getElementById('couponPop').style.left = _x+"px";	
}