	
	myBrowser=navigator.appName
	myVersion=navigator.appVersion
	var version45=(myVersion.indexOf("4.")!=-1||myVersion.indexOf("5.")!=-1)
	var NS=(myBrowser.indexOf("Netscape")!=-1 && version45)
	var IE=(myBrowser.indexOf("Explorer")!=-1 && version45)
	
	if (NS)
		displayShow = "table-row";
	else
		displayShow = "block";
	
	prevChoice = "";
	
	function highlight(element,className)
	{
		if (prevChoice != "")
		{
			document.getElementById(element).className='button';
			if (element != prevChoice)
				document.getElementById(prevChoice).className=prevChoiceClass;
		}
		else
		{
			document.getElementById(element).className='button';
		}
		prevChoice = element;
		prevChoiceClass = className;
	}
	
	function addOpt(elName,inText,inValue)
	{
		var rSel = window.opener.document.getElementById(elName);
		var oOption = window.opener.newOpt(inText,inValue);
		rSel.options[rSel.length] = oOption;
	}
	
	function newOpt(inText,inValue)
	{
		var myOpt = new Option(inText,inValue);
		return myOpt;
	}

	function showBranch(branch)
	{
		var objBranch = document.getElementById(branch).style;
		if(objBranch.display==displayShow)
			objBranch.display="none";
		else
			objBranch.display=displayShow;
	}
	
	function swapFolder(img)
	{
		objImg = document.getElementById(img);
		if(objImg.src.indexOf('bullet_plus.gif')>-1)
			objImg.src = openImg.src;
		else
			objImg.src = closedImg.src;
	}
	
	//resize Iframe
	function change_height(frameName)
	{
		if(document.getElementById && !(document.all)) 
		{
			height = document.getElementById(frameName).contentDocument.body.scrollHeight;
			document.getElementById(frameName).style.height = height;
		}
		else if(document.all)
		{
			height = document.frames(frameName).document.body.scrollHeight;
			eval("document.all." + frameName + ".style.height = height");
		}
	}
	
	function openWin(url,name,width,height,menubar,status)
	{
		var w = width; 
		var l = (screen.width - w ) /2 ;
		var h = height; 
		var t = (screen.height - h ) /2 ;
			
		win = window.open(url, name, "scrollbars=yes,resizable=no,status=" + status + ",toolbar=no,menubar=" + menubar + ",location=no,top=" + t + ",height=" + h + ",left=" + l + ",width=" + w);
		if (win != null)
			win.focus();
	}
	
	function deleteFromList(ListBoxName)
	{
		var ListBox = document.getElementById(ListBoxName);
		for (var i=0; i < ListBox.length; i++)
		{
			if (ListBox.options[i].selected == true)
			{
				ListBox.options[i] = null;
				i=i-1;
			}
	 	}
	}
	
	function setHeightWidth()
	{
		document.getElementById("content").height = document.body.clientHeight - parseInt(document.getElementById("top").height);
		document.getElementById("content").width = document.body.clientWidth - (parseInt(document.getElementById("left").width) + parseInt(document.getElementById("right").width));
	}
	
	function CheckKey(code,form)
	{
		if (code == 13) //enter
		{
			eval("document." + form + ".submit()");
		}  
	}
	
	function gotoPage(url)
	{
		document.location.href = url;
	}
	
	function confirmDelete(url)
	{
		if (confirm("Are you sure you want to delete it?"))
			gotoPage(url);
	}
	
	function addNew(ListBoxName,page)
	{
		var ListBox = document.getElementById(ListBoxName);
		optionsStr = "";
		
		for (i=0; i<ListBox.options.length; i++)
		{
			if (optionsStr != "" )
			{
				optionsStr = optionsStr + ",";
			}
			optionsStr = optionsStr + ListBox.options[i].value;
	 	}
		
		url = page + "?optionsStr=" + optionsStr;
		openWin(url,ListBoxName,510,400,'no','no');
	}
	
	function moveRight()
	{
		var AvailableLB = document.getElementById("available");
		var LinkedLB = document.getElementById("linked");
		for (var i=0; i < AvailableLB.length; i++)
		{
			if (AvailableLB.options[i].selected == true)
			{
				LinkedLB.options[LinkedLB.length] = new Option(AvailableLB.options[i].text, AvailableLB.options[i].value);
				AvailableLB.options[i] = null;
				i=i-1;
			}
		}
	}
	
	function moveLeft()
	{
		var AvailableLB = document.getElementById("available");
		var LinkedLB = document.getElementById("linked");
		for (var i=0; i < LinkedLB.length; i++)
		{
			if (LinkedLB.options[i].selected == true)
			{
				AvailableLB.options[AvailableLB.length] = new Option(LinkedLB.options[i].text, LinkedLB.options[i].value);
				LinkedLB.options[i] = null;
				i=i-1;
			}
	 	}
	}
	
	function countLineBreaks (string)
	{
		var re = /\r\n|\r|\n/g;
		var n = 0;
		while (re.exec(string))
			n++;
		return n;
	}
	
	function adjustRows (textarea)
	{
		if (document.all)
		{
			if (textarea.scrollHeight > textarea.clientHeight)
			{
				while (textarea.scrollHeight > textarea.clientHeight)
					textarea.rows++;
			}
			else
			{
				while (textarea.scrollHeight < textarea.clientHeight)
					textarea.rows--;
			}
			textarea.scrollTop = 0;
  		}
 		else if (textarea.rows) 
		{
			var lineBreaks = countLineBreaks(textarea.value);
			var rows = parseInt(textarea.rows);
			var wrap = textarea.getAttribute('wrap');
			if (lineBreaks > rows)
				textarea.rows = ++rows;
			else if (wrap.toLowerCase() == 'soft' || wrap.toLowerCase() == 'hard')
			{
				while (textarea.rows * textarea.cols <= textarea.value.length)
				{
					textarea.rows = ++rows;
      			}
    		}
  		}
	}
	
	function getMultiListBoxValues(form,ListBoxId,HiddenBoxName)
	{
		var LinkedLB = eval('document.getElementById("' + ListBoxId + '")');
		eval ('document.' + form + '.' + HiddenBoxName + '.value = ""');
		for (i=0; i<LinkedLB.options.length; i++)
		{
			if (eval ('document.' + form + '.' + HiddenBoxName + '.value != ""'))
			{
				eval ('document.' + form + '.' + HiddenBoxName + '.value = document.' + form + '.' + HiddenBoxName + '.value + ","');
			}
			eval ('document.' + form + '.' + HiddenBoxName + '.value = document.' + form + '.' + HiddenBoxName + '.value + LinkedLB.options[i].value');
	 	}
	}
	
	function getKeywordsRank(form,ListBoxId,HiddenBoxName)
	{
		var LinkedLB = eval('document.getElementById("' + ListBoxId + '")');
		eval ('document.' + form + '.' + HiddenBoxName + '.value = ""');
		for (i=0; i<LinkedLB.options.length; i++)
		{
			keyword = LinkedLB.options[i].text;
			rank = keyword.substring(keyword.indexOf("[")+1,keyword.indexOf("]"));
			
			if (eval ('document.' + form + '.' + HiddenBoxName + '.value != ""'))
			{
				eval ('document.' + form + '.' + HiddenBoxName + '.value = document.' + form + '.' + HiddenBoxName + '.value + ","');
			}
			eval ('document.' + form + '.' + HiddenBoxName + '.value = document.' + form + '.' + HiddenBoxName + '.value + "' + rank + '"');
		}
	}
	
	function checkListBox(ListBoxId,ListBoxCaption)
	{
		var LB = eval('document.getElementById("' + ListBoxId + '")');
		if (LB.options[LB.selectedIndex].value != "")
		{
			return true;
		}
		else
		{
			alert("You must choose " + ListBoxCaption + ".");
			LB.focus();
			return false;
		}
	}
	
	function checkMultiListBox(theField,ListBoxId,ListBoxCaption)
	{
		var LB = eval('document.getElementById("' + ListBoxId + '")');
		if (isWhitespace(theField.value))
		{
			alert("You must choose " + ListBoxCaption + ".");
			LB.focus();
			return false;
		}
		return true;
	}
	
	function showFields(itemType)
	{
		document.getElementById("itemStatusTR").style.display = "none";
		document.getElementById("languageTR").style.display = "none";
		document.getElementById("authorsTR").style.display = "none";
		document.getElementById("authorsEmailsTR").style.display = "none";
		document.getElementById("organizationsTR").style.display = "none";
		document.getElementById("organizations2TR").style.display = "none";
		document.getElementById("publicationTypeTR").style.display = "none";
		document.getElementById("copyrightRestrictionTR").style.display = "none";
		document.getElementById("editorTR").style.display = "none";
		document.getElementById("yearTR").style.display = "none";
		document.getElementById("confidentialityTR").style.display = "none";
		document.getElementById("referenceQueryTR").style.display = "none";
		document.getElementById("isbnTR").style.display = "none";
		document.getElementById("largeDescriptionTR").style.display = "none";
		document.getElementById("locationOrCountryTR").style.display = "none";
		document.getElementById("startDateTR").style.display = "none";
		document.getElementById("endDateTR").style.display = "none";
		document.getElementById("patentNumberTR").style.display = "none";
		document.getElementById("inventorTR").style.display = "none";
		document.getElementById("applicantTR").style.display = "none";
		document.getElementById("internationalClassificationTR").style.display = "none";
		document.getElementById("europeanClassificationTR").style.display = "none";
		document.getElementById("applicationNumberTR").style.display = "none";
		document.getElementById("priorityNumberTR").style.display = "none";
		document.getElementById("projectTypeTR").style.display = "none";
		document.getElementById("fundingTypeTR").style.display = "none";
		document.getElementById("fundingProgrammeTR").style.display = "none";
		document.getElementById("iprTR").style.display = "none";
		document.getElementById("developmentStageTR").style.display = "none";
		document.getElementById("achievementsTR").style.display = "none";
		document.getElementById("innovationTR").style.display = "none";
		
		switch (itemType)
		{
			case "1":
				document.getElementById("itemStatusTR").style.display = displayShow;
				document.getElementById("languageTR").style.display = displayShow;
				document.getElementById("authorsTR").style.display = displayShow;
				document.getElementById("organizationsTR").style.display = displayShow;
				document.getElementById("organizations2TR").style.display = displayShow;
				document.getElementById("publicationTypeTR").style.display = displayShow;
				document.getElementById("copyrightRestrictionTR").style.display = displayShow;
				document.getElementById("editorTR").style.display = displayShow;
				document.getElementById("yearTR").style.display = displayShow;
				document.getElementById("confidentialityTR").style.display = displayShow;
				break;
			case "2":
				document.getElementById("languageTR").style.display = displayShow;
				document.getElementById("authorsTR").style.display = displayShow;
				document.getElementById("organizationsTR").style.display = displayShow;
				document.getElementById("organizations2TR").style.display = displayShow;
				document.getElementById("referenceQueryTR").style.display = displayShow;
				document.getElementById("publicationTypeTR").style.display = displayShow;
				document.getElementById("copyrightRestrictionTR").style.display = displayShow;
				document.getElementById("publicationTR").style.display = displayShow;
				document.getElementById("editorTR").style.display = displayShow;
				document.getElementById("yearTR").style.display = displayShow;
				document.getElementById("isbnTR").style.display = displayShow;
				document.getElementById("confidentialityTR").style.display = displayShow;
				break;
			case "3":
				document.getElementById("largeDescriptionTR").style.display = displayShow;
				document.getElementById("locationOrCountryTR").style.display = displayShow;
				document.getElementById("startDateTR").style.display = displayShow;
				document.getElementById("endDateTR").style.display = displayShow;
				document.getElementById("confidentialityTR").style.display = displayShow;
				break;
			case "4":
				document.getElementById("itemStatusTR").style.display = displayShow;
				document.getElementById("largeDescriptionTR").style.display = displayShow;
				document.getElementById("authorsTR").style.display = displayShow;
				document.getElementById("organizationsTR").style.display = displayShow;
				document.getElementById("organizations2TR").style.display = displayShow;
				document.getElementById("referenceQueryTR").style.display = displayShow;
				document.getElementById("copyrightRestrictionTR").style.display = displayShow;
				document.getElementById("yearTR").style.display = displayShow;
				document.getElementById("patentNumberTR").style.display = displayShow;
				document.getElementById("inventorTR").style.display = displayShow;
				document.getElementById("applicantTR").style.display = displayShow;
				document.getElementById("internationalClassificationTR").style.display = displayShow;
				document.getElementById("europeanClassificationTR").style.display = displayShow;
				document.getElementById("applicationNumberTR").style.display = displayShow;
				document.getElementById("priorityNumberTR").style.display = displayShow;
				document.getElementById("confidentialityTR").style.display = displayShow;
				break;
			case "5":
				document.getElementById("largeDescriptionTR").style.display = displayShow;
				document.getElementById("endDateTR").style.display = displayShow;
				document.getElementById("organizationsTR").style.display = displayShow;
				document.getElementById("organizations2TR").style.display = displayShow;
				document.getElementById("referenceQueryTR").style.display = displayShow;
				document.getElementById("copyrightRestrictionTR").style.display = displayShow;
				document.getElementById("editorTR").style.display = displayShow;
				document.getElementById("yearTR").style.display = displayShow;
				document.getElementById("isbnTR").style.display = displayShow;
				document.getElementById("confidentialityTR").style.display = displayShow;
				break;
			case "6":
				var titleLabel = document.getElementById("titleLabel");
				var titleLabelValue = document.createTextNode("Acronym:")
				titleLabel.replaceChild(titleLabelValue, titleLabel.childNodes[0]);
				
				var authorsLabel = document.getElementById("authorsLabel");
				var authorsLabelValue = document.createTextNode("Co-ordinator Name:")
				authorsLabel.replaceChild(authorsLabelValue, authorsLabel.childNodes[0]);
								
				var abstractLabel = document.getElementById("abstractLabel");
				var abstractLabelValue = document.createTextNode("Title:")
				abstractLabel.replaceChild(abstractLabelValue, abstractLabel.childNodes[0]);
				
				var largeDescriptionLabel = document.getElementById("largeDescriptionLabel");
				var largeDescriptionLabelValue = document.createTextNode("Abstract:")
				largeDescriptionLabel.replaceChild(largeDescriptionLabelValue, largeDescriptionLabel.childNodes[0]);
				
				var organizationLabel = document.getElementById("organizationLabel");
				var organizationLabelValue = document.createTextNode("Co-ordinator Organ.:")
				organizationLabel.replaceChild(organizationLabelValue, organizationLabel.childNodes[0]);
				
				var yearLabel = document.getElementById("yearLabel");
				var yearLabelValue = document.createTextNode("Ending Year:")
				yearLabel.replaceChild(yearLabelValue, yearLabel.childNodes[0]);
				
				document.getElementById("largeDescriptionTR").style.display = displayShow;
				document.getElementById("organizationsTR").style.display = displayShow;
				document.getElementById("organizations2TR").style.display = displayShow;
				document.getElementById("startDateTR").style.display = displayShow;
				document.getElementById("endDateTR").style.display = displayShow;
				document.getElementById("authorsTR").style.display = displayShow;
				document.getElementById("authorsEmailsTR").style.display = displayShow;
				document.getElementById("yearTR").style.display = displayShow;
				document.getElementById("projectTypeTR").style.display = displayShow;
				document.getElementById("fundingTypeTR").style.display = displayShow;
				document.getElementById("fundingProgrammeTR").style.display = displayShow;
				document.getElementById("iprTR").style.display = displayShow;
				document.getElementById("developmentStageTR").style.display = displayShow;
				document.getElementById("achievementsTR").style.display = displayShow;
				document.getElementById("innovationTR").style.display = displayShow;
				break;
			case "7":
				document.getElementById("largeDescriptionTR").style.display = displayShow;
				document.getElementById("locationOrCountryTR").style.display = displayShow;
				document.getElementById("startDateTR").style.display = displayShow;
				document.getElementById("endDateTR").style.display = displayShow;
				document.getElementById("authorsTR").style.display = displayShow;
				document.getElementById("organizationsTR").style.display = displayShow;
				document.getElementById("organizations2TR").style.display = displayShow;
				document.getElementById("yearTR").style.display = displayShow;
				document.getElementById("fundingTypeTR").style.display = displayShow;
				document.getElementById("developmentStageTR").style.display = displayShow;
				document.getElementById("achievementsTR").style.display = displayShow;
				document.getElementById("innovationTR").style.display = displayShow;
				document.getElementById("confidentialityTR").style.display = displayShow;
				break;
			case "8":
				document.getElementById("itemStatusTR").style.display = displayShow;
				document.getElementById("largeDescriptionTR").style.display = displayShow;
				document.getElementById("authorsTR").style.display = displayShow;
				document.getElementById("organizationsTR").style.display = displayShow;
				document.getElementById("organizations2TR").style.display = displayShow;
				document.getElementById("yearTR").style.display = displayShow;
				document.getElementById("iprTR").style.display = displayShow;
				document.getElementById("developmentStageTR").style.display = displayShow;
				document.getElementById("achievementsTR").style.display = displayShow;
				document.getElementById("innovationTR").style.display = displayShow;
				document.getElementById("confidentialityTR").style.display = displayShow;
				break;
		}
	}

function nullifyVerScroll(ifr)
{
	if (eval('window.parent.' + ifr + '.document.body') != null)
	{
		if (window.parent.document.getElementById(ifr).style.height != "0px")
		{
			//an to PLATOS parathirou einai mikrotero apo ayto poy orisame tote ayksanei to upsos me bima 5
			if(eval('window.parent.' + ifr + '.document.body.clientWidth') < eval('window.parent.' + ifr + '.document.body.offsetWidth'))
			{
				while(eval('window.parent.' + ifr + '.document.body.clientWidth') < eval('window.parent.' + ifr + '.document.body.offsetWidth'))
					window.parent.document.getElementById(ifr).style.height=parseInt(window.parent.document.getElementById(ifr).style.height)+5;
			}
			else
			{ //diaforetika moionei to upsos 
				while(eval('window.parent.' + ifr + '.document.body.clientWidth') >= eval('window.parent.' + ifr + '.document.body.offsetWidth'))
					window.parent.document.getElementById(ifr).style.height=parseInt(window.parent.document.getElementById(ifr).style.height)-5;
				while(eval('window.parent.' + ifr + '.document.body.clientWidth') < eval('window.parent.' + ifr + '.document.body.offsetWidth'))
					window.parent.document.getElementById(ifr).style.height=parseInt(window.parent.document.getElementById(ifr).style.height)+1;
			}
		}
	}
}

function checkspaces(san)
{
	if (san==""){
		return false;
	}
	else
	{
		y=san.length;
		test1=false;
		for (i=0;i<y;i++)
		{
			if (san.charAt(i)==' '){
				cont=false;
			}else{
				test1=true;
			}
		}
		if (test1==false){
			//alert('wrong');
			return false;
		}
		else{
			//alert('ok');
			return true;
		}
	}
}