$(document).ready(function() {
	// $('#bt_cardapio').click(function(){
		// $('#bg_gallery').fadeIn(200, function(){
			// $('#gallery').fadeIn(500);
			// $('#close').fadeIn(200);
		// });
	// });
	// $('#close').click(function(){
		// $('#gallery').fadeOut(400, function(){
			// $('#bg_gallery').fadeOut(200);
			// $('#close').fadeOut(200);
		// });
	// });
	
	// $('#bt_cardapio1').click(function(){
		// $('#bg_gallery').fadeIn(200, function(){
			// $('#gallery1').fadeIn(500);
			// $('#close1').fadeIn(200);
		// });
	// });
	// $('#close1').click(function(){
		// $('#gallery1').fadeOut(400, function(){
			// $('#bg_gallery').fadeOut(200);
			// $('#close1').fadeOut(200);
		// });
	// });
	
	// $('#bt_cardapio2').click(function(){
		// $('#bg_gallery').fadeIn(200, function(){
			// $('#gallery2').fadeIn(500);
			// $('#close2').fadeIn(200);
		// });
	// });
	// $('#close2').click(function(){
		// $('#gallery2').fadeOut(400, function(){
			// $('#bg_gallery').fadeOut(200);
			// $('#close2').fadeOut(200);
		// });
	// });
	
	var endereco1 = '<iframe width="556" height="267" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://www.google.com/maps?f=q&amp;source=s_q&amp;hl=pt-BR&amp;geocode=&amp;q=Rua+Waldemar+Geib,+161+-+Novo+Hamburgo&amp;sll=37.0625,-95.677068&amp;sspn=41.224889,106.787109&amp;ie=UTF8&amp;hq=&amp;hnear=R.+Waldemar+Geib,+161+-+Canudos,+Novo+Hamburgo+-+Rio+Grande+do+Sul,+93540-300,+Brasil&amp;z=14&amp;iwloc=A&amp;ll=-29.688529,-51.105939&amp;output=embed"></iframe>';
	var endereco2 = '<iframe width="556" height="267" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://www.google.com/maps?f=q&amp;source=s_q&amp;hl=pt-BR&amp;geocode=&amp;q=Rua+Bento+Gon%C3%A7alves,+1759+-+Novo+Hamburgo&amp;sll=-29.688529,-51.105939&amp;sspn=0.011073,0.026071&amp;ie=UTF8&amp;hq=&amp;hnear=R.+Bento+Gon%C3%A7alves,+1759+-+P%C3%A1tria+Nova,+Novo+Hamburgo+-+Rio+Grande+do+Sul,+93410-003,+Brasil&amp;ll=-29.688537,-51.105952&amp;spn=0.011072,0.026071&amp;z=14&amp;output=embed"></iframe>';
	
	$('.abremapa').click(function(event){
		event.preventDefault();
		if ($(this).attr('id') == 'endereco1') {
			$('#div_endereco1').show().find('.cont_iframe').html(endereco1);
		} else {
			$('#div_endereco2').show().find('.cont_iframe').html(endereco2);
		}
		$('#popupBg').height($(document).height()).css('padding-top', 100+$(document).scrollTop()).fadeIn(200);
	});
	$('.btFecharPop').click(function(event){
		event.preventDefault();
		$('#popupBg').fadeOut(200);
		$('.div_mapa').hide();
	});
	$('#popupBg').click(function(){
		$('#popupBg').fadeOut(200);
		$('.div_mapa').hide();
	});
	
	$('.abreMiniImg').click(function(event){
		event.preventDefault();
		$('#imgHome').find('img').attr('src',$(this).parent().attr('href'));
		$('#imgHome').show();
		$('#popupBg').height($(document).height()).css('padding-top', 100+$(document).scrollTop()).fadeIn(200);
	});
	
});

function swapI(obj,focus){
	if(focus){
		if(obj.value == obj.attributes["label"].value){
			obj.value = "";
		}
	} else {
		if(obj.value.trim() == ""){
			obj.value = obj.attributes["label"].value;
		}
	}
}
function swapP(obj,focus){
	if(focus){
		var pass = document.getElementById(obj.attributes["parent"].value);
		if(pass){
			obj.innerHTML = "";
			pass.focus();
		}
	} else {
		if(obj.value == ""){
			var div = document.getElementById("div"+obj.id);
			if(div){
				div.innerHTML = obj.attributes["label"].value;
			}
		}
	}
}

function picture(tmp_src, tmp_width, tmp_height){
	var popup = new Popup(tmp_width,tmp_height);
	popup.overflow = 'hidden';
	popup.position = 'fixed';
	popup.open('../../inc/structure/picture.php?src='+tmp_src);
}

function abrePopMapaUnimed() {
	var popup = new Popup(642,384);
	popup.overflow = 'hidden';
	popup.template = 2;
	//popup.position = 'fixed';
	popup.open('../../inc/structure/pop_endereco2.php');
}

function abrePopMapaBento() {
	var popup = new Popup(642,384);
	popup.overflow = 'hidden';
	popup.template = 2;
	//popup.position = 'fixed';
	popup.open('../../inc/structure/pop_endereco1.php');
}


