/**
 * @author sarca
 */
$(document).ready(function(){
	$("#tabs").tabs();
	

	
	
	$(".gallery").livequery(function(){
		$(".gallery").each(function(){
			$('#'+$(this).attr('id')+' a').lightBox({fixedNavigation:true});
		
		});	
	});
	

	$(".gallery").each(function(){
		$('#'+$(this).attr('id')+' a').lightBox({fixedNavigation:true});
		
	});
	
	
	
	/*$(".galeria").livequery(function(){
		$(".galeria").each(function(){
			$('#'+$(this).attr('id')+' a').lightBox({fixedNavigation:true});
		
		});	
	});*/
	

	/*$(".galeria").each(function(){
		$('#'+$(this).attr('id')+' a').lightBox({fixedNavigation:true});
		
	});*/

	$("a.galeria").lightBox({fixedNavigation:true});

	
	

	
	$("#frmMicro").submit(function(){
		if($("#microName").val()=='' && $("#microProd").val()=='' && $("#microSec").val()=='' && $("#microMcpio").val()=='' ){
			$("#microError").text(" Requerido");
			return false; 
		}
		else{
			return true; 
		}
	});
});


function loadProd(){
	var idProd=$("#microSec").val();
	$.ajax({
		type:'POST',
		url:'services/service_micro.php',
		data:{loadProd:1,idProd:idProd},
		dataType:'text',
		beforeSend:function(){
			$("#prodLoader").show();
		},
		success:function(data, textStatus){
			$("#prodLoader").hide();
			$("#microProd").html(data);
		},
		error:function(XMLHttpRequest, textStatus, errorThrown){
			if(textStatus!='' || textStatus != null){
				jAlert("Error: "+textStatus);
			}
			else{
				jAlert("Error: "+errorThrown);
			}
		}
	});
}

function ShowDes(idDes){
	$.ajax({
		type:'POST',
		url:'services/service_micro.php',
		data:{ShowDes:1,idDes:idDes},
		dataType:'text',
		beforeSend:function(){
			$("#Desloader").show();
		},
		success:function(data, textStatus){
			$("#Desloader").hide();
			$("#microDest").html(data);
		},
		error:function(XMLHttpRequest, textStatus, errorThrown){
			if(textStatus!='' || textStatus != null){
				jAlert("Error: "+textStatus);
			}
			else{
				jAlert("Error: "+errorThrown);
			}
		}
	});
}


function pagination(page){
	$.ajax({
		type:'POST',
		url:'services/service_micro.php',
		data:{pagination:1,starting:page,sid:Math.random(),sql:$("#search_text").val()},
		dataType:'text',
		beforeSubmit:function(){
				//$("#Newsloader").show();
		},
		success:function(data, textStatus){
			$("#page_contents").html(data);
		},
		error:function(XMLHttpRequest, textStatus, errorThrown){
			if(textStatus!='' || textStatus != null){
				jAlert("Error: "+textStatus);
			}
			else{
				jAlert("Error: "+errorThrown);
			}
		}
	});
}

