function AlertBoxNew(url){
        if(confirm("You are about to go to an external site. Bank of Ireland does not accept any responsibility for the content or availability of any external site and you use such websites entirely at your own risk. To proceed please click OK.")){
		window.open(url);
		}
		else{
		}
}
   var agt=navigator.userAgent.toLowerCase();
    var is_major = parseInt(navigator.appVersion);
    var is_minor = parseFloat(navigator.appVersion);

    var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1) && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1) && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
    var is_nav2 = (is_nav && (is_major == 2));
    var is_nav3 = (is_nav && (is_major == 3));
    var is_nav4 = (is_nav && (is_major == 4));
    var is_nav4up = (is_nav && (is_major >= 4));
    var is_navonly = (is_nav && ((agt.indexOf(";nav") != -1) || (agt.indexOf("; nav") != -1)) );
    var is_nav6 = (is_nav && (is_major == 5));
    var is_nav6up = (is_nav && (is_major >= 5));

    var is_ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
    var is_ie3    = (is_ie && (is_major < 4));
    var is_ie4    = (is_ie && (is_major == 4) && (agt.indexOf("msie 4")!=-1) );
    var is_ie4up  = (is_ie && (is_major >= 4));
    var is_ie5    = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) );
    var is_ie5_5  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.5") !=-1));
    var is_ie5up  = (is_ie && !is_ie3 && !is_ie4);
    var is_ie5_5up =(is_ie && !is_ie3 && !is_ie4 && !is_ie5);
    var is_ie6    = (is_ie && (is_major == 4) && (agt.indexOf("msie 6.")!=-1) );
    var is_ie6up  = (is_ie && !is_ie3 && !is_ie4 && !is_ie5 && !is_ie5_5);

    var ieok = ((is_ie5)||(is_ie5_5up));
    var nsok = (is_nav4up);



//##################################           CLOSE WINDOW           ###############################

function closeWindow()
{
window.close();
}


//##################################           Break out of FRAMES           ###############################
function breakOut(url)
{
parent.location=url;
}


//##################################     CLOSE WINDOW AND REDIRECT     ##############################

function closeAndRedirect(where)
{
if (!(window.opener))
{
window.location = where;
}
else
{
window.close();
window.opener.location = where;
}
}

function popprod(wname) {
	prodwin=window.open(wname,"Item","Toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=0,width=550,height=550")
	setTimeout('prodwin.focus()',500);
}
function popprod1(wname) {
	prodwin=window.open(wname,"Item","Toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=0,width=860,height=640")
	setTimeout('prodwin.focus()',500);
}

//##################################     POPUP WINDOW                 ################################

//var newwin;
function launchwin(winurl,winname,winfeatures)
{
newwin = window.open(winurl,winname,winfeatures);

}


//#################################      DETECT SECURE CONNECTION      ###############################

function checkConnection(url, url2)
{
var url=self.location.href;
var clipUrl;
clipUrl = url.substring(0,5);
if (clipUrl=="http:")
{
window.location=url
}
else 
{
	if(!(url2=="stay"))
	{
	window.location=url2
	}
}
}

//#################### third party site warning #####################################################



//#################################      ROTATE IMAGES                ###############################

function rotateImages(imagesL,textL,linksL)
{
var images = imagesL.split(';');
var alt = textL.split(';');
var links = linksL.split(';');

var random = Math.floor(Math.random()*images.length);

ranlinktr = links[random];
ranimagetr = images[random];
rantexttr = alt[random];

document.write('<a href=\"' +ranlinktr+ '\"><img src=\"'+ranimagetr+'\" border="0" alt=\"'+rantexttr+'\" height="70" width="136"></a>');
document.write('<font face="Verdana, Arial, Helvetica, sans-serif" size="1"> ');
document.write('</font> <font face="Verdana, Arial, helvetica" size="1">');
document.write("<br>");
document.write(rantexttr);
document.write('<a href=\"' +ranlinktr+ '\"><img src="http://www.bankofireland.ie/html/gws/images/homepage/arrows.gif" width=18 height=9 border="0" alt=\"'+rantexttr+'\"></a></font>');
}

//#################################      PRINTER FRIENDLY                ###############################


function ref() {
pop.history.go(0)

}
function PrinterFriendly()
{
pop = window.open ("","pop","width=600,height=445, scrollbars=yes, menubar=yes")
pop.document.write('<head>');
pop.document.write('<style>');
pop.document.write('td {font-family: verdana; font-size: 12px;}');
pop.document.write('body {font-family: verdana; font-size: 12px;}');
pop.document.write('p {font-family: verdana; font-size: 12px;}');
pop.document.write('.header {font-family: verdana; font-size: 14px;}');
pop.document.write('h1 {font-family: verdana; font-size: 14px;}');
pop.document.write('h2 {font-family: verdana; font-size: 13px;}');
pop.document.write('h3 {font-family: verdana; font-size: 12px;}');
pop.document.write('h4,h5,h6,a {font-family: verdana; font-size: 12px;}');
pop.document.write('.right {float:right;CLEAR:BOTH;margin-right:5px;}');
pop.document.write('</style>');
pop.document.write('<Title>');
pop.document.write('LOADING Printer Friendly Version of '+document.title);
pop.document.write('</Title>');
pop.document.write('</head>');
pop.document.write('<body  topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0">');
pop.document.write('<img src=http://www.bankofireland.ie/html/gws/images/tracker.gif width=1 height=1>');
pop.document.write('<div class="right"><a href="javascript:print()">Print</a></div><BR>')
pop.document.write('<div class="header">'+document.title+'</div>');
pop.document.write('<table cellpadding=4>');
pop.document.write('<tr>');
pop.document.write('<td valign="top">');

var temp="";
var y=0;
var bt=pop.document.title;

var cft=document.getElementById('content').innerHTML;

for (var i=0; i<cft.length; i++) {
y++;
	if ((cft.charAt(i)+cft.charAt(i+1)+cft.charAt(i+2)+cft.charAt(i+3))=="href") {
	temp+=" onClick='return false' style='cursor: arrow;' ";

	}

temp+=cft.charAt(i);

}
pop.document.write(temp)
pop.document.write('</td></tr>');
pop.document.write('</table>');
pop.document.write('</body>');
pop.document.title=document.title;



}






function doChange(FrmElement){
	if (FrmElement.value == "Search BOI") {FrmElement.value=""}
	}



function SendDocument()
{

var cft=document.location.href;

pop = window.open ("","pop","width=500,height=440, scrollbars=no, menubar=no, status=yes, address=no")
pop.document.write('<head>');
pop.document.write('<style>');
pop.document.write('td {font-family:verdana; font-size: 12px;}');
pop.document.write('</style>');
pop.document.write('<Title>\n');
pop.document.write('Send Document\n');
pop.document.write('</Title>\n');

pop.document.write('</head>\n');
pop.document.write('<body bgcolor=#ffffff  topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0">\n');
pop.document.write('<img src=http://www.bankofireland.ie/html/gws/images/tracker.gif width=1 height=1>');
pop.document.write('<table bgcolor=#ffffff  width=100% border=0>\n');
pop.document.write('<tr>\n');
pop.document.write('<td valign="top">\n');
pop.document.write("<form name=f1 action=http://applications.boi.com/gws/EmailReferralJWeb>\n");
pop.document.write("<input type=\"hidden\" name=\"topic.title\" value=\""+document.title+"\">");
pop.document.write("<input type=hidden name='topic.url' value='"+cft+"'>");
pop.document.write("<input type=hidden name='topic.owner' value='Bank of Ireland'>");
pop.document.write("<input type=hidden name='topic.line.1' value='Further Information your friend included:'>");
pop.document.write("<table>\n<tr>\n<td colspan=2><font size=3><b>Send this document</b></font><hr>Please type in the contact details of the person you wish to send this document to.<hr></td>\n</tr>\n");
pop.document.write("<tr><td>Friends Name:</td><td><input type=text name='friend.1.name' size=11></td></tr>");
pop.document.write("<tr><td>Friends Email:</td><td><input type=text name='friend.1.email' size=11></td>\n</tr>");
pop.document.write("<tr><td>Your Name:</td><td><input type=text name='referrer.name' size=11></td></tr>");
pop.document.write("<tr><td>Further information you may like to include in the email: </td><td><input type=text name='topic.line.2' ></td></tr>");
pop.document.write("<tr><td></td><td><input type=hidden  value='info@boimail.com' name='referrer.email'  size=11></td>\n</tr>");
pop.document.write("<tr>\n<td colspan=2><br><br><b>Click send to email your friend the information:</b> \n\n");
pop.document.write("<tr>\n<td colspan=2><input type=submit value=Send></td>\n</tr>\n");
pop.document.write("\n</form>");
pop.document.write('\n</tr>');
pop.document.write('\n</table>');
pop.document.write('\n</body>');
setTimeout('ref()', 450);
}



function doTools() {
if (ieok) {
document.write('<a class="lhn" href="javascript:PrinterFriendly()"><img src=http://www.bankofireland.ie/html/gws/includes/general/tools/print.gif align=middle border=0>&nbsp;<font size=1 face=verdana>Printer ');
document.write('Friendly</font></a>&nbsp;<a class="lhn"  href="javascript:SendDocument()"><img src=http://www.bankofireland.ie/html/gws/includes/general/tools/mail.gif align=middle border=0>&nbsp;<font size=1 face=verdana>Email ');
document.write('this document</font></a> ');
}
}



function launchAIPWindow() {
	var aipform = window.open("http://int.sitestat.com/boigroup/boi/s?MortgagesApplyOnline&ns_type=clickout","AIPForm","menubar=no,resizable=yes,scrollbars=yes,status=yes,toolbar=yes,width=450,height=500");
}

function launchAIPWindowTUP() {
	var aipform = window.open("http://int.sitestat.com/boigroup/boi/s?TradeUpMort_apply&ns_type=clickout","AIPForm","menubar=no,resizable=yes,scrollbars=yes,status=yes,toolbar=yes,width=450,height=500");
}

function launchAIPWindow2() {
	var aipform = window.open("https://www.bankofireland.ie/html/gws/business/finance_your_business/small_bus_loan/loan_form.html","AIPForm","menubar=no,resizable=yes,scrollbars=yes,status=yes,toolbar=yes,width=745,height=560");
}

function popprod3(wname) {
	prodwin=window.open(wname,"Item","Toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=0,width=250,height=350")
	setTimeout('prodwin.focus()',500);
}
updateCookie();

function updateCookie(){

	var theUrl=document.location.href;
	if(theUrl.indexOf('personal')>=0)
		createCookie('theSwitch','1',30);
	else if(theUrl.indexOf('business')>=0)
		createCookie('theSwitch','2',30);
	
}
function createCookie(name,value,days) {
	
	if (days) {
		
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
		
	}
	else var expires = "";
	//alert(expires);
	document.cookie = name+"="+value+expires+"; path=/";
	//alert(document.cookie);
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}


//#################################      GLOBAL MARKETS SEARCH              ###############################

var TRange = null;
var dupeRange = null;
var TestRange = null;
var win = null;




var nom = navigator.appName.toLowerCase();
var agt = navigator.userAgent.toLowerCase();
var is_major   = parseInt(navigator.appVersion);
var is_minor   = parseFloat(navigator.appVersion);
var is_ie      = (agt.indexOf("msie") != -1);
var is_ie4up   = (is_ie && (is_major >= 4));
var is_not_moz = (agt.indexOf('netscape')!=-1)
var is_nav     = (nom.indexOf('netscape')!=-1);
var is_nav4    = (is_nav && (is_major == 4));
var is_mac     = (agt.indexOf("mac")!=-1);
var is_gecko   = (agt.indexOf('gecko') != -1);
var is_opera   = (agt.indexOf("opera") != -1);




var is_rev=0
if (is_gecko) {
temp = agt.split("rv:")
is_rev = parseFloat(temp[1])
}



var frametosearch = self;


function search(whichform, whichframe) {



if (is_ie4up && is_mac) return;



if (is_gecko && (is_rev <1)) return;



if (is_opera) return;



if(whichform.findthis.value!=null && whichform.findthis.value!='') {

       str = whichform.findthis.value;
       win = whichframe;
       var frameval=false;
       if(win!=self)
{

       frameval=true;  
       win = parent.frames[whichframe];

}

    
}

else return; 

var strFound;



if(is_nav4 && (is_minor < 5)) {
   
  strFound=win.find(str); 



 
        }



if (is_gecko && (is_rev >= 1)) {
   
    if(frameval!=false) win.focus(); 
    strFound=win.find(str, false, false, true, false, frameval, false);



    if (is_not_moz)  whichform.findthis.focus();




}

 if (is_ie4up) {

 

  if (TRange!=null) {
	  
   TestRange=win.document.body.createTextRange();
 
	  

   if (dupeRange.inRange(TestRange)) {

   TRange.collapse(false);
   strFound=TRange.findText(str);
    if (strFound) {
        
        win.document.body.scrollTop = win.document.body.scrollTop + TRange.offsetTop;
        TRange.select();
        }


   }
   
   else {

     TRange=win.document.body.createTextRange();
     TRange.collapse(false);
     strFound=TRange.findText(str);
     if (strFound) {
       
        win.document.body.scrollTop = TRange.offsetTop;
        TRange.select();
        }



   }
  }
  
   if (TRange==null || strFound==0) {
   TRange=win.document.body.createTextRange();
   dupeRange = TRange.duplicate();
   strFound=TRange.findText(str);
    if (strFound) {
       
        win.document.body.scrollTop = TRange.offsetTop;
        TRange.select();
        }

   
   }

 }

  if (!strFound) alert ("Sorry '"+str+"' not found!") 

        
}
