	 var headline_count;
	 var headline_interval;
	 var old_headline = 0;
	 var current_headline = 0;
	 var _alltabs=[ '', 'Free ETFs', 'Firstrade Advantage', 'Pricing', 'Powerful Tools', 'Rollover your 401k' ];
	function formatText(index, panel) {
		if(index>=_alltabs.length) index=0;
		return _alltabs[index];
	}    

	$(document).ready(function() { 
		$('.anythingSlider').anythingSlider({
				easing: "easeInOutExpo",        // Anything other than "linear" or "swing" requires the easing plugin
				autoPlay:true,                 // This turns off the entire FUNCTIONALY, not just if it starts running or not.
				delay: 2000000,                    // How long between slide transitions in AutoPlay mode
				startStopped: false,            // If autoPlay is on, this can force it to start stopped
				animationTime: 500,             // How long the slide transition takes
				hashTags: true,                 // Should links change the hashtag in the URL?
				buildNavigation: true,          // If true, builds and list of anchor links to link to each slide
				pauseOnHover: true,             // If true, and autoPlay is enabled, the show will pause on hover
				startText: "Go",                // Start text
				stopText: "Stop",               // Stop text
				navigationFormatter: formatText // Details at the top of the file on this use (advanced use)
		  });
		   if(navigator.userAgent.match(/Opera/)) $(".homepage .thumbNav").css("top", "222px");

			$('#id-symlookup1').focus(function() {
				$(this).select();
				FTL.InstallAC(this, - 3, 5, 'down', 'Symbol / Company');
				if (this.value == 'Symbol / Company') this.value = '';
			});
			$('input#id-symlookup1').keydown(function(evt) {
				if(!evt && window.event) evt=window.event;
				if(evt.keyCode==13) {
					$('div#id-searchbtngo1').trigger('click');
					$(this).select();
				}
			});
			togglemenu('hide', 'id-searchcategory1', _search_items, (msie6?90:91), {x:-1, y:-3});
		    $("#id-searchcategory1").click(function(){
		        togglemenu('auto', $(this).attr('id'), _shortcut_items, (msie6?90:91), {x:-1, y:-3});
		    });

		  getNews();
		  setInterval(counter, 1000);
		    $.ajax({type: 'POST', url: "/scripts/news/idc.php", dataType:"json", data: "r=index",  success:function(res){
					if (res != null){
						 $.each(res.index, function(i, element) {
							var temp_price = parseFloat(element.price)+0;
							temp_price = temp_price.toFixed(2);
							var temp_change_price = parseFloat(element.chg)+0;
							temp_change_price = temp_change_price.toFixed(2);
						 	var string = temp_price;
							if (element.chg >= 0){
								string += " <img style=\"vertical-align:top\" src=\"/images/shared/triangleg_up.png\"/> <font color=\"#009900\">"+temp_change_price+"</font>";
							}
							if (element.chg < 0){
								string += " <img style=\"vertical-align:top\" src=\"/images/shared/triangleg_down.png\"/> <font color=\"#FF0000\">"+temp_change_price.substring(1)+"</font>";
							}
						    if (element.name == "S&P 500 INDEX")
								$("li.middle ul li:eq(4) div").html(string);
							if (/^NASDAQ/.test(element.name) )
								$("li.middle ul li:eq(2) div").html(string);
							if (element.name == "DOW JONES INDUSTRIAL AVERAGE")
								$("li.middle ul li:eq(0) div").html(string);
						 });
					}
				}
			});
	});
	
	 function headline_rotate() {
	   current_headline = (old_headline + 1) % headline_count; 
	   $("div.headline:eq(" + old_headline + ")").animate({top: -205},"fast", function() {
		 $(this).css('top','210px');
	   });
	   $("div.headline:eq(" + current_headline + ")").show().animate({top: 5},"slow");  
	   old_headline = current_headline;
	 }
	function getNews(){
	  $.ajax({type: 'POST', url: "/scripts/news/idc.php", dataType:"json", data: "r=news", success:function(res){
	  		 if (res != null){
			   var news="";
			   $.each(res.news, function(i, element) {
					news+='<div class="headline"><a href="/content/en-us/researchtools/marketoverview/idcnews/?u='+escape(element.url)+'"><strong>'+element.headline+'</strong></a>  '+element.date+' <a href="/content/en-us/researchtools/marketoverview/idcnews/?u='+escape(element.url)+'">View More <img src="/images/shared/arrows.gif" border="0"></a></div>';
			   });
				  $(".news").html(news);
				 old_headline = 0;
				current_headline = 0;
				headline_count = $("div.headline").size();
			   $("div.headline:eq(0)").css('top','5px');
			   headline_interval = setInterval(headline_rotate,10000); //time in milliseconds
			   $('.news').hover(function() {
				 clearInterval(headline_interval);
			   }, function() {
				 headline_interval = setInterval(headline_rotate,10000); //time in milliseconds
				 headline_rotate();
			   });
			  }
		   }
	   }); 
	}
	function counter(){
		var string = "";
		var thedate = $("#today").text();
		if (checkholiday(thedate,0) == true){
			string = "<strong>U.S. Markets are Closed today.</strong>";
		}
		else {
			var timeNow = parseInt($("#timevalue").text());
			if (timeNow > 86400)
				document.location.href=document.location.href;
			if ( (timeNow < 34200 ) && (timeNow > 30600)){ // 1 hour before market open
				 var counterdown = 34200 - timeNow;
				// var newhour = Math.floor((counterdown / 3600)+.0);
				 var newmin = Math.floor(((counterdown % 3600)+.0) / 60);
				 var newsec = (((counterdown % 3600)+.0) % 60) ;
				 if(newmin <10)
					 newmin="0"+newmin;
				 if(newsec<10)
					 newsec="0"+newsec;
				  string = "Market Opens in " + newmin + " Min " + newsec + " Sec";
			}
			else if ( (timeNow >= close_time - 3600) && (timeNow < close_time) ){  // 1 hour before market close
				 var counterdown = close_time - timeNow;
				// var newhour = Math.floor((counterdown / 3600)+.0);
				 var newmin = Math.floor(((counterdown % 3600)+.0) / 60);
				 var newsec = (((counterdown % 3600)+.0) % 60) ;
				 if (newmin <10)
					 newmin="0"+newmin;
				 if (newsec<10)
					 newsec="0"+newsec;
				  string = "Market will Close in "+ newmin + " Min " + newsec + " Sec";
			} 
			else if ( (timeNow >= 34200) && (timeNow < close_time - 3600)){
				  string = "Market is Open.";
			}
			else {
				if ( (timeNow >= close_time) && (close_time == 57600) && (timeNow < close_time + 5400)){
					string = "Markets are Closed. After Hours Trading in Session.";
				}	
				else if ( (timeNow >= close_time) && (close_time == 46800) && (timeNow < close_time + 3600)){
					string = "Markets are Closed. After Hours Trading in Session.";
				}
				else
				    string = "Market is Closed";
			}
		}
		$(".middle .left .countDown").html(string);
		$("#timevalue").text(timeNow+1);
		
	}/*
	function randomPromots(){
		var pimages = new Array();
		pimages[0] = "http://4220.voxcdn.com/public/images/en-us/home_smban_l_iphone.jpg";
		pimages[0] = "http://4220.voxcdn.com/public/images/en-us/home_smban_l_iphone.jpg";
		pimages[0] = "http://4220.voxcdn.com/public/images/en-us/home_smban_l_iphone.jpg";
		pimages[0] = "http://4220.voxcdn.com/public/images/en-us/home_smban_l_iphone.jpg";
	}*/

