﻿$(document).ready( function() {
	resizeContent();
	window.onresize = resizeContent;
});

function resizeContent() {
	// mémoriser ancienne valeur content width
	var oldContentWidth = $('#content').css('width');

	// calculer largeur disponible et appliquer
	var totalWidth = $(this).width();
	var leftWidth = $('#left').width();
	var rightWidth = $('#right').width();
	var contentWidth = totalWidth - leftWidth - rightWidth - 50;
	$('#content').css('width', contentWidth);

	// vérifier largeur vignette et list
	if ( $('#content .list').length > 0 ) {
		var vignetteWidth = $('#content .vignette').width();
		var listWidth = $('#content .list').width();
		// si largeur list < largeur vignette on remet l'ancienne largeur
		if ( vignetteWidth >= listWidth ) {
			$('#content').css('width', oldContentWidth);
		}
	}
}

function popup_vue( url, title, left, top, width, height ) {
   title = "panoramic_city";
   xyz = window.open( url, title, "width=" + width + ",height=" + height + ",status=yes,scrollbars=yes,location=no");
   xyz.moveTo(left,top);
   xyz.location = url;
   xyz.focus();
}

function select_galerie( critere, value ) {
	document.mainForm.page.value = "galerie";
	request = "";
	sep = "?";
	if ( critere != '' ) {
		request = request + sep + "c_critere=" + critere;
		sep = "&";
	}
	if ( value != '' ) {
		request = request + sep + "c_value=" + value;
	}
	//alert(request);
	document.mainForm.action = "index.php" + request;
	document.mainForm.submit();
}
