// 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();
	
	if (-1<document.location.href.indexOf('enroll'))
	{
		openEnrollPopup();
	}
});

// 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);
messages[0] = 'By accessing the noted link you will be leaving Mountain America Credit Union\'s Web site and entering a Web site 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 Mountain America Credit Union\'s Web site. MACU is not responsible for the content of the third party site and we do not represent the third party or the member if the two enter into a transaction. We encourage you to read and evaluate the privacy and security policies of the site you are entering, which may be different from those of Mountain America Credit Union\'s.';

messages[1] = 'By accessing the noted link you will be leaving Mountain America Credit Union\'s Web site and entering a Web site 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 Mountain America Credit Union\'s Web site. MACU is not responsible for the content of the third party site and we do not represent the third party or the member if the two enter into a transaction. We encourage you to read and evaluate the privacy and security policies of the site you are entering, which may be different from those of Mountain America Credit Union\'s.';


messages[2] = 'By accessing the noted link you will be leaving Mountain America Credit Union\'s website and entering a website 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 Mountain America Credit Union\'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 Mountain America Credit Union\'s.';

messages[3] = 'By accessing the noted link you will be leaving Mountain America Credit Union\'s website and entering a website 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 Mountain America Credit Union\'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 Mountain America Credit Union\'s.';


messages[4] = '<p align="center"><img src="/home/diFiles/skins/default/images/macu_insur_logo.jpg" /></p> <p>Insurance products are not deposits of Mountain America Credit Union and are not protected by the NCUA. They are not an obligation of or guaranteed by the Credit Union and may be subject to risk. Any insurance required as a condition of an extension of credit by the Credit Union need not be purchased from the Credit Union and may be purchased from an agent or insurance company of the member\'s choice. Insurance products are not exclusive to Mountain America Credit Union members. Mountain America Insurance Services, LLC is a wholly owned subsidiary of Mountain America Financial Services, which is a wholly owned subsidiary of Mountain America Credit Union. Business conducted with Mountain America Insurance Services, LLC is separate and distinct from any business conducted with the Credit Union.</p>';


messages[5] = '<p>This is <strong>NOT</strong> a secured e-mail transmission. Please <strong>do not send personal/financial information</strong> via this method.</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>';	
	$("#ex_dis").html(content.join("")).show();
	scrollTo(0,0);
}

function getUrl(){
	var url = document.location.href;
	var urlstart = url.indexOf("newUrl=") + 7;
	var urlToReturn = url.substring(urlstart);
	return urlToReturn;
}

function openWin(url,name,width,height,options){
var n = name;
var w = width;
var h = height;
var o = options;
n = (n==null)?"_blank":n;
w = (isNaN(w) || w==null)?700:w;
h = (isNaN(h) || h==null)?600:h;
o = (o==null)?"toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1":(o.indexOf(",")!=0)?","+o:o;

var posX = Math.ceil((parseInt(screen.width) - w) / 2);
var posY = Math.ceil((parseInt(screen.height) - h) / 2);
aWindow = window.open(url,n,"width=" + w + ",height=" + h + ",left=" + posX + ",top=" + posY + o);
}


function open_win(url)
{
openWin(url,"application",700,600,"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,status=1");
}

function closeEnrollPopup()
{
	$('#enrollPopup').hide();
}
function openEnrollPopup()
{
	$('#enrollPopup').show();
}
//end of file
