

Function.prototype.bind = function(o){ var fn = this; return function(){ return fn.apply(o, arguments); }; };

function navPage(pageAddr, prefixID) {
	//alert(pageAddr + " " + prefixID);
	//alert(prefixID + "gallery_cont");
//var src = "drupal/galleryapi/?random=" + new Date().getTime();

	if(pageAddr.indexOf("?") < 0) {
		pageAddr += "&random=" + new Date.getTime();	
	}
	//$("#" + prefixID + "gallery_cont").parent().load(pageAddr);
	$.get(pageAddr, function(data){ $("#gallery").get()[0].innerHTML = filterAjax.call(this, data); tb_init('a.thickbox, area.thickbox, input.thickbox'); }.bind(this) );
}
//$("#" + prefixID + "gallery_cont").replaceWith( filterAjax.call(this, data) );  }.bind(this)
function nextPage(curPageNum) {

}

function flvplayer_ready() {
	//alert("ready");
	playVideo(1);
}

function playVideo(index) {
//	alert("playVideo");
	//alert(thumburl);
	//alert(videos[index-1].video);
	//alert(videos[index-1].thumb);
	var flvobj = new Object();
	flvobj.vidurl = videos[index-1].video;
	flvobj.thumburl = videos[index-1].thumb;
	flvobj.skinurl = "/swf/SkinUnderAllNoCaption.swf";
	flvobj.offsetHeight = -50;
	flvobj.skinAutoHide = false;
	flvobj.skinBackgroundColor = "0x444444";
	
	//alert(typeof(document.getElementById('piPlayFLV')));
	if(typeof(document.getElementById('piPlayFLV')) == "undefined") {
		embedPlayer();
	}
	document.getElementById('piPlayFLV').loadFLV(flvobj);
}

function embedPlayer() {
//	alert("embed player");
	var so = new SWFObject("swf/piPlayFLV.swf", "piPlayFLV", "400", "320", "9", "#FFFFFF");
	so.addParam('quality', 'high');	so.addParam('wmode', 'transparent');
	so.addParam('allowscriptaccess', 'always');
	so.addParam('allowfullscreen', 'true');	so.addParam('salign', 'lt');
	so.addVariable('callback', 'flvplayer_ready');
	so.write('videoPlayer');
}

//setTimeout(embedPlayer.bind(this), 1200);


