// JScript source code
//Show and Hide
	//layer_showThis(obj)
	//layer_hideThis(obj)
	//
	//Example
	//<script>
	//	if (is.ns4) {
	//		document.write("<style>\n");
	//		document.write(".child {display:none}\n");
	//		document.write("</style>\n");
	//	}
	//</script>
	//<style>
		//.myDiv {position:absolute;visibility: hidden;}
	//</style>
	//<a href="void(0);" class='child' id="myDiv_href" onmouseover='layer_showThis("myDiv");'>Show</a>
	//<div id='myDiv' class='myDiv'>my Div Text</div>
//
//Display and Block object
	//	hideObject(ObjId)
	//	hideObject(ObjId,default value)
	//	hideObject(ObjId,collapse value, expand value)
	//
	//example
	//<Style>
	//.hide1 {display: ;}
	//</style>
	//<div id='mydiv' class='hide1'>my div text</div>
	//<a href='void(0);' name='myDiv_href' onmouseover='hideObject("myDiv");">Show</a>
//
//Rollover images
	//msover(image tag name, rollover image url)
	//msout(image tag name, rollout image url)
//
//Drag and resize(SHIFTKEY + drag)
	//<style>
		//.myDiv {position:absolute;}
		//.myDivOver {position:absolute;}
		//.move { cursor: move;}
	//</style>
	//<div id="myDiv" class='myDiv'>MyText</div>
	//at the end of the page add
	//<script>
	//initialize(DIVTAG ID, GETXY OF ANCHOR, DRAGABLE, SHOW ON PAGELOAD, REMEMBER NEW XY AFTER DRAG,RESIZE)
	//</script>
//Browser check
function browser(){
	this.ver=navigator.appVersion; 
	this.agent=navigator.userAgent
	this.dom=document.getElementById?1:0
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom)?1:0;
	this.ie4=(document.all && !this.dom)?1:0; 
	this.ie=this.ie4||this.ie5||this.ie6
	this.mac=this.agent.indexOf("Mac")>-1; 
	this.opera=this.agent.indexOf("Opera")>-1
	this.opera5=this.agent.indexOf("Opera 5")>-1; 
	this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera4)
	return this
}
var is=new browser();

function positionHelp(quickTip,obj) 
{
    if(!is.ns4) 
    {
        evnt=is.dom && document.getElementById(quickTip)||is.ie4 && document.all[quickTip]

        evnt1=is.dom && document.getElementById(obj)||is.ie4 && document.all[obj]
    }
    else 
    {
        evnt=document.layers[quickTip]?document.layers[quickTip]:0;

        evnt1=document.layers[obj]?document.layers[obj]:0;
    }
    evnt.style.top =  parseInt(getAnchorPosition(evnt1).y) - evnt.offsetTop;
    
}

function layer_moveThis(x,y){
	this.x=x;
	this.y=y; 
	this.css.left=x;
	this.css.top=y;
	if (!(is.dom))
	{
		this.css.MozOpacity=0.6;
	}
	else
	{
		if (is.ns6) {
			this.css.MozOpacity=0.6;
		}
		else {
 			this.css.filter = "Alpha(opacity=75)";
 		}
	}	
}

function layer_moveBy(x,y){
	this.moveThis(this.x+x,this.y+y)
}
function getXY(e) {
	var coordinates
	if (is.dom) 
	{
		if (this.type != "WINDOW") {
                coordinates = getAnchorPosition(e + "_href");
        }
        if (myDiv[e].getPos) {
			myDiv[e].x = parseInt(coordinates.x) + parseInt(coordinates.w) + 2;
			myDiv[e].y = parseInt(coordinates.y) + parseInt(coordinates.h)/2;
			myDiv[e].css.left = parseInt(coordinates.x) + parseInt(coordinates.w) + 2;
			myDiv[e].css.top = parseInt(coordinates.y) + parseInt(coordinates.h)/2;
        }
        else {//alert(myDiv[e].posRem + " xx " + myDiv[e].XX + " YY "+ myDiv[e].YY)
			if (myDiv[e].posRem & myDiv[e].XX != 0 && myDiv[e].YY != 0)
			{}
			else
			{
				myDiv[e].x = parseInt(coordinates.x);
				myDiv[e].y = parseInt(coordinates.y) + parseInt(coordinates.h);
				myDiv[e].css.left = parseInt(coordinates.x);
				myDiv[e].css.top = parseInt(coordinates.y) + parseInt(coordinates.h);
			}
        }
        //myDiv[e].x = (is.ns6)?document.getElementById(e + "_href").text.length * 6.5 : document.getElementById(e + "_href").innerText.length * 6.5
        //myDiv[e].y = parseInt(coordinates.y) + parseInt("5px");
        //myDiv[e].css.left = (is.ns6)?parseInt(coordinates.x) + document.getElementById(e + "_href").text.length * 6.5 : parseInt(coordinates.x) + document.getElementById(e + "_href").innerText.length * 6.5
        //myDiv[e].css.top =  parseInt(coordinates.y) + parseInt("5px")
	}
	else
	{
		if (is.ns4)
		{
			if (this.type != "WINDOW") {
                coordinates = getAnchorPosition(e + "_href");
			}
			if (myDiv[e].getPos) {
				myDiv[e].x = parseInt(coordinates.x) + document.anchors[e + "_href"].text.length * 8.8;
				myDiv[e].y = parseInt(coordinates.y) + parseInt("5px");
				myDiv[e].css.left = parseInt(coordinates.x) + document.anchors[e + "_href"].text.length * 6.5;
				myDiv[e].css.top =  parseInt(coordinates.y) + parseInt("5px")
			}
			else {
				if (myDiv[e].posRem & myDiv[e].XX != 0 && myDiv[e].YY != 0)
				{}
				else
				{
					myDiv[e].x = parseInt(coordinates.x);
					myDiv[e].y = parseInt(coordinates.y) + parseInt("20px");
					myDiv[e].css.left = parseInt(coordinates.x);
					myDiv[e].css.top =  parseInt(coordinates.y) + parseInt("20px")
				}
			}
		}
		else
		{
			if (this.type != "WINDOW") {
                coordinates = getAnchorPosition(e + "_href");
			}
			if (myDiv[e].getPos) {
				myDiv[e].x = parseInt(coordinates.x) + parseInt(coordinates.w) + 2;
				myDiv[e].y = parseInt(coordinates.y) + parseInt(coordinates.h)/2;
				myDiv[e].css.left = parseInt(coordinates.x) + parseInt(coordinates.w) + 2;
				myDiv[e].css.top = parseInt(coordinates.y) + parseInt(coordinates.h)/2;
			}
			else {
				if (myDiv[e].posRem & myDiv[e].XX != 0 && myDiv[e].YY != 0)
				{}
				else
				{
					myDiv[e].x = parseInt(coordinates.x);
					myDiv[e].y = parseInt(coordinates.y) + parseInt(coordinates.h);
					myDiv[e].css.left = parseInt(coordinates.x);
					myDiv[e].css.top = parseInt(coordinates.y) + parseInt(coordinates.h);
				}
			}
			//myDiv[e].x = document.all[e + "_href"].innerText.length * 6.5;
			//myDiv[e].y = parseInt(coordinates.y) + parseInt("5px");
			//myDiv[e].css.left = parseInt(coordinates.x) + document.all[e + "_href"].innerText.length * 6.5;
			//myDiv[e].css.top =  parseInt(coordinates.y) + parseInt("5px")
		}
	}
}
function layer_showThis(e){
	if (e == null)
	{
		//if (this.getPos)
		//{
			getXY(this.obj);
		//}
		this.css.visibility="visible"
	}
	else
	{
		for (properties in myDiv)
		{
			if (eval("myDiv." +properties) == "[object Object]")
			{
				if (properties != e)
					layer_hideThis(eval("myDiv." + properties).obj)
			}
		}
		//if (myLayers != null)
		//{
		//	for (var i=0; i<myLayers.length;i++)
		//	{
		//		layer_hideThis(myLayers[i]);
		//	}
		//	myLayers = null;
		//}
		if (myDiv.Prev != null)
		{
			(is.dom)? document.getElementById(myDiv.Prev).style.visibility = "hidden" : (is.ns4)? document.layers[myDiv.Prev].visibility = "hide" : document.all[myDiv.Prev].style.visibility = "hidden";
		}
		//if (myDiv[e].getPos)
		//{
			getXY(e);
		//}
		(is.dom)? document.getElementById(e).style.visibility = "visible" : (is.ns4)? document.layers[e].visibility = "show" : document.all[e].style.visibility = "visible";
		myDiv.Prev = e;
	}
}

function layer_hideThis(e){
	if (e == null)
	{
		this.css.visibility="hidden"
	}
	else
	{
		(is.dom)? document.getElementById(e).style.visibility = "hidden" : (is.ns4)? document.layers[e].visibility = "hide" : document.all[e].style.visibility = "hidden";
	}
} 
function layer_resTo(t,r,b,l,res) {
	this.rr=r; 
	this.bb=b; 
	if(is.ns4){
		this.css.clip.top=t;
		this.css.clip.right=r; 
		this.css.clip.bottom=b;
		this.css.clip.left=l; 
	}
	else {
		if(t<0)t=0;if(r<0)r=0;if(b<0)b=0;if(b<0)b=0; 
		this.css.clip="rect("+t+","+r+","+b+","+l+")"; 
		if(res){
			if(is.op5){
				this.css.pixelWidth=r; 
				this.css.pixelHeight=b
			} 
			else{
				this.css.width=r; 
				this.css.height=b
			}; 
			this.w=r; 
			this.h=b
		}
	}
}
function layer_resize(width, height) {//alert(width + " " + height);
	this.clipTo(0,width,height,0,true);
}
function createObject(obj) {
	if(!is.ns4) {
		//this.evnt=is.dom && document.getElementById(obj)||is.ie4 && document.all[obj]
		this.evnt=is.dom && document.getElementById(obj)||is.ie4 && document.all[obj]
	}
	else {
		this.evnt=document.layers[obj]?document.layers[obj]:0	
	}
	this.className = this.evnt.className; 
	this.css=is.dom||is.ie4?this.evnt.style:this.evnt;//alert(this.evnt)
	this.moveThis=layer_moveThis;
	this.moveBy=layer_moveBy; 
	this.showThis=layer_showThis; 
	this.hideThis=layer_hideThis;
	this.x = 0;
	this.y = 0;
	this.w = 0;
	this.h = 0;
	this.hh = 0;
	this.ww = 0;
	this.XX = 0;
	this.YY = 0;
	this.zIndex = 100;
	this.getPos = false;
	this.dragable = false;
	this.posRem = false;
	this.obj = obj;
	this.resObj = null;
	this.resize = false;
	this.resThis = layer_resize;
	this.clipTo = layer_resTo;
	this.shftKey = false;
	//eval(this.obj + "=this");
	return this
}
var myLayers = new Array();
var myDiv = new Object();
myDiv.DragOver = null;
myDiv.DragObj = null;
myDiv.offsetX =0;
myDiv.offsetY = 0;
myDiv.total = 0;
myDiv.Prev = null;
function initialize(obj) {
	myObj = obj;
	myDiv.total = myDiv.total + 1;
	if(is.ns4) {
		document.captureEvents(Event.MOUSEMOVE | Event.MOUSEDOWN | Event.MOUSEUP | Event.DBLCLICK)
		//document.ondblclick=monsterdblclick;  
	}
	document.onmousemove=MonsterMouseMove;	
	document.onmousedown=MonsterMouseDown;  
	document.onmouseup=MonsterMouseUp;		
	
	createLayer(myObj);myLayers.push(obj);
	myDiv[obj].getPos = arguments[1];
	myDiv[obj].dragable = arguments[2];

	myDiv[obj].ww = is.dom||is.ie4?myDiv[obj].evnt.offsetWidth:myDiv[obj].evnt.clip.width;
	myDiv[obj].hh = is.dom||is.ie4?myDiv[obj].evnt.offsetHeight:myDiv[obj].evnt.clip.height;
	
	if (arguments[3])
	{
		myDiv[obj].showThis();
	}
	if (arguments[4])
	{
		myDiv[obj].posRem = arguments[4];
		myDiv[obj].getPos = !(arguments[4]);
	}
	else
	{
		myDiv[obj].posRem = false;
	}
	if (arguments[5])
	{
		myDiv[obj].resize = arguments[5];
		//myDiv[obj].resObj = obj+"_res";
		myDiv[obj].resThis(is.dom||is.ie4?myDiv[obj].evnt.offsetWidth:myDiv[obj].evnt.clip.width, is.dom||is.ie4?myDiv[obj].evnt.offsetHeight:myDiv[obj].evnt.clip.height);
	}
	
}

function createLayer(obj) {
	myDiv[obj] = new createObject(obj);
	myDiv[obj].evnt.onmouseover = new Function("layer_over('" + obj + "')");
	myDiv[obj].evnt.onmouseout = new Function("layer_out('" + obj + "')");
	//if(!is.ns4) myDiv[obj].event.ondblclick = new Function(layer_dblclick(" + obj + ")");
}

function layer_over(obj) {
	if (myDiv[obj].dragable || myDiv[obj].resize) {
		tempClass = myDiv[obj].className;
		myDiv[obj].evnt.className = myDiv[obj].className + "Over";
		myDiv.DragOver = obj;
	}
}
function layer_out(obj) {
	if (myDiv[obj].dragable || myDiv[obj].resize) {
		myDiv[obj].evnt.className = tempClass;
		myDiv.DragOver = null;
	}
	//myDiv[obj].hideThis();
}

function MonsterMouseDown(e) {
	var x=(is.ns4 || is.ns6)?e.pageX:event.x||event.clientX
	var y=(is.ns4 || is.ns6)?e.pageY:event.y||event.clientY
	if(is.ie5 || is.ie6) y+=document.body.scrollTop
	var id1=myDiv.DragOver;
	var id;
	if(id1 != null) {
		if (myDiv[id1].resize) myDiv[id1].resObj = id1;//myDiv[id1].resObj = id1 + "_res";
		if (is.ie) {
			if( event.shiftKey ) { myDiv[id1].shftKey = event.shiftKey; }}
			else {
				if (is.ns4) {
					//var mString =(e.modifiers+32).toString(2).substring(3,6);
					//myDiv[id1].shftKey=(mString.charAt(0)=="1");
					myDiv[id1].shftKey = false;
				}
				if (is.ns6) {if (e.shiftKey) { myDiv[id1].shftKey = true}}	
			}
		id=id1; 
		myDiv.DragObj = id; 
		myDiv.offsetX=x-myDiv[id].x; 
		myDiv.offsetY=y-myDiv[id].y
		
		if (myDiv.Prev != null)
		{
			myDiv[id1].css.zIndex = myDiv[myDiv.Prev].css.zIndex + 2
		}
		if(myDiv.total > 1)
		{
			myDiv.Prev = id1;
		}
	}
	else 
		if(is.ns4) routeEvent(e)
}
function getShift(e) {
	var shftKey = false;
	if( e.shiftKey ) { shftKey = e.shiftKey; }
	else if( e.modifiers ) { 
		if( e.modifiers & 4 ) { 
		shftKey = true;
		}
	}alert(shftKey)
	return shftKey;
}
function MonsterMouseMove(e, y) {
	var x=(is.ns4 || is.ns6)?e.pageX:event.x||event.clientX
	y=(is.ns4 || is.ns6)?e.pageY:event.y||event.clientY
	if(is.ie5 || is.ie6) y+=document.body.scrollTop
	var id1=myDiv.DragObj;	
	if(id1 != null) {
		if ((myDiv[myDiv.DragObj].resObj != null) && (myDiv[myDiv.DragObj].shftKey)) {
			var aa = id1;id1 = null;
			var nx=x,ny=y, oldw=myDiv[myDiv.DragObj].rr,oldh=myDiv[myDiv.DragObj].bb,cw= nx -myDiv[myDiv.DragObj].x, ch= ny - myDiv[myDiv.DragObj].y; 
			if(cw<myDiv[myDiv.DragObj].ww) cw=myDiv[myDiv.DragObj].ww; 
			if(ch<myDiv[myDiv.DragObj].hh) ch=myDiv[myDiv.DragObj].hh; //alert(cw + " "+ch)
			myDiv[myDiv.DragObj].resThis(cw,ch)
		}
	}
	//id1=myDiv.DragObj;
	if(id1 != null && myDiv[myDiv.DragObj].dragable) {	
		nx=x-myDiv.offsetX; 
		ny=y-myDiv.offsetY;
		if(ny<10) ny=10; 
		//fix for the resizing window while draging
		if (myDiv[id1].w == 0){ myDiv[id1].css.width = myDiv[id1].ww;}
		if (myDiv[id1].h == 0){ myDiv[id1].css.height = myDiv[id1].hh;}
		
		myDiv[id1].moveThis(nx,ny)
	}
}

function MonsterMouseUp(e){
	if (myDiv.DragObj != null)
	{
		var x=(is.ns4 || is.ns6)?e.pageX:event.x||event.clientX
		var y=(is.ns4 || is.ns6)?e.pageY:event.y||event.clientY
		myDiv[myDiv.DragObj].XX = x;
		myDiv[myDiv.DragObj].YY = y;
		if (!(is.dom))
		{
			myDiv[myDiv.DragObj].css.MozOpacity=1;
		}
		else
		{
			if (is.ns6) {
				myDiv[myDiv.DragObj].css.MozOpacity=1;
			}
			else {
 				myDiv[myDiv.DragObj].css.filter = "Alpha(opacity=100)";
 			}
		}
		myDiv[myDiv.DragObj].shftKey = false;
		myDiv.DragObj = null;
	}
}
function getObj(obj) {
	//var obj1 = new Object;
	if (document.getElementById)
	{
		obj1 = document.getElementById(obj);
	}
	else if (document.all)
	{
		obj1 = document.all[obj];
	}
	else if (document.layers)
	{
		obj1 = document.anchors[obj];
	}
	return obj1;
}

//Get coordinates of a link
function getAnchorPosition(obj) {
	if (typeof(obj) != 'object')
	{
		obj = getObj(obj);
	}
	else { obj = obj}
	var xyCoordinates = new Object;
	var x=0;y=0;w=0;h=0;
	if (is.dom || is.ie4) {
		x = findXY(obj)[0];
		y = findXY(obj)[1];
		w = obj.offsetWidth;
		h = obj.offsetHeight;
	}
	else 
		if (is.ns4) {
			x = findXY(obj)[0];
			y = findXY(obj)[1];
		}
	xyCoordinates.x = x;
	xyCoordinates.y = y;
	xyCoordinates.w = w;
	xyCoordinates.h = h;
	
	return xyCoordinates;
}

function findXY(obj)
{
	var curleft = 0;
	var curtop = 0;
	if (obj.offsetParent)
	{
		curleft = obj.offsetLeft;
		curtop = obj.offsetTop;
		while ((obj = obj.offsetParent) != null)
		{
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop
		}

	}
	else {
		if (obj.x)
			curleft += obj.x;
		if (obj.y)
			curtop += obj.y;
	}
	return [curleft, curtop]
}

//hide an object
function hideObject(objMenu) {
	if (is.dom) {
		if ((document.getElementById(objMenu).style.display == 'none') || document.getElementById(objMenu).style.display == "")
		
		{
			document.getElementById(objMenu).style.display = 'Block';
			if (arguments.length == 3)
			{
				document.getElementById(objMenu+ "_href").innerHTML = arguments[2];
			}
			if (arguments.length == 2)
			{
				arg2 = document.getElementById(objMenu+ "_href").innerHTML;
				document.getElementById(objMenu+ "_href").innerHTML = arguments[1];
			}
		}
		else 
		{
			document.getElementById(objMenu).style.display = 'none';
			if (arguments.length == 3)
			{
				document.getElementById(objMenu+ "_href").innerHTML = arguments[1];
			}
			if (arguments.length == 2)
			{
				document.getElementById(objMenu+ "_href").innerHTML = arg2;
			}
		}
	}
	else {
		if (is.ie4)
		{
			if ((document.all[objMenu].style.display == 'none') || document.all[objMenu].style.display == "")
		
			{
				if (arguments.length > 1)
				{
					document.all[objMenu + "_href"].innerHTML = arguments[2];
				}
				document.all[objMenu].style.display = 'Block';
			}
			else 
			{
				if (arguments.length > 1)
				{
					document.all[objMenu + "_href"].innerHTML = arguments[1];
				}
				document.all[objMenu].style.display = 'none';			
			}		
		}
		//if (is.ns4) {document.layers[objMenu].display = 'none';}
	}
}

//roll over 
var roll;
browser_name = navigator.appName;
browser_version = parseFloat(navigator.appVersion); 
if (browser_name == "Netscape" && browser_version >= 3.0) { 
	roll = 'true'; 
}
else 
	if (browser_name == "Microsoft Internet Explorer" && browser_version >= 4.0) { 
		roll = 'true'; 
	}
	else { 
		roll = 'false'; 
	}


function msover(img,ref) { if (roll == 'true') { document.images[img].src = ref; } }
function msout(img,ref)  { if (roll == 'true') { document.images[img].src = ref; } }