// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

$(function() {
	var tabContainers = $('div.tabs > div');
	tabContainers.hide().filter('#overview').show();
	
	$('div.tabs ul.tab-navigation a').click(function () {
		tabContainers.hide();
		tabContainers.filter(this.hash).show();
		$('div.tabs ul.tab-navigation a').removeClass('current');
		$(this).addClass('current');
		return false;
	}).filter('#overview').click();
});


$(document).ready(function(){
	// $("#product_registration").validate();
	
	// support answer toggle
	$(".question").click(function(){
		// jQuery(this).siblings(".answer").toggle();
		$(".answer").hide();
		$(this).siblings(".answer").show();
		return false;
	});

});


/* REGION SELECTOR */
Shadowbox.loadSkin('classic', '/shadowbox/skin');
$(document).ready(function(){
	Shadowbox.init({
        overlayColor: '#000',
        overlayOpacity: 0.9
  });
  $('#changeregion').click(function(e){
    e.preventDefault();
    s = Shadowbox.open({
      content: '/settings',
      width: '180px',
      height: '250px',
      player: 'xhr',
      title: 'Select a region:'
    });
  });
  
  if(region == '') $('#changeregion').triggerHandler('click');
});

$(document).ready(function(){
	// alert('jQuery Loves You!');

/* Remove newsletter's prompt value upon focus and re-add it if blank  */
	var newsletter_prompt = 'SIGN UP FOR OUR NEWSLETTER';
	$('div#header_email_signup input').focus(function() {
		if ($(this).val() == newsletter_prompt) {
			$(this).val('');
		}
	})
	.blur(function() {
		if ($(this).val() == '') {
			$(this).val(newsletter_prompt)
		}
	});

/* Remove newsletter's prompt value upon focus and re-add it if blank  */
	var newsletter_prompt = 'SIGN UP FOR OUR NEWSLETTER';
	$('div#newsletter_index input').focus(function() {
		if ($(this).val() == newsletter_prompt) {
			$(this).val('');
		}
	})
	.blur(function() {
		if ($(this).val() == '') {
			$(this).val(newsletter_prompt)
		}
	});
	
});	


