function findPos(oElement ) {
  if( typeof( oElement.offsetParent ) != 'undefined' ) {
    for( var posX = 0, posY = 0; oElement; oElement = oElement.offsetParent ) {
      posX += oElement.offsetLeft;
      posY += oElement.offsetTop;
    }
    return [ posX, posY ];
  } else {
    return [ oElement.x, oElement.y ];
  }
}

$.clientCoords = function(){
    if(window.innerHeight || window.innerWidth){
        return {w:window.innerWidth, h:window.innerHeight}
    }
    return {
        w:document.documentElement.clientWidth,
        h:document.documentElement.clientHeight
    }
}

$(function(){
	$('#kp').click(function(){
				$('#copc').show('slow');						
	});
	$('#copc').mouseleave(function(){
			$('#copc').hide('slow');	
	});			
	$("#foto").jCarouselLite({
        btnNext: "#next1",
        btnPrev: "#prev1"
    });
	$("#video").jCarouselLite({
        btnNext: "#next2",
        btnPrev: "#prev2"
    });
	$('.galeria img').hover(function(){
			var id = $(this).attr('name');
			$(id).show('slow');
			if(screen.width <= 972){
			var howw=0;
			}else{
			var howw = screen.width - 972;
			var howw = howw/2;
			}
			var howw = findPos(this)[0] - howw;
			var howh = findPos(this)[1];
			
			$(id).css('left', howw+50);
			$(id).css('top', howh+100);

			

	});	
	$('.galeria img').mouseleave(function(){
			var id = $(this).attr('name');
			$(id).hide('slow');	
	});	
});


sfHover = function() {
       var sfEls = document.getElementById("menu").getElementsByTagName("LI");
       for (var i=0; i<sfEls.length; i++) {
              sfEls[i].onmouseover=function() {
                     this.className+=" sfhover";
              }
              sfEls[i].onmouseout=function() {
                     this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
              }
       }
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

