/**                  
 * westeneng.js
 *
 * The functions below are custom build
 * for www.westeneng-makelaardij.nl
 *
 * @version 	1.0
 * @author	A.J. de Vries	
 * @package	www.westeneng-makelaardij.nl
 * 
 * Copyright (c) 2005 Malibomba                               
 * IT IS NOT ALLOWED TO USE OR MODIFY ANYTHING OF THIS SITE,  
 * WITHOUT THE PERMISION OF THE AUTHOR.                       
 * Info? Mail to info@malibomba.com                           
 */
//<![CDATA[ 
document.write('<script type="text/javascript" src="/javascript/functions.js"></script>');
function toggle(eRadio) {
	if(typeof eRadio == 'object') {
		var eWOG = getElement('wog_tbody');
		var eBOG = getElement('bog_tbody');
		eWOG.style.display = (eRadio.value == 'wog') ? '' : 'none';
		eBOG.style.display = (eRadio.value == 'bog') ? '' : 'none';
		
		var aPricefields = new Array('minimum', 'maximum');
		for(var i = 0; i < aPricefields.length; i++) {
			var eField = getElement(aPricefields[i]);
			var eParent = eField.parentNode.parentNode;
			
			eField.style.display = (eRadio.value == 'bog') ?  'none' : '';
			eParent.style.display = (eRadio.value == 'bog') ?  'none' : '';
			eField.alt = (eRadio.value == 'bog') ? "0|integer" : "1|integer";
		}
		_initCheck();		
	}
}

//function slideShow(identifier, title) {
//	var event = new Object();
//	var url = '/slideshow.php?id='+identifier;
//	makePopup(event, 'slideshow', 680, 500, title, '#eeba3f', '#000', url);
//}

function slideShow(identifier) {
	var anchors = null;
	if( (anchors = $$('a:[rel="gallery[' + identifier + ']"]')).length > 0 ) {
		$(anchors[0]).simulate('click');
	}
	//lightview
}

function info(identifier, title) {
	var event = new Object();	
	var url = "info.php?id=" + identifier;
	makePopup(event, 'info', 500, 400, title, '#eeba3f', '#000', url);
}

function mail(identifier, title) {
	var event = new Object();	
	var url = "mailpage.php?id=" + identifier;
	makePopup(event, 'mail', 500, 300, title, '#eeba3f', '#000', url);
}

function map(zipcode, title) {
	var event = new Object();	
	var url = "/location.php?zipcode=" + zipcode;
	makePopup(event, 'map', 333, 313, title, '#eeba3f', '#000', url);
}

function printPage(identifier, title) {
	var event = new Object();	
	var url = '/printpage.php?id='+identifier;
	makePopup(event, 'printpage', 700, 500, title, '#eeba3f', '#000', url);
}


function openBrochure(brochure, title, acrobat) {	
	if(acrobat == true) {
		var event = new Object();
		var url = '/admin/uploaded/documents/'+brochure;
		makePopup(event, 'brochure', 700, 500, title, '#eeba3f', '#000', url);
	}
	else {
		var confirmed = confirm('Acrobat reader kon niet worden gevonden op uw computer!\nWilt u deze nu downloaden om alsnog de brochure te kunnen bekijken?');
		if(confirmed == true ) {
			window.open('http://www.adobe.nl/products/acrobat/readstep2.html');
		} 
	}
}


addEvent(window, 'load', function() {
		/**
		 * currentStyle restricts the Javascript to IE only 
		 */
		if(document.all && document.getElementById('nav').currentStyle) {  
			var navroot = document.getElementById('nav');
			var lis = navroot.getElementsByTagName("LI");  
			for(var i = 0; i < lis.length; i++) {
				/**
				 * If the LI has another menu level 
				 */
				if(lis[i].lastChild.tagName == "UL") {
					/**
					 * Check if the title of the current lis is set
					 * to 'selected'. If so, then show its childrend (li element)
					 * as a block.
					 */
					if(lis[i].lastChild.title == 'selected') {

						lis[i].lastChild.style.display = "block";
					} else {

						lis[i].onmouseover = function() {
							this.lastChild.style.display = "block";
						}
						lis[i].onmouseout = function() {
							this.lastChild.style.display = "none";
						}
					}
				}
			}
		}
	}
);
//]]>