
/*****************************************************
 Opens a PopUp Window
 parameters: 
    mylink: page url
    width: optional popup width
    height: optional popup height
    windowname: optional popup window name
    
*****************************************************/
function popup(mylink, width, height, windowname)
{
    if (! window.focus)return true;
    if(windowname == "") windowname = 'popupwindow';
    if(width == "") width = '100';
    if(height == "") height = '100';
    var href;
    if (typeof(mylink) == 'string')
        href=mylink;
    else
        href=mylink.href;
    window.open(href, windowname, 'width='+ width +',height='+ height +',scrollbars=no');
    return false;
}
/*****************************************************/
function popupscroll(mylink, width, height, windowname)
{
    if (! window.focus)return true;
    if(windowname == "") windowname = 'popupwindow';
    if(width == "") width = '100';
    if(height == "") height = '100';
    var href;
    if (typeof(mylink) == 'string')
        href=mylink;
    else
        href=mylink.href;
    window.open(href, windowname, 'width='+ width +',height='+ height +',scrollbars=yes');
    return false;
}
/*****************************************************/
function requiredField( src, args ) 
{
    alert(src.controltovalidate);
    if(args.Value == "" || args.Value.lenght == 0)
    {
        args.IsValid = false;
    }
    else
    {
       args.IsValid = true;
    }
}
/*******************************************************/
function showsubm(varx){
	hide();
	document.getElementById("submenu").style.display = "block";
	document.getElementById(varx).style.display = "block";
	if(varx == "submenu-heres-the-proof"){document.getElementById("menu-heres-the-proof").style.backgroundImage = 'url(images/bt-menu-heres-the-proof_on.jpg)';}
	if(varx == "submenu-how-it-works"){document.getElementById("menu-how-it-works").style.backgroundImage = 'url(images/bt-menu-how-it-works_on.jpg)';}
}
/*******************************************************/						
function hide(){
	document.getElementById("submenu-heres-the-proof").style.display = "none";
	document.getElementById("submenu-how-it-works").style.display = "none";
	document.getElementById("submenu").style.display = "none";
	document.getElementById("menu-how-it-works").style.backgroundImage = 'url(images/bt-menu-how-it-works.jpg)';
	document.getElementById("menu-heres-the-proof").style.backgroundImage = 'url(images/bt-menu-heres-the-proof.jpg)';
	
	var sPath2 = window.location.pathname;

	var sPage2 = sPath2.substring(sPath2.lastIndexOf('/') + 1);

	if(sPage2.indexOf('SpecialOffer') >= 0)
	{
		document.getElementById("menu-special-offer").style.backgroundImage = 'url(images/bt-menu-special-offer.jpg)';
	}
	if(sPage2 == 'TrueStories_list.aspx')
	{
		document.getElementById("menu-true-stories").style.backgroundImage = 'url(images/bt-menu-true-stories.jpg)';
	}
	
}
/*******************************************************/						
function hide2(){
	/*document.getElementById("submenu-heres-the-proof").style.display = "none";
	document.getElementById("submenu-how-it-works").style.display = "none";
	document.getElementById("submenu").style.display = "none";
	document.getElementById("menu-how-it-works").style.backgroundImage = 'url(images/bt-menu-how-it-works.jpg)';
	document.getElementById("menu-heres-the-proof").style.backgroundImage = 'url(images/bt-menu-heres-the-proof.jpg)';*/
	hide();
	var sPath = window.location.pathname;

	var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);

	if(sPage == 'product-faq.aspx' || sPage == 'product-info-details.aspx')
	{
		showsubm("submenu-how-it-works")
	}
	if(sPage == 'pore-size.aspx' || sPage == 'firmness.aspx' || sPage == 'age-spots.aspx' || sPage == 'wrinkles-fine-lines.aspx' || sPage == 'heres-the-proof.aspx')
	{
		showsubm("submenu-heres-the-proof")
	}
	if(sPage.indexOf('SpecialOffer') >= 0)
	{
		document.getElementById("bt-buy-now").style.display = "none";
		document.getElementById("menu-special-offer").style.backgroundImage = 'url(images/bt-menu-special-offer_on.jpg)';
	}
	if(sPage == 'TrueStories_list.aspx')
	{
		document.getElementById("menu-true-stories").style.backgroundImage = 'url(images/bt-menu-true-stories_on.jpg)';
	}
	
}

