function idaugiau(lin){
 var dbr = document.getElementById('idaugiau').style.display;
 if (lin){
  var vieta=document.getElementById(lin).offsetTop-120;
  document.getElementById('idaugiau').style.top=vieta+"px";
 }else{
  document.getElementById('idaugiau').style.top="422px";
 }
if (dbr){
 if (dbr == 'none'){
   document.getElementById('idaugiau').style.display='block';
 }else{
   
   document.getElementById('idaugiau').style.display='none';
 }
}else{
	document.getElementById('idaugiau').style.display='block';
}
 
}

setTimeout(function() {$('#infobox').fadeIn(2000);}, 4000);  
jQuery(document).ready(function(){

	jQuery('.thumb > a').click(function(){
		 jQuery(".thumb a").removeClass("active");
		 jQuery(this).addClass("active");

		  var kuris = jQuery(this).attr('alt');   
		  var kuris2 = jQuery(this).attr('href'); 

			jQuery('#item_image').fadeOut(function(){
				jQuery('#item_image').fadeIn();
			jQuery('#item_image').attr('src', kuris);
			jQuery('.itemfo').attr('href', kuris2);
			
		  });
	});
});

$(window).scroll(function() {
	
if($('#infobox').size()){	
if (document.getElementById('infobox').style.display==""){
  var documentHeight = $(document).height()-150; 
  var scrollPosition = $(window).height() + $(window).scrollTop(); 

	
	
	if (documentHeight <= scrollPosition) {
		
  	  $('#infobox').fadeIn(2000);
  	  
    }else{
	   setTimeout(function() {$('#infobox').fadeIn(2000);}, 4000);  
    }
    
}
}

if ((navigator.appName == "Microsoft Internet Explorer") && (parseFloat(navigator.appVersion.split("MSIE")[1])) < 7){
  var documentHeight = $(document).height()-150; 
  var scrollPosition = $(window).height() + $(window).scrollTop()+155; 
  if($('#uforma').size()){
   if (document.getElementById("uforma").style.display=="block"){scrollPosition = scrollPosition-255};
	document.getElementById("infobox").style.top = scrollPosition+"px";
		}
}


});


      
      
function boxclose (id) {
	dpoz = document.getElementById(id).style.display;
	if ((dpoz == 'block') || (dpoz == ''))
	 //document.getElementById(id).style.display='none';
	 $('#'+id).remove();
	else{
	 document.getElementById(id).style.display='block';
	 if ((navigator.appName == "Microsoft Internet Explorer") && (parseFloat(navigator.appVersion.split("MSIE")[1])) < 7){	 
		 var dbr = $(window).scrollTop()-1;
		 
		 scroll(0,dbr);
     }	 
    } 
	 
	
	// if (id == "infobox") {pageTracker._trackPageview('uzdare_daugiau_informacijos');}
}
