// Use the Prototype blind functions and some class setting to create a curtain up and down
// effect got elements.  Assume the element is display:none;
function blind(idtoblind) {

	if($(idtoblind).hasClassName('blinddown')) {

		$(idtoblind).addClassName('blindup');
		$(idtoblind).removeClassName('blinddown');

		Effect.BlindUp(idtoblind, {duration: 1.0});

	} else {

		$(idtoblind).addClassName('blinddown');
		$(idtoblind).removeClassName('blindup');

		Effect.BlindDown(idtoblind, {duration: 1.0});
	}

	return false;

}


function AddSelectOption(selectObj, text, value, isSelected) 
{
    if (selectObj != null && selectObj.options != null)
    {
        selectObj.options[selectObj.options.length] = 
            new Option(text, value, false, isSelected);
    }
}

function roundNumber(num, dec) {
	var result = Math.round(num*Math.pow(10,dec))/Math.pow(10,dec);
	return result;
}

function toggleFilters(id) {
	
	var lis 	= $(id).getElementsByTagName("li");
	var type	= '';	// If we're showing or hiding, allows us to change the UPDATE string
	for(var n=3;n<lis.length;n++) {
		if(lis[n].id != '') {
			if(lis[n].getStyle('display') != 'block') {
				lis[n].setStyle({display: 'block'});
				type = 'show'
			} else {
				lis[n].setStyle({display: 'none'});
				type = 'hide';
			}
		}
	}
	
	if(type == 'show') { 
		$('more-'+id).update('Hide Extra Options');
	} else {
		$('more-'+id).update('View More &raquo;');
	}
	
	return false;
}

function showByClassName(classname) { 
	return true; 
}
