
var InternetExplorer = (navigator.appName.indexOf("Microsoft") != -1);

function knight_DoFSCommand(command, args)
{
  	eval(command+"()");
}

if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
  document.write('<SCRIPT LANGUAGE=VBScript\> \n');
  document.write('on error resume next \n');
  document.write('Sub knight_FSCommand(ByVal command, ByVal args)\n');
  document.write(' call knight_DoFSCommand(command, args)\n');
  document.write('end sub\n');
  document.write('</SCRIPT\> \n');
}

var currentType = 1;
var currentId = 0;
var currentBaseUrl = "";

function showImage(id)
{
	currentId = id;
	currentType = 1;
	mmContent.innerHTML = "<table cellspacing='0' cellpadding='0' width='320' height='240'><tr><td onDblClick='showLargeImage("+id+")'><img src='Image.aspx?image=" + id + "'></td></tr></table>";
}

function setBaseUrl(baseUrl)
{
	currentBaseUrl = baseUrl;
}

function showLargeImage(id)
{
	if (currentId == 0)
	{
		currentId = id;
	}
	if (currentType == 1)
	{
		windowX = Math.ceil( (window.screen.width - 100) / 2 );
		windowY = Math.ceil( (window.screen.height - 100) / 2 );

		//toolbars=no,left=" + windowX + ",top=" + windowY + ",width=100,height=100"
		newWindow = window.open(currentBaseUrl + "/ImageLarge.aspx?image="+currentId, null, "");
		window.onunload = function(){newWindow.close()}
	}
}

function showVideo(setContent)
{
	currentType = 2;
	mmContent.innerHTML = setContent;
}

function findObj(n, d)
{ 
	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 = findObj(n, d.layers[i].document);
	if (!x && d.getElementById) 
		x = d.getElementById(n); 
	return x;
}

if (findObj("first"))
	currentObject = first;

