var browser;
var isaMac;

if (navigator.userAgent.indexOf("Mac") != -1) {isaMac="true";} 
var styleTmp = " ";

if (((navigator.appName.indexOf("Netscape") != -1)) && (parseInt(navigator.appVersion) < 5))
{
browser = 'NS4';
}
else if (navigator.appName.indexOf("Microsoft") != -1)
{
browser = 'IE';
}
else if (((navigator.appName.indexOf("Netscape") != -1)) && (parseInt(navigator.appVersion) >= 5))
{
browser = 'Mozilla';
}
else if (navigator.appName.indexOf("Konqueror") != -1)
{
browser = 'Mozilla';
}
var agt=navigator.userAgent.toLowerCase();
var isIE4 = (agt.indexOf("msie 5")==-1) 

function makeStyle(id,left,width,height,top,fontsize,bottomBorder,topBorder,rightBorder,leftBorder,padding)
{

var d = window.document;
styleTmp = '#' + id + ' {position:absolute;';
styleTmp = styleTmp + 'visibility: hide; visibility: hidden;';

if(!(top)){ top='0'; }
if (left) { styleTmp = styleTmp + 'left:' + left + ';'; }
if (width) styleTmp = styleTmp + 'width:' + width + ';';
if (top) styleTmp = styleTmp + 'top:' + top + ';';

styleTmp = styleTmp + 'z-Index: 5;';
styleTmp = styleTmp + 'font-family: Arial, Helvetica, sans-serif;';
if (fontsize) styleTmp = styleTmp + 'font-size: ' + fontsize + ';';

if ((padding)&&(!(browser=="NS4"))&&((!(isaMac=="true"))||(!(isIE4))) )
{ 
styleTmp = styleTmp + 'padding-top: ' + padding + 'px; padding-bottom: ' + padding + 'px;'
}
else 
{ 
styleTmp = styleTmp + 'padding-top: ' + padding + 'px;'

if((isaMac=="true") && (isIE4)) 
{
styleTmp = styleTmp + 'height: ' + (height-3) + 'px;';
}
}
if((!(padding))&&(browser=="Mozilla")){ styleTmp = styleTmp + 'padding-bottom: ' + 3 + 'px;'}

if (bottomBorder)
{
styleTmp = styleTmp + 'border-bottom-width: 1px;';
styleTmp = styleTmp + 'border-bottom: 1px solid #7788A0;';
} 
if (rightBorder)
{ 
styleTmp = styleTmp + 'border-right-width:1px;';
styleTmp = styleTmp + 'border-right: 1px solid #7788A0;';
}
if (leftBorder)
{
styleTmp = styleTmp + 'border-left-width:1px;';
styleTmp = styleTmp + 'border-left: 1px solid #7788A0;';
}
if (topBorder)
{
styleTmp = styleTmp + 'border-top-width:1px;';
styleTmp = styleTmp + 'border-top: 1px solid #7788A0;';
}
styleTmp = styleTmp + '}';

{

d.writeln(styleTmp);
styleTmp = "";
}
}

// Menu has been designed by SHANMUGAM K. email : sunifnb@yahoo.com

function DivEl(menuParent,window,id,body,arrow)
{

this.menuParent = menuParent;
this.window = window;
this.id = id;
this.body = body;
this.arrow = arrow;

DivEl.prototype.output = function() 
{

var d = this.window.document; 

d.write('<DIV ID="' + this.id + '">');
d.write('&nbsp; ' + this.body);
if(this.arrow == 1) 
{
d.write('&nbsp;<img src=images/spc.gif>&nbsp;');
}

d.write('</DIV>');

switch (browser)
{
case "NS4" :
this.layer = d[this.id]; 
this.layer.visibility = "hide";
break
case "IE" :
this.element = d.all[this.id];
this.style = this.element.style;
this.style.visibility = "hidden"; 
break
case "Mozilla" :
this.element = d.getElementById(this.id);
this.style = this.element.style;
this.style.visibility = "hidden"; 
break
}
}

if (browser=="NS4")
{

DivEl.prototype.moveTo = function(x,y) { this.layer.moveTo(x,y); }
DivEl.prototype.moveBy = function(x,y) { this.layer.moveBy(x,y); }
DivEl.prototype.show = function() { this.layer.visibility = "show"; }
DivEl.prototype.hide = function() { this.layer.visibility = "hide"; }
DivEl.prototype.setStackingOrder = function(z) { this.layer.zIndex = z; }
DivEl.prototype.setBgColor = function(color) { this.layer.bgColor = color; }
DivEl.prototype.setFgColor = function(color) { this.layer.color = color; }
DivEl.prototype.setBgImage = function(image) { this.layer.background.src = image; }
DivEl.prototype.setCursor = function(cursor) { }

DivEl.prototype.getX = function() { return this.layer.left; }
DivEl.prototype.getY = function() { return this.layer.top; }
DivEl.prototype.getWidth = function() { return this.layer.width; }
DivEl.prototype.getHeight = function() { return this.layer.height; }
DivEl.prototype.getStackingOrder = function() { return this.layer.zIndex; }
DivEl.prototype.isVisible = function() { return this.layer.visibility=="show" ; }

DivEl.prototype.setBody = function() 
{
for(var i=0; i < arguments.length; i++)
this.layer.document.write(arguments[i]);
this.layer.document.close();
}


DivEl.prototype.addEventHandler = function(eventname, handler)
{
this.layer.captureEvents(DivEl._eventmasks[eventname]);
var dynel = this;
this.layer[eventname] = function(event) 
{
return handler(dynel, event.type, event.x, event.y,
event.which, event.which, 
((event.modifiers & Event.SHIFT_MASK) !=0),
((event.modifiers & Event.CTRL_MASK) !=0),
((event.modifiers & Event.ALT_MASK) !=0));
}
} 

DivEl.prototype.removeEventHandler = function(eventname)
{
this.layer.releaseEvents(DivEl._eventmasks[eventname]);
delete this.layer[eventname];
}


DivEl._eventmasks = {
onabort:Event.ABORT, onblur:Event.BLUR, onchange:Event.CHANGE,
onclick:Event.CLICK, ondblclick:Event.DBLCLICK,
ondraganddrop:Event.DRAGDROP, onerror:Event.ERROR,
onfocus:Event.FOCUS, onkeydown:Event.KEYDOWN, onkeypress:Event.KEYPRESS,
onkeyup:Event.KEYUP, onload:Event.LOAD, onmousedown:Event.MOUSEDOWN,
onmouseover:Event.MOUSEOVER, onmouseup:Event.MOUSEUP, onmove:Event.MOVE, 
onreset:Event.RESET, onresize:Event.RESIZE, onselect:Event.SELECT, 
onsubmit:Event.SUBMIT, onunload:Event.UNLOAD
};


} 

if((browser=="IE"))
{

DivEl.prototype.moveTo = function(x,y)
{
this.style.pixelLeft = x;
this.style.pixelTop = y;
}
DivEl.prototype.moveBy = function(x,y)
{
this.style.pixelLeft += x;
this.style.pixelTop += y;
}


DivEl.prototype.show = function() { this.style.visibility = "visible"; }
DivEl.prototype.hide = function() { this.style.visibility = "hidden"; }
DivEl.prototype.setStackingOrder = function(z) { this.style.zIndex = z; }
DivEl.prototype.setBgColor = function(color) { this.style.backgroundColor = color; }
DivEl.prototype.setBgImage = function(image) { this.style.backgroundImage = 'url(' + image + ')'; }

DivEl.prototype.setCursor = function(cursor) { this.style.cursor = cursor; }

DivEl.prototype.getX = function() { return this.style.pixelLeft; }
DivEl.prototype.getY = function() { return this.style.pixelTop; }
DivEl.prototype.getWidth = function() { return this.style.width; }
DivEl.prototype.getHeight = function() { return this.style.height; }
DivEl.prototype.getStackingOrder = function() { return this.style.zIndex; }
DivEl.prototype.isVisible = function() { return this.style.visibility == "visible"; } 
DivEl.prototype.getCursor = function() { return this.style.cursor; }

DivEl.prototype.setBody = function() 
{
var body = "";
for(var i =0; i < arguments.length; i++) {
body += arguments[i] + "\n";
}

this.element.innerHTML = body;
} 

DivEl.prototype.addEventHandler = function(eventname, handler)
{
var dynel = this;

this.element[eventname] = function()
{
var e = dynel.window.event;
e.cancelBubble = true;
return handler(dynel, e.type, e.x, e.y, e.button, e.keyCode, e.shiftKey, e.ctrlKey, e.altKey);
}
}

DivEl.prototype.removeEventHandler = function(eventname) 
{ 
this.element[eventname] = null;
}

} 


if(browser=="Mozilla")
{

DivEl.prototype.moveTo = function(x,y)
{
this.style.left = x;
this.style.top = y;
}
DivEl.prototype.moveBy = function(x,y)
{
this.style.left += x;
this.style.top += y; 
}


DivEl.prototype.show = function() { this.style.visibility = "visible"; }
DivEl.prototype.hide = function() { this.style.visibility = "hidden"; }
DivEl.prototype.setStackingOrder = function(z) { this.style.zIndex = z; }
DivEl.prototype.setBgColor = function(color) { this.style.backgroundColor = color; }
DivEl.prototype.setBgImage = function(image) { this.style.backgroundImage = 'url(' + image + ')'; }
DivEl.prototype.setCursor = 
function(cursor) 
{ 
if (cursor=="hand") { cursor = "pointer";}
this.style.cursor = cursor; 
}

DivEl.prototype.getX = function() { return this.style.pixelLeft; }
DivEl.prototype.getY = function() { return this.style.pixelTop; }
DivEl.prototype.getWidth = function() { return this.style.width; }
DivEl.prototype.getHeight = function() { return this.style.height; }
DivEl.prototype.getStackingOrder = function() { return this.style.zIndex; }
DivEl.prototype.isVisible = function() { return this.style.visibility == "visible"; }

DivEl.prototype.setBody = function() 
{
var body = "";
for(var i =0; i < arguments.length; i++) {
body += arguments[i] + "\n";
}

this.element.innerHTML = body;
} 

DivEl.prototype.addEventHandler= function(event, handler, otherparm, secondparm, thirdparm)
{
var DivEl = this;
eventname = event.replace(/on/i, "");
handler._ieEmuEventHandler = function(e) 
{
window.event = e;
return handler(DivEl, e.type, e.clientX, e.clientY, e.button, e.keyCode, e.shiftKey, e.ctrlKey, e.altKey, otherparm, secondparm, thirdparm);
}
this.element.addEventListener( eventname, handler._ieEmuEventHandler, false);

}

DivEl.prototype.removeEventHandler = function(event) 
{
eventname = event.replace(/on/i, "");
this.element.removeEventListener(eventname);

}


} 

}
