// BrowserCheck Object
// provides most commonly needed browser checking variables

function BrowserCheck() 
{
	var b = navigator.appName
	if (b=="Netscape") this.b = "ns"
	else if (b=="Microsoft Internet Explorer") this.b = "ie"
	else this.b = b
	this.v = parseInt(navigator.appVersion)
	this.ns = (this.b=="ns" && this.v>=4)
	this.ns4 = (this.b=="ns" && this.v==4)
	this.ns5 = (this.b=="ns" && this.v==5)
	this.ie = (this.b=="ie" && this.v>=4)
	this.ie4 = (navigator.userAgent.indexOf('MSIE 4')>0)
	this.ie5 = (navigator.userAgent.indexOf('MSIE 5')>0)
	if (this.ie5) this.v = 5
	this.min = (this.ns||this.ie)
	var p = navigator.platform
	//if (p=="MacPPC") this.p = "mac"
	//else this.p = p
}


// automatically create the "is" object
is = new BrowserCheck()


// determine relevant browser attributes
browser = (document.images) ? 1 : 0;


/*                      ... highlight function...                 */
	 
	    
function trilight(imageName,imageFile,imgHdr)
{
	if (browser == 1) 
	{
		document.images[imageName].src = eval(imageFile + ".src");
		document.docTsr.src = eval(imgHdr + ".src");
	}
}


function highlight(imageName,imageFile)
{
	if (browser == 1) 
	{
		document.images[imageName].src = eval(imageFile + ".src");
	}
}


function OpenOffsitePage(lb, wnd)
{
	var SelIndex = lb.selectedIndex;
	if (lb.selectedIndex <= 1) return;
	var Value = lb.options[SelIndex].value;

	// Get first char from Value
	var FirstChar = Value.substr(0, 1);

	// Get URL from Value
	var URL = Value.substr(1);

	// Determine whether to open in same frame or new window
	if(FirstChar == '1')
	{
		wnd.location.href = URL;
	}
	else
	{
		winStats='toolbar=yes,location=no,directories=no,menubar=yes,resizable=yes,'
		winStats+='scrollbars=yes'
		if (navigator.appName.indexOf("Microsoft")>=0) 
		{
			winStats+=',left=50,top=50,width=600,height=400'
		}
		else
		{
			winStats+=',screenX=50,screenY=50,width=600,height=400'
		}
		adWindow=window.open(URL,"",winStats)     
		adWindow.focus()
	}
}


function OpenInNewWindow(Url)
{
	OpenInNewWindowEx(Url,  'width=600,height=435,toolbar=yes,location=no,directories=no,menubar=yes,resizable=yes,scrollbars=yes');
}


function OpenInNewWindowEx(Url, OpenParams)
{
	open(Url, null, OpenParams);
}


function MM_swapImgRestore() //v3.0
{ 
	var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}


function MM_preloadImages() //v3.0
{ 
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}


function MM_findObj(n, d) //v4.0
{ 
	var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) 
	{
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);
    }
	if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	if(!x && document.getElementById) x=document.getElementById(n); return x;
}


function MM_swapImage() //v3.0
{ 
	var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


/********************************************************************************
Written by Gordon Ostasz
-Displays the current date
*********************************************************************************/
function date()
{
    // Array of month Names
    var monthNames = new Array(
    "January","February","March","April","May","June","July",
    "August","September","October","November","December");

    var now = new Date();
    document.write(monthNames[now.getMonth()] + " " + 
    now.getDate() + ", " + now.getFullYear());
}


/********************************************************************************
Written by Gordon Ostasz
-Create a pop up

Arguments:	pop		-pop up page, page to be display in the pop up
			size	-size of the pop up
*********************************************************************************/
function openpop(pop, size)
{
	if (size == "small")
	{
		window.open(pop,"","width=200,height=100,");
	}
	else if (size == "medium")
	{
		window.open(pop,"","width=410,height=285,");
	}
	else if (size == "large")
	{
		window.open(pop,"","width=325,height=330,");
	}
}


/********************************************************************************
Written by Gordon Ostasz
-Checks if cookie is found on client browser

Arguments:	cookieName	-Name of the cookie to search for on the client's browser
Returns:	notfound	-Cookie not found
			found		-coolie is found
*********************************************************************************/ 
function GetCookie(cookieName) 
{
	var returnValue = "notfound";
  
	if (document.cookie.length > 0) 
	{
		offset = document.cookie.indexOf(cookieName);
		if (offset != -1) 
		{ 
			returnValue="found";
		}
	}
	return returnValue;
}
 

/********************************************************************************
Written by Gordon Ostasz
-Writes a cookie to the client's browser if cookie is not found
-The cookie tells the browser that the pop has appear in once in this session

Arguments:	pop		-pop up page, page to be display in the pop up
			size	-size of the pop up
*********************************************************************************/ 
function LoadOnce(pop, size)
{
	if (GetCookie("poppedup")=="notfound")
	{
		openpop(pop, size)
		document.cookie="poppedup";
	}
}


 
