$(document).ready(function() {
	
	$('.text-field input').each( function () {
		$(this).val($(this).attr('defaultVal'));
		$(this).css({color:'grey'});
	});

	$('.text-field input').focus(function(){
		if ( $(this).val() == $(this).attr('defaultVal') ){
			$(this).val('');
			$(this).css({color:'black'});
		}
	});
	$('.text-field input').blur(function(){
		if ( $(this).val() == '' ){
			$(this).val($(this).attr('defaultVal'));
			$(this).css({color:'grey'});
		}
	});
	// IE6 and IE7 don't support CSS :after so we need to do this in jQuery for these 2 browsers only
	if ($.browser.msie && $.browser.version <= 7) {
		//$('header nav').after('<div class="main-menu-after"><img src="/wcm/site/template-images/main-menu-shadow.gif" alt=""/></div>');
		$('#strip-boxes').after('<div class="strip-boxes-after"></div>');
		$('.entry table tbody tr:nth-child(odd)').addClass('row2');
		//$('.entry table tbody tr.even').addClass('row2');
		$('input[type="text"]').addClass('typeText');
		$('input[type="password"]').addClass('typePassword');
	}

	$(".level2").each( function () {
		if ($(this).text() == 'Confirmation'){
			$(this).html('<li class="selected"><a title="" href="#">'+$("title").html()+'</a></li>');
		}
	});	
	
	$("aside#strip-boxes section.call-to-action p").evenHeights();
});




//Bug Fix: when changing company dropdown don;t submit the gateway Id as this is re-used in the filter for the new selected company
var ManageAnyCompany = {
	init: function() {
		var companySelectDropdown = $("#company-select #companyid");
		var gatewaySelectDropdown = $("#company-select #gatewayid");
		companySelectDropdown.bind ("change", function() {
			gatewaySelectDropdown.find ("option").each (function(index, element) {
				$(element).attr ("value", "");
			});
		});
	}
}
$(window).ready(function() {
	ManageAnyCompany.init();
});

