var down = 0;
var up = 0;

function LoadDiv(divid, url)
{
     $('#'+divid).load(url);
}

function OpenDialog(divid)
{
  $('#'+divid).dialog('open');
}


function CloseDialog(divid)
{
  $('#'+divid).dialog('close');
}

function SelectItem(itemid)
{
    $('.services_title').removeClass('selected');

   $('#'+itemid).addClass('selected');
}

function startScrollDown()
{
  down = 1;
}
function stopScrollDown()
{
down = 0;
}
function startScrollUp()
{
up = 1;
}
function stopScrollUp()
{
up = 0;
}
function movedownscroll(divid)
{
                  var heighttext = document.getElementById(divid).scrollTop;
                   var height = 0;
                  if (heighttext != "")
                            height = parseInt(heighttext);

                  height = height * -1;
 
                  if (down == 1)
                  {
	var toptext = document.getElementById(divid).style.top.replace("px", "");
	var topnum = 0;
	if (toptext == "")
		topnum = 0;
	else
		topnum = parseInt(toptext);

                     if (topnum*-1 >=0)
                    {
	document.getElementById(divid).style.top = (topnum -5) + "px";
                    setTimeout('movedown(\'' + divid +'\')',20);
                    }
                   }

}
function moveup(divid)
{
             if (up == 1)
               {
                  
	var toptext = document.getElementById(divid).style.top.replace("px", "");
	var topnum = 0;
	if (toptext == "")
		topnum = 0;
	else
		topnum = parseInt(toptext);
                     if (topnum < 0)
                     {
	     document.getElementById(divid).style.top = (topnum +5) + "px";

                           setTimeout('moveup(\'' + divid +'\')',20);
                     }
               }
}

function movedown(divid, max)
{
           var cmax =max;// 90*max - 360;
             var heighttext = document.getElementById(divid).scrollTop;
                   var height = 0;
                  if (heighttext != "")
                            height = parseInt(heighttext);

                  height = height * -1;
 
                  if (down == 1)
                  {
	var toptext = document.getElementById(divid).style.top.replace("px", "");
	var topnum = 0;
	if (toptext == "")
		topnum = 0;
	else
		topnum = parseInt(toptext);

                     if (topnum*-1 < cmax)
                    {
	document.getElementById(divid).style.top = (topnum -5) + "px";
                    setTimeout('movedown(\'' + divid +'\',' + max + ')',20);
                    }
                   }
}
