function catSlideToggle(parentID) {
	if ($('catSlide_' + parentID.toString()).hasClassName('Description')) {
		$('catSlide_' + parentID.toString()).hide().removeClassName('Description');
	}
	
	if ($('catSlide_' + parentID.toString()).visible()) {
		$('catSlide_' + parentID.toString()).slideUp({ duration: 0.2 });
		$('catSlideText_' + parentID.toString()).innerHTML = '... more';
	}
	else {
		$('catSlide_' + parentID.toString()).slideDown({ duration: 0.2 });
		$('catSlideText_' + parentID.toString()).innerHTML = '... less';
	}
}

function toggleFilterOptions() {
    if ($('FilterOptions') != null) {
        if ($('FilterOptions').hasClassName('Description')) $('FilterOptions').hide().removeClassName('Description');

        if ($('FilterOptions').visible()) {
            $('FilterOptions').slideUp({ duration: 0.5 });
        }
        else {
            $('FilterOptions').slideDown({ duration: 0.5 });
        }
    }
}
function showProductVideoLeiberts(divID,videoName) {
		var oVideo = document.getElementById(divID);
		oVideo.style.display = 'block';
		
		if (videoName != '') {
			//show it
			
			flowAPI = flashembed(divID,
			  {
				 src:'/FlowPlayerLP.swf',
					width: 195,
					height: 120
			  },
	
			  {config: {
					videoFile: videoName,
					autoPlay: false
			  }}
		   );
		}
	}
function formatCurrency(amount) {
    var i = parseFloat(amount);
    if (isNaN(i)) { i = 0.00; }
    var minus = '';
    if (i < 0) { minus = '-'; }
    i = Math.abs(i);
    i = parseInt((i + .005) * 100);
    i = i / 100;
    s = new String(i);
    if (s.indexOf('.') < 0) { s += '.00'; }
    if (s.indexOf('.') == (s.length - 2)) { s += '0'; }
    s = minus + s;
    return s;
}
function setOption(optValue) {
	$('options').value = $('option_' + optValue).value;
	
	if ($('option_' + optValue + '_extra')) 
	{
		var offset = $('option_' + optValue + '_extra').value.split(';')[0];
		var optCost = $('option_' + optValue + '_extra').value.split(';')[1];
		var optImg = $('option_' + optValue + '_extra').value.split(';')[2];
		
		if (optImg != '') {
			$('imgMain').src = "../getdynamicimage.aspx?path=" + optImg + "&width=280&height=280";
		}
		else {
			$('imgMain').src = "../getdynamicimage.aspx?path=" + $('defaultImage').value + "&width=280&height=280";
		}
		
		if ($('useOffset').value == "yes") {
    	if (parseFloat(offset) >= 0)
    	{
    		var newList = parseFloat($('baseList').value) + parseFloat(offset);
    		var newPrice = parseFloat($('basePrice').value) + parseFloat(offset);
    	
    		if ($('ListPrice')) { $('ListPrice').innerHTML = 'List Price: $' + formatCurrency(newList); }    	
    		$('Price').innerHTML = 'Our Price: $' + formatCurrency(newPrice);
  		}
  	}
  	else {
  		var newList = parseFloat(optCost);
  		var newPrice = parseFloat($('basePrice').value) + parseFloat(offset);
  		var newSave = newList - newPrice;
  		
  		if ($('ListPrice')) { $('ListPrice').innerHTML = 'List Price: $' + formatCurrency(newList); }    	
    	$('Price').innerHTML = 'Our Price: $' + formatCurrency(newPrice);
    	$('YouSave').innerHTML = 'You Save: $' + formatCurrency(newSave);	
  	}
  }
}
