function hideBox(boxID,boxName) {
	if (document.getElementById(boxID).style.display != 'none') {
    $('#' + boxID).slideToggle("normal");
		document.getElementById(boxID + 'B').innerHTML = 'Show<img src="/images/expand.png" width="13" height="9">';
		document.getElementById(boxID + 'B').title = 'Click to show ' + boxName;
	}
	else {
		 $('#' + boxID).slideToggle("normal");
		document.getElementById(boxID + 'B').innerHTML = 'Hide<img src="/images/collapse.png" width="13" height="9">';
		document.getElementById(boxID + 'B').title = 'Click to hide ' + boxName;
	}
}

function hideBox2(boxID,boxName) {
	if (document.getElementById(boxID).style.display != 'none') {
		document.getElementById(boxID).style.display = 'none';
		document.getElementById(boxID + 'B').innerHTML = '<img src="/images/expand2.png" width="13" height="9">';
		document.getElementById(boxID + 'B').title = 'Click to show ' + boxName;
	}
	else {
		document.getElementById(boxID).style.display = 'block';
		document.getElementById(boxID + 'B').innerHTML = '<img src="/images/collapse2.png" width="13" height="9">';
		document.getElementById(boxID + 'B').title = 'Click to hide ' + boxName;
	}
}

function openMediaPlayer(DiscID) {
  var so = new SWFObject('/scripts/player.swf','ply','400','300','9','##');
  so.addParam('allowfullscreen','false');
  so.addParam('allowscriptaccess','always');
  so.addParam('wmode','opaque');
  so.addVariable('playlistfile','/player_playlist.cfm?disc_id=' + DiscID);
  so.addVariable('playlist','bottom');
  so.addVariable('frontcolor','cccccc');
  so.addVariable('lightcolor','66cc00');
  so.addVariable('skin','/scripts/modieus.zip')
  so.addVariable('backcolor','111111');
  so.addVariable('playlistsize','270');
	so.addVariable('repeat','list');
	so.addVariable('autostart','true');
  so.write('mediaspaceflash');
	document.getElementById('mediaspace').style.visibility = 'visible';
}

function closeMediaPlayer() {
	document.getElementById('mediaspaceflash').innerHTML = '&nbsp;';
	document.getElementById('mediaspace').style.visibility = 'hidden';
}

function popupWindow(popUp,vars) {
	popUpWindow = window.open(popUp, "popUp", vars)
	popUpWindow.focus()
}

function checkProductOptionDropBox(productForm,optionTypeName) {
	if (productForm.option_id.value==-1) {
		alert("You must select a " + optionTypeName + " for the product");
		return false;
	}
	else {
		return true;
	}
}

function selectBillingRowEffect(object,row,rows) {
	// Set other rows to default style
	for (i=1;i<=rows;i++)
	{
		identity=document.getElementById('billingRow'+(i-1));
		identity.className = 'checkoutRow';
	}
	// set row to selected style
	identity=document.getElementById('billingRow'+row);
	identity.className = 'checkoutRowSelected';
	// one button is not an array
  if (document.billForm.billing_address_id[0]) {
    document.billForm.billing_address_id[row].checked=true;
  } else {
    document.billForm.billing_address_id.checked=true;
  }
}

function selectShippingRowEffect(object,row,rows) {
	// Set other rows to default style
	for (i=1;i<=rows;i++)
	{
		identity=document.getElementById('shippingRow'+(i-1));
		identity.className = 'checkoutRow';
	}
	// set row to selected style
	identity=document.getElementById('shippingRow'+row);
	identity.className = 'checkoutRowSelected';
	// one button is not an array
  if (document.billForm.shipping_address_id[0]) {
    document.billForm.shipping_address_id[row].checked=true;
  } else {
    document.billForm.shipping_address_id.checked=true;
  }
}

function selectShippingTypeRowEffect(object,row,rows) {
	// Set other rows to default style
	for (i=1;i<=rows;i++)
	{
		identity=document.getElementById('shippingTypeRow'+(i-1));
		identity.className = 'checkoutRow';
	}
	// set row to selected style
	identity=document.getElementById('shippingTypeRow'+row);
	identity.className = 'checkoutRowSelected';
	// one button is not an array
  if (document.shippingForm.ShippingType[0]) {
    document.shippingForm.ShippingType[row].checked=true;
  } else {
    document.shippingForm.ShippingType.checked=true;
  }
}

function selectPaymentTypeRowEffect(object,row,rows) {
	// Set other rows to default style
	for (i=1;i<=rows;i++)
	{
		identity=document.getElementById('paymentTypeRow'+(i-1));
		identity.className = 'checkoutRow';
	}
	// set row to selected style
	identity=document.getElementById('paymentTypeRow'+row);
	identity.className = 'checkoutRowSelected';
	// one button is not an array
  if (document.shippingForm.payment_type_id[0]) {
    document.shippingForm.payment_type_id[row].checked=true;
  } else {
    document.shippingForm.payment_type_id.checked=true;
  }
}

function rowOverEffect(object) {
  if (object.className == 'checkoutRow') object.className = 'checkoutRowOver';
}

function rowOutEffect(object) {
  if (object.className == 'checkoutRowOver') object.className = 'checkoutRow';
}
