


function journalsList(formNum)
{
    var list = "<select name='paper[paper"+formNum+"][journal]' id='paper[paper"+formNum+"][journal]' onChange=\"addOtherJournal("+formNum+");\">\n"+
	"<option value='Select'>Select journal</option>\n"+
	"<option value='Annales Geophysicae'>Annales Geophysicae</option>\n"+
	"<option value='Annals of Nuclear Energy'>Annals of Nuclear Energy</option>\n"+
	"<option value='Astronomy and Astrophysics'>Astronomy and  Astrophysics</option>\n"+
	"<option value='The Astrophysical Journal'>The Astrophysical Journal</option>\n"+	
	"<option value='Astrophysics and Space Science'>Astrophysics and Space Science</option>\n"+
	"<option value='Communications in Nonlinear Science and Numerical Simulation'>Communications in Nonlinear Science and Numerical Simulation</option>\n"+
	"<option value='Computer Physics Communications'>Computer Physics Communications</option>\n"+
	"<option value='Journal of Applied Physics'>Journal of Applied Physics</option>\n"+	
	"<option value='Journal of Geophysical Research'>Journal of Geophysical Research</option>\n"+		
	"<option value='Montly Notices of the Royal Astronomical Society'>Montly Notices of the Royal Astronomical Society</option>\n"+	
	"<option value='Physical Review'>Physical Review</option>\n"+
	"<option value='Physics of Plasmas'>Physics of Plasmas</option>\n"+	
	"<option value='Plasma Physics and Controlled Fusion'>Plasma Physics and Controlled Fusion</option>\n"+		
	"<option value='Proceedings of the Royal Society of London'>Proceedings of the Royal Society of London</option>\n"+	
	"<option value='Publications of the Astronomical Society of Japan'>Publications of the Astronomical Society of Japan</option>\n"+	
	"<option value='Science'>Science</option>\n"+
	"<option value='Solar Physics'>Solar Physics</option>\n"+
	"<option value='Other'>Other, specify </option>\n"+	
	"</select>";
   return list;
}

function addOtherJournal(formNum) {
	if (document.getElementById('paper[paper'+formNum+'][journal]')) {
		if (document.getElementById('paper[paper'+formNum+'][journal]').value == 'Other') {
			document.getElementById('otherJournal'+formNum).innerHTML += "<span id='otherJournalDiv'><span class='label'>&nbsp;&nbsp;Please specify:&nbsp;</span><input type='text' name='paper[paper"+formNum+"][journal]' id='paper[paper"+formNum+"][journal]' size='60'/></span>";
		} else {
			if (document.getElementById('otherJournalDiv')) {
				var dd = document.getElementById('otherJournal'+formNum);
				var deldiv = document.getElementById('otherJournalDiv');
				dd.removeChild(deldiv);
			}
		}	
	}
}

function addOtherRecognition(formNum) {
	if (document.getElementById('recognition[recognition' + formNum + '][type]')) {
		if (document.getElementById('recognition[recognition' + formNum + '][type]').value == 'Other') {
			document.getElementById('otherRecognition'+formNum).innerHTML += "<span id='otherRecognitionDiv'><span class='label'>Please specify: </span><input type='text' name='recognition[recognition"+formNum+"][type]' id='recognition[recognition"+formNum+"][type]' size='60' /></span>";
		} else {
			if (document.getElementById('otherRecognitionDiv')) {
				var dd = document.getElementById('otherRecognition'+formNum);
				var deldiv = document.getElementById('otherRecognitionDiv');
				dd.removeChild(deldiv);
			}
		}	
	}
}

function addOtherDissemination(formNum) {
	if (document.getElementById('dissemination[dissemination' + formNum + '][type]')) {
		if (document.getElementById('dissemination[dissemination' + formNum + '][type]').value == 'Other') {
			document.getElementById('otherDissemination'+formNum).innerHTML += "<span id='otherDisseminationDiv'><span class='label'>Please specify: </label> <input type='text' name='dissemination[dissemination"+formNum+"][type]' id='dissemination[dissemination"+formNum+"][type]' size='60'/></span>";
		} else {
			if (document.getElementById('otherDisseminationDiv')) {
				var dd = document.getElementById('otherDissemination'+formNum);
				var deldiv = document.getElementById('otherDisseminationDiv');
				dd.removeChild(deldiv);
			}
		}	
	}
}

function addPaper()
{
	var ni = document.getElementById("paperDiv");
	var numi = document.getElementById("theValue");
	var num = (document.getElementById("theValue").value -1)+ 2;
	numi.value = num;
	var divIdName = "paper"+num+"Div";
	var newdiv = document.createElement("div");
	newdiv.setAttribute("id",divIdName);
	newdiv.innerHTML = "<!-- Paper "+  num +"-->"+
	"<div class='section'>"+
	"<p><label for='title'>Title: </label><input type='text' name='paper[paper" + num + "][title]' id='paper[paper" + num + "][title]' size='60'></p>"+ 
	"<p><label for='journal'>Journal: </label>"+ journalsList(num) + "</p><p><span id='otherJournal" + num + "'></span></p>"+
	"<p><label>Authors: </label><span class='onlyform'><textarea rows='2' cols='70' name='paper[paper" + num + "][authors]' id='paper[paper" + num + "][authors]'></textarea></span></p>"+
	"<p><span class='label'>Authors which are members of the solaire teams (please indicate node in brackets): </span><span class='onlyform'><textarea rows='2' cols='70' name='paper[paper" + num + "][solaire_authors]' id='paper[paper" + num + "][solaire_authors]'></textarea></span></p>"+
	"<p><label> Volume: </label><input name='paper[paper" + num + "][volume]' id='paper[paper" + num + "][volume]' size='3' />"+
	"<span class='label'> Page: </span> <input name='paper[paper" + num + "][page]' id='paper[paper" + num + "][page]' size='3'/>"+
	"<span class='label'> Year: </span> <input name='paper[paper" + num + "][year]' id='paper[paper" + num + "][year]' size='3' />"+
	"<span class='label'>Publication state: </span> <select name='paper[paper" + num + "][state]' id='paper[paper" + num + "][state]'>"+
    "<option value='Published'>Published</option>"+
    "<option value='In print'>In print</option>"+
    "<option value='Submitted'>Submitted</option>"+
    "</select></p>"+
	"<p><span class='label'>Is the Solaire acknowledgment sentence included? </span> <select name='paper[paper"+num+"][acknowledgment]' id='paper[paper"+num+"][acknowledgment]'>\n"+
	"<option value='yes'>yes</option>\n <option value='no'>no</option>\n</select></p>"+

	"<div class='buttons'><a href=\"javascript:;\" onclick=\"removeItem('paperDiv',\'"+divIdName+"\')\" title=\"Remove the item\"><img  src='forms/img/cancel.png' alt='Remove' width='32' height='32' /></a></div>"+
	"</div>";
    ni.appendChild(newdiv);
}

function addConference()
{
	var ni = document.getElementById("conferenceDiv");
	var numi = document.getElementById("theValue");
	var num = (document.getElementById("theValue").value -1)+ 2;
	numi.value = num;
	var divIdName = "conference"+num+"Div";
	var newdiv = document.createElement("div");
	newdiv.setAttribute("id",divIdName);
	newdiv.innerHTML = "<!-- <h3>conference "+  num +"</h3> -->"+
	"<div class='section'>"+
	"<p><label>Researcher&nbsp;name: </label><input type='text' name='conference[conference" + num + "][name]' id='conference[conference" + num + "][name]' size='60'></p>"+	
	"<p><label>Category: </label><select name='conference[conference" + num + "][category]' id='conference[conference" + num + "][category]'>"+
    "<option value='Network ESR'>Network ESR</option>"+
    "<option value='Network ER'>Network ER</option>"+
    "<option value='Doctorand from the team without solaire contract'>Doctorand from the team without solaire contract</option>"+
	"<option value='Postdoc from the team without solaire contract'>Postdoc from the team without solaire contract</option>"+
	"<option value='Senior member of the team'>Senior member of the team</option>"+
    "</select></p>"+
	
	"<p><label>Type: </label> <select name='conference[conference" + num + "][type]' id='conference[conference" + num + "][type]'>"+
    "<option>Invited review</option>"+
    "<option>Invited lecture</option>"+
    "<option>Oral contribution</option>"+
	"<option>Poster</option>"+
	"<option>Main organizer of the conference</option>"+
	"<option>Member of scientific organizing committee</option>"+
	"<option>Member of local organizing committee</option>"+
    "</select></label></p>"+
	"<p><label>Title of lecture:</label><input type='text' name='conference[conference" + num + "][title]' id='review[conference" + num + "][title]' size='60'></p>"+ 
	"<p><label>Name of conference: </label><input type='text' name='conference[conference" + num + "][conference_name]' id='conference[conference" + num + "][conference_name]' size='60'></p>"+ 
	"<p><label>Location: </label> <input type='text' name='conference[conference" + num + "][location]' id='conference[conference" + num + "][location]' size='30'></span>"+ 
	"<span class='label'>Date: </span><input type='text' name='conference[conference" + num + "][date]' id='conference[conference" + num + "][date]' size='20'></p>"+ 
	
	"<p><span class='label'>Publication (proceedings or journal): </span><span class='onlyform'><input type='text' name='conference[conference" + num + "][publication]' id='conference[conference" + num + "][publication]' size='60' /></span></p>"+
	
	"<p><label>Editors: </label><input type='text' name='conference[conference" + num + "][editors]' id='conference[conference" + num + "][editors]' size='60' /></p>"+
	
	"<p><label>Volume: </label> <input name='conference[conference" + num + "][volume]' id='conference[conference" + num + "][volume]' size='3' />"+
	"<span class='label rightside'> Page: </span><input name='conference[conference" + num + "][page]' id='conference[conference" + num + "][page]' size='3'/>"+
	"<span class='label rightside'> Year: </span> <input name='conference[conference" + num + "][year]' id='conference[conference" + num + "][year]' size='3' /></p>"+
	
	"<div class='buttons'><a href=\"javascript:;\" onclick=\"removeItem('conferenceDiv',\'"+divIdName+"\')\" title=\"Remove the item\"><img  src='forms/img/cancel.png' alt='Remove' width='32' height='32' /></a></div>"+
	"</div>";
    ni.appendChild(newdiv);
}


function addNetworking()
{
	var ni = document.getElementById("networkingDiv");
	var numi = document.getElementById("theValue");
	var num = (document.getElementById("theValue").value -1)+ 2;
	numi.value = num;
	var divIdName = "networking"+num+"Div";
	var newdiv = document.createElement("div");
	newdiv.setAttribute("id",divIdName);
	newdiv.innerHTML = "<!-- <h3>networking "+  num +"</h3> -->"+
	"<div class='section'>"+
	"<p><label>Researcher&nbsp;name: </label><input type='text' name='networking[networking" + num + "][name]' id='networking[networking" + num + "][name]' size='60'></p>"+ 
	"<p><label>Category: </label><select name='networking[networking" + num + "][category]' id='networking[networking" + num + "][category]'>"+
    "<option value='Network ESR'>Network ESR</option>"+
    "<option value='Network ER'>Network ER</option>"+
    "<option value='Doctorand from the team without solaire contract'>Doctorand from the team without solaire contract</option>"+
	"<option value='Postdoc from the team without solaire contract'>Postdoc from the team without solaire contract</option>"+
	"<option value='Senior member of the team'>Senior member of the team</option>"+
    "</select></p>"+
	"<p><label>Destination&nbsp;node: </label><select name='networking[networking" + num + "][node]' id='networking[networking" + num + "][node]'>"+
    "<option value='IAC'>IAC</option>"+
    "<option value=''>USTAN</option>"+
    "<option value='USTAN'>KUL</option>"+
	"<option value='NBI'>NBI</option>"+
	"<option value='MPS'>MPS</option>"+
	"<option value='UIO'>UIO</option>"+
	"<option value='OPM'>OPM</option>"+
	"<option value='RUB'>RUB</option>"+
	"<option value='GLAS'>GLAS</option>"+
	"<option value='UCT'>UCT</option>"+
	"<option value='UU'>UU</option>"+
	"<option value='ELTE'>ELTE</option>"+
	"<option value='FGE'>FGE</option>"+
    "</select></p>"+
	"<p><span class='label'>Name of collaborators in the host institution:</span><span class='onlyform'><input type='text' name='networking[networking" + num + "][collaborators_name]' id='networking[networking" + num + "][collaborators_name]' size='60'></span></p>"+ 
	"<p><label>Aim of the visit: </label><input type='text' name='networking[networking" + num + "][aim]' id='networking[networking" + num + "][aim]' size='60'></p>"+ 
	"<p><label>Dates: </label><input type='text' name='networking[networking" + num + "][dates]' id='networking[networking" + num + "][dates]' size='60'></p>"+ 
	"<div class='buttons'><a href=\"javascript:;\" onclick=\"removeItem('networkingDiv',\'"+divIdName+"\')\" title=\"Remove the item\"><img  src='forms/img/cancel.png' alt='Remove' width='32' height='32' /></a></div>"+
	"</div>";
    ni.appendChild(newdiv);
}

function addCollaboration()
{
	var ni = document.getElementById("collaborationDiv");
	var numi = document.getElementById("theValue");
	var num = (document.getElementById("theValue").value -1)+ 2;
	numi.value = num;
	var divIdName = "collaboration"+num+"Div";
	var newdiv = document.createElement("div");
	newdiv.setAttribute("id",divIdName);
	newdiv.innerHTML = "<!-- <h3>networking "+  num +"</h3> -->"+
	"<div class='section'>"+
	"<p><span class='label'>Topic of collaboration: </span><span class='onlyform'><input type='text' name='collaboration[collaboration" + num + "][topic]' id='collaboration[collaboration" + num + "][topic]' size='60' /></span></p>"+
	"<p><span class='label'>Participating researchers (please indicate node in brackets): </span><span class='onlyform'><textarea  name='collaboration[collaboration" + num + "][researchers]' id='collaboration[collaboration" + num + "][researchers]' cols='60' rows='2'></textarea></span></p>"+ 
	"<p><label>Solaire working packages: </label><textarea  name='collaboration[collaboration" + num + "][packages]' id='collaboration[collaboration" + num + "][packages]' cols='60' rows='2'></textarea></p>"+ 
	"<p><label>Duration of the collaboration: </label><input type='text' name='collaboration[collaboration" + num + "][duration]' id='collaboration[collaboration" + num + "][duration]' size='60'></p>"+ 
	"<div class='buttons'><a href=\"javascript:;\" onclick=\"removeItem('collaborationDiv',\'"+divIdName+"\')\" title=\"Remove the item\"><img  src='forms/img/cancel.png' alt='Remove' width='32' height='32' /></a></div>"+
	"</div>";
    ni.appendChild(newdiv);
}

function addRecognition()
{
	var ni = document.getElementById("recognitionDiv");
	var numi = document.getElementById("theValue");
	var num = (document.getElementById("theValue").value -1)+ 2;
	numi.value = num;
	var divIdName = "recognition"+num+"Div";
	var newdiv = document.createElement("div");
	newdiv.setAttribute("id",divIdName);
	newdiv.innerHTML = "<!-- Recognition "+  num +" -->"+
	"<div class='section'>"+
	"<p><label>Researcher&nbsp;name: </label><input type='text' name='recognition[recognition" + num + "][name]' id='recognition[recognition" + num + "][name]' size='60'></p>"+ 
	"<p><label>Token of recognition: </label> <select name='recognition[recognition" + num + "][type]' id='recognition[recognition" + num + "][type]' onChange=\"addOtherRecognition("+ num +");\">"+
    "<option value='Honorary membership of scientific societies'>Honorary membership of scientific societies</option>"+
    "<option value='Presidency of scientific societies'>Presidency of scientific societies</option>"+
    "<option value='Invited lectures in special public events'>Invited lectures in special public events</option>"+
	"<option value='Membership in (or chairmanship of) international committees'>Membership in (or chairmanship of) international committees</option>"+
	"<option value='Medals and awards'>Medals and awards</option>"+
	"<option value='Other'>Other (specify)</option>"+
    "</select></p>"+ 
	"<p><span id='otherRecognition" + num + "'></span></p>"+
	"<p><label>Please, specify details: </label><input type='text' name='recognition[recognition" + num + "][details]' id='recognition[recognition" + num + "][details]' size='60'></p>"+ 
	"<div class='buttons'><a href=\"javascript:;\" onclick=\"removeItem('recognitionDiv',\'"+divIdName+"\')\" title=\"Remove the item\"><img  src='forms/img/cancel.png' alt='Remove' width='32' height='32' /></a></div>"+
	"</div>";
    ni.appendChild(newdiv);
}

function addTraining()
{
	var ni = document.getElementById("trainingDiv");
	var numi = document.getElementById("theValue");
	var num = (document.getElementById("theValue").value -1)+ 2;
	numi.value = num;
	var divIdName = "training"+num+"Div";
	var newdiv = document.createElement("div");
	newdiv.setAttribute("id",divIdName);
	newdiv.innerHTML = "<!-- <h3>training "+  num +"</h3> -->"+
	"<div class='section'>"+
	"<p><label>Title of the activity: </label><input type='text' name='training[training" + num + "][title]' id='training[training" + num + "][local]' size='60'></p>"+ 
	"<p><span class='label'>Participating researchers (please indicate node in brackets): </span>"+
	"<span class='onlyform'><textarea rows='2' cols='70' name='training[training" + num + "][researchers]' id='training[training" + num + "][researchers]'></textarea></span></p>"+
	"<p><span class='label'>Description of training: </span>"+
	"<span class='onlyform'><textarea rows='2' cols='70' name='training[training" + num + "][description]' id='training[training" + num + "][description]'></textarea></span></p>"+
	"<p><label>Type of training: </label><select name='training[training" + num + "][type]' id='training[training" + num + "][type]'>"+
    "<option value='Local training activities at your node attended by the solaire appointees'>Local training activities at your node attended by the solaire appointees</option>"+
    "<option value='Network-wide training activities attended by the solaire appointees'>Network-wide training activities attended by the solaire appointees</option>"+
    "<option value='Participation of solaire appointees from other nodes in the local training activities at your node'>Participation of solaire appointees from other nodes in the local training activities at your node</option>"+
    "</select></p>"+
	"<div class='buttons'><a href=\"javascript:;\" onclick=\"removeItem('trainingDiv',\'"+divIdName+"\')\" title=\"Remove the item\"><img  src='forms/img/cancel.png' alt='Remove' width='32' height='32' /></a></div>"+
	"</div>";
    ni.appendChild(newdiv);
}

function addSecondment()
{
	var ni = document.getElementById("secondmentDiv");
	var numi = document.getElementById("theValue");
	var num = (document.getElementById("theValue").value -1)+ 2;
	numi.value = num;
	var divIdName = "secondment"+num+"Div";
	var newdiv = document.createElement("div");
	newdiv.setAttribute("id",divIdName);
	newdiv.innerHTML = "<!-- <h3>Secondments "+  num +"</h3> -->"+
	"<div class='section'>"+
	"<p><label>Researcher&nbsp;name: </label><input type='text' name='secondment[secondment" + num + "][name]' id='secondment[secondment" + num + "][name]' size='60'></p>"+ 
	"<p><label>Category: </label><select name='secondment[secondment" + num + "][category]' id='secondment[secondment" + num + "][category]'>"+
    "<option value='Network ESR'>Network ESR</option>"+
    "<option value='Network ER'>Network ER</option>"+
    "<option value='Doctorand from the team without solaire contract'>Doctorand from the team without solaire contract</option>"+
	"<option value='Postdoc from the team without solaire contract'>Postdoc from the team without solaire contract</option>"+
	"<option value='Senior member of the team'>Senior member of the team</option>"+
    "</select></p>"+
	"<p><label>Dates of stay: </label> <input type='text' name='secondment[secondment" + num + "][dates]' id='secondment[secondment" + num + "][dates]' size='60'></p>"+ 
	"<p><label>Name of trainer at FGE ltd.: </label><input type='text' name='secondment[secondment" + num + "][trainer]' id='secondment[secondment" + num + "][trainer]' size='60'></p>"+ 
	"<div class='buttons'><a href=\"javascript:;\" onclick=\"removeItem('secondmentDiv',\'"+divIdName+"\')\" title=\"Remove the item\"><img  src='forms/img/cancel.png' alt='Remove' width='32' height='32' /></a></div>"+
	"</div>";
    ni.appendChild(newdiv);
}

function addDissemination()
{
	var ni = document.getElementById("disseminationDiv");
	var numi = document.getElementById("theValue");
	var num = (document.getElementById("theValue").value -1)+ 2;
	numi.value = num;
	var divIdName = "dissemination"+num+"Div";
	var newdiv = document.createElement("div");
	newdiv.setAttribute("id",divIdName);
	newdiv.innerHTML = "<!-- <h3>Dissemination "+  num +"</h3> -->"+
	"<div class='section'>"+	
	"<p><label>Type of activity: </label><select name='dissemination[dissemination" + num + "][type]' id='dissemination[dissemination" + num + "][type]' onChange=\"addOtherDissemination("+ num +");\">"+
    "<option value='Specialized lecture in a research institution'>Specialized lecture in a research institution</option>"+
    "<option value='Public lecture for a broad audience'>Public lecture for a broad audience</option>"+
    "<option value='Article in newspaper or magazine'>Article in newspaper or magazine</option>"+
	"<option value='Report to learned society'>Report to learned society</option>"+
	"<option value='Workshops or schools for non-specialized public'>Workshops or schools for non-specialized public</option>"+
	"<option value='Newsletter'>Newsletter</option>"+
	"<option value='Other'>Other (specify)</option>"+
    "</select></p>"+ 
	"<p><span id='otherDissemination" + num + "'></span></p>"+
	
	"<p><label>Participating researcher: </label> <input type='text' name='dissemination[dissemination" + num + "][name]' id='dissemination[dissemination" + num + "][name]' size='60'></p>"+ 
	"<p><label>Category: </label> <select name='dissemination[dissemination" + num + "][category]' id='dissemination[dissemination" + num + "][category]'>"+
    "<option value='Network ESR'>Network ESR</option>"+
    "<option value='Network ER'>Network ER</option>"+
    "<option value='Doctorand from the team without solaire contract'>Doctorand from the team without solaire contract</option>"+
	"<option value='Postdoc from the team without solaire contract'>Postdoc from the team without solaire contract</option>"+
	"<option value='Senior member of the team'>Senior member of the team</option>"+
    "</select></p>"+
	"<p><label>Place: </label><input type='text' name='dissemination[dissemination" + num + "][place]' id='dissemination[dissemination" + num + "][place]' size='60'></p>"+ 
	"<p><label>Dates: </label><input type='text' name='dissemination[dissemination" + num + "][dates]' id='dissemination[dissemination" + num + "][dates]' size='60'></p>"+ 
	"<p><label>Target audience: </label><input type='text' name='dissemination[dissemination" + num + "][audience]' id='dissemination[dissemination" + num + "][audience]' size='60'></p>"+ 
	"<p><label>Newspaper or magazine: </label> <input type='text' name='dissemination[dissemination" + num + "][newspaper]' id='dissemination[dissemination" + num + "][newspaper]' size='60'></p>"+ 
	"<p><label>Date: </label> <input name='dissemination[dissemination" + num + "][date]' id='dissemination[dissemination" + num + "][date]' size='10' />"+
	"<span class='label'>Page: </span> <input name='dissemination[dissemination" + num + "][page]' id='dissemination[dissemination" + num + "][page]' size='3' /></p>"+
	"<div class='buttons'><a href=\"javascript:;\" onclick=\"removeItem('disseminationDiv',\'"+divIdName+"\')\" title=\"Remove the item\"><img  src='forms/img/cancel.png' alt='Remove' width='32' height='32' /></a></div>"+
	"</div>";
    ni.appendChild(newdiv);
}

function removeItem(divName, divNum)
{
	var d = document.getElementById(divName);
	var olddiv = document.getElementById(divNum);
	d.removeChild(olddiv);
}


/* Cambio de opacidad */

function opacity(id, opacStart, opacEnd, millisec) {
	//speed for each frame
	var speed = Math.round(millisec / 100);
	var timer = 0;

	//determine the direction for the blending, if start and end are the same nothing happens
	if(opacStart > opacEnd) {
		for(i = opacStart; i >= opacEnd; i--) {
			setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
			timer++;
		}
	} else if(opacStart < opacEnd) {
		for(i = opacStart; i <= opacEnd; i++)
			{
			setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
			timer++;
		}
	}
}

//change the opacity for different browsers
function changeOpac(opacity, id) {
	var object = document.getElementById(id).style; 
	object.opacity = (opacity / 100);
	object.MozOpacity = (opacity / 100);
	object.KhtmlOpacity = (opacity / 100);
	object.filter = "alpha(opacity=" + opacity + ")";
}

function shiftOpacity(id, millisec) {
	//if an element is invisible, make it visible, else make it ivisible
	
	opacity(id, 100, 0, millisec);
	/*
	if(document.getElementById(id).style.opacity == 0) {
		opacity(id, 0, 100, millisec);
	} else {
		opacity(id, 100, 0, millisec);
	}
	*/
}

function blendimage(divid, imageid, imagefile, millisec) {
	var speed = Math.round(millisec / 100);
	var timer = 0;
	
	//set the current image as background
	document.getElementById(divid).style.backgroundImage = "url(" + document.getElementById(imageid).src + ")";
	
	//make image transparent
	changeOpac(0, imageid);
	
	//make new image
	document.getElementById(imageid).src = imagefile;

	//fade in image
	for(i = 0; i <= 100; i++) {
		setTimeout("changeOpac(" + i + ",'" + imageid + "')",(timer * speed));
		timer++;
	}
}

function currentOpac(id, opacEnd, millisec) {
	//standard opacity is 100
	var currentOpac = 100;
	
	//if the element has an opacity set, get it
	if(document.getElementById(id).style.opacity < 100) {
		currentOpac = document.getElementById(id).style.opacity * 100;
	}

	//call for the function that changes the opacity
	opacity(id, currentOpac, opacEnd, millisec)
}