// JavaScript Document by k206i


// Menu MOVE
var scroll_bar = document.getElementById("scroll_bar");
var main_div = document.getElementById("main_div");
var move_div = document.getElementById("move_div");
var posY;
var pos0;
var nextPos = 20;
var koef;
var move_int;

function move_scroll()
{
	clearInterval(move_int);
	pos0 = posY - nextPos;
	koef = (main_div.offsetHeight - move_div.offsetHeight)/(main_div.offsetHeight - 25 - scroll_bar.offsetHeight);
	move_int = setInterval("move_func()", 10);
}
function move_func()
{	
	scroll_bar.style.top = (posY - pos0) +'px';
	move_div.style.top = (posY - pos0)*koef  + 0 + 'px';
	nextPos = posY - pos0;
		
	if (scroll_bar.offsetTop < (main_div.offsetTop + 20)) 
	{
		clearInterval(move_int);
		scroll_bar.style.top = 20  + 'px';
		move_div.style.top = 0  + 'px';
		nextPos = 20;
	}
	if ((scroll_bar.offsetTop + scroll_bar.offsetHeight) > (main_div.offsetTop + main_div.offsetHeight - 20)) 
	{
		clearInterval(move_int);
		scroll_bar.style.top = (main_div.offsetHeight  - scroll_bar.offsetHeight - 20) + 'px';
		nextPos = main_div.offsetHeight  - scroll_bar.offsetHeight - 20;
	}
}

function objectPosition(e)
{
  posY=e.clientY;
}

function objectPositionNew()
{	clearInterval(move_int);
	clearInterval(move_time_pic);
	next_pos_pic = color_pic.offsetTop;
}


//Picture MOVE
var color_pic = document.getElementById("color_pic");
var pos_top_pic;
var next_pos_pic = 0;
var move_time_pic;

function move_pic()
{	
	clearInterval(move_time_pic);
	pos_top_pic = posY - next_pos_pic;
	move_time_pic = setInterval("move_pic_func()", 1);
}


//

function move(i){
	var color_pic = document.getElementById("color_pic");
	var firstPos=color_pic.offsetTop;
	var lastPos=-500;

	if(!i){i=firstPos;}
	
	color_pic.style.top=i+'px';
	i--;
	if(i>lastPos){
		setTimeout("move("+i+")", 1);
	}

}


//
function move_pic_func()
{
	color_pic.style.top = (posY - pos_top_pic) + 'px';
	if ((posY - pos_top_pic) >0)
	{
		//clearInterval(move_time_pic);
		color_pic.style.top = 0 + 'px';
	}
}

function photo( path, alt, width, height )
{        
		var body;
        
        if (document.all)
        { 
                body = '<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="White" onblur="self.window.close();" onresize="self.window.location.reload();">';
        } 
        else 
        {
                body = '<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="White" onblur="self.window.close();">';
        }
                
        var win_op = window.open('','show', 'resizable=yes,width='+width+',height='+height+',screenX=200,screenY=200,left=100,top=100');
        
        win_op.document.open();
        win_op.document.writeln('<html>');
        win_op.document.writeln('<head>');
        win_op.document.writeln('<title>' + alt + '</title>');
        win_op.document.writeln('</head>');
        win_op.document.writeln(body);
        win_op.document.writeln('<center><img name="image" src='+ path + ' border=0 alt="' + alt + '"></center>');
        win_op.document.writeln('</body>');
        win_op.document.writeln('</html>');                
        win_op.document.close();
}