function getFlashMovieObject(movieName) {
	if (window.document[movieName]) return window.document[movieName];
	if (navigator.appName.indexOf("Microsoft Internet")==-1)if (document.embeds && document.embeds[movieName])return document.embeds[movieName];
		else return document.getElementById(movieName);
}

function checkFields(fields) {
	var id = '';
	for(i in fields) {
		if(parseInt(i) == i) id = 'k'+i; else id = i;
		if(document.getElementById(id))
			if(document.getElementById(id).value == fields[i]) document.getElementById(id).value = '';
	}
}

function shareUrl(elem, w, h, t)
{
	var st = t == undefined ? 0 : t;
	
	window.open($(elem).attr('href')+(st ? encodeURIComponent(document.title.toString()) : ''), 'share_url', 'width='+w+',height='+h).focus();

	return false;
}

$(document).ready(function() {

	$('a.colorbox').colorbox();
	$('a.ajaxbox').click(function(e){
		e.preventDefault();
		var self = $(this);
		if(self.attr('ajax') != undefined)
		{
			var url = $(this).attr('ajax');
			var width = parseInt($(this).attr('ajaxwidth')) || false;
			var height = parseInt($(this).attr('ajaxheight')) || false;
			
			$.fn.colorbox({
				href: url + (url.indexOf('?')>0 ? '&' : '?' ),
				width: width,
				height: height,
				innerWidth: false, 
				classAdd: self.attr('ajaxclass')
			});
		} else
			$(this).colorbox({width: false, innerWidth: false, classAdd: self.attr('ajaxclass')});
	});

});
