/*

Genral JavaScript for Aleut Story website - v1.01 (10/31/05)
by Kurt Robar (krobar@krobarstudios.com)
	
*/


function KS_CSS(image) {

	if (document.getElementById){
		if (image == '') { return; };
		if (image > 0 && image < 10) {document.getElementById('ul_box').style.backgroundImage='url(images/ul_'+image+'.jpg)'; }
		else {document.getElementById('ul_box').style.backgroundImage='url(images/spacer.gif)'; };
	}
return;
}

function display_trailer(){

	if (document.getElementById){
		document.getElementById('ul_box').style.backgroundImage='url(images/spacer.gif)';
	}
return;
}

function newWindow(url, width, height) {

	var windowName='spawn'
	if (navigator.appVersion.indexOf('4') != -1) { // Centering the new window on Version 4 Browsers
		xTop = screen.width/2 - (width/2);
		yTop = screen.height/2 - (height/2);
		window.open(url, windowName, 'height='+height+',width='+width+',scrollbars=0,resizable=0,menubar=0,toolbar=0,status=0,location=0,directories=0,left=' + xTop + ',top=' + yTop + '');
	} else {
		window.open(url, windowName, 'height='+height+',width='+width+',scrollbars=0,resizable=0,menubar=0,toolbar=0,status=0,location=0,directories=0,left=150,top=200');
	}
}

function PreloadImages() { //Javascript image preload

	if(document.images){
 		if(!document.imagePreload) { document.imagePreload=new Array(); };
		var i;
		var j = document.imagePreload.length;
		var a = PreloadImages.arguments;
		for(i=0; i<a.length; i++)
		if (a[i].indexOf("#")!=0){
			document.imagePreload[j]=new Image();
			document.imagePreload[j++].src=a[i];
		}
	}
   
}

function rollover(picName, newSrc) {
	if (document.images) {
		document[picName].src = newSrc;
	}
	return;
}


function galleryWindow(title, picture, name, caption, description) { 

	var width = '480';
	var height = '260';
	var windowName='spawn';

	if (navigator.appVersion.indexOf('4') != -1) { // Centering the new window on Version 4 Browsers
		xTop = screen.width/2 - (width/2);
		yTop = screen.height/2 - (height/2);
		gWindow=window.open('', windowName, 'height='+height+',width='+width+',scrollbars=0,resizable=0,menubar=0,toolbar=0,status=0,location=0,directories=0,left=' + xTop + ',top=' + yTop + '');
	} else {
		gWindow=window.open('', windowName, 'height='+height+',width='+width+',scrollbars=0,resizable=0,menubar=0,toolbar=0,status=0,location=0,directories=0,left=150,top=200');
	}

	gWindow.document.write('<HTML><head><TITLE>'+title+'</TITLE>')
	gWindow.document.write('<link href="as_css_01.css" rel="stylesheet" MEDIA="screen"></head>')
	gWindow.document.write('<BODY bgcolor="#ffffff" leftmargin="0" marginheight="0" marginwidth="0" topmargin="0">')
	gWindow.document.write('<table WIDTH="470" BORDER="0" CELLSPACING="0" CELLPADDING="0" align="center" HEIGHT="250"><tr><td><DIV class="gallery_content">')
	gWindow.document.write('<img src="'+picture+'" alt="" BORDER="0"><br>')
	gWindow.document.write('<FONT id="name">'+name+'</FONT><br>')
	gWindow.document.write('<FONT id="caption">'+caption+'</FONT><br><br>')
	gWindow.document.write('<FONT id="description">'+description+'</FONT><br><br>')
	gWindow.document.write('<FORM><input type="BUTTON" value="Close Window" ONCLICK="window.close()"></FORM>')
	gWindow.document.write('</DIV></td></tr></table></BODY></HTML>')

	gWindow.document.close()
	self.name="main"
}


function documentWindow(title, image, download) { 

	var width = '680';
	var height = '400';
	var windowName='dSpawn';

	if (navigator.appVersion.indexOf('4') != -1) { // Centering the new window on Version 4 Browsers
		xTop = screen.width/2 - (width/2);
		yTop = screen.height/2 - (height/2);
		gWindow=window.open('', windowName, 'height='+height+',width='+width+',scrollbars=1,resizable=0,menubar=0,toolbar=0,status=0,location=0,directories=0,left=' + xTop + ',top=' + yTop + '');
	} else {
		gWindow=window.open('', windowName, 'height='+height+',width='+width+',scrollbars=1,resizable=0,menubar=0,toolbar=0,status=0,location=0,directories=0,left=150,top=200');
	}

	gWindow.document.write('<HTML><head><TITLE>'+title+'</TITLE>')
	gWindow.document.write('<link href="../as_css_01.css" rel="stylesheet" MEDIA="screen"></head>')
	gWindow.document.write('<BODY bgcolor="#ffffff" leftmargin="0" marginheight="0" marginwidth="0" topmargin="0">')
	gWindow.document.write('<table WIDTH="470" BORDER="0" CELLSPACING="0" CELLPADDING="0" align="center" HEIGHT="250"><tr><td><DIV class="gallery_content">')
	gWindow.document.write('<img src="'+image+'" alt="" BORDER="0"><br>')
	//gWindow.document.write('<FONT id="name">'+name+'</FONT><br>')
	//gWindow.document.write('<FONT id="caption">'+caption+'</FONT><br><br>')
	//gWindow.document.write('<FONT id="description">'+description+'</FONT><br><br>')
	gWindow.document.write('<FORM><input type="BUTTON" value="Close Window" ONCLICK="window.close()">&nbsp;&nbsp;<input type="BUTTON" value="Download PDF" ONCLICK="document.location.href=\''+download+'\';return false"></FORM>')
	gWindow.document.write('</DIV></td></tr></table></BODY></HTML>')

	gWindow.document.close()
	self.name="main"
}


function clipWindow(title, movie, wHeight, mHeight, mWidth, name, description) { 

	var width = '540';
	var height = parseInt(wHeight,10);
	var windowName='cSpawn';
	mHeight = parseInt(mHeight,10) + 16;

	if (navigator.appVersion.indexOf('4') != -1) { // Centering the new window on Version 4 Browsers
		xTop = screen.width/2 - (width/2);
		yTop = screen.height/2 - (height/2);
		cWindow=window.open('', windowName, 'height='+height+',width='+width+',scrollbars=0,resizable=0,menubar=0,toolbar=0,status=0,location=0,directories=0,left=' + xTop + ',top=' + yTop + '');
	} else {
		cWindow=window.open('', windowName, 'height='+height+',width='+width+',scrollbars=0,resizable=0,menubar=0,toolbar=0,status=0,location=0,directories=0,left=150,top=200');
	}

	cWindow.document.write('<HTML><head><TITLE>'+title+'</TITLE>')
	cWindow.document.write('<link href="as_css_01.css" rel="stylesheet" MEDIA="screen"></head>')
	cWindow.document.write('<BODY bgcolor="#ffffff" leftmargin="0" marginheight="0" marginwidth="0" topmargin="0">')
	cWindow.document.write('<table WIDTH="480" BORDER="0" CELLSPACING="0" CELLPADDING="0" align="center" HEIGHT="250"><tr><td><DIV class="gallery_content">')
	cWindow.document.write('<OBJECT classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" height="'+mHeight+'" width="'+mWidth+'">')
	cWindow.document.write('<PARAM name="src" value="'+movie+'">')
	cWindow.document.write('<PARAM name="autoplay" value="true">')
	cWindow.document.write('<PARAM name="controller" value="true">')
	cWindow.document.write('<EMBED height="'+mHeight+'" PLUGINSPAGE="http://www.apple.com/quicktime/download/" src="'+movie+'" TYPE="video/quicktime" width="'+mWidth+'" CONTROLLER="true" AUTOPLAY="true">')
	cWindow.document.write('</OBJECT>')
	cWindow.document.write('<br><br><FONT id="name">'+name+'</FONT><br>')
	//cWindow.document.write('<FONT id="description">'+caption+'</FONT><br><br>')
	cWindow.document.write('<FONT id="caption">'+description+'</FONT><br><br>')
	cWindow.document.write('<FORM><input type="BUTTON" value="Close Window" ONCLICK="window.close()"></FORM>')
	cWindow.document.write('</DIV></td></tr></table></BODY></HTML>')

	cWindow.document.close()
	self.name="main"
}

function downloadFile(url) {
	this.document.location.href = url;
}

