// for Cool Menus
if(window.event + "" == "undefined") event = null;
function showMenu(){return false};
function mout(){return false};
function dummyObject() {this.mout=mout};
oM = new dummyObject();

//window.onerror = function(){ return true; }

function target_blank(url){
    tmp = window.open(url);
    tmp = null;
}

function makeNavImage(name,width,height){
this.name_on="nav-" + name +"-on.gif";
this.name_off="nav-" + name +"-off.gif";
this.width=width;
this.height=height;
this.newimage_on = new Image(width,height);
this.newimage_on.src = dir + '/images/' + this.name_on;
this.newimage_off = new Image(width,height);
this.newimage_off.src = dir + '/images/' + this.name_off;
}

function img_act(imgName){
document[imgName].src =  navitems[imgName].newimage_on.src;
}

function img_inact(imgName){
window.status = "";
document[imgName].src =  navitems[imgName].newimage_off.src;
}


document.write('<img src="'+dir+'/images/wcscreenrez.gif?width='+screen.width+'&height='+screen.height+'" width="1" height="1">'); 

function wcInternalPopup(url, height, width){
    var wide=width;
    var tall=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 wide=width;
    var tall=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;
    window.open(url,'externalpopup',features);
}

function open_apps(nameofapp)
{
var pWidth = ( ((parseInt(screen.width) / 2)) - 350)
var pHeight = (((parseInt(screen.height) / 2)) - 300)
aWindow = window.open('https://www.usfed.org/Forms/OnlineForm.cgi?form=' + nameofapp,'application',"toolbar=0,location=0,directories=0,status=0,menubar=0,width=700,height=600,top=" + pHeight + ",left=" + pWidth + ",scrollbars=1,resizable=1,status=1");
}

function openPDF(page)
{
bWindow = window.open('fiFiles/static/documents/'+page,'newWin');
	bWindow = null;
	return;
}

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;
	return;
}

/************************************************************************************************************
* 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:('http://wwww.mysite.com');">My Site</a>
**************************************************************************************************************/

function showWarning(lk, desc, target, msg){
	desc = (desc) ? desc : "Third Party Site";
	target = (target) ? target : "_top";
	msg = (msg) ? msg : 0;
	
	var messages = new Array(6);
	messages[0] = '<div align="center"><img src="'+dir+'/images/logo_fresnocfcu.gif" width="190" height="104" alt="" border="0"/></div><h1>Third Party Site Disclaimer</h1><br/>You are leaving Fresno County Federal Credit Union’s website.  FCFCU provides links from this web site to other non-FCFCU operated websites for your information and convenience.  These links are not operated by nor owned or controlled by FCFCU.  FCFCU is not responsible for the content on these alternative websites.<br/><br/>FCFCU does not represent either the third party or the member if the two enter into a transaction.  Privacy and security policies on the third party site may differ from those practiced by Fresno County Federal Credit Union.<br/><br/>FCFCU suggests that you engage in an appropriate investigation for any products and services prior to purchase.   Questions as to the content, availability or maintenance of these websites should be directed to the site owners.';
	
	messages[1] = '<div align="center"><img src="'+dir+'/images/logo_fresnocfcu.gif" width="190" height="104" alt="" border="0"/></div><h1>Third Party Site Disclaimer</h1><br/>You are leaving Fresno County Federal Credit Union’s website.  FCFCU provides links from this web site to other non-FCFCU operated websites for your information and convenience.  These links are not operated by nor owned or controlled by FCFCU.  FCFCU is not responsible for the content on these alternative websites.<br/><br/>FCFCU does not represent either the third party or the member if the two enter into a transaction.  Privacy and security policies on the third party site may differ from those practiced by Fresno County Federal Credit Union.<br/><br/>FCFCU suggests that you engage in an appropriate investigation for any products and services prior to purchase.   Questions as to the content, availability or maintenance of these websites should be directed to the site owners.';
	
	messages[2] = '<div align="center"><img src="'+dir+'/images/logo_fresnocfcu.gif" width="190" height="104" alt="" border="0"/></div><h1>Third Party Site Disclaimer</h1><br/>You are leaving Fresno County Federal Credit Union’s website.  FCFCU provides links from this web site to other non-FCFCU operated websites for your information and convenience.  These links are not operated by nor owned or controlled by FCFCU.  FCFCU is not responsible for the content on these alternative websites.<br/><br/>FCFCU does not represent either the third party or the member if the two enter into a transaction.  Privacy and security policies on the third party site may differ from those practiced by Fresno County Federal Credit Union.<br/><br/>FCFCU suggests that you engage in an appropriate investigation for any products and services prior to purchase.   Questions as to the content, availability or maintenance of these websites should be directed to the site owners.';
	
	messages[3] = '<div align="center"><img src="'+dir+'/images/logo_fresnocfcu.gif" width="190" height="104" alt="" border="0"/></div><h1>Third Party Site Disclaimer</h1><br/>You are leaving Fresno County Federal Credit Union’s website.  FCFCU provides links from this web site to other non-FCFCU operated websites for your information and convenience.  These links are not operated by nor owned or controlled by FCFCU.  FCFCU is not responsible for the content on these alternative websites.<br/><br/>FCFCU does not represent either the third party or the member if the two enter into a transaction.  Privacy and security policies on the third party site may differ from those practiced by Fresno County Federal Credit Union.<br/><br/>FCFCU suggests that you engage in an appropriate investigation for any products and services prior to purchase.   Questions as to the content, availability or maintenance of these websites should be directed to the site owners.';
	
	messages[4] = '<div align="center"><img src="'+dir+'/images/logo_fresnocfcu.gif" width="190" height="104" alt="" border="0"/></div><h1>Third Party Site Disclaimer</h1><br/>You are leaving Fresno County Federal Credit Union’s website.  FCFCU provides links from this web site to other non-FCFCU operated websites for your information and convenience.  These links are not operated by nor owned or controlled by FCFCU.  FCFCU is not responsible for the content on these alternative websites.<br/><br/>FCFCU does not represent either the third party or the member if the two enter into a transaction.  Privacy and security policies on the third party site may differ from those practiced by Fresno County Federal Credit Union.<br/><br/>FCFCU suggests that you engage in an appropriate investigation for any products and services prior to purchase.   Questions as to the content, availability or maintenance of these websites should be directed to the site owners.';
	
	messages[5] = '<div align="center"><h3 align="center">Please Note</h3>This is <strong>NOT</strong> secure e-mail, do not send personal/financial information.</div> ';

	var content = new Array();
	var index = 0;
	content[index++] = messages[msg];
	content[index++] = '<br /><br /><br />';
	content[index++] = '<div align="center"><a href="'+lk+'" target="'+target+'" onclick="document.getElementById(\'ex_dis\').style.display = \'none\'">Continue</a>&#160;&#160;<a href="javascript:void(\'0\');" onclick="document.getElementById(\'ex_dis\').style.display = \'none\'">Decline</a></div></div>';	
	document.getElementById("ex_dis").innerHTML = content.join("");
	document.getElementById("ex_dis").style.display = "block";
	scrollTo(0,0);
}

/*
function showWarning(URL)
{
	document.location.href = "?pageLabel=thirdparty&amp;newUrl="+URL;
}	
*/
function getUrl(){
	var url = document.location.href;
	var urlstart = url.indexOf("newUrl=") + 7;
	var urlToReturn = url.substring(urlstart);
	return urlToReturn;
}


function checkSize()
{
    var myWidth = 0;
	if( typeof( window.innerWidth ) == 'number' )
	{
		//Non-IE
		myWidth = window.innerWidth;
	}
	else if( document.documentElement && ( document.documentElement.clientWidth ) )
	{
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
	}
	else if( document.body && ( document.body.clientWidth ) )
	{
		//IE 4 compatible
		myWidth = document.body.clientWidth;
	}
    return myWidth;
}

document.write('<div id="ex_dis" style="background-color: #ffffff; font-family: Arial, Helvetica, sans-serif; font-size: 8pt; font-weight: normal; color: #000000; text-align: left; position:absolute; top:60px; left:' + (parseInt(checkSize()/2)-175) + 'px; border: thin solid #1A448E; padding: 15px; display: none; z-index: 100000; width:350px;"></div>');
// OTHER FUNCTIONS ABOVE

function header_img_swap(img)
{
	var imageArray = new Array( "pic_masthead_1.jpg",
                                "pic_masthead_2.jpg",
                                "pic_masthead_3.jpg",
                                "pic_masthead_4.jpg",
                                "pic_masthead_5.jpg",
                                "pic_masthead_6.jpg");

	var imgdir = "/home/diFiles/skins/default/images/";

    var numImages = 6;

	var iteratorNum = ( rand(numImages) - 1); //-1 to take into account that array starts at 0

	document.getElementById(img).style.backgroundImage = "url(" + imgdir + imageArray[iteratorNum] + ")";
}

function rand(number) {
		return Math.ceil((Math.random()* number));       
};



/* Rates page tag replacement function.*/
function doReplacement(str, link)
{
    var result = str;
    
    var tempLink = link;
    
    if (tempLink == '' || tempLink == ' ')
        tempLink = '#';

// Begin List of Tag Replacements

    while (result.indexOf('_BR_') > -1 || result.indexOf('_br_') > -1)
        result = result.replace(/_BR_/i, '<br/>');    // <br/>

    while (result.indexOf('_SUP_') > -1 || result.indexOf('_sup_') > -1)
        result = result.replace(/_SUP_/i, '<sup>');      // <sup>
    while (result.indexOf('_!SUP_') > -1 || result.indexOf('_!sup_') > -1)
        result = result.replace(/_!SUP_/i, '</sup>');    // </sup>

    while (result.indexOf('_A_') > -1 || result.indexOf('_a_') > -1)
        result = result.replace(/_A_/i, '<a href="' + tempLink + '">');     // <a href="link">
    while (result.indexOf('_!A_') > -1 || result.indexOf('_!a_') > -1)
        result = result.replace(/_!A_/i, '</a>');                                            // </a>

// End List of Tag Replacements

    return result;
}


function navContactIFrame(){
    if(!document.getElementById)return;
    url = document.location.href;
    formName = url.match(/type=([^#&]+)/);
    if(!formName || !formName[1]){
        fName = 'email';
    }
    else
        fName = formName[1];
    
    objFrame = document.getElementById("formFrame");
    objFrame.src = "https://www.fresnocfcu.org/Forms/OnlineForm.cgi?form=contact&type="+fName;
}

function navBuyForm(){
    if(!document.getElementById)return;
    url = document.location.href;
    
    var str = document.location.href
    var index = str.indexOf("app_buy");
    if (index > -1)
    {
        str = str.substring(index+8, str.length);
        objFrame = document.getElementById("formFrame");
        objFrame.src = "https://www.fresnocfcu.org/Forms/OnlineForm.cgi?form=BUY_Form_WC&"+str;
    }
}

function navBidForm(){
    if (!document.getElementById) return;
    url = window.location.href;
    
    var str = document.location.href
    var index = str.indexOf("app_bid");
    if (index > -1)
    {
        str = str.substring(index+8, str.length)
        objFrame = document.getElementById("formFrame");
        objFrame.src = "https://www.fresnocfcu.org/Forms/OnlineForm.cgi?form=BID_Form_WC&"+str;
        contentWindow.document.location.replace(str);
    }
}
