// Used to simulate functionality for mockups. Not needed for production

$(document).ready(function() {
						 
					
// Hide all error messages which are placed in the HTML in the appropriate locations.						   
$(".errorMessage").hide();
$(".successmsgCA").hide()

superSet = "US";
// Super-sets defined.

switch (superSet){ 

	case 'US':
		$("<div id=\"demoStart\">Click Login to start Demo</div>").appendTo(".cofisso_login_panel");
		$("#demoStart").fadeTo("slow", 0.75);	
		$("<div id=\"mockupFootnote\">US Demo</div>").appendTo("body");
		$("#linkEnroll").wrap("<a href=\"http://qias2.kdc.capitalone.com:7819/theFarm/pigpen/eos/EOS_BAU_WIP/Enrollment/Enrollment.aspx.Welcome.htm\" target=\"_parent\"></a>");
		$("#linkFgotUsername").wrap("<a href=\"javascript:alert('You are viewing our demo. This feature is not enabled in the demo.')\"></a>");		
		$("#linkFgotPassword").wrap("<a href=\"javascript:alert('You are viewing our demo. This feature is not enabled in the demo.')\"></a>");			
		$("#btnEnroll").wrap("<a href=\"javascript:alert('You are viewing our demo. This feature is not enabled in the demo.')\"></a>");
		$("#showErrors").click(function () {
			$(".errorMessage").toggle("");
			});

// Remove for final WWW 
		$("a#lnkUpdateSecurityQuestions").replaceWith("<a href=\"UpdateSecurityQuestions.aspx.htm\">Update Security Questions</a>");


// Account Nicknames
		$("#c1-servicing-AccountDisplayPreferences #errMsg1").hide();
		$("#c1-servicing-AccountDisplayPreferences #btnUpdate").click(function () {
  		    $("#errMsg1").show("");
		    });    
//

		$("#enrollmentConfirmation #OTHERACCOUNTS").hide();

		// swap message dropdown from value of #cboAccountList
		$("#cboMoreSubjects").hide();
		 $("#cboAccountList").change(function () {
          	if ($(this).val() == '999') {
					$("#cboSubjectList").hide();
					$("#cboMoreSubjects").show();
			}
			else  {
			 		$("#cboSubjectList").show();
			 		$("#cboMoreSubjects").hide();
			}
			
			});

		// swap statements view based on #statementFormat
		$("#htmlStatementData").hide();
		 $("#statementFormat").change(function () {
          	if ($(this).val() == 'PDF') {
					$("#htmlStatementData").hide();
					$("#pdfStatementData").show();
			}
			else if ($(this).val() == 'HTML') {
			 		$("#pdfStatementData").hide();
			 		$("#htmlStatementData").show();
			}
			
			});
// Account Details toggle 

		$("#detaillinklabel").hide();
		$("#detaillinkvalue").hide();
		$("#moreDetailtxt").show();
		$("#lessDetailtxt").hide();

$("#detailsToggle").click(function () {
		$("#detaillinklabel").toggle();
		$("#detaillinkvalue").toggle();
		$("#moreDetailtxt").toggle();
		$("#lessDetailtxt").toggle();
		});


$("#rewardsChoices :radio").click(function () {
			$("#rewardsExplained").show();									
												
												});


// Customer Card Lab - demo

		 $("#configuratorLaunchAccount").change(function () {
          	if ($(this).val() == '1') {
					$("#warningMessage").hide();
			}
			else if ($(this).val() == '3'){
				window.location = "7174-config-1-message.html";

			}
			
			else  {
			 		$("#warningMessage").show();
			}
			
			});

// Forgot Username - Swap display criteria after modifying #ctlWorkflow_Authentication_ddlAccountType

function hideAuthenticationFields() {
		$("#cardFields").hide();
		$("#ctlWorkflow_Authentication_trLastDeposit").hide();
		$("#ctlWorkflow_Authentication_trMaturityDate").hide();
		$("#ctlWorkflow_Authentication_trPaymentAmount").hide();
		$("#ctlWorkflow_Authentication_trTotalLineAmount").hide();
		$("#ctlWorkflow_Authentication_trZipCode").hide();
}
hideAuthenticationFields();
					
		 $("#ctlWorkflow_Authentication_ddlAccountType").change(function () {
          	if ($(this).val() == 'UNSELECTED') {
				hideAuthenticationFields();			
			}
			else if ($(this).val() == 'CHECKING') {
				hideAuthenticationFields();			
				$("#ctlWorkflow_Authentication_trLastDeposit").show();
			}
			else if ($(this).val() == 'CREDITCARD') {
				hideAuthenticationFields();			
				$("#cardFields").show();
			}
			else if ($(this).val() == 'SAVINGS') {
				hideAuthenticationFields();			
				$("#ctlWorkflow_Authentication_trLastDeposit").show();
			}
			else if ($(this).val() == 'PASSBOOK') {
				hideAuthenticationFields();			
				$("#ctlWorkflow_Authentication_trLastDeposit").show();
			}
			else if ($(this).val() == 'MONEYMARKET') {
				hideAuthenticationFields();			
				$("#ctlWorkflow_Authentication_trLastDeposit").show();
			}
			else if ($(this).val() == 'IRA') {
				hideAuthenticationFields();			
				$("#ctlWorkflow_Authentication_trMaturityDate").show();
			}
			else if ($(this).val() == 'CD') {
				hideAuthenticationFields();			
				$("#ctlWorkflow_Authentication_trMaturityDate").show();
			}
			else if ($(this).val() == 'AUTOLOAN') {
				hideAuthenticationFields();			
				$("#ctlWorkflow_Authentication_trPaymentAmount").show();
			}			
			else if ($(this).val() == 'LINEOFCREDIT') {
				hideAuthenticationFields();			
				$("#ctlWorkflow_Authentication_trTotalLineAmount").show();
			}
			else if ($(this).val() == 'LOAN') {
				hideAuthenticationFields();			
				$("#ctlWorkflow_Authentication_trPaymentAmount").show();
			}
			else if ($(this).val() == 'BUSINESSCARD') {
				hideAuthenticationFields();			
				$("#ctlWorkflow_Authentication_trZipCode").show();
			}
			else  {
				hideAuthenticationFields();			
			}	
			
			});
			
// Account Summary P2 functionality
$("#").hide("#");
		
		
	$('#testmeout').click(function(){
     $('errMsg1').hide();
   });
			
			
			
			
			
		
			
	break;
	
	}



// Get the filename and use as a unique identifier

if (location.href.lastIndexOf('/') !=-1)
{
firstpos=document.URL.lastIndexOf('/')+1;
lastpos=document.URL.length;
theDoc=document.URL.substring(firstpos,lastpos);
}

// other global redirect links
//$("#LNKHOME").click(function() { alert("This feature is not enabled in the Demo.") } );
//$("#LNKPRIVACY").click(function() { alert("This feature is not enabled in the Demo.") } );
//$("#LNKSECURITY").click(function() { alert("This feature is not enabled in the Demo.") } );
//$("#LNKTERMS").click(function() { alert("This feature is not enabled in the Demo.") } );
//$("#LNKFDIC").click(function() { alert("This feature is not enabled in the Demo.") } );
//$("#LNKVERISIGN").click(function() { alert("This feature is not enabled in the Demo.") } );




// Define page specific functions.	
// using unique identifier:
switch (theDoc){ 
	
	
// Actions for individual pages by their body.id. 

	
	case 'PendingPayments.aspx.htm':
//$(".itemPendingPayments a").mousedown(function() { alert("This feature is not enabled in the Demo.") } );	
	
	break;
	

	};
// end of switch()


});