﻿$(document).ready(function() {
	$('.JavascriptRequired').hide();
	$('.LoginBox').show();
	$('form').bind('submit', function() { });

	function clearFieldBackground(field) {
		field.css('background', '#fff');
	}

	function backgroundUsername() {
		field = $("input[id$='txtUsername']");
		if ((field.val() != null) && (field.val().length < 1))
		{
			field.css('background', '#fff url(/Images/OnlineBanking/inputfield_username.gif) no-repeat left center');
		}
		else {
			clearFieldBackground(field);
		}
	}
	function backgroundPassword() {
		field = $("input[id$='txtPassword']");
		if ((field.val() != null) && (field.val().length < 1))
		{
			field.css('background', '#fff url(/Images/OnlineBanking/inputfield_password.gif) no-repeat left center');
		}
		else {
			clearFieldBackground(field);
		}
	}

	backgroundUsername();
	backgroundPassword();

	$("input[id$='txtUsername']").blur(function() { backgroundUsername(); });
	$("input[id$='txtPassword']").blur(function() { backgroundPassword(); });
	$("input[id$='txtUsername']").focus(function() { clearFieldBackground($(this)); });
	$("input[id$='txtPassword']").focus(function() { clearFieldBackground($(this)); });

	$('a.WhySignin').qtip({
		content: "To protect your personal details we require you to sign in again to access our high security area.",
		style: {
			border: {
				size: 3,
				radius: 5
			},
			fontSize: 14,
			fontWeight: 'bold',
			tip: 'topLeft',
			name: 'dark'
		},
		hideOthers: true,
		position: {
			corner: {
				target: 'bottomMiddle',
				tooltip: 'topLeft'
			}
		},
		show: {
			delay: 0,
			effect: { length: 100 },
			solo: true
		},
		hide: {
			delay: 0,
			effect: { length: 100 },
			fixed: true
		}
	});
});
