/* 

This is a email masking script to prevent spam. It's implemented like this:

href="javascript:sendMailTo('info','cetoncorp','com')" 

*/
function sendMailTo(name, company, domain) {
  locationstring = 'mai' + 'lto:' + name + '@' + company + '.' + domain;
  window.location.replace(locationstring);
}

//var $j = jQuery.noConflict();

jQuery(document).ready(function($) {
    // $() will work as an alias for jQuery() inside of this function	

	//When page loads…
	$(".tab_content").hide(); //Hide all content
	$("ul.tabs li:first").addClass("active").show(); //Activate first tab
	$(".tab_content:first").show(); //Show first tab content

	//On Click Event
	$("ul.tabs li").click(function() {

		$("ul.tabs li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".tab_content").hide(); //Hide all tab content

		var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active ID content
		return false;
	});
	
	//change where the search results go
	//results_div_id = 'content';
	
	$("#secondary a").each(function() {
        if(this.href == window.location) $(this).addClass("selected");
    });
    
   var company_link = $("a[href$='/company/']");
   //var support_link = $("a[href$='/support-page/']");
   
   
   company_link.click(function(e){
      e.preventDefault();
      window.location = "http://www.cetoncorp.com/company/about"
   });
   
   /*
   support_link.click(function(e){
      e.preventDefault();
   });
   */
   
   //Add the newsletter header graphics
   var newsletter_pre = $("<img src='http://cetoncorp.com/wp-content/themes/ceton_v2/img/icon_mail.png' alt='newsletter' width='47' height='53' class='icon' /><h5>Join our Newsletter</h5><br/>");
   $("#mc_signup_form").prepend(newsletter_pre);
    
   //make the first word bold
   $('.home .feature_top h2').each(function(){
   	var me = $(this), t = me.text().split(' ');
   	me.html( '<strong>'+t.shift()+'</strong> '+t.join(' ') );
   });
   
   //turn off the disabled links
   $("a.disabled").click(function(){
      return false;
   });
   
   $("#poster_frame").click(function(){
      player.playVideo();
      $(this).hide();
   });
   
   
   //add hover effect on the downloads
   $(".page-id-1698 .box a").hover(function () {
      $(this).parent().append("<div class='arrow'></div>")
     },
     function () {
       $(".arrow").remove();
   });
   

});

function redirectPage(page) {
   window.location = page;
}
