// Form Validation
function validateForm(form)
{
    var f = form.subscribeEmail;
        
    if(f){
        if(f.value == ""){            
            f.value = "* Please enter your email";
            return false;
        }
    }
}


// Pre-load rollover images

var preloaded = new Array();
function preload_images() 
{
   for (var i = 0; i < arguments.length; i++)
    {
        preloaded[i] = document.createElement('img');
        preloaded[i].setAttribute('src',arguments[i]);
    };
};

function preload_primarynav()
{
	preload_images
	('');		
};

function showSecNav(primaryNavOption)
{
    var secNav;
    secNav = document.getElementById(primaryNavOption);
    secNav.style.display = "block";
    showSecNavDiv();
}

function hideAllSecNav()
{
	var menus = document.getElementsByTagName('ul');
	for(var i=0; i < menus.length; i++)
	{
		var thisMenu = menus[i];
		if(thisMenu.className == 'hidden')
		{
			hideSecNav(thisMenu.id);
		}
	}
	hideSecNavDiv();
}

function showSecNavDiv()
{
    var secNavDiv;
    secNavDiv = document.getElementById('secondaryNav');
    secNavDiv.style.display = "block";
}

function hideSecNavDiv()
{    
    var secNavDiv;
    secNavDiv = document.getElementById('secondaryNav');
    secNavDiv.style.display = "none";
}

function hideSecNav(menuId)
{
    var menuToHide;
    menuToHide = document.getElementById(menuId);
    menuToHide.style.display = "none";
}

function highlightPriNav(li)
{
    li.style.backgroundColor = "#eeeeee";
}

function unhighlightAllPriNav(except)
{
	var menus = document.getElementsByTagName('li');
	for(var i=0; i < menus.length; i++)
	{
		var thisMenu = menus[i];
		if((thisMenu.className == 'prinav') || (thisMenu.className == 'prinavselected'))
		{
			thisMenu.style.backgroundColor = "";
		}
		if(thisMenu.id == except)
		{
		    thisMenu.style.backgroundColor = "#eeeeee";
		}
	}    
}

function SelectPicture()
{	
	var url = "/res/cms/cmsImages.aspx";
	// display popup window allowing user to select from an image list, or upload their own
	flist = "dialogHeight:520px;dialogWidth:800px;resizable:yes;";

	var myObject = new Object();
	myObject.cancel = true;
	myObject.imagePath = "";
	myObject.testString = "Hello";

	var dialog = window.showModalDialog(url, myObject, flist);

	if (myObject.cancel) return;
	document.getElementById("txtPicture").value = myObject.imagePath;			
}

var newwindow;
function popupwindow(url)
{
	newwindow=window.open(url,'name','location=0,status=0,scrollbars=0,width=560,height=530');
	if (window.focus) {newwindow.focus()}
}
