function formuoti_pranesima(klaidos) {
    if (klaidos.length==1) 
        pranesimas = "Klaida!\n"+klaidos[0]+".";
    else {
        pranesimas = "Klaidos!"; 
        for (i=1; i<=klaidos.length; i++)
           pranesimas += "\n"+i+". "+klaidos[i-1]+".";
    }
    return pranesimas;
}

function show_foto_info_box(id, event) {
    x=document.body.scrollLeft + event.clientX;
    y=document.body.scrollTop + event.clientY;
    if (box = document.getElementById('info_box_'+id)) {
        box.style.visibility = "visible";
        box.style.top = y+4;
        box.style.left = x+4;
    }
}

function hide_foto_info_box(id) {
    if (box = document.getElementById('info_box_'+id))
        box.style.visibility = "hidden";
}




function goC(url){
	if(document.getElementById('eventscalendar')){
		var obj=document.getElementById('eventscalendar');
		obj.style.opacity=0.3;
		obj.style.filter='alpha(opacity=30)';
		xmlhttpPost(url);
	}
}


function xmlhttpPost(strURL) {
    var xmlHttpReq = false;
    var self = this;
   
	try{// Firefox, Opera 8.0+, Safari
		self.xmlHttpReq=new XMLHttpRequest();
	}
	catch (e){// Internet Explorer
		try{
			self.xmlHttpReq=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e){
			self.xmlHttpReq=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}

    self.xmlHttpReq.open('GET', strURL, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
            updatepage(self.xmlHttpReq.responseText);
        }
    }
    self.xmlHttpReq.send(null);
}


function updatepage(str){
    var obj=document.getElementById('eventscalendar');
	obj.innerHTML = str;
	obj.style.opacity=1;
	obj.style.filter='alpha(opacity=100)';
}


function shiftOpacity(id, millisec) { 
    //if an element is invisible, make it visible, else make it ivisible 
    if(document.getElementById(id).style.opacity == 0) { 
        opacity(id, 0, 100, millisec); 
    } else { 
        opacity(id, 100, 0, millisec); 
    } 
} 

function opacity(id, opacStart, opacEnd, millisec) { 
    //speed for each frame 
    var speed = Math.round(millisec / 100); 
    var timer = 0; 

    //determine the direction for the blending, if start and end are the same nothing happens 
    if(opacStart > opacEnd) { 
        for(i = opacStart; i >= opacEnd; i--) { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } else if(opacStart < opacEnd) { 
        for(i = opacStart; i <= opacEnd; i++) 
            { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } 
} 

//change the opacity for different browsers 
function changeOpac(opacity, id) { 
    var object = document.getElementById(id).style; 
    object.opacity = (opacity / 100); 
    object.MozOpacity = (opacity / 100); 
    object.KhtmlOpacity = (opacity / 100); 
    object.filter = "alpha(opacity=" + opacity + ")"; 
} 



function goC2(url){
	if(document.getElementById('eventscalendar2')){
		var obj=document.getElementById('eventscalendar2');
		obj.style.opacity=0.3;
		obj.style.filter='alpha(opacity=30)';
		xmlhttpPost2(url);
	}
}


function xmlhttpPost2(strURL) {
    var xmlHttpReq = false;
    var self = this;
   
	try{// Firefox, Opera 8.0+, Safari
		self.xmlHttpReq=new XMLHttpRequest();
	}
	catch (e){// Internet Explorer
		try{
			self.xmlHttpReq=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e){
			self.xmlHttpReq=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}

    self.xmlHttpReq.open('GET', strURL, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
            updatepage2(self.xmlHttpReq.responseText);
        }
    }
    self.xmlHttpReq.send(null);
}


function updatepage2(str){
    var obj=document.getElementById('eventscalendar2');
	obj.innerHTML = str;
	obj.style.opacity=1;
	obj.style.filter='alpha(opacity=100)';
}