function f(id,width,height)
	{

	//popup = window.open("index.php?popup=1&id=" + id,"width=300, height=200","menubar=1, resizable=1, scrollbars=yes");
	if(id==false)
	  	popup = window.open("index.php?popup=2&id=" +id,"_blank","width="+width+",height="+height+",scrollbars=no,resizable=no,toolbar=no,status=no,menubar=no,location=no");
	  else
		popup = window.open("index.php?popup=1&id=" +id,"_blank","width="+width+",height="+height+",scrollbars=no,resizable=no,toolbar=no,status=no,menubar=no,location=no");
 	}
function ScrollLeft()
{
Timer = setInterval("document.getElementById('container').scrollLeft -= 2", 10);
}
function ScrollRight()
{
Timer = setInterval("document.getElementById('container').scrollLeft += 2", 10);
}
var Div_X=false;
var Mouse_X;
var Last_Pos;
var Timer=false;
var On_Div=false;
var Div_Width;
var On_Button=false;
var isOpera = (navigator.userAgent.indexOf('Opera') != -1);
var isIE = (!isOpera && navigator.userAgent.indexOf('MSIE') != -1)

//find div width;
function count_div()
	     {
	     x = document.getElementById('container');
	     Div_Width=x.offsetWidth;
	     }
//counting coordinates
function Count_Coord()
		 {
         var Middle = Math.round(Div_Width/2); // Naxodim center div'a;
		 Mouse_X=Mouse_X-Div_X;               //  Otchitvaem posiciju mishi ot nacala div'a;
		 var Percent=Math.round(Mouse_X*100/Div_Width); // Mouse position in % (of div's width);
         var Result_X=Div_Width-Mouse_X;               //  Get div scroll side;
         if ((Result_X > Middle) && (On_Div==true)){
		 	 if(Timer)
		 		clearInterval(Timer);
		 	 ScrollLeft();
		 	 }
		 else if (On_Div==true) {
		    if(Timer)
		       clearInterval(Timer);
		    ScrollRight();
		    }
		 else {
		    if(Timer)
		 		clearInterval(Timer);
		 	 }
		 }
//Mouse coordinates
function mouseX(evt) {
	if(!evt)
		evt=event;
	if (evt.pageX)
		Mouse_X=evt.pageX;
	else if (evt.clientX)
		Mouse_X=evt.clientX + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft);
	else
		Mouse_X=null;
	if((Div_X != false) && (On_Button==false))
	   Count_Coord();
	}
//Div coordainates
function findPosX() {
		 if	(document.getElementById)
			 var obj=document.getElementById('container');
		 else if (document.all)
		 	 var obj=document.all['container'];
	    var curleft = 0;
        if (obj.offsetParent)
        {
                while (obj.offsetParent)
                {
                        curleft += obj.offsetLeft
                        obj = obj.offsetParent;
                }
        }
        else if (obj.x)
                curleft += obj.x;

        Div_X=curleft;
}
document.onmousemove=mouseX;