// JavaScript Document



function PrintThisPage(obj) 
{ 
   var sOption="toolbar=yes,location=no,directories=yes,menubar=yes,"; 
       sOption+="scrollbars=yes,width=750,height=600,left=100,top=25"; 

   var sWinHTML = document.getElementById(obj).innerHTML; 
   
   var winprint=window.open("","",sOption); 
       winprint.document.open(); 
       winprint.document.write('<html><LINK href=/site/css/default.css rel=Stylesheet><body>'); 
       winprint.document.write(sWinHTML);          
       winprint.document.write('</body></html>'); 
       winprint.document.close(); 
       winprint.focus(); 
	   winprint.print();
}


/* CONFIRM DELETE*/	
function confirmDelete(id, ask, url) //confirm order delete
{
	temp = window.confirm(ask);
	if (temp) //delete
	{
		window.location=url+id;
	}
}

/*#### De onderstaande code is voor de ProductViewer ####*/
function approachEnlargement(el) 
{
	var tbody = el.parentNode.parentNode.parentNode;
	
	for(i=0;i<tbody.childNodes.length;i++) 
	{	
		if(tbody.childNodes[i].nodeName == 'TR') 
		{		
			for(j=0;j<tbody.childNodes[i].childNodes.length;j++) 
			{				
				if(tbody.childNodes[i].childNodes[j].nodeName == 'TD') 
				{
					if(tbody.childNodes[i].childNodes[j].className == 'tableleft') 
					{						
						for(k=0;k<tbody.childNodes[i].childNodes[j].childNodes.length;k++) 
						{							
						    if(tbody.childNodes[i].childNodes[j].childNodes[k].nodeName == 'IMG') 
							{								
								var img = tbody.childNodes[i].childNodes[j].childNodes[k];
								return img;
							} 
						}
					}
				}
			}
		}
	}
}

function getThumbSource(el)
{
	for(i=0;i<el.childNodes.length;i++) 
	{
		if(el.childNodes[i].nodeName == 'IMG') 
		{
			var img = el.childNodes[i].getAttributeNode('src').nodeValue;
			return img;
		}
	}
}


function alterImage(el) 
{
	// Vergroting links:
	var enlargement = approachEnlargement(el)
	// Aangeklikte thumbnail:
	var thumb = getThumbSource(el);	
	// Nieuw sourceattribuut:
	var newAtt = document.createAttribute("src");
	newAtt.value = thumb;	
	// Verwijder bestaand attribuut:
	enlargement.removeAttribute("src");
	// Plaats nieuw attribuut:
	enlargement.setAttributeNode(newAtt);	
}
/*#### Einde ProductViewer ####*/



/*#### Gastenboek ####*/
function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else 
countfield.value = maxlimit - field.value.length;
}
/*#### Einde Gastenboek ####*/



