/**
 * @author sarca
 */
$(document).ready(function(){
	var idnoticia='';
	
	$("#tabs").tabs();
	$(".Novmodal").click(function(){
		idnoticia=$(this).attr('id');
	});
	$(".Novmodal").colorbox({height:"70%",width:"60%",title:'Microempresas de Antioquia',href:'#newsDialog',inline:'true'},function(){
			$.ajax({
				type:'POST',
				url:'services/service_news.php',
				data:{showNewHistorial:1,idNews:idnoticia},
				dataType:'text',
				beforeSubmit:function(){
					$("#Newsloader").show();
				},
				success:function(data, textStatus){
					$("#Newsloader").hide();
					$("#newsDialog").html(data);
					
				},
				error:function(XMLHttpRequest, textStatus, errorThrown){
					if(textStatus!='' || textStatus != null){
						jAlert("Error: "+textStatus);
					}
					else{
						jAlert("Error: "+errorThrown);
					}
				}
			});
	});
});



function ShowNew(idNews){
	$.ajax({
		type:'POST',
		url:'services/service_news.php',
		data:{ShowNew:1,idNews:idNews},
		dataType:'text',
		beforeSend:function(){
			$("#Newsloader").show();
		},
		success:function(data, textStatus){
			$("#Newsloader").hide();
			$("#newsContainer").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_news.php',
		data:{pagination:1,starting:page,sid:Math.random()},
		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);
			}
		}
	});
}




