// funciones de anything slider
		$(function(){

			// External Link with callback function
			$("#slide-jump").click(function(){
				$('#slider2').anythingSlider(4, function(slider){ /* alert('Now on page ' + slider.currentPage); */ });
				return false;
			});

			// External Link
			$("a.muppet").click(function(){
				$('#slider1').anythingSlider(5);
				$(document).scrollTop(0);
				return false;
			});

			// Report Events to console & features list
			$('#slider1, #slider2').bind('before_initialize initialized swf_completed slideshow_start slideshow_stop slideshow_paused slideshow_unpaused slide_init slide_begin slide_complete', function(e, slider){
				// show object ID + event (e.g. "slider1: slide_begin")
				var txt = slider.$el[0].id + ': ' + e.type + ', now on panel #' + slider.currentPage;
				$('#status').text(txt);
				if (window.console && window.console.firebug){ console.debug(txt); } // added window.console.firebug to make this work in Opera
			});

			// Theme Selector (This is really for demo purposes only)
			var themes = ['minimalist-round','minimalist-square','metallic','construction','cs-portfolio'];
			$('#currentTheme').change(function(){
				var theme = $(this).val();
				if (!$('link[href*=' + theme + ']').length) {
					$('body').append('<link rel="stylesheet" href="css/theme-' + theme + '.css" type="text/css" media="screen" />');
				}
				$('#slider1').closest('div.anythingSlider')
					.removeClass( $.map(themes, function(t){ return 'anythingSlider-' + t; }).join(' ') )
					.addClass('anythingSlider-' + theme);
			});

			// Add a slide
			var imageNumber = 1;
			$('button.add').click(function(){
				$('#slider1')
					.append('<li><img src="imagenes/slide-tele-' + (++imageNumber%2 + 1)  + '.jpg" alt="" /></li>')
					.anythingSlider(); // update the slider
			});
			$('button.remove').click(function(){
				if ($('#slider1').data('AnythingSlider').pages > 1) {
					$('#slider1 > li:not(.cloned):last').remove();
					$('#slider1').anythingSlider(); // update the slider
				}
			});

		});

		// Set up Sliders
		// **************
		$(function(){

			$('#slider1').anythingSlider({
				startText       : "Iniciar",   // Start button text
				stopText        : "Pausar",    // Stop button text
				delay           : 10000,  // How long between slideshow transitions in AutoPlay mode (in milliseconds)
				animationTime   : 300,  // How long the slideshow transition takes (in milliseconds)
				startStopped    : false, // If autoPlay is on, this can force it to start stopped
				width           : 800,   // Override the default CSS width
				height          : 400,   // if resizeContent is false, this is the default height if panel size is not defined
				/*theme           : 'metallic',*/
				pauseOnHover    : true,      // If true & the slideshow is active, the slideshow will pause on hover
				autoPlayLocked  : true,  // If true, user changing slides will not stop the slideshow
				resumeDelay     : 10000, // Resume slideshow after user interaction, only if autoplayLocked is true (in milliseconds).
				onSlideComplete : function(slider){
					// alert('Welcome to Slide #' + slider.currentPage);
				}
			});

		});
//fin anything slider

//back to top			
//contador de los clicks
var cont1=0
var cont2=0
$(document).ready(function() {
	//bg switch
	$('.bgSwitcher').click(function(e){
            e.preventDefault();
		   $("body").css("background", "#000 url('" + $(this).attr("href") + "') fixed");
    });

    $(".mainMenu li:last-child").addClass("lastMenuChild");			   
						   
    $(".mainMenu li:last-child").addClass("lastMenuChild");			   
						   
   	//animate back to top btn
	   //twitter
	$(".backToTop").hover(function() {
	    $(".backToTopBtn").stop().animate({"height":"122px"},300, "easeOutCubic");
	    $(this).stop().animate({"top": "0px"},300, "easeOutCubic");
	
	},function(){
		$(".backToTopBtn").stop().delay(200).animate({"height":"32px"},300, "easeOutCubic");
	    $(this).stop().delay(200).animate({"top": "-90px"},300, "easeOutCubic");
	});
	   
	   //facebook
	$(".backToTopFace").hover(function() {
	    $(".backToTopBtn").stop().animate({"height":"122px"},300, "easeOutCubic");
	    $(this).stop().animate({"top": "0px"},300, "easeOutCubic");
	
	},function(){
		$(".backToTopBtn").stop().delay(200).animate({"height":"32px"},300, "easeOutCubic");
	    $(this).stop().delay(200).animate({"top": "-90px"},300, "easeOutCubic");
	});
   
	/* top menu */
	$(".mainMenu > li").hover(function() {
		$(this).stop().find(".subMenu").animate({height: "show"},50);
	},function(){
		$(this).stop().find(".subMenu").delay(10).animate({height: "hide"},50);
	});
	/* fin de top menu */

	$('#registrarme').click(function(){
		if (cont1 % 2 == 0){
			//par
		    $("#subCont1").css("display", "block");
		    $("#registrarme").html("<div class='fleft'>No quiero registrarme</div><img id='despliegaReg' class='imgDespliega' src='imagenes/despliegaH.png'>");
		}else{
			//inpar
			$("#subCont1").css("display", "none");
		    $("#registrarme").html("<div class='fleft'>Quiero registrarme</div><img id='despliegaReg' class='imgDespliega' src='imagenes/despliega.png'>");
		}
		cont1++;
	});
	
	$('#inscribirme').click(function(){
		if (cont2 % 2 == 0){
			//par
		    $("#subCont2").css("display", "block");
		    $("#inscribirme").html("<div class='fleft'>No quiero inscribirme</div><img id='despliegaInsc' class='imgDespliega' src='imagenes/despliegaH.png'>");
		}else{
			//inpar
			$("#subCont2").css("display", "none");
		    $("#inscribirme").html("<div class='fleft'>Quiero inscribirme</div><img id='despliegaInsc' class='imgDespliega' src='imagenes/despliega.png'>");
		}
		cont2++;
	});
	/* pintar los link del menu principal */
	pintarLinks();
	novedadesSlider();
});

function inscribir() {
	$("#cargando").css("display", "inline");
	$("#resultaInscr").load("procesos/inscribirse.php", {
		mail: $("#inscri").val()
	}, function() {
		$("#cargando").css("display", "none");
	});
};

function obtenerArchivo(url){
	archi=url.split('/');
	nombre=archi[archi.length-1];
	return nombre;
}

function pintarLinks(){
	nombre= obtenerArchivo(document.URL);
	if (nombre=="index.php"){
		$('#index').addClass("currentPage");
	}else{
		if (nombre=="institucional.php"){
			$('#institucional').addClass("currentPage");
		}else{
			if (nombre=="materiales.php" || nombre=="impresion-digital.php" || nombre=="preprensa.php"){
				$('#productos').addClass("currentPage");
			}else{
				if (nombre=="asesoramiento.php" || nombre=="pre-impresion.php" || nombre=="impresion.php" || nombre=="terminacion.php" || nombre=="entrega.php" || nombre=="ctp.php" || nombre=="pelicula.php" || nombre=="gigantografia.php" || nombre=="plotter.php" || nombre=="plotter-corte.php"){
					$('#servicios').addClass("currentPage");
				}else{
					if (nombre=="contacto.php"){
						$('#contacto').addClass("currentPage");
					}else{
						if (nombre=="presupuesto.php"){
							$('#presupuesto').addClass("currentPage");
						}
					}
				}
			}
		}
	}
}

function novedadesSlider(){
	$('#mijcarousel').jCarouselLite({
        vertical: true,
        circular: true,
        btnNext: '.next',
        btnPrev: '.prev',
        visible: 1,
        auto: 8000,
        speed: 500,
        scroll: 1
		});
}

function cargaEstoEn(pArchivo, pIdResult) {
	//alert('entro en carga estoen: con datos: ' + pArchivo + " y "+ pIdResult);
	var name = jQuery("#iName").val();
	var email = jQuery("#iEmail").val();
	var subject = jQuery("#iSubject").val();
	var msg = jQuery("#iMessage").val();
	$(pIdResult).load(pArchivo, {
		nombre: name, 
		email: email,
		asunto: subject,
		mensaje: msg
	});
};

function borraValoresRegistrar(){
	$("#iName").val('');
	$("#iEmail").val('');
	$("#iSubject").val('');
	$("#iMessage").val('');
}
/*$('.minipic').hover(function(){
    		$(this).css('opacity',0.3);},function(){ $(this).css('opacity',1);
    	});
*/

