﻿function download() {
	//var url='/main/AppDownload.jsp?os='+document.getElementById("os").options[0].option+"&email="+document.getElementById("email").value;
	selValue = document.dlForm.osSelect.options[document.dlForm.osSelect.selectedIndex].innerHTML;
	email = document.getElementById("email").value;
	var url = '/main/AppDownload.jsp?email='+email+'&os='+selValue;
	alert(url);
	//newwindow=window.open(url,'name','height=400,width=200');
	//if (window.focus) { newwindow.focus() }
	//document.getElementById('email').value="";
}
function enable() {
	var form = document.getElementById("download");
	
	var div = document.createElement("div");
	div.setAttribute("id", "added");
	
	//email address input
	var addr = document.createElement("p");
	addr.appendChild( document.createTextNode("Email Address ") );
	var font = document.createElement("font");
	font.style.color = "red";
	font.innerHTML = "(Required)";
	addr.appendChild(font);
	var addIn = document.createElement("input");
	addIn.setAttribute("type", "text");
	addIn.setAttribute("size", "45");
	addIn.setAttribute("name", "email");
	addr.appendChild(addIn);
	div.appendChild( addr );

	//os select
	var sel = document.createElement("p");
	sel.appendChild( document.createTextNode("Operating System") );
	var osSel = document.createElement("select");
	sel.appendChild( osSel );
	
	osSel.setAttribute("name", "os");
	osSel.setAttribute("siz", "1");
	var op = document.createElement("option");
	op.innerHTML = "Microsoft Windows";
	osSel.appendChild( op );
	op = document.createElement("option");
	op.innerHTML = "Linux";
	osSel.appendChild(op);
	op = document.createElement("option");
	op.innerHTML = "Mac OS X";
	osSel.appendChild( op);
	div.appendChild( sel );
	op = document.createElement("option");
	op.innerHTML = "Solaris";
	osSel.appendChild(op);		
	
	
	//submission button
	var sub = document.createElement("input");
	sub.setAttribute("type", "submit");
	sub.defaultValue = sub.value = 'Submit';
	div.appendChild(sub);
	
	form.appendChild( div );
	document.getElementById("enableButton").onclick= function () {};
	document.getElementById("disableButton").onclick= function () { disable(); };
}
function disable() {
	var added = document.getElementById("added");
	added.parentNode.removeChild( added );
	document.getElementById("enableButton").onclick = function () { enable(); };
	document.getElementById("disableButton").onclick = function () {};
}

var dlForm =	"<div id=\"added\"><p>Email Address <font color=\"#FF0000\">(Required)</font>"+
				"<input type=\"text\" name=\"email\" id=\"email\" size=\"45\" disabled=\"disabled\"/>"+
				"</p><p>Operating System <select size=\"1\" name=\"os\" id=\"os\" disabled=\"disabled\">"+
				"<option>Microsoft Windows</option><option>Linux</option><option>Mac OS X</option>"+
				"<option>Solaris</option></select></p><p><input id=\"submit\" type=\"submit\" value=\"Submit\""+
				" name=\"submit\" disabled=\"disabled\"/></p></div>"


function getEulaContent() {
	var ol = document.createElement("ol");
	var list = document.createElement("li");
	var text = document.createTextNode(
			"Through a Memorandum of Agreement between Indiana University (IU) and the Advanced Research and Technology "+
			"Institute, the predecessor corporation to Indiana University Research and Technology Corporation (IURTC) "+
			"dated January 1, 1997, IU assigns its intellectual property to IURTC and IURTC has manages and markets IU's "+
			"intellectual property through its Office of Technology Transfer.  IURTC is the owner of certain software "+
			"commonly know as Curation Alignment Tool for Protein Analysis (CATPA) developed by Mehmet Dalkilic, Andrew"+ 
			"Albrecht and James Costello of the Indiana University School of Informatics. This is a legal agreement "+
			"between you, RECIPIENT, and IURTC.  By accepting, receiving, and using CATPA, you agree to be bound by "+
			"all of its terms.");
	list.appendChild(text);
	ol.appendChild(list);
	
	list = document.createElement("li");
	text = document.createTextNode(
			"IURTC grants to RECIPIENT a royalty free, non-exclusive, and nontransferable license to install and use "+
			"CATPA for internal research.");
	list.appendChild(text);
	ol.appendChild(list);
	
	list = document.createElement("li");
	text = document.createTextNode(
			"The title and copyright to CATPA and any associated programs and documentation shall remain with IURTC. "+ 
			"RECIPIENT agrees to preserve same. RECIPIENT agrees not to make any copies of CATPA except for use in "+
			"RECIPIENT's laboratory, distribute CATPA to another laboratory within  RECIPIENT's institution, or"+ 
			"transfer it to another location or another person without IURTC's prior written permission.  Please "+
			"contact Bill Brizzard at bbrizzar@iu.edu to obtain permission to distribute CATPA.  RECIPIENT agrees to "+
			"include a copy of this license and place the appropriate copyright notice on any such copies.");
	list.appendChild(text);
	ol.appendChild(list);
			
			
	list = document.createElement("li");
	text = document.createTextNode(
			"If IURTC grants RECIPIENT permission to distribute CATPA, RECIPIENT shall not export, CATPA, or any part "+ 
			"thereof, directly or indirectly, to any country where such export or re-export is not in full compliance "+
			"with the laws of the United States of America.	");
	list.appendChild(text);
	ol.appendChild(list);	
	
	
	list = document.createElement("li");
	text = document.createTextNode(
			"RECIPIENT acknowledges that CATPA is a research tool and provided free of charge, it is only provided "+ 
			"\"as is.\" IURTC, its faculty, employees, or students, have not obligation to assist RECIPIENT in its use, "+
			"correction, modification, or enhancement and without any obligation to provide any updates.");
	list.appendChild(text);
	ol.appendChild(list);		
							
						
	list = document.createElement("li");
	var b = document.createElement("b");
	text = document.createTextNode(
			"IURTC MAKES NO REPRESENTATIONS AND EXTENDS NO WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED.  THERE "+ 
			"ARE NO EXPRESS OR IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS OF CATPA FOR A PARTICULAR PURPOSE, OR "+
			"THAT THE USE OF CATPA WILL NOT INFRINGE ANY PATENT, COPYRIGHT, TRADEMARK, TRADE SECRET, OR OTHER INTELLECTUAL "+ 
			"PROPERTY RIGHTS OF ANOTHER PARTY, OR ANY OTHER EXPRESS OR IMPLIED WARRANTIES.  IURTC WILL NOT BE LIABLE TO "+
			"RECIPIENT  FOR ANY CLAIMS OR DAMAGES ARISING FROM RECIPIENT'S USE OF CATPA, ANY CLAIM FOR ANY LOSS OR "+ 
			"INTERRUPTION OF BUSINESS, OR FOR ANY INDIRECT, SPECIAL, OR CONSEQUENTIAL DAMAGES OF ANY KIND.");
	b.appendChild(text);
	list.appendChild(b);
	ol.appendChild(list);						
	
	return ol
}