//-------------------------------------------------------------------------------------------------------------------
// systemove funkce - ruzne funkce zajistujici javascriptovou obsluhu stranek
//-------------------------------------------------------------------------------------------------------------------

function wnd_open(img_url, target) {
	var new_wnd = window.open(img_url, target, "resizable=yes, toolbar=no, menubar=no, scrollbars=no, status=yes");
}

function mov_qm(id) {
	var obj = document.getElementById(id);
	obj.style.visibility = "visible";
	obj.style.display = "inline";
	obj.style.zindex = 1;
}

function mou_qm(id) {
	var obj = document.getElementById(id);
	obj.style.visibility = "hidden";
	obj.style.display = "none";
	obj.style.zindex = -1;
}

//funkce na dynamicke efekty polozek menu pro najeti/odjeti mysi
var prev_mit_bg = "";

function mov(obj) {
	//barva pozadi menupolozky
	prev_mit_bg = obj.style.backgroundColor;
	obj.style.backgroundColor = '#FFE680';
	obj.style.borderColor = '#FFE680';
	
	//barva textu menupolozky
	var atxt = obj.firstChild;
	//atxt.style.color = "#FFFFFF";
	
	//var bullet_obj = obj.firstChild;
	//bullet_obj.style.width = 0;
}

function mou(obj) {
	//barva pozadi menupolozky
	obj.style.backgroundColor = prev_mit_bg;
	obj.style.borderColor = prev_mit_bg;
	prev_mit_bg = "transparent";
	
	//barva textu menupolozky
	var atxt = obj.firstChild;
	//atxt.style.color="#000000";
	
	//var bullet_obj = obj.firstChild;
	//bullet_obj.style.width = 0;
}


//funkce na zabarvovani radku v tabulkach
var prev_bg = "";

function trmov(obj) {
	prev_bg = obj.style.backgroundColor;
	obj.style.backgroundColor = "#E1E8FF";
}

function trmou(obj) {
	obj.style.backgroundColor = prev_bg;
	prev_bg = "transparent";
}

//nevim... asi obrazky prezentace nacitane do pameti
var itmp = new Image();
itmp.src = "img/mi_bg_repeat.png";

//open new image window
function img_wnd_open( imw_object , imw_descriptionArg , imw_widthArg , imw_heightArg ) {
	imw_imgUrl = imw_object.href;
	imw_images = imw_object.getElementsByTagName( 'img' );
	
	if (imw_descriptionArg != undefined && /[a-zA-Z]{2,}/.test(imw_descriptionArg)) {
		//alert(imw_descriptionArg);
		imw_description = imw_descriptionArg;
	} else {
		imw_description = imw_images[0].alt;
	}
	
	imw_imageFull = new Image();
	imw_imageFull.src = imw_imgUrl;
	
	imw_fullWidth = (( imw_imageFull.width > 0 ) ? imw_imageFull.width : 550);
	imw_fullHeight = (( imw_imageFull.height > 0 ) ? imw_imageFull.height : 550);
	
	if (/[0-9]{2,}/.test(imw_widthArg)) {
		imw_width = imw_widthArg;
	} else {
		imw_width = imw_fullWidth + 100;
	}
	if (/[0-9]{2,}/.test(imw_heightArg)) {
		imw_height = imw_heightArg;
	} else {
		imw_height = imw_fullHeight + 150;
	}
	
	if( imw_width > ( screen.width * 0.8 ) ) { imw_width = screen.width * 0.8; }
	if( imw_height > ( screen.height * 0.8 ) ) { imw_height = screen.height * 0.8; }
	
	var imw_url_param = 'img_url='+ imw_imgUrl +'&img_descr='+ imw_description +' ';
	var imw_window_url = imw_object.href.replace("/normal/", "/preview_image.php?"+imw_url_param);
	imw_window_url = imw_window_url.replace(/[a-zA-Z0-9\-\_\%\*]{1,}[\.][a-zA-Z0-9\-\_\%\*]{1,}$/, "");
	
	window.open(imw_window_url, 'imgwnd', 'scrollbars=yes, menubar=no, toolbar=no, resizable=yes, status=no, width='+imw_width+', height='+imw_height);
	
	return false;
}
