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;
	}
}


function manageReference(id){
	ref = $('ref' + id);
	img = ref.getElements('img');
	img = img[0];  
	
	link = ref.getElements('a');
	ref.rlink = link[0]; 
	 	
	descr = ref.getElements('div');
	ref.descr = descr[1]; 

	 
	// ref.descr.setStyle('height', '0px'); 
	ref.f = function(){ this.descr.tween('height', '0'); }; 
	ref.f.delay(2000, ref);     			 			
	 
	ref.onclick = function(){  
		window.location.href= this.rlink.href;  
		return false;  
	}

	ref.onmouseover = function(){ 
		if(this.activated){

		} else {
			$clear(this.tid);						
			this.descr.tween('height', '27'); 
			this.activated = true;
		}   
	}

	ref.onmouseout = function(){ 
		if(this.activated){
			this.ff = function(){ this.descr.tween('height', '0'); };
			this.tid = this.ff.delay(1000, this);  						
			this.activated = false;
		} else {
			
		}   
	}
	
} 

function showPhoto(title, href){
	i = $('singleImage');
	img = i.getElements('img');
	img = img[0];  
	img.setProperty('src', href);
	img.setProperty('alt', title);
	img.setProperty('title', title);
	
	
	
	p = i.getElements('p');
	p = p[0];  
	p.set('text', title);
	
	return false; 

}

    
