	
	$(function(){
		
				
		$('.inmateButton').click(function(){
			$('.startBillPanel').hide();
			$('.inmateBillPanel').show();
			
			return false;
		});
		
		
		$('.inmateBackButton').click(function(){
			$('.inmateBillPanel').hide();
			$('.startBillPanel').show();
			
			return false;
		});
		
		
		$('.billPayTab2').hide();
		$('.billPayTab, .billPayTab2').click(function(){
			$('.billPayTab').toggle();
			$('.billPayTab2').toggle();
			
			$('.pane2').hide();
			$('.billPayTab').toggleClass('open2');
			
			if ($('.billPayTab').hasClass('open2')){
				$('.otherPaymentPane').show();
				
			} else {
				$('.billPayPane').show();
			}
		});
		
		
		$('.giftCardTab2').hide();
		
		$('.prePaidPane .image').hide();
		
		$('.giftCardTab, .giftCardTab2').click(function(){
			$('.giftCardTab').toggle();
			$('.giftCardTab2').toggle();
			
			$('.pane').hide();
			$('.giftCardTab').toggleClass('open');
			
			if ($('.giftCardTab').hasClass('open')){
				$('.prePaidPane').show();
				$('.prePaidPane .image').show();
			} else {
				$('.giftCardPane').show();
			}
		});
			 
		
		$('.languageDrop').hide();
		$('.languageSelect, .languageDrop a').click(function(){
			$('.languageDrop').toggle();
			return false;
		});
		
		
		$(".loginSelect").change(function(){
			
			$("#header .loginDropDown .panel").hide();
			panel = $(this).val();
			
			
			$(".loginSelect").val($(".loginSelect option:first").val());
			
			
			$("#header .loginDropDown ." + panel).show();
		});
		
		
		$("#login .loginBox .loginDropBox").hide();
		
		
		$("#login .loginBox .radioButton").click(function(){
			if ($("#login .loginBox .radioButton:checked").val() == 'return'){
				$("#login .loginBox .loginDropBox").fadeIn('fast');
			}
			if ($("#login .loginBox .radioButton:checked").val() == 'new'){
				$("#login .loginBox .loginDropBox").fadeOut('fast');
			}
		});
		
		
		$(".button").click(function(){
			
			$("#login .loginBox .panel").hide();
			
			
			$(".button").removeClass('active');
			
			
			$(this).addClass('active');
			
			
			if ($(this).hasClass("sendMoneyLink")) {
				$("#login .loginBox .loginSendMoney").show();
			} else if ($(this).hasClass("goldCardRewardsLink")) {
				$("#login .loginBox .loginGoldCard").show();
			} else if ($(this).hasClass("goldCardPhoneLink")) {
				$("#login .loginBox .loginPhone").show();
			} else if ($(this).hasClass("prePaidLink")) {
				$("#login .loginBox .loginPrePaid").show();
			} else if ($(this).hasClass("wuPerksLink")) {
				$("#login .loginBox .loginPerks").show();
			} else if ($(this).hasClass("agentsLink")) {
				$("#login .loginBox .loginAgent").show();
			}
			
			return false;
		});
		
		
		$(".loginButton").click(function(){
			
			$("#header .loginDropDown .panel").hide();
			
			
			if ($(this).hasClass("sendMoneyLink")) {
				$("#header .loginDropDown .loginSendMoney").show();
			} else if ($(this).hasClass("goldCardRewardsLink")) {
				$("#header .loginDropDown .loginGoldCard").show();
			} else if ($(this).hasClass("goldCardPhoneLink")) {
				$("#header .loginDropDown .loginPhone").show();
			} else if ($(this).hasClass("prePaidLink")) {
				$("#header .loginDropDown .loginPrePaid").show();
			} else if ($(this).hasClass("wuPerksLink")) {
				$("#header .loginDropDown .loginPerks").show();
			} else if ($(this).hasClass("agentsLink")) {
				$("#header .loginDropDown .loginAgent").show();
			}
			
			return false;
		});
		
		
		$(".helpIcon").qtip({
						content: {title: 'Contextual Header', text: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.' },
						show: 'mouseover',
						hide: 'mouseout',
						style: { width: 200, padding: 5, background: '#fff', color: '#000', name: 'dark', tip: false, 'font-size': 10, 'padding': 3,
							border: { width: 1, radius: 3, color: '#ffdf1c' },
							title: {'color': '#000', 'font-size': 11, 'height': 12, 'margin': 2, 'margin-top': 0, 'padding': 5, 'padding-bottom': 0, 'background': '#fff', 'font-weight': 'bold' }
						},
						position: { adjust: { screen: true } }	
						});
		$(".helpIcon2").qtip({
						content: {text: 'Your Money Transfer Control Number (MTCN) is the 10-digit number provided on your receipt or transfer confirmation page and confirmation e-mail if your transfer was made online.' },
						show: 'mouseover',
						hide: 'mouseout',
						style: { width: 200, padding: 5, background: '#fff', color: '#000', name: 'dark', tip: false, 'font-size': 10, 'padding': 3,
							border: { width: 1, radius: 3, color: '#ffdf1c' },
							title: {'color': '#000', 'font-size': 11, 'height': 12, 'margin': 2, 'margin-top': 0, 'padding': 5, 'padding-bottom': 0, 'background': '#fff', 'font-weight': 'bold' }
						},
						position: { adjust: { screen: true } }	
						});
		
		
		$("#header .loginDropDown").hide();
		$("#header .userLoginLink").click(function(){
			if (!$("#header .userLoginLink").hasClass("userLinkActive")){
				$("#header .userLoginLink").addClass("userLinkActive");
				
				$('#content .accordion select:visible').addClass('revert');
				$('#content .accordion select:visible').hide();
				$("#header .loginDropDown").show();
			} else {
				$("#header .userLoginLink").removeClass("userLinkActive");
				$("#header .loginDropDown").hide();
				$("#header .loginDropDown .panel").hide();
				$("#header .loginDropDown .loginMenu").show();
				
				$('#content .accordion .revert').show();
			}
			return false;
		});
		
		$("#header .closeLogin").click(function(){
			$("#header .userLoginLink").removeClass("userLinkActive");
			$("#header .loginDropDown").hide();
			$("#header .loginDropDown .panel").hide();
			$("#header .loginDropDown .loginMenu").show();
			return false;
		});
		
		
		
		$(".pngFix").ifixpng();
		$("h3").ifixpng();
		$(".panel .sendMoneyContent").ifixpng();
		$(".panel .checkTransferContent").ifixpng();
		$(".panel .goldCardContent").ifixpng();
		$(".panel .prePaidContent").ifixpng();
		$(".panel .billPayContent").ifixpng();
		$(".panel .billPayButton").ifixpng();
		

		
		$('.nextHide').hide();
		$('.billPayMort').hide();
		$('.billPayFin').hide();
		
		
		$('.nextPanel').click(function(){
			
			sliderEle = $(this).closest('.slider');
			$(sliderEle).animate({left: '-=275px'}, 'slow');
			return false;
		}); 
		
		
		$('.prevPanel').click(function(){
			
			sliderEle = $(this).closest('.slider');
			$(sliderEle).animate({left: '+=275px'}, 'slow');
			return false;
		});
		
		
		$('#transferCountry').change(function(){
			value = $('#transferCountry :selected').val();
			switch(value){
				case 'CAN': $('#transferCaProv').fadeIn();$('#transferUsState').hide();$('#transferAustProv').hide();$('.transferNextButt1').hide();break;
				case 'AUS': $('#transferAustProv').fadeIn();$('#transferUsState').hide();$('#transferCaProv').hide();$('.transferNextButt1').hide();break;
				case 'USA': $('#transferUsState').fadeIn();$('#transferCaProv').hide();$('#transferAustProv').hide();$('.transferNextButt1').hide();break;
				case '': $('#transferUsState').hide();$('#transferCaProv').hide();$('#transferAustProv').hide();$('.transferNextButt1').hide();break;
				default: $('#transferUsState').hide();$('#transferCaProv').hide();$('#transferAustProv').hide();$('.transferNextButt1').fadeIn();break;
			}
		});
		
		
		$('#transferCaProv').change(function(){
			value = $('#transferCaProv :selected').val();
			switch(value){
				case '': $('.transferNextButt1').hide();break;
				default: $('.transferNextButt1').fadeIn();break;
			}
		});
		
		
		$('#transferUsState').change(function(){
			value = $('#transferUsState :selected').val();
			switch(value){
				case '': $('.transferNextButt1').hide();break;
				default: $('.transferNextButt1').fadeIn();break;
			}
		});
		
		
		$('#transferAustProv').change(function(){
			value = $('#transferAustProv :selected').val();
			switch(value){
				case '': $('.transferNextButt1').hide();break;
				default: $('.transferNextButt1').fadeIn();break;
			}
		});
		
		
		$('#transferTCountry').change(function(){
			value = $('#transferTCountry :selected').val();
			switch(value){
				case 'CAN': $('#transferTCaProv').fadeIn();$('#transferTUsState').hide();$('#transferTAustProv').hide();$('.transferNextButt2').hide();break;
				case 'AUS': $('#transferTAustProv').fadeIn();$('#transferTUsState').hide();$('#transferTCaProv').hide();$('.transferNextButt2').hide();break;
				case 'USA': $('#transferTUsState').fadeIn();$('#transferTCaProv').hide();$('#transferTAustProv').hide();$('.transferNextButt2').hide();break;
				case '': $('#transferTUsState').hide();$('#transferTCaProv').hide();$('#transferTAustProv').hide();$('.transferNextButt2').hide();break;
				default: $('#transferTUsState').hide();$('#transferTCaProv').hide();$('#transferTAustProv').hide();$('.transferNextButt2').fadeIn();break;
			}
		});
		
		
		$('#transferTCaProv').change(function(){
			value = $('#transferTCaProv :selected').val();
			switch(value){
				case '': $('.transferNextButt2').hide();break;
				default: $('.transferNextButt2').fadeIn();break;
			}
		});
		
		
		$('#transferTUsState').change(function(){
			value = $('#transferTUsState :selected').val();
			switch(value){
				case '': $('.transferNextButt2').hide();break;
				default: $('.transferNextButt2').fadeIn();break;
			}
		});
		
		
		$('#transferTAustProv').change(function(){
			value = $('#transferTAustProv :selected').val();
			switch(value){
				case '': $('.transferNextButt2').hide();break;
				default: $('.transferNextButt2').fadeIn();break;
			}
		});
		
		
		$('#transferType').change(function(){
			value = $('#transferType :selected').val();
			switch(value){
				case '': $('.transferAmount').hide();$('.amountHelp').hide();$('.transferNextButt3').hide();break;
				default: $('.transferAmount').val('Amount to send');$('.transferAmount').fadeIn();$('.amountHelp').fadeIn();break;
			}
		});
		
		
		$('#transferAmount').keyup(function(){
			value = $(this).val();
			if (value == 'Amount to send' || value == ''){
				$('.transferNextButt3').hide();
			} else {
				$('.transferNextButt3').fadeIn();
			}
		});
		
		
		$('#transferRecipientFirst').keyup(function(){
			recipientStep();
		});
		$('#transferRecipientLast').keyup(function(){
			recipientStep();
		});
		
		
		$('#billPayUsState').change(function(){
			value = $('#billPayUsState :selected').val();
			switch(value){
				case '': $('.billPayMort').hide();break;
				default: $('.billPayMort').fadeIn();break;
			}
		});
		
		
		$('#billPayMort').change(function(){
			value = $('#billPayMort :selected').val();
			switch(value){
				case '': $('.billPayFin').hide();break;
				default: $('.billPayFin').fadeIn();break;
			}
		});
		
		
		$('#billPayInst').change(function(){
			billPayStep();
		});
		
		
		$('#billPayOther').change(function(){
			billPayStep();
		});
		
		
		$("#content .accordion").accordion({ collapsible: true, active: false });
		
		
		accordInit();
		
		
		$("#contentBackground .rotatingSlides").cycle({fx: 'fade', speed: 2500, timeout: 8000, cleartype: 1});
		
		
		
		window.initState = false;
		$("#content .accordion").bind('accordionchangestart', function(event, ui) {
			
			
			if ($("#content h3").hasClass("ui-state-active")){ 
				initState = true;
			} else {
				initState = false;
			}
			
			
			if (!initState){
				accordInit();
				$("#contentBackground .rotatingSlides").cycle('resume');
				$('.slide').fadeIn();
				$(".heroSlide").fadeOut();
			} else {
				if ($("#content .sendMoneyPanel").hasClass("ui-state-active")){
					accordDeInit(2);
showPanel('.sendMoneySlide');
captureLinkOmni('SignInCl');
				} else if ($("#content .checkTransferPanel").hasClass("ui-state-active")){
					accordDeInit(3);
showPanel('.checkTransferSlide');
					captureLinkOmni('checkTransferCl');
				} else if ($("#content .goldCardPanel").hasClass("ui-state-active")){
					accordDeInit(4);
showPanel('.goldCardSlide');
					captureLinkOmni('goldCardCl');
				} else if ($("#content .prePaidPanel").hasClass("ui-state-active")){
					accordDeInit(5);
showPanel('.prePaidSlide');
					captureLinkOmni('prepaidCardsCl');
				} else if ($("#content .billPayPanel").hasClass("ui-state-active")){
					accordDeInit(6);
showPanel('.billPaySlide');
					captureLinkOmni('billPayCl');
				}
			}
		});
		
		$(".prePaidButton").click(function(){
			
			$("#content .accordion").accordion( 'activate' , 3 )
		});
		
		
		$("#content h3, #content .panel, #contentBackground").hover(function(){
			if (!initState) {
				$("#contentBackground .rotatingSlides").cycle('pause');
			}
		}, function(){
			if (!initState) {
				$("#contentBackground .rotatingSlides").cycle('resume');
			}
		});
		
		
		$('input.auto').focus(function(){
			$('input.auto').autoNumeric();
		});
		
		
		$("#loginUsername").toggleVal({ populateFrom: "label", removeLabels: true, focusClass: "hasFocus", changedClass: "isChanged" });
		$("#loginPassword").toggleVal({ populateFrom: "label", removeLabels: true, focusClass: "hasFocus", changedClass: "isChanged" });
		$("#loginCaptcha").toggleVal({ populateFrom: "label", removeLabels: true, focusClass: "hasFocus", changedClass: "isChanged" });
		
		$("#transferAmount").toggleVal({ populateFrom: "label", removeLabels: true, focusClass: "hasFocus", changedClass: "isChanged" });
		
		$("#transferRecipientFirst").toggleVal({ populateFrom: "label", removeLabels: true, focusClass: "hasFocus", changedClass: "isChanged" });
		$("#transferRecipientLast").toggleVal({ populateFrom: "label", removeLabels: true, focusClass: "hasFocus", changedClass: "isChanged" });
		
		$("#checkMTCN").toggleVal({ populateFrom: "label", removeLabels: true, focusClass: "hasFocus", changedClass: "isChanged" });
		$("#checkSendersFirst").toggleVal({ populateFrom: "label", removeLabels: true, focusClass: "hasFocus", changedClass: "isChanged" });
		$("#checkSendersLast").toggleVal({ populateFrom: "label", removeLabels: true, focusClass: "hasFocus", changedClass: "isChanged" });
		$("#checkReceiversFirst").toggleVal({ populateFrom: "label", removeLabels: true, focusClass: "hasFocus", changedClass: "isChanged" });
		$("#checkReceiversLast").toggleVal({ populateFrom: "label", removeLabels: true, focusClass: "hasFocus", changedClass: "isChanged" });
		
		$("#checkSendersFirst2").toggleVal({ populateFrom: "label", removeLabels: true, focusClass: "hasFocus", changedClass: "isChanged" });
		$("#checkSendersLast2").toggleVal({ populateFrom: "label", removeLabels: true, focusClass: "hasFocus", changedClass: "isChanged" });
		
		
		$("#countrySelect").toggleVal({ populateFrom: "label", removeLabels: true, focusClass: "hasFocus", changedClass: "isChanged" });
		$("#city").toggleVal({ populateFrom: "label", removeLabels: true, focusClass: "hasFocus", changedClass: "isChanged" });
		$("#state").toggleVal({ populateFrom: "label", removeLabels: true, focusClass: "hasFocus", changedClass: "isChanged" });
		$("#zip").toggleVal({ populateFrom: "label", removeLabels: true, focusClass: "hasFocus", changedClass: "isChanged" });
		$("#zipCode").toggleVal({ populateFrom: "label", removeLabels: true, focusClass: "hasFocus", changedClass: "isChanged" });
		
		$("#goldCardUsername").toggleVal({ populateFrom: "label", removeLabels: true, focusClass: "hasFocus", changedClass: "isChanged" });
		$("#goldCardPassword").toggleVal({ populateFrom: "label", removeLabels: true, focusClass: "hasFocus", changedClass: "isChanged" });
		
		$("#usernameAgents").toggleVal({ populateFrom: "label", removeLabels: true, focusClass: "hasFocus", changedClass: "isChanged" });
		$("#passwordAgents").toggleVal({ populateFrom: "label", removeLabels: true, focusClass: "hasFocus", changedClass: "isChanged" });
		
		$("#usernamePerks").toggleVal({ populateFrom: "label", removeLabels: true, focusClass: "hasFocus", changedClass: "isChanged" });
		$("#passwordPerks").toggleVal({ populateFrom: "label", removeLabels: true, focusClass: "hasFocus", changedClass: "isChanged" });
		
		$("#usernamePhone").toggleVal({ populateFrom: "label", removeLabels: true, focusClass: "hasFocus", changedClass: "isChanged" });
		$("#passwordPhone").toggleVal({ populateFrom: "label", removeLabels: true, focusClass: "hasFocus", changedClass: "isChanged" });

		$("#usernamePrePaid").toggleVal({ populateFrom: "label", removeLabels: true, focusClass: "hasFocus", changedClass: "isChanged" });
		$("#passwordPrePaid").toggleVal({ populateFrom: "label", removeLabels: true, focusClass: "hasFocus", changedClass: "isChanged" });

		$("#usernameSendMoney").toggleVal({ populateFrom: "label", removeLabels: true, focusClass: "hasFocus", changedClass: "isChanged" });
		$("#signInPasswordText").toggleVal({ populateFrom: "label", removeLabels: true, focusClass: "hasFocus", changedClass: "isChanged" });
		$("#passwordSendMoney").toggleVal({ populateFrom: "label", removeLabels: true, focusClass: "hasFocus", changedClass: "isChanged" });
		$("#captchaSendMoney").toggleVal({ populateFrom: "label", removeLabels: true, focusClass: "hasFocus", changedClass: "isChanged" });

		$("#usernameGoldCard").toggleVal({ populateFrom: "label", removeLabels: true, focusClass: "hasFocus", changedClass: "isChanged" });
		$("#passwordGoldCard").toggleVal({ populateFrom: "label", removeLabels: true, focusClass: "hasFocus", changedClass: "isChanged" });

		
		
		$('.captchaLink').openDOMWindow({ 
			eventType:'click',
			borderSize: 0,
			width: 750,
			height: 500,
			windowBGColor: 'none'
		});
		
		
		$('.privacyLink').openDOMWindow({ 
			eventType:'click',
			borderSize: 0,
			width: 750,
			height: 500,
			windowBGColor: 'none'
		});
		
		
		$('.confirmationButton').openDOMWindow({ 
			eventType:'click',
			borderSize: 0,
			width: 750,
			height: 500,
			windowSourceID:'#confirmationMessage', 
			windowBGColor: 'none'
		});
		$('#registerBtn').openDOMWindow({ 
			eventType:'click',
			borderSize: 0,
			width: 750,
			height: 500,
			windowSourceID:'#confirmationMessage2', 
			windowBGColor: 'none'
		});
	});
	
	
	function accordInit(){
		
		$("#contentBackground").cycle('resume');
		
		
		activePanel = -1;
		
		
		
		$("#content h3 span").removeClass("small");
		$("#content .sendMoneyPanel").animate({height: "72px", lineHeight: "72px"}, 600);
		$("#content .checkTransferPanel").animate({height: "74px", lineHeight: "74px"}, 600);
		$("#content .goldCardPanel").animate({height: "73px", lineHeight: "73px"}, 600);
		$("#content .prePaidPanel").animate({height: "73px", lineHeight: "73px"}, 600);
		$("#content .billPayPanel").animate({height: "75px", lineHeight: "75px"}, 600);
	}
	
	
	function accordDeInit(panelAct){
		
		
		$("#content .accordion h3").animate({height: "30px", lineHeight: "34px"}, 310);
		$("#content h3 span").addClass("small");
	}
	
	
	function slideNum(number){
		$("#contentBackground").cycle(number);
		$('#content .accordion').accordion('activate', number);
		
		if (initState) {
			activePanel = number;
			$("#contentBackground").cycle('pause');
		}
	}
	
	
	function showPanel(heroName) {
		$(".heroSlide").fadeOut();
		if (initState) {
			$("#contentBackground .rotatingSlides").cycle('pause');
			$(heroName).fadeIn();
			$('.slide').fadeOut();
			
		} else {
			$("#contentBackground .rotatingSlides").cycle('resume');
			$('.slide').fadeIn();
			$(".heroSlide").fadeOut();
			
		}
	}
	
	function recipientStep(){
		value1 = $('#transferRecipientFirst').val();
		value2 = $('#transferRecipientLast').val();
		
		if (value1 == 'Recipient first name' || value1 == ''){
			$('.transferNextButt4').hide();
		} else {
			if (value2 == 'Recipient last name' || value2 == ''){
				$('.transferNextButt4').hide();
			} else {
				$('.transferNextButt4').fadeIn();	
			}
		}
	}
	
	function billPayStep(){
		value1 = $('#billPayInst').val();
		value2 = $('#billPayOther').val();
		
		$('.nextHide').hide();
		if (value1 == 'Select Bank' || value1 == ''){
			
		} else {
			$('.transferNextButt5').fadeIn();	
		}
		
		if (value2 == 'Select Other Billers' || value2 == ''){
			
		} else {
			$('.transferNextButt5').fadeIn();	
		}
	}
	
	function replaceBg(selector, backgroundimage){
		
		$(selector).css('background', backgroundimage);
}
function captureLinkOmni(crName){
	if($('#s_pageName') != null)
		crName = $('#pnameId').val() + crName;
var channel='US:wucom';		
var langCode = 'en';
	if($('#languageCode') != null){
		langCode = $('#languageCode').val();
	}	
	setOmnitureVal(crName,channel,langCode);
}