function toggleCategoryList(objName) {
	var theObj = objName + "-list";
	var thePreview = objName + "-preview";
	
	if (document.myForm[objName].checked) {
		getObject(theObj).display = "block";
		getObject(thePreview).display ="none";
	}
	else {
		getObject(theObj).display = "none";
		getObject(thePreview).display ="block";
	}
}

function toggleTM(objName) {
	//alert(objName);
	var theObj = objName + "-list";
	var thePreview = objName + "-preview";
	
	if (document.myForm[objName].checked) {
		getObject(theObj).display = "block";
		getObject(thePreview).display ="none";
	}
	else {
		getObject(theObj).display = "none";
		getObject(thePreview).display ="block";
	}
}

function toggleTMradio(objValue) {
	for (var i = 0; i < document.myForm.tm.length; i++) {
		objName = "tm"+i;
		var theObj = objName + "-list";
		var thePreview = objName + "-preview";
		
		if (document.myForm.tm[i].checked) {
			//if (document.myForm.tm[i].value == objValue) {
				getObject(theObj).display = "block";
				getObject(thePreview).display ="none";
			} else {
				getObject(theObj).display = "none";
				getObject(thePreview).display ="block";
			//}
		}
	}
			

}

function toggleEigenList() {
	var theObj = "eigenType-list";
	for (var i = 0; i < document.myForm.material.length; i++) {
		if (document.myForm.material[i].checked) {
			if (document.myForm.material[i].value == "Material") {
				getObject(theObj).display = "block";
			}
			else {
				getObject(theObj).display = "none";
			}
		}
	}
}

function toggleTransfo() {
	var theObj = "transfo-list";
	for (var i = 0; i < document.myForm.tfm_is.length; i++) {
		if (document.myForm.tfm_is[i].checked) {
			if (document.myForm.tfm_is[i].value == "1") {
				getObject(theObj).display = "block";
			}
			else {
				getObject(theObj).display = "none";
			}
		}
	}
}

// for transfor sketch
function toggleTF1(objName) {
	var theObj = objName + "-list";
	var thePreview = objName + "-preview";
	
	
	if (getObject(theObj).display == 'none') {
		getObject(theObj).display = "block";
		getObject(thePreview).display ="none";
	}
	else {
		getObject(theObj).display = "none";
		getObject(thePreview).display ="block";
	}
	
}


function alertDelete(id) {
	var warning = "Weet je zeker dat je deze bijdrage wilt verwijderen?\n";
	var popup = confirm(warning);
	if (popup != "0") {
		location.href = "delete.php?id=" + id;
	}
}

function alertDeleteFile(id, filename) {
	var warning = "Weet je zeker dat je het bestand " + filename + "wilt verwijderen?\nDit kan niet ongedaan gemaakt worden!\n";
	var popup = confirm(warning);
	if (popup != "0") {
		location.href = "delete.php?type=file&id=" + id;
	}
}

function sendLocation(loc) {
	location.href = loc;
}

function mudInit() {
	initDHTMLAPI();
}

// events
// gecko, safari, konqueror and generic
if (typeof window.addEventListener != 'undefined') {
	window.addEventListener('load', mudInit, false);
}
// opera 7
else if (typeof document.addEventListener != 'undefined') {
	document.addEventListener('load', mudInit, false);
}
// win/ie
else if (typeof window.attachEvent != 'undefined') {
	window.attachEvent("onload", mudInit);
}


// ----------------------------------------------------------------------------------------------
//
// 		FLASH RE-SIZE FUNCTIONS 
//
// ----------------------------------------------------------------------------------------------

function setFlashWidth(divid, newW){
	document.getElementById(divid).style.width = newW+"px";
}

function setFlashHeight(divid, newH){
	document.getElementById(divid).style.height = newH+"px";		
}

function setFlashSize(divid){
	var wHeight, wWidth, sHeight, sWidth, bitDepth;
	if (document.all) {
			//	ie compatible
			wHeight = document.body.clientHeight;
			wWidth = document.body.clientWidth;
			sHeight = screen.height;
			sWidth = screen.width;
	} else {
			//	mozilla/gecko compatible
			wHeight = window.innerHeight;
			wWidth = window.innerWidth;
			sHeight = screen.height;
			sWidth = screen.width;
	}	
	setFlashWidth(divid, wWidth);
	setFlashHeight(divid, wHeight);
}


function canResizeFlash(){
	var ua = navigator.userAgent.toLowerCase();
	var opera = ua.indexOf("opera");
	if( document.getElementById ){
		if(opera == -1) return true;
		else if(parseInt(ua.substr(opera+6, 1)) >= 7) return true;
	}
	return false;
}


function getSize() {
	var wHeight, wWidth, sHeight, sWidth, bitDepth;
	if (document.all) {
			//document.write("ie compatible;<br>");
			wHeight = document.body.clientHeight;
			wWidth = document.body.clientWidth;
			sHeight = screen.height;
			sWidth = screen.width;
	} else {
			//document.write("mozilla/gecko compatible;<br>");
			wHeight = window.innerHeight;
			wWidth = window.innerWidth;
			sHeight = screen.height;
			sWidth = screen.width;
	}
	
	//document.write("wHeight=" + wHeight + ";<br>");
	//document.write("wWidth=" + wWidth + ";<br>");

	//document.write("sHeight=" + sHeight + ";<br>");
	//document.write("sWidth=" + sWidth + ";<br>");

}





function chgImg(obj) {
	currnt = document[obj].src;
	smimg = 'http://www.zandstad.nl/tf/images/sm_'+obj+'.jpg';
	if (currnt == smimg) {
		document[obj].src = 'images/bg_'+obj+'.jpg';
	} else {
		document[obj].src = 'images/sm_'+obj+'.jpg';
		//window.location.reload();
	}
	
}


// TF show grid of images
function toggleLevel2(objName) {
	ob = objName+"-level1";
	ob_grid = objName+"-level2";
	//alert(document.getElementById(ob).style.display);
	document.getElementById(ob).style.display = "none";
	document.getElementById(ob_grid).style.display = "block";
	
}