//-------------------------------------------------------------
//    For checkit materials in right panel 
//-------------------------------------------------------------
var OldSelect = "";
var CurSelect = "";
//------------------------------------------------------------------
//
//------------------------------------------------------------------
function getafter()
{
  var gr0 = window.location.href;
  if(gr0.indexOf("?",0) == -1) {
     OldSelect = document.all['Start'].children[0];
   }
  else {
     var gr1 = gr0.substr(gr0.indexOf("?",0)+1, gr0.length);
     var NameId = gr1.substr(0, gr1.length-5);
     OldSelect = document.all[NameId];
   } 

  OldSelect.style.color = 0x0444b3;
  OldSelect.style.backgroundColor = 0xffffff;
  OldSelect.style.borderBottomColor = 0xCDD9EB;
  OldSelect.onclick = MEmpty;
  OldSelect.onmouseover = MEmpty;
  OldSelect.onmouseout = MEmpty;
  OldSelect.style.cursor = "default";
  hideframe.navigate(gr1)

}

//------------------------------------------------------------------
//
//------------------------------------------------------------------
function SetFrame()
{

}

//------------------------------------------------------------------
//
//------------------------------------------------------------------
function MOver(elements)
{
if(elements == null)return;
//document.getElementById(elements).style.cursor = "pointer";
document.getElementById(elements).style.color = "#846401";
document.getElementById(elements).style.backgroundColor = "#fff4e3";
document.getElementById(elements).style.borderBottomColor = "#D8D8D6";
}

//------------------------------------------------------------------
//
//------------------------------------------------------------------
function MOut(elements)
{
if(elements == null)return;
document.getElementById(elements).style.color = "#000000";
document.getElementById(elements).style.backgroundColor = "#caddfe";
document.getElementById(elements).style.borderBottomColor = "#99B0D6";
}

//------------------------------------------------------------------
//------------------------------------------------------------------
function MEmpty()
{
}


//------------------------------------------------------------------
//------------------------------------------------------------------
//------------------------------------------------------------------
//------------------------------------------------------------------
//         Archive of the section
//------------------------------------------------------------------
function strModify(url_old)
{
 var url_new = "";

 while(true) {
    url_new = url_old.replace("../", "_zzz_");
	if(url_new == url_old) break;
	url_old = url_new;
  }	

 while(true) {
    url_new = url_old.replace("/", "_zz_");
	if(url_new == url_old) break;
	url_old = url_new;
  }	
   
 return url_new;
}

//------------------------------------------------------------------
//
//------------------------------------------------------------------
function strRestore(url_old)
{
 var url_new = "";

 while(true) {
    url_new = url_old.replace("_zzz_", "../");
	if(url_new == url_old) break;
	url_old = url_new;
  }	

 while(true) {
    url_new = url_old.replace("_zz_", "/");
	if(url_new == url_old) break;
	url_old = url_new;
  }	
   
 return url_new;
}

//------------------------------------------------------------------
//
//------------------------------------------------------------------
function MakeWindow(url, width, height)
{
 var str1 = "toolbar=no, scrollbars=yes, resizable=yes, status=yes, location=no, ";
 var str2 = "width=" + width + ", height=" + height;
 var str = str1 + str2;

 url = strModify(url);
 var wnd = open("arj_opener.html",url, str);

 wnd.top.moveTo((screen.width-width)/2, (screen.height-height)/2);
}


//------------------------------------------------------------------
//
//------------------------------------------------------------------
function LoadArjMaterial()
{
  var str7 = strRestore(this.name) + ".html";
  hideframe.navigate(str7);
}

//------------------------------------------------------------------
//
//------------------------------------------------------------------
function MOver2(elements)
{
//event.srcElement.style.cursor = "hand";
document.getElementById(elements).style.color = "#7d9ece";
document.getElementById(elements).style.textDecoration = "underline";
}

//------------------------------------------------------------------
//
//------------------------------------------------------------------
function MOut2(elements)
{
document.getElementById(elements).style.color = "#093279"
document.getElementById(elements).style.textDecoration = "none";
}

 
//------------------------------------------------------------------
//------------------------------------------------------------------
//-------------------------------------------------------------
//    For change language
//-------------------------------------------------------------
function LangClick()
{
  var OldLocation = window.location.href;
  var TargetLang = event.srcElement.id

  if((OldLocation.indexOf("find.cgi?", 0) != -1) ||
      (OldLocation.indexOf("tmplnk_", 0) != -1)) {
     var strEnd; 
     switch(TargetLang) {
       case "az":
	      strEnd = "_a.html";
	      break;
       case "en":
	      strEnd = "_e.html";
	      break;
       case "ru":
	      strEnd = "_r.html";
	      break;
      }
	
     window.location.href = "../index" + strEnd; 
	 return;
   }

  var posVopros = OldLocation.indexOf("?", 0); 
  var posDies = OldLocation.indexOf("#", 0);
  if(posVopros != -1) 
     OldLocation = OldLocation.substr(0, posVopros);
if(posDies != -1) 
     OldLocation = OldLocation.substr(0, posDies);


  var Find = OldLocation.substr(OldLocation.length-7, OldLocation.length);
  var Replace;
  switch(TargetLang) {
    case "az":
	   Replace = "_a.html";
	   break;
    case "en":
	   Replace = "_e.html";
	   break;
    case "ru":
	   Replace = "_r.html";
	   break;
   }
  var NewLocation = OldLocation.replace(Find, Replace);
  window.location.href = NewLocation;
}
//------------------------------------------------------------------
//
//------------------------------------------------------------------
function LangOver()
{
event.srcElement.style.cursor = "hand";
event.srcElement.style.color = 0x9B6A03;
}

//------------------------------------------------------------------
//
//------------------------------------------------------------------
function LangOut()
{
event.srcElement.style.color = 0x004AC1;
}


//------------------------------------------------------------------
//                       INDEX
//------------------------------------------------------------------
//------------------------------------------------------------------
//
//------------------------------------------------------------------
function OpenNews(num, lang)
{
  var strM = "s_news/news" + num + "_" + lang + ".html";
  var wnd2 = open(strM,"","toolbar=no,scrollbars=yes,resizable=yes,  width=620,height=460,status=yes,location=no");
  wnd2.top.moveTo((screen.width-620)/2, (screen.height-460)/2);
}

