/* keep the Flickr images hidden until they are
       loaded and then fade them in.  Just give any
       image being loaded from Flickr the flickr class
       */
jQuery(document).ready(
    function() {
        
        jQuery("img.flickr").each(
            function(){
                if(this.complete) jQuery(this).fadeIn(500);
                if(BrowserDetect.browser == 'Opera'){
                    jQuery(this).fadeIn(500);
                }
            }
        );

        jQuery("img.flickr").load(
            function(event){
                jQuery(this).fadeIn(500);
                if(BrowserDetect.browser == 'Opera' && this.complete){
                    jQuery(this).fadeIn(500);
                }
            }
        );
       
    }
);

function showFeaturedItem(id) {
    var selectedTabTextColor = '453f2f';
    var tabTextColor = 'ffffff';
    var overTabTextColor = 'f57e20';
    
    jQuery('#LatestFeaturesContainer li.selected').each(
        function() {
            var link = jQuery(this).find("a").get(0);
            var img = jQuery(this).find("img").get(0);
            this.className = "";
            changeTextColor(link, tabTextColor);
            link.href="javascript:showFeaturedItem('" + this.id + "')";
            link.onmouseover = function() { changeTextColor(link, overTabTextColor);  };
            link.onmouseout = function() { changeTextColor(link, tabTextColor);  };
            jQuery("#" + this.id + "Container").hide();
        }
    );

    jQuery('#LatestFeaturesContainer li').each(
        function() {
            if (this.className == "subnavTitle") return;
            // get the nested anchor tag and img tag inside of the tab
            var link = jQuery(this).find("a").get(0);
            var img = jQuery(this).find("img").get(0);
            
            if (this.id == id) {
                link.blur();
                this.className = "selected";
                changeTextColor(link, selectedTabTextColor);
                link.onmouseover = null;
                link.onmouseout = null;
                link.href="#";
                jQuery("#" + this.id + "Container").show();
                
            }
        }
    );
}

function changeTextColor(container, color) {
    var img = jQuery(container).children("img")[0];
    img.src = img.src.replace(/tcol=.{6}/, "tcol=" + color);
}

function tabswap(id, obj)
{
    for(i = 1; i <= 4; i++){
        $('featureContentHolder'+ i).style.display = 'none';
        $('tick'+i).className = 'currTabOff';
    }
    $('featureContentHolder'+id).style.display = 'block';
    obj.className = 'currTab';
    
}

function tabswapv2(id, obj, total)
{
    for(i = 1; i <= total; i++){
        $('featureTab'+i).className = 'currTabOff';
    }
    $('featureTab'+id).style.display = 'block';
    obj.className = 'currTab';
    
}

$(document).ready(function(){

$('#content1').hide();

$('a').click(function(){
$('#content1').show('slow');
});

$('a#close').click(function(){
$('#content1').hide('slow');
})

});