
/* 
	(c) 2005-2006 Grafikstudio
	Wszystkie prawa zastrzeżone

	UWAGA!
	Dokonanie *jakichkolwiek* zmian w obrębie kodu źródłowego strony
	doprowadzi do utraty gwarancji na poprawne działanie kodu i
	uniemożliwi nieodpłatne naprawy usterek przez wykonawcę, jeżeli 
	takowe wystąpią.

*/

function div_display (name) {
	document.getElementById(name).style.display="block";
}

function div_hide (name) {
	document.getElementById(name).style.display="none";
}

function search_select_all() {
	for (var c=0;c<document.forms["search_form"].elements.length;c++) {
		var e = document.forms["search_form"].elements[c];
		if (e.name != 'search_option_allbox') {
			e.checked = document.search_form.search_option_allbox.checked;
		}
	}
}

function open_image_window (id, width, height) {
	
	var window_width = 0, window_height = 0;

	if ( width < ( window.screen.availWidth - 30 ) ) {
		window_width  = width + 30;
		scrolls='no';
	} else {
		window_width = window.screen.availWidth - 30;
		scrolls='yes';
	}
	if ( height < ( window.screen.availHeight - 130 ) ) {
		window_height =  height + 120;
		scrolls='no';
	} else {
		window_height =  window.screen.availHeight - 130;
		scrolls='yes';
	}
	
	var position_left = 0, position_top = 0;

	position_left = Math.round( (window.screen.availWidth  - window_width ) /2 );
	position_top = Math.round( (window.screen.availHeight - window_height) /2 );
	
	window.open("inc.picture.view.php?gid="+id+"", "null", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars="+scrolls+",resizable=yes,copyhistory=no,width="+window_width+",height="+window_height+",left="+position_left+",top="+position_top+"");
}

function pollVote(formname,maxpicks){
	var f=document.forms[formname];
	var picks=0;
	for (i=0;i<f.elements.length;i++) {
		if ( f.elements[i].getAttribute("type")=="checkbox" && f.elements[i].checked ) { picks++; }
		if ( picks >= maxpicks ) { f.submit(); return true; }
	}
}

