// superfish menu nav
jQuery(document).ready(function() {
    	  // Main navigation dropdowns
          $('ul.sf-menu').superfish({
                delay:       300,                            // one second delay on mouseout
                animation:   { height:'show' },              // fade-in and slide-down animation
                speed:       'fast',                         // faster animation speed
                autoArrows:  false,                           // disable generation of arrow mark-up
                disableHI:   true,
                dropShadows: false                           // disable drop shadows
          });
          $("ul.tabs").tabs("div.panes > div");
          $("ul.css-tabs").tabs("div.css-panes > div");
          $(".scrollable").scrollable();
          $(".accordion").tabs(".pane", {tabs: 'h2', effect: 'slide'});
          $(".accordion-faq").tabs(".pane", {tabs: 'span', effect: 'slide'});
     	  $('img.captify').captify({});
          /* External links open in new windows */
          $("a[rel='external']").bind("click.external", function(){
            window.open(this.href);
            return false;
          });
          $("a[rel^='prettyPhoto']").prettyPhoto();
});

// simple hide no animation
function hide(id){
    if (document.getElementById){
    obj = document.getElementById(id);
    obj.style.display = "none";
    }     }

// simple show no animation
function show(id){
    if (document.getElementById){
    obj = document.getElementById(id);
    obj.style.display = "";
    }    }

// jquery hide, show and toggle
function ajaxshow(id){
	$(id).fadeIn("slow");
}
function ajaxhide(id){
	$(id).fadeOut("slow");
}
function toggle(id){
	$(id).slideToggle("fast");
}

// Cufon Replacements
Cufon.replace(' h1, h2, h3, .applyfont', { hover: true, fontFamily: 'Vera' });
Cufon.replace(' .big-footer h3', { textShadow: '1px 1px #ffffff', fontFamily: 'Vera' });
Cufon.replace(' .applyfont, .sidebar-left h3, .sidebar-right h3', { textShadow: '1px 1px #ffffff', fontFamily: 'Vera' });

//script for search box and newsletter box
var elementsCleared = [];
function clearBox(element)
{
	if (elementsCleared[element] === undefined)
	{
		elementsCleared[element] = $("#" + element).attr('value');
		$("#" + element).val('');
	}
}
function resetBox(element, text)
{
	if ($("#" + element).val() == "")
	{
		$("#" + element).val(text);
		elementsCleared[element] = undefined;
	}
}

jQuery(document).ready(function() {
	$("#keywords").focus(function(){
		clearBox($(this).attr('id'));
	});
	$("#keywords").blur(function(){
		resetBox($(this).attr('id'), 'Search...');
	});
	$("#newsletter-field").focus(function(){
		clearBox($(this).attr('id'));
	});
	$("#newsletter-field").blur(function(){
		resetBox($(this).attr('id'), 'Email...');
	});
});
