// JavaScript Document
var fontMod = function myText(options){
	this.options = options;
	this.element = this.options.element;
	this.iterator = this.element.css("font-size").replace("px","");
	this.aumenta = function(){
		this.iterator++;
		if(this.iterator > this.options.max){
			this.iterator = 16;
		}
		this.element.css("font-size",this.iterator+"px");
	}
	this.diminui = function(){
		this.iterator--;
		if(this.iterator < this.options.min){
			this.iterator = 9;
		}
		this.element.css("font-size",this.iterator+"px");
	}
}

function wOpen(file,name,params){
	janela = window.open(file,name,params);
	janela.focus();
	return false;
}

function my_ajaxForm(form,result){
	 $.ajax({
	   type: form.attr('method'),
	   url: form.attr('action'),
	   data: form.serialize(),
	   beforeSend: function(){result.show("fast");result.html("<img src='/files/img/loader.gif' />")},
	   success: function(msg){
		 result.html(msg);
	   }
	 });

	return false;
}

function loadAjax(url,result){
	 $.ajax({
	   type: 'get',
	   url: url,
	   beforeSend: function(){result.show("fast");result.html("<img src='/files/img/loader.gif' />")},
	   success: function(msg){
		 result.html(msg);
	   }
	 });

	return false;
}
function loadVideo(video_id)
{
	$("#mostravideo").hide();
	
	$.ajax({
			method: "get",url: "/Ajax_controller/showvideo/"+video_id,
			dataType: "html",
			beforeSend: function(){$("#carregaVideo").show();}, 
			complete: function(){ $("#carregaVideo").hide();}, 
			success: function(html){
											 
						$("#mostravideo").html("");
						$("#mostravideo").append(html);
						//$("#troca_classificadosPag").show();
			},
			error: function(){
				alert('Ocorreu um erro ao enviar requisição.');
			}
	
	 });
	$("#mostravideo").show();
	
}

function votaNoticia(count,id,pagina_id){
	$.ajax({
			method: "get",url: "/Ajax_controller/vota_noticia/"+id+"/"+count+"/"+pagina_id,
			dataType: "html",
			beforeSend:  function(){$("#carregaVoto").show("fast");$("#carregaVoto").html("<img src='/site/images/working.gif' />")},
			success: function(html){ 
						$("#carregaVoto").html("");
						$("#carregaVoto").append(html);
						$("#carregaVoto").show();
		 }
	 }); //close $.ajax(
		
}