$(function(){
	// Uncomment and Optimize the selector below for rollover images. 
	// Should select the ID of the element containing the nav w/ rollover images.
	// HINT: You can add more image containers by separating IDs with a space, just like in CSS: $('#navBar1 #navBar2')
	
    // Add e-mail disclaimer to all mailto links
	$("a[@href^=mailto:]").click(function(){
		return displayThirdPartyAlert(5,this)
		});
});

//####### GLOBAL VARIABLES ########
var fiName = 'Warren-Boynton State Bank';
//####### GLOBAL VARIABLES ########

//useage: <a href="javascript:invest_services();">Test Link</a>
function invest_services()
{

	//page variables
	var page_bgcolor="#CBCBA9";
	var border_color="#9D8B75";
	var table_bgcolor="#FFFFFF";
	var time_visible=30000; //automatically closes after this time
	var URL="http://www.pattoninvestgroup.com";

	//content creation
	var content=""
	content+='<html>';
	content+='<head>';
	content+='<title>3rd Party Disclaimer</title>';
	content+='</head>';
	content+='<body bgcolor="' + page_bgcolor + '" onload=javascript:setTimeout(\'self.close()\','  + time_visible + ')>';
	content+='<table bgcolor="' + border_color + '" align="center" width="370" cellspacing="2" cellpadding="0" border="0">';
	content+='	<tr>';
	content+='	    <td>';
	content+='		<table bgcolor="' + table_bgcolor +'" align="center" width="100%" cellspacing="1" cellpadding="6" border="0">';
	content+='			<tr>';
	content+='	    		<td align="center" style="font-size:10pt;"><font face="Arial,Verdana,Helvetica" color="#800000"><b>You are entering...</b><br><br>William Patton Investment Services Group Website. All products and services offered exclusively through Assist Investment Management Company, Inc. Member NASD/SIPC<br><br>Products are not FDIC Insured.<br>Products offered are not deposits or other obligations of, or guaranteed by, the Warren-Boynton State Bank.<br>Products offered are subject to investment risk, including possible loan loss of principal investment.';                            
	content+='				<br><br>';
	content+='				<br><br>';
	content+='				 <div align="center"><form><input type="button" onClick="window.open(\''+URL+'\');setTimeout(\'self.close()\',1500);" value="Proceed"></form></div>';	
	content+='				</td>';
	content+='			</tr>';
	content+='		</table>';
	content+='		</td>';
	content+='	</tr>';
	content+='</table>';
	content+='</body>';
	content+='</html>';

	//actual centering popup code
	outsideURL=URL;
	var pWidth = ((parseInt(screen.width) - 340) / 2); 
	var pHeight = ((parseInt(screen.height) - 370) / 2);
     newwin = window.open("","newwin", "width=390,height=350,left="+pWidth+",top="+pHeight+", scrollbars=0");
 	newwin.document.open();
	newwin.document.write(content);
	newwin.document.close();
}

//useage: <a href="javascript:show_warning('http://www.google.com');">Test Link</a>
function show_warning(URL)
{

	//page variables
	var page_bgcolor="#CBCBA9";
	var border_color="#9D8B75";
	var table_bgcolor="#FFFFFF";
	var time_visible=30000; //automatically closes after this time

	//content creation
	var content=""
	content+='<html>';
	content+='<head>';
	content+='<title>3rd Party Disclaimer</title>';
	content+='</head>';
	content+='<body bgcolor="' + page_bgcolor + '" onload=javascript:setTimeout(\'self.close()\','  + time_visible + ')>';
	content+='<table bgcolor="' + border_color + '" align="center" width="370" cellspacing="2" cellpadding="0" border="0">';
	content+='	<tr>';
	content+='	    <td>';
	content+='		<table bgcolor="' + table_bgcolor +'" align="center" width="100%" cellspacing="1" cellpadding="6" border="0">';
	content+='			<tr>';
	content+='	    		<td align="center" style="font-size:10pt;"><br><font face="Arial,Verdana,Helvetica" color="#800000">You are leaving the Warren-Boynton State Bank Web Site.  We are not responsible for the content or privacy practices of such Web Sites.';
	content+='				<br><br>';
	content+='				<br>';
	content+='				 <div align="center"><form><input type="button" onClick="window.open(\''+URL+'\');setTimeout(\'self.close()\',1500);" value="Proceed"></form></div>';
	content+='				</td>';
	content+='			</tr>';
	content+='		</table>';
	content+='		</td>';
	content+='	</tr>';
	content+='</table>';
	content+='</body>';
	content+='</html>';

	//actual centering popup code
	outsideURL=URL;
	var pWidth = ((parseInt(screen.width) - 340) / 2); 
	var pHeight = ((parseInt(screen.height) - 370) / 2);
     newwin = window.open("","newwin", "width=390,height=210,left="+pWidth+",top="+pHeight+", scrollbars=0");
 	newwin.document.open();
	newwin.document.write(content);
	newwin.document.close();
}

/************************************************************************************************************
* 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
	messages[4] = messages[0];
	// Standard mailto: Insecure Warning
	messages[5] = '<h2 style="text-align:center">Email Disclaimer</h2><p align="center">Please do not transmit confidential information via e-mails.</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()">Proceed</a>&#160;&#160;<a href="#" onclick="$(\'#ex_dis\').hide();return false;">Cancel</a></div></div>';	
	$("#ex_dis").html(content.join("")).show();
	scrollTo(0,0);
}

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:125px; left:300px; border: thin solid #000000; padding: 15px; display: none; z-index: 3000; width:350px;\"></div>');