function makePopup(windowPosX,windowPosY,windowName,url,name,w,h,extra){
	var titlebarHeight = 28;
	str="height="+h+",width="+w+","+extra;
	if(parseInt(navigator.appVersion)>3) // supports screen.width
		if (windowPosX == -1) {
			str+=",left=" + (screen.width -w)/2 + ",top=" + parseInt(((screen.height -h)-titlebarHeight)/2);
		}
		else {
			str+=",left="+windowPosX+",top="+windowPosY;
		}
	var k = eval(windowName + "=window.open('" + url + "','" + name + "','" + str + "')");
	return k;
}

function openPop(url,width,height) {
	ak_pop = makePopup(-1,-1,'tab', url,'tab',width,height,'scrollbars=yes');		
	ak_pop.focus();	
}

function openPhotogallery(url) {
	ak_pop = makePopup(-1,-1,'tab', url,'tab',600,800,'scrollbars=yes');		
	ak_pop.focus();	
	return false;
}

function bookmarkPage(title,url){
	if (window.sidebar){ // firefox
		window.sidebar.addPanel(title, url, url);
	} else if(window.opera && window.print){ // opera
		var elem = document.createElement('a');
		elem.setAttribute('href',url);
		elem.setAttribute('title',title);
		elem.setAttribute('rel','sidebar');
		elem.click();
	}
	else if(document.all) {// ie
		window.external.AddFavorite(url, title);
	}
}


/******** prace s inputy **************/

function remove_txt(txt,input) {
	if(input.value == txt){
		input.value = "";
	}
}

function set_txt(txt,input) {
	if(input.value == ""){
		input.value = txt;
	}
}

function CheckAll(f,el) {
	for (var i=0;i<f.elements.length;i++)
	{
		var e=f.elements[i];
		if (e.name==el) e.checked=f.check_all.checked;
	}
}

/** images*/

function loadImage(imgId, newSrc, preload){
	objImage = new Image();
	objImage.onLoad = imageLoaded(imgId, newSrc);
	objImage.src = newSrc;
	
	if(preload){
		img = document.getElementById(imgId);
		img.src = preload;
		img.className = 'preloadImg'
	}
	return false;
}

function imageLoaded(imgId, newSrc){
	img = document.getElementById(imgId);
	this.newSrc = newSrc;
	setTimeout("img.src = this.newSrc; img.className = ''",1000);
}


/** blocks */
function manageBlock(trigger, blockId){	
	block = document.getElementById(blockId);
	switch(trigger.className){
		case 'plus':	
			block.style.display = 'block';		
			trigger.className = 'minus';	
			break;
		case 'minus':	
			block.style.display = 'none';		
			trigger.className = 'plus';	
			break;
	}
}



var zIndex = 9;
var currentTip = 1;
var maxx = 0;
function showTip(tNo){
	for(i = 1; i <= maxx; i++){
		try{
			//$('tip' + i).setStyle('display', 'none'); 
			$('tipTrigger'  + i).removeClass('selected'); 
		} catch(err) {
			
		}
	}  
	
	currentTip = tNo;
	     
	try{ 
		tip = $('tip' + tNo);
		tip.fade('hide');  
		tip.setStyle('z-index', zIndex++);  
		tip.fade('in');  
		 
		$('tipTrigger'  + tNo).addClass('selected');
	} catch(err) { 
	}  
	return false; 
	  
}

function slideTips(){
	if(currentTip == maxx){
 		currentTip = 0;  
	} 
	showTip(currentTip + 1); 
}

var periodical; 

function showBlock(bid, height){
	block = $(bid);  
	if( block.getStyle('height')  == '0px'){
		
	} else {  
		height = 0; 
	}
	
	block.tween('height', height); 
	return false; 
}

