// Browser / Version / Platform Detect...
var browser = "default";
if (navigator.userAgent.indexOf("Opera")!=-1) { browser = "opera"; }
if (navigator.appName == "Microsoft Internet Explorer") { browser = "ie"; }
// IE version detection...
var verDetect = navigator.userAgent.toLowerCase();
function checkIt (string) { place = verDetect.indexOf(string) + 1; thestring = string; return place; }
var ieVersion = "";
if (checkIt('msie')) { ieVersion = verDetect.charAt(place + thestring.length); }
if (navigator.userAgent.indexOf('Mac') != -1) { MacOS = true } else { MacOS = false; }
if (navigator && navigator.platform && navigator.platform.match(/^(iPad)$/)) { ipad = true } else { ipad = false; }
if (navigator && navigator.platform && navigator.platform.match(/^(iPod|iPhone)$/)) { iphone = true } else { iphone = false; }
// end of Detect




function mailto(user, domain) { window.location = "mailto:" + user + "@" + domain; }




// ***** B A N N E R  C R O S S - F A D E   A N I M A T I O N ***** //

var bnrcounter = 1; // stores number ID of which Ad we're currently dealing with
var banovopac = 0; // banner overlay opacity var used in the cross-fade
// the banners' HTML...
var ad1 = "<a href=\"https://www.ipua.co.uk/join_0.htm\"><img src=\"images/banner-ad1.jpg\" alt=\"The easiest, most competitive, SME Business Insurance in the UK.\" /></a>";
var ad2 = "<a href=\"https://www.ipua.co.uk/join_0.htm\"><img src=\"images/banner-ad2.jpg\" alt=\"Imagine if with one click we could fastforward to the good parts.\" /></a>";
var ad3 = "<a href=\"https://www.ipua.co.uk/join_0.htm\"><img src=\"images/banner-ad3.jpg\" alt=\"Imagine access to all these insurers through one agency.\" /></a>";
var ad4 = "<a href=\"https://www.ipua.co.uk/join_0.htm\"><img src=\"images/banner-ad4.jpg\" alt=\"Imagine friendly, flexible underwriters empowered to make instant decisions.\" /></a>";
var ad5 = "<a href=\"https://www.ipua.co.uk/join_0.htm\"><img src=\"images/banner-ad5.jpg\" alt=\"Imagine a pain-free claims tracking process\" /></a>";
var ad6 = "<a href=\"https://www.ipua.co.uk/join_0.htm\"><img src=\"images/banner-ad6.jpg\" alt=\"No network charges. No transaction fees. Full Commission. Time saving recipe.\" /></a>";
var totalAds = 6; // IMPORTANT TO UPDATE THIS IF NUMBER OF ADS CHANGES!

function doBannerXFanim () { theswap = setTimeout ("changeTheFloor()",6000); }

function changeTheFloor () {
	// move the Ad we've just faded in into the #bannerfloor div
	document.getElementById('bannerfloor').innerHTML = this["ad" + bnrcounter];
	// set the #banneroverlay div opacity to 0 (ie. hide it)
	if (browser == "ie") {
		document.getElementById('banneroverlay').style.filter = "alpha(opacity=0)";
	} else {
		document.getElementById('banneroverlay').style.opacity = 0;
	}
	// update the opacity var
	banovopac = 0;
	// setup the next Ad...
	bnrcounter ++; // increment bnrcounter var
	if (bnrcounter > totalAds) { // if we've just faded in the final Ad...
		bnrcounter = 1;
		// replace the conents of the #banneroverlay div with the next Ad
		document.getElementById('banneroverlay').innerHTML = this["ad" + bnrcounter];
		// let the final Ad stay on screen longer than the others...
		setTimeout ("fadeBannerIn()",12000);
	} else {
		// replace the conents of the #banneroverlay div with the next Ad
		document.getElementById('banneroverlay').innerHTML = this["ad" + bnrcounter];
		fadeBannerIn();
	}
}
function fadeBannerIn() {
	if (banovopac < 100) {
		banovopac += 4;
		if (browser == "ie") {
			document.getElementById('banneroverlay').style.filter = "alpha(opacity="+banovopac+")";
		} else {
			document.getElementById('banneroverlay').style.opacity = banovopac/100;
		}
		setTimeout('fadeBannerIn()', 80);
	} else {
		doBannerXFanim();
	}
}
// ***** end of BANNER animation ***** //





// ***** L O G O  C R O S S - F A D E   A N I M A T I O N ***** //
var XFcounter = 0;
var opac = 100;
var logoXFarray = new Array();

function doLogoXFanim () { theswap = setTimeout ("fadeOut()",800); }
function fadeOut() {
	if (opac > 0) {
		opac -= 5;
		if (browser == "ie") {
			document.getElementById('XFlogos').style.filter = "alpha(opacity="+opac+")";
		} else {
			document.getElementById('XFlogos').style.opacity = opac/100;
		}
		setTimeout('fadeOut()', 20);
	} else { swapXFlogo(); }
}
function swapXFlogo () {
	XFcounter += 1;
	if (XFcounter >= logoXFarray.length) { XFcounter = 0; }
	document.getElementById('XFlogos').innerHTML = "<img src=\"images/" + logoXFarray[XFcounter] + "\" alt=\"\" />";
	fadeIn();
}
function fadeIn() {
	if (opac < 100) {
		opac += 4;
		if (browser == "ie") {
			document.getElementById('XFlogos').style.filter = "alpha(opacity="+opac+")";
		} else {
			document.getElementById('XFlogos').style.opacity = opac/100;
		}
		setTimeout('fadeIn()', 40);
	} else { doLogoXFanim(); }
}
// ***** end of LOGOS animation ***** //





function createFooter () {
	document.writeln ("<div id='footer'>");
		document.writeln ("<div id='footleft'>&copy; 2012 iprism Underwriting Agency Limited. 133 Houndsditch, London, EC3A 7BX.</div>");
		document.writeln ("<div id='footright'>");

			document.writeln ("<a href='https://www.ipua.co.uk/join_0.htm'>Join iprism</a>|");
			document.writeln ("<a href='contact.htm'>Contact</a>|");
			document.writeln ("<a href='privacy.htm'>Privacy Policy</a>|");
			document.writeln ("<a href='terms.htm'>Terms &amp; Conditions</a>|");
			document.writeln ("<a href='sitemap.htm'>Site Map</a>");

		document.writeln ("</div>");
	document.writeln ("</div>");
	
	if (iphone) { document.getElementById('footer').style.fontSize = '0.4em'; }
}


