var globalId;

function startUpload( id )
{
    globalId = id;
    document.getElementById("progressBar").style.display = "block";
    document.getElementById("progressBarText").innerHTML = "upload in progress: 0%";
    //document.getElementById("uploadbutton").disabled = true;
    setTimeout("doRequest()", 1000);
    return true;
}

function doRequest()
{
  http_request = false;  
  
   if (window.XMLHttpRequest) {
      try {
           http_request = new XMLHttpRequest(); 
      }
      catch (e)
      {
        alert(e);
      }
   } else if(window.ActiveXObject) { 
      try {
            http_request = new ActiveXObject('Microsoft.XMLHTTP');   
      }
      catch (e)
      {
        alert(e);
      }
   }


  if (!http_request)
  {
    alert('Ende :( Kann keine XMLHTTP-Instanz erzeugen');
    return false;
  }

  http_request.onreadystatechange = processContent;
  http_request.open('GET', "UploadStatus?uploadID=" + globalId, true);
  http_request.send(null);
}

function processContent()
{
  if (http_request.readyState == 4)
  {
    if (http_request.status == 200)
    {
      var progressPercent=http_request.responseText;
      if (progressPercent!=null) {
        document.getElementById("progressBarText").innerHTML = 'upload in progress: ' + progressPercent + '%';
        document.getElementById('progressBarBoxContent').style.width = parseInt(progressPercent * 3.5) + 'px';
      }
      setTimeout("doRequest()", 2000);
    }
    else
    {
       alert('Bei dem Request ist ein Problem aufgetreten.');
    }
  }  
}


function ismarked(checkbox)
{
var objCheck = checkbox.checked;
if (objCheck==false) {
	var answer = confirm("Are you sure you don't want to grant the University of Innsbruck to store all user input and uploaded skos data for research purposes?");
	if (answer)
  	{
  	   //alert("YES");
  	   //document.getElementById(id).checked=true;
  	}
  	else
  	{
  	   //alert("NO");
  	   checkbox.checked=true;
  	}
} // end if
}


// <a href="html-or.jpg" onclick="return popup(this,123,456)" title="..." 
// or 
// <a href="html-or.jpg" onclick="return popup(this)" title="..." 
var pop = null;
function popdown()
{ 
	if (pop && !pop.closed) pop.close(); 
}
function popup(obj,w,h) 
{ 
	var url = (obj.getAttribute) ? obj.getAttribute('href') : obj.href; 
	if (!url) return true; 
	w = (w) ? w += 20 : 150; 
 	// 150px*150px is the default size 
 	h = (h) ? h += 25 : 150; 
 	var args = 'width='+w+',height='+h+',resizable, scrollbars'; 
 	popdown();
  	pop = window.open(url,'',args); 
  	return (pop) ? false : true; 
}
//window.onunload = popdown; 
//window.onfocus = popdown; 


function UnCryptMailto(s) {
	var n=0;
	var r="";
	for(var i=0;i<s.length;i++) {
		n=s.charCodeAt(i);
		if (n>=8364) {n = 128;}
		r += String.fromCharCode(n-(1));
	}
	return r;
}
function linkTo_UnCryptMailto(s) {
	location.href=UnCryptMailto(s);
}


function ChooseProton() {
	var optionNumber = document.getElementById('choiceform').proton.selectedIndex
	var protont = new Array();
	protont[0] = ["Abstract", "Something, which neither happens nor exists, e.g. a number or a chemical compound formula. Those are usually some symbols, invented to refer to general notions."]
	protont[1] = ["Contact Information", "Any instance of a particular notation, used to make the contact with an individual or an organization possible."]
	protont[2] = ["General Term", "General concept with well defined (idiomatic) meaning which can have a set of distinct lexical items (serface realizations) associated with it. Such examples are: F2F, I18N, P2P, B2B, VIP, ASAP, Semantic Web."]
	protont[3] = ["Language", "A spoken or written natural language."]
	protont[4] = ["Number", "Any given number, within the meaning that a number is one of the following: a concept of quantity derived from zero and units; or a numeral (or a string of numerals) used for identification ('she refused to give them her Social Security number'); or a phone number, etc."]
	protont[5] = ["Topic", "Any sort of a topic or theme, explicitly defined for classification purposes. As long as any other class or entity can play the role of a topic, the instances of this class are only those concepts, which are defined to serve as topics. The topic class is the natural top-class for linkage of logically informal taxonomies."]
	protont[6] = ["Happening", "Something that happens. It can be either dynamic - like in 'drawing a circle', or static - like in 'being a president'. In all cases, a happening (an event, a situation, or a time period) has a certain (usually quite concrete) temporal positioning - in the simplest case this is one, denoted by start and end points in time."]
	protont[7] = ["Event", "A dynamic event, such as 'running', or 'a concert'."]
	protont[8] = ["Situation", "A static event or situation, like 'sitting on a chair' or 'holding position'. Typically, those are temporarily homogenuous, i.e. they nature is not expected/required to change within their duration. As a happening, they use to happen/take place/be true for some periods of time and may or may not have a well-defined space extension."]
	protont[9] = ["Job Position", "The situation of a person, holding a job (employment) position within an organization. The sub-classes of this one define a number of different types of positions."]
	protont[10] = ["Role", "The role of an entity (usually an agent) within/during/effecting (intentionally or not) a particular happening. For instance a coordinator of a project,  or a defendant in a trial, or even a material object that serves as an evidence in a trial (e.g. a weapon)."]
	protont[11] = ["Time Interval", "This is a general time expression (TIMEEX), which refers to a particular period of time, an interval. Repeating periods (like the Spring or Christmas) are not time intervals, while specific instances of theirs (like the Spring of 1944) are. A TimeInterval could collapse, in very special cases, to a time point, however in this case, in contrast to the Abstract time point (referring to some time during the day), it should be bound to a specific date, i.e. to represent a timestamp."]
	protont[12] = ["Object", "Objects are entities that could be claimed to exist - in some sense of existence. An object can play a certain role in some happenings. Objects could be substantially real - as the Buckingham Palace or a hardcopy book - or substantially imperceptible - say, an electronic document that exists only virtually, one cannot touch it."]
	protont[13] = ["Agent", "An Agent is something, which can show (carry out) an independent action, whether consciously or not. Most animals are considered agents, in most contexts; so are most organizations. According to DOLCE 2.0 'objects to which we ascribe intentions, beliefs and desires'. Agent here also denotes any automatic services, including web services and servers."]
	protont[14] = ["Group", "A group of agents, which is not organized in any way. This could be the group of people within a bus or the shareholders of a company."]
	protont[15] = ["Organization", "Organization is a group, which is established in such a way that certain known relationships and obligations exist between the members, and/or between the organization and its members, and/or between the organization and 'outsiders' (individuals or groups). includes both informal and legally constituted organizations. Organizations can act as agents - to undertake projects, to enter into agreements, to own property, etc. Most organizations have names. Almost all have at least two members."]
	protont[16] = ["Person", "A Person is an agent (within the meaning of Agent in BULO), which is an individual who is a human being (i.e. any living or extinct member of the family Hominidae). Wordnet 2.0."]
	protont[17] = ["Location", "Usually a geographic location on the earth, however any sort of 3D regions also fit here. The classification is based on the ADL Feature Type Thesaurus version 070203. Sub-classes omitted: Administrative Areas (its sub-types are put directly under Location), Territorial waters, Tribal areas. For each specific type, the corresponding NIMA GNS designators (DSG) are given."]
	protont[18] = ["Product", "The general concept of a product model, say, Ford T. The instances of this class are not specific instances of the product - the latter are just objects. Analogous to FormalProductType in Cyc."]
	protont[19] = ["Service", "Any sort of service, ranging from scheduled flight or train services to weather forecast information/web serivce. Many services could be considered agenets."]
	protont[20] = ["Statement", "A message that is stated or declared; a communication (oral or written), setting forth particulars or facts, etc; 'according to his statement he was in London on that day'. WordNet 1.7.1."]
	protont[21] = ["Information Resource", "InformationResource denotes an information resources with identity, as defined in Dublin Core (DC2003ISO). InformationResource is considered any communication or message that is delivered or produced, taking into account the specific intention ot its originator, and also the supposition (and anticipation) for a particular audience or counter-agent in the process of communication (i.e. passive or active feed-back)."]				
	protont[22] = ["Document", "The information content of any sort of document. The tangible aspects are ignored. It is usually a document in free text with no formal structure or semantics."]

    //if (optionNumber != 9) { //the first option is used as directions holder
    document.getElementById('choiceform').shortMasterConcept.value = protont[optionNumber][0]
    document.getElementById('choiceform').longMasterConcept.value = protont[optionNumber][1]    	
    //}
    
}
 

