
var mainTableWidth = 750;
var browserName = navigator.appName;

if (browserName == "Netscape") {
v  = ".top";
l  = ".left";
dS = "document.";
sD = "";
y  = "window.pageYOffset";
iW = "window.innerWidth";
iH = "window.innerHeight";
oW = -8;
}
else {
v  = ".pixelTop";
l  = ".pixelLeft";
dS = "";
sD = ".style";
y  = "document.body.scrollTop";
iW = "document.body.clientWidth";
iH = "document.body.clientHeight";
oW = 0;
}

var dhtml         = null; // Our layer
var isOver        = true;
var myTimer       = setTimeout("HideDHTML()",300);
var intCurrent    = -1;
var intNew        = -2;

var ns4 = (document.layers)? true:false
var ie4 = (document.all)? true:false

if ((ns4) || (ie4)) {
} else {
	PopUp = no_PopUp;
}

function SetValLayS(lay,valt) {
 if (ns4) {
   lay.width=valt;
  }
 if (ie4) {
   lay.style.width=valt;
  }
}


function SetValLay(lay,valt,vall) {
 if (ns4) {
   lay.top=valt;
   lay.left=vall;
  }
 if (ie4) {
   lay.style.top=valt;
   lay.style.left=vall;
  }
}

function SetValPic(pic,valw,valh) {
 pic.width=valw;
 pic.height=valh;
}

function MyResize() {
ws=eval(iW);
 if (ws<=1003) {addx=1;} else if (ws>1003) {addx = (ws-982)/2;}
 SetValLayS(areainfo,ws-(250+2*addx));

 if (ws>1003) {
  for ($n=0;$n<=2;$n++) {
   gposX[$n] = gposX[$n]-addx;
  }
 addx = (ws-982)/2;
  for ($n=0;$n<=2;$n++) {
   gposX[$n] = gposX[$n]+addx;
  }
 SetValLay(Lay1,10,10+addx);
 SetValLay(Lay2,105,10+addx);
 SetValLay(topLay,9,250+addx);
 SetValLay(Lay3,190,10+addx);
 SetValLay(Lay5,215,10+addx);
 SetValLay(LayL5,245,10+addx);
 SetValLay(Lay9,275,10+addx);
 SetValLay(LayL8,305,10+addx);
 SetValLay(LayL1,190,40+addx);
 SetValLay(L2_1,215,40+addx);
 SetValLay(L2,215,95+addx);
 SetValLay(L3_1,244,40+addx);
 SetValLay(L3,244,88+addx);
 SetValLay(L4_1,274,40+addx);
 SetValLay(L4,274,68+addx);
 SetValLay(L5,305,38+addx);
 SetValLay(L6,335,15+addx);
 SetValLay(BookLay,380,20+addx);
 SetValLay(areainfo,200,250+addx);
 SetValLay(addhead,130,250+addx);
// SetValLay(forolmer,10,840+addx);
 SetValLay(topmenu,10,840+addx);
 }
}

function SetCit() {
 var m_frame = self;
 var r = Math.random();
 nn = Cit_texts.length-1;
 r=Math.round(r*nn);
 ws=eval(iW);
 addx = (ws-982);
 ws=screen.width;
 adw=ws-285-addx;
 if (ws==800) {
   adw=ws-250;
  }
 tt = "<table width=\""+adw+"\" id=up border=0><tr><td align=right>"+Cit_texts[r]+"</td></tr></table>";
 if (ns4) { dhtml = m_frame.document.addhead;}
 if (ie4) { dhtml = m_frame.addhead.style;}
 if (ns4) {
  var lyr = dhtml.document;
//  lyr.write(tt);
  lyr.close();
 }
 else if (ie4) {
  m_frame.document.all["addhead"].innerHTML = tt;
  }
}

function sw() {
var m_frame = self;
if (ie4) {
  dhtml = m_frame.AllLay.style;
  dhtml.visibility = "visible";
 } else {
   dhtml = m_frame.document.AllLay;
   dhtml.visibility = "show"; 
  }
}

function AllSize() {
 SetSize();
 SetCit();
 sw();
}

function SetSize() {
 var m_frame = self;

 sW=screen.width;
 ws=eval(iW);
 if (sW == 1024) {

 } else if (sW==800) {
 SetValPic(pic1,187,74);
 SetValLay(Lay2,84,10);
 SetValPic(pic2_4,187,66);
 SetValLay(topLay,9,197);
 SetValPic(toppic,579,111);
 SetValLay(Lay3,150,10);
 SetValPic(pic2_6,24,19);
 SetValLay(Lay5,169,10);
 SetValPic(pic2_8,24,24);
 SetValLay(LayL5,193,10);
 SetValPic(picL5,24,24);
 SetValLay(Lay9,217,10);
 SetValPic(pic9,24,24);
 SetValLay(LayL8,241,10);
 SetValPic(picL8,24,19);
 SetValLay(LayL1,150,34);
 SetValPic(picL1,164,19);
 SetValLay(L2_1,169,34);
 SetValPic(p2_1,43,22);
 SetValLay(L2,169,74);
 SetValPic(pic2,121,24);
 SetValLay(L3_1,191,34);
 SetValPic(p3_1,34,24);
 SetValLay(L3,191,69);
 SetValPic(pic3,121,24);
 SetValLay(L4_1,215,34);
 SetValPic(p4_1,18,24);
 SetValLay(L4,215,53);
 SetValPic(pic4,121,24);
 SetValLay(L5,239,35);
 SetValPic(pic5,121,24);
 SetValLay(L6,263,15);
 SetValPic(pic6,121,24);
 SetValLay(BookLay,296,16);

// SetValLay(forolmer,10,630);

 SetValLay(MainLay,-2,76);
 SetValLay(Forum,1,35);
 SetValLay(Path,1,35);
 SetValLay(People,1,35);
 SetValLay(Twor,1,35);
 SetValLay(Konk,1,35);

 SetValPic(bookpic,116,276);

 SetValLay(areainfo,156,240);
 SetValLay(addhead,100,165);
 SetValLay(topmenu,10,630);

  for ($n=0;$n<=2;$n++) {
   gposX[$n] = 800*gposX[$n]/1024+15;
   gposY[$n] = 800*gposY[$n]/1024;
 }
} else if (sW>1024) {
// MyResize();
 addx = (ws-982)/2;
 SetValLay(Lay1,10,10+addx);
 SetValLay(Lay2,105,10+addx);
 SetValLay(topLay,9,250+addx);
 SetValLay(Lay3,190,10+addx);
 SetValLay(Lay5,215,10+addx);
 SetValLay(LayL5,245,10+addx);
 SetValLay(Lay9,275,10+addx);
 SetValLay(LayL8,305,10+addx);
 SetValLay(LayL1,190,40+addx);
 SetValLay(L2_1,215,40+addx);
 SetValLay(L2,215,95+addx);
 SetValLay(L3_1,244,40+addx);
 SetValLay(L3,244,88+addx);
 SetValLay(L4_1,274,40+addx);
 SetValLay(L4,274,68+addx);
 SetValLay(L5,305,38+addx);
 SetValLay(L6,335,15+addx);
 SetValLay(BookLay,380,20+addx);
 SetValLay(areainfo,200,250+addx);

 SetValLayS(areainfo,ws-(250+addx)-addx);

// SetValLay(forolmer,10,840+addx);

 SetValLay(addhead,130,250+addx);
 SetValLayS(MainLay,200);
 SetValLayS(Forum,200);
 SetValLayS(Path,200);
 SetValLayS(People,200);
 SetValLayS(Twor,200);
 SetValLayS(Konk,200);


 SetValLay(topmenu,10,840+addx);
  for ($n=0;$n<=2;$n++) {
   gposX[$n] = gposX[$n]+addx;
 }
 }
}


function no_PopUp() {
	return true;
}

function menuon(imgname,npath,num) {
 imgname.src = npath;
 if (num != 0) { PopUp(num-1); }
}

function PopUp() {
	clearTimeout(myTimer);
	intNew = arguments[0]
	if ( intCurrent != intNew ) {
		intCurrent = intNew;
	
		// Load defaults to runtime.
		var m_frame     = self;
		var m_width     = "WIDTH=" + gWidth[intNew];
		var m_text      = DHTML_texts[intNew];
		var layerhtml = "<TABLE " + m_width + " CELLPADDING=0 CELLSPACING=0><TR><TD valign=center id=baks>" + m_text + "</TD></TR></TABLE>";	
		if (ns4) { dhtml = m_frame.document.DHTLMenu; }
		if (ie4) { dhtml = m_frame.DHTLMenu.style;}
		SetPosition(intNew);
		dhtml.onmouseover = OverDHTML;
		dhtml.onmouseout = OutDHTML2;
		OverDHTML();
		
	  if (ns4) {
		  var lyr = dhtml.document

		  lyr.write(layerhtml);
		  lyr.close();
		  dhtml.visibility = "show";
		}
		else if (ie4) {
			m_frame.document.all["DHTLMenu"].innerHTML = layerhtml;
			dhtml.visibility = "visible";
		}


		return true;
	}

}

function SetPosition(id) {
	var j = eval(iW);
	var posX = 0;
	var posY = 0;
	
	if (j <= mainTableWidth) { j = 2 }
	else { j = ((j - mainTableWidth) / 2) + oW; }
	if (j < 2 ) { j = 2; }
	posX = gposX[id] + j;
	
	
	var j1 = eval(iH);
	var j2 = eval(y);
	var j3 = j1 + j2;
	var j4 = gposY[id];
	var j5 = j1 + j2 - j4;
	var j6 = gHeight[id];
	var j7 = j4 - j2;
  var j8 = j4;
	
	if ((j5 < j6) && (j5 < j7)) { j8 = j4 - j6 - 30; }
	if (j8 < 0) { j8 = 0 }
	
	posY = j8;
	posX=gposX[id];
	posY=gposY[id];
	dhtml.left = posX;
  dhtml.top = posY;
}

function HideDHTML() {
	if (!isOver) { 
		intCurrent = -2;
		if (ns4) { dhtml.visibility = "hide" }
		else if (ie4) { dhtml.visibility = "hidden" }
	}
}

function OverDHTML() { 
	clearTimeout(myTimer); 
	isOver = true; 
}

function OutDHTML2() { 
	clearTimeout(myTimer);
	isOver = false; 
	myTimer = setTimeout("HideDHTML()",300);
}

function OutDHTML(imgname,npath,num) { 
     if (num !=0) {
	clearTimeout(myTimer);
	isOver = false; 
	myTimer = setTimeout("HideDHTML()",300);
	}	
        imgname.src = npath;
}
