var saveWidth = 0;

function scaleImg(what) {
what = document.getElementById(what);
if (navigator.appName=="Netscape")
winW = window.innerWidth;
if (navigator.appName.indexOf("Microsoft")!=-1)
winW = document.body.offsetWidth;
if (what.width>(720) || saveWidth>(720)) {
if (what.width==(720))
what.width=saveWidth;

else
{
saveWidth = what.width;
what.style.cursor = "pointer";
what.width=(720);
}
}
}

var h2 = document.getElementsByTagName("h2");

function addFields() {
var fields = document.getElementById("hidefields");

fields.setAttribute("id","showfields"); 
h2[0].innerHTML = '<a href="javascript:removeFields();">Remove Fields</a> | <a href="javascript:switchMode(1);">One-Click Upload Mode</a>';
}

function removeFields() {
var fields = document.getElementById("showfields");

fields.setAttribute("id","hidefields"); 
h2[0].innerHTML = '<a href="javascript:addFields();">Add More Fields</a> | <a href="javascript:switchMode(1);">One-Click Upload Mode</a>';
}

function switchMode(mode) {
var visUploader = document.getElementById("visible");
var hidUploader = document.getElementById("hidden");

visUploader.setAttribute("id","hidden");
hidUploader.setAttribute("id","visible");

if (mode == 1) {
h2[0].innerHTML = '<a href="javascript:switchMode();">Switch Back to Normal Mode</a>'; }
else {
h2[0].innerHTML = '<a href="javascript:addFields();">Add More Fields</a> | <a href="javascript:switchMode(1);">One-Click Upload Mode</a>'
}
}

function showFileName(real, fake) {
var actualInput = document.getElementById(real);
var fakeInput = document.getElementById(fake);

fakeInput.value = actualInput.value;
}

function resetInputIds() {
var allFields = document.getElementsByTagName("input");
for (i=0; i<allFields.length; i+=2) {
allFields[i].setAttribute("id","userfile");
}
return true;
}

function copy(text2copy) {
  if (window.clipboardData) {
    window.clipboardData.setData("Text",text2copy);
  } else {
    var flashcopier = 'flashcopier';
    if(!document.getElementById(flashcopier)) {
      var divholder = document.createElement('div');
      divholder.id = flashcopier;
      document.body.appendChild(divholder);
    }
    document.getElementById(flashcopier).innerHTML = '';
    var divinfo = '<embed src="_clipboard.swf" FlashVars="clipboard='+escape(text2copy)+'" width="0" height="0" type="application/x-shockwave-flash"></embed>';
    document.getElementById(flashcopier).innerHTML = divinfo;
  }
}

function copyWebsiteCodes() {
  var allText = document.getElementsByTagName("input");
  var textValues = new Array();
  var counter = 0;
  var textHolder = new String();
  
  for (i=0; i<allText.length; i+=3) {
    textValues[counter] = allText[i].value;
    counter++;
}
  for (i=0; i<textValues.length; i++) {
    textHolder = textHolder + " " + textValues[i];
}
   copy(textHolder); 
}

function copyForumCodes() {
  var allText = document.getElementsByTagName("input");
  var textValues = new Array();
  var counter = 0;
  var textHolder = new String();
  
  for (i=1; i<allText.length; i+=3) {
    textValues[counter] = allText[i].value;
    counter++;
}
  for (i=0; i<textValues.length; i++) {
    textHolder = textHolder + " " + textValues[i];
}
   copy(textHolder); 
}

function copyEmailCodes() {
  var allText = document.getElementsByTagName("input");
  var textValues = new Array();
  var counter = 0;
  var textHolder = new String();
  
  for (i=2; i<allText.length; i+=3) {
    textValues[counter] = allText[i].value;
    counter++;
}
  for (i=0; i<textValues.length; i++) {
    textHolder = textHolder + " " + textValues[i];
}
   copy(textHolder); 
}

