//audio_player-PV-CLASSIC-V3.40.00
//No customization required
//
// JavaScript Document
// Opens new window, starts playing an MP3 file in an embedded player
// Could be adapted to play other file types (see BatmoAudioPop!)
// 
// Insert the following as a link:
// 			javascript:popup_audio_player(sound,label,sublabel,picture,caption,width,height,scrollbars,autoplay)
//   DO NOT PUT ANY / IN THE VARIABLES, it will not work (probably a bug in Javascript!)
//   WARNING: ALWAYS put at least '' or 0 between commas for each variable!
// - sound: filename is required. The sound file MUST be in the folder ../audio/
// - label: Defaults to the sound filename unless value = 'none'
// - sublabel: Optional, no default.
// - caption: optional
// - picture: The picture file MUST be in the folder images/. 
//            Defaults to imagesTemplates/audio_image_default.jpg if it exists, if not, no picture is shown.
// - width & height: DO NOT LEAVE BLANK, always enter digits, 0 means use defaults: 460 by 530
// - scrollbars: yes or no, default is no
//
// Based on Pop-Up Embedder Script by David Battino, www.batmosphere.com
// Version 2006-05-31  
// OK to use if this notice is included
//
// To make it work you need the following:
//
//	- scripts/popup_audio_player.js
//	- scripts/embed_audio_player.js
//	- css/style-popups.css (customize as wanted...)
//	- _audio_player.php
//	
//	- the following script in the page that calls this function
//    possibly embedded in the common_java_scripts library item or in the Master template:
//	<script language="JavaScript" src="scripts/popup_audio_player.js"></script>
//
//
  
function popup_audio_player(sound,label,sublabel,caption,picture,width,height,scrollbars) {

if (isUndefined(width)) var width = 460;
if (isUndefined(height)) var height = 500;
if (isUndefined(scrollbars)) var scrollbars = 'no';
if (isUndefined(label)) var label = '';
if (isUndefined(sublabel)) var sublabel = '';
if (isUndefined(picture)) var picture = '';
if (isUndefined(caption)) var caption = '';

// NO SLASHES ACCEPTED IN THE FOLLOWING LINE!!!! - Player will not work, cause unknown, probably bug somewhere in Javascript player???
var newWindow = window.open('_audio_player.php?sound=' + escape(sound) + '&label=' + escape(label) + '&sublabel=' + escape(sublabel) + '&picture=' + picture + '&caption=' + escape(caption) + '&width=' + width + '&height=' + height,'PVaudioPlayer','scrollbars=' + scrollbars + ',menubar=no,height=' + height + ',width=' + width + ',resizable=yes,toolbar=no,location=no,status=no');

newWindow.focus ( );
}

function isUndefined(a) {
    return typeof a == 'undefined';
} 
