// JavaScript Document
// Pop-Up Audio Embedder Script by David Battino, www.batmosphere.com; 
// Object tag implementation by Mark Levitt, http://digitalmedia.oreilly.com
// OK to use if this notice is included
var UniqueID = 314 // Make each link open in a new window.
function AudioPop(soundfiledesc,soundfilepath) {
PlayerWin = window.open('',UniqueID,'width=320,height=190,top=0,left=0,resizable=0,scrollbars=0,titlebar=0,toolbar=0,menubar=0,status=0,directories=0,personalbar=0');
PlayerWin.focus(); 
var winContent = "<html><head><title>" + soundfiledesc + "</title></head><body bgcolor='#ff9900'>";
winContent += "<b style='font-size:18px;font-family:Verdana,sans-serif;line-height:1.5'>" + soundfiledesc + "</b>";

winContent += "<object width='300' height='42'>";
winContent += "<param name='src' value='" +  soundfilepath + "'>";
winContent += "<param name='autoplay' value='true'>";
winContent += "<param name='controller' value='true'>";
winContent += "<param name='bgcolor' value='#ff9900'>";
winContent += "<embed src='" + soundfilepath + "' autostart='true' loop='false' width='300' height='42' controller='true' bgcolor='#ff9900'></embed>";
winContent += "</object>";

winContent += "<p style='font-size:12px;font-family:Verdana,sans-serif;text-align:center'><a href='"+soundfilepath+"'>Download this file</a> <span style='font-size:10px'>(right-click or Option-click)</span></p>";

winContent += "<form><div align='center'><input type='button' value='close this window' onclick='javascript:window.close();'></div></form>";
winContent += "</body></html>";
PlayerWin.document.write(winContent);
PlayerWin.document.close(); // "Finalizes" new window
UniqueID = UniqueID + 1
}

///////////////////////////////////////////////////

// Pop-Up Photo Embedder by David Battino, www.batmosphere.com
// OK to use if this notice is included

var UniqueID = 314 // Identify pop-ups so subsequent ones don't replace current one; increment each time function runs. 
// Could pass this parameter to the function so clicking the link twice wouldn't open another copy....
var now = new Date

function PhotoPop(filedesc,filepath,origwidth,orighite,caption,lang) {

// languages options
if (lang == 'es')
	{ 
	var langClose = 'Cerrar ventana';
	var langClick = 'Click-derecho o Opcion-click';
	var langDown = 'Descargar archivo';
	}
else
	{ 
	var closeWin = 'Close this window';
	var langClick = 'Right-click or Option-click';
	var langDown = 'Download file';	
	}

var PopWin = window.open('',UniqueID,'top=0,left=0,position=0,width='+screen.availWidth+',height='+screen.availHeight+',resizable=1,scrollbars=1,titlebar=0,toolbar=0,menubar=0,status=0,directories=0'); 
PopWin.focus(); 

var winContent = "<html><head><title>" + filedesc + "</title>";
winContent += "<link href='web.css' rel='stylesheet' type='text/css'>";
winContent += "</head>";

winContent += "<body class='mplayer'>";
winContent += "<div align='center'><div class='mplayer'><form>";
winContent += "<h3><br>" + filedesc + "</h3>";
winContent += "<img src='" + filepath + "' id='image1' name='image1' alt='Loading " + filedesc + " image...' width='" + origwidth + "' height='" + orighite + "'title='" +filedesc + "'>";
winContent += "<p style='font-size:12px;font-family:Verdana,sans-serif;text-align:center'>" + caption + "</p>";

winContent += "<br><input type='button' value='" + langClose + "' onClick='javascript:window.close()'><br><br>";
winContent += "</form></div></div>";
winContent += "</body></html>";
PopWin.document.write(winContent);
PopWin.document.close(); // "Finalizes" new window
UniqueID = UniqueID + 1 // gives subsequent pop-ups new ID
}

///////////////////////////////////////////////////

// Pop-Up Audio/Photo Embedder Script by David Battino, www.batmosphere.com
// v 2005-10-04
// OK to use if this notice is included

function EnhAudioPop(popuptitle,imgpath,imgwidth,imgheight,caption,soundpath,UniqueID,lang) { // Add error handling?

// languages options
if (lang == 'es')
	{ 
	var langClose = 'Cerrar ventana';
	var langClick = 'Click-derecho o Opcion-click';
	var langDown = 'Descargar archivo';
	}
else
	{ 
	var closeWin = 'Close this window';
	var langClick = 'Right-click or Option-click';
	var langDown = 'Download file';	
	}

     var winWidth = Number(imgwidth) + 100;
     var rawHeight = Number(imgheight) + 250 + caption.length/7; // calculate window height based on caption length
     var winHeight = Math.round(rawHeight * Math.pow(10,0))/Math.pow(10,0); // round to integer
     MediaWin = window.open('',UniqueID,'width=' + winWidth + ',height=' + winHeight + ',top=0,left=0,resizable=1,scrollbars=0,titlebar=0,toolbar=0,menubar=0,status=0,directories=0,personalbar=0');
     MediaWin.focus();
     var winContent = "<html><head><title>" + popuptitle + "</title>";
	winContent += "<link href='web.css' rel='stylesheet' type='text/css'>";	 
	 winContent += "</head>";
     winContent += "<body class='mplayer'>";
     winContent += "<div align='center'><div class='mplayer'>";
     winContent += "<img src='" + imgpath + "' id='image1' border='2' alt='" + popuptitle + "' width='" + imgwidth + "' height='" + imgheight + " 'title='" + popuptitle + "' />";
     winContent += "<br />";
     winContent += "<object width='" + imgwidth + "' height='30' >"; // add 4 to width to align controller with img border?
     winContent += "<param name='src' value='" + soundpath + "'>";
     winContent += "<param name='autoplay' value='true'>";
     winContent += "<param name='controller' value='true'>";
     winContent += "<param name='bgcolor' value='#ffffff'>";
     winContent += "<embed src ='" + soundpath + "' autostart='true' loop='false' width='" + imgwidth + "' height='30' controller='true' bgcolor='#ffffff'>";
     winContent += "</embed></object>";

     winContent += "<div style='width: " + imgwidth + "px; margin: 0px; padding: 0px; text-align:left;'>"; // restrict caption width to image width
     winContent += "<p style='font-size:12px;font-family:Verdana,sans-serif'><b>"+ popuptitle +":</b> " + caption + "</p>";
     winContent += "</div>";
     winContent += "<p style='font-size:12px;font-family:Verdana,sans-serif'><a href='" + soundpath +"'>" + langDown + "</a> <span style='font-size:9px'>(" + langClick + ")</span>";
     winContent += "<br /><a href='#' onClick='javascript:window.close();'>" + langClose + "</a></p>";
     winContent += "</div></div>";
     winContent += "</body></html>";
     MediaWin.document.write(winContent); 
     MediaWin.document.close(); // "Finalizes" new window
}

// Opens popup resizing to image

// Set the horizontal and vertical position for the popup

PositionX = 100;
PositionY = 100;

// Set these value approximately 20 pixels greater than the
// size of the largest image to be used (needed for Netscape)

defaultWidth  = 300;
defaultHeight = 300;

// Set autoclose true to have the window close automatically
// Set autoclose false to allow multiple popup windows

var AutoClose = true;

// Do not edit below this line...
// ================================
if (parseInt(navigator.appVersion.charAt(0))>=4){
var isNN=(navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
var optIE='scrollbars=no,width=500,height=400,left='+PositionX+',top='+PositionY;

function popImage(imageURL,imageTitle){
if (isNN){imgWin=window.open('about:blank','',optNN);}
if (isIE){imgWin=window.open('about:blank','',optIE);}
with (imgWin.document){
writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');writeln('<sc'+'ript>');
writeln('var isNN,isIE;');writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
writeln('isNN=(navigator.appName=="Netscape")?1:0;');writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
writeln('function reSizeToImage(){');writeln('if (isIE){');writeln('window.resizeTo(100,100);');
writeln('width=100-(document.body.clientWidth-document.images[0].width);');
writeln('height=100-(document.body.clientHeight-document.images[0].height);');
writeln('window.resizeTo(width,height);}');writeln('if (isNN){');       
writeln('window.innerWidth=document.images["George"].width;');writeln('window.innerHeight=document.images["George"].height;}}');
writeln('function doTitle(){document.title="'+imageTitle+'";}');writeln('</sc'+'ript>');
if (!AutoClose) writeln('</head><body scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
else writeln('</head><body scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
writeln('<img name="George" src='+imageURL+' style="display:block"></body></html>');
close();
}}