function DisplayEventInfo ()
{
	// construct URL to the Event Detail based on arguments passed in
	if (arguments.length == 1)
	{
		url = "EventInfo.aspx?id=" + arguments[0];
	}
	else if (arguments.length == 4)
	{
		url = "EventInfo.aspx?id=" + arguments[0] + "&day=" + arguments[1] + "&month=" + arguments[2] + "&year=" + arguments[3];
	}
	DisplayEventInfoUrl(url);
}


function DisplayEventInfoUrl(url)
{
	var eventWidth = 470;
	var eventHeight = 525;
	var winName = "EventInfo";
	DisplayPopupWindow(url, eventWidth, eventHeight, winName);
}


function DisplayPopupWindow(url, width, height, winName)
{
	var winSize = "width=" + width + "px,height=" + height + "px,";
	var params = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no";

	var pos = "";
	var posX = (screen.width - width)/2;
	var posY = (screen.height - height)/2;	
	if (document.all != null)
	{
		pos = "left=" + posX + ",top=" + posY;
	}
	else if (document.getElementById != null)
	{
		pos = "ScreenX=" + posX + ",ScreenY=" + posY;	
	}
	var winFeat = winSize + pos + "," + params;	
// alert("URL: " + url + " FEATURES: " + winFeat);		
	var winRef = window.open(url, winName,  winFeat);
	if (winRef != null)
	{
		winRef.focus();
	}
}


function DisplayWindow(url, width, height, winName)
{
	var pos = "";
	var posX = (screen.width - width)/2;
	var posY = (screen.height - height)/2;	
	if (document.all != null)
	{
		pos = "left=" + posX + ",top=" + posY;
	}
	else if (document.getElementById != null)
	{
		pos = "ScreenX=" + posX + ",ScreenY=" + posY;	
	}
	
	var winSize = "width=" + width + "px,height=" + height + "px,";
	var params = "toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes";
	var winFeat = winSize + pos + "," + params;	
	var winRef = window.open(url, winName,  winFeat);
	if (winRef != null)
	{
		winRef.focus();
	}
}


//Functions copied from Thrashers to handle popup window
function CheckCookie()
{
	if (enablePopup != null && enablePopup == true)
	{
		if(GetCookie('Popup') == null)
		{
			DisplayPopupWindow('Popup.aspx', 300, 384, 'promoWindow');
			//Set the cookie so the popup will not appear for the user for one hour
			var expdate = new Date(); 
			expdate.setTime(expdate.getTime() + (1000 * 60 * 30 * 1 * 1));  
			SetCookie('Popup', 'POPUPWINDOW', expdate);
		}
	}
}

function GetCookie (name) 
{
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	while (i < clen) 
	{
		var j = i + alen;
		if (document.cookie.substring(i, j) == arg)
		{
//alert( 'Returning: document.cookie.substring(' + i + ', ' + j + ') = ' + document.cookie.substring(i, j) );		
			return getCookieVal(j);
		}
		i = document.cookie.indexOf(" ", i) + 1;
		if (i == 0) break; 
	}
	return null;
}

function getCookieVal(pos)
{
	var clen = document.cookie.length;
	var i = pos;
	return 'POPUPWINDOW';
}


function SetCookie (name, value) 
{
	var argv = SetCookie.arguments; 
	var argc = SetCookie.arguments.length; 
	var expires = (argc > 2) ? argv[2] : null; 
	var path = (argc > 3) ? argv[3] : null; 
	var domain = (argc > 4) ? argv[4] : null; 
	var secure = (argc > 5) ? argv[5] : false; 
	document.cookie = name + "=" + escape (value) + 
	((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
	((path == null) ? "" : ("; path=" + path)) + 
	((domain == null) ? "" : ("; domain=" + domain)) + 
	((secure == true) ? "; secure" : "");
}

//This function is used to 'zoom in' on images
function loadimage(img, text, width, height) {
  imgstr = "../images/" + img;
  winparams = "scrollbars=no,menubar=no,toolbar=no,location=no,status=no,";
  winparams += "width=" + width + ",height=" + height +",resizable=yes";
  picWin = window.open("",'picView',winparams);
  if (picWin.focus) picWin.focus();
  picWin.document.open();
  picWin.document.write("<body bgcolor='#006699'>\n");
  picWin.document.write("<center>\n");
  picWin.document.write("<img src='"+imgstr+"'><br>\n");
  if (text != '') {
    picWin.document.write('<font face="arial,times" size=-1><b>' + text + '</b></font>\n');
  }
  picWin.document.write('<a href="Javascript:window.close();"><img src=../images/closeWindowBut.gif border=0></a>\n');
  picWin.document.write("</center>\n");
  picWin.document.close();
}



function MM_openBrWindow(theURL,winName,features) 
{ //v2.0
  window.open(theURL,winName,features);
}


function JustSoPicWindow(imageName,imageWidth,imageHeight,alt,bgcolor,hugger,hugMargin) 
{
	if (bgcolor=="") 
	{
		bgcolor="#FFFFFF";
	}
	var adj=10
	var w = screen.width;
	var h = screen.height;
	var byFactor=1;

	if(w<740)
	{
	  var lift=0.90;
	}
	if(w>=740 & w<835)
	{
	  var lift=0.91;
	}
	if(w>=835)
	{
	  var lift=0.93;
	}
	if (imageWidth>w)
	{	
	  byFactor = w / imageWidth;			
	  imageWidth = w;
	  imageHeight = imageHeight * byFactor;
	}
	if (imageHeight>h-adj)
	{
	  byFactor = h / imageHeight;
	  imageWidth = (imageWidth * byFactor);
	  imageHeight = h; 
	}
	   
	var scrWidth = w-adj;
	var scrHeight = (h*lift)-adj;

	if (imageHeight>scrHeight)
	{
  	  imageHeight=imageHeight*lift;
	  imageWidth=imageWidth*lift;
	}

	var posLeft=0;
	var posTop=0;

	if (hugger == "hug image")
	{
	  if (hugMargin == "")
	  {
	    hugMargin = 0;
	  }
	  var scrHeightTemp = imageHeight - 0 + 2*hugMargin;
	  if (scrHeightTemp < scrHeight) 
	  {
		scrHeight = scrHeightTemp;
	  } 
	  var scrWidthTemp = imageWidth - 0 + 2*hugMargin;
	  if (scrWidthTemp < scrWidth) 
	  {
		scrWidth = scrWidthTemp;
	  }
	  
	  if (scrHeight<100){scrHeight=100;}
	  if (scrWidth<100){scrWidth=100;}

	  posTop =  ((h-(scrHeight/lift)-adj)/2);
	  posLeft = ((w-(scrWidth)-adj)/2);
 	}

	if (imageHeight > (h*lift)-adj || imageWidth > w-adj)
	{
		imageHeight=imageHeight-adj;
		imageWidth=imageWidth-adj;
	}
	posTop = parseInt(posTop);
	posLeft = parseInt(posLeft);		
	scrWidth = parseInt(scrWidth); 
	scrHeight = parseInt(scrHeight);
	
	var agt=navigator.userAgent.toLowerCase();
	if (agt.indexOf("opera") != -1){
	  var args= new Array();
	  args[0]='parent';
	  args[1]=imageName;
	  var i ; document.MM_returnValue = false;
	  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
	} else {
	newWindow = window.open("vwd_justso.htm","newWindow","width="+scrWidth+",height="+scrHeight+",left="+posLeft+",top="+posTop);
	newWindow.document.open();
	newWindow.document.write('<html><title>'+alt+'</title><body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" bgcolor='+bgcolor+' onBlur="self.close()" onClick="self.close()">');  
	newWindow.document.write('<table width='+imageWidth+' border="0" cellspacing="0" cellpadding="0" align="center" height='+scrHeight+' ><tr><td>');
	newWindow.document.write('<img src="'+imageName+'" width='+imageWidth+' height='+imageHeight+' alt="Click screen to close" >'); 
	newWindow.document.write('</td></tr></table></body></html>');
	newWindow.document.close();
	newWindow.focus();
	}
}


function loadIpix (ipx, text, width, height) 
{
  winparams = "scrollbars=no,menubar=no,toolbar=no,location=no,status=no,";
  winparams += "width=" + width + ",height=" + height +",resizable=yes";
  ipxWin = window.open("",'ipixView',winparams);
  if (ipxWin.focus) ipxWin.focus();
  ipxWin.document.open();
  ipxWin.document.write("<body bgcolor='#006699'>\n");
  ipxWin.document.write("<center>\n");
  ipxWin.document.write('<OBJECT ID="IpixX1" WIDTH=320 HEIGHT=240 CLASSID="CLSID:11260943-421B-11D0-8EAC-0000C07D88CF" CODEBASE="http://www.ipix.com/viewers/ipixx.cab#version=6,0,0,2">\n');
  ipxWin.document.write('<!-- For MSIE 3,4+ -->\n');
  ipxWin.document.write('<PARAM NAME="IPXFILENAME" VALUE="' + ipx + '">\n');
  ipxWin.document.write('<!-- For Netscape 3,4 -->\n');
  ipxWin.document.write('<embed src="' + ipx + '" border=0 width=320 height=240 palette="FOREGROUND" type="application/x-ipix" pluginsPage="http://www.ipix.com/cgi-bin/download.cgi">\n');
  ipxWin.document.write('</embed>\n');
  ipxWin.document.write('</OBJECT><br>\n');
  if (text != '') 
  {
    ipxWin.document.write('<font face="arial,times" size=-1><b>' + text + '</b></font><br>\n');
  }
  ipxWin.document.write('<a href="Javascript:window.close();"><img src=../images/closeWindowBut.gif border=0></a>\n');
  ipxWin.document.write("</center>\n");
  ipxWin.document.close();
}


function loadMov (mov, text, width, height, mw, mh) {
  winparams = "scrollbars=no,menubar=no,toolbar=no,location=no,status=no,";
  winparams += "width=" + width + ",height=" + height +",resizable=yes";
  movWin = window.open("",'movView',winparams);
  movWin.focus();
  movWin.document.open();
  movWin.document.write("<body bgcolor='#006699'>\n");
  movWin.document.write("<center>\n");
  movWin.document.write("<embed src=\"../images/" + mov + "\" controller=true border=0 autostart=true width=" +
    mw + " height=" + mh +"><br>\n");
  if (text != '') {
    movWin.document.write('<font face="arial,times" size=-1><b>' + text + '</b></font>\n');
  }
  movWin.document.write('<a href="Javascript:window.close();"><img src=../images/closeWindowBut.gif border=0></a>\n');
  movWin.document.write("</center>\n");
  movWin.document.close();
}
