$(document).ready(function() {    
    // !Accordion
    // !Fixes space between li's in IE
    if ($('ul.accordion li'))
        $('ul.accordion li').css('zoom', '1');
    if ($('ul.accordion_onclick li'))
        $('ul.accordion_onclick li').css('zoom', '1');
    if ($('ul.accordion_onclick li li'))
        $('ul.accordion_onclick li li').css('zoom', '0');

    if ($(".accordion")) {
        $(".accordion").accordion({
            active: false,
            event: 'mouseover',
            autoHeight: false,
            header: 'a.accordion_toggle',
            navigation: true,
            clearStyle: true
        });

        $(".accordion .accordion_nested").accordion({
            active: false,
            event: 'mouseover',
            autoHeight: false,
            header: 'a.accordion_nested_toggle',
            navigation: true,
            clearStyle: true
        });
        
        $(".accordion .accordion_nested .accordion_nested_quaternary").accordion({
            active: false,
            event: 'mouseover',
            alwaysOpen: true,
            autoHeight: false,
            header: 'a.accordion_nested_quaternary_toggle',
            navigation: true,
            clearStyle: true
        });

        $(".accordion_onclick").accordion({
            active: false,
            collapsible: true,
            event: 'click',
            autoHeight: false,
            header: 'a.accordion_toggle',
            navigation: true,
            clearStyle: true
        });

        $(".accordion_nested_onclick").accordion({
            active: false,
            event: 'click',
            alwaysOpen: false,
            autoHeight: false,
            header: 'a.accordion_nested_toggle',
            navigation: false,
            clearStyle: true
        });
    }
    // !Tabs
    if ($(".tabs"))
        $(".tabs").tabs({
            fx: {
                fadeTo: true,
                opacity: 'toggle',
                duration: 'fast'
            }
        });

    // !Video Pop-up
    if ($(".video_standard")) {
        $(".video_standard").fancybox({
            'padding': 0,
            'overlayShow': true,
            'frameWidth': 600,
            'frameHeight': 475
        });
    }
	if ($(".video_wide")) {
        $(".video_wide").fancybox({
            'padding': 0,
            'overlayShow': true,
            'frameWidth': 640,
            'frameHeight': 392
        });
	}
	if ($("a.video_withtext")) {
        $("a.video_withtext").fancybox({
            'padding': 0,
            'overlayShow': true,
            'frameWidth': 900,
            'frameHeight': 475
        });
	}
	if ($("a.fancy#first")) {
        $("a.fancy#first").fancybox({
            'zoomSpeedIn': 1,
            'zoomSpeedOut': 1,
            'overlayShow': false,
            'frameWidth': 800,
            'frameHeight': 600
        });
    }
});

// !Drop Down Menu
	function jumpMenu(targ, selObj, restore){
		window.open(selObj.options[selObj.selectedIndex].value,targ);
	}

// !Navigation Fix For IE
	sfHover = function() {
        var sfEls = $("#nav-primary 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);
			
// !Email Address Scrambler
	function mailtoVars(address, domain, ext, text) {
		var first = 'ma';
		var second = 'il';
		var third = 'to:';
	
		if(text != "false") {
			document.write('<a href="' + first + second + third + address + '&#64;' + domain + '.' + ext + '">' + text + '</a>');
		} else {	
			document.write('<a href="' + first + second + third + address + '&#64;' + domain + '.' + ext + '">' + address + '&#64;' + domain + '.' + ext + '</a>');
		} 	
	}	
