// JavaScript Document

function aTrack(artist0,title0,url0){
this.artist=artist0;
this.title=title0;
this.url=url0;
}

var aradio = new Array()
aradio[0]= new aTrack("The New Strawberry Zots", "Heartful of Soul","gfx/heartfullofsoul.mp3");
aradio[1]= new aTrack("The New Strawberry Zots","Hey Hey Hey","zots/heyheyhey.mp3");
aradio[2]= new aTrack("The New Strawberry Zots","It Gets Dark","zots/itGetsDark.mp3");
aradio[3]= new aTrack("The New Strawberry Zots","Lie To Me","zots/lietome.mp3");
aradio[4]= new aTrack("The New Strawberry Zots","So I Did","zots/soidid.mp3");
aradio[5]= new aTrack("The New Strawberry Zots","Space Oddity","zots/space_oddity.mp3");
aradio[6]= new aTrack("The New Strawberry Zots","Star Star Star","zots/starstarstar.mp3");
aradio[7]= new aTrack("The New Strawberry Zots","There","zots/there.mp3");
aradio[8]= new aTrack("The New Strawberry Zots","Waste of Time","zots/wasteOfTime.mp3");


function getArr(arr){
i = (arr.length-1)*Math.random();
i = Math.round(i);
return arr[i]
}

function loadRadio(index){
if (index == null ) {
  var player = getArr(ambient);
  }
  else {
  var player = aradio[index];
  }
  var target = 'audio-player';
  var content = "<div style=\"padding: 0 0 3px 0;\"><strong>Now Playing: </strong>" +  player.title ;
  content = content + "</div><br><object><embed src=\"../media/" + player.url + "\" height='20'  /> </object>";
  $(target).update(content);
}

var posx; var posy;
function getMouse(e) {

}

function positionLayer(e, objectName) {
  var posx=0; var posy=0;
  var ev=(!e)?window.event:e;//IE:Moz
  if (ev.pageX){//Moz
    posx=ev.pageX+window.pageXOffset;
    posy=ev.pageY+window.pageYOffset;
  } 
  else if(ev.clientX){//IE
    posx=ev.clientX+document.body.scrollLeft;
    posy=ev.clientY+document.body.scrollTop;
  }
  
  else{return false}//old browsers
  
  headblock = document.getElementById(objectName);
  x = (posx - 450) + "px";
  y = (posy + 50) + "px";
  headblock.style.left = x;
  headblock.style.top = y;
}
