function changepic(id,image,name,url)
{
	document.getElementById('img_'+id).src='images/items/'+image;
	document.getElementById('img_'+id).title=name+' ('+url+')';
	document.getElementById('link_'+id).href=url;
}

function changepdflink(id,pdf)
{
	//document.getElementById('link_'+id).href='images/items/'+pdf;
	links=document.getElementsByName('link_'+id);
	for (x=0;x<links.length;x++)
		{
			links[x].href='images/items/'+pdf;
		}
}

function movepic(id,left,top)
{
	//document.getElementById('div_'+id).style.top=top+'px';
	document.getElementById('div_'+id).style.left=left+'px';
}

function openpage(page)
{
	top.location.href=page;
}

function checkmail(mail)
{
	regex=new RegExp(/.+@(.+[.])[\w]{2,}/);
	return regex.test(mail);
}

function checkform()
{
	cont=true;
	checkfields=document.getElementsByName('td_check');
	for (x=0;x<checkfields.length;x++)
		{
			field=checkfields[x].id.substr(3);
			if (document.getElementsByName(field)[0].value=='')
				{
					cont=false;
					document.getElementById('td_'+field).style.color='#ff0000';
				}
			else if ((field=='email') && (checkmail(document.getElementsByName(field)[0].value)==false))
				{
					cont=false;
					document.getElementById('td_'+field).style.color='#ff0000';
				}
			else
				{
					document.getElementById('td_'+field).style.color='#000000';
				}
		}
	return cont;
}

function printImage() {
  pwin = window.open(document.getElementById("image_to_print").src,"_blank");
  setTimeout("pwin.print()",1500)
}

