var persistclose=0
var startX = 0
var startY = 0
var verticalpos="frombottom"

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function get_cookie(Name) {
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) {
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}

function closebar(){
if (persistclose)
document.cookie="remainclosed=1"
document.getElementById("topbar").style.visibility="hidden"
}

function staticbar(){
	barheight=document.getElementById("topbar").offsetHeight
	var ns = (navigator.appName.indexOf("Netscape") != -1) || window.opera;
	var d = document;
	function ml(id){
		var el=d.getElementById(id);
		if (!persistclose || persistclose && get_cookie("remainclosed")=="")
		el.style.visibility="visible"
		if(d.layers)el.style=el;
		el.sP=function(x,y){this.style.left=x+"px";this.style.top=y+"px";};
		el.x = startX;
		if (verticalpos=="fromtop")
		el.y = startY;
		else{
		el.y = ns ? pageYOffset + innerHeight : iecompattest().scrollTop + iecompattest().clientHeight;
		el.y -= startY;
		}
		return el;
	}
	window.stayTopLeft=function(){
		if (verticalpos=="fromtop"){
		var pY = ns ? pageYOffset : iecompattest().scrollTop;
		ftlObj.y += (pY + startY - ftlObj.y);
		}
		else{
		var pY = ns ? pageYOffset + innerHeight - barheight: iecompattest().scrollTop + iecompattest().clientHeight - barheight;
		ftlObj.y += (pY - startY - ftlObj.y);
		}
		ftlObj.sP(ftlObj.x, ftlObj.y);
		setTimeout("stayTopLeft()", 0);
	}
	ftlObj = ml("topbar");
	stayTopLeft();
}

if (window.addEventListener)
window.addEventListener("load", staticbar, false)
else if (window.attachEvent)
window.attachEvent("onload", staticbar)
else if (document.getElementById)
window.onload=staticbar


function ShowDate()
{
	var now = new Date();
	var yr = now.getFullYear();
	var mName = now.getMonth() + 1;
	var dName = now.getDay() + 1;
	var dayNr = ((now.getDate()<10) ? "0" : "") + now.getDate();
	
    if(dName==1) Day = "воскресенье";
    if(dName==2) Day = "понедельник";
    if(dName==3) Day = "вторник";
    if(dName==4) Day = "среда";
    if(dName==5) Day = "четверг";
    if(dName==6) Day = "пятница";
    if(dName==7) Day = "суббота";
    if(mName==1) Month="января";
    if(mName==2) Month="февраля";
    if(mName==3) Month="марта";
    if(mName==4) Month="апреля";
    if(mName==5) Month="мая";
    if(mName==6) Month="июня";
    if(mName==7) Month="июля";
    if(mName==8) Month="августа";
    if(mName==9) Month="сентября";
    if(mName==10) Month="октября";
    if(mName==11) Month="ноября";
    if(mName==12) Month="декабря";
	
	var todaysDate =(""+dayNr+" "+Month+" " + yr + " г." + " <B>·</B> "+ Day);
	
	document.write(todaysDate);
}

// --------------------------------------

//Time delay between Slides in milliseconds
var delay = 1500;

var lock = false;
var run;
function chgImg(direction) {
	if (document.images) {
	ImgNum = ImgNum + direction;
	if (ImgNum > ImgLength) {
	ImgNum = 0;
	}
	if (ImgNum < 0) {
	ImgNum = ImgLength;
	}
	document.slideshow.src = NewImg[ImgNum];
	   }
}

function auto() {
	if (lock == true) {
	lock = false;
	window.clearInterval(run);
	}
	else if (lock == false) {
	lock = true;
	run = setInterval("chgImg(1)", delay);
	   }
}

// ------------------

function ChangeCurrency(currency)
{
	if (currency == 'eur')
	{
		$$('span.eur').each(function(s) { s.show();	});
		$$('span.rur').each(function(s) { s.hide();	});
	}
	else if (currency == 'rur')
	{
		$$('span.eur').each(function(s) { s.hide();	});
		$$('span.rur').each(function(s) { s.show();	});		
	}
}

function PrintPrice() {
	$('price_content').value = $('print_area').innerHTML;
	$('print_form').submit();
}

function movepic(img_name,img_src) {
document[img_name].src=img_src;
}

function openWin2() { 
  myWin= open("/catalog/MATRAC/", "displayWindow", 
"width=1050,height=700,top=50,left=50,scrollbars=yes"); 
} 


