var uc = uc || {};
uc.common = uc.common || {};

//Ajaxify content
uc.common.ajaxify = function (timeout) {
	if (timeout == null) timeout = 0;
	
	uc.utils.ajaxifyLink(jQuery('a.ajax-post'), 'POST', function() {uc.common.ajaxify();});
	uc.utils.ajaxifyLink(jQuery('a.ajax'), 'GET', function() {uc.common.ajaxify();});
	uc.utils.ajaxifyLink(jQuery('.ajax a'), 'GET', function() {uc.common.ajaxify();});
	uc.utils.ajaxifyForm(jQuery('form.ajax'), function() {uc.common.ajaxify();});
}


// Process document after its loading
jQuery(document).ready(function() {
	// Ajaxify
	uc.common.ajaxify(200);
	
	// Add help feature to input text
	jQuery('input.help[type=text]').each(function(index) {
		var jq_this = jQuery(this);
		var help = jq_this.val();
		jq_this.focus(function() {if (jq_this.val() == help) jq_this.val('');});
		jq_this.blur(function() {if (jq_this.val() == '') jq_this.val(help);});
	});

	// Instantiate all flow player
	flowplayer(".player-item", "/flashes/flowplayer-3.1.3.swf",
		{
			// configuration for a clip
			clip: {
				autoPlay: true,
		    	autoBuffering: true,
		    	scaling: 'fit',
			},
			// setup controlbar to use skins
			plugins: {
			  	controls: conf.skins.universcine
			}
		});
});

