var faderFOID = new Object();
var faderFTID = new Object();

function fader(object, destOp, rate, delta){
    if (!document.all) return;
    if (object != "[object]"){
        setTimeout("fader("+object+","+destOp+","+rate+","+delta+")",0);
        return;
    }
    clearTimeout(faderFTID[object.sourceIndex]);
    diff = destOp-object.filters.alpha.opacity;
    direction = 1;
    if (object.filters.alpha.opacity > destOp) direction = -1;
    delta=Math.min(direction*diff,delta);
    object.filters.alpha.opacity+=direction*delta;
    if (object.filters.alpha.opacity != destOp){
        faderFOID[object.sourceIndex]=object;
        faderFTID[object.sourceIndex]=setTimeout("fader(faderFOID["+object.sourceIndex+"],"+destOp+","+rate+","+delta+")",rate);
    }
}

function makeFaders(){
    if (!document.all) return;
    var a=document.getElementsByTagName('IMG');
    for(i=0;i < a.length;i++){
		if(a[i].ref=='fadeMe'){
			a[i].style.cursor="pointer"
			a[i].style.filter="alpha(opacity=50)"
			a[i].attachEvent("onmouseover",objEvent(a[i],100,60,10),true);
			a[i].attachEvent("onmouseout",objEvent(a[i],50,60,10),true);
			createDropShadow(a[i])
		}
    }
}

objEvent = function(a,b,c,d) {
     return function() { fader(a,b,c,d) } 
}

var shadowOffset = 5
var shadowBGcolor = '#000000'

function createDropShadow(img){
	var sDiv=document.createElement('DIV')
	sDiv.style.position='absolute'
	sDiv.style.fontFamily='verdana'
	sDiv.style.fontSize='1'
	sDiv.style.top=(findPosY(img)+img.offsetHeight)
	sDiv.style.left=findPosX(img)+shadowOffset
	sDiv.style.height=shadowOffset
	sDiv.style.width=img.offsetWidth
	sDiv.style.background=shadowBGcolor
	sDiv.style.filter='Alpha(Opacity=75) blur(add=0,direction=275,strength=8)'
	document.body.appendChild(sDiv)

	var sDiv=document.createElement('DIV')
	sDiv.style.position='absolute'
	sDiv.style.fontFamily='verdana'
	sDiv.style.fontSize='1'
	sDiv.style.top=findPosY(img)+shadowOffset
	sDiv.style.left=(findPosX(img)+img.offsetWidth)
	sDiv.style.height=img.offsetHeight-shadowOffset
	sDiv.style.width=shadowOffset
	sDiv.style.background=shadowBGcolor
	sDiv.style.filter='Alpha(Opacity=75) blur(add=0,direction=275,strength=8)'
	document.body.appendChild(sDiv)
}


function findPosX(obj){
    var curleft=0;
    if(obj.offsetParent){
        while(obj.offsetParent){
            curleft+=obj.offsetLeft
            obj=obj.offsetParent;
        }
    }
    else if(obj.x)
        curleft+=obj.x;
    return curleft;
}

function findPosY(obj){
    var curtop=0;
    if(obj.offsetParent){
        while(obj.offsetParent){
            curtop+=obj.offsetTop
            obj=obj.offsetParent;
        }
    }
    else if(obj.y)
        curtop+=obj.y;
    return curtop;
}
function setSelectedMenu(menu)
{
	document.getElementById("_ctl0_mastermenun" + menu.toString()).style.backgroundColor="#FFFFFF";
	document.getElementById("_ctl0_mastermenun" + menu.toString()).children[0].children[0].children[0].children[0].children[0].style.backgroundColor="#FFFFFF";
	document.getElementById("_ctl0_mastermenun" + menu.toString()).children[0].children[0].children[0].children[0].children[0].style.color="#003366";
	document.getElementById("_ctl0_mastermenun" + menu.toString()).children[0].children[0].children[0].style.backgroundColor="#FFFFFF";
}