function restartGif(){
  for(var i=0; i<document.images.length; i++){
    var img = document.images[i];
    var imgName = img.src.toUpperCase();
    if (imgName.substring(imgName.length-3, imgName.length) == "GIF"){
      img.src = img.src;
    }
  }
}

var currentItem; var showFlag=false;

function sendEvent(typ,prm) { 
  restartGif();
  thisMovie("thePlayerId").sendEvent(typ,prm); 
};

var currentItem;

function getUpdate(typ, pr1, pr2, pid) {
  if(typ == 'item')
  {
    currentItem = pr1;
    setTimeout("getItemData(currentItem)", 100);
  }
};

function getItemData(idx) {
  var obj = thisMovie('thePlayerId').itemData(idx);
  var t = document.getElementById('testing');
  t.innerHTML = obj['title'];
};

function gid(name) {
  return document.getElementById(name);
};



function thisMovie(movieName) {
    if(navigator.appName.indexOf("Microsoft") != -1) {
    return window[movieName];
  } else {
    return document[movieName];
  }
};

function createPlayer(theFile) {
  var s = new SWFObject("js/mediaplayer.swf","thePlayerId","1","1","7");
  s.addParam("allowfullscreen","true");
  s.addVariable("file",theFile);
  s.addVariable("width","1");
  s.addVariable("height","1");
  s.addVariable("displayheight","1");
  s.addVariable("overstretch","fit");
  s.addVariable("showicons","false");
  s.addVariable("autostart","true");
  s.addVariable('frontcolor','0x990099'); 
  s.addVariable('lightcolor','0xFF00FF');
  s.addVariable("enablejs","true");
  s.addVariable("javascriptid","thePlayerId"); 
  s.write("placeholder");
}

function createWindow(adr) { 
  showFlag=true;
  sendEvent("stop");
  document.getElementById("placeholder").style.visibility="hidden";
  var pWin=window.open(adr, "playerWin", "width=300,height=330,left=100,top=200,resizable=yes");
  pWin.focus();
}

function showhide() { 
    document.getElementById("placeholder").style.visibility="hidden";
}
