//AS TO JS
function resizeTitle(theId, theSize){
  document.getElementById(theId).height = theSize + "px";
}

$(document).ready(function(){
													 
	//checks for search box before setting events
  if($("#search_term").attr("id") != undefined){
		//HOVER
		$("#search_term").click(
      function () {
        $(this).select();
      }
    );
	}
	
	//checks for email sign-up box before setting events
  if($("#email_subscribe_form").attr("id") != undefined){
		//HOVER
		$("#name").click(
      function () {
        $(this).select();
      }
    );
		
		$("#cjhdy-cjhdy").click(
      function () {
        $(this).select();
      }
    );
	}
});
	
//FLASH TITLES
$(document).ready(function(){		
  
  
  $inc = 0;
  //h2 titles
  $("h2").each(function (i) {
    
    if(this.id == ""){
        $(this).replaceWith('<h2 id="h2Title' + i + '">' + $(this).text() + '</h2>');
        
        if($inc > 0){
        swfobject.embedSWF("http://fuseio.com/web/wp-content/themes/fuseio.com/swf/subpage_h2_title.swf", "h2Title" + i, "664", "18", "9.0.0","http://fuseio.com/web/wp-content/themes/fuseio.com/swf/expressInstall.swf", {titleSize:"664", titleText:$(this).text(), permalink:"", theId:"h2_title" + i, hexColor: "0x494845"}, {wmode:"transparent"}, {id:"h2_title" + i, name:"h2_title" + i, styleclass: "h2Title"});
        }
        
        else {
          swfobject.embedSWF("http://fuseio.com/web/wp-content/themes/fuseio.com/swf/subpage_h2_title.swf", "h2Title" + i, "664", "18", "9.0.0","http://fuseio.com/web/wp-content/themes/fuseio.com/swf/expressInstall.swf", {titleSize:"664", titleText:$(this).text(), permalink:"", theId:"h2_title" + i, hexColor: "0x494845"}, {wmode:"transparent"}, {id:"h2_title" + i, name:"h2_title" + i, styleclass: "h2Title first"});
        }
    }
    
    $inc++;
  });
  
  //HIDES ELEMENTS
  $(".hidden").hide();
  
  //Blog items
  $("#tab_blog_articles a").click(function () {
    $("#blog_articles_items").show();
    $("#blog_resources_items").hide();
    
    $("#tab_blog_articles").addClass("on");
    $("#tab_blog_resources").removeClass("on");
  });
  
  $("#tab_blog_resources a").click(function () {
    $("#blog_articles_items").hide();
    $("#blog_resources_items").show();
    
    $("#tab_blog_articles").removeClass("on");
    $("#tab_blog_resources").addClass("on");
  });
  
  
  //News items
  $("#tab_news_recent a").click(function () {
    $("#news_recent_items").show();
    $("#news_news_items").hide();
    $("#news_press_items").hide();
    
    $("#tab_news_recent").addClass("on");
    $("#tab_news_news").removeClass("on");
    $("#tab_news_press").removeClass("on");
  });
  
  $("#tab_news_news a").click(function () {
    $("#news_recent_items").hide();
    $("#news_news_items").show();
    $("#news_press_items").hide();
    
    $("#tab_news_recent").removeClass("on");
    $("#tab_news_news").addClass("on");
    $("#tab_news_press").removeClass("on");
  });
  
  $("#tab_news_press a").click(function () {
    $("#news_recent_items").hide();
    $("#news_news_items").hide();
    $("#news_press_items").show();
    
    $("#tab_news_recent").removeClass("on");
    $("#tab_news_news").removeClass("on");
    $("#tab_news_press").addClass("on");
  });
  
  
  //Subnav				
  $("#nav_products_services_subnav").hide();
  $("#nav_pointer").hide();
  
});