$(document).ready(function(){

	//This keeps track of the slideshow's current location
	var current_panel = 1;
	//Controlling the duration of animation by variable will simplify changes
	var animation_duration = 2500;
	
	$.timer(6000, function (timer) {
		//Determine the current location, and transition to next panel
		switch(current_panel){
			case 1:
				$("#slideshow").stop().animate({left: "-1020px", top: "0px"}, {easing: 'easeOutBack', duration: animation_duration});
				current_panel = 2;
			break;
			case 2:
				$("#slideshow").stop().animate({left: "0px", top: "-300px"}, {easing: 'easeOutBack', duration: animation_duration});
				current_panel = 3;
			break;
			case 3:
				$("#slideshow").stop().animate({left: "-1020px", top: "-300px"}, {easing: 'easeOutBack', duration: animation_duration});
				current_panel = 4;
			break;
			case 4:
				$("#slideshow").stop().animate({left: "0px", top: "0px"}, {easing: 'easeOutBack', duration: animation_duration});
				current_panel = 1;
			break;	
	  		timer.reset(12000);
		}
	});
	
	
	sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" selected";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" selected\\b"), "");
		}
	}
	}
	if (window.attachEvent) window.attachEvent("onload", sfHover);
	
	$(".slidetabs").tabs(".cnt_gen_img_carrousel > div", {		
		effect: 'fade',
		fadeOutSpeed: "slow",
		rotate: true
	}).slideshow();
	/*
		$("#ratings").children().not(":radio").hide(); 
		$("#ratings").stars({
			oneVoteOnly: true, 
			callback: function(ui, type, value, idprod)
			{   
			    idprodval = $('#idProducto').val();
				$.post("Calificar.ashx", {rate: value, idprod: idprodval}, function(data) 
				{
					
					$("#ajax_response").html(data); 
				});
			}
		});	
	*/
	$('.cnt_img_carrousel a').lightBox();
	
	$('#simple_tabs a.tab').simpleTabs();
	
	if($.browser.msie && $.browser.version.substr(0, 1) == "6"){
	    $(".sub_menutop").append($("#nav li.selected ul"));
    }

});

