$(document).ready(function(){ 
//	if($.browser.msie && parseInt($.browser.version) == 6) {
//		$(document).pngFix();
//	}

//	if($.browser.safari) {
//		$("ul.nav li a").css("padding","17px 9px 0 9px");
//		$("ul.nav li ul li a").css("padding","7px 10px");
//		//$("ul.nav li a").css("background","#00ff00");
//	}

//	$("table.table tr:even td").css("background-color", "#f8e8cf");
////	//$("table.table tr:odd td").css("background-color", "#f4f3f0");
	$("table.table tr td:first-child").css("border-left", "1px solid #c79b18");
	$("table.table tr td:last-child").css("border-right", "1px solid #c79b18");
	$("table.table tr th:first-child").css("border-left", "1px solid #c79b18");
	$("table.table tr th:last-child").css("border-right", "1px solid #c79b18");
	
	$("table.table-archive tr td:first-child").css("border-left", "1px solid #c79b18");
	$("table.table-archive tr td").css("border-right", "1px solid #c79b18");

	$("table.news tr:even td").css("background-color", "#ecf2f6");
	$("table.table tr:even td").css("background-color", "#f6efdb");
	
	$("table.newsletter-table tr td:first-child").css("border-left", "1px solid #c79b18");
	$("table.newsletter-table tr td:last-child").css("border-right", "1px solid #c79b18");
	$("table.newsletter-table tr th:first-child").css("border-left", "1px solid #c79b18");
	$("table.newsletter-table tr th:last-child").css("border-right", "1px solid #c79b18");
	
	$("table.newsletter-table tr:even td").css("background-color", "#f6efdb");
	
	$('div.required label').append('<span style="color:#ff0000;">*</span>');
	
	$("ul.nav").superfish({
		delay:100,
		animation: {height:'show'},
		speed:'fast',
		autoArrows:false,
		onBeforeShow: beforeShow
	});
	
	$("ul.quicklinks").superfish({
		delay:100,
		animation: {height:'show'},
		speed:'fast',
		autoArrows: false
	});
	
	$('#category_select').change(function(){
	  $('#category_form').submit();
	  return false;
	});
	
	function beforeShow() {
		if($(this).prev('a').attr('id') != undefined) {
			if($(this).prev('a').attr('id') == 'apply-for-a-loan') {
				$(this).css('left','-24px');
			}
		}
	}
	
	$(".rollover").hover(
	  function () {
		var imagesrc = $(this).find("img").attr("src");
		$(this).find("img").attr("src",imagesrc.replace("-off","-on"));
	  }, 
	  function () {
		var imagesrc = $(this).find("img").attr("src");
		$(this).find("img").attr("src",imagesrc.replace("-on","-off"));
	  }
	);
	
	$('table.slideout th a').click(function() {
		var td = $(this).parent('th').parent('tr').next('tr').find('td');
		if($(td).hasClass('on')) {
			$(td).removeClass('on');
		} else {
			$(td).addClass('on');
		}
		$(this).toggleClass('on');
		return false;
	});
	
	$("a.lightbox").fancybox({
		'transitionIn'	: 'fade',
		'transitionOut'	: 'fade',
		'titleShow' : true,
		'overlayOpacity' : 0.9,
		'onComplete': function() { 
			$("#fancybox-title").css({'top':'-40px', 'bottom':'auto'}); 
		} 
	});
	
	$("a#videolightbox").click(function() {
		$.fancybox({
				'padding'		: 0,
				'autoScale'		: false,
				'transitionIn'	: 'none',
				'transitionOut'	: 'none',
				'title'			: this.title,
				'width'		    : 680,
				'height'		: 495,
				'href'			: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
				'type'			: 'swf',
				'swf'			: {
					'wmode'		: 'transparent',
					'allowfullscreen'	: 'true'
				}
			});
	
		return false;
	});
	
	$("a.videolightbox").click(function() {
		$.fancybox({
				'padding'		: 0,
				'autoScale'		: false,
				'transitionIn'	: 'none',
				'transitionOut'	: 'none',
				'title'			: this.title,
				'width'		    : 680,
				'height'		: 495,
				'href'			: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
				'type'			: 'swf',
				'swf'			: {
					'wmode'		: 'transparent',
					'allowfullscreen'	: 'true'
				}
			});
	
		return false;
	});
	
}); 
