function switchMenu(obj)
{
	var el = document.getElementById(obj);
	if(el.style.display != "block")
	{
		el.style.display = "block";
	}
	else
	{
		el.style.display = "none";
	}
}		

function OpenWindow()
{
	window.open("upload.aspx", "Upload", "width=600, height=350,location=no,menubar=no,status=no,toolbar=no,scrollbars=no,resizable=yes");
	self.document.location.reload(true);
}

function CreateFolder()
{
	window.open("createFolder.aspx","Create", "width=440, height=155,location=no,menubar=no,status=no,toolbar=no,scrollbars=no,resizable=yes");
	self.document.location.reload(true);
}

function SetDate()
{
	d = new Date();
	var month=""; 
	mymonth = d.getMonth(); 
	if(mymonth == 0) { 
		month = "Jan. "} 
	else if(mymonth ==1) 
		month = "Feb. " 
	else if(mymonth ==2) 
		month = "March " 
	else if(mymonth ==3) 
		month = "April " 
	else if(mymonth ==4) 
		month = "May " 
	else if(mymonth ==5) 
		month = "June " 
	else if(mymonth ==6) 
		month = "July " 
	else if(mymonth ==7) 
		month = "Aug. " 
	else if(mymonth ==8) 
		month = "Sept. " 
	else if(mymonth ==9) 
		month = "Oct. " 
	else if(mymonth ==10) 
		month = "Nov. " 
	else if(mymonth ==11) 
		month = "Dec. "
	
	var dateLabel = document.getElementById("lblDate");	
	
	if (dateLabel)
	    dateLabel.innerHTML = month + d.getDate() + ", " + d.getFullYear();
}

// Display the submenu in the main navigation menu, if it exists.
function displaySubMenu()
{
    // get all the links on page.
    var anchorTags = document.getElementsByTagName("a");
    
    // loop through all links.
    for(var i = 0; i < anchorTags.length; i++)
    {
        // get rid of pageName.aspx (and any query string stuff) from the URL if it's there.
        var currentUrl = window.location.href.toLowerCase();
        currentUrl = currentUrl.replace(/[a-zA-Z0-9\-\_]+[\.]aspx.*/, "");
        
        // if we've found a link that points to the page we're on.
        if (anchorTags[i].href.toLowerCase() == currentUrl)
        {
            // Get the next node in the DOM.
            var sibling = anchorTags[i].nextSibling;
            
            // There may be white space, so loop through until we find the next element.
            while (sibling && sibling.nodeType != 1)
                sibling = sibling.nextSibling;
            
            // check if the next element is an unordered list.
            if (sibling && sibling.tagName == "UL")
            {
                // Show its child links.
                sibling.style.display = "block";
                var parentElement = sibling.parentNode;
                
                // in case there are multiple levels display parent lists too.
                while (parentElement && parentElement.tagName == "LI")
                {
                    var parentList = parentElement.parentNode;  // get the UL tag.
                    parentList.style.display = "block";         // show the parent.
                    parentElement = parentList;                 // check the parent's parent too.
                }
                
                break;
            }
        }
    }
}

window.onload = function()
{
    SetDate();
    displaySubMenu();
}