var mobileHeight = 90;
var addressHeight = 129;
var activeHeight = 311;

$(document).ready(function(){
  /* Common Home & Laser Script */
  $('#bookSeminar').click(function()
  {
    $('#infoRequest').val('Book a seminar');
  });

 	$(function()
 	{ 
 	  cookieResize('#sizer a', 'medium'); 
  });
	 	  
	$('a.medium').addClass('active');
	
	$("#sizer a").click(function()
  {
    $("#sizer a").removeClass('active');
    $(this).addClass('active');
  });
  
	$("input.search").click(function()
	{ 
	  $("input.search").addClass('noBg'); 
  }).blur(function()
  { 
    if($("input.search").val() == '')
    {
      $("input.search").removeClass('noBg');
    }
  });
	
  $("ul.sf-menu").superfish().find('ul').bgIframe({opacity:false});
		
  $("#laserNavWrapper li, .menuWrapper li").hover(function()
  {
    $(this).addClass('active');
  },function()
  {
    $(this).removeClass('active');
  });

  $("#laserNavWrapper li.active, .menuWrapper li.active").hover(function()
  {
    $(this).addClass('active');
  },function()
  {
    $(this).addClass('active');
  });
	/* Common Home & Laser Script END */
	
	$(".toggleField").each( function()
	{
	  $(this).data( "labelName", $(this).val() );
	});
	
	$('.toggleField').focus(function(){
  if ( $(this).val() == $(this).data("labelName") )
  {
    $(this).val("");
  }
  })
  .blur(function(){
    if ( $(this).val() == "" )
    {
      $(this).val($(this).data("labelName"));
    }
  }); 
  
  $(".toggleForm").submit(function () 
  {
    $(".toggleField").each( function()
    {
      if ( $(this).val() == $(this).data("labelName") )
      {
        $(this).val("");
      }
    });
  });
  
  $("#callMe").click(function()
		{
  	if($(this).is(":checked"))
    {
  		activeHeight += mobileHeight;
      $("#contactBlue").height(activeHeight);
      $("#extendMobile").fadeIn(1500);
    }
    else
    {
      $("#extendMobile").fadeOut(1000,function(){
      	activeHeight -= mobileHeight
        $("#contactBlue").height(activeHeight);
      });
    }  		
		}
  );
  
  $("#infoPack").click(function()
		{
      if($(this).is(":checked"))
      {
      	activeHeight += addressHeight;
        $("#contactBlue").height(activeHeight);
        $("#extendAddress").fadeIn(1500);
      }
      else
      {
        $("#extendAddress").fadeOut(1000,function(){
        	activeHeight -= addressHeight;
          $("#contactBlue").height(activeHeight);
        });
      }      
    }
  );
  
});

/* write out the email address to protect from spam harvesters*/
var emailLinkStart = "<a href=\"mailto:";
var emailLinkMiddle = "\">";
var emailLinkImage = "<img src=\"/images/button-email.gif\" alt=\"Email\" border=\"0\" align=\"top\" />";
var emailLinkEnd = "</a>";

function email( name, domain )
{
   document.write( emailLinkStart + name + "@" + domain + emailLinkMiddle + name + "@" + domain + emailLinkEnd );
}

function emailImage( name, domain )
{
   document.write( emailLinkStart + name + "@" + domain + emailLinkMiddle + emailLinkImage + emailLinkEnd );
}