

// some variables to save
var currentItem;

// this function is caught by the JavascriptView object of the player.
function sendEvent(typ,prm) { thisMovie("playerID").sendEvent(typ,prm); };


// these functions is called by the JavascriptView object of the player.
function getUpdate(typ,pr1,pr2,swf) { 
	if(typ == "item") { currentItem = pr1; setTimeout("getItemData(currentItem)",100);}
};


function getItemData(idx) {
	var obj = thisMovie("playerID").itemData(idx);
	//var tmp = document.getElementById("caption"); if (tmp) { tmp.innerHTML = "<b>File:</b> " + obj["file"]; } 
	//$('#caption').load('handler.php', { handler: 'html', callback: 'simplehtml', params: 'file' });
	//var tmp = document.getElementById("caption"); if (tmp) { tmp.innerHTML = "<b>File:</b> " + $.getJSON('http://www.gurbanivichar.com/multimedia/handler.php', { handler: 'simplehtml', callback: 'getarray' }); } 
	var tmp;
	
  $(document).ready(function()
  {
	 $('#info').load('http://www.gurbanivichar.com/multimedia/function.php?file='+obj['file']);
	 
  });

};


// This is a javascript handler for the player and is always needed.
function thisMovie(movieName) {
	return document.getElementsByName(movieName)[0];
};


// This creates the player after the page has finished loading (onload).
function createplayer(xmlFile) {
	var s1 = new SWFObject("http://www.gurbanivichar.com/multimedia/mediaplayer.swf","playerID","450","350","8");
	s1.addParam("allowfullscreen","true");
	s1.addParam("allowscriptaccess","always");
	s1.addVariable("thumbsinplaylist","false");

	s1.addVariable("file",xmlFile);
	s1.addVariable("linktarget","_self");

	s1.addVariable("enablejs","true");
	s1.addVariable("javascriptid","playerID");

	s1.addVariable("width","450");
	s1.addVariable("height","350");
	s1.addVariable("displaywidth","0");
	s1.addVariable('volume','100');

	s1.write("player");
};