var Publicidade = {

		getPublicidade1 : function (){ 
		
		$.ajax({
			type	: 'POST',
			url		: 'php/servicePublicidade.php',
			data 	: 'dados=1',
			cache	: false,
			beforeSend	: function(){$("#imgsPublicidade1").empty().html('carregando...')},
			success	: function(html){Publicidade.preenchePublicidade1(html);}
		});
		
		return false;
	},

/* ********************************************************************************************** */	
                                   
	preenchePublicidade1: function(p){
		var publicidade1 = '<a href="index.php?pagina=html/form-anuncie.html"><img src="'+urlImg+'publicidades/publicidade1.jpg" width="300" height="50" /></a>';
		//if(p == 'null')
			//return false;
	
		if(p!='null'){
			struct = eval('(' + p + ')');
	
			$.each(struct, function(i, val){
				if(val.urlLink){
					if(val.tipo_link == 1){
						publicidade1 +='<a href="'+val.urlLink+'" target="_blank"><img src="'+urlImg+'publicidades/'+val.banner+'" width="300" height="50" /></a>';
					}else{
						publicidade1 +='<a href="'+val.urlLink+'"><img src="'+urlImg+'publicidades/'+val.banner+'" width="300" height="50" /></a>';
					}
				}else{
					publicidade1 +='<img src="'+urlImg+'publicidades/'+val.banner+'" width="300" height="50" />';
				}
			})
		}
		$("#imgsPublicidade1").empty().html(publicidade1);
		
		//script jquery
		$(document).ready( function(){ $('#imgsPublicidade1').innerfade({ speed: 750, timeout: 5000, type: 'sequence', containerheight: '1em' });  } ); 
	
	},
	
/* ********************************************************************************************** */
/* ********************************************************************************************** */
	
	getPublicidade2 : function (){ 
		
		$.ajax({
			type	: 'POST',
			url		: 'php/servicePublicidade.php',
			data 	: 'dados=2',
			cache	: false,
			beforeSend	: function(){$("#imgsPublicidade").empty().html('carregando...')},
			success	: function(html){Publicidade.preenchePublicidade2(html);}
		});
		
		return false;
	},

/* ********************************************************************************************** */	
                                   
	preenchePublicidade2: function(p){
		var publicidade2 = '<a href="index.php?pagina=html/form-anuncie.html"><img src="'+urlImg+'publicidades/publicidade2.jpg" width="715" height="90" /></a>';
		//if(p == 'null')
			//return false;
		if(p!='null'){			
			struct = eval('(' + p + ')');
		
			$.each(struct, function(i, val){
				if(val.urlLink){
						if(val.tipo_link == 1){
							if(val.tipo_link == 1){
								publicidade2 +='<a href="'+val.urlLink+'" target="_blank"><img src="'+urlImg+'publicidades/'+val.banner+'" width="715" height="90" /></a>';
							}else{
								publicidade2 +='<a href="'+val.urlLink+'"><img src="'+urlImg+'publicidades/'+val.banner+'" width="715" height="90" /></a>';
							}
						}else{
							publicidade2 +='<a href="'+val.urlLink+'"><img src="'+urlImg+'publicidades/'+val.banner+'" width="715" height="90" /></a>';
						}
					
				}else{
					publicidade2 +='<img src="'+urlImg+'publicidades/'+val.banner+'" width="715" height="90" />';
				}
			})
		}
		$("#imgsPublicidade").empty().html(publicidade2);

		//script jquery
		$(document).ready( function(){ $('#imgsPublicidade').innerfade({ speed: 750, timeout: 5000, type: 'sequence', containerheight: '1em' });  } ); 
	
	},


/* ********************************************************************************************** */
/* ********************************************************************************************** */

	getPublicidade3 : function (){ 
		
		$.ajax({
			type	: 'POST',
			url		: 'php/servicePublicidade.php',
			data 	: 'dados=3',
			cache	: false,
			beforeSend	: function(){$("#imgsPublicidadeRodape1").empty().html('carregando...')},
			success	: function(html){Publicidade.preenchePublicidade3(html);}
		});
		
		return false;
	},

/* ********************************************************************************************** */	
                                   
	preenchePublicidade3: function(p){
		var publicidade3 = '<a href="index.php?pagina=html/form-anuncie.html"><img src="'+urlImg+'publicidades/publicidade3.jpg" width="290" height="90" /></a>';
		//if(p == 'null')
			//return false;
	
		if(p!='null'){	
			struct = eval('(' + p + ')');
		
			$.each(struct, function(i, val){
				if(val.urlLink){
					if(val.tipo_link == 1){
						publicidade3 +='<a href="'+val.urlLink+'" target="_blank"><img src="'+urlImg+'publicidades/'+val.banner+'" width="290" height="90" /></a>';
					}else{
						publicidade3 +='<a href="'+val.urlLink+'" ><img src="'+urlImg+'publicidades/'+val.banner+'" width="290" height="90" /></a>';
					}
				}else{
					publicidade3 +='<img src="'+urlImg+'publicidades/'+val.banner+'" width="290" height="90" />';
				}
			})
		}
		$("#imgsPublicidadeRodape1").empty().html(publicidade3);

		//script jquery
		$(document).ready( function(){ $('#imgsPublicidadeRodape1').innerfade({ speed: 750, timeout: 5000, type: 'sequence', containerheight: '1em' });  } ); 
	
	},

/* ********************************************************************************************** */
/* ********************************************************************************************** */

	getPublicidade4 : function (){ 
		
		$.ajax({
			type	: 'POST',
			url		: 'php/servicePublicidade.php',
			data 	: 'dados=4',
			cache	: false,
			beforeSend	: function(){$("#imgsPublicidadeRodape2").empty().html('carregando...')},
			success	: function(html){Publicidade.preenchePublicidade4(html);}
		});
		
		return false;
	},

/* ********************************************************************************************** */	
                                   
	preenchePublicidade4: function(p){
		var publicidade4 = '<a href="index.php?pagina=html/form-anuncie.html"><img src="'+urlImg+'publicidades/publicidade3.jpg" width="290" height="90" /></a>';
		//if(p == 'null')
			//return false;
		if(p!='null'){		
			struct = eval('(' + p + ')');
		
			$.each(struct, function(i, val){	
				if(val.urlLink){
					if(val.tipo_link == 1){
						publicidade4 +='<a href="'+val.urlLink+'" target="_blank"><img src="'+urlImg+'publicidades/'+val.banner+'" width="290" height="90" /></a>';
					}else{
						publicidade4 +='<a href="'+val.urlLink+'"><img src="'+urlImg+'publicidades/'+val.banner+'" width="290" height="90" /></a>';
					}
				}else{
					publicidade4 +='<img src="'+urlImg+'publicidades/'+val.banner+'" width="290" height="90" />';
				}
			})
		}
		$("#imgsPublicidadeRodape2").empty().html(publicidade4);

		//script jquery
		$(document).ready( function(){ $('#imgsPublicidadeRodape2').innerfade({ speed: 750, timeout: 5000, type: 'sequence', containerheight: '1em' });  } ); 
	
	},

/* ********************************************************************************************** */
/* ********************************************************************************************** */

	getPublicidade5 : function (){ 
		
		$.ajax({
			type	: 'POST',
			url		: 'php/servicePublicidade.php',
			data 	: 'dados=5',
			cache	: false,
			beforeSend	: function(){$("#imgsPublicidadeRodape3").empty().html('carregando...')},
			success	: function(html){Publicidade.preenchePublicidade5(html);}
		});
		
		return false;
	},

/* ********************************************************************************************** */	
                                   
	preenchePublicidade5: function(p){
		var publicidade5 = '<a href="index.php?pagina=html/form-anuncie.html"><img src="'+urlImg+'publicidades/publicidade3.jpg" width="290" height="90" /></a>';
		//if(p == 'null')
			//return false;
		if(p!='null'){	
			struct = eval('(' + p + ')');
		
			$.each(struct, function(i, val){
				if(val.urlLink){
					if(val.tipo_link == 1){
						publicidade5 +='<a href="'+val.urlLink+'" target="_blank"><img src="'+urlImg+'publicidades/'+val.banner+'" width="290" height="90" /></a>';
					}else{
						publicidade5 +='<a href="'+val.urlLink+'" ><img src="'+urlImg+'publicidades/'+val.banner+'" width="290" height="90" /></a>';
					}
				}else{
					publicidade5 +='<img src="'+urlImg+'publicidades/'+val.banner+'" width="290" height="90" />';
				}
			})
		}
		$("#imgsPublicidadeRodape3").empty().html(publicidade5);

		//script jquery
		$(document).ready( function(){ $('#imgsPublicidadeRodape3').innerfade({ speed: 750, timeout: 5000, type: 'sequence', containerheight: '1em' });  } ); 
	
	},
	
}

$(document).ready(function(){
	Publicidade.getPublicidade1(),
	Publicidade.getPublicidade2(),
	Publicidade.getPublicidade3(),
	Publicidade.getPublicidade4(),
	Publicidade.getPublicidade5()

})
