function changeForm()
{
  var subjects = new Array("General Inquiry", "Billing Inquiry", "Item Inquiry", "Save Request", "Wanted Application", "General Inquiry Explain", "Billing Inquiry Explain", "Item Inquiry Explain", "Save Request Explain", "Wanted Application Explain");
  var current = document.contact.topic.value;
  var explain = document.contact.topic.value + " Explain";
  for(var i=0; i < subjects.length; i++)
  {
    if(subjects[i] == current || subjects[i] == explain) {
      document.getElementById(subjects[i]).style.display == '';}
    else {
      document.getElementById(subjects[i]).style.display == 'none';}
  }
}

function currencyalert(msg, url)
{
  alert(msg);
  window.location = url;
}

function expand(change, hide)
{
  style = document.getElementById(hide).style;
  chng = document.getElementById(change);
  if(style.display == 'none')
  {
    style.display = '';
    chng.innerHTML = "<img src=\"images/cart/cartarrow2.gif\" alt=\"\" />";
  }
  else
  {
    style.display = 'none';
    chng.innerHTML = "<img src=\"images/cart/cartarrow1.gif\" alt\"\" />";
  }
}

function image_cycle(images, change, direction)
{
  var arr = images.split(',');
  var image = document.getElementById(change);
  var position = 0;

  for(var i = 0; i < arr.length; i++)
  {
    if(arr[i] == image.src) {
      position = i;}
  }

  var new_index = position + direction;

  if(new_index < 0) {
    new_index = arr.length - 1;}
  else {
    new_index = new_index % arr.length;}

  image.src = arr[new_index];
}

function toggle_video(width, height, embedID, textID, cellID, text)
{
  var oldHeight = document.getElementById(embedID).height;
  var oldWidth = document.getElementById(embedID).width;
  var oldText = document.getElementById(textID).innerHTML;

  var newURL = "toggle_video('"+oldWidth+"', '"+oldHeight+"', '"+embedID+"', '"+textID+"', '"+cellID+"', '"+oldText+"');";
  var newCell = "<a class=\"listingVideoExpand\" href=\"#\" onclick=\""+newURL+"\"><span id=\"videoText\">"+text+"</span></a></td>";

  document.getElementById(embedID).height = height;
  document.getElementById(embedID).width = width;
  document.getElementById(cellID).innerHTML = newCell;
}

function display_download(link, change)
{
  var html = document.getElementById(change);
  html.innerHTML = "<a href=\""+link+"\" class=\"detailsDownloadLink\">Download</a>";
}

