

function NoError() { return true; };
//window.onerror=NoError;  	// включить в окончательной версии!
var ie45,ns6,ns4,dom; gap=' '; if (navigator.appName=="Microsoft Internet Explorer")
 ie45=parseInt(navigator.appVersion)>=4; else if (navigator.appName=="Netscape"){
 ns6=parseInt(navigator.appVersion)>=5;ns4=parseInt(navigator.appVersion)<5;} dom=ie45 || ns6;
var oldDomain	= document.domain; 
	/* function meBuild(){
	if ( !l1is ) setTimeout('hide("l1");show("l2");l1is=false;',3000);
	animatedcollapse.addDiv('navigation1',  'fade=1')
	animatedcollapse.addDiv('gallery1',  'fade=1,hide=0')
	animatedcollapse.addDiv('n2','fade=0');		animatedcollapse.addDiv('l2','fade=0,speed=600');
													animatedcollapse.addDiv('l50','fade=1,group=downmenu');
													animatedcollapse.addDiv('l51','fade=1,speed=2000,group=downmenu');
	animatedcollapse.init();			};*/












<!-- Begin
var slideShowSpeed = 3000; 		// Set slideShowSpeed (milliseconds)
var crossFadeDuration = 3;		// Duration of crossfade (seconds)
var Pic = new Array();			// Specify the image files; to add more images, just continue the pattern, adding to the array below
Pic[0] = 'sneg/a.png';Pic[1] = 'sneg/1.png';Pic[2] = 'sneg/2.png';Pic[3] = 'sneg/3.png';Pic[4] = 'sneg/4.png';
Pic[5] = 'sneg/5.png';Pic[6] = 'sneg/6.png';Pic[7] = 'sneg/7.png';Pic[8] = 'sneg/8.png';Pic[9] = 'sneg/9.png';
Pic[10]= 'sneg/c.png';Pic[11]= 'sneg/d.png';Pic[12]= 'sneg/e.png';Pic[13]= 'sneg/f.png';Pic[14]= 'sneg/f.png';
var t; var j=0; var p=Pic.length; var preLoad=new Array(); for (i=0; i < p; i++) { preLoad[i] = new Image(); preLoad[i].src = Pic[i]; }
function runSlideShow() {
  if (document.all) {
	document.images.SlideShow.style.filter="blendTrans(duration=2)";
	document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)";
	document.images.SlideShow.filters.blendTrans.Apply();
	}
  document.images.SlideShow.src = preLoad[j].src;
  if (document.all) { document.images.SlideShow.filters.blendTrans.Play(); }
  j = j + 1; if (j > (p - 1)) j = 0; t = setTimeout('runSlideShow()', slideShowSpeed);
  } 							//  End -->
function high(which2){ theobject=which2;			highlighting=setInterval("highlightit(theobject)",50); };
function  low(which2){ clearInterval(highlighting);	which2.filters.alpha.opacity=50; };
function low2(which2){ clearInterval(highlighting);	which2.filters.alpha.opacity=10; }
function highlightit(cur2){ 						if (cur2.filters.alpha.opacity<100)
	cur2.filters.alpha.opacity+=5
	else if (window.highlighting)
	clearInterval(highlighting)
	}

function otk1(){ 	clearTimeout(t);SlideShow.width=0;SlideShow.height=0;setTimeout("animatedcollapse.show('potr1');",1800); };
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
	hide('kotla'); }
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; }
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x; }
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} }


function refres() { 
animatedcollapse.addDiv('pre1', 'fade=0,speed=400,hide=0');
animatedcollapse.addDiv('potr1', 'fade=0,speed=600,hide=0');
animatedcollapse.addDiv('potr2', 'fade=0,speed=600,hide=0');
animatedcollapse.addDiv('potr3', 'fade=0,speed=600,hide=0');
animatedcollapse.addDiv('sipp1', 'fade=0,speed=400,hide=0');
animatedcollapse.addDiv('anek1', 'fade=0,speed=400,hide=0');
animatedcollapse.addDiv('anek2', 'fade=0,speed=400,hide=0');
animatedcollapse.addDiv('anek3', 'fade=0,speed=400,hide=0');
animatedcollapse.addDiv('anek4', 'fade=0,speed=400,hide=0');
animatedcollapse.addDiv('anek5', 'fade=0,speed=400,hide=0');
animatedcollapse.addDiv('zakn1', 'fade=0,speed=400,hide=0');
animatedcollapse.addDiv('ar1', 'fade=0,speed=400,hide=0');
animatedcollapse.addDiv('ar2', 'fade=0,speed=400,hide=0');
animatedcollapse.addDiv('ar3', 'fade=0,speed=400,hide=0');
animatedcollapse.addDiv('ar4', 'fade=0,speed=400,hide=0');
animatedcollapse.addDiv('ar5', 'fade=0,speed=400,hide=0');
animatedcollapse.addDiv('ar6', 'fade=0,speed=400,hide=0');
animatedcollapse.addDiv('ar7', 'fade=0,speed=400,hide=0');
	animatedcollapse.init(); 	 }
function prelo() { 	MM_preloadImages('pic/h_ico6a.png','pic/h_ico6b.png','pic/i3a.gif','pic/i3b.gif','pic/i4a.gif','pic/i4b.gif','pic/pogr.png','pic/cia.gif','pic/find.gif')
/*    if( $("b.are").hasClass("ah6")){ $("b.are").removeClass("ah6");	$("b.are").addClass("p");}; */
refres(); setTimeout('runSlideShow();',4000); }

function my_getbyid(id)	{	itm = null; if (document.getElementById)
	{ itm = document.getElementById(id); } else if (document.all)
	{ itm = document.all[id]; } else if (document.layers) { itm = document.layers[id];}
	return itm;	}
function toggle(id) { if ( ! id ) return; if ( itm = my_getbyid(id) ) { if (itm.style.display == "none")
		{ itm.style.display = ""; } else	{ itm.style.display = "none"; }}}
function hide(id) { if ( ! id ) return; if ( itm = my_getbyid(id) ) { if (itm.style.display == "none")
		{						  } else	{ itm.style.display = "none"; }}}		
function show(id) { if ( ! id ) return; if ( itm = my_getbyid(id) ) { if (itm.style.display == "none")
		{ itm.style.display = ""; } else	{  }}}
function makearray(n) {	    this.length = n; for(var i = 1; i <= n; i++) this[i] = 0; return this; }
function goTo(wheretoo) {	this.document.location=wheretoo}; 	// функция нужна везде где есть якоря!
												// ::or::  document.location.href = url; return false;*/
function makevisible(cur,which){ 				// use in MARQUEE used links
 if (which==0) {cur.style.opacity=0.87} 	  else {cur.style.opacity=0.7} 	// fur  Opera, Safari
 if (which==0) {cur.filters.alpha.opacity=87} else {cur.filters.alpha.opacity=70} }
												//	if (browserdetect=="mozilla") cur.style.MozOpacity=0.87;
												//	if (window.highlighting) clearInterval(highlighting);
String.prototype.trim = function () { 			// e.trim() - меняем пару пробелов на <br />
 re2 = /  /i; b=this.replace(re, "<br />");		// Warning: Written not in Texas.  Yeehaw.
 for(var i = 1; i <= 22; i++)  b=b.replace(re, "<br />"); return b.replace(re, "<br />"); };




var forbiddenTypes = ".gif .jpeg .txt .doc"; // расширения файлов, ссылки на которые мы не переписываем
var forbiddenClass = "forbidden"; // имя класса для ссылок, которые мы не переписываем
// определяем имя сайта (домена)
var site = location.host;
var start = 'yes';

// получение данных, используя AJAX
// здесь реализовано на jquery, но можно и  по другому
function getDataAjax(url)
	{
	$.ajax({
	type: "GET", 
	url: url, 
	data: "ajax=yes",
	success: function(data) 
		{ 
		parseGetData(data);
		}
	});
	}

function setupNewLinks(obj)
	{
	var links = obj.getElementsByTagName("a"); // все ссылки внутри объекта obj
	// перебираем ссылки
	for (i = 0; i < links.length; i ++)
		{
		// проверяем, можно ли переписывать адрес текущей ссылки 
		//(проверка по имени класса, расширению и "внешности" ссылки :-)
		// если можно, то переписываем
		tmp = links[i].href; 
		tmp = tmp.replace("http://"+site, "");
		indexOfDot = 0;
		if(tmp.lastIndexOf(".") > 0) indexOfDot = tmp.lastIndexOf("."); 
		if(forbiddenTypes.match(tmp.substring(indexOfDot)) == null && tmp.substring(0, 7) != "http://" && links[i].className != forbiddenClass)
			{
			// прописываем, что происходит при клике на ссылку
			$(links[i]).bind("click", function()
				{
				markLinksWithHref(this.href);
				historyVar.getNewHistoryState(this.href.replace("http://"+site+"/#", ""));
				this.className = "curPage";
				});
			// заменяем адрес
			links[i].href = "#" + tmp;
			}
		}
	}

// с помощью этой функции мы отмечаем все ссылки 
// с одинаковым значением href
function markLinksWithHref(linkHref)
	{
	var links = document.getElementsByTagName("a");
	if(navigator.appName == 'Microsoft Internet Explorer') linkHref = linkHref.replace("http://"+site+"/", "");
	for (i = 0; i < links.length; i ++)
		{
		if(links[i].href == linkHref || links[i].href == linkHref+"/") links[i].className = "curPage";
		else links[i].className = "";
		}
	}

function checkAnchorOnload()
	{
	// определяем полный путь и якорь страницы
	var urlPathName = location.pathname;
	var urlAnchor = location.hash;
	
	// проверяем адрес, если пользователь первый раз 
	//вошел на сайт. Если в адресе есть якорь, то 
	// подгружаем страницу
	if(start == 'yes')
		{
		if(urlPathName != "/") 
			{
			location.href = "http://"+site+"/#"+urlPathName;
			}
		else if(urlAnchor != "" && urlAnchor.indexOf("#/") != -1)
			{
			getDataAjax(urlAnchor.replace("#", ""));
			}
		}
	// примерно такая же проверка, но только при нажатии 
	// "назад" или "вперед" в браузере
	else if(start == '')
		{
		if(urlPathName == "/") 
			{
			if(urlAnchor == "" || (urlAnchor == "#" && navigator.appName == 'Microsoft Internet Explorer')) 
				{
				getDataAjax("http://"+site+"/");
				}
			else if(urlAnchor.indexOf("#/") != -1) 
				{
				getDataAjax(urlAnchor.replace("#/", ""));
				}
			}
		}
	}

function parseGetData(data)
	{
	//получаем заголовок и содержание страницы из XML
	title = data.getElementsByTagName('title');
	cnt = data.getElementsByTagName('content');
	
	//вставляем это в нашу страницу
	$('#content').html(cnt[0].firstChild.nodeValue);
	document.title = title[0].firstChild.nodeValue;
	
	// обновляем ссылки внутри страницы
	setupNewLinks(document.getElementById('content'));
	markLinksWithHref(window.location.href); 
	}
	
function init()
	{
	setupNewLinks(document); // переписываем адреса ссылок
	historyVar = new historyHandler(); // запоминаем историю
	start = '';
	}
	
function historyHandler() {
	var stateVar = "nothin'", displayDiv = document.getElementById("content");
	
	this.getNewHistoryState = function(currentState) {
		var newVal = currentState;
		unFocus.History.addHistory(newVal);
	};
	
	this.historyListener = function(historyHash) {
		stateVar = historyHash;
		// при каждом изменении истории мы будем
		// выдавать соответствующий контент
		checkAnchorOnload();
	};
	unFocus.History.addEventListener('historyChange', this.historyListener);
	
	this.historyListener(unFocus.History.getCurrent());
};
var historyVar;





