function showtable() {
    var table = document.getElementById('pricingtable');
    currentStyle = getStyle(table, 'display');
    if (currentStyle == 'none') {
        table.style.display = 'block';
    } else {
        table.style.display = 'none';
    }
}

function activateSearch () {
	var e = document.getElementById('search_input');
	if (e && e.className != '') {
		e.className = '';
		e.value = '';
	}
}

function getStyle(oElm, strCssRule){
    var strValue = "";
    if(document.defaultView && document.defaultView.getComputedStyle){
        strValue = document.defaultView.getComputedStyle(oElm, "").getPropertyValue(strCssRule);
    }
    else if(oElm.currentStyle){
        strCssRule = strCssRule.replace(/\-(\w)/g, function (strMatch, p1){
            return p1.toUpperCase();
        });
        strValue = oElm.currentStyle[strCssRule];
    }
    return strValue;
}


function show_screen_thumb(itemid, clickable) {
    var image = document.getElementById('screenshot_thumb');
    image.src = '/cgi-bin/items.cgi?_rm=display_blob;_size=l;_name=Image;_item='+itemid;
    if (clickable == 1) {
        image.setAttribute('onclick', 'openup(\''+itemid+'\')');
        // next line is for IE
        image.onclick = new Function("openup('"+itemid+"');"); 
        image.className = 'clickable';
    } else {
        image.setAttribute('onclick', '');
        // next line is for IE
        image.onclick = new Function("");
        image.className = '';
    }
}


function openup(itemid) {
    window.open('/cgi-bin/items.cgi?_rm=show_image;_size=screenshot;_name=Image;_item='+itemid, 'screenshot','width=850,height=640,scrollbars=yes,resize=no');
}



function homepageflash() {
if (DetectFlashVer(6,0,0)) {
document.write('<object id="clouds" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="950" height="534" align="absmiddle"> <param name="movie" value="/flash/clouds.swf"> <param name="quality" value="high"> <param name="wmode" value="opaque"> <embed src="/flash/clouds.swf" width="950" height="534" align="absmiddle" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="opaque"> </embed> </object>');
} else {
document.write('<img src="/images/clouds.jpg" alt="" style="display: block;">');
}
}

function innerflash() {
if (DetectFlashVer(6,0,0)) {
document.write('<object id="inner_clouds" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="950" height="534" align="absmiddle"> <param name="movie" value="/flash/inner_clouds.swf"> <param name="quality" value="high"> <param name="wmode" value="opaque"> <embed src="/flash/inner_clouds.swf" width="950" height="534" align="absmiddle" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="opaque"> </embed> </object>');
} else {
document.write('<img src="/images/inner_clouds.jpg" alt="" style="display: block;">');
}
}


function set_spacers(spacer1, spacer2, newurl) {
    var spacer1_img = document.getElementById(spacer1);
    var spacer2_img = document.getElementById(spacer2);
    spacer1_img.src=newurl;
    spacer2_img.src=newurl;
}

function inject_casestudy_carousel() {
if (DetectFlashVer(8,0,0)) {
document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="590" height="300" id="site_carousel" align="middle"><param name="allowScriptAccess" value="sameDomain"><param name="movie" value="/flash/site_carousel.swf"><param name="quality" value="high"><param name="bgcolor" value="#ffffff"><embed src="/flash/site_carousel.swf" quality="high" bgcolor="#ffffff" width="590" height="300" name="site_carousel" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></object>');
}
}

function MM_preloadImages() { 
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function checkForm() {
	if (document.regform.firstname.value == '') {
		alert("Please supply a first name or initial.");
		return false;
	} else if (document.regform.surname.value == '') {
		alert("Please supply a surname.");
		return false;
	} else if (document.regform.address1.value == '') {
		alert("Please supply an address.");
		return false;
	} else if (document.regform.town.value == '') {
		alert("Please supply a town.");
		return false;
	} else if (document.regform.postcode.value == '') {
		alert("Please supply a postcode.");
		return false;
	} else if (document.regform.county.selectedIndex == 0) {
		alert("Please supply a county.");
		return false;
	} else if (document.regform.email.value == '') {
		alert("Please supply an email address.");
		return false;
	} else if (document.regform.email2.value == '') {
		alert("Please confirm your email address.");
		return false;
    } else if (document.regform.password1.value == '') {
        alert("Please choose a password.");
        return false;
    } else if (document.regform.password2.value == '') {
        alert("Please confirm your password.");
        return false;
    } else if (document.regform._accept_terms.checked == false) {
        alert("Please confirm that you accept the Terms and Conditions.");
        return false;
    }
    // strip whitespace off end of passwords 
    var pass1 = document.regform.password1.value;
    var pass2 = document.regform.password2.value;
    pass1 = pass1.replace(/\s+$/, "");
    pass2 = pass2.replace(/\s+$/, "");
    if (pass1 != pass2) {
        alert("Please ensure that your passwords match.");
        return false;
    }
    // strip whitespace off end of emails 
    var email1 = document.regform.email.value;
    var email2 = document.regform.email2.value;
    email1 = email1.replace(/\s+$/, "");
    email2 = email2.replace(/\s+$/, "");
    if (email1 != email2) {
        alert("Please ensure that your email addresses match.");
        return false;
    }
    document.regform.submit();
}


function checkRegOfInterest() {
	if (document.interestform.interestfirstname.value == '') {
		alert("Please supply a first name or initial.");
		return false;
	} else if (document.interestform.interestsurname.value == '') {
		alert("Please supply a surname.");
		return false;
	} else if (document.interestform.interestemail.value == '') {
		alert("Please supply an email address.");
		return false;
	} else if (document.interestform.interestemail2.value == '') {
		alert("Please confirm your email address.");
		return false;
    } else if (document.interestform.interestcounty.selectedIndex == 0) {
        alert("Please choose a county.");
        return false;
    }
    // strip whitespace off end of emails 
    var email1 = document.interestform.interestemail.value;
    var email2 = document.interestform.interestemail2.value;
    email1 = email1.replace(/\s+$/, "");
    email2 = email2.replace(/\s+$/, "");
    if (email1 != email2) {
        alert("Please ensure that your email addresses match.");
        return false;
    }
    document.interestform.submit();
}

function swapnav(num, onoff) {
    var thisimg = document.getElementById('topnav'+num);
    if (onoff == 'on') {
        thisimg.src = '/images/page_nav_'+num+'_over.png';
    } else if (onoff == 'off') {
        thisimg.src = '/images/page_nav_'+num+'.png';
    } 
}

function P7_VScroller(el,dr,ty,oy,spd) { //v1.7 by PVII
        var g,gg,fr,sp,pa='',slw=true,m=false,h,ly;
        ty=parseInt(ty);
        if((g=MM_findObj(el))!=null){
                gg=(document.layers)?g:g.style;
        } else {
                return;
        }
        if(dr=="Stop"){
                if(g.toMove){clearTimeout(g.p7Magic);}g.toMove=false;
        }
        if((parseInt(navigator.appVersion)>4 || navigator.userAgent.indexOf("MSIE")>-1)&& !window.opera){
                pa="px";
        }
        if(navigator.userAgent.indexOf("NT")>-1 || navigator.userAgent.indexOf("Windows 2000")>-1){
                slw=false;
        }
        if(spd=="Slow"){
                sp=(slw)?2:1;
                fr=(slw)?40:30;
        } else if(spd=="Medium"){
                sp=(slw)?4:1;
                fr=(slw)?40:10;
        } else {
                sp=(slw)?8:4;
                fr=(slw)?40:10;
        }
        if(spd=="Warp"){
                sp=5000;
        }
        var yy=parseInt(gg.top);
        if(isNaN(yy)){
                if(g.currentStyle){
                        yy=parseInt(g.currentStyle.top);
                } else if(document.defaultView&&document.defaultView.getComputedStyle){
                        yy=parseInt(document.defaultView.getComputedStyle(g,"").getPropertyValue("top"));
                } else {
                        yy=0;
                }
        }
        if(document.all || document.getElementById){
                h=parseInt(g.offsetHeight);
                if(!h){
                        h=parseInt(g.style.pixelHeight);
                }
        } else if(document.layers){
                h=parseInt(g.clip.height);
        }
        ly=ty+parseInt(oy)-h;
        if(dr=="Down"){
                if(yy>ly){
                        m=true;yy-=sp;
                        if(yy<ly){
                                yy=ly;
                        }
                }
        }
        if(dr=="Up"){
                if(yy<ty){
                        m=true;yy+=sp;
                        if(yy>ty){
                                yy=ty;
                        }
                }
        }
        if(dr=="Reset"){
                gg.top=ty+pa;
                if(g.toMove){
                        clearTimeout(g.p7Magic);
                }
                g.toMove=false;
        }
        if(m){
                gg.top=yy+pa;
                if(g.toMove){
                        clearTimeout(g.p7Magic);
                }
                g.toMove=true;
                eval("g.p7Magic=setTimeout(\"P7_VScroller('"+el+"','"+dr+"',"+ty+","+oy+",'"+spd+"')\","+fr+")");
        } else {
                g.toMove=false;
        }
}

function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_findObj(n, d) { //v4.0 Dreamweaver code - required for nested layers in NS4
        var p,i,x;
        if(!d) {
                d=document;
        }
        if((p=n.indexOf("?"))>0&&parent.frames.length) {
                d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);
        }
        if (!(x=d[n])&&d.all) x=d.all[n];
        for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
        for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
        if(!x && document.getElementById) x=document.getElementById(n);
        return x;
}

