function cdenter(field,event)
    {
    var k;
    if (event.keyCode)
        k = event.keyCode;
    else if (event.which)
        k = event.which;
    else
        k = event.charCode;
    if (k == 13)
        return false;
    else
        return true;
    }

function image_active(imgName)
    {
    imgOn = eval(imgName + "On.src");
    document [imgName].src = imgOn;
    }

function image_inactive(imgName)
    {
    imgOff = eval(imgName + "Off.src");
    document [imgName].src = imgOff;
    }

/***********************************************
* Ultimate Fade-In Slideshow (v1.51): © Dynamic Drive (http://www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/

var fadeimages=new Array()
fadeimages[0]=["http://www.pqaccountant.com/imag/imag0200.gif","http://www.pqaccountant.com/pmag-FFFF00500024000002171957.html",""]
fadeimages[1]=["http://www.pqaccountant.com/imag/imag0201.gif","http://www.pqaccountant.com/pmag-FFFF00500024000002171957.html",""]

var fadebgcolor="white"
var fadearray=new Array()
var fadeclear=new Array()

var dom=(document.getElementById)
var iebrowser=document.all

function fadeshow(theimages, fadewidth, fadeheight, borderwidth, delay, pause, displayorder){
    this.pausecheck=pause
    this.mouseovercheck=0
    this.delay=delay
    this.degree=10
    this.curimageindex=0
    this.nextimageindex=1
    fadearray[fadearray.length]=this
    this.slideshowid=fadearray.length-1
    this.canvasbase="canvas"+this.slideshowid
    this.curcanvas=this.canvasbase+"_0"
    if (typeof displayorder!="undefined")
        theimages.sort(function() {return 0.5 - Math.random();})
    this.theimages=theimages
    this.imageborder=parseInt(borderwidth)
    this.postimages=new Array()
    for (p=0;p<theimages.length;p++){
        this.postimages[p]=new Image()
        this.postimages[p].src=theimages[p][0]
    }

    var fadewidth=fadewidth+this.imageborder*2
    var fadeheight=fadeheight+this.imageborder*2

    if (iebrowser&&dom||dom)
        document.write('<div id="master'+this.slideshowid+'" style="position:relative;width:'+fadewidth+'px;height:'+fadeheight+'px;overflow:hidden;"><div id="'+this.canvasbase+'_0" style="position:absolute;width:'+fadewidth+'px;height:'+fadeheight+'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);opacity:0.1;-moz-opacity:0.1;-khtml-opacity:0.1;background-color:'+fadebgcolor+'"></div><div id="'+this.canvasbase+'_1" style="position:absolute;width:'+fadewidth+'px;height:'+fadeheight+'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);opacity:0.1;-moz-opacity:0.1;-khtml-opacity:0.1;background-color:'+fadebgcolor+'"></div></div>')
    else
        document.write('<div><img name="defaultslide'+this.slideshowid+'" src="'+this.postimages[0].src+'"></div>')

    if (iebrowser&&dom||dom)
        this.startit()
    else{
        this.curimageindex++
        setInterval("fadearray["+this.slideshowid+"].rotateimage()", this.delay)
    }
}

function fadepic(obj){
    if (obj.degree<100){
        obj.degree+=10
    if (obj.tempobj.filters&&obj.tempobj.filters[0]){
        if (typeof obj.tempobj.filters[0].opacity=="number")
            obj.tempobj.filters[0].opacity=obj.degree
        else
            obj.tempobj.style.filter="alpha(opacity="+obj.degree+")"
    }
    else if (obj.tempobj.style.MozOpacity)
        obj.tempobj.style.MozOpacity=obj.degree/101
    else if (obj.tempobj.style.KhtmlOpacity)
        obj.tempobj.style.KhtmlOpacity=obj.degree/100
    else if (obj.tempobj.style.opacity&&!obj.tempobj.filters)
        obj.tempobj.style.opacity=obj.degree/101
    }
    else{
        clearInterval(fadeclear[obj.slideshowid])
        obj.nextcanvas=(obj.curcanvas==obj.canvasbase+"_0")? obj.canvasbase+"_0" : obj.canvasbase+"_1"
        obj.tempobj=iebrowser? iebrowser[obj.nextcanvas] : document.getElementById(obj.nextcanvas)
        obj.populateslide(obj.tempobj, obj.nextimageindex)
        obj.nextimageindex=(obj.nextimageindex<obj.postimages.length-1)? obj.nextimageindex+1 : 0
        setTimeout("fadearray["+obj.slideshowid+"].rotateimage()", obj.delay)
    }
}

fadeshow.prototype.populateslide=function(picobj, picindex){
    var slideHTML=""
    if (this.theimages[picindex][1]!="")
        slideHTML='<a href="'+this.theimages[picindex][1]+'" target="'+this.theimages[picindex][2]+'">'
    slideHTML+='<img src="'+this.postimages[picindex].src+'" border="'+this.imageborder+'px">'
    if (this.theimages[picindex][1]!="")
        slideHTML+='</a>'
    picobj.innerHTML=slideHTML
}

fadeshow.prototype.rotateimage=function(){
    if (this.pausecheck==1)
        var cacheobj=this
    if (this.mouseovercheck==1)
        setTimeout(function(){cacheobj.rotateimage()}, 100)
    else if (iebrowser&&dom||dom){
        this.resetit()
        var crossobj=this.tempobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
        crossobj.style.zIndex++
        fadeclear[this.slideshowid]=setInterval("fadepic(fadearray["+this.slideshowid+"])",50)
        this.curcanvas=(this.curcanvas==this.canvasbase+"_0")? this.canvasbase+"_1" : this.canvasbase+"_0"
    }
    else{
        var ns4imgobj=document.images['defaultslide'+this.slideshowid]
        ns4imgobj.src=this.postimages[this.curimageindex].src
    }
    this.curimageindex=(this.curimageindex<this.postimages.length-1)? this.curimageindex+1 : 0
}

fadeshow.prototype.resetit=function(){
    this.degree=10
    var crossobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
    if (crossobj.filters&&crossobj.filters[0]){
        if (typeof crossobj.filters[0].opacity=="number")
            crossobj.filters(0).opacity=this.degree
        else
            crossobj.style.filter="alpha(opacity="+this.degree+")"
    }
    else if (crossobj.style.MozOpacity)
        crossobj.style.MozOpacity=this.degree/101
    else if (crossobj.style.KhtmlOpacity)
        crossobj.style.KhtmlOpacity=this.degree/100
    else if (crossobj.style.opacity&&!crossobj.filters)
        crossobj.style.opacity=this.degree/101
}

fadeshow.prototype.startit=function(){
    var crossobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
    this.populateslide(crossobj, this.curimageindex)
    if (this.pausecheck==1){
        var cacheobj=this
        var crossobjcontainer=iebrowser? iebrowser["master"+this.slideshowid] : document.getElementById("master"+this.slideshowid)
        crossobjcontainer.onmouseover=function(){cacheobj.mouseovercheck=1}
        crossobjcontainer.onmouseout=function(){cacheobj.mouseovercheck=0}
    }
    this.rotateimage()
}

function sleep(milliseconds) {
    var start = new Date().getTime();
    for (var i = 0; i < 1e7; i++) {
        if ((new Date().getTime() - start) > milliseconds){
            break;
        }
    }
}

var slideimages = new Array()
slideimages[0]=["http://www.pqaccountant.com/advt/00030000.gif","http://www.bpp.com",""]
slideimages[1]=["http://www.pqaccountant.com/advt/00050000.gif","http://www.walkerdendle.co.uk/content_static/splash.asp",""]
slideimages[2]=["http://www.pqaccountant.com/advt/00060000.gif","http://www.firstintuition.co.uk",""]
slideimages[3]=["http://www.pqaccountant.com/advt/00070000.gif","http://www.lsbf.org.uk",""]
slideimages[4]=["http://www.pqaccountant.com/advt/00080000.gif","http://financial.kaplan.co.uk/pages/default.aspx",""]
slideimages[5]=["http://www.pqaccountant.com/advt/00090000.gif","http://www.pagepersonnel.co.uk",""]


dir=0
speed=8
imageSize=100
fixedWidth=100
fixedHeight=60
spacerWidth=20
alwaysCenter=1
popupLeft=0
popupTop=0
biggest=0
ieBorder=0
totalWidth=0
hs4Timer=null

preload=new Array()
for(var i=0;i<slideimages.length;i++){
    preload[i]=new Image()
    preload[i].src=slideimages[i][0]
}
function initHS4(){
    scroll1=document.getElementById("scroller1")
    for(var j=0;j<slideimages.length;j++){
        scroll1.innerHTML+='<img id="pic'+j+'" src="'+preload[j].src+'" alt="'+slideimages[j][2]+'" title="'+slideimages[j][2]+'" onclick="showBigPic('+j+')">'
        if(imageSize!=0){
            newWidth=preload[j].width/100*imageSize
            newHeight=preload[j].height/100*imageSize
        }
        else{
            newWidth=fixedWidth
            newHeight=fixedHeight
        }
        document.getElementById("pic"+j).style.width=newWidth+"px"
        document.getElementById("pic"+j).style.height=newHeight+"px"

        if(document.getElementById("pic"+j).offsetHeight>biggest){
            biggest=document.getElementById("pic"+j).offsetHeight
        }
        document.getElementById("pic"+j).style.marginLeft=spacerWidth+"px"
        totalWidth+=document.getElementById("pic"+j).offsetWidth+spacerWidth
    }
    totalWidth+=1
    for(var k=0;k<slideimages.length;k++){
        document.getElementById("pic"+k).style.marginBottom = (biggest-document.getElementById("pic"+k).offsetHeight)/2+"px"
    }
    scrollBox=document.getElementById("scroll_box")
    if(document.uniqueID && scrollBox.currentStyle && document.compatMode!="CSS1Compat"){
        ieBorder=parseInt(scrollBox.currentStyle.borderWidth)*2
    }
    if(document.getElementById&&document.all){
        ieBorder=parseInt(scrollBox.style.borderTopWidth)*2
    }

    scrollBox.style.height=biggest+ieBorder+"px"

    scroll1.style.width=totalWidth+"px"
    scroll2=document.getElementById("scroller2")
    scroll2.innerHTML=scroll1.innerHTML
    scroll2.style.left= scroll1.offsetWidth+"px"
    scroll2.style.top= 0+"px"
    scroll2.style.width=totalWidth+"px"
    if(dir==1){
        speed= -speed
    }
    scrollHS4()
}
function scrollHS4(){
    if(paused==1){return}
    clearTimeout(hs4Timer)
    scroll1Pos=parseInt(scroll1.style.left)
    scroll2Pos=parseInt(scroll2.style.left)
    scroll1Pos-=speed
    scroll2Pos-=speed
    scroll1.style.left=scroll1Pos+"px"
    scroll2.style.left=scroll2Pos+"px"
    hs4Timer=setTimeout("scrollHS4()",50)

    if(dir==0){
        if(scroll1Pos< -scroll1.offsetWidth){
            scroll1.style.left=scroll1.offsetWidth+"px"
        }

        if(scroll2Pos< -scroll1.offsetWidth){
            scroll2.style.left=scroll1.offsetWidth+"px"
        }
    }

    if(dir==1){
        if(scroll1Pos>parseInt(scrollBox.style.width)){
            scroll1.style.left=scroll2Pos+ (-scroll1.offsetWidth)+"px"
        }

        if(scroll2Pos>parseInt(scrollBox.style.width)){
            scroll2.style.left=scroll1Pos+ (-scroll2.offsetWidth)+"px"
        }
    }
}
st=null
function pause(){
    clearTimeout(hs4Timer)
    clearTimeout(st)
}
function reStartHS4(){
    clearTimeout(st)
    st=setTimeout("scrollHS4()",100)
}

paused=0
picWin=null

function showBigPic(p){
    if(slideimages[p][1]!=""){
        paused=1
        if(picWin&&picWin.open&&!picWin.closed){picWin.close()}
        if(slideimages[p][1].indexOf("jpg")!=-1){
            bigImg=new Image()
            bigImg.src=slideimages[p][1]
            if(alwaysCenter==1){
                popupLeft = (screen.availWidth - bigImg.width) / 2
                popupTop = (screen.availHeight - bigImg.height) / 2
            }
            data="\n<center>\n<img src='"+bigImg.src+"'>\n<\/center>\n"
            var winProps = "left= "+popupLeft+", top = "+popupTop+", width="+(bigImg.width+20)+", height="+(bigImg.height+20)+", scrollbars=no, toolbar=no, directories=no, menu bar=no, resizable=yes, status=no"
            picWin=window.open("","win1",winProps)
            picWin.document.write("<HTML>\n<HEAD>\n<TITLE><\/TITLE>\n")
            picWin.document.write("<\/HEAD>\n")
            picWin.document.write("<BODY style='background-color:black;margin-top:10px;margin-left:10px'>\n")
            picWin.document.write("<div id=\"display\">"+data+"<\/div>")
            picWin.document.write("\n<\/BODY>\n<\/HTML>")
        }
        else{
            picWin=window.open(slideimages[p][1])
        }
    }
}

window.onfocus=function(){
    paused=0
    scrollHS4()
}
onunload=function(){
    if(picWin&&picWin.open&&!picWin.closed){
        picWin.close()
    }
}

