//-- flickering fix for IE6 but not IE7, Moz, Safari, Opera...
//if (typeof document.body.style.maxHeight == "undefined") {
try {
	document.execCommand('BackgroundImageCache', false, true);
} catch(e) { /* unless it's not IE6... */ }
//} // if

function toggle(id) {
	
	tbl = document.getElementById('table' + id);
	var visible = tbl.style.display ? '' : 'none';
	tbl.style.display = visible;
	
	
	if(document.getElementById('img' + id)) {
		h = document.images['img'+id].src;
		if (h.substring(h.length-8, h.length) == 'plus.gif') {
			document.images['img'+id].src = h.substring(0, h.length-8) + 'minus.gif';
		} else if (h.substring(h.length-9, h.length) == 'minus.gif') {
			document.images['img'+id].src = h.substring(0, h.length-9) + 'plus.gif';
		}
	}
}

function toggleImage (id) {
		
	if(document.getElementById('img' + id)) {
		h = document.images['img'+id].src;
		if (h.substring(h.length-8, h.length) == 'plus.gif') {
			document.images['img'+id].src = h.substring(0, h.length-8) + 'minus.gif';
		} else if (h.substring(h.length-9, h.length) == 'minus.gif') {
			document.images['img'+id].src = h.substring(0, h.length-9) + 'plus.gif';
		}
		
		if (h.substring(h.length-9, h.length-5) == 'open') {
			document.images['img'+id].src = h.substring(0, h.length-9) + 'close' + h.substring(h.length-5,h.length);
		} else if (h.substring(h.length-10, h.length-5) == 'close') {
			document.images['img'+id].src = h.substring(0, h.length-10) + 'open' + h.substring(h.length-5,h.length);
		}
	}
}

function EffectToggle(id) {
	
	//new Effect.toggle(idx, { afterFinish: function() {alert(idx);} });
	new Effect.toggle(id,'blind');
	
}

function toggleInfo(id) {
	
	for(var i=0;i<=3;i++) {
		
		if(document.getElementById('tr' + i)) {
			
			tr = document.getElementById('tr' + i);
			td = document.getElementById('td' + i);
			
			if(i==id) {
				tr.style.display = '';
				td.className = 'box2_sub2';
			} else {
				tr.style.display = 'none';
				td.className = 'box2_sub1';
			}
			
		}
		
	}
}

function calculate(field, x) {
	field.value = parseInt(field.value) + x;
	if(field.value < 0)
		field.value = 0;
	if(field.value > 998)
		field.value = 998;
	document.form1.submit();
}

function myPopup(strContent,strTitle,strBoxClass,intWidth,intHeight) {
				
	var win = new Window({className: "dialog", width: intWidth, height: intHeight, zIndex: 100, resizable: true, title: strTitle, showEffect:Effect.Appear, hideEffect: Effect.Fade, draggable:true, wiredDrag: true, minimizable:false, maximizable:false,destroyOnClose: true});
	win.getContent().innerHTML= "<div class='" + strBoxClass + "'>" + strContent + "</div>";
	win.setStatusBar("&nbsp;");
	win.showCenter();
	
}

