// Dom ready
$(document).ready(function() {
   	
	// Dropdown navigation
	$('#nav').superfish({
        pathClass: 'current',
        speed: 'normal',
        autoArrows: false,
        dropShadows: false
    });
    
    embedFlash();
    initFeature();
	
});

// Only after page is fully loaded
$(window).load(function() {
	
	setTagline();
	
});

/**
 *  Set tagline
 *  
 *  Display a random tagline in the header
 **/
function setTagline() 
{
	var tags = new Array(
		"TCS is: Tier 1 Connectivity Services", 
		"TCS is: Technology Center Solutions", 
		"TCS is: Tightly Controlled Security", 
		"TCS is: Total Customer Satisfaction"
	);
	
	var rand = Math.floor(Math.random() * tags.length);
	var html = $('<div></div>').attr('id','tagline').html(tags[rand]);

	$(html).appendTo('#slogan').hide().fadeIn('slow');
}

/**
 *  Embed Home Page Flash
 *
 *  Embed flash movie via swfobject 
 *  Note: path to swf file is relative to the html page
 **/
function embedFlash() 
{
	if($('#flash').length) {
		var flashvars = {};
        var params = {wmode:"opaque"};
        var attributes = {};
	    swfobject.embedSWF("images/home_banner.swf", "flash", "920", "305", "9.0.0", false, flashvars, params, attributes);
	}
}

/**
 *  Init Feature Rollovers
 *  
 *  Swap description classes on link rollover
 **/
function initFeature() 
{
	$('#feature a').hover(
        function(){
            el = $(this).attr('rel');
            $('#feature a').removeClass('current');
            $('#feature p').removeClass('current');
            $(this).addClass('current');
            $(el).addClass('current');
        },
        function(){}
    ); 
}