var doNotShowNav = false;
//on the home page this gets set to true so that the nav doesn't get set based on the cookie

//load the arrow down gif that will get swapped in
(new Image()).src = "/images/theWorkArrowDown.gif";

function checkNav(id)
{
    //check to see if we should show or hide the id element
    var x = document.getElementById(id);
    //alert(id + " is " + x.style.visibility);
    if (x.style.visibility != "visible")
    {
        showNav(id);
		//show the element
    }
    else
    {
        hideNav(id);
		//hide the element
    }
}

function showNav(id)
{
	//alert("showNav(" + id +")");
    var x = document.getElementById(id);
    x.style.display = "block";
    x.style.visibility = "visible";
    
    //swap the arrow gif
	var imgId = id + "Arrow";
	var img = document.getElementById(imgId);
	img.src = "/images/theWorkArrowDown.gif";
}

function hideNav(id)
{
	//alert("hideNav(" + id +")");
    var x = document.getElementById(id);
    x.style.display = "none";
    x.style.visibility = "hidden";
     
    //swap the arrow gif 
	var imgId = id + "Arrow";
	var img = document.getElementById(imgId);
	img.src = "/images/theWorkArrowRight.gif";
}

function setNavCookie(id)
{
	//alert("setNavCookie\ntheWorkNavItem="+id);
    document.cookie = "theWorkNavItem=" + id;
    //i_the_work_nav.asp uses this cookie to set the param that gets passed to setNavItem()
}
function setNavItem(id)
{
	//alert("setNavItem\nshowNav("+id+")");
    //the call to this function is created in i_the_work_nav.asp
    try
    {
        //underline the active link
        x = document.getElementById(id);
        x.style.borderBottom = "2px solid #ff00cc";
        //make sure the appropriate div is visible (either client_links or channel_links
        showNav(x.parentNode.id);
		showNav(x.parentNode.parentNode.id);
        
    }
    catch(e)
    {
    
    }
    
}
/*
function clearNav()
{
	var nav = document.getElementById("theWorkNav")
	var navLinks = nav.getElementsByTagName("a");
	
	for(x=0; x<navLinks.length; x++)
	{
		navLinks[x].style.borderBottom = "none";
		//the problem with this is that once this style is set, no border will show up onmouseover
	}
	hideNav("b2b");
	hideNav("b2bClients");
	hideNav("b2bChannels");
	hideNav("consumer");
	hideNav("consumerClients");
	hideNav("consumerChannels");
}
*/

function openQuickTimeVideoWindow(w,h,title,video)
{        
    title = encodeURI(title);
    video = encodeURI(video);
    var url = "quicktime_video.aspx?title=" + title + "&video=" + video + "&height=" + h + "&width=" + w;
    //alert(url);
    w+=20; //add 20px to the window
    h+=20;
    var windowParams = "width=" + w + ",height=" + h;
    var w = window.open(url,"",windowParams);
     
}
function openFlashVideoWindow(w,h,title,video)
{        
    title = encodeURI(title);
    video = encodeURI(video);
    var url = "flash_video.aspx?title=" + title + "&video=" + video + "&height=" + h + "&width=" + w;
   
    w+=20; //add 20px to the window
    h+=20;
    var windowParams = "width=" + w + ",height=" + h;
    var w = window.open(url,"",windowParams);
     
}
function openVideoWindow(w,h,url)
{        
    w+=20; //add 20px to the window
    h+=20;
    var windowParams = "width=" + w + ",height=" + h;
    var w = window.open(url,"",windowParams);
     
}
