
$(window).load(function() {

    /* Language Country Menu*/
    $('#language-country').click(function() {
        $('#infglobal-menu-items1').slideToggle(500);
        if (!$("#careers-menu-items").is(":hidden"))
            $('#careers-menu-items').slideToggle(300);
    });
    $('#infglobal-menu-items1').mouseleave(function() { $('#infglobal-menu-items1').slideToggle(500); });

    /* careers Menu*/
    $('#careers-master').click(function() {
        $('#careers-menu-items').slideToggle(500);
        if (!$("#infglobal-menu-items1").is(":hidden"))
            $('#infglobal-menu-items1').slideToggle(300);
    });
    $('#careers-menu-items').mouseleave(function() { $('#careers-menu-items').slideToggle(500); });

    /*Main Menu Drop Down*/
    $(function() {
        $("ul.dropdown li").hover(function() {
            $(this).addClass("hover");
            $('ul:first', this).css('visibility', 'visible');
        }, function() {
            $(this).removeClass("hover");
            $('ul:first', this).css('visibility', 'hidden');
        });

        // $("ul.dropdown li ul li:has(ul)").find("a:first").append(" &raquo; ");
        $("ul.dropdown li ul li:has(ul)").find("a").addClass("show-3level");
    });


    // LEAD STORY  //
    $("#leadstory_container div:nth-child(1)").hide();
/*
    $.each($('#leadstory_container').find("a"), function() {
        $(this).click(function() {
            var host = window.location.host;
            var dest = this.href;
            var dcsuri = "/Home Page/leadstory/" + dest.replace(new RegExp("http://" + host + "/", "ig"), "");
            var dcsref = top.window.location.href;
            dcsMultiTrack('DCS.dcsuri', dcsuri, 'DCS.dcsref', dcsref, 'WT.ac', 'Lead Story Banner');
            //alert("dcsMultiTrack('DCS.dcsuri', "+dcsuri+", 'DCS.dcsref', "+dcsref+", 'WT.ac', 'Lead Story Banner');");
        });
    });
*/
    this.LEADSTORY = function(type) {
        // random Display//
        if (type == "random") {
            var ran = Math.floor(Math.random() * $("#leadstory_container div").length) + 1;
            //alert($("#leadstory_container div").length);
            $("#leadstory_container div:nth-child(" + ran + ")").show();
        }
        // Cycle Display 
        if (type == "cycle") {
            $('#leadstory_container').after('<div id="mainstory_pager">').cycle({
                fx: 'fade',
                speed: 1000,
                timeout: 6500,
                //random:  3
                pager: '#mainstory_pager'//,
                //pagerAnchorBuilder: function(idx, slide) { return '<a href="#">&nbsp;</a>'; }
            });
        }
    };

    LEADSTORY('cycle'); //random OR cycle

    // LEAD STORY END //

    // NEWS TICKER //

    var options = {
        newsList: "#news",
        tickerRate: 30, 	// time gap between display of each letter (ms)
        startDelay: 100, 	// delay before first run of the ticker (ms)
        loopDelay: 5000, // time for which full text of each item is shown at end of print-out (ms)
        placeHolder1: "", // character placeholder shown on even loops
        placeHolder2: ""	// character placeholder shown on odd loops
    }
    $().newsTicker(options);

    // NEWS TICKER END //

    //SPOTLIGHT //
    $('#spotlight-1').removeClass('spotlight-1').addClass('');
    $('#spotlight-2').removeClass('spotlight-2').addClass('');
    $('#spotlight-3').removeClass('spotlight-3').addClass('');
    $('#spotlight-4').removeClass('spotlight-4').addClass('');

    $("#spotlight-1").mouseenter(
		function() {
		    $("#updates-container-wrapper").mouseenter(
				function() {
				    $('#spotlight-1-content').stop();
				    $('#spotlight-1-content').removeClass('spotlight-slideup-1').addClass('');
				    $('#c-spot-hd-1').removeClass('c-spot-hd-bg').addClass('');
				    $('#spotlight-1-content').animate({ height: '84px' }, 300);
				});

		    $("#footer-container-wrapper").mouseenter(
				function() {
				    $('#spotlight-1-content').stop();
				    $('#spotlight-1-content').removeClass('spotlight-slideup-1').addClass('');
				    $('#c-spot-hd-1').removeClass('c-spot-hd-bg').addClass('');
				    $('#spotlight-1-content').animate({ height: '84px' }, 300);
				});

		    $('#spotlight-1-content').removeClass('').addClass('spotlight-slideup-1');
		    $('#c-spot-hd-1').removeClass('').addClass('c-spot-hd-bg');
		    $('#spotlight-1-content').animate({ height: '185px' }, 500, function() { $('#spotlight-1-content').removeClass('').addClass('spotlight-slideup-1'); });
		});

    $("#spotlight-1-content").mouseleave(
		function() {
		    $('#spotlight-1-content').animate({ height: '84px' }, 400, function() { $('#c-spot-hd-1').removeClass('c-spot-hd-bg').addClass(''); $('#spotlight-1-content').removeClass('spotlight-slideup-1').addClass(''); });
		});

    $("#spotlight-2").mouseenter(
		function() {
		    $("#updates-container-wrapper").mouseenter(
				function() {
				    $('#spotlight-2-content').stop();
				    $('#spotlight-2-content').removeClass('spotlight-slideup-2').addClass('');
				    $('#c-spot-hd-2').removeClass('c-spot-hd-bg').addClass('');
				    $('#spotlight-2-content').animate({ height: '84px' }, 300);
				});

		    $("#footer-container-wrapper").mouseenter(
				function() {
				    $('#spotlight-2-content').stop();
				    $('#spotlight-2-content').removeClass('spotlight-slideup-2').addClass('');
				    $('#c-spot-hd-2').removeClass('c-spot-hd-bg').addClass('');
				    $('#spotlight-2-content').animate({ height: '84px' }, 300);
				});

		    $('#spotlight-2-content').removeClass('').addClass('spotlight-slideup-2');
		    $('#c-spot-hd-2').removeClass('').addClass('c-spot-hd-bg');
		    $('#spotlight-2-content').animate({ height: '185px' }, 500, function() { $('#spotlight-2-content').removeClass('').addClass('spotlight-slideup-2'); });
		});


    $("#spotlight-2-content").mouseleave(
		function() {
		    $('#spotlight-2-content').animate({ height: '84px' }, 400, function() { $('#c-spot-hd-2').removeClass('c-spot-hd-bg').addClass(''); $('#spotlight-2-content').removeClass('spotlight-slideup-2').addClass(''); });
		});


    $("#spotlight-3").mouseenter(
		function() {
		    $("#updates-container-wrapper").mouseenter(
				function() {
				    $('#spotlight-3-content').stop();
				    $('#spotlight-3-content').removeClass('spotlight-slideup-3').addClass('');
				    $('#c-spot-hd-3').removeClass('c-spot-hd-bg').addClass('');
				    $('#spotlight-3-content').animate({ height: '84px' }, 300);
				});

		    $("#footer-container-wrapper").mouseenter(
				function() {
				    $('#spotlight-3-content').stop();
				    $('#spotlight-3-content').removeClass('spotlight-slideup-3').addClass('');
				    $('#c-spot-hd-3').removeClass('c-spot-hd-bg').addClass('');
				    $('#c-spot-hd-3').removeClass('c-spot-hd-bg').addClass('');
				    $('#spotlight-3-content').animate({ height: '84px' }, 300);
				});

		    $('#spotlight-3-content').removeClass('').addClass('spotlight-slideup-3');
		    $('#c-spot-hd-3').removeClass('').addClass('c-spot-hd-bg');
		    $('#spotlight-3-content').animate({ height: '185px' }, 500, function() { $('#spotlight-3-content').removeClass('').addClass('spotlight-slideup-3'); });
		});


    $("#spotlight-3-content").mouseleave(
		function() {
		    $('#spotlight-3-content').animate({ height: '84px' }, 400, function() { $('#c-spot-hd-3').removeClass('c-spot-hd-bg').addClass(''); $('#spotlight-3-content').removeClass('spotlight-slideup-3').addClass(''); });
		});


    $("#spotlight-4").mouseenter(
		function() {
		    $("#updates-container-wrapper").mouseenter(
				function() {
				    $('#spotlight-4-content').stop();
				    $('#spotlight-4-content').removeClass('spotlight-slideup-4').addClass('');
				    $('#c-spot-hd-4').removeClass('c-spot-hd-bg').addClass('');
				    $('#spotlight-4-content').animate({ height: '84px' }, 300);
				});

		    $("#footer-container-wrapper").mouseenter(
				function() {
				    $('#spotlight-4-content').stop();
				    $('#spotlight-4-content').removeClass('spotlight-slideup-4').addClass('');
				    $('#c-spot-hd-4').removeClass('c-spot-hd-bg').addClass('');
				    $('#spotlight-4-content').animate({ height: '84px' }, 300);
				});

		    $('#spotlight-4-content').removeClass('').addClass('spotlight-slideup-4');
		    $('#c-spot-hd-4').removeClass('').addClass('c-spot-hd-bg');
		    $('#spotlight-4-content').animate({ height: '185px' }, 500, function() { $('#spotlight-4-content').removeClass('').addClass('spotlight-slideup-4'); });
		});

    $("#spotlight-4-content").mouseleave(
		function() {
		    $('#spotlight-4-content').animate({ height: '84px' }, 400, function() { $('#c-spot-hd-4').removeClass('c-spot-hd-bg').addClass(''); $('#spotlight-4-content').removeClass('spotlight-slideup-4').addClass(''); });
		});

		//SPOTLIGHT Random//
		var divLength = $("#c-spot-hd-1 div").length / 2;
		var ran = Math.floor(Math.random() * divLength) + 1;
		$("#c-spot-hd-1 div:nth-child(" + ran + ")").show();

		divLength = $("#c-spot-hd-2 div").length / 2;
		ran = Math.floor(Math.random() * divLength) + 1;
		$("#c-spot-hd-2 div:nth-child(" + ran + ")").show();

		divLength = $("#c-spot-hd-3 div").length / 2;
		ran = Math.floor(Math.random() * divLength) + 1;
		$("#c-spot-hd-3 div:nth-child(" + ran + ")").show();

		divLength = $("#c-spot-hd-4 div").length / 2;
		ran = Math.floor(Math.random() * divLength) + 1;
		$("#c-spot-hd-4 div:nth-child(" + ran + ")").show();


});
/*
$("#updates-container-wrapper").mouseenter(
function(){
$('div[id$="-content"]').stop();
$('div[id$="-content"]').removeClass('div[id~="spotlight-slideup-"]').addClass('');
$('div[id$="-content"]').animate({ height: '84px'}, 100);
});	
	
$("#footer-container-wrapper").mouseenter(
function(){					
$('div[id$="-content"]').stop();
$('div[id$="-content"]').removeClass('div[id~="spotlight-slideup-"]').addClass('');
$('div[id$="-content"]').animate({ height: '84px'}, 100);
});
	
	
*/

/*
$("#updates-container-wrapper").mouseenter( function() {
$('#spotlight-1-content').animate({ height: '84px'}, 1,function(){$('#spotlight-1-content').removeClass('spotlight-slideup-1').addClass('');});
$('#spotlight-2-content').animate({ height: '84px'}, 1,function(){$('#spotlight-2-content').removeClass('spotlight-slideup-2').addClass('');});
$('#spotlight-3-content').animate({ height: '84px'}, 1,function(){$('#spotlight-3-content').removeClass('spotlight-slideup-3').addClass('');});
$('#spotlight-4-content').animate({ height: '84px'}, 1,function(){$('#spotlight-4-content').removeClass('spotlight-slideup-4').addClass('');});
																														
});
	
	
*/

//$("#spotlight-1").bind('mouseenter mouseleave', function() {$("#spotlight-1-content").slideToggle(500)});
//$("#spotlight-2").bind('mouseenter mouseleave', function() {$("#spotlight-2-content").slideToggle(500)});
//$("#spotlight-3").bind('mouseenter mouseleave', function() {$("#spotlight-3-content").slideToggle(500)});
//$("#spotlight-4").bind('mouseenter mouseleave', function() {$("#spotlight-4-content").slideToggle(500)});

//$("#spotlight-1").mouseover(function(){$('#spotlight-1-content').removeClass('').addClass('spotlight-slideup')});

//$("#spotlight-1").mouseenter(function(){$('#spotlight-1-content').removeClass('').addClass('spotlight-slideup');$('#spotlight-1-content').animate({ height: '200px'}, 800);});

//$("#spotlight-2").bind('mouseenter mouseleave', function() {$("#spotlight-2-content").toggleClass('spotlight-slideup-2','slow')});


//$("#spotlight-1-content").mouseleave(function(){$('#spotlight-1-content').animate({ height: '84px'}, 500);$('#spotlight-1-content').removeClass('spotlight-slideup').addClass('');});
//$('#spotlight-1-content').animate({ height: '200px' }, { duration: 800, queue: true }){$('#spotlight-1-content').css('background', 'transparent url(/bte/images/spotlight-1-cotnent-bg.png) no-repeat 0 0');}; 

//$("#spotlight-1").hover(function() {$("#spotlight-1-content").slideToggle(400,function() {$("#spotlight-2-content").hide(400);$("#spotlight-3-content").hide(400);$("#spotlight-4-content").hide(400)} );}, function() {$("#spotlight-1-content").hide(400);})

//$("#spotlight-2").hover(function() {$("#spotlight-2-content").slideToggle(400,function(){ $("#spotlight-1-content").hide(400);$("#spotlight-3-content").hide(400);$("#spotlight-4-content").hide(400)});}, function() {$("#spotlight-2-content").hide(400);})

//$("#spotlight-3").hover(function() {$("#spotlight-3-content").slideToggle(400,function() {$("#spotlight-1-content").hide(400);$("#spotlight-2-content").hide(400);$("#spotlight-4-content").hide(400)} );}, function() {$("#spotlight-3-content").hide(400);})

//$("#spotlight-4").hover(function() {$("#spotlight-4-content").slideToggle(400,function() {$("#spotlight-1-content").hide(400);$("#spotlight-2-content").hide(400);$("#spotlight-3-content").hide(400)} );}, function() {$("#spotlight-4-content").hide(400);})

/*
$("#container").mouseover( function() {$("#spotlight-1-content").hide("slow");$("#spotlight-2-content").hide("slow");$("#spotlight-3-content").hide("slow");$("#spotlight-4-content").hide("slow")});
	
$("#news-container-wrapper").mouseover( function() {$("#spotlight-1-content").hide("slow");	$("#spotlight-2-content").hide("slow");	$("#spotlight-3-content").hide("slow");				$("#spotlight-4-content").hide("slow")});
	
$("#updates-container-wrapper").mouseover( function() {$("#spotlight-1-content").hide("slow");$("#spotlight-2-content").hide("slow");
$("#spotlight-3-content").hide("slow");	
$("#spotlight-4-content").hide("slow")
});

$("#footer-container-wrapper").mouseover( function() {			
$("#spotlight-1-content").hide("slow");
$("#spotlight-2-content").hide("slow");
$("#spotlight-3-content").hide("slow");	
$("#spotlight-4-content").hide("slow")
});

	
$("#spotlight-1").mouseover( function() {
if ($("#spotlight-1-content").is(":hidden")) {		
$("#spotlight-1-content").slideToggle("slow");
$("#spotlight-2-content").hide();
$("#spotlight-3-content").hide();
$("#spotlight-4-content").hide();			
			
}
});
$("#spotlight-1-content").mouseleave( function() {
if (!$("#spotlight-1-content").is(":hidden")) {		
$("#spotlight-1-content").hide();
}
});
	
	
$("#spotlight-2").mouseover( function() {
if ($("#spotlight-2-content").is(":hidden")) {		
$("#spotlight-2-content").slideToggle("slow");
$("#spotlight-1-content").hide();
$("#spotlight-3-content").hide();
$("#spotlight-4-content").hide();			
			
			
}
});
$("#spotlight-2-content").mouseleave( function() {
if (!$("#spotlight-2-content").is(":hidden")) {		
$("#spotlight-2-content").hide();
}
});
	
$('#spotlight-3').removeClass('spotlight-3').addClass('');
$("#spotlight-3").mouseover( function() {
if ($("#spotlight-3-content").is(":hidden")) {		
			
$("#spotlight-1-content").hide();
$("#spotlight-2-content").hide();
$("#spotlight-4-content").hide();			
$("#spotlight-3-content").slideToggle("slow");
			
}
});
$("#spotlight-3-content").mouseleave( function() {
if (!$("#spotlight-3-content").is(":hidden")) {		
$("#spotlight-3-content").hide();
}
});
	
$('#spotlight-4').removeClass('spotlight-4').addClass('');
$("#spotlight-4").mouseover( function() {
if ($("#spotlight-4-content").is(":hidden")) {				
$("#spotlight-1-content").hide();
$("#spotlight-3-content").hide();
$("#spotlight-2-content").hide();			
$("#spotlight-4-content").slideToggle("slow");
}
});
$("#spotlight-4-content").mouseleave( function() {
if (!$("#spotlight-4-content").is(":hidden")) {		
$("#spotlight-4-content").hide();
}
});
	
*/

//SPOTLIGHT END //
 
 


