            function getPageSize(){
	            var xScroll, yScroll, windowWidth, windowHeight, b = document.body, de = document.documentElement;
	            if (window.innerHeight && window.scrollMaxY) {
		            xScroll = b.scrollWidth;
		            yScroll = window.innerHeight + window.scrollMaxY;
	            } else if (b.scrollHeight > b.offsetHeight){ // all but Explorer Mac
		            xScroll = b.scrollWidth;
		            yScroll = b.scrollHeight;
	            } else if (de && de.scrollHeight > de.offsetHeight){ // Explorer 6 strict mode
		            xScroll = de.scrollWidth;
		            yScroll = de.scrollHeight;
	            } else { // Explorer Mac...would also work in Mozilla and Safari
		            xScroll = b.offsetWidth;
		            yScroll = b.offsetHeight;
	            }

	            if (self.innerHeight) { // all except Explorer
		            windowWidth = self.innerWidth;
		            windowHeight = self.innerHeight;
	            } else if (de && de.clientHeight) { // Explorer 6 Strict Mode
		            windowWidth = de.clientWidth;
		            windowHeight = de.clientHeight;
	            } else if (b) { // other Explorers
		            windowWidth = b.clientWidth;
		            windowHeight = b.clientHeight;
	            }

	            // for small pages with total height less then height of the viewport
	            var pageHeight = yScroll < windowHeight? windowHeight : yScroll;

	            // for small pages with total width less then width of the viewport
	            var pageWidth = xScroll < windowWidth? windowWidth : xScroll;

	            return [pageWidth,pageHeight,windowWidth,windowHeight]
            }
            function getScrollXY() {
	            var scrOfX = 0, scrOfY = 0, b = document.body, de = document.documentElement;
	            if( typeof( window.pageYOffset ) == 'number' ) {
		        //Netscape compliant
		            scrOfY = window.pageYOffset;
		            scrOfX = window.pageXOffset;
	            } else if( b && ( b.scrollLeft || b.scrollTop ) ) {
		            //DOM compliant
		            scrOfY = b.scrollTop;
		            scrOfX = b.scrollLeft;
	            } else if( de && ( de.scrollLeft || de.scrollTop ) ) {
		            //IE6 Strict
		            scrOfY = de.scrollTop;
		            scrOfX = de.scrollLeft;
	            }
	            return [ scrOfX, scrOfY ];
            }
            function animateOpacity(el, sVal, _step ,_iterations, _interval)
            {
                _iterations--;
                sVal = sVal + _step;
                setOpacity(el, sVal);
                if(_iterations > 0){
                setTimeout(function(){animateOpacity(el, sVal, _step, _iterations, _interval)},_interval);
                }
            }
            function setOpacity(){
	            setOpacity = arguments[0].filters ?
		        function(elem,level){elem.style.filter = "alpha(opacity="+level+")"} :
		        function(elem,level){elem.style.opacity = level / 100}
	            setOpacity(arguments[0],arguments[1]);
            }

	    function showWinWithTitle(winId,ctrTitleId,mesTitle){

		ctrTitle = document.getElementById(ctrTitleId);
		if(ctrTitle)
		{
			ctrTitle.innerHTML= mesTitle;
		}
		showWin(winId);
	    }

 function showWinWithFocus(winId, focusedId){
                win = document.getElementById(winId);
                var ovr = document.getElementById("overlay");

                var size = getPageSize();

                var scrol = getScrollXY();
                if (win && ovr){
		           win.style.display = 'block';
		           win.style.left = parseInt((size[2]/2) - (win.offsetWidth/2))+'px';
		           win.style.top = parseInt(((size[3]/2) - (win.offsetHeight/2)) - scrol[1])+'px';
		           ovr.style.display = 'block';
		           ovr.style.width = size[0]+'px';
		           ovr.style.height = size[1]+'px';

		           ///var step=2, iteration=20, interval=5;
		           animateOpacity(ovr, 0, 2, 40, 5);
		           setOpacity(win, 99);
		           var ctrFocused = document.getElementById(focusedId);
		           if(ctrFocused)
		           			ctrFocused.focus();
		         }
             }

            function showWin(winId){
                win = document.getElementById(winId);
                var ovr = document.getElementById("overlay");
                var size = getPageSize();
                var scrol = getScrollXY();
                if (win && ovr){
		           win.style.display = 'block';
		           win.style.left = parseInt((size[2]/2) - (win.offsetWidth/2))+'px';
		           win.style.top = parseInt(((size[3]/2) - (win.offsetHeight/2)) + scrol[1])+'px';
		           ovr.style.display = 'block';
		           ovr.style.width = size[0]+'px';
		           ovr.style.height = size[1]+'px';

		           ///var step=2, iteration=20, interval=5;
		           animateOpacity(ovr, 0, 2, 20, 5);
		           setOpacity(win, 99);
		         }
             }

 function showPicture(ctrWinId, ctrTitleId, ctrContainerId, sourcePict, messTitle)
 {

		win = document.getElementById(ctrWinId);

		ovr = document.getElementById("overlay");

		titl = document.getElementById(ctrTitleId);

		cont = document.getElementById(ctrContainerId);

                size = getPageSize();
                scrol = getScrollXY();

                if (win && ovr && titl && cont){

			   cont.src = sourcePict;
			   titl.innerHTML = messTitle;
			   win.style.display = 'block';
		           win.style.left = parseInt((size[2]/2) - (win.offsetWidth/2))+'px';
		           win.style.top = parseInt(((size[3]/2) - (win.offsetHeight/2)) + scrol[1])+'px';
		           ovr.style.display = 'block';
		           ovr.style.width = size[0]+'px';
		           ovr.style.height = size[1]+'px';

		           ///var step=2, iteration=20, interval=5;
		           animateOpacity(ovr, 0, 2, 20, 5);
		           setOpacity(win, 99);
		         }


		}

function showGalery(winId)
 {

		win = document.getElementById(winId);

		ovr = document.getElementById("overlay");
        b = document.getElementsByTagName("body").item(0);
		//cont = document.getElementById("ctrPictContainer");

                size = getPageSize();
                scrol = getScrollXY();

                if (win && ovr ){

			  /// cont.src = sourcePict;

			   win.style.display = 'block';
		           win.style.left = parseInt((size[2]/2) - (win.offsetWidth/2))+'px';
		           win.style.top = parseInt(((size[3]/2) - (win.offsetHeight/2)) + scrol[1] )+'px';
		           ovr.style.display = 'block';
		           ovr.style.width = size[0]+'px';
		           ovr.style.height = size[1]+'px';

		           ///var step=2, iteration=20, interval=5;
		           animateOpacity(ovr, 0, 2, 40, 5);
		           setOpacity(win, 99);

		         }


		}

function showPictureWithOutTitle(sourcePict)
 {

		//alert(sourcePict); return;
		win = document.getElementById("ctrPictWin");

		ovr = document.getElementById("overlay");

		cont = document.getElementById("ctrPictContainer");

                size = getPageSize();
                scrol = getScrollXY();

                if (win && ovr && cont){

			   cont.src = sourcePict;

			   win.style.display = 'block';
		           win.style.left = parseInt((size[2]/2) - (win.offsetWidth/2))+'px';
		           win.style.top = parseInt(((size[3]/2) - (win.offsetHeight/2)) + scrol[1] )+'px';
		           ovr.style.display = 'block';
		           ovr.style.width = size[0]+'px';
		           ovr.style.height = size[1]+'px';

		           ///var step=2, iteration=20, interval=5;
		           animateOpacity(ovr, 0, 2, 20, 5);
		           setOpacity(win, 99);
		         }


		}

function showVideo(winId, contId, pathToFile){
  win = document.getElementById(winId);
  var ovr = document.getElementById("overlay");
  var size = getPageSize();
  var scrol = getScrollXY();
  if (win && ovr){
		           win.style.display = 'block';
		           win.style.left = parseInt((size[2]/2) - (win.offsetWidth/2))+'px';
		           win.style.top = parseInt(((size[3]/2) - (win.offsetHeight/2)) + scrol[1])+'px';
		           ovr.style.display = 'block';
		           ovr.style.width = size[0]+'px';
		           ovr.style.height = size[1]+'px';

		           ///var step=2, iteration=20, interval=5;
		           animateOpacity(ovr, 0, 2, 20, 5);
		           setOpacity(win, 99);
				var flashvars = {};
		//var playlist = [{name:'ÂÈÄÅÎ', url:'test.flv'}];
		//var text = JSON.stringify (playlist);
		//flashvars.source= text;
		flashvars.autostart = "true";
		flashvars.source=pathToFile;
		var params = {menu:'false',scale:'noScale',bgcolor:'#000000',allowFullScreen:'true'};
		swfobject.embedSWF("/flash/playerbase.swf", contId, "100%", "100%", "9.0.0", "/flash/expressInstall.swf", flashvars, params);
		         }
             }


             function closeWin(winId){
                win = document.getElementById(winId);
                var ovr = document.getElementById("overlay");
                win.style.display='none';
                ovr.style.display='none';
              }

             function close(){
                 if(win){
                  win.style.display='none';
                  ovr.style.display='none';
                }
              }
