//$(document).ready(function() {
$(window).load(function() {
/*
$('#q').removeClass('').addClass('SearchBoxHeader');
$("#q").click(function(){
						if($('#q').val() != "")
							$('#q').removeClass('SearchBoxHeader').addClass('');
						});
$("#q").mouseleave(function(){
							if($('#q').val() == "")
								$('#q').removeClass('').addClass('SearchBoxHeader');											
							});
$("#q").keypress(function(){
							if($('#q').val() != "")
								$('#q').removeClass('SearchBoxHeader').addClass('');
							});

*/
/* Language Country Menu*/
$('#language-country').click(function() {$('#infglobal-menu-items1').slideToggle(500);});
$('#infglobal-menu-items1').mouseleave(function() {$('#infglobal-menu-items1').slideToggle(500);});

 // 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/2) + 1;
		var ran = Math.floor(Math.random()*$("#leadstory_container div").length) + 1;
		$("#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: 4500, 
			//random:  3
			pager:  '#mainstory_pager', 
			pagerAnchorBuilder: function(idx, slide) { return '<a href="#">&nbsp;</a>';  }		
		});
	}
};

LEADSTORY('random'); //random OR cycle
 
// LEAD STORY END //
 
 // NEWS TICKER //
 if(document.getElementById('news') != null)
 {

	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: '164px'}, 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: '164px'}, 300);
				});
			
			$('#spotlight-1-content').removeClass('').addClass('spotlight-slideup-1');
			$('#c-spot-hd-1').removeClass('').addClass('c-spot-hd-bg');
			$('#spotlight-1-content').animate({ height: '225px'}, 500,function(){$('#spotlight-1-content').removeClass('').addClass('spotlight-slideup-1');});
		});
	
	$("#spotlight-1-content").mouseleave(
		function()
		{
			$('#spotlight-1-content').animate({ height: '164px'}, 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: '164px'}, 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: '164px'}, 300);
				});
			
			$('#spotlight-2-content').removeClass('').addClass('spotlight-slideup-2');
			$('#c-spot-hd-2').removeClass('').addClass('c-spot-hd-bg');
			$('#spotlight-2-content').animate({ height: '225px'}, 500,function(){$('#spotlight-2-content').removeClass('').addClass('spotlight-slideup-2');});
		});
	
	
	$("#spotlight-2-content").mouseleave(
		function(){
			$('#spotlight-2-content').animate({ height: '164px'}, 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: '164px'}, 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: '164px'}, 300);
				});
		
			$('#spotlight-3-content').removeClass('').addClass('spotlight-slideup-3');
			$('#c-spot-hd-3').removeClass('').addClass('c-spot-hd-bg');
			$('#spotlight-3-content').animate({ height: '225px'}, 500,function(){$('#spotlight-3-content').removeClass('').addClass('spotlight-slideup-3');});
		});
	
	
	$("#spotlight-3-content").mouseleave(
		function(){
			$('#spotlight-3-content').animate({ height: '164px'}, 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: '164px'}, 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: '164px'}, 300);
				});
			
			$('#spotlight-4-content').removeClass('').addClass('spotlight-slideup-4');
			$('#c-spot-hd-4').removeClass('').addClass('c-spot-hd-bg');
			$('#spotlight-4-content').animate({ height: '225px'}, 500,function(){$('#spotlight-4-content').removeClass('').addClass('spotlight-slideup-4');});
		});
	
	$("#spotlight-4-content").mouseleave(
		function(){
			$('#spotlight-4-content').animate({ height: '164px'}, 400,function(){$('#c-spot-hd-4').removeClass('c-spot-hd-bg').addClass('');$('#spotlight-4-content').removeClass('spotlight-slideup-4').addClass('');});
		});
});	

 
 

