jQuery(function(){
	initVideo();
});

function initVideo(){
	var videoHold1 = jQuery('#placaholder-1');
	var videoHold2 = jQuery('#placaholder-2');
	
	if(typeof jwplayer === 'function' && videoHold1.length){
		videoHold1.attr('videoSrc', videoHold1.attr('title')).attr('title', '');
		if(videoHold1.attr('rel')) videoHold1.attr('imageSrc', videoHold1.attr('rel')).attr('rel', '');
		var hold = videoHold1.get(0);
		var videoFile = videoHold1.attr('videoSrc');
		var imageFile = videoHold1.attr('imageSrc');
		if(imageFile){
			jwplayer(hold).setup({
				flashplayer: 'http://www.pv-labs.com/wp-content/themes/pvlabs/swf/player.swf',
				file: videoFile,
				image: imageFile,
				volume: 80,
				width: 370,
				height: 237,
				autostart: false,
				events: {
					// onReady: function() { this.play(); }
				}
			});
		} else {
			jwplayer(hold).setup({
				flashplayer: 'http://www.pv-labs.com/wp-content/themes/pvlabs/swf/player.swf',
				file: videoFile,
				volume: 80,
				width: 370,
				height: 237,
				autostart: false,
				events: {
					// onReady: function() { this.play(); }
				}
			});
		}	
	}
	if(typeof jwplayer === 'function' && videoHold2.length){
		videoHold2.attr('videoSrc', videoHold2.attr('title')).attr('title', '');
		if(videoHold2.attr('rel')) videoHold2.attr('imageSrc', videoHold2.attr('rel')).attr('rel', '');
		var hold = videoHold2.get(0);
		var videoFile = videoHold2.attr('videoSrc');
		var imageFile = videoHold2.attr('imageSrc');
		if(imageFile){
			jwplayer(hold).setup({
				flashplayer: 'http://www.pv-labs.com/wp-content/themes/pvlabs/swf/player.swf',
				image: imageFile,
				file: videoFile,
				volume: 80,
				width: 207,
				height: 115,
				autostart: false,
				events: {
					// onReady: function() { this.play(); }
				}
			});
		} else {
			jwplayer(hold).setup({
				flashplayer: 'http://www.pv-labs.com/wp-content/themes/pvlabs/swf/player.swf',
				file: videoFile,
				volume: 80,
				width: 207,
				height: 115,
				autostart: false,
				events: {
					// onReady: function() { this.play(); }
				}
			});
		}	
	}
}
