');
this.name = name;
this.parent = parent
this.ref = "divDot" + menuCount;
this.caption = "divCap" + menuCount
if(r) this.radius = r;
else this.radius = 400;
this.subMenus = new Array();
this.state = 0;
this.moving = false;
if(this.parent) this.action = "null";
else this.action = "toggle";
if(this.parent) this.startAngle = parent.startAngle;
else this.startAngle = 0;
getObjectRef(this.ref).objRef = this.name;
this.show = function() { show(this.ref); }
this.hide = function() { hide(this.ref); }
this.moveMe = function(x,y) { if(this.parent) { x += this.parent.x(); y += this.parent.y(); } moveMe(this.ref,x,y); }
this.moveBy = function(x,y) { moveBy(this.ref,x,y); }
this.x = function() { return parseInt(getObjectRef(this.ref).style.left); }
this.y = function() { return parseInt(getObjectRef(this.ref).style.top); }
this.w = function() { return getWidth(this.ref); }
this.h = function() { return getHeight(this.ref); }
this.showCaption = function() {
moveMe(this.caption, this.x() - (getWidth(this.caption)/2) + (this.w()/2), (this.y() + this.h()));
show(this.caption);
}
this.hideCaption = function() {
hide(this.caption);
}
this.setCaption = function(c) { getObjectRef(this.caption).innerHTML = c;}
this.addItem = function(c,action,r) {
getObjectRef(this.ref).className = "dot";
if(!r) r = this.radius/2;
var sub = new menuObject(this.name + ".subMenus[" + this.subMenus.length + "]",0,0,c,r,this);
sub.parent = this;
sub.action = action;
sub.moveMe(0,0);
this.subMenus[this.subMenus.length] = sub;
return sub;
}
this.expand = function() {
if(this.subMenus.length > 0) {
var p = true;
if(this.parent) {
p = !this.parent.moving;
for(var i=0; i.state==0) || (this.parent.subMenus.state==this.parent.subMenus.subMenus.length)) && (this.parent.subMenus.moving==false);
} else var o = false;
if((!this.parent || this.parent.state == this.parent.subMenus.length) && p) {
if(this.parent) this.collapseAll(this.name);
var diff = 360 / this.subMenus.length;
for(var i=0;i.moveMe(0,0);
this.subMenus.show();
this.moving = true;
this.subMenus.slide(this.subMenus.radius * cos(degToRad((diff*i)+this.startAngle)), this.subMenus.radius * sin(degToRad((diff*i)+this.startAngle)), this.name + ".subMenus[" + i + "].showCaption();" + this.name + ".moving=false;" + this.name + ".state+=1;");
}
if(this.parent){
getObjectRef(this.parent.ref).style.filter = "alpha (opacity=33)";
getObjectRef(this.parent.ref).style.MozOpacity = "33%";
getObjectRef(this.parent.ref).className = "dotoff";
getObjectRef(this.parent.caption).style.filter = "alpha (opacity=33)";
getObjectRef(this.parent.caption).style.MozOpacity = "33%";
for(i=0;i.ref).style.filter = "alpha (opacity=66)";
getObjectRef(this.parent.subMenus.ref).style.MozOpacity = "66%";
getObjectRef(this.parent.subMenus.caption).style.filter = "alpha (opacity=66)";
getObjectRef(this.parent.subMenus.caption).style.MozOpacity = "66%";
}
if(this.parent.parent) {
for(i=0;i.ref).style.filter = "alpha (opacity=33)";
getObjectRef(this.parent.parent.subMenus.ref).style.MozOpacity = "33%";
getObjectRef(this.parent.parent.subMenus.ref).className = "dotoff";
getObjectRef(this.parent.parent.subMenus.caption).style.filter = "alpha (opacity=33)";
getObjectRef(this.parent.parent.subMenus.caption).style.MozOpacity = "33%";
}
getObjectRef(this.parent.parent.ref).style.MozOpacity = "33%";
getObjectRef(this.parent.parent.ref).style.MozOpacity = "33%";
getObjectRef(this.parent.parent.ref).className = "dotoff";
}
}
getObjectRef(this.ref).style.filter = "alpha (opacity=66)";
getObjectRef(this.caption).style.filter = "alpha (opacity=66)";
getObjectRef(this.ref).style.MozOpacity = "66%";
getObjectRef(this.caption).style.MozOpacity = "66%";
}
}
}
this.collapse = function() {
var p = true;
p = !this.moving;
for(var i=0; i.state==0) && (this.subMenus.moving==false);
if(p && this.subMenus.length > 0) {
for(var i=0;i.hideCaption();
this.moving = true;
this.subMenus.slide(0, 0, this.name + ".subMenus[" + i + "].hide();" + this.name + ".moving=false;" + this.name + ".state-=1;");
}
if(this.parent){
getObjectRef(this.parent.ref).style.filter = "alpha (opacity=66)";
getObjectRef(this.parent.ref).style.MozOpacity = "66%";
if(this.parent.subMenus.length != 0)
getObjectRef(this.parent.ref).className = "dot";
else
getObjectRef(this.parent.ref).className = "dotempty";
getObjectRef(this.parent.caption).style.filter = "alpha (opacity=66)";
getObjectRef(this.parent.caption).style.MozOpacity = "66%";
for(i=0;i.ref).style.filter = "alpha (opacity=100)";
getObjectRef(this.parent.subMenus.ref).style.MozOpacity = "100%";
if(this.parent.subMenus.subMenus.length != 0)
getObjectRef(this.parent.subMenus.ref).className = "dot";
else
getObjectRef(this.parent.subMenus.ref).className = "dotempty";
getObjectRef(this.parent.subMenus.caption).style.filter = "alpha (opacity=100)";
getObjectRef(this.parent.subMenus.caption).style.MozOpacity = "100%";
}
if(this.parent.parent) {
for(i=0;i.ref).style.filter = "alpha (opacity=66)";
getObjectRef(this.parent.parent.subMenus.ref).style.MozOpacity = "66%";
if(this.parent.parent.subMenus.subMenus.length != 0)
getObjectRef(this.parent.parent.subMenus.ref).className = "dot";
else
getObjectRef(this.parent.parent.subMenus.ref).className = "dotempty";
getObjectRef(this.parent.parent.subMenus.caption).style.filter = "alpha (opacity=66)";
getObjectRef(this.parent.parent.subMenus.caption).style.MozOpacity = "66%";
}
}
}
getObjectRef(this.ref).style.filter = "alpha (opacity=100)";
getObjectRef(this.caption).style.filter = "alpha (opacity=100)";
getObjectRef(this.ref).style.MozOpacity = "100%";
getObjectRef(this.caption).style.MozOpacity = "100%";
}
}
this.collapseAll = function(except) {
for(var i=0;i.name!=except && this.parent.subMenus.state==this.parent.subMenus.subMenus.length) {
this.parent.subMenus.collapse();
}
}
}
this.toggle = function(e) {
if(document.all) id = window.event.srcElement;
else id = e.target;
var dot = eval(id.objRef);
if(dot.state==0 && !dot.moving) dot.expand();
else if(dot.state==dot.subMenus.length && !dot.moving) dot.collapse()
}
this.doAction = function(e) {
if(document.all) id = window.event.srcElement;
else id = e.target;
var dot = eval(id.objRef);
if(dot.action == "toggle") dot.toggle(e);
else eval(dot.action);
}
//change these if you want to change the events that trigger the actions
//========================================================================
//getObjectRef(this.ref).onmousemove = this.toggle;
getObjectRef(this.ref).onmouseup = this.doAction;
this.slide = function(xx,yy,func) {
if(!func) func = "";
var px = this.parent.x();
var py = this.parent.y();
var x = xx - this.x() + px;
var y = yy - this.y() + py;
var d = sqrt(square(xx-this.x() + px) + square(yy-this.y() + py));
var v = d/8;
if(v<1) v = 1;
if( (Math.abs(x) < v) && (Math.abs(y) < v) ) {
moveMe(this.ref,xx + px,yy + py);
if(func != "") eval(func);
} else {
var a = round(atan(x,y));
dx = round(v * cos(degToRad(a)));
dy = round(v * sin(degToRad(a)));
this.moveBy(dx,dy);
setTimeout(this.name + ".slide(" + xx + "," + yy + ", '" + func + "');",10);
}
}
// Preoading the windows filters.
if (menuCount==0 && document.all) document.all[this.ref].style.filter = "alpha (opacity=100)";
menuCount++;
return this;
}
// Math functions
//================
var pi = Math.PI;
function square(x) { return (x*x); }
function sqrt(x) { return Math.sqrt(x); }
function round(x) { return Math.round(x); }
function rand(x,y) { return (round(Math.random()*(y-x)) + x); }
function cos(x) { return Math.cos(x) }
function sin(x) { return Math.sin(x) }
function degToRad(x) { return ( x/(360/(2*pi)) ); }
function radToDeg(x) { return ( x*(360/(2*pi)) ); }
function atan(s,t) {
if( s == 0.0 && t > 0.0)
angle = 90.0;
else if(s == 0.0 && t < 0.0)
angle = 270.0;
else if (s < 0.0 )
angle = 180.0 + radToDeg(Math.atan(t/s));
else if (s > 0.0 && t < 0.0)
angle = 360.0 + radToDeg(Math.atan(t/s));
else {
if(s==0.0) s=0.00001;
angle = radToDeg(Math.atan(t/s));
}
if(angle < 0.0) angle += 360.0;
return angle;
}
if(document.all) pageWidth = document.body.offsetWidth-20;
else pageWidth = innerWidth;
if(document.all) pageHeight = document.body.offsetHeight-4;
else pageHeight = innerHeight;
//Create main menu
var menu = new menuObject("menu",pageWidth/2,pageHeight/2,"Главная",pageHeight/2);
menu.startAngle = -90;
//show menu and caption
menu.show();
menu.showCaption();
//Add submenus
menu.addItem("АРХИВ НОВОСТЕЙ","window.open('/news/news.html')");
menu.addItem("О КОМАНДЕ","toggle");
menu.addItem("СТАТЬИ","toggle");
menu.addItem("ВОПРОСЫ","toggle");
menu.addItem("ОПРОСЫ","toggle");
menu.addItem("РАЗНОЕ","toggle");
menu.addItem("ГОСТЕВАЯ","window.open('http://www.narod.ru/guestbook/?owner=19145037&mainhtml=nk.txt&messageshtml=nkw.txt')");
menu.addItem("НОВОСТИ САЙТА","window.open('/idea/idea.html')");
c = menu.subMenus[1].addItem("О, "СОВА"","toggle");
c.startAngle = 15;
c = menu.subMenus[1].addItem("О "ГиБ"","toggle");
c.startAngle = 15;
menu.subMenus[1].addItem("МО КОЛІР","window.open('/about/kolir.html')");
menu.subMenus[1].subMenus[0].addItem("Оля К.","window.open('/about/sova/kri.html')");
menu.subMenus[1].subMenus[0].addItem("Саша","window.open('/about/sova/kosh.html')");
menu.subMenus[1].subMenus[0].addItem("Оля А.","window.open('/about/sova/azar.html')");
menu.subMenus[1].subMenus[0].addItem("Влад","window.open('/about/sova/xxx.html')");
menu.subMenus[1].subMenus[0].addItem("Вова","window.open('/about/sova/meln.html')");
menu.subMenus[1].subMenus[0].addItem("Ваня","window.open('/about/sova/via.html')");
menu.subMenus[1].subMenus[0].addItem("Алла","window.open('/about/sova/bar.html')");