function slidethingy1 () {	
	jQuery("li#slide2").css("display", "block");
	jQuery("li#slide2").show("slide", { direction: "up" }, 800);
	jQuery("li#slide2").height(jQuery("li#slide2").height());
}
function about_down (){
	jQuery("div#about_down").css("display", "block");
	jQuery("div#about_down").show("blind", { direction: "vertical" }, 1000);
	jQuery("div#contact_down").hide();
}
function about_bye (){
	jQuery("div#about_down").hide();
}
function contact_down (){
	jQuery("div#contact_down").css("display", "block");
	jQuery("div#contact_down").show("blind", { direction: "vertical" }, 1000);
	jQuery("div#about_down").hide();
}
function contact_bye (){
	jQuery("div#contact_down").hide("blind", { direction: "vertical" }, 1000);
}
function info_down (){
	jQuery("div#info_down").show("blind", { direction: "vertical" }, 1000);
	jQuery("div#contact_down").hide();
	jQuery("div#about_down").hide();
}
function info_bye (){
	jQuery("div#info_down").hide("blind", { direction: "vertical" }, 1000);
}


(function($) {

$(document).ready(function() {

    var slideLI = document.createElement("li");
    slideLI.setAttribute("class", "slide2");
    slideLI.setAttribute("id", "slide2");
    $('li.selectedtab ~ li.childitem1').wrapAll(slideLI).wrapAll(document.createElement("ul"));
    var dropdown = jQuery('li.selectedtab ~ li.slide2');

    dropdown.hide();

    $("div#about_down").hide();
    $("div#contact_down").hide();
    $("div#info_down").hide();
    function filterPath(string) {
        return string
 		.replace(/^\//, '')
 		.replace(/(index|default).[a-zA-Z]{3,4}$/, '')
 		.replace(/\/$/, '');
    }
    var locationPath = filterPath(location.pathname);

    $('li.slide2 a').each(function() {
        var thisPath = filterPath(this.pathname) || locationPath;
        //alert(thisPath);
        thisPath = thisPath.replace(locationPath, "");
        thisPath = thisPath.replace("/", "#");
        $(this).attr("href", thisPath);
        $(this).click(function(event) {
            event.preventDefault();
            var jQuerytarget = jQuery(this.hash), target = this.hash;
            var targetOffset = jQuerytarget.offset().top;
            $('html, body').animate({ scrollTop: targetOffset }, 1000, function() {
                location.hash = target;
            });
            });
    });
    //setTimeout("slidethingy1()", 1000);
    $("li#slide2").css("display", "block");

    //Automatically Check AddToMailList checkboxes
    $('input[type="checkbox"]').each(function(){
        var id = jQuery(this).attr("id");
        if (id.indexOf('AddToMailingList') != -1)
        {
            $(this).attr("checked",true);
        }
    });
});

})(jQuery);
