/* prominic.v1.2.js * Author Jake Howlett * Date 31st May 200 *//* First we load all the dependent functions *//* document.getElementsBySelector(selector)   - returns an array of element objects from the current document     matching the CSS selector. Selectors can contain element names,      class names and ids and can be nested. For example:            elements = document.getElementsBySelect('div#main p a.external')          Will return an array of all 'a' elements with 'external' in their      class attribute that are contained inside 'p' elements that are      contained inside the 'div' element which has id="main"   New in version 0.4: Support for CSS2 and CSS3 attribute selectors:   See http://www.w3.org/TR/css3-selectors/#attribute-selectors   Version 0.4 - Simon Willison, March 25th 2003   -- Works in Phoenix 0.5, Mozilla 1.3, Opera 7, Internet Explorer 6, Internet Explorer 5 on Windows   -- Opera 7 fails */function getAllChildren(e) {  // Returns all children of element. Workaround required for IE5/Windows. Ugh.  return e.all ? e.all : e.getElementsByTagName('*');}document.getElementsBySelector = function(selector) {  // Attempt to fail gracefully in lesser browsers  if (!document.getElementsByTagName) {    return new Array();  }  // Split selector in to tokens  var tokens = selector.split(' ');  var currentContext = new Array(document);  for (var i = 0; i < tokens.length; i++) {    token = tokens[i].replace(/^\s+/,'').replace(/\s+$/,'');;    if (token.indexOf('#') > -1) {      // Token is an ID selector      var bits = token.split('#');      var tagName = bits[0];      var id = bits[1];      var element = document.getElementById(id);      if (tagName && element.nodeName.toLowerCase() != tagName) {        // tag with that ID not found, return false        return new Array();      }      // Set currentContext to contain just this element      currentContext = new Array(element);      continue; // Skip to next token    }    if (token.indexOf('.') > -1) {      // Token contains a class selector      var bits = token.split('.');      var tagName = bits[0];      var className = bits[1];      if (!tagName) {        tagName = '*';      }      // Get elements matching tag, filter them for class selector      var found = new Array;      var foundCount = 0;      for (var h = 0; h < currentContext.length; h++) {        var elements;        if (tagName == '*') {            elements = getAllChildren(currentContext[h]);        } else {            elements = currentContext[h].getElementsByTagName(tagName);        }        for (var j = 0; j < elements.length; j++) {          found[foundCount++] = elements[j];        }      }      currentContext = new Array;      var currentContextIndex = 0;      for (var k = 0; k < found.length; k++) {        if (found[k].className && found[k].className.match(new RegExp('\\b'+className+'\\b'))) {          currentContext[currentContextIndex++] = found[k];        }      }      continue; // Skip to next token    }    // Code to deal with attribute selectors    if (token.match(/^(\w*)\[(\w+)([=~\|\^\$\*]?)=?"?([^\]"]*)"?\]$/)) {      var tagName = RegExp.$1;      var attrName = RegExp.$2;      var attrOperator = RegExp.$3;      var attrValue = RegExp.$4;      if (!tagName) {        tagName = '*';      }      // Grab all of the tagName elements within current context      var found = new Array;      var foundCount = 0;      for (var h = 0; h < currentContext.length; h++) {        var elements;        if (tagName == '*') {            elements = getAllChildren(currentContext[h]);        } else {            elements = currentContext[h].getElementsByTagName(tagName);        }        for (var j = 0; j < elements.length; j++) {          found[foundCount++] = elements[j];        }      }      currentContext = new Array;      var currentContextIndex = 0;      var checkFunction; // This function will be used to filter the elements      switch (attrOperator) {        case '=': // Equality          checkFunction = function(e) { return (e.getAttribute(attrName) == attrValue); };          break;        case '~': // Match one of space seperated words           checkFunction = function(e) { return (e.getAttribute(attrName).match(new RegExp('\\b'+attrValue+'\\b'))); };          break;        case '|': // Match start with value followed by optional hyphen          checkFunction = function(e) { return (e.getAttribute(attrName).match(new RegExp('^'+attrValue+'-?'))); };          break;        case '^': // Match starts with value          checkFunction = function(e) { return (e.getAttribute(attrName).indexOf(attrValue) == 0); };          break;        case '$': // Match ends with value - fails with "Warning" in Opera 7          checkFunction = function(e) { return (e.getAttribute(attrName).lastIndexOf(attrValue) == e.getAttribute(attrName).length - attrValue.length); };          break;        case '*': // Match ends with value          checkFunction = function(e) { return (e.getAttribute(attrName).indexOf(attrValue) > -1); };          break;        default :          // Just test for existence of attribute          checkFunction = function(e) { return e.getAttribute(attrName); };      }      currentContext = new Array;      var currentContextIndex = 0;      for (var k = 0; k < found.length; k++) {        if (checkFunction(found[k])) {          currentContext[currentContextIndex++] = found[k];        }      }      // alert('Attribute Selector: '+tagName+' '+attrName+' '+attrOperator+' '+attrValue);      continue; // Skip to next token    }    // If we get here, token is JUST an element (not a class or ID selector)    tagName = token;    var found = new Array;    var foundCount = 0;    for (var h = 0; h < currentContext.length; h++) {      var elements = currentContext[h].getElementsByTagName(tagName);      for (var j = 0; j < elements.length; j++) {        found[foundCount++] = elements[j];      }    }    currentContext = found;  }  return currentContext;}/* That revolting regular expression explained /^(\w+)\[(\w+)([=~\|\^\$\*]?)=?"?([^\]"]*)"?\]$/  \---/  \---/\-------------/    \-------/    |      |         |               |    |      |         |           The value    |      |    ~,|,^,$,* or =    |   Attribute    Tag*/$=function(id){	return document.getElementById(id);}$$=function(id){	return document.getElementsBySelector(id);}/* menu initialisation code */function menuInit(){	withChilds = document.getElementsBySelector("#main_navigation li li ul");	for (var i=0; i<withChilds.length; i++){		withChilds[i].parentNode.firstChild.className="has_child"; //.addClass('has_child');	}}//This function is run after page is loaded.function pageInit() {	menuInit();		//look for the BBB	if ($("BBBNav")) {		divs = $$(".content_tabs_container");		for (var i=0; i<divs.length; i++){			divs[i].style.display='none'; 		}				//is a section stated in the URL?		if (location.hash!="" && location.hash.toLowerCase().indexOf("section")>-1){			BBB.current=location.hash.charAt(location.hash.length-1);			BBB.jumpTo=true;			//check this section DOES exist.			if (!$("section"+BBB.current)){BBB.current=1; BBB.jumpTo=false;}					}				$("section"+BBB.current).style.display=''; 		if (BBB.jumpTo) $("section"+BBB.current+"_title").scrollIntoView(); 		$("section"+BBB.current+"_title").className="selected";	}}var BBB = new Object();BBB.current=1;BBB.toggle = function(link){	id=link.getAttribute('to');	$("section"+BBB.current+"_title").className=""; //("selected");	link.className="selected";	$("section"+BBB.current).style.display='none'; //;addClass("off");	$("section"+id).style.display=''; //.removeClass("off");	BBB.current=id;	link.blur();}function toggleLoginDialog(){	//Bug in Safari won't display absolute positioned DIVs, so just redirect.	//Has been fixed in Safari 3.0, so remove some time after its release	//if (/KHTML|WebKit/i.test(navigator.userAgent)){location.href="?login"; return}		dlg=document.getElementById('login_dialog');	dlg.style.display=(dlg.style.display=='block')?'none':'block';}/*	mailto replaces the mailto:	anchor link and prevents	spambots harvesting the	address.*/function mailto(name, domain, tld, subject){	location.href = "mailto:" + name + "@" + domain + "." + tld + ((subject)?"?subject="+subject:"");}/*	allows instant "window.onload" (DOM.onload) function execution. shortened version, just IE code	credits: Dean Edwards/Matthias Miller/John Resig/Rob Chenny	http://www.cherny.com/webdev/27/domloaded-updated-again*/var DomLoaded ={	onload: [],	loaded: function()	{		if (arguments.callee.done) return;		arguments.callee.done = true;		for (i = 0;i < DomLoaded.onload.length;i++) DomLoaded.onload[i]();	},	load: function(fireThis)	{		this.onload.push(fireThis);		if (document.addEventListener) 			document.addEventListener("DOMContentLoaded", DomLoaded.loaded, null);		if (/KHTML|WebKit/i.test(navigator.userAgent))		{ 			var _timer = setInterval(function()			{				if (/loaded|complete/.test(document.readyState))				{					clearInterval(_timer);					delete _timer;					DomLoaded.loaded();				}			}, 10);		}		/*@cc_on @*/		/*@if (@_win32)		var proto = "src='javascript:void(0)'";		if (location.protocol == "https:") proto = "src=//0";		document.write("<scr"+"ipt id=__ie_onload defer " + proto + "><\/scr"+"ipt>");		var script = document.getElementById("__ie_onload");		script.onreadystatechange = function() {		    if (this.readyState == "complete") {		        DomLoaded.loaded();		    }		};		/*@end @*/	   window.onload = DomLoaded.loaded;	}};DomLoaded.load(pageInit);/* Invitational positioning */var lpPosY = 100;var lpPosX = 100;function doSubmit(f){	var req=[];	req["_Quote"]=[		{name: 'Name', msg: 'Please enter your name'},		{name: 'Email', test: 'isEmail', msg: 'Please enter a valid email address'},		{name: 'Comment', msg: 'Please enter a request'},		{name: 'Phone', msg: 'Please enter a phone number, including international dialing code.'},		{name: 'Phone', test: 'isPhoneNumber', condition: f['Phone'].value!='', msg: 'Please use a valid phone number, including international dialing codes.'},		{name: 'Captcha', msg: 'Please solve the simple test to prove you\'re a real person'}	];	req["_report"]=[		{name: 'Body', type: 'text', msg: 'Please enter a report'}	];		var fields = req[f.name];	var valid = true;		var ul = $('_quote_errors');	ul.innerHTML="";		for (var i=0; i<fields.length; i++) {			if ( typeof fields[i].condition == "undefined" || fields[i].condition ){			if ( f[fields[i].name].value.trim()=="" || (typeof fields[i].test!="undefined" && !eval( fields[i].test+"(document.forms['"+f.name+"']."+fields[i].name+".value)") ) ) {				f[fields[i].name].className="required";				li = document.createElement('li');				li.innerHTML= fields[i].msg;				li.className="error";				ul.appendChild(li);				valid = false;					} else {				f[fields[i].name].className="text";			}		}	}	return valid;}//Extend String object and add a trim methodString.prototype.trim = function() {	a = this.replace(/^\s+/, '');	return a.replace(/\s+$/, '');};function isEmail(str){	var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid	var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; // valid	if ( !reg1.test( str ) && reg2.test( str ) ) {		return true;	} else {	 	return false;	}}function isPhoneNumber(str){	var reg1 = /^((\+\d{1,3}(-| )?\(?\d\)?(-| )?\d{1,5})|(\(?\d{2,6}\)?))(-| )?(\d{3,4})(-| )?(\d{3,4})(( x| ext)\d{1,5}){0,1}$/	if ( reg1.test( str ) ) {		return true;	} else {	 	return false;	}}function doValidateLogin(frm){	var ul = $((frm.name=="Login")?'login_errors':'login_errors_top');	ul.innerHTML="";	var valid = true;	if (frm.Username.value.trim()=="" || !isEmail(frm.Username.value)){		frm.Username.className="required";		li = document.createElement('li');		li.innerHTML= "Please enter a valid email address for logon.";		li.className="error";		ul.appendChild(li);		valid = false;	} else {		frm.Username.className="text";	}		if (frm.Password.value.trim()==""){		frm.Password.className="required";		li = document.createElement('li');		li.innerHTML= "Please enter a password for logon.";		li.className="error";		ul.appendChild(li);		valid = false;	} else {		frm.Password.className="text";		}		return valid;	}Array.prototype.each = function(fun /*, thisp*/)  {    var len = this.length;    if (typeof fun != "function"){    	throw new TypeError();	}    var thisp = arguments[1];    for (var i = 0; i < len; i++){		if (i in this) {	  		fun.call(thisp, this[i], i, this);	  	}	}};function switchTab(to) {	$$(".tab-consumer a").each(function(el){		el.className = el.className.replace("no-bgd", "");	});	$$(".tab-small-business a").each(function(el){		el.className = el.className.replace("no-bgd", "");	});			$$(".ui-tabs-selected").each(function(el){		el.className = ""; //el.className.replaceAll("ui-tabs-selected", "");	});		$('tab-'+to).className="ui-tabs-selected";					$$(".ui-tabs-panel").each(function(el){		el.className = el.className + " ui-tabs-hide";	});	$(to).className = $(to).className.replace(/ui-tabs-hide/g, "");		return false;};