	var timeoutIDs = new Array();
	
	/* Открывает изображение в новом окне */ 
	function FullImageOpen(ID, Width, Height) {
		open("/picture.asp?ID="+ID, "_blank", "resizable=1,menubar=0,scrollbars=1,width="+Width+",height="+Height+""); //,left=100,top=60"
	}

        function openURL(URL){
            open(URL, "_self");
        }


        function isLowRes()
        {
            return screen.width<1280 ? true : false;
        }          

        function openTextWindow(url)
        {
            if (isLowRes())
                textwin=window.open(url,"text_win", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,top=0,left=0,width=375,height=375");
            else
                textwin=window.open(url,"text_win", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,top=0,left=0,width=600,height=600");
            textwin.focus();
        }


        function openImageWindow(url,title,img_width,img_height)
        {
            imgwin=window.open("", "image_win", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,top=0,left=0,width="+img_width+",height="+img_height);
            imgwin.close();
            imgwin=window.open("", "image_win", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,top=0,left=0,width="+img_width+",height="+img_height);

            imgwin.document.writeln('<html><head><title>'+title+'</title><link rel="stylesheet" type="text/css" href="/style-imgwin.css"></head><body><img src="'+url+'" width="'+img_width+'" height="'+img_height+'"></body></html>');
            imgwin.focus();
        }

        function linkStyleSheet(low_css,hi_css)
        {
                if (isLowRes())
                        document.write('<link rel="stylesheet" href="'+low_css+'">');
                else
                        document.write('<link rel="stylesheet" href="'+hi_css+'">');
        }

        function linkImage(low_res_image,hi_res_image)
        {
                if (isLowRes())
                        document.write('<img src="'+low_res_image+'">');
                else
                        document.write('<img src="'+hi_res_image+'">');
        }

        function replaceImageSource(image_id, link_id, fixedwidth, fullimg, name, width, height)
        {
                document.getElementById(image_id).src='/file?Images&'+fixedwidth;
                document.getElementById(link_id).href="javascript:openImageWindow('/file?Images&"+fullimg+"','"+name+"',"+width+","+height+")";
                //document.getElementById(link_id).href="javascript:openImageWindow('/file?Images&"+fullimg+"','"+"\\\'Выставка картин из частных собраний\\\'"+"',"+width+","+height+")";
        }

        function getLineHeight()
        {
            return isLowRes() ? 14 : 16;
        }

        function getLineHeightInAuthorsList()
        {
            return isLowRes() ? 19 : 21;
        }


	var timeoutID= 0;

	function HideArrows(scrollareaID, contentID){
		var scrollarea= getStyleObject(scrollareaID);
		var content = getStyleObject(contentID);
		var up  = getStyleObject("uptext");
		var down = getStyleObject("downtext");
		var circle = getStyleObject("circle");
		if (scrollarea.clientHeight>content.clientHeight)
		{
			up.style.display="none";
			down.style.display="none";
			circle.style.display="none";
		}
	}

	function ScrollByLineUp(divID, lineHeight){
		//lineHeight = 16;
		obj = getStyleObject(divID);
		winHeight = getStyleObject("scrollarea").clientHeight;
		timeoutID = setInterval("increaseTop('"+divID+"', "+lineHeight+", "+winHeight+")", 40); 
		return false;
	}

	function ScrollByLineDown(divID, lineHeight, divscroll){
		//lineHeight = 16;
		obj = getStyleObject(divID);
		winHeight = getStyleObject(divscroll).clientHeight;
		//alert(winHeight);
		timeoutID = setInterval("decreaseTop('"+divID+"', "+lineHeight+", "+winHeight+")", 40); 
		return false;
	}

	function ScrollByLine(divID, lineHeight, divscroll){   
	//alert(getStyleObject(divscroll).clientHeight);
    if (event.wheelDelta >= 120)
        increaseTop(divID, lineHeight, getStyleObject(divscroll).clientHeight);
    else if (event.wheelDelta <= -120)
        decreaseTop(divID, lineHeight, getStyleObject(divscroll).clientHeight); 
    return false; 
	}

	

	function decreaseTop(divID, lineHeight, winHeight){
		obj = getStyleObject(divID);
		if ((winHeight+lineHeight-obj.offsetTop) < obj.clientHeight){
			obj.style.top = obj.offsetTop-lineHeight;
			setCircle((100*(-obj.offsetTop))/(obj.clientHeight-winHeight)+"%");
		}else{
			obj.style.top = -obj.clientHeight+winHeight;
			setCircle("100%");
			clearInterval(timeoutID);
		}
	}
	
	function increaseTop(divID, lineHeight, winHeight){
		obj = getStyleObject(divID);
		//alert(timeoutID+" "+(-obj.offsetTop)+" "+obj.clientHeight);
		if (obj.offsetTop+lineHeight <0){
			obj.style.top = obj.offsetTop+lineHeight;
			setCircle((100*(-obj.offsetTop))/(obj.clientHeight-winHeight)+"%");
		}else{
			obj.style.top = 0;
			setCircle("0");
			clearInterval(timeoutID);
		}
	}

	function setCircle(percent){
		var objC = getStyleObject("circle");
		objC.style.top = percent;
	}

	function setSelect(obj)
	{	
		obj.className = 'selected';
		return true;
	}

	function setUnselect(obj)
	{	
		obj.className = '';
		return true;
	}
//
// ************************
// layer utility routines *
// ************************

function getStyleObject(objectId) {
    // cross-browser function to get an object's style object given its id
    if(document.getElementById && document.getElementById(objectId)) {
	// W3C DOM
	return document.getElementById(objectId);
    } else if (document.all && document.all(objectId)) {
	// MSIE 4 DOM
	return document.all(objectId);
    } else if (document.layers && document.layers[objectId]) {
	// NN 4 DOM.. note: this won't find nested layers
	return document.layers[objectId];
    } else {
	return false;
    }
} // getStyleObject




