// SCROLLER PART
var scrollposx = 0;
var scrollmaxx = 1010;
var scrollstep = 2;
var scrolldelay = 40;


// scrollmaxx = 1260 bij 10 items (scrollstep = 10)
// scrollmaxx = 1135 bij 9 items
// scrollmaxx = 1010 bij 8 items
// scrollmaxx =      bij 7 items
// scrollmaxx =      bij 6 items
// scrollmaxx =      bij 5 items

function startscroll(nrofitems)
{
 var a = document.getElementById('scrollcontainer');
 a.scrollLeft = scrollposx;
 scrollmaxx = 126*nrofitems;
 
 if (nrofitems>=5) continuescroll();
}

function continuescroll()
{
 var a = document.getElementById('scrollcontainer');
    
     a.scrollLeft=a.scrollLeft+scrollstep;
 if (a.scrollLeft>=scrollmaxx) a.scrollLeft = scrollposx;

 setTimeout('continuescroll()', scrolldelay);
}

// SUPPLIERS SECTIONS

var clicker = true;

function setclass(obj, name)
{
 obj.className=name;
}

function clicksupplier(url)
{
 if (clicker) window.location=url;
}

function clickon()
{
 clicker = true;	
}

function clickoff()
{
 clicker = false;
}

function checkUncheckAll(theElement) 
{
 var theForm = theElement.form, z = 0;
 
 for(z=0; z<theForm.length;z++)
   if(theForm[z].type == 'checkbox' && theForm[z].name != 'checkall') theForm[z].checked = theElement.checked;
}

/* for mainpage */
var oldnum      = 1;
var target      = -1;
var targetcount = 5;
var nextcount   = 50;

					

function starttimer()
{
 setTimeout(timerevent, 125);
}

function timerevent()
{
 if (target>-1)
 {
  if (targetcount>0) targetcount--;
                else 
                {
                 showinfoitem(target);
                 target = -1;
                 nextcount = 250;
                }
 }
 else
 {
  if (nextcount>0) nextcount--;
             else { shownewinfoitem(); nextcount = 50;  }
 }
 
 setTimeout(timerevent, 125);
}

function selecttarget(atarget)
{
 target      = atarget;
 targetcount = 5;
}

function clicktarget(atarget)
{
 if (oldnum!=atarget) 
                 {
                  showinfoitem(atarget);
                  target = -1;
                  nextcount = 500;
                  result= false;
                 }
                 else result = true;
 
 return result;
}

function showinfoitem(newitem)
{
 document.getElementById('sel'+oldnum).className = '';
 document.getElementById('sel'+newitem).className = 'hl';
 
 document.getElementById('inf'+oldnum).className = 'hid';
 document.getElementById('inf'+newitem).className = '';
 
 oldnum = newitem;
}

function shownewinfoitem()
{
 newnum = oldnum+1;
 if (document.getElementById('sel'+newnum)) showinfoitem(newnum); else showinfoitem(1);
}
