//****  Globals
var mainMaintReload=0;
var mainImageCache=new Array();

//****  Runlist
mainCheckMaint ();

//****  Functions

function mainCheckMaint () {

	if (mainMaint==1) {
		var curLoc=document.location.href;
		if (curLoc.indexOf(mainMaintLocation)<0) {
			mainMaintReload=1;
			mainGoto (mainMaintLocation);
		};
	}
}

function mainInsertFooter () {

	var code='';
	var now=new Date();

	code+='<br><center>';
	code+='<img SRC="\/media\/images\/1pix.gif" HEIGHT="20" WIDTH="1"><br>';
	code+='<img SRC="\/media\/images\/slogo.gif" VSPACE="5"><br>';
	code+='&copy; '+now.getFullYear()+'<br>';
	code+='<img SRC="\/media\/images\/1pix.gif" HEIGHT="15" WIDTH="1"><br>';
	code+='<\/center>';

	document.open;
	document.write (code);
	document.close;

}

function mainRemoveFrames () {
	
	if ( top.location != self.location ) {
		top.location = self.location
	};
}

function mainCacheImages ( imageURL ) {

	for (i=0;i<imageURL.length;i++) {
		mainImageCache[i]=new Image;
		mainImageCache[i].src=imageURL[i]
	};
}

function mainGoto ( locGoto ) {

	document.location=locGoto;

};

function mainBarred () {

	window.location="/template/barred.html"

}

function mainInsertLib ( libName ) {

	var code='';
	for (i=0;i<libName.length;i++)
	{
		libThis = libName[i];
		isStyle = libThis.indexOf ('.css');
		if ( isStyle == -1 )
		{
			code+='<script LANGUAGE="JavaScript" SRC="'+libThis+'"><\/script>';
		}else{
			code+='<link REL="STYLESHEET" HREF="'+libThis+'" TYPE="text\/css">';
		};
	};
	
	document.open;
	document.write (code);
	document.close;
}

function mainInsertImage ( imageURL, options ) {

	var code="";
	
	code='<IMG SRC="'+imageURL+'" '+options+'>';

	document.open;
	document.write (code);
	document.close;
}

function mainInsertFlash ( sourcefile, width, height, loop, bgcolor ) {

	var code="";
	
	code+='<CENTER>';
	code+='<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=4,0,0,0" ID='+sourcefile+' WIDTH='+width+' HEIGHT='+height+'>';
	code+='<PARAM NAME=movie VALUE="'+sourcefile+'">';
	code+='<PARAM NAME=loop VALUE='+loop+'>';
	code+='<PARAM NAME=quality VALUE=best>';
	if (bgcolor=='') {
		code+='<PARAM NAME=wmode VALUE="transparent">';
	}else{
		code+='<PARAM NAME=bgcolor VALUE='+bgcolor+'>';
	};
	code+='<EMBED src="'+sourcefile+'" loop=false quality=best bgcolor=#'+bgcolor+' WIDTH='+width+' HEIGHT='+height+' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">';
	code+='</EMBED>';
	code+='</OBJECT>';
	code+='</CENTER>';

	document.open;
	document.write (code);
	document.close;
}
