//  Часть пакета framenavy
// (C) Алексей Петров <petrov@nano.ioffe.rssi.ru> 
//
// wrap("Main",
//	{Dir:"WD/60/", Index: "./index.html", Banner: "../index.html", Text: "&laquo;Рабочая Демократия&raquo; #60"},
//	{Dir:"WM/06-00/",Index: "./index.html", Banner: "../index.html", Text: "Рабочее движение VI/2000"},
//	{Dir:"International/Ukraina/",{Index: "./index.html", Banner: "../index.html", Text: "Украина"}
//	) 
//
function oops(text){
alert("Oops! You have found error of the web design...Sorry.\n, The bug report may be subscribed to mail@rwp.ru\n" +text) 
}

// Эта функция загружает фреймсет в первичный каталог
function framemaker(target,primary){
// alert("start framemaker")
// Находим корень нашего сайта исходя из значения primary Dir
 var rt=(String(document.location).split(primary.Dir))[0]
 if (/\.html$/.test(rt)) oops("The page is at the bad directory!")  
 // Мы устанавливаем cookie действующий 5 минут 
 var today = new Date(); var expire = new Date()
 expire.setTime(today.getTime() + 5*1000*60)
//устанавливаем cookie базового поля
 document.cookie = target + " = " + escape(String(document.location)) + "; path= / ; expires=" + expire.toGMTString()
// delete primary.Dir
// delete primary.Text
 for (var frm in primary) 	// устанавливаем cookie остальных полей
  if (frm != "Dir" && frm != "Text")
   document.cookie = frm + " = " + escape(primary.Dir+primary[frm]) + "; path= / ; expires=" + expire.toGMTString()
//загружаем фреймсет
 document.location = rt+"index.html"
// alert("finish framemaker")
}
//
function wrap() {
//загружаем фреймсет
 if (top.frames.length != 4 || typeof(top.root) == "undefined") 
  framemaker(arguments[0], arguments[1])
 else{
  top.wrapper(arguments)
  if (arguments[0]=="Main"){
    top.colorset()
    top.topbar()
    top.historic()
  }
 }
}
//
