
// Escape frames, except for specified translation sites
var translation = false;
if (document.location.pathname.substring(0,10) == '/translate') translation = true; // Google translator
if (document.location.href.substring(7,26) == 'babelfish.altavista') translation = true;
if (document.location.href.substring(7,22) == 'freetranslation') translation = true;
if (document.location.href.substring(11,26) == 'freetranslation') translation = true;
if ((window != top) && (translation !=true)) top.location.href = document.location;



// Begin Miscellaneous Pop-up
// Here just in case, but currently not used.
// Once it is used, list here the page(s) on which it is used.
function miscPopup(url,x,y)
	{
	misc = window.open(url,'_blank','toolbar=no,location=no,directories=no,status=yes,scrollbars=no,resizable=yes,copyhistory=no,width='+x+',height='+y);
	setTimeout('misc.focus()',500);
	}
// End Generic Pop-up



// Begin Attraction Info Pop-up
function infoPopup(url)
	{
	info = window.open(url,'Info','toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,resizable=yes,copyhistory=no,width=320,height=300');
	setTimeout('info.focus()',500);
	}
// End Attraction Info Pop-up



// Begin texPopup
	/*
	Original dynamically resizing pop-up script written by Bugimus.
	Original script found here: http://www.bugimus.com/gurus/image_popup/imagepopup.html
	Copyright © 1998-2001 Bugimus, all rights reserved.
	http://bugimus.com/

	Heavily modified by Wesley Treat to become texPopup for use on Texas Twisted.
	http://www.texastwisted.com/

	Special thanks to bitdamaged, Slime and Veneficuz of Ozone's Asylum for helping me make it work.
	http://www.bitdamaged.com/	http://www.slimeland.com/	http://www.p-design.net/
	http://www.ozoneasylum.com/
	*/
function texPopup(myArray) {

	// How many images are in the array?
	var number_of_images = 0;
	var re = /(\.jpg|\.gif)$/;
	for (var a=0; a < myArray.length; a++) {
		if(myArray[a].match(re)) number_of_images++;
	}

	// Does the array contain a QuickTime file?
	var quicktime=false;
	quicktime = /\.mov/.test(myArray);
	// If so, assign variable names to the strings.
	if(quicktime) {
		qtfile = myArray[0];
		qtx = myArray[1];
		qty = myArray[2];
		// Then add the height of the QuickTime controller to file height.
		var qtycon = qty+16;
	}

	// Does the array contain flags?
	var noborder=false;
	noborder = /noborder\.flag/.test(myArray);

	texwin = window.open('','texPop','toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,resizable=yes,copyhistory=no,width=395,height=400');
	texwin.document.write( '<HTML>\n' );
	texwin.document.write( '<HEAD>\n' );
	texwin.document.write( '<TITLE>Texas Twisted</TITLE>\n\n' );
	texwin.document.write( '<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">\n\n' );
	texwin.document.write( '<LINK REL="stylesheet" TYPE="text/css" HREF="http://www.texastwisted.com/common.css">\n\n' );

	// Begin resize script
	texwin.document.write( '<SCRIPT LANGUAGE="JavaScript">\n\n' );

	texwin.document.write( 'IE5=NN4=NN6=false;\n' );
	texwin.document.write( 'if(document.all)IE5=true;\n' );
	texwin.document.write( 'else if(document.getElementById)NN6=true;\n' );
	texwin.document.write( 'else if(document.layers)NN4=true;\n\n' );

	texwin.document.write( 'function autoSize() {\n\n' );

	// Creating the variable "multiple" is only necessary because we added a third else statement below for QuickTime pop-ups.
	texwin.document.write( '	var single=false;\n' );
	texwin.document.write( '	var multiple=false;\n' );
	texwin.document.write( '	if(document.images.length == 1) single=true;\n' );
	texwin.document.write( '	if(document.images.length > 1) multiple=true;\n\n' );

	// If quicktime is true in this script, create the necessary movie-size variables in the pop-up's script for use in resizing.
	if(quicktime) {
		texwin.document.write( '	var qtx = '+qtx+';\n' );
		texwin.document.write( '	var qtycon = '+qtycon+';\n\n' );
	}

	texwin.document.write( '	if(single) {\n' );
	texwin.document.write( '		if(IE5) self.resizeTo(document.images[0].width+45,document.images[0].height+45+90);\n' );
	texwin.document.write( '		else if(NN6) self.sizeToContent();\n' );
	texwin.document.write( '		else top.window.resizeTo(document.images[0].width+35,document.images[0].height+90);\n' );
	texwin.document.write( '		self.focus();\n' );
	texwin.document.write( '	}\n' );
	texwin.document.write( '	else if(multiple) {\n' );
	texwin.document.write( '		if(IE5||NN6) self.resizeTo(407,document.images[0].height+45+105);\n' );
	texwin.document.write( '		else top.window.resizeTo(407,document.images[0].height+105);\n' );
	texwin.document.write( '		self.focus();\n' );
	texwin.document.write( '	}\n' );
	texwin.document.write( '	else {\n' ); // If there is neither a single image nor multiple images, then it's QuickTime.
	texwin.document.write( '		if(IE5||NN6) self.resizeTo(qtx+55,qtycon+45+50);\n' );
	texwin.document.write( '		else top.window.resizeTo(qtx+45,qtycon+50);\n' );
	texwin.document.write( '		self.focus();\n' );
	texwin.document.write( '	}\n\n' );

	texwin.document.write( '}\n\n' );

	texwin.document.write( '</SCR' );
	texwin.document.write( 'IPT>\n\n' );
	// End resize script

	texwin.document.write( '</HEAD>\n' );
	texwin.document.write( '<BODY ' );

	// If this is a multiple-image pop-up, use the scroll-arrow background.
	if(number_of_images > 1) texwin.document.write( 'BACKGROUND="http://www.texastwisted.com/scroll_arrow.gif" ' );

	texwin.document.write( 'BGCOLOR="#FFFFFF" MARGINHEIGHT=0' );
	if(number_of_images > 1) texwin.document.write( ' MARGINWIDTH=4 LEFTMARGIN=4' ); // Better spacing along left side in multiple-image pop-ups.
	else texwin.document.write( ' MARGINWIDTH=0 LEFTMARGIN=0' );
	texwin.document.write( ' TOPMARGIN=0 onLoad="javascript:autoSize();">\n\n\n' );

	// If this is a QuickTime pop-up, write the QuickTime EMBED tag.
	if(quicktime) {
		texwin.document.write( '<DIV ALIGN=center>\n\n' );
		// The table is for spacing. Can't use a spacer image, else the script will think it's a single-image pop-up.
		texwin.document.write( '<TABLE CELLPADDING=10 CELLSPACING=0 BORDER=0>\n' );
		texwin.document.write( '<TR>\n' );
		texwin.document.write( '	<TD><EMBED SRC="http://www.texastwisted.com/media/_poster.mov" QTSRC="rtsp://quicktime.texastwisted.com:7071/quicktime.texastwisted.com/'+qtfile+'" WIDTH='+qtx+' HEIGHT='+qtycon+' AUTOPLAY=true CONTROLLER=true LOOP=false PLUGINSPAGE="http://www.apple.com/quicktime/"></TD>\n' );
		texwin.document.write( '</TR>\n' );
		texwin.document.write( '</TABLE>\n\n' );
		texwin.document.write( '</DIV>\n\n' );
	}
	// Otherwise, create the image/caption table.
	else {
		texwin.document.write( '<TABLE ' );
		if(number_of_images > 1) texwin.document.write( 'WIDTH="339" ' );
		texwin.document.write( 'CELLPADDING=5 CELLSPACING=0 BORDER=0>\n\n' );
		// Loop through the array to create the appropriate rows and cells.
		for(i=0;i<myArray.length;i++) {
			reImg = /(\.jpg|\.gif)$/;
			reFlag = /(\.flag)$/;
			// If it ends with .jpg or .gif, it's an image.
			if(myArray[i].match(reImg)) {
				texwin.document.write( '<TR><TD ALIGN=center><IMG SRC="http://www.texastwisted.com'+myArray[i]+'" VSPACE="5"' );
				if(noborder) {
					texwin.document.write( '>' );
					}
				else texwin.document.write( ' BORDER="2">' );
				texwin.document.write( '</TD></TR>\n\n' );
			}
			// If it's a flag, write nothing.
			else if(myArray[i].match(reFlag)) {
				texwin.document.write( '' );
			}
	 		// If it's not an image, it's a caption.
			else {
				texwin.document.write( '<TR><TD ALIGN=center CLASS="popup-caption">'+myArray[i] );
				if(number_of_images > 1) texwin.document.write( '<BR><BR>' );
				texwin.document.write( '</TD></TR>\n\n' );
			}
		}
	texwin.document.write( '</TABLE>\n\n\n' );
	}

	// If this is a multiple-image pop-up, provide some extra space below the last object for esthetics.
	if(number_of_images > 1) texwin.document.write( '<BR>\n\n' );

	texwin.document.write( '</BODY>\n' );
	texwin.document.write( '</HTML>' );
	texwin.document.close();

}
// End texPopup

