var days   = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
var months = new Array("","January","February","March","April","May","June","July",
                        "August","September","October","November","December");

function Popup(object,windowWidth,windowHeight,windowTitle,objectWidth,objectHeight)
{

	windowHeight = (REQUIRED_RESOLUTION_HEIGHT>windowHeight) ? windowHeight : REQUIRED_RESOLUTION_HEIGHT-40;
	windowWidth  = (REQUIRED_RESOLUTION_WIDTH>windowWidth)   ? windowWidth  : REQUIRED_RESOLUTION_WIDTH-20;
	scrollBars   = (windowWidth>objectWidth && windowHeight>objectHeight) ? "no" : "yes";
	windowTitle  = (windowTitle!="") ? escape(windowTitle) : escape("&nbsp;");
	windowName   = ("OptionSixPopup"+windowWidth+"x"+windowHeight+(Math.random()*10)).replace(/\./g,"");;

	if(object.indexOf(".htm")!=-1 || object.indexOf(".html")!=-1)
	{
		scrollBars = "yes";
		sPath = (location.href.indexOf("popups/")!=-1) ? "" : "popups/";
		sPath = (location.href.indexOf("interface")!=-1) ? "../popups/" : sPath;
		win = open(sPath+object,windowName,"width="+windowWidth+",height="+windowHeight+",scrollbars="+scrollBars+",resizable=yes,menubars=no,toolbar=no,directories=no");
		win.focus();
	}
	if(object.indexOf(".jpg")!=-1 || object.indexOf(".gif")!=-1)
	{
		sPath = (location.href.indexOf("popups/")!=-1) ? "" : "popups/";
		sPath = (location.href.indexOf("interface")!=-1) ? "../popups/" : sPath;
		win = open(sPath+"00_showimage.htm?IMG="+object+"&WIDTH="+objectWidth+"&HEIGHT="+objectHeight+"&TITLE="+windowTitle,windowName,"width="+windowWidth+",height="+windowHeight+",scrollbars="+scrollBars+",menubars=no,toolbar=no,directories=no");
		win.focus();
	}
	if(object.indexOf(".swf")!=-1)
	{
		sPath = (location.href.indexOf("media/flash/")!=-1) ? "" : "../media/flash/";
		sPath = (location.href.indexOf("popups/")!=-1) ? "../../media/flash/" : sPath;
		sPath = (location.href.indexOf("interface")!=-1) ? "../../media/flash/" : sPath;
		win = open(sPath+"00_showflash.htm?SWF="+object+"&WIDTH="+objectWidth+"&HEIGHT="+objectHeight+"&TITLE="+windowTitle,windowName,"width="+windowWidth+",height="+windowHeight+",scrollbars="+scrollBars+",menubars=no,toolbar=no,directories=no");
		win.focus();
	}
	if(object.indexOf(".doc")!=-1 || object.indexOf(".xls")!=-1 || object.indexOf(".pdf")!=-1)
	{
		scrollBars = "yes";
		sPath = (location.href.indexOf("popups/")!=-1) ? "../" : "";
		sPath = (location.href.indexOf("interface")!=-1) ? "../popups/" : sPath;
		win = open(sPath+"documents/"+object,windowName,"width="+windowWidth+",height="+windowHeight+",scrollbars="+scrollBars+",resizable=yes,menubars=yes,toolbar=yes,directories=no");
		win.focus();
	}

}


function GetCookie(cookieName) 
{
   search = cookieName + "="
   if (document.cookie.length > 0)
   {
    offset = document.cookie.indexOf(search) 
    if (offset != -1)
    {
      offset += search.length;
      end = document.cookie.indexOf(";", offset);

      if (end == -1) { end = document.cookie.length; }

      cookieValue = unescape(document.cookie.substring(offset, end))

      return cookieValue
    } 
    else { return ""; }
   }
}



function setCookie(cookieName, cookieValue, cookieLife)
{
   expirationDate = new Date();

   if(cookieLife == null || cookieLife != -1)
   {
    cookieLife = 365*86400000;
    expirationDate.setTime(expirationDate.getTime() + cookieLife);
    document.cookie = escape(cookieName) + "=" + escape(cookieValue) + ";expires=" + expirationDate.toGMTString() + ";path=/";
   }
   else
   {
    document.cookie = escape(cookieName) + "=" + escape(cookieValue) + ";path=/";
   }
} 



function IsDigit()
{ 
  return ( (event.keyCode >= 48) && (event.keyCode <= 57) || (event.keyCode ==46)); 
}


function MakeNiceDate(inputDate, delimiter)
{
  if(!delimiter) { delimiter = "/"; }
  inputDate = new Date(inputDate);

  funcDate = (inputDate.getMonth() + 1) + delimiter + 
             inputDate.getDate()        + delimiter + 
             inputDate.getFullYear();

  return funcDate;
}

