	
var sel_okno=0;
var chat_okno=0;
var comm_okno=0;

function show_chat(sel_link,sirka,vyska){
	if(sel_okno){
		sel_okno.close();
	}
	sel_x=((screen.width-sirka)/2);
	sel_y=((screen.height-vyska)/2);

	if(sel_x<0){
		sel_x=0;
	}
	if(sel_y<0){
		sel_y=0;
	}

	sel_okno = window.open(sel_link,"img_okno","width="+sirka+",height="+vyska+",left="+
	sel_x+",top="+sel_y+
	",toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,dependant=0");
}

function show_sel(sel_link,sirka,vyska){
	if(sel_okno){
		sel_okno.close();
	}
	sel_x=((screen.width-sirka)/2);
	sel_y=((screen.height-vyska)/2);

	if(sel_x<0){
		sel_x=0;
	}
	if(sel_y<0){
		sel_y=0;
	}

	sel_okno = window.open(sel_link,"img_okno","width="+sirka+",height="+vyska+",left="+
	sel_x+",top="+sel_y+
	",toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,dependant=1");
}

function show_comm(comm_link,sirka,vyska){
	if(comm_okno){
		comm_okno.close();
	}
	comm_x=((screen.width-sirka)/2);
	comm_y=((screen.height-vyska)/2);

	if(comm_x<0){
		comm_x=0;
	}
	if(comm_y<0){
		comm_y=0;
	}

	comm_okno = window.open(comm_link,"img_okno","width="+sirka+",height="+vyska+",left="+
	comm_x+",top="+comm_y+
	",toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,dependant=1");
}

function HideThumbDesc(){
	var td_div=document.getElementById('thumb_desc_alt');
	if(td_div){
		td_div.style.visibility='hidden';
		td_div.style.left=0;
		td_div.style.top=0;
	}
	return(true);
}

function getPageCoords (el) {
	var coords = {x: 0, y: 0};
	do {
		coords.x += el.offsetLeft;
		coords.y += el.offsetTop;
	}
	while ((el = el.offsetParent));
	return coords;
}

function MoveThumbDesc(ev,descid){
	var td_div=document.getElementById('thumb_desc_alt');
	var td_desc=document.getElementById(descid);
	var scrx=0;
	var scry=0;

	if (window.event){
		var coords = getPageCoords(event.srcElement);
		scrx = coords.x + window.event.offsetX;
		scry = coords.y + window.event.offsetY;
		} else if (ev){
			scrx = ev.layerX;
			scry = ev.layerY;
			} else
				return true;


				if(td_div && td_desc){
					td_div.innerHTML=td_desc.innerHTML;
					td_div.style.visibility='visible';
					scrx=scrx+15;
					scry=scry+15;
					td_div.style.left=scrx+'px';
					td_div.style.top=scry+'px';
				}
				return(true);
}


function getStyle(el,styleProp){
	var x = document.getElementById(el);
	if (x.currentStyle)
		var y = x.currentStyle[styleProp];
	else if (window.getComputedStyle)
		var y = document.defaultView.getComputedStyle(x,null).getPropertyValue(styleProp);
	return y;
}
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/;";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}
function switch_left() {
var st = getStyle("leftblock","display");	
    if (st == 'none') {
    	// ukazat
        document.getElementById('leftblock').style.display = 'block'
				document.getElementById('leftblockswitch').style.background = 'url(/img/ar_left.png)'
        document.getElementById('leftblockswitch').title = 'Skrýt sloupec'
        var w = parseInt(getStyle("leftblock","width")) - parseInt(getStyle("leftblockswitch","width"));
        var wx = w+'px';
        document.getElementById('leftblockswitch').style.left = wx;        
        document.getElementById('cont').style.marginLeft = parseInt(getStyle("leftblock","width"))+15+'px';			  
				eraseCookie("FZLEFT");        
    }
    else {
    	// schovat
        document.getElementById('leftblock').style.display = 'none'
				document.getElementById('leftblockswitch').style.background = "url('/img/ar_right.png')"
        document.getElementById('leftblockswitch').title = 'Ukázat sloupec'
        document.getElementById('leftblockswitch').style.left = '0px';   
        document.getElementById('cont').style.marginLeft =  getStyle("leftblockswitch","width");;
			  createCookie("FZLEFT","1",1);              
    }
}
function switch_right() {
	var st = getStyle("rightblock","display");
//alert(st);

    if (st == 'block') {
    	
    	// schovat
        document.getElementById('rightblock').style.display = 'none'
				document.getElementById('rightblockswitch').style.background = "url('/img/ar_left.png')"
        document.getElementById('rightblockswitch').title = 'Ukázat sloupec'
        document.getElementById('rightblockswitch').style.marginLeft = '-'+getStyle("rightblockswitch","width");       
        document.getElementById('cont').style.marginRight =  getStyle("rightblockswitch","width");
			  createCookie("FZRIGHT","1",1);     	
    } else {
    		// ukazat
       	document.getElementById('rightblock').style.display = 'block'
				document.getElementById('rightblockswitch').style.background = 'url(/img/ar_right.png)'
        document.getElementById('rightblockswitch').title = 'Skrýt sloupec'
        var w = parseInt(getStyle("rightblock","width"));
        var wx = w+15+'px';
        document.getElementById('rightblockswitch').style.marginLeft = '-'+w+'px';       
        document.getElementById('cont').style.marginRight = wx;
				eraseCookie("FZRIGHT");  
    }
}
function checkSwitches(){
	//alert("auto height "+FZLEFT+"|"+FZRIGHT);
	if(FZLEFT){
	        document.getElementById('leftblock').style.display = 'none'
					document.getElementById('leftblockswitch').style.background = "url('/img/ar_right.png')"
	        document.getElementById('leftblockswitch').title = 'Ukázat sloupec'
	        document.getElementById('leftblockswitch').style.left = '0px';        
	        document.getElementById('cont').style.marginLeft =  getStyle("leftblockswitch","width");
	}
	
	if(FZRIGHT){
	        document.getElementById('rightblock').style.display = 'none'
					document.getElementById('rightblockswitch').style.background = "url('/img/ar_left.png')"
	        document.getElementById('rightblockswitch').title = 'Ukázat sloupec'
	        document.getElementById('rightblockswitch').style.marginLeft = '-'+getStyle("rightblockswitch","width");       
	        document.getElementById('cont').style.paddingRight =  getStyle("rightblockswitch","width");
	}
}




