hi everyone,
i'm a newbie to javascript and desperate to get this to work.
here www.femius.ch/index_new.htm i have used two pieces of code; one to play sound when you click on the song titles as well as the thumbnails, and one to change the picture in the righthand box (when u click song titles). when i use these codes seperately they both work fine, however once i put them on the same link, the sound code stops functioning. As you can see by clicking on the song titles (pic changes, sound does not play). however the same code works fine when u click on the thumbnails (the pic changing code is not used on it). I'd really appreciate any help.
Thanks a million!
Here is the sound code:
--
<script LANGUAGE="JavaScript"><!--
// Preload and play audio files with event handler (MouseOver sound)
// designed by JavaScript Archive, (c)1999
// Get more free javascripts at http://jsarchive.8m.com

var aySound = new Array();
// Below: source for sound files to be preloaded
aySound[0]="Songs/01BeatOfMyHeart.mp3";
aySound[1]="Songs/02ImJustAMan.mp3";
aySound[2]="Songs/03HoldMeTight.mp3";
aySound[3]="Songs/04JustNoMoreCry.mp3";
aySound[4]="Songs/05DaysInParadise.mp3";
aySound[5]="Songs/06WeCanMakeIt.mp3";
aySound[6]="Songs/07Survivor.mp3";
aySound[7]="Songs/08NeverSayGoodbye.mp3";
aySound[8]="Songs/09ForeverAndADay.mp3";
aySound[9]="Songs/10AlwaysLoveYou.mp3";

// DO NOT edit below this line
document.write('<BGSOUND ID="auIEContainer">')
IE = (navigator.appVersion.indexOf("MSIE")!=-1 && document.all)? 1:0;
NS = (navigator.appName=="Netscape" && navigator.plugins["LiveAudio"])? 1:0;
ver4 = IE||NS? 1:0;
onload=auPreload;

function auPreload() {
if (!ver4) return;
if (NS) auEmb = new Layer(0,window);
else {
Str = "<DIV ID='auEmb' STYLE='position:absolute;'></DIV>";
document.body.insertAdjacentHTML("BeforeEnd",Str);
}
var Str = '';
for (i=0;i<aySound.length;i++)
Str += "<EMBED SRC='"+aySound[i]+"' AUTOSTART='FALSE' HIDDEN='TRUE'>"
if (IE) auEmb.innerHTML = Str;
else {
auEmb.document.open();
auEmb.document.write(Str);
auEmb.document.close();
}
auCon = IE? document.all.auIEContainer:auEmb;
auCon.control = auCtrl;
}
function auCtrl(whSound,play) {
if (IE) this.src = play? aySound[whSound]:'';
else eval("this.document.embeds[whSound]." + (play? "play()":"stop()"))
}
function playSound(whSound) { if (window.auCon) auCon.control(whSound,true); }
function stopSound(whSound) { if (window.auCon) auCon.control(whSound,false); }
//-->
</script>
--

and here the pic changing code:
--
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!--

// canManipulateImages - check if the browser we're using can do
// clever stuff with document images.

function canManipulateImages() {
if (document.images)
return true;
else
return false;
}

// loadPosterImage

function loadPosterImage(imageURL) {
if (gImageCapableBrowser) {
document.imagePoster.src = imageURL;
return false;
}
else {
return true;
}
}

// gImageCapableBrowser - is this browser hip to images? Set up
// a global variable so that we don't have to keep calling a function
// (useful if the function becomes costly to compute).

gImageCapableBrowser = canManipulateImages();

// -->
</SCRIPT>
--

and the link to activate them:
<img src="img/01.gif" alt="01 Beat Of My Heart" width="30" height="9"> <a href="javascriptlaySound(0);" onClick="return(loadPosterImage('img/01.jpg'))" class="tracks">Beat Of My Heart</a>

--