
Array.prototype.indexOf = function(value)
{
for (ii=0; ii<this.length;ii++)
{
if (this[ii] == value)
{
return ii;
}
}
return -1;
}
Array.prototype.remove = function(index, count)
{
for (this.i=index; this.i <= this.length-count; this.i++)
{
this[this.i] = this[this.i+count];
}
for (this.i=0; this.i < count; this.i++) this.pop(); 
}
String.prototype.remove = function(index, count)
{
start = this.substr(0,index);
end   = this.substr(index+count);
this.value  = start+end;
}
if (Image.prototype)
{
Image.prototype.loaded = function()
{
if (typeof this.complete != "undefined")
{
return this.complete;
}
return (this.naturalWidth > 0);
}
}
if (typeof HTMLImageElement != "undefined")
{
HTMLImageElement.prototype.loaded = function()
{
if (typeof this.complete != "undefined")
{
return this.complete;
}
return (this.naturalWidth > 0);
}
}
ImageLoaded = function(obj)
{
if (!obj)
{
return false;
}
if (typeof obj.complete != "undefined")
{
return obj.complete;
}
if (obj.naturalWidth)
{
return (obj.naturalWidth > 0);
}
return false;
}
if (typeof BUFFER == "undefined")
{
BUFFER = new Array();
}
BOXES = function(){};
BOXES.nextId = 0;
BOXES.objects = new Array();
BOXES.save = function(obj)
{
BOXES.objects.push(obj);
return BOXES.nextId++;
}
BOXES.get = function(id)
{
if (BOXES.objects[id])
{
return BOXES.objects[id];
}
else
{
return null;
}
}
BOXES.object = function(obj)
{
if (!obj)
{
return null;
}
{
this.setPosition = function(position)
{
if (this.currentObject)
{
this.currentObject.style.position = position;
}
}
this.getPosition = function(){return this.currentObject.style.position;};
this.setZ = function(index)
{
if (this.currentObject)
{
this.currentObject.style.zIndex = index;
}
}
this.getZ = function(){return this.currentObject.style.zIndex;};
this.get = function(){return this.currentObject;};
this.setParent = function(obj)
{
if (obj && obj != this.currentParent)
{
if (this.opened)
{
try
{
this.currentParent.removeChild(this.currentObject);
}
catch (e)
{
}
obj.appendChild(this.currentObject);
this.update();
}
this.currentParent = obj;
}
}
this.getParent = function(obj)
{
return this.currentParent;
}
this.setVisibility = function(visibility)
{
this.currentObject.style.visibility = visibility;
}
this.getVisibility = function()
{
if (this.currentObject.style.visibility)
{
return this.currentObject.style.visibility;
}
else
{
return "visible";
}
}
this.close = function()
{
if (this.opened)
{
try
{
this.currentParent.removeChild(this.currentObject);
}
catch (error)
{
}
this.opened = false;
}
}
this.setCenter = function()
{
this.setCentered = true;
}
this.unsetCenter = function()
{
this.setCentered = false;
this.currentObject.style.marginTop  = 0;
this.currentObject.style.marginLeft = 0;
this.move(0,0);
}
this.update = function()
{
if (this.opened && this.setCentered)
{
this.currentObject.style.top = "50%";
this.currentObject.style.left = "50%";
this.currentObject.style.marginLeft = (-parseInt(parseInt(this.currentObject.style.width)/2))+"px";
this.currentObject.style.marginTop = (-parseInt(parseInt(this.currentObject.style.height)/2))+"px";
if (this.currentObject.offsetTop < 0)
{
this.currentObject.style.top = "0px";
this.currentObject.style.marginTop = "0px";
}
if (this.currentObject.offsetLeft < 0)
{
this.currentObject.style.left = "0px";
this.currentObject.style.marginLeft = "0px";
}
}
}
this.open = function()
{
if (this.currentObject && !this.opened)
{
this.currentParent.appendChild(this.currentObject);
this.opened = true;
this.update();
}
}
this.moveTo = function(x, y)
{
if (this.setCentered || !this.currentObject)
{
return false;
}
this.currentObject.style.top  = y+"px";
this.currentObject.style.left = x+"px";
return true;
}
this.move = function(offX, offY)
{
if (this.setCentered || !this.currentObject)
{
return false;
}
offX += (this.currentObject.style.left) ? parseInt(this.currentObject.style.left) : 0;
offY += (this.currentObject.style.top) ? parseInt(this.currentObject.style.top) : 0;
this.currentObject.style.top  = offY+"px";
this.currentObject.style.left = offX+"px";
return true;
}
this.setSize = function(w,h)
{
this.currentObject.style.width = w+"px";
this.currentObject.style.height = h+"px";
this.update();
}
this.getSize = function()
{
size = function(){};
size.width  = (this.currentObject.style.width) ? parseInt(this.currentObject.style.width) : (this.currentObject.width) ? parseInt(this.currentObject.width) : (this.currentObject.naturalWidth) ? parseInt(this.currentObject.naturalWidth) : 0;
size.height = (this.currentObject.style.height) ? parseInt(this.currentObject.style.height) : (this.currentObject.height) ? parseInt(this.currentObject.height) : (this.currentObject.naturalHeight) ? parseInt(this.currentObject.naturalHeight) : 0;
return size;
}
this.getAbsoluteOffset = function()
{
coor= function(){};
coor.X= 0;
coor.Y= 0;
if (!this.opened)
{
return coor;
}
obj= this.currentObject;
coor.X = (obj.style.marginLeft) ? - parseInt(obj.style.marginLeft) : ((obj.style.margin) ? - parseInt(obj.style.margin) : 0);
coor.Y = (obj.style.marginTop) ? - parseInt(obj.style.marginTop) : ((obj.style.margin) ? - parseInt(obj.style.margin) : 0);
if (obj.offsetParent)
{
do
{
coor.X += obj.offsetLeft;
coor.Y += obj.offsetTop;
}
while (obj = obj.offsetParent);
}
else
{
coor.X = parseInt(obj.style.left);
coor.Y = parseInt(obj.style.top);
}
return coor;
}
this.getClientOffset = function()
{
coor= function(){};
coor.X= 0;
coor.Y= 0;
if (!this.opened)
{
return coor;
}
obj= this.currentObject;
coor.X = (obj.style.marginLeft) ? - parseInt(obj.style.marginLeft) : ((obj.style.margin) ? - parseInt(obj.style.margin) : 0);
coor.Y = (obj.style.marginTop) ? - parseInt(obj.style.marginTop) : ((obj.style.margin) ? - parseInt(obj.style.margin) : 0);
if (obj.offsetParent)
{
do
{
coor.X += obj.offsetLeft - ((obj.parentNode.scrollLeft) ? obj.parentNode.scrollLeft : 0);
coor.Y += obj.offsetTop - ((obj.parentNode.scrollTop) ? obj.parentNode.scrollTop : 0);
}
while (obj = obj.offsetParent);
}
else
{
coor.X = parseInt(obj.style.left) - ((obj.parentNode.scrollLeft) ? obj.parentNode.scrollLeft : 0);
coor.Y = parseInt(obj.style.top) - ((obj.parentNode.scrollLeft) ? obj.parentNode.scrollLeft : 0);
}
return coor;
}
}
{
this.opened = false;
this.setCentered = false;
this.id = BOXES.save(this);
this.set(obj);
this.setParent(document.body);
this.setZ(0);
this.move(0,0);
if (!this.currentObject.style.position)
{
this.setPosition("absolute");
}
}
}
{
BOXES.object.prototype.set = function(obj)
{
this.currentObject = obj;
this.currentObject.parent = this;
this.update();
}
}
BOXES.box = function(obj)
{
{
this.getId = function(){return this.currentObject.id;};
this.setTitle = function(title){this.title.appendChild(title);};
this.setTitleClass = function(className)
{
this.title.className = className;
this.closeButton.className = className;
}
this.setCloseButtonClass = function(className)
{
this.closeButtonHTML.className = className;
}
this.setBodyClass = function(className)
{
this.boxBody.className = className;
}
this.setBodyObjectClass = function(className)
{
this.bodyObject.className = className;
}
this.setClass = function(className)
{
this.currentObject.className = className;
}
this.setTitleText = function(text)
{
this.title.innerHTML = text;
}
this.enableCloseButton = function()
{
this.closeButton.appendChild(this.closeButtonHTML);
}
this.disableCloseButton = function()
{
this.closeButton.removeChild(this.closeButtonHTML);
}
}
this.constructor = BOXES.object;
this.constructor(obj);
}
{
BOXES.box.prototype.set = function(obj)
{
if (!obj)
{
return;
}
this.bodyObject = obj;
this.bodyObject.parent = this;
this.currentObject = document.createElement("table");
this.currentObject.setAttribute("cellPadding",0);
this.title= document.createElement("td");
this.closeButton= document.createElement("td");
this.boxBody= document.createElement("td");
this.currentObject.parent= this;
this.title.parent= this;
this.closeButton.parent= this;
this.boxBody.parent= this;
this.closeButtonHTML = document.createElement("a");
this.closeButtonHTML.href = "javascript:void(null)";
this.closeButtonHTML.innerHTML = "X";
this.closeButtonHTML.parent = this;
this.closeButtonHTML.onmousedown = function(e)
{
e = e || window.event;
if (e && e.stopPropagation)
{
e.stopPropagation();
}
else
{
event.cancelBubble=true;
}
}
this.closeButtonHTML.onclick = function()
{
this.parent.close();
}
this.boxBody.appendChild(obj);
this.boxBody.colSpan = 2;
tbody= document.createElement("tbody");
tr1= document.createElement("tr");
tr2= document.createElement("tr");
this.title.style.textAlign = "left";
this.closeButton.style.textAlign="right";
tr1.appendChild(this.title);
tr1.appendChild(this.closeButton);
tr2.appendChild(this.boxBody);
tbody.appendChild(tr1);
tbody.appendChild(tr2);
this.currentObject.appendChild(tbody);
this.enableCloseButton();
}
}
BOXES.option = function (title, message)
{
this.message= document.createElement("td");
this.buttonsHTML= document.createElement("td");
tr1 = document.createElement("tr");
tr2 = document.createElement("tr");
table = document.createElement("table");
tbody = document.createElement("tbody");
table.appendChild(tbody);
tbody.appendChild(tr1);
tbody.appendChild(tr2);
tr1.appendChild(this.message);
tr2.appendChild(this.buttonsHTML);
this.setMessage(message);
this.buttons = new Array();
this.onClicks = new Array();
this.constructor = BOXES.box;
this.constructor(table);
this.setTitleText(title);
{
this.setMessage = function(message){this.message.innerHTML = message;}
this.addButton = function(name, onClick)
{
a = document.createElement("a");
this.onClicks.push(onClick);
this.buttons.push(a);
this.buttonsHTML.appendChild(a);
a.href = "javascript:BOXES.prototype.get("+this.id+").doClick("+(this.buttons.length-1)+")";
a.innerHTML = name;
return this.buttons.length-1;
}
this.removeButton = function(id)
{
if (this.onClicks[id])
{
this.buttonsHTML.removeChild(this.buttons[id]);
this.onClicks[id] = this.onClicks[this.onClicks.length-1];
this.buttons[id]  = this.buttons[this.buttons.length-1];
}
}
this.removeAllButtons = function()
{
for (i = 0; i < this.onClicks.length ; i++ )
{
this.removeButton(i);
}
}
this.updateButton = function(id,name,onClick)
{
if (this.onClicks[id])
{
this.onClicks[id] = onClick;
this.buttons[id].innerHTML = name;
}
}
this.setButtonClass = function(className)
{
for (i = 0; i < this.buttons.length ;i++ )
{
this.buttons[i].setAttribute("className",className);
this.buttons[i].setAttribute("class",className);
}
}
this.setButtonZoneClass = function(className)
{
this.buttonsHTML.setAttribute("className",className);
this.buttonsHTML.setAttribute("class",className);
}
this.setMessageClass = function(className)
{
this.message.setAttribute("className",className);
this.message.setAttribute("class",className);
}
this.doClick = function(btnid)
{
if (this.onClicks[btnid])
{
eval(this.onClicks[btnid]);
}
this.close();
}
}
}
BOXES.progressBar = function(percent,width, height)
{
this.currentObject = document.createElement("table");
this.constructor = BOXES.object;
this.constructor(this.currentObject);
{
this.setClass = function(className){this.get().className = className;};
this.setPercentClass = function(className)
{
this.percent.className = className;
}
this.setLeftClass = function(className)
{
this.left.className = className;
}
this.setPercent = function(percent)
{
if (percent > 100 || percent < 0)
{
return;
}
this.currentPercent = percent;
this.percent.style.width = percent+"%";
this.left.style.width = (100-percent)+"%";
}
this.getPercent = function(){return this.currentPercent;};
this.increase = function(amount){this.setPercent(this.currentPercent+amount);};
this.decrease = function(amount){this.setPercent(this.currentPercent-amount);};
}
tbody= document.createElement("tbody");
tr= document.createElement("tr");
td1= document.createElement("td");
td2= document.createElement("td");
this.currentObject.setAttribute("cellPadding",0);
this.currentObject.setAttribute("cellSpacing",0);
this.percent = td1;
this.left = td2;
this.setPercent(percent);
this.setSize(width,height);
tbody.appendChild(tr);
tr.appendChild(td1);
tr.appendChild(td2);
this.currentObject.appendChild(tbody);
}
BOXES.progressBar.prototype.set = BOXES.object.prototype.set;
BOXES.pagination = function(quantity, handler)
{
this.constructor = BOXES.object;
this.constructor(document.createElement("div"));
{
this.setClass = function(className)
{
this.get().className = className;
}
this.setNormalPageClass = function(className)
{
this.pageNormalClass = className;
this.reset();
}
this.setActivatedPageClass = function(className)
{
this.pageActiveClass = className;
if (typeof this.pages[this.currentPage] != "undefined")
{
this.pages[this.currentPage] = this.pageNormalClass;
}
}
this.setQuantity = function(pageQuantity)
{
if (this.pageQuantity != pageQuantity)
{
this.pageQuantity = pageQuantity;
this.reset();
}
}
this.setCurrentPage = function(cPage)
{
if (cPage <= this.pageQuantity && cPage > 0 && cPage != this.currentPage && !this.isDisable)
{
if (this.pages[this.currentPage])
{
this.pages[this.currentPage].className = this.pageNormalClass;
}
this.currentPage = cPage;
this.reset();
if (this.handler != null)
{
this.handler(cPage);
}
}
}
this.enableShowAll = function()
{
this.showAll = true;
}
this.disableShowAll = function()
{
this.showAll = false;
}
this.setHandler = function(pHandler)
{
this.handler = pHandler;
}
this.disable = function()
{
this.isDisable = true;
}
this.enable = function()
{
this.isDisable = false;
}
this.addPage = function(number)
{
BUFFER.push(((typeof page != "undefined") ? page : null))
page = document.createElement("a");
page.href = "javascript:BOXES.get("+this.id+").setCurrentPage("+number+")";
page.innerHTML = number;
this.pages[number] = page;
page.className = this.pageNormalClass;
this.get().appendChild(page);
page = BUFFER.pop();
}
this.addSpacer = function()
{
this.spacers.push(this.spacer.cloneNode(true));
this.get().appendChild(this.spacers[this.spacers.length-1]);
}
this.setSpacer = function(spacer)
{
this.spacer = spacer;
}
this.reset = function()
{
if (this.currentPage == 0 || this.isDisable)
{
return;
}
BUFFER.push(((typeof i != "undefined") ? i : null));
BUFFER.push(((typeof start != "undefined") ? start : null));
BUFFER.push(((typeof end != "undefined") ? end : null));
while (this.pages.length > 0)
{
i = this.pages.pop();
if (typeof i != "undefined")
{
this.get().removeChild(i);
}
}
while (this.spacers.length > 0){this.get().removeChild(this.spacers.pop());};
if (this.showAll == true)
{
for (i = 1; i <= this.pageQuantity ; i++ )
{
this.addPage(i);
}
}
else
{
for (i = 1; i <= this.partQuantity && i <= this.pageQuantity ; i++ )
{
this.addPage(i);
}
start = this.currentPage - parseInt(this.partQuantity/2);
if (start+this.partQuantity > this.pageQuantity+1)
{
start = this.pageQuantity-this.partQuantity+1;
}
end = start+this.partQuantity;
if (start <= this.partQuantity)
{
start = this.partQuantity+1;
}
if (start > this.partQuantity+1)
{
this.addSpacer();
}
for (i=start; i < end && i <= this.pageQuantity; i++ )
{
this.addPage(i);
}
if (i+this.partQuantity < this.pageQuantity+1 )
{
this.addSpacer();
}
start = Math.max(i,this.pageQuantity-this.partQuantity+1);
for (i = start; i <= this.pageQuantity ; i++ )
{
this.addPage(i);
}
}
if (this.pages[this.currentPage])
{
this.pages[this.currentPage].className = this.pageActiveClass;
}
end= BUFFER.pop();
start= BUFFER.pop();
i= BUFFER.pop();
}
this.setPartQuantity = function(partQuantity)
{
this.partQuantity = partQuantity;
this.reset();
}
}
{
this.isDisable = false;
this.showAll = false;
this.currentPage = 0;
this.pageQuantity = 0;
this.partQuantity = 3;
this.handler = null;
this.pages = new Array();
this.spacers = new Array();
this.spacer = document.createElement("span");
this.spacer.innerHTML = "&nbsp;...&nbsp;";
this.pageNormalClass = "";
this.pageActiveClass = "";
}
this.setQuantity(quantity);
this.setHandler(handler);
}
BOXES.pagination.prototype.set = BOXES.object.prototype.set;
MOUSE = function()
{
this.markedX = 0;
this.markedY = 0;
}
MOUSE.posX = 0;
MOUSE.posY = 0;
MOUSE.onmousemove = new Array();
MOUSE.addOnmousemove = MOUSE.prototype.addOnmousemove = function(func)
{
MOUSE.onmousemove.push(func);
}
MOUSE.removeOnmousemove = MOUSE.prototype.removeOnmousemove = function(func)
{
id = MOUSE.onmousemove.indexOf(func);
if (id >= 0)
{
MOUSE.onmousemove.remove(id,1);
}
}
MOUSE.onmousedown = new Array();
MOUSE.addOnmousedown = MOUSE.prototype.addOnmousedown = function(func)
{
MOUSE.onmousedown.push(func);
}
MOUSE.removeOnmousedown = MOUSE.prototype.removeOnmousedown = function(func)
{
id = MOUSE.onmousedown.indexOf(func);
if (id >= 0)
{
MOUSE.onmousedown.remove(id,1);
}
}
MOUSE.onmouseup = new Array();
MOUSE.addOnmouseup = MOUSE.prototype.addOnmouseup = function(func)
{
MOUSE.onmouseup.push(func);
}
MOUSE.removeOnmouseup = MOUSE.prototype.removeOnmouseup = function(func)
{
id = MOUSE.onmouseup.indexOf(func);
if (id >= 0)
{
MOUSE.onmouseup.remove(id,1);
}
}
MOUSE.onclick = new Array();
MOUSE.addOnclick = MOUSE.prototype.addOnclick = function(func)
{
MOUSE.onclick.push(func);
}
MOUSE.removeOnclick = MOUSE.prototype.removeOnclick = function(func)
{
id = MOUSE.onclick.indexOf(func);
if (id >= 0)
{
MOUSE.onclick.remove(id,1);
}
}
MOUSE.prototype.getOffsetX = function()
{
return (MOUSE.posX - this.markedX);
}
MOUSE.prototype.getOffsetY = function()
{
return (MOUSE.posY - this.markedY);
}
MOUSE.prototype.rememberPosition = function()
{
this.markedX = MOUSE.posX;
this.markedY = MOUSE.posY;
}
MOUSE.getAbsoluteX = MOUSE.prototype.getAbsoluteX = function()
{
return MOUSE.posX;
}
MOUSE.getAbsoluteY = MOUSE.prototype.getAbsoluteY = function()
{
return MOUSE.posY;
}
MOUSE.getClientX = MOUSE.prototype.getClientX = function()
{
return MOUSE.posX - document.body.scrollLeft - document.documentElement.scrollLeft;
}
MOUSE.getClientY = MOUSE.prototype.getClientY = function()
{
return MOUSE.posY - document.body.scrollTop - document.documentElement.scrollTop;
}
MOUSE.prototype.getMarkedX = function()
{
return this.markedX;
}
MOUSE.prototype.getMarkedY = function()
{
return this.markedY;
}
MOUSE.getCurrentObject = MOUSE.prototype.getCurrentObject = function()
{
currentObject = null;
for (this.i = 0; this.i < BOXES.objects.length ; this.i++ )
{
pos= BOXES.objects[this.i].getAbsoluteOffset();
size= BOXES.objects[this.i].getSize();
pos.X= MOUSE.getAbsoluteX()-pos.X;
pos.Y= MOUSE.getAbsoluteY()-pos.Y;
if (pos.X > 0 && size.width > pos.X && pos.Y > 0 && size.height > pos.Y)
{
if (!currentObject || currentObject.getZ() < BOXES.objects[this.i].getZ())
{
currentObject = BOXES.objects[this.i];
}
}
}
return currentObject;
}
MOUSE.stopPropagation = MOUSE.prototype.stopPropagation = function(e)
{
e = e || window.event;
if (!e)
{
return;
}
if (e.stopPropagation)
{
e.stopPropagation();
}
else
{
e.cancelBubble=true;
}
}
MOUSE.cursors = function(){};
MOUSE.cursors.auto= "auto";
MOUSE.cursors.allScroll = "all-scroll";
MOUSE.cursors.crossHair = "crosshair";
MOUSE.cursors.Default= "default";
MOUSE.cursors.help= "help";
MOUSE.cursors.inherit= "inherit";
MOUSE.cursors.move= "move";
MOUSE.cursors.pointer= "pointer";
MOUSE.cursors.progress= "progress";
MOUSE.cursors.text= "text";
MOUSE.cursors.verticalText= "vertical-text";
MOUSE.cursors.wait= "wait";
MOUSE.cursors.noDrop= "no-drop";
MOUSE.cursors.notAllowed = "not-allowed";
MOUSE.cursors.eResize= "e-resize";
MOUSE.cursors.nResize= "n-resize";
MOUSE.cursors.sResize= "s-resize";
MOUSE.cursors.wResize= "w-resize";
MOUSE.cursors.colResize= "col-resize";
MOUSE.cursors.rowResize= "row-resize";
MOUSE.cursors.neResize= "ne-resize";
MOUSE.cursors.nwResize= "nw-resize";
MOUSE.cursors.seResize= "se-resize";
MOUSE.cursors.swResize= "sw-resize";
MOUSE.setCursor = MOUSE.prototype.setCursor = function(cursor)
{
document.body.style.cursor = cursor;
}
MOUSE.onmousemoveEvent = function( e )
{
if (!e)
{
e = window.event;
}
if (e.pageX && e.pageY)
{
MOUSE.posX = e.pageX;
MOUSE.posY = e.pageY;
}
else if (e.clientX && e.clientY)
{
MOUSE.posX = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
MOUSE.posY = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
}
else
{
MOUSE.posX = 0;
MOUSE.posY = 0;
}
for (this.i = 0; this.i < MOUSE.onmousemove.length ; this.i++ )
{
try
{
MOUSE.onmousemove[this.i]( e );
}
catch ( error )
{
try
{
MOUSE.onmousemove[this.i]();
}
catch ( error )
{
eval(MOUSE.onmousemove[this.i]);
}
}
}
}
MOUSE.onmousedownEvent = function( e )
{
if (!e)
{
e = window.event;
}
for (this.i = 0; this.i < MOUSE.onmousedown.length ; this.i++ )
{
try
{
MOUSE.onmousedown[this.i]( e );
}
catch ( error )
{
try
{
MOUSE.onmousedown[this.i]();
}
catch ( error )
{
eval(MOUSE.onmousedown[this.i]);
}
}
}
}
MOUSE.onmouseupEvent = function( e )
{
if (!e)
{
e = window.event;
}
for (this.i = 0; this.i < MOUSE.onmouseup.length ; this.i++ )
{
try
{
MOUSE.onmouseup[this.i]( e );
}
catch ( error )
{
try
{
MOUSE.onmouseup[this.i]();
}
catch ( error )
{
eval(MOUSE.onmouseup[this.i]);
}
}
}
}
MOUSE.onclickEvent = function( e )
{
if (!e)
{
e = window.event;
}
for (this.i = 0; this.i < MOUSE.onclick.length ; this.i++ )
{
try
{
MOUSE.onclick[this.i]( e );
}
catch ( error )
{
try
{
MOUSE.onclick[this.i]();
}
catch ( error )
{
eval(MOUSE.onclick[this.i]);
}
}
}
}
document.onmousemove= MOUSE.onmousemoveEvent;
document.onmousedown= MOUSE.onmousedownEvent;
document.onmouseup= MOUSE.onmouseupEvent;
document.onclick= MOUSE.onclickEvent;
MOUSE.preventDefault = function(e)
{
e = e || window.event;
if (e && e.preventDefault)
{
e.preventDefault();
return true;
}
return false;
}
MOUSE.fromElement = function(e)
{
e = e || window.event;
return  (e.relatedTarget || e.toElement);
}
MOUSE.targetElement = function(e)
{
e = e || window.event;
return (e.relatedTarget || e.fromElement);
}
MOUSE.clickedButton = MOUSE.prototype.clickedButton = function(e)
{
e = window.event || e;
if (typeof e.which != "undefined")
{
switch(e.which)
{
case 3:return MOUSE.button.right;
case 1:return MOUSE.button.left;
case 0:return MOUSE.button.middle;
default:return MOUSE.button.unknown;
}
}
else if (typeof e.button != "undefined")
{
switch(e.button)
{
case 2: return MOUSE.button.right;
case 1: return MOUSE.button.left;
case 4: return MOUSE.button.middle;
default:return MOUSE.button.unknown;
}
}
return MOUSE.button.unknown;
}
MOUSE.button = function(){};
MOUSE.button.left = 0;
MOUSE.button.right = 1;
MOUSE.button.middle = 2;
MOUSE.button.unknown = 3;
bodyIsLoaded = false;
function activeButton(btnObj,ontop)
{
document.getElementById("left"+btnObj).src = "temp/menuActive.left.png";
document.getElementById("right"+btnObj).src = "temp/menuActive.right.png";
document.getElementById("cont"+btnObj).className = "buttonMenuOver";
if (ontop)
{
document.getElementById("btn"+btnObj).style.zIndex = 10;
}
}
function normalizeButton(btnObj)
{
document.getElementById("left"+btnObj).src = "temp/menu.left.png";
document.getElementById("right"+btnObj).src = "temp/menu.right.png";
document.getElementById("cont"+btnObj).className = "buttonMenu";
document.getElementById("btn"+btnObj).style.zIndex = document.getElementById("btn"+btnObj).zIndex;
}
if (typeof currentButton == "undefined")
{
currentButton = null;
}
function bodyLoaded()
{
if (bodyIsLoaded) return;
try
{
for(this.i = 0; this.i < 6; this.i++)
{
document.getElementById("mainMenu").getElementsByTagName("a")[this.i].zIndex = document.getElementById("mainMenu").getElementsByTagName("a")[this.i].style.zIndex;
document.getElementById("mainMenu").getElementsByTagName("a")[this.i].onmouseover = function()
{
MOUSE.setCursor(MOUSE.cursors.pointer);
if (this.id.substr(3) != currentButton)
{
activeButton(this.id.substr(3));
}
}
document.getElementById("mainMenu").getElementsByTagName("a")[this.i].onmouseout = function()
{
MOUSE.setCursor(MOUSE.cursors.Default);
if (this.id.substr(3) != currentButton)
{
normalizeButton(this.id.substr(3));
}
}
document.getElementById("mainMenu").getElementsByTagName("a")[this.i].onclick = function()
{
if (this.id.substr(3) != currentButton)
{
if (currentButton)
{
normalizeButton(currentButton);
}
else
{
activeButton(this.id.substr(3),true);
currentButton = this.id.substr(3);
}
}
}
}
bodyIsLoaded = true;
}
catch(ex)
{}
}
bodyLoaded();

