


//***************************************************//
//         Text sizing version .9                    //
//***************************************************//

//var sizesArray = new Array("60%", "70%", "80%", "90%", "100%", "110%", "120%", "130%", "140%");
var sizesArray = new Array("70%", "80%", "90%", "100%", "110%", "120%", "130%");

var sizePointer = 3;
var ruleCounter;
// ruleCounter is used for Mozilla due to the necessity to write the new CSS rule in the last position so that it is applied.


if (getCookie("sizePref") != "") {
	sizePointer = Number(getCookie("sizePref"))
	// now apply the font
	if (document.styleSheets[0].cssRules) {
		ruleCounter = document.styleSheets[0].cssRules.length
	// Mozilla
	document.styleSheets[0].insertRule("#navcolbg {font-size: " + sizesArray[sizePointer] + ";}", ruleCounter)
		//ruleCounter = ruleCounter + 1
	}
	else {
	//IE
	document.styleSheets[0].addRule("#navcolbg", "{font-size: " + sizesArray[sizePointer] + ";}")
	}
}

var ie=false;
if (navigator.appName.indexOf("Microsoft") != -1){
	ie=true;
}
	


function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=")
  if (c_start!=-1)
    { 
    c_start=c_start + c_name.length+1 
    c_end=document.cookie.indexOf(";",c_start)
    if (c_end==-1) c_end=document.cookie.length
    return unescape(document.cookie.substring(c_start,c_end))
    } 
  }
return "";
}

function largerFont () {
	
	if (document.styleSheets[0].cssRules) {
	// Mozilla
		if (document.styleSheets[0].cssRules[0]) {
			if (sizePointer != 8) {
				ruleCounter = document.styleSheets[0].cssRules.length;
				sizePointer = sizePointer + 1;
				document.styleSheets[0].insertRule("#sidecolspacer {font-size: " + sizesArray[sizePointer] + ";}", ruleCounter)
				//document.write('<style>* {font-size: ' + sizesArray[sizePointer] + ';}</style>');
				document.cookie = 'sizePref='+ sizePointer + '; path=/; domain=.flu.gov';
			}
		}	
	}
	
	else if (document.styleSheets[0].rules) {
	// IE
		if (sizePointer < 8) {
			sizePointer = sizePointer + 1;
			document.cookie = 'sizePref='+ sizePointer + '; path=/; domain=.flu.gov';
			document.styleSheets[0].addRule("#sidecolspacer", "{font-size: " + sizesArray[sizePointer] + ";}")
			}
		}		
	}

function smallerFont () {	
	if (document.styleSheets[0].cssRules) {
		
	// Mozilla
		if (document.styleSheets[0].cssRules[0]) {	
			if (sizePointer != 0) {
				sizePointer = sizePointer - 1;
				ruleCounter = document.styleSheets[0].cssRules.length;
				document.styleSheets[0].insertRule("#sidecolspacer {font-size: " + sizesArray[sizePointer] + ";}", ruleCounter)
				document.cookie = 'sizePref='+ sizePointer + '; path=/; domain=.flu.gov';
			}
		}	
	}
	
	else if (document.styleSheets[0].rules) {
	// IE		
		if (sizePointer > 0) {
			sizePointer = sizePointer - 1;
			document.cookie = 'sizePref='+ sizePointer + '; path=/; domain=.flu.gov';
			document.styleSheets[0].addRule("#sidecolspacer", "{font-size: " + sizesArray[sizePointer] + ";}")
		}
	}
	
}


var cur_spotlight = 1;
$(document).ready(function () {	
	var old_src;
	var share_img_src;
	
	$("p#bb_icon_option img").mouseover(function(){
			old_src = $(this).attr("src");
			$(this).attr("src",removeExt($(this).attr("src")) + "hi.jpg")
      //alert(removeExt($(this).attr("src")));
      
    }).mouseout(function(){
      $(this).attr("src",old_src);
   });   
   
	
	$("img.sharebutton").mouseover(function(){		
			share_img_src = $(this).attr("src");
			share_img_src_ext = getExt(share_img_src);			
			$(this).attr("src",removeExt(share_img_src) + "Hola" + share_img_src_ext);
    }).mouseout(function(){
      $(this).attr("src",share_img_src);
   });
   
   $("img.hover").mouseover(function(){		
			share_img_src = $(this).attr("src");
			share_img_src_ext = getExt(share_img_src);			
			$(this).attr("src",removeExt(share_img_src) + "_hi" + share_img_src_ext);
    }).mouseout(function(){
      $(this).attr("src",share_img_src);
   });
	
	
	$("div.yesjavascript div#spotlight_body div.spotlight:first").addClass("spotlight_selected");
	var spotlight_count = $("div.yesjavascript div#spotlight_body div.spotlight").size();
	
	if(spotlight_count > 1){
		var spotlightnavcode = "<ul>";
		for(i=1;i <= spotlight_count;i++){
			
			//alert($("div#spotlights:eq(4) div.spotlight h3").text());
			//alert(slabel);
			runcode="slabel=$('div#spotlights div.spotlight:eq(" + (i - 1) + ") h3').text()";
			//alert(runcode);
			eval(runcode);
			//alert(slabel);
			//alert(runcode);
			//alert($(runcode).text());
			if(i==1){
				spotlightnavcode += "<li class='spotlight_nav_selected'><a href='javascript:spotlight_select(" + i + ")' " + "title='" + slabel +"'>" + i + "</a></li>";
			}
			else{				
				spotlightnavcode += "<li><a href='javascript:spotlight_select(" + i + ")' " + "title='" + slabel +"'>" + i + "</a></li>";
			}
		}
		spotlightnavcode += "</ul">
		$("div.yesjavascript div#spotlight_body div#spotlight_nav").html(spotlightnavcode);
	}
	
	
	$("div.tabs div.tab div.tabHeader").click(function (){
		if(!$(this).parent().hasClass("actived_tab")){						
			$(this).parent().parent().children(".tab").each(		
				function(i){																
					var obj = $(this).children(".tabHeader").find("img");
					if($(this).hasClass("actived_tab")){						
						$(this).removeClass("actived_tab");						
						obj.attr("src", removeExt(obj.attr("src"),"Hi.") + ".gif");
					}
					else{						
						$(this).addClass("actived_tab");						
						obj.attr("src", removeExt(obj.attr("src"),"Hi.") + "http://www.healthreform.gov/jscripts/Hi.gif");
					}					
			});
		}
	});
});



function spotlight_select(indx){
	$("div.yesjavascript div#spotlight_body div#spotlight_nav li").eq(cur_spotlight-1).removeClass("spotlight_nav_selected")
	$("div.yesjavascript div#spotlight_body div.spotlight").eq(cur_spotlight - 1).removeClass("spotlight_selected");
	$("div.yesjavascript div#spotlight_body div.spotlight").eq(indx - 1).addClass("spotlight_selected");
	$("div.yesjavascript div#spotlight_body div#spotlight_nav li").eq(indx - 1).addClass("spotlight_nav_selected")
	cur_spotlight = indx;
}
function removeExt(str){
	var indx = str.lastIndexOf(".");
	if(indx != -1){
		
		str = str.substring(0,indx);
		return str;
	}
	else{
		return str;
	}
}

function removeExt(str,str2){
	var indx = str.lastIndexOf(str2);
	if(indx == -1)
		indx = str.lastIndexOf(".")
	if(indx != -1){
		
		str = str.substring(0,indx);
		return str;
	}
	else{
		return str;
	}
}
function getExt(str){
	var ext="";
	var indx = str.lastIndexOf(".");
	if(indx != -1){
		ext=str.substring(indx);
	}
	return ext;
}
