/* This script and many more are available free online at
The JavaScript Source :: http://javascript.internet.com
Created by: Ultimater, Mr J :: http://www.webdeveloper.com/forum/showthread.php?t=77389 */
function toggle(elem)
{
     if(document.getElementById(elem).style.display == "none") {
           document.getElementById(elem).style.display = "block"
     } else {
           document.getElementById(elem).style.display = "none"
     }
} 

function showel(elem,posY,posX) {
	 //alert(this.offsetX);
	//document.getElementById(elem).style.left = (posX + this.offsetX)+ "px";

	//document.getElementById(elem).style.left = posX-140+'px';
	 document.getElementById(elem).style.top = posY-210+'px'; 
     document.getElementById(elem).style.display = "block"; 
} 
function hidel(elem) {
	document.getElementById(elem).style.display = "none";
}

function pridej (co,kam) {
	if(kam == 'EcoforumKeywords') {
		document.Ecoforum.EcoforumKeywords.value = document.Ecoforum.EcoforumKeywords.value + co + ', ';
	} else if (kam == 'EcoforumPeople') {
		document.Ecoforum.EcoforumPeople.value = document.Ecoforum.EcoforumPeople.value + co + ', ';
	} else if(kam == 'ActionKeywords') {
		document.Action.ActionKeywords.value = document.Action.ActionKeywords.value + co + ', ';
	} else if (kam == 'ActionPeople') {
		document.Action.ActionPeople.value = document.Action.ActionPeople.value + co + ', ';
	} else if (kam == 'ActionKeywords') {
		document.Action.ActionPeople.value = document.Action.ActionPeople.value + co + ', ';
	} else if (kam == 'ActionPeople') {
		document.Action.ActionPeople.value = document.Action.ActionPeople.value + co + ', ';
	}
	
}

var arrInput = new Array(0);
  var arrInputValue = new Array(0);

function addInput() {
  arrInput.push(arrInput.length);
  arrInputValue.push("");
  display();
}

function display() {
  document.getElementById('parah').innerHTML="";
  for (intI=0;intI<arrInput.length;intI++) {
    document.getElementById('parah').innerHTML+=createInput(arrInput[intI], arrInputValue[intI]);
  }
}

function saveValue(intId,strValue) {
  arrInputValue[intId]=strValue;
}  

function createInput(id,value) {
  return "<input type='text' name='data[EconomixIssue]["+id+"][name]' id='test "+ id +"' onChange='javascript:saveValue("+ id +",this.value)' value='"+ value +"'><br>";
}

function deleteInput() {
  if (arrInput.length > 0) { 
     arrInput.pop(); 
     arrInputValue.pop();
  }
  display(); 
}


var arr2Input = new Array(0);
  var arr2InputValue = new Array(0);

function add2Input() {
  arr2Input.push(arr2Input.length);
  arr2InputValue.push("");
  display2();
}

function display2() {
  document.getElementById('parah2').innerHTML="";
  for (int2I=0;int2I<arr2Input.length;int2I++) {
    document.getElementById('parah2').innerHTML+=create2Input(arr2Input[int2I], arr2InputValue[int2I]);
  }
}

function save2Value(int2Id,str2Value) {
  arr2InputValue[int2Id]=str2Value;
}  

function create2Input(id2,value2) {
  return "<input type='text' name='data[EconomixArticle]["+id2+"][name]' id='test2 "+ id2 +"' onChange='javascript:save2Value("+ id2 +",this.value)' value='"+ value2 +"'><br>";
}

function delete2Input() {
  if (arr2Input.length > 0) { 
     arr2Input.pop(); 
     arr2InputValue.pop();
  }
  display2(); 
}