
//---------------------------------------------------------------------------------------------
//
// Open eQuotes / CashBack in new window
//
//---------------------------------------------------------------------------------------------
 
function openAppWindow (page){
	var page;
	window.open(page,'','resizable=no,scrollbars=yes,status=yes,width=800,height=600');
}




//---------------------------------------------------------------------------------------------
//
// Open new popup windows for help etc.
//
//---------------------------------------------------------------------------------------------

function openInfoWindow(url,winName,width,height){ // No scroll bars
	var new_window = window.open(url, winName,'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=' + width + ',height=' + height);							
return false;
}

function openInfoWindowScroll(url,winName,width,height){ // With scroll bars
	var new_window = window.open(url,winName,'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=0,width=' + width + ',height=' + height);							
}


//---------------------------------------------------------------------------------------------
//
// Flash detect functions
//
//---------------------------------------------------------------------------------------------

// These are the user defined globals.

var requiredVersion = 5;   // Version the user needs to view site (max 6, min 2)
var useRedirect = false;   // Set to false to embed the ovie or alternate html directly into this page.

// *************
// Everything below this point is internal until after the BODY tag.
// Do not modify!
// *************

// System globals
var flash2Installed = false;    
var flash3Installed = false;    
var flash4Installed = false;    
var flash5Installed = false;    
var flash6Installed = false;    
var maxVersion = 6;             
var actualVersion = 0;          
var hasRightVersion = false;    // boolean. true if it's safe to embed the flash movie in the page
var jsVersion = 1.0;            



// Check the browser...we're looking for ie/win
var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;    // true if we're on ie
var isWin = (navigator.appVersion.indexOf("Windows") != -1) ? true : false; // true if we're on windows

// This is a js1.1 code block, so make note that js1.1 is supported.
jsVersion = 1.1;

// Write vbscript detection on ie win. IE on Windows doesn't support regular
// JavaScript plugins array detection.
if(isIE && isWin){
  document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
  document.write('on error resume next \n');
  document.write('flash2Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.2"))) \n');
  document.write('flash3Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3"))) \n');
  document.write('flash4Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4"))) \n');
  document.write('flash5Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) \n');  
  document.write('flash6Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6"))) \n');  
  document.write('</SCR' + 'IPT\> \n'); // break up end tag so it doesn't end our script
}


// standard javascript detection that uses the 
// navigator.plugins array. Detector into a function so it loads
// before we run it.

function detectFlash() {  
  // If navigator.plugins exists...
  if (navigator.plugins) {
    // ...then check for flash 2 or flash 3+.
    if (navigator.plugins["Shockwave Flash 2.0"]
        || navigator.plugins["Shockwave Flash"]) {

      // Some version of Flash was found. Time to figure out which.
      
      // Set convenient references to flash 2 and the plugin description.
      var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
      var flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description;
      
      // A flash plugin-description looks like this: Shockwave Flash 4.0 r5
      // can get the major version by grabbing the character before the period
      var flashVersion = parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1));
     
      // found the version, now set appropriate version flags. Make sure
      // to use >= on the highest version so we don't prevent future version
      // users from entering the site.
      flash2Installed = flashVersion == 2;    
      flash3Installed = flashVersion == 3;
      flash4Installed = flashVersion == 4;
      flash5Installed = flashVersion == 5;
      flash6Installed = flashVersion >= 6;
    }
  }
	for (var i = 2; i <= maxVersion; i++) { 
		var iVersion = eval("flash" + i + "Installed")
		if (iVersion == true) {
			actualVersion = i;		
		}
	}


  if(navigator.userAgent.indexOf("WebTV") != -1) actualVersion = 3;  
		if (actualVersion >= requiredVersion) {
		hasRightVersion = true;
		}
  }
     
detectFlash();  // call our detector now that it's safely loaded.  

//
function popup(url,width,height) {
window.open(url,'Popupwin','left=30,top=30,width=' + width + ',height=' + height + ',menubar=no,toolbar=no,location=no,directories=no,scrollbars=no,status=no,resizable=no');
}

//
function writeBanner(swf,gif,w,h,link){
	<!--
	if (!useRedirect) {    
		if(hasRightVersion) {
			var re = new RegExp ('&', 'gi') ;
			var link = link.replace(re, '%26') ;
			var oeTags = '<a href="' + link + '" border="0" >'
			+ '<OBJECT CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'
			+ 'WIDTH="' + w + '" HEIGHT="' + h + '"'
			+ 'CODEBASE="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab">'
			+ '<PARAM NAME="MOVIE" VALUE="' + swf + '?clickTag=' + link + '&clickWin=_top">'
			+ '<PARAM NAME="PLAY" VALUE="true">'
			+ '<PARAM NAME="LOOP" VALUE="false">'
			+ '<PARAM NAME="QUALITY" VALUE="high">'
			+ '<PARAM NAME="MENU" VALUE="false">'
			+ '<EMBED SRC="' + swf + '?clickTag=' + link + '&clickWin=_top"'
			+ 'WIDTH="' + w + '" HEIGHT="' + h + '"'
			+ 'PLAY="true"'
			+ 'LOOP="false"'
			+ 'QUALITY="high"'
			+ 'MENU="false"'
			+ 'TYPE="application/x-shockwave-flash"'
			+ 'PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">'
			+ '</EMBED>'
			+ '</OBJECT></a>';
			document.write(oeTags);  
		} else {  
			// flash is too old or can't detect the plugin
			var alternateContent = '<a href="' + link + '" title="" border="0"><img border="0" src="' + gif + '" width="' + w + '" height="' + h + '"></a>';
			document.write(alternateContent); 
		}
	}
	// -->
}


function writeGlossary(swf,gif,w,h){
	<!--
	if (!useRedirect) {    
		if(hasRightVersion) {  
			var oeTags = '<OBJECT CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'
			+ 'WIDTH="' + w + '" HEIGHT="' + h + '"'
			+ 'CODEBASE="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab">'
			+ '<PARAM NAME="MOVIE" VALUE="' + swf + '">'
			+ '<PARAM NAME="PLAY" VALUE="true">'
			+ '<PARAM NAME="LOOP" VALUE="false">'
			+ '<PARAM NAME="QUALITY" VALUE="high">'
			+ '<PARAM NAME="MENU" VALUE="false">'
			+ '<EMBED SRC="' + swf + '"'
			+ 'WIDTH="' + w + '" HEIGHT="' + h + '"'
			+ 'PLAY="true"'
			+ 'LOOP="false"'
			+ 'QUALITY="high"'
			+ 'MENU="false"'
			+ 'TYPE="application/x-shockwave-flash"'
			+ 'PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">'
			+ '</EMBED>'
			+ '</OBJECT>';
			document.write(oeTags);  
		} else {  
			// flash is too old or can't detect the plugin
			var alternateContent = '<a href="/maia?h=home_head&amp;f=home_footer&amp;p=consumer/faq_callback&amp;u=home_utility&amp;n=shared/help_glossary&amp;t=glossary_top&amp;b=shared/help/glossary/glossary" title="Glossary section" border="0"><img src="'+gif+'" width="'+w+'" height="'+h+'"></a>';
			document.write(alternateContent); 
		}
	}
	// -->
}

// Tall banner
function banner138x276(swf,gif,link){
	writeBanner("/promo/img/" + swf,"/promo/img/" + gif,138,276,link);
}
// Medium banner
function banner138x192(swf,gif,link){
	writeBanner("/promo/img/" + swf,"/promo/img/" + gif,138,192,link);
}
// Medium banner
function banner138x180(swf,gif,link){
	writeBanner("/promo/img/" + swf,"/promo/img/" + gif,138,180,link);
}
// Short banner
function banner138x90(swf,gif,link){
	writeBanner("/promo/img/" + swf,"/promo/img/" + gif,138,90,link);
}


//
function travelBanner(){
	writeBanner("/promo/img/banner_rowing_small.swf","/promo/img/ban_cashback_138x90.gif",138,109);
}

// Glossary box
function glossary(swf,gif){
	writeGlossary("/promo/img/" + swf,"/promo/img/" + gif,138,320);
}

// DrHilary
function drHilaryLink(area) {
	var newWindow = window.open('http://reporting.axappphealthcare.co.uk/cgi-bin/rr.cgi/http://www.axappphealthcarecampaign.co.uk/popup_webchat.asp&nourl=www.axappphealthcare.co.uk/links/' + area + '/drhilary_medium','webchatPopup', 'WIDTH=538,HEIGHT=564,TOP=10,LEFT=10,resizable');
	newWindow.focus();
}

// EHC calc tool
function banner450x150(swf,gif,link){
	writeBanner("/promo/img/" + swf,"/promo/img/" + gif,450,150,link);
}


//---------------------------------------------------------------------------------------------
//
// Text size changer functions
//
//---------------------------------------------------------------------------------------------
 
// dw_cookies.js - cookie functions for www.dyn-web.com
// Recycled from various sources

// Modified from Bill Dortch's Cookie Functions (hidaho.com) 
// (found in JavaScript Bible)
function setTcCookie(name,value,days,path,domain,secure) {
  var expires, date;
  if (typeof days == "number") {
    date = new Date();
    date.setTime( date.getTime() + (days*24*60*60*1000) );
		expires = date.toGMTString();
  }
  document.cookie = name + "=" + escape(value) +
    ((expires) ? "; expires=" + expires : "") +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    ((secure) ? "; secure" : "");
	//alert('set cookie name=' +name);
}

// Modified from Jesse Chisholm or Scott Andrew Lepera ?
// (found at both www.dansteinman.com/dynapi/ and www.scottandrew.com/junkyard/js/)

function getTcCookie(name) {
	//alert('cookie name= ' +name);
  var nameq = name + "=";
  var c_ar = document.cookie.split(';');
  for (var i=0; i<c_ar.length; i++) {
    var c = c_ar[i];
	//alert('cookie value=' +c);
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameq) == 0) return unescape( c.substring(nameq.length, c.length) );
		
  }
	//alert('can\'t find cookie');
  return null;
	
}

// from Bill Dortch's Cookie Functions (hidaho.com) 
function deleteTcCookie(name,path,domain) {
  if (getTcCookie(name)) {
    document.cookie = name + "=" +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}

// dw_sizerdx.js version date: Jan 2004
// requires dw_cookies.js

/*************************************************************************
  This code is from Dynamic Web Coding at http://www.dyn-web.com/
  Copyright 2004 by Sharon Paine 
  See Terms of Use at http://www.dyn-web.com/bus/terms.html
  regarding conditions under which you may use this code.
  This notice must be retained in the code as is!
*************************************************************************/

function setPageDefaults () {

	// Set default values of 'dw_fontSizerDX' object
	dw_fontSizerDX.sizeUnit = "em";
	dw_fontSizerDX.defaultSize = .7;
	dw_fontSizerDX.maxSize = 1.1;
	dw_fontSizerDX.minSize = .6;

	// set elements to be controlled 
	// Arguments: (selector text, default size, minimum, maximum)
	
	dw_fontSizerDX.set('.bodyText', .7, .7, 1.1);
	dw_fontSizerDX.set('.tableText', .7, .7, .9);
	dw_fontSizerDX.set('.tableSpacer', .7, .7, .9);
	dw_fontSizerDX.set('.bodyTextSmall', .6, .6, .8);
	dw_fontSizerDX.set('.bodyTextNoSubHeader', .7, .7, 1.1);
	dw_fontSizerDX.set('.dataProtectionPadlockText', .6, .6, .8);
	dw_fontSizerDX.set('.offerTextNoBorder', .7, .7, 1.1);
	dw_fontSizerDX.set('h3.normalHeaders', .7, .7, 1.1);
	dw_fontSizerDX.set('h4.numberedHeaders', .7, .7, 1.1);
	dw_fontSizerDX.set('h5.numberedHeaders', .7, .7, 1.1);
	dw_fontSizerDX.set('h3.subHeader', .75, .75, 1.15);
	dw_fontSizerDX.set('div#footer', .65, .65, .85);
	dw_fontSizerDX.set('div#largeNavText', .7, .7, .9);
	dw_fontSizerDX.set('a.leftNavLink', .7, .7, .9);
	dw_fontSizerDX.set('a.leftNavLinkOn', .7, .7, .9);
	dw_fontSizerDX.set('a.leftNavSubLink', .7, .7, .9);
	dw_fontSizerDX.set('a.leftNavSubLinkOn', .7, .7, .9);
	dw_fontSizerDX.set('a.leftNavSubLinkBlue', .7, .7, .9);
	dw_fontSizerDX.set('a.leftNavSubLinkBlueOn', .7, .7, .9);
	dw_fontSizerDX.set('a.leftNavSub2Link', .7, .7, .9);
	dw_fontSizerDX.set('a.leftNavSub2LinkOn', .7, .7, .9);
	dw_fontSizerDX.set('a.navTextWithTop', .7, .7, .9);
	dw_fontSizerDX.set('div#keywordSearchForm', .7, .7, .9);
	dw_fontSizerDX.set('a.keywordSearch', .7, .7, .9);
	dw_fontSizerDX.set('a.utilityBlueLinks', .7, .7, 1.1);
	dw_fontSizerDX.set('a.utilityBlueLinksTop', 1, 1, 1.1);
	dw_fontSizerDX.set('h6.yourQuestionsHeader', .7, .7, .9);
	dw_fontSizerDX.set('div.generalFormField', 1, 1, 1.1);
	dw_fontSizerDX.set('.clickOn', .7, .7, 1.1);
	dw_fontSizerDX.set('div.contentDescriptionRight', .7, .7, 1.1);
	dw_fontSizerDX.set('.letters', .8, .8, 1.1);
	dw_fontSizerDX.set('a.letters', .95, .95, 1.25);
	
	dw_fontSizerDX.set('.paginationTop', .65, .65 , .75);
	dw_fontSizerDX.set('.paginationBottom', .65, .65, .75);
	dw_fontSizerDX.set('.nextPageLinkBox', .65, .65, .75);

	// Homepage specific
	dw_fontSizerDX.set('.descriptionText', .75, .75, 1.15);
	dw_fontSizerDX.set('.bracketText', .7, .7, .9);
	dw_fontSizerDX.set('.searchBlockText', .7, .7, .8);
	dw_fontSizerDX.set('.hcIntro', .7, .7, 1.1);
	dw_fontSizerDX.set('.hcLink', .75, .75, 1.15);
	
	// Health hub specific	
	dw_fontSizerDX.set('.hubIntro', .7, .7, 1.1);
	dw_fontSizerDX.set('.contentDescription', .7, .7, .9);
	dw_fontSizerDX.set('.IframeText', .7, .7, .9);

	// Microsites
	dw_fontSizerDX.set('h6.yourQuestionsHeader', .7, .7, .9);
	dw_fontSizerDX.set('h4.yourQuestions', .7, .7, .9);
	
	// call init() function
	dw_fontSizerDX.init();
}

// dw_fontSizerDX javascript object
	var dw_fontSizerDX = {

	  // object local variables
	  sizeUnit:    "px",
	  defaultSize: 11,
	  maxSize:     14,
	  minSize:     10,

	  // array
	  adjustList: [],

	  // set array values function
		set: function (sel,dflt,mn,mx) {
		this.adjustList[this.adjustList.length] = arguments;
		},

  // init function 
  init: function() {
	// local variables
    var size, sizerEl, i;
	// simple browser compatibility detection - stop (return) if false
    if ( !document.getElementById || !document.getElementsByTagName ) return;
	// try and get cookie
    size = getTcCookie("fontSize");
	// if size is a number, turn into a float eg. 1.0 else use default size
    size = !isNaN( parseFloat(size) )? parseFloat(size): this.defaultSize;
    // check size is in max - min range. if not, then use default size
    if ( size > this.maxSize || size < this.minSize ) size = this.defaultSize;
	// curSize variable set to default value
    this.curSize = this.defaultSize;
	// these two are a bit of a mystery
    sizerEl = document.getElementById('sizer');
    if (sizerEl) sizerEl.style.display = "block";
    // hold ratio of this element's default size to this.defaultSize for calcs in adjust fn 
    for (i=0; this.adjustList[i]; i++) 
      this.adjustList[i][4] = this.adjustList[i][1] / this.defaultSize;
    if ( size != this.defaultSize ) this.adjust( size - this.defaultSize );
  },

  adjust: function(n) {
    var alist, size, list, i, j;
    // check against max/minSize
    if ( n > 0 && dw_fontSizerDX.maxSize ) {
      if ( dw_fontSizerDX.curSize + n > dw_fontSizerDX.maxSize )
          n = dw_fontSizerDX.maxSize - dw_fontSizerDX.curSize;
    } else if ( n < 0 && dw_fontSizerDX.minSize ) {
        if ( dw_fontSizerDX.curSize + n < dw_fontSizerDX.minSize )
          n = dw_fontSizerDX.minSize - dw_fontSizerDX.curSize;
    }
    if ( n == 0 ) return false;
    dw_fontSizerDX.curSize += n;
    // loop through adjustList, calculating size, checking max/min
    alist = dw_fontSizerDX.adjustList;
    for (i=0; alist[i]; i++) {
      size = dw_fontSizerDX.curSize * alist[i][4]; // maintain proportion 
      size = Math.max(alist[i][2], size); size = Math.min(alist[i][3], size);
      list = dw_getElementsBySelector( alist[i][0] );
      for (j=0; list[j]; j++) { list[j].style.fontSize = size + dw_fontSizerDX.sizeUnit; }
    }
    setTcCookie( "fontSize", dw_fontSizerDX.curSize, 180, "/" );
  },

  // Reset adjustList elements to their default sizes
  reset: function() {
    var alist = dw_fontSizerDX.adjustList, list, i, j;
    for (i=0; alist[i]; i++) {
      list = dw_getElementsBySelector( alist[i][0] );
      for (j=0; list[j]; j++) { list[j].style.fontSize = alist[i][1] + dw_fontSizerDX.sizeUnit; }
    }
    dw_fontSizerDX.curSize = dw_fontSizerDX.defaultSize;
    deleteTcCookie("fontSize", "/");
  }
}
// end of object


// resource: simon.incutio.com/archive/2003/03/25/getElementsBySelector
function dw_getElementsBySelector(selector) {
 	var nodeList = [document], tokens, bits, list, els, i, j, k;
  if (!document.getElementsByTagName) return [];
  tokens = selector.split(' ');
  for (i=0; tokens[i]; i++) {
    if ( tokens[i].indexOf('#') != -1 ) {  // id
      bits = tokens[i].split('#'); 
      nodeList = [ document.getElementById( bits[1] ) ];
      continue; 
    } else if ( tokens[i].indexOf('.') != -1 ) {  // class
      bits = tokens[i].split('.');
      for (j=0; nodeList[j]; j++) 
        list = dw_getElementsByClassName( bits[1], bits[0], nodeList[j]);
      nodeList = [];
      for (j=0; list[j]; j++) { nodeList.push(list[j]); }
      continue; 
    } else {  // element 
      els = []; 
      for (j = 0; nodeList[j]; j++) {
        list = nodeList[j].getElementsByTagName(tokens[i]);
        for (k = 0; list[k]; k++) { els.push(list[k]); }
      }
      nodeList = els;
    }
  }
  return nodeList;
}

function dw_getElementsByClassName(sClass, sTag, oCont) {
  var result = [], list, i;
  oCont = oCont? oCont: document;
  if ( document.getElementsByTagName ) {
    if ( !sTag || sTag == "*" ) {
      list = oCont.all? oCont.all: oCont.getElementsByTagName("*");
    } else list = oCont.getElementsByTagName(sTag);
    
    for (i=0; list[i]; i++) 
      if ( list[i].className.match( new RegExp("\\b" + sClass + "\\b", "i") ) ) result.push( list[i] );
  }
  return result;
}

if (!Array.prototype.push) {  // for ie5.0
	Array.prototype.push =  function() {
		for (var i=0; arguments[i]; i++) this[this.length] = arguments[i];
		return this.length;
	}
}  


//---------------------------------------------------------------------------------------------
//
// Function for displaying 'Please wait' on home and health info hub pages while iframe
// is retrieving web news feed content
//
//---------------------------------------------------------------------------------------------
 

function holdOn() {	
	document.getElementById('wait').style.display = 'none';
	document.getElementById('iframe').style.display = 'block';
}