;(function($){
	$.extend({
		jqWebSite: function(options) {
			return {
				init: function(options) {
					settings = jQuery.extend({
						//name: options.name,
						lang: options.lang
					}, options);
					
					return this;
				},

				// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
				// 
				// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
				

				// Categorias : Menu Lateral
				// -----------------------------------------------------------------
				CategMenu: function(p) {
					$('#navigation').accordion({
						active: -1,
						autoheight: false,
						header: '.head',
						navigation: true
					});	
				},// end : CategMenu

				// Cesta : Adiciona um item a cesta
				// -----------------------------------------------------------------
				CestaLoad: function(p) {
					$("#addCesta").click(function(){
						$hash	= $(this).attr('code');
						$.post("get_cesta.php",{ 
							acao: "ADD-CESTA", 
							hash: $hash 
						}, function(json){
								if(json.report.success == 'true'){
									var mensagem = json.report.mensagem;
									window.location = "cesta.php";
								} else {
									var mensagem = json.report.mensagem;
								}

								//alert(mensagem);
								return false;
							}, "json"
						);
					});// end : addCesta : click

				},// end : CestaLoad


				// Cesta : Exibe a quantidade de produtos na cesta
				// -----------------------------------------------------------------
				CestaLoadCompras: function(p) {
					$.post("get_cesta.php",{ 
						acao: "MINHAS-COMPRAS"
					}, function(json){
							if(json.report.success == 'true'){
								/*
								var strHtml = "";								
								if(json.cesta.quantidade > 0){
									strHtml = "<a href=\"cesta.php\">"+ json.cesta.quantidade +"</a>";
								} else {
									strHtml = "<span>"+ json.cesta.quantidade +"</span>";
								}
								*/
								$("#dvMinhaCesta").html("<span>"+ json.cesta.quantidade +"</span>")
							} 
							return false;
						}, "json"
					);

				},// end : CestaLoadCompras


				// Cesta : Atualiza os produtos da cesta
				// -----------------------------------------------------------------
				CestaAction: function(p) {
					$("#updateCesta").click(function(){
						if($.jqValidacao.validarCadastro()){
							var form = document.frmUpdateCesta;
							form.submit();
						}		
						return false;
					});

					$("#checkoutCesta").click(function(){ // Verifica se existe registros
						if($.jqValidacao.validarCadastro()){
							var itens = new String('');
							//$("input[@name=itemId[]]").each(function(){
							$(".check_item").each(function(){
								if( itens.length > 0) itens += ',';
								itens += $(this).val();
							});
							
							if(itens.length < 1) {
								alert('Sua cesta de compras está vazia!');
								return false;
							}else{
								$("#strAcaoFinal").val('FINALIZAR');
								var form = document.frmUpdateCesta;
								//form.strFinalizar.value = "FINALIZAR"; 
								form.submit();
							}
						}
						return false;
					})

				}, //CestaAction


				CestaUpdateOLD: function(p) {
					$("#updateCesta").click(function(){
						var itens   = new String('');
						$("input[@name=chkItensDelete]").each(function(){
							if(this.checked){
								if( itens.length > 0) itens += ',';
								itens += $(this).val();
							}
						});

						if(itens.length < 1) {
							alert('Selecione no mínimo um (1) registro para excluir!');
							return false;
						}
						if (!confirm("Este processo não pode ser revertido, deseja continuar?")){
							return false;
						}

						alert(itens);
						return false;
						$.post("get_cesta.php",{ 
							acao: "REMOVER", 
							hash: $hash 
						}, function(json){
								
								
								/*

								alert( json.report.success );
								if(json.report.success == 'true'){
									var mensagem = json.report.mensagem;
									window.location = "cesta.php";
								} else {
									var mensagem = json.report.mensagem;
								}

								//alert(mensagem);
								return false;*/
							}, "json"
						);

						return false;
					});
				},// end : CestaUpdate


				// Cesta : Atualiza os produtos da cesta
				// -----------------------------------------------------------------
				LoginLoad: function(p) {
					$("#postLogin").click(function(){

						if($.jqValidacao.validaFull()){
							var form = document.formLogin;
							form.submit();
						}						
						return false;
					});

					$("#postEsqueci").click(function(){
						if($.jqValidacao.validaFull()){
							var form = document.formEsqueci;
							form.submit();
						}						
						return false;
					})
				},

				// ZoomImg : Exibe a imagem no div maior
				// -----------------------------------------------------------------
				ZoomImg: function(p) {
					$(".zoomImg").click(function(){
						$image	= $(this).attr('href');

						$("#imgZoom").html('');
						$("#imgZoom").html("<img src=\""+ $image +"\" border=\"0\" width=\"228\" height=\"212\">");
						return false;
					
					});
				},// end : ZoomImg


				// Blog : Adicionar
				// -----------------------------------------------------------------
				BlogRedes: function(p) {
					$(".dvCompartilhe").click(function(){
						url_compartilhar = window.location;
						$code	= $(this).attr('code');
						var tit	= $(this).attr('rel');

						redes = "<a href=\"https://favorites.live.com/quickadd.aspx?marklet=1&mkt=pt-br&url="+url_compartilhar+"&title="+tit+"&top=1\" target=\"_blank\"><img src=\"images/redes/live_ico.gif\" border=\"0\" alt=\"Live\" title=\"Live\"></a>&nbsp;";

						redes = redes +"<a href=\"http://del.icio.us/post?url="+url_compartilhar+"&title="+tit+"\" target=\"_blank\"><img src=\"images/redes/delicio_ico.gif\" border=\"0\" alt=\"del.icio.us\" title=\"del.icio.us\"></a>&nbsp;";

						redes=redes +"<a href=\"http://myweb2.search.yahoo.com/myresults/bookmarklet?t="+tit+"&u="+url_compartilhar+"\" target=\"_blank\"><img src=\"images/redes/yahoo_ico.gif\" border=\"0\" alt=\"Yahoo MyWeb\" title=\Yahoo MyWeb\"></a>&nbsp;";

						redes = redes +"<a href=\"http://technorati.com/faves?add="+url_compartilhar+"\" target=\"_blank\"><img src=\"images/redes/technorati_ico.gif\" border=\"0\" alt=\"Technorati\" title=\"Technorati\"></a>&nbsp;";

						redes = redes +"<a href=\"http://digg.com/submit?url="+url_compartilhar+"&title="+tit+"\" target=\"_blank\"><img src=\"images/redes/digg_ico.gif\" border=\"0\" alt=\"Digg\" title=\"Digg\"></a>&nbsp;";

						redes = redes +"<a href=\"http://www.google.com/bookmarks/mark?op=edit&bkmk="+url_compartilhar+"&title="+tit+"\" target=\"_blank\"><img src=\"images/redes/goggle_ico.gif\" border=\"0\" alt=\"Google\" title=\"Google\"></a>&nbsp;";

						redes = redes +"<a href=\"http://rec6.via6.com/link.php?url="+url_compartilhar+"&titulo="+tit+"\" target=\"_blank\"><img src=\"images/redes/rec6_ico.gif\" border=\"0\" alt=\"Rec6\" title=\"Rec6\"></a>&nbsp;";

						redes = redes +"<a href=\"http://www.facebook.com/share.php?u="+url_compartilhar+"\" target=\"_blank\"><img src=\"images/redes/facebook_ico.gif\" border=\"0\" alt=\"Facebook\" title=\"Facebook\"></a>&nbsp;";

						redes = redes +"<a href=\"http://www.linkk.com.br/submit.php?url="+url_compartilhar+"&title="+tit+"\" target=\"_blank\"><img src=\"images/redes/linkk_ico.gif\" border=\"0\" alt=\"Linkk\" title=\"Linkk\"></a>&nbsp;";

						redes = redes +"<a href=\"http://www.netscape.com/submit/?U="+url_compartilhar+"&T="+tit+"\" target=\"_blank\"><img src=\"images/redes/netscape_ico.gif\" border=\"0\" alt=\"Netscape\" title=\"Netscape\"></a>&nbsp;";

						redes = redes +"<a href=\"http://reddit.com/submit?url="+url_compartilhar+"&title="+tit+"\" target=\"_blank\"><img src=\"images/redes/reddit_ico.gif\" border=\"0\" alt=\"reddit\" title=\"reddit\"></a>&nbsp;";

						redes = redes +"<a href=\"http://www.stumbleupon.com/submit?url="+url_compartilhar+"&title="+tit+"\" target=\"_blank\"><img src=\"images/redes/stumbleupon_ico.gif\" border=\"0\" alt=\"StumbleUpon\" title=\"StumbleUpon\"></a>&nbsp;";





						$("#compartilhe_"+ $code).html(redes);
						$("#compartilhe_"+ $code).toggle();
						//alert($code);
						return false;
						

						/*
						$.post("get_cesta.php",{ 
							acao: "ADD-CESTA", 
							hash: $hash 
						}, function(json){
								if(json.report.success == 'true'){
									var mensagem = json.report.mensagem;
									window.location = "cesta.php";
								} else {
									var mensagem = json.report.mensagem;
								}

								//alert(mensagem);
								return false;
							}, "json"
						);
						*/
					});// end : addCesta : click

				},// end : BlogRedes






				um: function() { 
					alert('um ' + settings.name )
				},

        dois: function() {
					alert('dois ' + settings.id)
				}

			};
		}()
	});
})(jQuery);




