window.onload = function(){
	if (document.getElementById) {
		//external links to open in a new window
		var anchors = document.getElementsByTagName('a');
		for (var i=0; i<anchors.length; i++){
			var anchor = anchors[i];
			if (anchor.getAttribute('href') && (anchor.getAttribute('rel') == 'external' || anchor.getAttribute('rel') == 'nofollow')){ anchor.target = '_blank'; 
			}else if (anchor.getAttribute('href') && anchor.getAttribute('rel') == 'player'){ 
				anchor.onclick = function(){ window.open(this.href, 'player', 'width=220,height=165,toolbars=0,left=200,top=200,screenX=200,screenY=200' ); return false; }
			}else if (anchor.getAttribute('href') && anchor.getAttribute('rel') == 'screenshot'){ 
				anchor.onclick = function(){ window.open(this.href, 'screenshot', 'width=800,height=468,toolbars=0,left=0,top=0,screenX=0,screenY=0' ); return false; }
			}else if (anchor.getAttribute('href') && anchor.getAttribute('rel') == 'pdftracking'){ 
				anchor.onclick = function(){ pageTracker._trackPageview(this.href.replace(new RegExp("\.pdf\\b"), "")); }
			}
		}

////////popup navigation menus ie6
		if(window.attachEvent){// window.attachevent is IE only
			var sfEls = document.getElementById("subnav").getElementsByTagName("LI");
				for (var x=0; x<sfEls.length; x++) {
					sfEls[x].onmouseover=function() { this.className+=" sfhover"; }
					sfEls[x].onmouseout=function() { this.className=this.className.replace(new RegExp(" sfhover\\b"), ""); }
				}
		}


		//navigation main links over on popup
		if(document.getElementById('blink') && document.getElementById('tlink') && document.getElementById('rlink')){
			popups = new Array();
			popups[0] = document.getElementById('blink');
			popups[1] = document.getElementById('tlink');
			for (var y=0; y<popups.length; y++) {
				popups[y].childNodes[1].onmouseover = function() { this.parentNode.className = 'navh'; }
				popups[y].childNodes[1].onmouseout = function() {  this.parentNode.className = '';  }
		
			}
		}
		
		//123-reg form on websites/how_it_works page
		if(document.getElementById('domainform')) document.getElementById('domainform').target = '_blank';
		if(document.getElementById('query')){
			querybox = document.getElementById('query');
			querybox.onfocus = function() { this.value = ''; }
			querybox.onblur = function() { if (this.value == '')  this.value = 'Search our site'; }
		}
		
	}//end if (document.getElementById)
highlight();
}

function writeFlash(id) {
switch(id){
	case 'homeflash':
		document.getElementById(id).innerHTML = "<object type=\"application/x-shockwave-flash\" data=\"/flash/side.swf\" width=\"196\" height=\"305\"><param name=\"movie\" value=\"/flash/side.swf\" /><param name=\"wmode\" value=\"opaque\" /></object>";
		break;    
	case 'bfolio':
		document.getElementById(id).innerHTML = "<object type=\"application/x-shockwave-flash\" data=\"/flash/bespoke.swf\" width=\"204\" height=\"79\"><param name=\"movie\" value=\"/flash/bespoke.swf\" /><param name=\"wmode\" value=\"opaque\" /></object>";
		break;    
	case 'tfolio':
		document.getElementById(id).innerHTML = "<object type=\"application/x-shockwave-flash\" data=\"/flash/side.swf\" width=\"196\" height=\"420\"><param name=\"movie\" value=\"/flash/side.swf\" /><param name=\"wmode\" value=\"opaque\" /></object>";
		break;    
	case 'stka':
	case 'stka_or':
		document.getElementById(id).innerHTML = "<object type=\"application/x-shockwave-flash\" data=\"/flash/strictly.swf\" width=\"40\" height=\"18\"><param name=\"movie\" value=\"/flash/strictly.swf\" /><param name=\"wmode\" value=\"opaque\" /></object>";
		break;    
	case 'stka_be':
		document.getElementById(id).innerHTML = "<object type=\"application/x-shockwave-flash\" data=\"/flash/strictlyb.swf\" width=\"40\" height=\"18\"><param name=\"movie\" value=\"/flash/strictlyb.swf\" /><param name=\"wmode\" value=\"opaque\" /></object>";
		break;    
	case 'stka_te':
		document.getElementById(id).innerHTML = "<object type=\"application/x-shockwave-flash\" data=\"/flash/strictlyt.swf\" width=\"40\" height=\"18\"><param name=\"movie\" value=\"/flash/strictlyt.swf\" /><param name=\"wmode\" value=\"opaque\" /></object>";
		break;    
	case 'stka_re':
		document.getElementById(id).innerHTML = "<object type=\"application/x-shockwave-flash\" data=\"/flash/strictlyr.swf\" width=\"40\" height=\"18\"><param name=\"movie\" value=\"/flash/strictlyr.swf\" /><param name=\"wmode\" value=\"opaque\" /></object>";
		break;    
	case 'stka_ta':
		document.getElementById(id).innerHTML = "<object type=\"application/x-shockwave-flash\" data=\"/flash/strictlye.swf\" width=\"40\" height=\"18\"><param name=\"movie\" value=\"/flash/strictlye.swf\" /><param name=\"wmode\" value=\"opaque\" /></object>";
		break;    
	case 'testimonials':
		document.getElementById(id).innerHTML = "<object type=\"application/x-shockwave-flash\" data=\"/flash/testimonials.swf\" width=\"557\" height=\"148\"><param name=\"movie\" value=\"/flash/testimonials.swf\" /><param name=\"wmode\" value=\"opaque\" /></object>";
		break;
	//webAUDIO
	//VoaA
	case 'VoaA000':
	case 'VoaA011':
	case 'VoaA012':
	case 'VoaA021':
	case 'VoaA022':
	case 'VoaA111':
	case 'VoaA112':
	case 'VoaA121':
	case 'VoaA122':
	//VoaB
	case 'VoaB000':
	case 'VoaB011':
	case 'VoaB012':
	case 'VoaB021':
	case 'VoaB022':
	case 'VoaB111':
	case 'VoaB112':
	case 'VoaB121':
	case 'VoaB122':
	//VoaK
	case 'VoaK000':
	case 'VoaK011':
	case 'VoaK012':
	case 'VoaK021':
	case 'VoaK022':
	case 'VoaK111':
	case 'VoaK112':
	case 'VoaK121':
	case 'VoaK122':
	//VoaS
	case 'VoaS000':
	case 'VoaS011':
	case 'VoaS012':
	case 'VoaS021':
	case 'VoaS022':
	case 'VoaS111':
	case 'VoaS112':
	case 'VoaS121':
	case 'VoaS122':
		document.getElementById(id).innerHTML = "<object type=\"application/x-shockwave-flash\" data=\"/flash/webaudio.swf\" width=\"156\" height=\"15\"><param name=\"movie\" value=\"/flash/webaudio.swf\" /><param name=\"FlashVars\" value=\"audio="+ id + "\" /></object>";
		break;
			case 'arithmo':
		document.getElementById(id).innerHTML = "<object type=\"application/x-shockwave-flash\" data=\"http://www.arithmo.co.uk/demo/Camtasia%20Studio/new%20demo/newDemo/newDemo.swf\" width=\"500\" height=\"400\"><param name=\"movie\" value=\"http://www.arithmo.co.uk/demo/Camtasia%20Studio/new%20demo/newDemo/newDemo.swf\" /><param name=\"wmode\" value=\"opaque\" /></object>";
		break;    

}//end switch
}//end function

/********* Check mandatory fields and email validity *********/
function checkForm(f){
nameError = emailError = totalError = 0;
errorMessage = "";
var theName = document.getElementById('name');
var theEmail = document.getElementById('email');
var str = theEmail.value;
var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;

/******* build error messages and error count *******/
	if (theName.value.length == 0){
		nameError = 1;
		totalError += 1;
		errorMessage += "* Name: the field is empty or not valid.\n";
	}//end if
	
	if (theEmail.value.length == 0 || (!filter.test(str))){
		emailError = 1;
		totalError += 1;
		errorMessage += "* Email: the field is empty or not valid.\n";
	}//end if


/******* error fields background and border colors *******/
	if (totalError > 0){
		alert('The form contains ' + totalError + ' error(s).\n\n' + errorMessage);
		return false
	}
}//end function

function displayE(whose){
var d = 'accountantwebsmiths';
var at = '@';
var tld = '.co.uk';

document.write('<a href="mailto:' + whose + at + d + tld + '">' + whose + at + d + tld + '</a>');
}
