// JavaScript Document


// swap news puff images
		
function newsPuffs()
{
	$("#newsText1").css({background: 'url(/images/nh/news-on.gif)', fontWeight: 'bold'});
	$("#newsText2").css({background: 'url(/images/nh/news-off.gif)', fontWeight: 'normal'});
	$("#newsText3").css({background: 'url(/images/nh/news-off.gif)', fontWeight: 'normal'});
	
	$("#newsText1").hover(
					  function()
					  {
						  $("#newsPic1").css({display: 'block'});
						  $("#newsPic2").hide();
						  $("#newsPic3").hide();
						  $("#newsText1").css({background: 'url(/images/nh/news-on.gif)', fontWeight: 'bold'});
						  $("#newsText2").css({background: 'url(/images/nh/news-off.gif)', fontWeight: 'normal'});
						  $("#newsText3").css({background: 'url(/images/nh/news-off.gif)', fontWeight: 'normal'});
					  },
					  function()
					  {
						  return false;
					  }
					  );
	
	$("#newsText2").hover(
					  function()
					  {
						  $("#newsPic1").hide();
						  $("#newsPic2").css({display: 'block'});
						  $("#newsPic3").hide();
						  $("#newsText1").css({background: 'url(/images/nh/news-off.gif)', fontWeight: 'normal'});
						  $("#newsText2").css({background: 'url(/images/nh/news-on.gif)', fontWeight: 'bold'});
						  $("#newsText3").css({background: 'url(/images/nh/news-off.gif)', fontWeight: 'normal'});
					  },
					  function()
					  {
						  return false;
					  }
					  );
	
	$("#newsText3").hover(
					  function()
					  {
						  $("#newsPic1").hide();
						  $("#newsPic2").hide();
						  $("#newsPic3").css({display: 'block'});
						  $("#newsText1").css({background: 'url(/images/nh/news-off.gif)', fontWeight: 'normal'});
						  $("#newsText2").css({background: 'url(/images/nh/news-off.gif)', fontWeight: 'normal'});
						  $("#newsText3").css({background: 'url(/images/nh/news-on.gif)', fontWeight: 'bold'});
					  },
					  function()
					  {
						  return false;
					  }
					  );
		
}

// END



// new build developer directory row highlighting

function nhDDhover()
{
	$(".nhDDresult").hover(
      function () {
        $(this).css({background: '#F2F2F2'});
      }, 
      function () {
        $(this).css({background: 'none'});
      }
    );
}

// END 



// new build - developer directory - show/hide developments - june 08

function showDevs(myDev)
{
	$('#'+myDev).slideToggle();
}

// END


// new build homepage relocate elements for seo

function relocate()
{
	$("#bannerWrapper").appendTo("#bannerWrapperTARGET");
	$("#logo").appendTo("#logoTARGET");
	$("#nav").appendTo("#navTARGET");
	$("#mpu_target").appendTo("#mpu_targetTARGET");
	$("#nh_mpu_target").appendTo("#nh_mpu_targetTARGET");
	$("#nhHPsearch").appendTo("#nhHPsearchTARGET");
	$("#nhFP1").appendTo("#nhFP1TARGET");
}

// new build search results relocate elements for seo

function relocateNHSR()
{
	$("#bannerWrapper").appendTo("#bannerWrapperTARGET");
	$("#logo").appendTo("#logoTARGET");
	$("#nav").appendTo("#navTARGET");
	$("#mpu_target").appendTo("#mpu_targetTARGET");
	$("#nhSearchRight").appendTo("#nhSearchRightTARGET");
}

// END


// developer profile code - august 08

function THEnhContactLinks()
{
	$("#nhContactLinks").show();
}

function nhContactCheck()
{
	var themessage = "Please enter...\n";
	
	if ( $("#yourName").val() == '' )
	{
		themessage = themessage + " - Your name\n";
	}
	
	if ( $("#yourEmail").val() == '' )
	{
		themessage = themessage + " - Your email address\n";
	}
	
	if ( $("#yourTelephone").val() == '' )
	{
		themessage = themessage + " - Your telephone number\n";
	}
	
	if ( $("#yourMessage").val() == '' )
	{
		themessage = themessage + " - Your message\n";
	}

	//alert if fields are empty and cancel form submit
	
	if (themessage == "Please enter...\n")
	{
		return true;
	}
	else
	{
		alert(themessage);
		return false;
	}
}

// end



function onload_run()
{
	newsPuffs();
	nhDDhover();
	THEnhContactLinks();
}

// onload functions

$(document).ready(
				  function()
				  {
					  onload_run();
				  }
);
