//HARD CODED TOPNAV
function menuShow(id) {

  var element = document.getElementById(id);
  if (element) { element.className = 'visible'; }
//  element = document.getElementById('content');
//  if (element) { element.className = 'menudown'; }

}

function menuHide(id) {

  var element = document.getElementById(id);
  if (element) { element.className = ''; }
//  element = document.getElementById('content');
//  if (element) { element.className = ''; }

}

//DYNAMIC EXPANDABLE TOPNAV
function show_menu(cellid) {
    var thiscell = document.getElementById(cellid);
    thiscell.className = 'nav_option visible';
}

function hide_menu(cellid) {
    var thiscell = document.getElementById(cellid);
    thiscell.className = 'nav_option';
}


//EXPANDABLE AND COLLAPSABLE NEWS
function ReflowNews(id) {
    var e = document.getElementById('news_trans_bottom_image'+id);
    if (e) {
        e.style.bottom= '-1px';
        e.style.bottom= '0px';
    }
}

function showhidenews (id) {
    var miniintro = document.getElementById('news_mini_intro'+id);
    var intro = document.getElementById('news_intro'+id);
    var show = document.getElementById('show'+id);
    var hide = document.getElementById('hide'+id);
    var newsimage = document.getElementById('news_image'+id);
    if (miniintro.style.display == 'none') {
        miniintro.style.display = 'block';
        intro.style.display = 'none';
        show.style.display = 'block';
        hide.style.display = 'none';
        if (newsimage != null) {
            newsimage.style.display = 'none';
        }
    } else {
        miniintro.style.display = 'none';
        intro.style.display = 'block';
        show.style.display = 'none';
        hide.style.display = 'block';
        if (newsimage != null) {
            newsimage.style.display = 'block';
        }
    }
    ReflowNews(id);
}


function injectFlash() {
  // Inject from external JS to avoid IE 6 "click to enable control" "feature"
document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="773" height="308" id="slideshow"><param name="allowScriptAccess" value="sameDomain"><param name="movie" value="/flash/slideshow.swf"><param name="quality" value="high"><param name="wmode" value="transparent"><param name="scale" value="exactfit"><param name="bgcolor" value="#ffffff"><embed wmode="transparent" src="/flash/slideshow.swf" quality="high" scale="exactfit" bgcolor="#ffffff" width="773" height="308" name="slideshow" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></object>');
}



//POSTCODE BOX
function activatePostcode(inputName) {
	var e = document.getElementById(inputName);
	if (e && e.className != '') {
		e.className = '';
		e.value = '';
	}
}


//SCROLLER
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;
}
