/*
 * Nome: global.js
 * Desenvolvido por: Webee E-marketing
 * Data da Criação: 17-08-2010
 * Última modificação: XX-08-2010
 * Copyright (c) 2011 Webee E-marketing (http://www.webee.com.br)
 */
 
Cufon.replace(".cufon", {hover: true});
 
$(document).ready(function(){
	
	$(".total").css({'font-size': '13px'});
	
	$('#mycarousel').jcarousel({
		scroll: 1,
		auto: 3,
		wrap: 'circular'
	});	
	$('#mycarousel2').jcarousel({
		scroll: 1,
		auto:0
	});	
	
	$('#mycarousel3').jcarousel({
		scroll: 1,
		auto:0
	});
	
	$('.item-colorbox').css({'cursor': 'pointer'});
	$(".item-colorbox").live('click', function(){
		$.fn.colorbox({href:$(this).find("a:first").attr('href'), open: true});
		return false;
	});
	
	$(".link_externo_home a").css({'display': 'none'});
	$(".link_externo_home").css({'cursor': 'pointer'});
	$(".link_externo_home").click(
		function(){
			var destino = $(this).find("a:first").attr("href");
			window.open(destino);
		}
	);
	
	$(".link_interno_home a").css({'display': 'none'});
	$(".link_interno_home").css({'cursor': 'pointer'});
	$(".link_interno_home").click(
		function(){
			var destino = $(this).find("a:first").attr("href");
			window.location = destino;
		}
	);

	//Botão Curtir Facebook
	/*$(".btFacebook").click(
		function(){
			window.open('http://www.facebook.com/sharer.php?u=http://kingdom2800.com.br/fotos-lista.php?fotos=210&t=Kingdom2800&src=sp');
			//$(".btFacebook").html('<iframe src="http://www.facebook.com/share.php?t=http://server/2800/site/fotos-detalhes.php?id_galeria=1" style="border: medium none; overflow: hidden; width: 250px; height: 25px;" allowtransparency="true" scrolling="no" frameborder="0"></iframe>');
		}
	);
	
	//Botão Retweet
	$(".btTwitter").click(
		function(){
			window.open('https://twitter.com/intent/tweet?source=webclient&text=Kingdom2800+http://kingdom2800.com.br/fotos-lista.php?fotos=210');
			//$(".btTwitter").html('<iframe src="http://twitter.com/?status=http://server/2800/site/fotos-detalhes.php?id_galeria=1" role="presentation" allowtransparency="true" scrollbars="no" style="width: 110px; height: 20px;" scrolling="no" frameborder="0"></iframe>');
		}
	);
	
	//Botão Compartilhar Orkut
	$(".btOrkut").click(
		function(){
			window.open('http://promote.orkut.com/preview?nt=orkut.com&du=http://kingdom2800.com.br/fotos-lista.php?fotos=210&tt=Kingdom2800');
			//$(".btOrkut").html('<iframe src="http://promote.orkut.com/preview?nt=http://server/2800/site/fotos-detalhes.php?id_galeria=1" role="presentation" allowtransparency="true" scrollbars="no" style="width: 110px; height: 20px;" scrolling="no" frameborder="0"></iframe>');
		}
	);*/
		
	$('#submenu_produtos li.first:last').css('border', 'none');
	
	//BOTÃO QUE CHAMA O VÍDEO DO YOUTUBE NA INDEX ASSIM QUE CLICADO - INICIO
	/*$(".midias-sociais-tvkingdom-video-bt").click(
		function(){
			$("a.videoYoutube").youtubin({
				swfWidth : 236,
				swfHeight : 190
			});
			$(".midias-sociais-tvkingdom-video-bt").css({'display':'none'});
		}
	);*/
	//BOTÃO QUE CHAMA O VÍDEO DO YOUTUBE NA INDEX ASSIM QUE CLICADO - FIM
	$(".videoYoutubePlay").ytplaylist({
		addThumbs:true, 
		autoPlay: false, 
		playerWidth: '320',
		playerHeight: '240'
    });
	
	$(".videoYoutubePlay li a img").css({'width': '233'});
	$(".videoYoutubePlay li a img").css({'height': '180'});
	$(".videoYoutubePlay li a img").css({'display': 'block'});
	$(".videoYoutubePlay li a img").css({'margin-top': '5px'});
	$(".videoYoutubePlay li a img").css({'margin-left': '1px'});
	
	$(".midias-sociais-tvkingdom-video-bt").colorbox();

	$('a.external').attr('target','_blank');
	
	//$("a[rel='colorbox'").colorbox();
	$(".colorbox-presidente").colorbox({width: "420px", height: "495px", iframe: true});	
	
	//Colorbox p/ qualquer imagem
	$(".colorbox").colorbox();
	
	$("a[rel='colorboxNaMidia']").colorbox();

	$(".hover-fade,.scrollableArea a").hover(function(){
		$(this).fadeTo("fast", 0.8);
			},function(){
		$(this).fadeTo("fast", 1.0);
	});
	
	
	$("input[name='quantidade']").bind("keyup blur focus", function(e) {
	   e.preventDefault();
	   var expre = /[A-Za-z\.\§\£\@\`\Ž\^\~\'\"\!\?\#\$\%\š\¬\_\+\=\.\,\:\;\<\>\|\°\ª\º\]\[\{\}\\ \)\(\*\&\-\/\\]/g;
	
	   // REMOVE OS CARACTERES DA EXPRESSAO ACIMA
	   if ($(this).val().match(expre))
		   $(this).val($(this).val().replace(expre,''));
	});
	
	$('#txprojeto').filestyle({ 
		image: "img/bt_procurar.jpg",
		imagewidth : 134,
		imageheight : 38,
		width: 270,
		heigth: 38
	});
	
	
	/*$("#produtos_menu").hover(function(){
		$("#submenu_produtos").show();
			},function(){
		$("#submenu_produtos").hide();
	});*/
		
	/*$('#txcurriculo').change(function(){
		$('#fakefileinput').val($('#txcurriculo').val());
	});*/
	
	/* Alternar Cores */
	$("li.item:even").addClass("cor-1"); // Par-Branco
	$("li.item:odd").addClass("cor-2"); // Impar-Verde
	
	
	
	
		
	

});

/* Abrir pop-up Centralizada */
function abrir(pagina, largura, altura) {
	// Definindo meio da tela
	var esquerda = (screen.width - largura)/2;
	var topo = (screen.height - altura)/2;
	
	// Abre a nova janela
	window.open(pagina,'','height=' + altura + ', width=' + largura + ', top=' + topo + ', left=' + esquerda);
}

/*Exemplo de Função */
function validaEmail(email) {
	email_original = email
	arroba = email.indexOf("@");
	ponto = email.indexOf(".");
	if (ponto < arroba) {
		parte2 = email.indexOf(".");
		parte4 = email.substring(0,parte2);
		parte3 = email.length;
		email = parte4 + email.substring(parte2+1,parte3);
	}
	parte1 = email.indexOf("@");
	parte2 = email.indexOf(".");
	parte3 = email.length;
	email = email_original;
	if (!(parte1 >= 3 && parte2 >= 6 && parte3 >= 9)) return false;
	else return true;
}

/*function validaAcessoRestrito(form){

	var formulario = form;
	
	if (!validaEmail(formulario.email.value)) {
		alert("Digite o e-mail corretamente!");
		formulario.email.focus();
		return false;
	};
	
	if (!formulario.senha.value) {
		alert("Digite a senha!");
		formulario.senha.focus();
		return false;
	};

	return true;
}*/

/*function fechaCM8(){
	document.getElementById("objBannerCM8").style.visibility="hidden";
}

function fecha(){
	fechaCM8();
}*/
