<!--

var day = new Array('en', 'es');
var month = new Array('en', 'es');

day['en'] = new Array("Sun", "Mon", "Tue", "Wed", "Thur", "Fri", "Sat");
month['en'] = new Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");

day['es'] = new Array("Domingo", "Lunes", "Martes", "Miercoles", "Jueves", "Viernes", "Sabado");
month['es'] = new Array("Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre");

var currentLang = 'en';

function getCurrentLanguage()
{
	//get the previous language
	var urlLoc = window.location.href;

	var endOfLangIndex = urlLoc.lastIndexOf("/");
	var startOfLangIndex = urlLoc.lastIndexOf("/", (endOfLangIndex - 1));
	var currentLang = urlLoc.substr(startOfLangIndex + 1, endOfLangIndex - startOfLangIndex - 1);

	return currentLang;
}

function getDate()
{
	
	//check to see if a different language is in force
	try
	{
		currentLang = getCurrentLanguage();

		var now = new Date();
		var theDay = day[currentLang][now.getDay()];
		var theDate = now.getDate();
		var theMonth = month[currentLang][now.getMonth()];
		var theYear = now.getFullYear();
		var theHour = (now.getHours() < 10) ? "0" + now.getHours() : now.getHours();
		var theMinutes = (now.getMinutes() < 10) ? "0" + now.getMinutes() : now.getMinutes();
		var theSeconds = (now.getSeconds() < 10) ? "0" + now.getSeconds() : now.getSeconds();

		return theDay + ", " + theDate + " " + theMonth + " " + theYear + " " + theHour + ":" + theMinutes + ":" + theSeconds;
	}
	catch (e)
	{
	}

//alert(month.length)
	return "";
	
}

//retrieves the parameters from the current window address if any
function getAddressParameters()
{
  var address = window.location.href; //get address
  var paramList = address.substring(address.indexOf("?") + 1, address.length);  //separate params from address
  
  if (paramList.indexOf("#") != -1)
  {
	paramList = paramList.substring(0, paramList.indexOf("#")) ; //separate any # hrefs within the page
  }

  var paramarray = paramList.split("&");  //separate individul parameter pairs
  var parameters = new Array();
  
  for (var i=0; i<paramarray.length; i++)
  {
	//taken out so that parameters are no longer stored as [paramname, paramvalue]
    //parameters[i] = new Array();
    //parameters[i][0] = paramarray[i].split("=")[0];
    //parameters[i][1] = paramarray[i].split("=")[1];
		
    //added in so that params are now stored as parameters[name] = val
    parameters[paramarray[i].split("=")[0]] = paramarray[i].split("=")[1];
  }
  
  return parameters;
}

//closes down a child window and resets focus to the parent if one exists
function closedownChildWindow()
{
  if (opener)
  {
    opener.focus();
  }
  
  window.close();
}

//closes down a window
function closedownWindow()
{
  window.close();
}

//retreive the object on the page if it exists
function findObj(obj)
{
	if (navigator.appName.indexOf("Microsoft") != -1) 
	{
        return window[obj];
    }
    else 
	{
        return document.getElementById(obj);
	}
}

/////////////////////////////////////////////////////
//// HIGHLIGHT FUNCTIONS
/////////////////////////////////////////////////////

var lastSelectedLink = null;

//used to highlight a passed in link and unhighlight a previously highlighted one
function highlightLink(linkObj)
{
	if (linkObj)
	{
		if (linkObj.className == "Sidemenu")
		{
		  linkObj.className = "Sidemenuselected";
		}
		else
		{
		  linkObj.className = "Submenuselected";
		}
	
		if ((lastSelectedLink != null) && (lastSelectedLink != linkObj))
		{
			if (lastSelectedLink.className == "Sidemenuselected")
			{
				lastSelectedLink.className = 'Sidemenu';
			}
			else
			{
				lastSelectedLink.className = 'Submenu';
			}
		}

		lastSelectedLink = linkObj;
	}
}

//used to unselected the currently selected link
function unhighlightSelectedLink()
{
	if (lastSelectedLink)
	{
		if (lastSelectedLink.className == "Sidemenuselected")
		{
			lastSelectedLink.className = 'Sidemenu';
		}
		else
		{
			lastSelectedLink.className = 'Submenu';
		}

		lastSelectedLink = null;
	}
}

//-->
