var prosecSubRegios = new Array();
prosecSubRegios['show'] = ['Oostende', 'Brugge'];//[1, 6];


$(document).ready(function(){
	$('#center .node img').each(function(){
		if($(this).css('float')=='left') {
				$(this).addClass('imgleft');
		}
		else if($(this).css('float')=='right') {
				$(this).addClass('imgright');
		}
		
	});
	
	$('.views-exposed-widget:even').addClass('even');
	$('.views-exposed-widget:odd').addClass('odd');
	
	
	$('#chk-regios-prosec input[type=checkbox]').each(function(){
		var label = $(this).attr('id').replace('edit-tid-1-', '');
		if(!(label == 1 || label == 6)){
			$(this).addClass('hidden').hide();
			$(this).parent().parent().addClass('hidden').hide();
		}else{
			$(this).click(function(){checkSubRegios();});
		}
	});
	$('#chk-regios-prosec').removeClass('hidden');
	checkSubRegios();
	
	$('.addthis-button').html(addthis_label);
	
	/*INPUT*/
	//$('#block-views--exp-zoekscherm-page_1 #edit-keys').example('Typ hier je trefwoord');
	//$('#block-views--exp-zoekscherm-default #edit-keys').example('Typ hier je trefwoord');
	
	/*SUPERSIZE*/
	$.fn.supersized.options = {
		startwidth: 1920,
		startheight: 800,
		minsize: .5,
		slideshow: 0,
		vertical_center: 1,
		slideinterval: 5000
	};
    $('#supersize').supersized();
	

	//resize
	resizeActions();     
});

$(window).bind("resize", function(){
	resizeActions();
});

function checkSubRegios(type){
	if(type){
		var j;
		//alert(type + '-' + prosecJSArray['all-' + type]);
		for(j=0; j < prosecJSArray['all-' + type].length; j++){
			//alert($('#chk-regios-prosec #edit-tid-1-' + prosecJSArray['all-' + type][j] + '.hidden').attr('id'));
			$('#chk-regios-prosec #edit-tid-1-' + prosecJSArray['all-' + type][j] + '.hidden').click();
		}
		//alert($('#chk-regios-prosec input:checked').length);
	}else{
		$('#chk-regios-prosec input.hidden:checked').click();
		if($('#chk-regios-prosec #edit-tid-1-6').attr('checked')) checkSubRegios('Oostende');
		if($('#chk-regios-prosec #edit-tid-1-1').attr('checked')) checkSubRegios('Brugge');
	}
}

function resizeActions(){
	var browserwidth = $(window).width();
	var browserheight = $(window).height();
	var footerheight = $('#wrapper_footer').height();
	
	var leftOver = browserheight - footerheight ;	
	
	if(leftOver> $('#wrapper').height() ){
		$('#wrapper').css('height',leftOver+'px');
	}
}

function openLogin(){
	newWindow('http://downloads.buro2.be/htcomnet', 'popup', 800, 500, 1, 1, 0, 0, 0, 0, 0); return false;
	
	/*
	"this.href" refers to the URL given in the "a" tag; "'popup'" is the name of the popup window;
	600 is the width of the popup window; 500 is the height of the popup window; the numbers that
	follow designate whether a property is turned on ("1") or off ("0"), in this order:
	scrollbars, resizable, menubar, toolbar, addressbar, statusbar, fullscreen
	*/

	//window.open('http://downloads.buro2.be/htcomnet','Kyotopark-login','width=700,height=500,scrollbars=yes,toolbar=no,location=no'); return false
}

function newWindow(a_str_windowURL, a_str_windowName, a_int_windowWidth, a_int_windowHeight, a_bool_scrollbars, a_bool_resizable, a_bool_menubar, a_bool_toolbar, a_bool_addressbar, a_bool_statusbar, a_bool_fullscreen) {
  var int_windowLeft = (screen.width - a_int_windowWidth) / 2;
  var int_windowTop = (screen.height - a_int_windowHeight) / 2;
  var str_windowProperties = 'height=' + a_int_windowHeight + ',width=' + a_int_windowWidth + ',top=' + int_windowTop + ',left=' + int_windowLeft + ',scrollbars=' + a_bool_scrollbars + ',resizable=' + a_bool_resizable + ',menubar=' + a_bool_menubar + ',toolbar=' + a_bool_toolbar + ',location=' + a_bool_addressbar + ',statusbar=' + a_bool_statusbar + ',fullscreen=' + a_bool_fullscreen + '';
  var obj_window = window.open(a_str_windowURL, a_str_windowName, str_windowProperties)
    /*if (parseInt(navigator.appVersion) >= 4) {
      obj_window.window.focus();
    }
    */
}
