
function leftButtonHover(button)
{
	button.src = "images/" + button.id + "_red.png";
}

function leftButtonUnHover(button)
{
	button.src = "images/" + button.id + ".png";
}

function showProductZoom() {
  document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="600" height="256" id="zoom_view" align="middle"><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="zoom_view.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><embed src="zoom_view.swf" quality="high" bgcolor="#ffffff" width="600" height="256" name="zoom_view" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>');
}

function toggleSideNav(div_id, img_id, a_id)
{

  current_status = document.getElementById(div_id).style.display;

  //alert(current_status);

  if (current_status == 'none' || current_status == '')
  {
    document.getElementById(div_id).style.display = 'block';
    document.getElementById(img_id).src = 'images/arrow_open.gif';
    document.getElementById(a_id).style.color = '#c80031';
  }
  else
  {
    document.getElementById(div_id).style.display = 'none';
    document.getElementById(img_id).src = 'images/arrow_closed.gif';
    document.getElementById(a_id).style.color = '#333333';
  }
}

function confirmFields(formName) {

  var errorMessage = "";
  var numErrors = 0;

  for (var i = 0; i < document.forms[formName].elements.length; i++) {
    if (trim(document.forms[formName].elements[i].value) == "" && document.forms[formName].elements[i].attributes["required"] != null ) {
      errorMessage += "*   " + document.forms[formName].elements[i].attributes["required"].value + "\n";
      numErrors++;
    }
    }
    if (errorMessage != "") {
      if (numErrors == 1)
        alert ("Please fill in the following field:\n\n" + errorMessage);
      else
      alert ("Please fill in the following fields:\n\n" + errorMessage);
    return false;
  }
  else
    return true;
}

function trim(stringToTrim) {
    return stringToTrim.replace(/^\s+|\s+$/g,"");
}

function setShippingToBilling()
{
  if (document.billingForm.shipping_checkbox.checked)
  {
    document.billingForm.first_name_shipping.value = document.billingForm.first_name.value;
    document.billingForm.last_name_shipping.value = document.billingForm.last_name.value;
    document.billingForm.phone_shipping.value = document.billingForm.phone_billing.value;
    document.billingForm.email_shipping.value = document.billingForm.email_billing.value;
    document.billingForm.street_shipping.value = document.billingForm.street.value;
    document.billingForm.street_shipping2.value = document.billingForm.street2.value;
    document.billingForm.city_shipping.value = document.billingForm.city.value;
    document.billingForm.state_shipping.value = document.billingForm.state.value;
    document.billingForm.zip_shipping.value = document.billingForm.zip.value;
    document.billingForm.country_shipping.value = document.billingForm.country.value;
  }
}

function submitLoginForm()
{
  if (_CF_checkloginForm(document.loginForm))
  {
    document.loginForm.submit();
  }
}

function showHiddenDiv(div_name)
{
  the_div = document.getElementById(div_name);
  visibility = the_div.style.display;

  if (visibility == 'none')
  {
  the_div.style.display = 'block';
  }
}

function hideDiv(div_name)
{
  the_div = document.getElementById(div_name);
  the_div.style.display = 'none';
}

function enforceTextDefaultBlur(input_obj, text)
{
  if (input_obj.value == '')
    input_obj.value = text;
}

function enforceTextDefaultClick(input_obj, text)
{
  if (input_obj.value == text)
    input_obj.value = '';
}

function openWindow(url, width, height)
{
  window.open(url, 'popupWindow', 'location=0,status=0,scrollbars=1,toolbar=0,menubar=0,resizable=0,left=100,top=5,height=' + height + ',width=' + width);
}

//Author: Eric King Url: http://redrival.com/eak/index.shtml
//This script is free to use as long as this info is left in
//Courtesy of SimplytheBest.net - http://simplythebest.net/scripts/
var win = null;
function NewWindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
win = window.open(mypage,myname,settings)
}
