var _ajaxServer = '/ajax_server.php';

var Layout = {

	setHeight			: function(left, right)
	{
		if ($(left).height() > $(right).height())
			return $(right).css('height', $(left).height() + 'px');
		return $(left).css('height', $(right).height() + 'px');
	},
	
	fadeItems			: function(container)
	{
		$(container).each(function(el) {
		
		});
	}
}

function popup(url, width, height, windowName)
{
	return !window.open(url, windowName, "width="+width+",height="+height+",status=no,toolbar=no,location=no,scrollbars=no");
}

$(window).load(function() {
	$('.luister_live_link').each(function(){
		this.onclick = function() {
			return popup(this.href, 500, 350, 'luister_live');
		}
	});
	try {
		if (location.href.match(/media_archief/i)) {
			$('#series_id').bind('change', function() {
				$.post(_ajaxServer + '?app=frontpage&action=getMedia',
				{
					seriesId: this.options[this.selectedIndex].value
				}, 
			  	function(data){
			  		// remove all childs
			  			$('#delivery_id').children().remove();
			  		if (data) {
			  			var objectData =  eval('(' + data + ')');
			  			if (objectData.length < 0) {
							  $('#delivery_id').append('<option value="0">Er zijn geen afleveringen gevonden</option>');
						} else {
							$(objectData).each(function(el) {
								$('#delivery_id').append('<option value="' + this.id + '">' + this.title + '</option>');
							});
						}
			  		} else {
					  $('#delivery_id').append('<option value="0">Er zijn geen afleveringen gevonden</option>');
					}
					return false;
			  	});
			});
		}
	} catch (error) {
	
	}
});
