
/*
	(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ą.

*/

var current_link_menu = "";
var current_link_submenu = "";
var visible_submenu = "";
var hovered_category = "";
var hovered_subcategory = "";

function set_visibility (name) {
	if ( name == visible_submenu) {
		visible_submenu = "";
	} else {
		visible_submenu = name;
	}
}

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

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

function mainmenu_hover(name) {
	document.getElementById(name).className="block_menu_link_hover";
}

function mainmenu_unhover(name) {
	if (name != current_link_menu) {
		document.getElementById(name).className="block_menu_link";
	}
}

function submenu_hover(name) {
	document.getElementById(name).className="block_menu_sublink_row_hover";
}

function submenu_unhover(name) {
	if ( name != current_link_submenu ) {
		document.getElementById(name).className="block_menu_sublink_row";
	}
}

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 category_hover(id) {
	document.getElementById('mm_prd_'+id+'').className="block_menu_prd_category_hover";
//	if ( document.getElementById('mm_prd_'+id+'_sub') != null ) {
//		document.getElementById('mm_prd_'+id+'_sub').className="block_menu_prd_category_sub_hover";
//	}
}

function category_unhover(id) {
	if ( id != hovered_category ) {
		document.getElementById('mm_prd_'+id+'').className="block_menu_prd_category";
//		if ( document.getElementById('mm_prd_'+id+'_sub') != null ) {
//			document.getElementById('mm_prd_'+id+'_sub').className="block_menu_prd_category_sub";
//		}
	}
}

function subcategory_hover(id) {
	document.getElementById('mm_prd_sub_'+id+'').className="block_menu_prd_subcategory_hover";
}

function subcategory_unhover(id) {
	if ( id != hovered_subcategory ) {
		document.getElementById('mm_prd_sub_'+id+'').className="block_menu_prd_subcategory";
	}
}

function category_rolldown(id) {
	if (document.getElementById('mm_prd_'+id+'_sub') != null) {
		if ( document.getElementById('mm_prd_'+id+'_sub').style.display == "block" ) {
			document.getElementById('mm_prd_'+id+'_sub').style.display = "none";
		} else {
			document.getElementById('mm_prd_'+id+'_sub').style.display = "block";
		}
	}
}

function products_rolldown() {
	if (document.getElementById('mm_prd_list').style.display == "block") {
		document.getElementById('mm_prd_list').style.display = "none";
	} else {
		document.getElementById('mm_prd_list').style.display = "block";
	}
}

