function imageSwap(daImage, daSrc){
  var objStr,obj;

  // Check to make sure that images are supported in the DOM.
  if(document.images){
    // Check to see whether you are using a name, number, or object
    if (typeof(daImage) == 'string') {
      // This whole objStr nonesense is here solely to gain compatability
      // with ie3 for the mac.
      objStr = 'document.' + daImage;
      obj = eval(objStr);
      obj.src = daSrc;
    } else if ((typeof(daImage) == 'object') && daImage && daImage.src) {
      daImage.src = daSrc;
    }
  }
}

function preloadImages() {
/*
Usage: preloadImages('image 1 URL', 'image 2 URL', 'image 3 URL', ...);
*/

  // Don't bother if there's no document.images
  if (document.images) {
    if (typeof(document.WM) == 'undefined'){
      document.WM = new Object();
    }
    document.WM.loadedImages = new Array();
    // Loop through all the arguments.
    var argLength = preloadImages.arguments.length;
    for(arg=0;arg<argLength;arg++) {
      // For each arg, create a new image.
      document.WM.loadedImages[arg] = new Image();
      // Then set the source of that image to the current argument.
	  //alert (preloadImages.arguments[arg]);
      document.WM.loadedImages[arg].src = preloadImages.arguments[arg];
    }
  }
}

var imageList = "'/images/spacer.gif'";

function init() {
	if (imageList != '') {
		eval("preloadImages(" + imageList + ");");
		//alert ("preloadImages(" + imageList + ");");
	}
}

var cc=0;
function insertLogin() {
	//browser detection && !ns4
	dom = (document.getElementById) ? true : false;
	ns5 = ((navigator.userAgent.indexOf("Gecko")>-1) && dom) ? true: false;
	ie5 = ((navigator.userAgent.indexOf("MSIE")>-1) && dom) ? true : false;
	ns4 = (document.layers && !dom) ? true : false;
	ie4 = (document.all && !dom) ? true : false;

	// hardcoding the cell we want to change the content for

	opencontent = "<form action='https://secure.hostgs.com/frameset.vps' Method='Post'><table cellpadding='0' cellspacing='7' border='0'><tr><td valign='top'><font class='copy'>Username:</font><br><input type='text' class='input' name='username' size='10'></td></tr><tr><td valign='top'><font class='copy'>Password:</font><br><input type='password' class='input' name='password' size='10'></td></tr><tr><td><input type='image' src='/assets/images/login.gif'></td></tr></table><font class='copy'><A HREF='javascript:launchPasswordWizard();'>Forgot your password?</A><br><input type='hidden' name='EvwIspDn' value='o=GlobalScape,ou=Clients,o=FCTY'></form>";
	//opencontent = "<form method=\"post\"><span class=\"copy\">User Name</span><br><input type=\"text\" name=\"username\" size=\"8\" class=\"homepagelogin\"><br><span class=\"copy\">Password</span><br><input type=\"password\" name=\"password\" size=\"8\" class=\"homepagelogin\"><br><input type=\"image\" src=\"/assets/images/double_arrow_submit.gif\" border=\"0\"></form>";
	closecontent = "";

	// cross browser code is from: http://wsabstract.com/javatutors/dynamiccontent5.shtml
	if (document.all) {
		myCell = document.getElementById('login_cell');
		if (cc==0)
		{	// if in the original state and the arrow is clicked on
			// show the login form
			cc=1;
			myCell.innerHTML=opencontent;
		}
		else
		{	// state shows the login form, remove it
			cc=0;
			myCell.innerHTML=closecontent;
		}
	}
		//else if NS 4
	else if (document.layers){
		if (cc==0)
		{	// if in the original state and the arrow is clicked on
			// show the login form
			cc=1;
			document.ns4dcontent.document.ns4dcontent2.document.write(opencontent);
			document.ns4dcontent.document.ns4dcontent2.document.close();
		}
		else
		{	// state show sthe login form, remove it
			cc=0;
			document.ns4dcontent.document.ns4dcontent2.document.write(closecontent);
			document.ns4dcontent.document.ns4dcontent2.document.close();
		}
	}

}

function showHide() {
	//loginBlock.className='visible';
	//document.layer.loginBlock.display.value='run-in';
	//htmlcode="<form method=\"post\" action=\"index.html\">User name<br><input type=\"text\" name=\"username\" size=\"8\" class=\"homepagelogin\"><br>Password<br><input type=\"password\" name=\"password\" size=\"8\" class=\"homepagelogin\"><br><input type=\"image\" src=\"images/double_arrow_submit.gif\" border=\"0\">";
	//layerWrite('loginBlock',null,'<SPAN CLASS="visible">'+htmlcode+'</SPAN>');
	if(	document.all['loginBlock'].style.display =='none') {nextState='block'} else {nextState='none'};
	document.all['loginBlock'].style.display = nextState;
	//document.all('loginBlock').style.visibility = "visible";


}


function launchPasswordWizard()
{
   var popup;

   popup = window.open("https://secure.hostgs.com/Includes/passwordWizard.jsp","PasswordWizard","width=410,height=260,titlebar=no, scrollbars=no, status=no, toolbar=no, menubar=no, resizable=yes");
}

function validateDownloadForm()
{
    var optIn           = document.getElementById('optIn');
    var errorMessage    = 'You must sign up for our mailing list '
      + 'in exchange for\nreceiving the free trial version of '
      + 'our software.';

    if (optIn.checked) {
        return true;
    } else {
        alert(errorMessage);
        return false;
    }
}

