/* ----------------------------------------------------------- globals	default global vars*/	/* ----------------------------------------------------------- Util_Random	Return random number between min & max, inclusive*/function Util_Random(min,max){	return Math.floor(Math.random()*(max-min+1)+min);}/* ----------------------------------------------------------- Obj_Random_Unique	Object to create unique random number between min & max, inclusive	new Obj_Random_Unique(min,max)	.unique()  returns number between min and max*/function Obj_Random_Unique(min,max){	var range_min = min;	var range_max = max;	var range_count = max-min+1;	var unique_array = new Array(range_count);	var i;// init "hit" array	for( i=0; i<range_count; i++ ) unique_array[i] = 0;// "unique" member	this.unique = function()	{		do {			i = Util_Random(0,range_count-1);		} while( unique_array[i] );		unique_array[i] = 1;		return i + range_min;	}}/* ----------------------------------------------------------- Obj_StringArray	Object to create array of strings and then return them	new Obj_StringArray()	.add('string to add')	.random()  returns random string	.unique_random() returns random string (each only once)*/function Obj_StringArray(){	var count = 0;	var building = 1;	var array = new Array();	var random_init = 0;	var random_unique_obj;	this.add = function(str)	{		if( !building ) alert('Once array features are used, adding not allowed');		array[count++] = str;	}	// private function to signal "adding" is done, need to possibly initialize random object	function add_done()	{		if( !random_init )		{			random_init = 1;			building = 0;			random_unique_obj = new Obj_Random_Unique(0,count-1);		}	}	this.random = function()	{		add_done();		return array[Util_Random(0,count-1)];	}	this.unique_random = function()	{		add_done();		return array[random_unique_obj.unique()];	}}/* ----------------------------------------------------------- Video_AddMovieEmbedHTML	this function is called by the pop-up HTML to get around a problem in IE7:	if this code were directly in the pop-up HTML, then IE7 would force the user to press spacebar	or click to play the movie... all to conform to some odd-ball patent	by having this code separate it bypasses the patent problem*/function Video_AddMovieEmbedHTML(name,width,height){document.write('<OBJECT CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" ' +				'WIDTH="' + width + '" ' +				'HEIGHT="' + height + '" CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab">' +				'<PARAM NAME="SRC" VALUE="' + name + '">' +				'<PARAM NAME="AUTOPLAY" VALUE="true">' +				'<PARAM NAME="CONTROLLER" VALUE="true">' +				'<PARAM NAME="SCALE" VALUE="tofit">' +				'<EMBED SRC="' + name + '" WIDTH="' + width + '" HEIGHT="'+height+'" ' +				'SCALE="tofit" AUTOPLAY="true" CONTROLLER="true" ' +				'PLUGINSPAGE="http://www.apple.com/quicktime/download/">' +				'</EMBED></OBJECT>' );}/* ----------------------------------------------------------- Video_PopupWindow	open up Video Pop-Up window and play QuickTime Movie*/var videoWindow = null;	// window that is open and playing videovar bViewingTheVideosPage = 0;	// do special stuff if on the "Videos" page (search below for details! :)/* If you add a dash to the beginning of a title, it won't be quoted as is the default */function Video_FixTitle(theTitle){	if( theTitle.charAt(0)=='-' ) return theTitle.slice(1);	else return '"' + theTitle + '"';}function Video_PopupWindow(theTitle,theFile,windWidth,windHeight,movWidth,movHeight){	theParms = 'title='+Video_FixTitle(theTitle)+'&movie='+theFile+'&width='+movWidth+'&height='+movHeight;	w = screen.availWidth, h = screen.availHeight;	if( w<800 ) W = 800;	if( h<600 ) h = 600;	windLeft = (w-windWidth)/2, windTop = (h-windHeight)/2;	windTop = windTop - (windTop/4);	// if the window already exists, the open will fail to resize so close it first	if( videoWindow && videoWindow.open )	{		if( !videoWindow.closed ) videoWindow.close();		delete videoWindow;		videoWindow = null;	}	windName = 'wndMovie';	videoWindow = window.open('videos_popup.html?'+theParms, windName,'width='+windWidth+',height='+windHeight		+',top='+windTop+',left='+windLeft+',status=no,toolbar=no,location=no,menubar=no,scrollbars=no,resizable=no');}/* ----------------------------------------------------------- Video_AddHTML	add HTML code to display video thumbnail, description and links	for even more consistency, each video should have the code to	call this function in a SSI*/var bStaggerSides = 0;	// 0: thumbnail on left, 1: on rightfunction Video_AddHTML(theTitle,theDescription,theTime,theFile){	document.write('<TABLE ALIGN="CENTER" CELLSPACING="0" CELLPADDING="7"><TR VALIGN="MIDDLE">');	if( bStaggerSides )	{		Video_AddHTML_GraphicSide(theFile,theTitle);		Video_AddHTML_TextSide(theTitle,theDescription,theTime,'LEFT');	}	else	{		Video_AddHTML_TextSide(theTitle,theDescription,theTime,'RIGHT');		Video_AddHTML_GraphicSide(theFile,theTitle);	}	if( bViewingTheVideosPage ) bStaggerSides = 1 - bStaggerSides;	document.write('</TR></TABLE><BR>');}function Video_AddHTML_GraphicSide(theFile,theTitle){	comm = "<A CLASS=\"video\" HREF=\"javascript:Video_PopupWindow('" + theTitle + "','" + theFile;	str = '<TD ALIGN="CENTER"><IMG SRC="'+theFile+'.jpg" ALT="" BORDER="2"><BR><SPAN CLASS="video_play"><IMG SRC="videos/video.gif" BORDER="0" ALT=""> '		+ comm + '_56k\',370,300,160,120)">56k modem</A> - '		+ comm + '_DSL\',370,300,320,240)">Cable/DSL</A> - '		+ comm + '_HIGH\',710,556,640,480)">SuperSize</A>'		+ '</SPAN></TD>';	document.write(str);}function Video_AddHTML_TextSide(theTitle,theDescription,theTime,theSide){	str = '<TD ALIGN="' + theSide + '" WIDTH="320">'		+ '<SPAN CLASS="video_name">' + Video_FixTitle(theTitle) + (bViewingTheVideosPage ? '':' - Video') + '</SPAN><BR>'		+ '<SPAN CLASS="video_description"><BR>' + theDescription + ' </SPAN>'		+ '<SPAN CLASS="video_time">' + theTime + ' min</SPAN><BR><BR></TD>';	document.write(str);}