function HideContent(d) {
	if(d.length < 1) { return; }
	document.getElementById(d).style.display = "none";
}
function ShowContent(d) {
	if(d.length < 1) { return; }
	document.getElementById(d).style.display = "block";
}
function ReverseContentDisplay(d) {
	if(d.length < 1) { return; }
	if(document.getElementById(d).style.display == "none") { document.getElementById(d).style.display = "block"; }
	else { document.getElementById(d).style.display = "none"; }
}
function SetRadio(RadioID) {
    document.orderform.fotooptie[RadioID].checked = true;
}
function textCounter(field,cntfield,maxlimit) {
		if (field.value.length > maxlimit)
		field.value = field.value.substring(0, maxlimit);
		else
		cntfield.value = maxlimit - field.value.length;
}
function imgpopup(id_var) {
		var prod_id = id_var;
		window.open('card_popup.php?id='+prod_id,'cardpopup','scrolling=no,status=1,resizable=no,width=400,height=400');
}
/*function calculate()
{
var product = document.orderform.product.value;
var productoms = document.orderform.productoms.value;
var productcosts = parseFloat(document.orderform.productprijs.value);
var shippingmethod = document.orderform.verzendmethode.value;
if(shippingmethod=="Nederland - brievenbus post (+ &#8364; 1,76)")
	{
		var shippingcost=parseFloat(1.76);
	}	
	else if(shippingmethod=="Nederland - aangetekend (+ &#8364; 7,00)"){
		var shippingcost=parseFloat(7.00);
	}	
	else if(shippingmethod=="Buitenland - binnen Europa (+ &#8364; 3,08)"){
		var shippingcost=parseFloat(3.08);
	}	
	else if(shippingmethod=="Buitenland - buiten Europa (+ &#8364; 5,70)"){
		var shippingcost=parseFloat(5.70);
	}	
  var shippingcost=parseFloat(shippingmethod);
	var totalcosts=((shippingcost+productcosts).toFixed(2)).toString();
	var totalcosts=totalcosts.replace(".", ",");
	var totalcosts=totalcosts.replace(",00", ",-");
	document.orderform.verzendkosten.value = shippingcost;
	document.orderform.totaalprijs.value = totalcosts;
	document.getElementById('totalproduct').innerHTML='Totaalbedrag ('+productoms+' + verzendkosten):';
	document.getElementById('totalprice').innerHTML='&#8364; '+totalcosts;
}*/
function clearReceiveDate()
{
	document.orderform.ontvangstdag.value = "";
	document.orderform.ontvangstdag.disabled = true;
	document.orderform.ontvangstdag.style.border = "1px solid #FFFFFF";
	document.orderform.ontvangstdag.style.background = "#E3E3E3";
	document.orderform.ontvangstmaand.value = "";
	document.orderform.ontvangstmaand.disabled = true;
	document.orderform.ontvangstmaand.style.border = "1px solid #FFFFFF";
	document.orderform.ontvangstmaand.style.background = "#E3E3E3";
	document.orderform.ontvangstjaar.value = "";
	document.orderform.ontvangstjaar.disabled = true;
	document.orderform.ontvangstjaar.style.border = "1px solid #FFFFFF";
	document.orderform.ontvangstjaar.style.background = "#E3E3E3";
}
function setReceiveDate()
{
	document.orderform.ontvangstdag.disabled = false;
	document.orderform.ontvangstmaand.disabled = false;
	document.orderform.ontvangstjaar.disabled = false;
}
function clearFileInputField(tagId) 
{
	document.getElementById(tagId).innerHTML = document.getElementById(tagId).innerHTML; 
} 
function Nextfield(evt,nextelmnt,elmnt,content)
{
if (content.length==elmnt.maxLength)
	{
		if(evt.keyCode!=9){
			document.orderform[nextelmnt].focus();
		}
	}
}
function MM_showHideLayers() { //v9.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
function startupThings()
{
	calculate();
	MM_showHideLayers('button_active','','show','button_inactive','','hide'); 
	if (document.orderform.verzendmoment[1].checked)
	{
		document.orderform.ontvangstdag.disabled = false;
		document.orderform.ontvangstmaand.disabled = false;
		document.orderform.ontvangstjaar.disabled = false;
	}
}
function resetThings()
{
	document.getElementById('warning').innerHTML="";
	MM_showHideLayers('button_active','','show','button_inactive','','hide'); 
}
function SetVkNL()
{
	document.orderform.verzendmethode.selectedIndex=0;
	calculate();
}
function SetVkBL()
{
	document.orderform.verzendmethode.selectedIndex=2;
	calculate();
}
function getFlashMovie(movieName) {
  var isIE = navigator.appName.indexOf("Microsoft") != -1;
  return (isIE) ? window[movieName] : document[movieName];
}
function playMP3(a,b) {
  var text = a;
  var movie = b;
  getFlashMovie(b).sendTextToFlash(text);
}
function printfactuur(){
var div_content = document.getElementById("printfactuur-content").innerHTML;
var myWin = window.open("","myWin","menubar,scrollbars, resizable, directories=no,location=no, height=500px,width=650px");
myWin.document.write(('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><title>Factuur van uw bestelling op stuureenlichtje.nl!</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head><body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" style="margin-top:-20px;">'+div_content+'</body></html>'));
myWin.document.close();
} 
function JoinMailinglist() 
{ 
	var email = document.orderform.ymlp.value;
	if(email.length>0){
		window.frames["newsletterholder"].document.getElementById("YMP0").value=email;
		window.frames["newsletterholder"].document.forms["newsletter"].submit();
	}
}
//http://ymlp.com/subscribe.php?YMLPID=gesmjuhgmgh

//** Tab Content script- &copy; Dynamic Drive DHTML code library (http://www.dynamicdrive.com)
//** Last updated: Nov 8th, 06

var enabletabpersistence=0 //enable tab persistence via session only cookies, so selected tab is remembered?

////NO NEED TO EDIT BELOW////////////////////////
var tabcontentIDs=new Object()

function expandcontent(linkobj){
var ulid=linkobj.parentNode.parentNode.id //id of UL element
var ullist=document.getElementById(ulid).getElementsByTagName("li") //get list of LIs corresponding to the tab contents
for (var i=0; i<ullist.length; i++){
ullist[i].className=""  //deselect all tabs
if (typeof tabcontentIDs[ulid][i]!="undefined") //if tab content within this array index exists (exception: More tabs than there are tab contents)
document.getElementById(tabcontentIDs[ulid][i]).style.display="none" //hide all tab contents
}
linkobj.parentNode.className="selected"  //highlight currently clicked on tab
document.getElementById(linkobj.getAttribute("rel")).style.display="block" //expand corresponding tab content
saveselectedtabcontentid(ulid, linkobj.getAttribute("rel"))
}

function expandtab(tabcontentid, tabnumber){ //interface for selecting a tab (plus expand corresponding content)
var thetab=document.getElementById(tabcontentid).getElementsByTagName("a")[tabnumber]
if (thetab.getAttribute("rel"))
expandcontent(thetab)
}

function savetabcontentids(ulid, relattribute){// save ids of tab content divs
if (typeof tabcontentIDs[ulid]=="undefined") //if this array doesn't exist yet
tabcontentIDs[ulid]=new Array()
tabcontentIDs[ulid][tabcontentIDs[ulid].length]=relattribute
}

function saveselectedtabcontentid(ulid, selectedtabid){ //set id of clicked on tab as selected tab id & enter into cookie
if (enabletabpersistence==1) //if persistence feature turned on
setCookie(ulid, selectedtabid)
}

function getullistlinkbyId(ulid, tabcontentid){ //returns a tab link based on the ID of the associated tab content
var ullist=document.getElementById(ulid).getElementsByTagName("li")
for (var i=0; i<ullist.length; i++){
if (ullist[i].getElementsByTagName("a")[0].getAttribute("rel")==tabcontentid){
return ullist[i].getElementsByTagName("a")[0]
break
}
}
}

function initializetabcontent(){
for (var i=0; i<arguments.length; i++){ //loop through passed UL ids
if (enabletabpersistence==0 && getCookie(arguments[i])!="") //clean up cookie if persist=off
setCookie(arguments[i], "")
var clickedontab=getCookie(arguments[i]) //retrieve ID of last clicked on tab from cookie, if any
var ulobj=document.getElementById(arguments[i])
var ulist=ulobj.getElementsByTagName("li") //array containing the LI elements within UL
for (var x=0; x<ulist.length; x++){ //loop through each LI element
var ulistlink=ulist[x].getElementsByTagName("a")[0]
if (ulistlink.getAttribute("rel")){
savetabcontentids(arguments[i], ulistlink.getAttribute("rel")) //save id of each tab content as loop runs
ulistlink.onclick=function(){
expandcontent(this)
return false
}
if (ulist[x].className=="selected" && clickedontab=="") //if a tab is set to be selected by default
expandcontent(ulistlink) //auto load currenly selected tab content
}
} //end inner for loop
if (clickedontab!=""){ //if a tab has been previously clicked on per the cookie value
var culistlink=getullistlinkbyId(arguments[i], clickedontab)
if (typeof culistlink!="undefined") //if match found between tabcontent id and rel attribute value
expandcontent(culistlink) //auto load currenly selected tab content
else //else if no match found between tabcontent id and rel attribute value (cookie mis-association)
expandcontent(ulist[0].getElementsByTagName("a")[0]) //just auto load first tab instead
}
} //end outer for loop
}

function getCookie(Name){ 
var re=new RegExp(Name+"=[^;]+", "i"); //construct RE to search for target name/value pair
if (document.cookie.match(re)) //if cookie found
return document.cookie.match(re)[0].split("=")[1] //return its value
return ""
}

function setCookie(name, value){
document.cookie = name+"="+value //cookie value is domain wide (path=/)
}
