;(function($){
	$.extend({
		jqWebSite: function(options) {
			return {
				init: function(options) {
					settings = jQuery.extend({
						//name: options.name,
						lang: options.lang
					}, options);
						
					return this;
				},

				// sendNewsLetter
				// -----------------------------------------------------------------
				sendNewsLetter: function(p) {
					$("#postNews").click(function(){
						$email = $("#newsEmail").val();

						// Verifica se é um email válido


						$.post("mvc/Funcoes.Json.asp",{ acao: "NEWSLETTER-CADASTRO", email: $email },
							function(json){
								if(json.report.error == 'false'){
									$("#newsEmail").val('');
									var mensagem = json.report.mensagem;
								} else {
									var mensagem = json.report.mensagem;
								}
								//jAlert('E-mail registrado.', 'Mensagem');
								jAlert(mensagem, 'Mensagem');
								//alert( mensagem );
								return false;
							}, "json"
						);
						return false;
					});// end : postNews : click
				},// end : sendNewsLetter


				// sendAcesso : Acesso a Área Pedagógica
				// -----------------------------------------------------------------
				sendAcesso: function(p) {
					$("#postAcesso").click(function(){
						$login = $("#acessoLogin").val();
						$senha = $("#acessoSenha").val();
						$.post("mvc/Funcoes.Json.asp",{ 
							acao: "ACESSORIA-ACESSO", 
							login: $login,
							senha: $senha							
						}, function(json){
								if(json.report.error == 'false'){
									window.location='sala-dos-educadores-logado.asp';
								} else {
									var mensagem = json.report.mensagem;
									alert( mensagem );									
								}								
								return false;
							}, "json"
						);
						return false;
					});// end : postAcesso : click

					$("#postAcessoRG").click(function(){
						$login	= $("#acessoRGLogin").val();
						$senha	= $("#acessoRGSenha").val();
						$cpf		= $("#acessoRGCPF").val();

						if($login.length == 0){ alert('Informe o RG'); $("#acessoRGLogin").focus(); return false; }
						if($senha.length == 0){ alert('Informe a Senha'); $("#acessoRGSenha").focus(); return false; }
						if($cpf.length == 0){ alert('Informe o CPF'); $("#acessoRGCPF").focus(); return false; }
						$.post("mvc/Funcoes.Json.asp",{ 
							acao: "ACESSORIA-ACESSO-RG", 
							login: $login,
							senha: $senha,
							cpf: $cpf
						}, function(json){
								if(json.report.error == 'false'){
									$("#acessoRGLogin").val('');
									$("#acessoRGSenha").val('');
									$("#acessoRGCPF").val('');
									jAlert(json.report.mensagem, 'Mensagem');
									//window.location='sala-dos-educadores-logado.asp';
								} else {
									//var mensagem = json.report.mensagem;
									alert( json.report.mensagem );									
								}								
								return false;
							}, "json"
						);
						return false;
					});// end : postAcesso : click

				},// end : sendAcesso


				// sendEsqueci : Esqueci minha senha
				// -----------------------------------------------------------------
				sendEsqueci: function(p) {
					$("#postEsqueci").click(function(){
						$cpf = $("#esqCPF").val();
						$.post("mvc/Funcoes.Json.asp",{ 
							acao: "ESQUECI-SENHA", 
							cpf: $cpf
						}, function(json){
								if(json.report.error == 'false'){
									$("#esqCPF").val('');
									var mensagem = json.report.mensagem;
									//window.location='sala-dos-educadores-logado.asp';
								} else {
									var mensagem = json.report.mensagem;
									//alert( mensagem );									
								}
								$("#msg_esqueci").html(mensagem).show().fadeOut(8000);
								return false;
							}, "json"
						);
						return false;
					});// end : postAcesso : click
				},// end : sendAcesso



				// bannerRotativo : 
				// -----------------------------------------------------------------
				bannerRotativo: function(p) {
					$('.loadBanners').show();
					$('.loadBanners').cycle({ 
						fx:     'fade', 
						timeout: 6000,
						speed: 500,
						prev:   '.previous',
						next:   '.next'
					});
					
					$('.files').mouseover(function() {
						$('.loadBanners').cycle('pause');
					});

					$('.files').mouseout(function() {
						$('.loadBanners').cycle('resume', false);
					});
					return false;


					/*
					$.post('mvc/Funcoes.Json.asp',{
						acao: "BANNER-ROTATIVO",
					},function(resposta){							
						$("#dvBannerRotativo").html(resposta);
						$('.loadBanners').show();
						$('.loadBanners').cycle({ 
							fx:     'fade', 
							timeout: 6000,
							speed: 500,
							prev:   '.previous',
							next:   '.next'
						});
						
						$('.files').mouseover(function() {
							$('.loadBanners').cycle('pause');
						});

						$('.files').mouseout(function() {
							$('.loadBanners').cycle('resume', false);
						});
						return false;
					});
					*/
				},// end : bannerRotativo








				// MenuLateral : Exibe os itens do menu accordion
				// -----------------------------------------------------------------
				GaleriaAccordion: function(p) {
					$('#picturesAccordion').accordion({
						autoHeight: false,
						active: 1
					});
					//$('#picturesAccordion').accordion();
					$('#picturesAccordion_OLD').accordion({
						active: -1,
						autoheight: false,
						alwaysOpen: false,
						header: '.head',
						navigation: true
					});	
				},// end : MenuLateral

				
				// Imagens da Home
				// -----------------------------------------------------------------
				HomeImages: function(p) {
					$.post('get_home.php',{
						acao: "IMAGEM-HOME",
						lang: settings.lang
					},function(resposta){							
						$("#colunahome").html(resposta);						
						return false;
					});
				},// end : HomeImages


				// Notícias
				// -----------------------------------------------------------------
				NoticiasListHome: function(p) {
					$.post('get_noticias.php',{
						acao: "NEWS-LIST",
						lang: settings.lang
					},
						function(resposta){							
							$("#news").html(resposta);						
							return false;
						}
					);
				},// end : NoticiasListHome


				// Galerias
				// -----------------------------------------------------------------
				GaleriasLoad: function(p) {
					$.post('get_galerias.php',{
						acao: "PICTURES-LIST",
						lang: settings.lang,
						idcategoria: p.idcategoria
					},
						function(resposta){							
							$("#pictures").html(resposta);
							$.jqWebSite.GaleriasLoadMain();
							$.jqWebSite.GaleriaAccordion();
							return false;
						}
					);
				},// end : GaleriasLoad

				// Vídeos
				// -----------------------------------------------------------------
				VideosLoad: function(p) {
					$.post('get_galerias.php',{
						acao: "VIDEOS-LIST",
						lang: settings.lang,
						idcategoria: p.idcategoria
					},
						function(resposta){							
							$("#videos").html(resposta);
							return false;
						}
					);
				},// end : VideosLoad

				// PDFs
				// -----------------------------------------------------------------
				PDFSLoad: function(p) {
					$.post('get_galerias.php',{
						acao: "PDFS-LIST",
						lang: settings.lang,
						idcategoria: p.idcategoria
					},
						function(resposta){							
							$("#pdfs").html(resposta);
							return false;
						}
					);
				},// end : PDFSLoad


				// Carrega a imagem Main
				// -----------------------------------------------------------------
				GaleriasLoadMain: function() {
					$(".fileGaleria").click(function(){			
						$img	= $(this).attr('rel');
						
						//$(".fotoMainCenter").html('<div class="center"><img id="imgPreview" src="img/loading.gif"></div>');
						$("#imgPreview").attr("src", '');
						$("#imgPreview").hide();

						imgPreloader = new Image();
						imgPreloader.onload = function(){	
						imgPreloader.onload = null;
							$("#imgPreview").attr("src", $img);
						}
						imgPreloader.src = $img;
						$("#imgPreview").fadeIn();
					});// end : fileGaleria : click
				},// end : GaleriasLoadMain


				// Carrega a imagem Main
				// -----------------------------------------------------------------
				CategoriaLoad: function(p) {
					$("#retorno").html( 'load: '+ p.idcategoria );
					$.post('get_categorias.php',{
						acao: "CATEGORIAS-MAIN",
						lang: settings.lang,
						idcategoria: p.idcategoria
					},
						function(resposta){							
							$("#right").html(resposta);							
							$.jqWebSite.GaleriasLoad({idcategoria: p.idcategoria});
							$.jqWebSite.VideosLoad({idcategoria: p.idcategoria});
							$.jqWebSite.PDFSLoad({idcategoria: p.idcategoria});
							$.jqWebSite.GaleriasLoadMain();
							return false;
						}
					);

				},// end : CategoriaLoad










				// Relacionados
				// -----------------------------------------------------------------
				// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
				// GALERIA DE IMAGENS
				// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
				GaleriaImoveisLoad: function() {
					$.post('get_imoveis.php',{
						acao: "LISTAGEM",
						id: settings.idimovel
					},
						function(resposta){							
							$("#retornoGaleria").html(resposta);
							$.jqWebSite.GaleriaImoveisUpdate();
							$.jqWebSite.GaleriaImoveisDelete();
							return false;
						}
					);
				},// end : GaleriaLoad

				GaleriaImoveisUpdate: function() {
					$(".updateArqGal").click(function(){
						var $href = $(this).attr('rel');
						var $title = $(this).attr('title');

						GB_myShow($title, '../../admin/'+ $href, 280, 400); return false; return false;
						return false;
					});
				},// end : GaleriaUpdate

				GaleriaImoveisDelete: function() {
					$(".deleteArqGal").click(function(){			
						if (!confirm("Este processo não pode ser revertido, deseja continuar?")){
							return false;
						}

						$code	= $(this).attr('code');
						$.post("get_imoveis.php",{ acao: "EXCLUIR", id: $code },
							function(json){
								if(json.report.success == 'true'){
									var mensagem = json.report.mensagem;
								} else {
									var mensagem = json.report.mensagem;
								}

								$.jqWebSite.GaleriaImoveisLoad();
								return false;
							}, "json"
						);
						return false;
					});// end : deleteArqGal : click
				},// end : GaleriaDelete





				// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
				// PAGINAÇÃO
				// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
				Paginacao: function(p) {
					$(".pagenav a").click(function(){
						$rel		= $(this).attr('rel');
						$page		= $(this).attr('code');

						$.jqWebSite.UserImvDisponiveis({
							pagina: $page					
						});
						/*
						$.post($rel,{acao : p.acao, pagina : $page },
							function(resposta){
								$(p.div).html(resposta);								
							}
						);
						*/
						return false;
					});
				},// end : UserImvDisponiveis




				um: function() { 
					alert('um ' + settings.name )
				},

        dois: function() {
					alert('dois ' + settings.id)
				}

			};
		}()
	});
})(jQuery);




/*
$(function(){
   $.plugin.um();
   $.plugin.dois();
});
*/


/*
;(function($){
   $.extend({
      plugin: function() {
         return {
            um: function() { alert('um')
						},
            dois: function() {alert('dois')}
         };
      }()
   });
})(jQuery);
*/