function swapImage(e, src){
  $(e).src = src;
}

function swapBkgImage(e, src){
  //alert_debug($(e));
  $(e).style.backgroundImage = 'url('+src+')';
  //alert("image swapped :"+$(e).style.backgroundImage+":");
}

function alert_debug(obj)
{
  // debugging function
  
  var str = "";
  for (var prop in obj) {
    str = str + prop + " = " + obj[prop] + ";";
  }
  //if($('debug')){
    //$('debug').innerHTML = str;
  //}else{
    alert("Debug: " + str);
  //}
}


function show_standalone_form()
{
  try {
    Element.show("standalone_form");
    //Element.hide("overflow_form");
    
  }
  catch (e)
  {
    //alert('RJS error:\n\n' + e.toString()); alert('Element.show(\"new_form\");\nElement.hide(\"churn_form\");');
    throw e
  }
}

function hide_existing_login()
{
  Element.hide("existing_customer_login");
  Element.show("signup");
}

function show_existing_login()
{
  Element.show("existing_customer_login");
  Element.hide("signup");
}


function hide_dd_form()
{
  try {
    Element.show("credit_card_form");
    Element.hide("direct_debit_form");
  }
  catch (e)
  {
    alert('RJS error:\n\n' + e.toString()); alert('Element.show(\"credit_card_form\");\nElement.hide(\"direct_debit_form\");');
    throw e
  }

}

function hide_cc_form()
{
  try {
    Element.hide("credit_card_form");
    Element.show("direct_debit_form");
  }
  catch (e)
  {
    alert('RJS error:\n\n' + e.toString()); alert('Element.hide(\"credit_card_form\");\nElement.show(\"direct_debit_form\");');
    throw e
  }
}

