//alert("test");



function update_extra_preview_url(imageid)

  {

  image_height = document.getElementById("image_height").value;

  image_width = document.getElementById("image_width").value;

  image_link_id = "extra_preview_link_"+imageid;

  //alert(image_link_id);

  if(((image_height > 0) && (image_height <= 1024)) && ((image_width > 0) && (image_width <= 1024)))

    {

    new_url = "index.php?view_preview=true&imageid="+imageid+"&height="+image_height+"&width="+image_width+"";

    //alert(document.getElementById(image_link_id).getAttribute('href'));

    document.getElementById(image_link_id).setAttribute('href',new_url);

    }

    else

      {

      //alert(document.getElementById(image_link_id).getAttribute('href'));

      new_url = "index.php?view_preview=true&imageid="+imageid+"";

      document.getElementById(image_link_id).setAttribute('href',new_url);

      }

  return false;

  }





function add_image_upload_forms(state)

  {

  time = new Date();

  if(state == null)

    {

    state = '';

    }

  new_element_number = time.getTime();

  new_element_id = "image_form_id_"+new_element_number;

  

  form_html = "<table class='add_extra_images'>\n\r";

          

  form_html += "  <tr>\n\r";

  form_html += "    <td colspan='2'>\n\r";

  form_html += "    <hr class='image_seperator' />";

  form_html += "    </td>\n\r";

  form_html += "  </tr>\n\r";

  

  form_html += "  <tr>\n\r";

  form_html += "    <td colspan='2'>\n\r";

  form_html += "      <br />\n\r";

  form_html += "      <strong class='form_group'><?php echo TXT_WPSC_PRODUCTIMAGES;?></strong>\n\r";

  form_html += "    </td>\n\r";

  form_html += "  </tr>\n\r";

  form_html += "  <tr>\n\r";

  form_html += "    <td style='width: 120px;'>\n\r";

  form_html +=  TXT_WPSC_PRODUCTIMAGE +"\n\r";

  form_html += "    </td>\n\r";

  form_html += "    <td>\n\r";

  form_html += "      <input type='file' name='extra_image["+new_element_number+"]' value='' />\n\r";

  form_html += "    </td>\n\r";

  form_html += "  </tr>\n\r";  

  

  new_element = document.createElement('div');

  new_element.id = new_element_id;

   

  document.getElementById(state+"additional_images").appendChild(new_element);

  document.getElementById(new_element_id).innerHTML = form_html;

  return false;

  }