$(document).ready(function(){	backgroundRandomiser();	setupLinkTypes();	floatImageWidths();	faqDropList();	captchaWidget();	textSizeChanger();	setupFooterButtons();	topNavHoverFix();	newTableImageSwap();	$('div.editorImageLeftCaption img').load(function(){floatImageWidths()})	$('div.editorImageRightCaption img').load(function(){floatImageWidths()})	setupTables();	$(".tabs").tabs();	$(".tabs ul li:last").addClass('last');	superscriptAnchors();	$("span.badgeTen").wrapInner("<span id='logoFlash'></span>");	FlashReplace.replace("logoFlash", "/html/video/10YLogo.swf", "logoFlash", "140", "140", 9, {quality : "high",	play : "true",	loop : "true",	menu : "true",autoplay : "true",autoload : "true",wmode : "opaque",allowFullScreen : "false",allowScriptAccess : "sameDomain"});		});$(window).resize(function(){                $('div#overlay').height($('html').height());                $('div#overlay').width($('html').width());});function backgroundRandomiser(){	var randomnumber=Math.floor(Math.random()*3)	$('body').addClass('bg'+randomnumber)};function newTableImageSwap(){	$('div.imageSwap a').click(function(){		var tempActiveImageVar = $('div.imageSwap img.'+$(this).attr('class'));		tempActiveImageVar.siblings('img').hide()		tempActiveImageVar.show();		$(this).siblings('a').removeClass('active');		$(this).addClass('active')		return false;	});}function superscriptAnchors(){	$('sup:not(.exclude)').wrapInner("<a href='#references'></a>");}function setupTables(){	$('table.foldUp tr:not(.heading,.showHide)').hide().children('td').css({"padding":"0px","overflow":"hidden"}).find('div.wrap').css({"padding":"4px 7px 8px"}).hide();	$('table.foldUp tr.heading td').click(function(){showHideNext($(this).parents('tr.heading'))});	$('tr.showHide td a').click(function(){showHideAll($(this)); return false});	$('table.foldUp tr.heading td').hover(function(){$(this).children('span').css({"margin-right":"10px","text-decoration":"underline"})},function(){$(this).children('span').css({"margin-right":"0px","text-decoration":"none"})})	if($('div.foldUpWrap').length >= 1){		$(window).scroll(function(){			var tableTop = $("div.foldUpWrap").offset();			var windowTop = $(window).scrollTop();			var tableBottom = $("div.foldUpWrap").height() + tableTop.top;			if(windowTop >= tableTop.top && !(windowTop >= (tableBottom - 50))){				$("div.specialHeader").stop().animate({"top": windowTop - tableTop.top}, "fast");			}else{				$("div.specialHeader").stop().animate({"top": "0px"}, "fast");			};		});	}}function showHideAll(e){	var wholeTable = e.parents('table')	if(e.is('.showAll')){		e.parents('table').find('tr:not(.heading,.showHide)').show().children('td').find('div.wrap').slideDown('fast');		e.parents('table').find('tr.heading').addClass('open').find('span.show').html('Hide');		e.removeClass('showAll').addClass('hideAll').html('Hide All');		return false;	}else{		e.parents('table').find('tr:not(.heading,.showHide)').children('td').find('div.wrap').slideUp('fast', function(){$(this).parents('tr').hide()});		e.parents('table').find('tr.heading').addClass('open').find('span.show').html('Show');		$('tr.heading').removeClass('open');		e.removeClass('hideAll').addClass('showAll').html('Show All');		return false;	}	return false;}function showHideNext(e){	if(e.is('.open')){		e.removeClass('open');		if(e.parents('table').find('tr.open').length == 0){			e.parents('table').find('a.hideAll').removeClass('hideAll').addClass('showAll').html('Show All');		}		e.find('span.show').html('Show');		e.nextAll('tr').each(function() {			if ($(this).is('.heading')) {				return false; // next heading reached, stop			};			if($(this).is('.showHide')) {				return false; // next heading reached, stop			};			$(this).find('div.wrap').slideUp('fast', function(){$(this).parents('tr').hide()});		});	}else{		e.addClass('open');		e.parents('table').find('a.showAll').removeClass('showAll').addClass('hideAll').html('Hide All')		e.find('span.show').html('Hide');		e.nextAll('tr').each(function() {			if ($(this).is('.heading')) {				return false; // next heading reached, stop			};			if($(this).is('.showHide')) {				return false; // next heading reached, stop			};			$(this).show().find('div.wrap').slideDown('fast');		});	}}function showOverlay(){	$('div#overlay').show();}function setupHCPOverlay(html){	$('body').prepend('<div id="overlay"><div id="mask"></div><div id="viewWindow">'+html+'<span class="overlayBase"><!--bottom of overlay--></span><div class="clearB"><!--clearer--></div></div></div>');	$('a.HCPYes').click(function(){	$('div#overlay').hide();})	$('a.HCPNo').click(function(){window.location='http://www.google.co.uk'})	$('div#overlay').height($('html').height());    $('div#overlay').width($('html').width());	showOverlay();}function setupHomeOverlay(html){	$('body').prepend('<div id="overlay"><div id="mask"></div><div id="viewWindow">'+html+'<span class="overlayBase"><!--bottom of overlay--></span><div class="clearB"><!--clearer--></div></div></div>');	$('a.IntYes').click(function(){	$('div#overlay').hide();})	$('div#overlay').height($('html').height());    $('div#overlay').width($('html').width());	showOverlay();}function setupLinkTypes(){	//setup External Links	var externalWarning = '<span class="externalWarn"><strong>External Website<br /> opens in new window</strong></span>'	$('a.xlink').append(externalWarning)	$('a.xlink').hover(function(){$(this).children($('span.externalWarning')).show()},function(){$(this).children($('span.externalWarning')).hide()})	$('a.xlink').click(function () {     window.open($(this).attr("href"),'newWindow');     return false;	});	//setup Download Links	$('a.dLink').hover(function(){		var urlArray = new Array();		urlArray = $(this).attr('href').split('/');		var fileName = urlArray[urlArray.length -1].split('.');		$(this).children('span.downloadPopup').children('span').children('strong').children('em.fileType').html(fileName[1]);		$(this).children('span.downloadPopup').show();		},function(){$(this).children('span.downloadPopup').hide();})		}function floatImageWidths(){	$('div.editorImageLeftCaption').each(function(){		$(this).css('width',((parseInt($(this).children('img').width()) + 2) + 'px'))	});	$('div.editorImageRightCaption').each(function(){		$(this).css('width',((parseInt($(this).children('img').width()) + 2) + 'px'))	})}function faqDropList(){	$(".dropdown-dl dd").hide();	$(".dropdown-dl dt").css({cursor:'pointer'});	$(".dropdown-dl").click(function(){		if($(this).is('.open')) {		} else {//			$(".dropdown-dl").removeClass("open");			$(this).addClass("open");//			$(".dropdown-dl dd").slideUp("fast");			$(this).children("dd").slideDown("fast");			return false;		}	});	$(".dropdown-dl dt").click(function(){		if($(this).parents('dl').is('.open')){			$(this).siblings("dd").slideUp("fast");			$(this).parents('dl').removeClass("open");			return false;		}	});};function captchaWidget(){	$("li.captchaExplain").hide();	$("a.captchaExp").click(function(){$("li.captchaExplain").slideToggle(); return false;})}function textSizeChanger(){	$('.toolsTextSize a').click(function(){		if($(this).is('.size1')){			$(this).siblings('a').removeClass('active');			$(this).addClass('active');			$('div#wrapper').css('font-size','0.75em');			return false;		}		if($(this).is('.size2')){			$(this).siblings('a').removeClass('active');			$(this).addClass('active');			$('div#wrapper').css('font-size','0.85em');			return false;		}		if($(this).is('.size3')){			$(this).siblings('a').removeClass('active');			$(this).addClass('active');			$('div#wrapper').css('font-size','0.95em');			return false;		}	});}function setupFooterButtons(){	$('li.printPage a').click(function(){		window.print();		return false;	});     if(window.opera)       {           if ($("li.bookPage a").attr("rel") != "")           {               $("li.bookPage a").attr("rel","sidebar");           }       }       $("li.bookPage a").click(function(event)       {           event.preventDefault();           if (window.sidebar)         {           	url = location.href             window.sidebar.addPanel("Avelox",url, "");           }           else if(window.external)           {               window.external.AddFavorite(location.href,Avelox);           }           else if(window.opera)           {               return false;           }           else           {               alert('Please bookmark this page manually.');           }       });  }function topNavHoverFix(){	$('ul.topFeatureNav li').hover(function(){		if($(this).is('.first')){			$(this).removeClass('first').addClass('firstHover');		}else{if($(this).is('.firstActive')){					}else{if($(this).is('.active')){						}else{			$(this).removeClass().addClass('hover');		}		}		}	},function(){		if($(this).is('.firstHover')){			$(this).addClass('first').removeClass('firstHover');		}else{if($(this).is('.firstActive')){					}else{if($(this).is('.active')){				}else{			$(this).removeClass();		}		}		}	});};
