// JavaScript Document
$rs_admin = 'http://back.rapidde-sign.com';		//ruta al administrador de contenidos
$(function(){
	$('div.acciones input').val('');
	if ($('#listado_promos').length){
		$('#listado_promos').cycle({ 
			speed:       450, 
			timeout:     8000, 
			pager:      '.nav_galeria',
			fx:      'scrollHorz',
			prev:   '#anterior', 
			next:   '#siguiente', 
			pauseOnPagerHover: true 
		});

		$('#listado_promos li').mouseover(function() { 
			$('#listado_promos').cycle('pause'); 
		});

		$('#listado_promos li').mouseout(function() {
			$('#listado_promos').cycle('resume'); 
		});
	}	
	$('#section_works').change(function(){
		self.location = $('#section_works').val();
	});

	if ($('.captify').length > 0){
		$('img.captify').captify({
			speedOver: 200,
			speedOut: 200,
			hideDelay: 50,
			animation: 'fade',	  	
			prefix: '',	
			className: 'caption'
		});
	}
	if ($('fieldset.datos_trabajo').length > 0){
		$campos = $('fieldset.datos_trabajo .lista_productos');
		$campos.click(function(){
			$('input#All_products').val('');
			$mas = $valores = "";
			$campos.each(function(){
				if ($(this).is(':checked')){
					$valores = $valores + $mas + $(this).val();
					$mas = ", ";
				}
			});
			$('input#All_products').val($valores);
		});
	}
	
	$('.descargar_doc').click(function(){
		clave = $('#clave_pdf').val();
		objeto = $(this);
		if (clave.length < 6){alert("Esciba correctamente el cógido de acceso"); return}
		path_php = base_url + "modulos/enlaces/documentos.php" ;
		$.post(path_php, {clave: clave }, function(data){
			switch(data){
				case 'correcto':
					$('#field_documento').val(objeto.attr('title'));
					$('#descargar').submit();
				break;
				
				case 'error':
					alert("Descarga denegada. Clave incorrecta.");
				break;
			}
		});
	});

});
$(window).bind("load", function() { 
	if ($("#mygalone").length>0){	
		//$("div#mygalone").slideView();
		$("div#mygalone").slideView({
			easeFunc: "easeInOutSine", 
			easeTime: 500, 
			toolTip: true
		});
	}
});
