// JavaScript Document

$(document).ready(function(){
	$("#AccountNumber").focus();

	$('div.tabNavbar div').click(function() {
		var curChildIndex = $(this).prevAll().length + 1;
		$(this).parent().children('.current').removeClass('current');
		$(this).addClass('current');
		$(this).parent().next('.tabContainer').children('.current').hide('fast',function() {
			$(this).removeClass('current');
			$(this).parent().children('div:nth-child('+curChildIndex+')').show('normal',function() {
				$(this).addClass('current');
			});
		});
		return false;								
	});
	
	//uses bPopup to enlarge thumbs ID'd as popsmallN where N = integer and corresponds to large picture called poplargeN
	$("img.popsmall").bind('click', function(e){
		var popImageNumber = e.target.getAttribute("id").substr(8);
		var largePopElement = "div#poplarge" + popImageNumber;
      $(largePopElement).openPopup({amsl:0, opacity:0.8});
	  $(largePopElement + " input.bClose").css("float", "right");
	  $(largePopElement + ' img').css('border', 'solid medium #FFF');
   });


	
	$('.emailHotspot').click(function(e) {
		var addressee = '';
		var mailtoHref = '';
		var contact = $(e.currentTarget).attr("id");
		switch (contact){
			case "home_contact_admin":
				addressee = 'admin';
				break;
			case "home_contact_scott":
				addressee = 'scott';
				break;
			case "home_contact_will":
				addressee = 'will';
				break;
			case "home_contact_nik":
				addressee = 'nik';
				break;
		}
		mailtoHref = 'mailto:' + addressee + '@noteableblends.com';
		window.location.href = mailtoHref;
		return false;
	});
	

	
	
	$("#home_contacts_where").click(function(){
		window.location.replace("http://noteableblends.com/streetmap.html");
	});
	
	$("#member_reg").click(function(){
		window.location.replace("http://noteableblends.com/member_registration.php");
	});
	
	$("#membership_reasons").click(function(){
		alert("here");
		window.location.replace("http://noteableblends.com/membership_reasons.html");
	});
	
	$("#logo_sound").jPlayer( {
				 oggSupport: true,
                 ready: function () {
                 this.element.jPlayer("setFile", "audio/mamuto.mp3", "audio/mamuto.ogg");
                   }
				});
	
	$("#logo_slogan").click( function() { $("#logo_sound").jPlayer("play") });
	
		//qtips
	$.fn.qtip.styles.nbstyle = { // Last part is the name of the style
	   width: 200,
	   background: '#E5223F',
	   color: '#FFE1A6',
	   textAlign: 'center',
	   border: {
		  width: 1,
		  radius: 3,
		  color: '#821323'
	   },
	   tip: 'bottomLeft',
	   target: 'topRight',
	   name: 'dark' // Inherit the rest of the attributes from the preset dark style
	}
	
	
	$('img.popsmall').qtip(
   {
      style: { name: 'nbstyle', tip: true },
	  content: 'Click image to view LARGER version',
	  position: {
		  corner: {
					target: 'topMiddle',
					tooltip: 'bottomLeft'
		  },
		  adjust: { y: -10,
		  			screen: true,
		  			scroll: false}
	  }
   });
});
