function checkposition()
{
   //document.getElementById("pic").src = Pic[Math.floor(s.getValue()*(AnzPic-1)/100) + 1].src;
   document.getElementById("pic").src = Pic[s.getValue()+1].src;

   //alert(s.getValue());

   allt = document.getElementsByTagName('a');
	
	var posNum = s.getValue();
	pos = posNum.toString();
	
	while(pos.length<3)
	{
		pos = "0"+pos;  // tryggjum að pos sé alltaf 3 stafa
	}
	
	
	for(i=0;i<allt.length;i++)
	{
		if(allt[i].getAttribute('class')=="hlekkur")
		{
			linkur = allt[i].getAttribute('href');
			
			if( (linkur.indexOf('&pos=')==-1) && (linkur.indexOf('&st=')==-1))
		{
			allt[i].setAttribute('href',linkur+'&pos='+pos+'&st='+stafur);
		}
		else
		{
			if(linkur.indexOf('VEL')==-1)
			{
			linkur = linkur.substr(0,linkur.length-13);
			}
			else
			{
			linkur = linkur.substr(0,linkur.length-15);
			}
			allt[i].setAttribute('href',linkur+'&pos='+pos+'&st='+stafur );	
			
		}
		
		}
	}
   
}

function updateSlider(nyttGildi)
{
	rettGildi = nyttGildi*1; //breytum t.d. 004 í 4
	//alert(rettGildi);
	s.setValue(rettGildi);
	
	checkposition();
}