// stuff inside here will run when the DOM is ready
// onload replacement
$(function(){
	// Uncomment and Optimize the selector below. I.E. "ul.rollover" or even better "#navContainer".
	// It will be much faster!
	$('.rollover').rollovers();
});

// for Cool Menus
if(window.event + "" == "undefined") event = null;
function showMenu(){return false};
oM = {mout:function(){return false;}};

function target_blank(url){
    tmp = window.open(url);
    tmp = null;
}

function wcInternalPopup(url, height, width){
	var wide = parseInt(width);
	var tall = parseInt(height);
    var halfwide = (wide/2);
    var halftall = (tall/2);
    var pWidth = (((parseInt(screen.width) / 2)) - halfwide);
    var pHeight = (((parseInt(screen.height) / 2)) - halftall);
    var features = 'toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,width='+wide+',height='+tall+',top='+pHeight+',left='+pWidth;
    window.open(url,'internalpopup',features);
}

function wcPopup(url, height, width, disclaimer){
	var disclaimer = parseInt(disclaimer);
	var wide = parseInt(width);
	var tall = parseInt(height);
	var halfwide = (wide/2);
	var halftall = (tall/2);
	var pWidth = (((parseInt(screen.width) / 2)) - halfwide);
	var pHeight = (((parseInt(screen.height) / 2)) - halftall);
	var features = 'toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1,width='+wide+',height='+tall+',top='+pHeight+',left='+pWidth;
	if (disclaimer)
		showWarning("javascript:void(window.open('"+url+"','externalpopup','"+features+"'))", url, false, disclaimer)
	else
		window.open(url,'externalpopup',features);
}

function openDisc(page){
	var pWidth = ( ((parseInt(screen.width) / 2)) - 300)
	var pHeight = (((parseInt(screen.height) / 2)) - 400)
	bWindow = window.open(page,'discwin',"scrollbars=1,toolbar=0,location=0,directories=0,status=0,menubar=0,width=600,height=600,top=" + pHeight + ",left=" + pWidth);
	bWindow = null;
}

/************************************************************************************************************
* This function is used in the onclick of the a tag to display the external site warning. 
* @param msg - Integer specifying the which message to display.
* @param lk - The a link object
* Usage: <a href="http://wwww.mysite.com" onclick="return displayThirdPartyAlert(1,this);">My Site</a>
**************************************************************************************************************/
function displayThirdPartyAlert(msg,lk){
	var description = lk.innerHTML;
	if(description.indexOf('alt="') != -1){
		var x = description.indexOf('alt="')+5;
		var temp = description.substring(x);
		description = temp.substring(0,temp.indexOf("\""));
	}
	showWarning(lk.href, description, lk.target, msg)
	return false;
}

/************************************************************************************************************
* This function is used in the href of the a tag to display the external site warning. 
* @param lk - The url of the site to be opened
* @param desc - The description of the site to be opened, i.e. the name of the site.
* @param target - Allows for the window to opened in a new window
* @param msg - Integer specifying the which message to display.
* Usage: <a href="javascript:showWarning('http://wwww.mysite.com');">My Site</a>
**************************************************************************************************************/

function showWarning(lk, desc, target, msg){
	desc = (desc) ? desc : "Third Party Site";
//	target = (target) ? target : "_blank";
	msg = (msg) ? msg : 0;
	
	var messages = new Array(6);
	// Standard 3rd Party Warning
	messages[0] = messages[1] = '<h2 style="text-align:center">Third Party Site Disclaimer</h2><p>By accessing the noted link you will be leaving '+fiName+'\'s website and entering a website hosted by another party. '+fiName+' has not approved this as a reliable partner site. Please be advised that you will no longer be subject to, or under the protection of, the privacy and security policies of '+fiName+'\'s website. We encourage you to read and evaluate the privacy and security policies of the site you are entering, which may be different than those of '+fiName+'.</p>';
	// Standard Partner Warning
	messages[2] = '<h2 style="text-align:center">Partner Site Disclaimer</h2><p>By accessing the noted link you will be leaving our website and entering a partner site which is hosted by another party. Please be advised that you will no longer be subject to, or under the protection of, the privacy and security policies of our website. We encourage you to read and evaluate the privacy and security policies of the site which you are entering, which may be different than those of ours.</p>';
	// Standard Affiliate Warning
	messages[3] = '<h2 style="text-align:center">Affiliate Site Disclaimer</h2><p>By accessing the noted link you will be leaving our website and entering an affiliate site located which is hosted by another party. Please be advised that you will no longer be subject to, or under the protection of, the privacy and security policies of our website. We encourage you to read and evaluate the privacy and security policies of the site which you are entering, which may be different than those of ours.</p>';
	// Customize if requested -- Patriot Act Disclaimer
	messages[4] = '<h2 style="text-align:center">Important information about<br />opening an account</h2><p>On September 11, 2001, our lives changed forever.  In an effort to protect you and our country, the USA PATRIOT Act was signed into law.  To help the government fight the funding of terrorism and money laundering activities, Federal law requires all financial institutions to obtain, verify and record information that identifies each person who opens an account.</p><p>When you open an account, we will ask you for your name, address, date of birth and other information that will allow us to identify you. We may ask to see your driver’s license or other identifying documents.</p><p>We proudly support all efforts to protect and maintain the security of our customers and our country.</p>';
	// Standard mailto: Insecure Warning
	messages[5] = '<h2 style="text-align:center">Email Disclaimer</h2><p>This is <strong>NOT</strong> a secured e-mail transmission. Please <strong>do not send personal/financial information</strong> via this method.</p>';

    ////////////// The disclaimers below cannot be selected in the WCAC content editor (only A-E which correspond to messages 1-5 above

    // Large table credit card disclosure (created for 201-26390)
    messages[6]  = '<table cellspacing="0" cellpadding="4" class="cc_disclaimer" style="width: 100%">';
    messages[6] += '    <tr>';
	messages[6] += '		<th>Interest Rates and Interest Changes</th>';
	messages[6] += '		<th>Visa®, Visa® Gold and Mastercard®</th>';
	messages[6] += '	</tr>';
	messages[6] += '	<tr>';
	messages[6] += '		<td><strong>Annual Percentage Rate (APR) for Purchases</strong></td>';
	messages[6] += '		<td><strong>15.00%</strong><br />Fixed</td>';
	messages[6] += '	</tr>';
	messages[6] += '	<tr>';
	messages[6] += '		<td><strong>APR for Balance Transfers</strong></td>';
	messages[6] += '		<td><strong>15.00%</strong><br />Fixed</td>';
	messages[6] += '	</tr>';
	messages[6] += '	<tr>';
	messages[6] += '		<td><strong>APR for Cash Advances</strong></td>';
	messages[6] += '		<td><strong>15.00%</strong><br />Fixed</td>';
	messages[6] += '	</tr>';
	messages[6] += '	<tr>';
	messages[6] += '		<td><strong>Penalty APR and When it Applies</strong></td>';
	messages[6] += '		<td>None</td>';
	messages[6] += '	</tr>';
	messages[6] += '	<tr>';
	messages[6] += '		<td><strong>How to Avoid Paying Interest on Purchases</strong></td>';
	messages[6] += '		<td>Your due date is at least <strong>25 </strong>days after the close of each billing cycle. We will not charge you interest on purchases if you pay your entire balance by the due date (Grace Period) each month.</td>';
	messages[6] += '	</tr>';
	messages[6] += '	<tr>';
	messages[6] += '		<td><strong>Minimum Interest Charge</strong></td>';
	messages[6] += '		<td>If you are charged interest, the charge will be no less than <strong>$0.00</strong>.</td>';
	messages[6] += '	</tr>';
	messages[6] += '	<tr>';
	messages[6] += '		<td><strong>For Credit Card Tips from the Federal Reserve Board</strong></td>';
	messages[6] += '		<td>To learn more about factors to consider when applying for or using a credit card, visit the web site of the Federal Reserve Board at http://www.federalreserve.gov/creditcard.</td>';
	messages[6] += '	</tr>';
	messages[6] += '</table>';
	messages[6] += '<table cellspacing="0" cellpadding="4" class="cc_disclaimer" style="width: 100%">';
	messages[6] += '	<tr>';
	messages[6] += '		<th>Fees</th>';
	messages[6] += '		<th>Visa® and Mastercard®</th>';
	messages[6] += '		<th>Visa® Gold</th>';
	messages[6] += '	</tr>';
	messages[6] += '	<tr>';
	messages[6] += '		<td>Annual Fee</td>';
	messages[6] += '		<td>$12.00</td>';
	messages[6] += '		<td>$24.00</td>';
	messages[6] += '	</tr>';
	messages[6] += '	<tr>';
	messages[6] += '		<td style="vertical-align: top">';
	messages[6] += '			Transaction Fees';
	messages[6] += '			<ul>';
	messages[6] += '				<li>Balance Transfer</li>';
	messages[6] += '				<li>Cash Advances</li>';
	messages[6] += '				<li>Foreign Transaction</li>';
	messages[6] += '			</ul>';
	messages[6] += '		</td>';
	messages[6] += '		<td colspan="2" style="vertical-align: top"><br />';
	messages[6] += '			<ul style=" margin-left: 0px; padding-left: 0px"><li style="list-style-image: none; list-style-type:none;">None</li>';
	messages[6] += '			<li style="list-style-image: none; list-style-type:none; margin-left: 0px">None</li>';
	messages[6] += '			<li style="list-style-image: none; list-style-type:none; margin-left: 0px">1.00%</li></ul>';
	messages[6] += '		</td>';
	messages[6] += '	</tr>';
	messages[6] += '	<tr>';
	messages[6] += '		<td style="vertical-align: top">';
	messages[6] += '			Penalty Fees';
	messages[6] += '			<ul>';
	messages[6] += '				<li>Late Payment</li>';
	messages[6] += '				<li>Over the Credit Limit</li>';
	messages[6] += '				<li>Returned Payment</li>';
	messages[6] += '			</ul>';
	messages[6] += '		</td>';
	messages[6] += '		<td colspan="2" style="vertical-align: top;"><br />';
	messages[6] += '			<ul style=" margin-left: 0px; padding-left: 0px"><li style="list-style-image: none; list-style-type:none; margin-left: 0px">$10.00</li>';
	messages[6] += '			<li style="list-style-image: none; list-style-type:none; margin-left: 0px">None</li>';
	messages[6] += '			<li style="list-style-image: none; list-style-type:none; margin-left: 0px">None</li></ul>';
	messages[6] += '		</td>';
	messages[6] += '	</tr>';
	messages[6] += '	<tr>';
	messages[6] += '		<td>Other Fees</td>';
	messages[6] += '		<td colspan="2">None</td>';
	messages[6] += '	</tr>';
	messages[6] += '</table>';
	messages[6] += '<p><strong>How We Will Calculate Your Balance</strong>: We use a method called "average daily balance" (including new purchases). * An explanation of this method is provided in your account agreement.</p>';
	messages[6] += '<p><strong>Billing Rights</strong>: Information on your rights to dispute transactions and how to exercise those rights is provided in your account agreement.</p>';
    messages[6] += '</table>';
    
    // Combination of standard TPD with the Patriot Act disclaimer... Created for 201-26390
    messages[7] = '<h2 style="text-align:center">Important information about<br />opening an account</h2><p>On September 11, 2001, our lives changed forever.  In an effort to protect you and our country, the USA PATRIOT Act was signed into law.  To help the government fight the funding of terrorism and money laundering activities, Federal law requires all financial institutions to obtain, verify and record information that identifies each person who opens an account.</p><p>When you open an account, we will ask you for your name, address, date of birth and other information that will allow us to identify you. We may ask to see your driver’s license or other identifying documents.</p><p>We proudly support all efforts to protect and maintain the security of our customers and our country.</p>';
    messages[7] += '<h2 style="text-align:center">Third Party Site Disclaimer</h2><p>By accessing the noted link you will be leaving '+fiName+'\'s website and entering a website hosted by another party. '+fiName+' has not approved this as a reliable partner site. Please be advised that you will no longer be subject to, or under the protection of, the privacy and security policies of '+fiName+'\'s website. We encourage you to read and evaluate the privacy and security policies of the site you are entering, which may be different than those of '+fiName+'.</p>';
    
	var content = new Array();
	var index = 0;
	content[index++] = messages[msg];
	content[index++] = '<div style="margin-top:1em;text-align:center"><a href="'+lk+'"'+(target?' target="'+target+'"':'')+' onclick="$(\'#ex_dis\').hide()">Continue</a>&#160;&#160;<a href="#" onclick="$(\'#ex_dis\').hide();return false;">Decline</a></div></div>';	
    
    if (msg == 6) {
        $("#ex_dis").css({ width:'620px', top:'10px', left:'40px' });
    }
    
	$("#ex_dis").html(content.join("")).show();
	scrollTo(0,0);
}


$(document).ready(function() {



$('#firstOptions').hover(function(){
		if($.moreInfoTimeout)clearTimeout($.moreInfoTimeout);
		//$($.infoMenu.which+':hidden').slideDown('slow');
		//$('#moreOptions').animate({opacity:'show',height:'show'},'slow');
		$('#moreOptions').show();
	},
	function() {
		$.moreInfoTimeout = setTimeout(function(){
			//$($.infoMenu.which+':visible').slideUp('slow');
			//$('#moreOptions').animate({opacity:'hide',height:'hide'},'slow');
			$('#moreOptions').hide();
		},300);
	}
);

$('#moreOptions').hover(function(){
		if($.moreInfoTimeout)clearTimeout($.moreInfoTimeout);
		//$($.infoMenu.which+':hidden').slideDown('slow');
	},
	function() {
		$.moreInfoTimeout = setTimeout(function(){
			//$($.infoMenu.which+':visible').slideUp('slow');
			$('#moreOptions').animate({opacity:'hide',height:'hide'},'slow');
		},300);
	}
);


});






function getUrl(){
	var url = document.location.href;
	var urlstart = url.indexOf("newUrl=") + 7;
	var urlToReturn = url.substring(urlstart);
	return urlToReturn;
}
//end of file