$("div.mainBar div.directoryMap").appendTo("div#directorySearch");

/**
* Clears the input on focus if it has a particular value
*/
$.fn.clearInput = function(inputVal){

	return this.focus(function(){
		obj = $(this);
		
		if(obj.val() == inputVal)
		{
			obj.val('');
		}
	})
	.blur(function(){
		obj = $(this);
		
		if(obj.val() == "")
		{
			obj.val(inputVal);
		}
	});

};

$("#searchText").clearInput("Search");
$("#username").clearInput("Username");
$("#password").clearInput("Password");


$(function()
{

	// Any tracking info here can be found within analytics under the content menu, event tracking.

	// form popup links with class="form-link" track it via google analytics.
	$('a[class*="form-link"]').click(function()
	{
		var linkHTML = $(this).html();
		pageTracker._trackEvent('Form', 'Popup Form', '' + linkHTML + '');
	});
	
	
	// remove target _blank off any link and replace with class="external".
	$('a[target^=_blank]')
		.addClass('external')
		.removeAttr('target', '_blank');
		
		
	// any links with rel="external" open in a new window
	$('a[class*="external"]').click(function()
	{
		$('a[class*="external"]').attr('target', '_blank');
		
		// also track outbound links and send info to google analytics.
		var linkHTML = $(this).html();
		pageTracker._trackEvent('Link', 'Outgoing',  '' + $(this).attr('href') + '');
	});


	$('#signupForm ol li:last-child').addClass('last security clearfix');
	$('#signupForm ul li:last-child').removeClass('last security clearfix');
	//$('#registrationForm ol li:last-child').addClass('last security clearfix');
	$('#signupForm .security br').remove();
	title = $('#signupForm .security span').text();
	$('#signupForm .security span').replaceWith('<label>' + title + '</label>');
	
	textLink = $('a[target="_NEW"]').text();
	hrefLink = $('a[target="_NEW"]').attr('href');

	$('form.loginForm li:last-child').append('<label class="forgot"><a href="' + hrefLink + '">' + textLink + '</a></label>');
	//field = $('#signupForm .security div').html();
	//$('#signupForm .security div').replaceWith('<span>' + field + '</span>');

	
});
