// JavaScript Document
/*2009 sipecu filoquin
*/

$(document).ready(function() {
/*			  $("#nqn").animate({   width:  "370px", height: "182px", padding: "40px 10px 0  10px" }, 1000 );
			  $("#cipo").animate({   width:  "280px", height: "250px", padding: "20px 10px 0  10px" }, 1000 );
*/
	$("img","#menuCentral").hover(function(){$(this).fadeTo(250,0.33);$(this).fadeTo(500,1)});
	$("a.anchorLink").anchorAnimate()
	
	

});		
function rotarBannerHome(){
	
	if (ub==false){
		$("#contenedorBanner").animate({   left:  "-234px" }, 1000 );
		ub=true;
		t=setTimeout("rotarBannerHome()",5000);
	} else {
		$("#contenedorBanner").animate({   left:  "0" }, 1000 );
		ub=false;
		t=setTimeout("rotarBannerHome()",5000);
	}

}
function desresevar(art,us,obj){

	$.get("desreservar.php", { apk: art, uk: us },
			  function(data){
					 $($(obj).parents().filter("#articulo")).remove();	
			  });
	
}
function isframe(framespage){
    if (top.location==document.location){
      top.location=framespage;
    }else{
      var parent_location=parent.location.href;
      var str_beginning=parent_location.length-framespage.length;
      if (parent_location.substring(str_beginning, parent_location.length)!=framespage){
        parent.location=framespage;
      }
    }
}
function irA(ubicacion){
		alert(ubicacion);
			$("#cuerpo").animate({   top:  ubicacion + "px" }, 1000 );

}
function goToByScroll(id){
     	$('html,body,#cuerpo').animate({scrollTop: $("#"+id).offset().top},'slow');
}


jQuery.fn.anchorAnimate = function(settings) {
 	settings = jQuery.extend({
		speed : 1100
	}, settings);	
	return this.each(function(){
		var caller = this
		$(caller).click(function (event) {	
			event.preventDefault()
			var locationHref = window.location.href
			var elementClick = $(caller).attr("href")
			var destination = $(elementClick).offset().top;
			$("html:not(:animated),body:not(:animated),#cuerpo:not(:animated)").animate({ scrollTop: destination}, settings.speed, function() {
				window.location.hash = elementClick
			});
		  	return false;
		})
	})
}

