//<!-- Javascript per andare sui links quando si premono i tasti -->
function VaiA(address) {
window.location = address;
} 
	
//<!-- Javascript per spedire i valori del Login con HTML nascosti -->
function mtChangeAction(){
var sUrl
myDdl= document.getElementById('ddl');
sUrl= myDdl.options[myDdl.selectedIndex].value;
document.getElementById('formLogin').action = sUrl;
return true;
}
				
//<!-- Javascript per andare sulla pagina dell'Università scelta nel ComboBox -->
function mtGoUniversity(){
var sUrl
myDdl= document.getElementById('ddlUniversity');
sUrl= myDdl.options[myDdl.selectedIndex].value;
document.getElementById('formUniversity').action = sUrl;
return true;
}
				
//<!-- Javascript per andare sulla pagina degli Istituti scelto nel ComboBox -->
function mtGoInstitute(){
var sUrl
myDdl= document.getElementById('ddlInstitute');
sUrl= myDdl.options[myDdl.selectedIndex].value;
document.getElementById('formInstitute').action = sUrl;
return true;
}

function PopUp(address) {
var winPopUp;
winPopUp = window.open(address, '', 'toolbar=0,statusbar=0,scrollbars=yes,location=0,menubar=0,resizable=0,width=610,height=400,left = 100,top = 100');
} 
				
function RefreshPage(anchor){
window.location.reload()
//window.location=window.location + '#<xsl:value-of select="MAIN/EDITPROJECT/LEVEL"/>'
//history.go(0);
}
			
function PopUpPub(address) {
var winPopUp;
winPopUp = window.open(address, '', 'toolbar=0,statusbar=0,scrollbars=yes,location=0,menubar=0,resizable=0,width=720,height=500,left = 50,top = 50');
} 
				
function RefreshPage(anchor){
window.location.reload()
//window.location=window.location + '#<xsl:value-of select="MAIN/EDITPROJECT/LEVEL"/>'
//history.go(0);
}
			
function highlightButton(s) {
if ("INPUT"==event.srcElement.tagName)
event.srcElement.className=s
}


function AddUrlWithText(sIdEditor, sUrl, sText){
window.opener.CreateLinkWithText(sIdEditor, sUrl, sText); 
window.close();
}

function mtPeoplePopup(sField){
window.open('EditPubSearchPeople.aspx?Field='+sField,'','fullscreen=no,toolbar=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,directories=no,location=no,width=550,height=350,left=100,top=100');
}
				
function mtJournalPopup(){
window.open('SearchJournal.aspx','','fullscreen=no,toolbar=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,directories=no,location=no,width=550,height=350,left=100,top=100');
}
					 
function mtPublisherPopup(){
window.open('SearchPublisher.aspx','','fullscreen=no,toolbar=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,directories=no,location=no,width=550,height=350,left=100,top=100');
}

function mtInsertNewPeople(){
//document.all['btnPeoplePanelTab'].click();
document.getElementById('btnPeoplePanelTab').click();
}


function mtSelectDepartmentPopup(idDepartment, idResource, idUniversity){
window.open('EditResourcePrj.aspx?IdUniversity='+idUniversity+'&IdDepartment='+idDepartment+'&IdResource='+idResource,'','fullscreen=no,toolbar=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,directories=no,location=no,width=550,height=350,left=100,top=100');
}

// Author: Sergey A Zakharov, sergey@kraft-sp.ru
// Copyright: (c)2002 Sergey A Zakharov
// Small JavaScript Menu: v1.0

ua=navigator.userAgent;
OP=ua.match(/Opera.[5-9]/i)!=null;
IE=!OP&&ua.match(/msie.[4-9]/i)!=null;
N4=!OP&&!IE&&ua.match(/mozilla.4/i)!=null;

ofsH=14;
w=150;
nbsp="&nbsp;";
rt="<!--el-->";
mi=[];
c=0;
d=document;

function Item(m,w){
	this.l;
	this.m=m;
	this.w=w
}

function Menu(n){
	this.n=n;
	this.m="<table border=0 cellpadding=4 cellspacing=0 class=\"menutable2\"><tr>"+rt+"</tr></table>";
	this.sm=this.m; //"";
	this.sw=this.w
	this.bg=["#9CA7BA","#7385A4","#9CA7BA","#7385A4"];
	this.cl=["#FFFFFF","#FFFFFF","#FFFFFF","#FFFFFF"];
	this.mf="Arial, Helvetica, sans-serif";
	this.mfs="11px";
	this.mfw="normal";
	this.smf=this.mf;
	this.smfs=this.mfs;
	this.smfw=this.mfw;
	this.bc="#0000FF";
	this.bw=0
}

function addM(mo,mid,text,url,w){
	mi[mid]=new Item(mo,w);mo.m=mo.m.replace(rt,item(mid,mo.bg[0],mo.n,url,nbsp+text+nbsp)+rt)
	}

function addSM(mo,mid,text,url,w){
	mi[mid+"sub"+c]=new Item(mo,0);
	ls="<!--"+mid+"-->";
	if(mo.sm.indexOf(ls)<0)mo.sm+=(N4?"<layer":"<div")+" id="+mid+"sub onmouseover=sE(this,1) onmouseout=sE(this,0) "+(N4?"visibility=hide  width="+mi[mid].w:"style=position:absolute;visibility:hidden")+"><table width=85 border=0 cellpadding=0 cellspacing=0><tr><td bgcolor="+mo.bc+"><table width=100% border=0 cellpadding=4 cellspacing="+mo.bw+">"+ls+"</table></td></tr></table>"+(N4?"</layer>":"</div>");mo.sm=mo.sm.replace(ls,"<tr>"+item(mid+"sub"+c,mo.bg[2],mo.n+"sub",url,nbsp+text+nbsp)+"</tr>"+ls);c++
}

function writeStyle(o){
	s=IE?"cursor:hand":N4?"text-decoration:none":"cursor:default";d.write('<style>.'+o.n+',.'+o.n+'n{font-family:'+o.mf+';font-size:'+o.mfs+';font-weight:'+o.mfw+';'+s+'}.'+o.n+'sub,.'+o.n+'subn{font-family:'+o.smf+';font-size:'+o.smfs+';font-weight:'+o.smfw+';'+s+'}.'+o.n+'{color:'+o.cl[0]+'}.'+o.n+'sub{color:'+o.cl[2]+'}</style>')
	}

function hl(o,t){
	e=mi[o.id];c=(e.w>0)<<1|t;bg=e.m.bg[c];cl=e.m.cl[c];
	if(N4){
		w=o.clip.width;
		with(o.document){
			linkColor=cl;vlinkColor=cl;alinkColor=cl;bgColor=bg;open();write(e.l);close()
		}
		o.clip.width=w
		}
		else{
			OP?o.style.background=bg:o.style.backgroundColor=bg;o.style.color=cl
			}
		sm=gE(o.id+"sub");
		if(e.w && sm){
			if(t){
				if(N4){
					sm.left=o.pageX;sm.top=o.pageY+o.clip.height;
					}
				else{
					mnp=o;ofsL=0;ofsT=0;
					do{
						ofsL+=mnp.offsetLeft;ofsT+=mnp.offsetTop;mnp=mnp.offsetParent
						}
					while(mnp!=null);s=sm.style;s.left=ofsL;s.top=ofsT+(OP?ofsH:o.offsetHeight)
					}
				sE(sm,1)
				}
			else sE(sm,0)
		}
	}

function item(id,bg,cl,u,t){
	mi[id].l=a(cl+"n",u,t);
	return "<td align=center bgcolor="+bg+(N4?"><ilayer><layer width=100%":" class="+cl+(u?" onmousedown=document.location='"+u+"'":""))+" id="+id+" onmouseover=hl(this,1) onmouseout=hl(this,0)>"+(N4?a(cl,u,t)+"</layer></ilayer>":t)+"</td>"
	}

function a(cl,u,t){
	return "<a class="+cl+" href="+(u?u:"#")+">"+t+"</a>"
	}

function gE(e,f){
	if(N4){
		f=(f)?f:self;
		var V=f.document.layers;
		if(V[e])return V[e];
		for(var W=0;W<V.length;)t=gE(e,V[W++]);
		return t
		}
	if(IE)return d.all[e];
	return d.getElementById(e)
	}

function gS(e){
	return N4? gE(e):gE(e).style
	}

function sE(e,v){
	(N4?e:e.style).visibility=v?N4?'show':'visible':N4?'hide':'hidden'
	}
	

function change(currentbox) {
numb = currentbox.id.split("_");
currentbox = numb[1];

i=parseInt(currentbox)+1

// I empty all combo boxes following the current one

while ((eval("typeof(document.getElementById(\"combo_"+i+"\"))!='undefined'")) && (document.getElementById("combo_"+i)!=null)) {
son = document.getElementById("combo_"+i);
// I empty all options except the first one (it isn't allowed)
for (m=son.options.length-1;m>0;m--) son.options[m]=null;
// I reset the first option
son.options[0]=new Option(displaywhenempty,valuewhenempty)
i=i+1
}

// now I create the string with the "base" name ("stringa"), ie. "data_1_0"
// to which I'll add _0,_1,_2,_3 etc to obtain the name of the combo box to fill

stringa='data'
i=0
while ((eval("typeof(document.getElementById(\"combo_"+i+"\"))!='undefined'")) && (document.getElementById("combo_"+i)!=null)) {
eval("stringa=stringa+'_'+document.getElementById(\"combo_"+i+"\").selectedIndex")
if (i==currentbox) break;
i=i+1
}

// filling the "son" combo (if exists)

following=parseInt(currentbox)+1

if ((eval("typeof(document.getElementById(\"combo_"+following+"\"))!='undefined'")) && (document.getElementById("combo_"+following)!=null)) {
son = document.getElementById("combo_"+following);
stringa=stringa+"_"
i=0
while ((eval("typeof("+stringa+i+")!='undefined'")) || (i==0)) {

// if there are no options, I empty the first option of the "son" combo
// otherwise I put "-select-" in it

if ((i==0) && eval("typeof("+stringa+"0)=='undefined'"))
if (eval("typeof("+stringa+"1)=='undefined'"))
eval("son.options[0]=new Option(displaywhenempty,valuewhenempty)")
else
eval("son.options[0]=new Option(displaywhennotempty,valuewhennotempty)")
else
eval("son.options["+i+"]=new Option("+stringa+i+".text,"+stringa+i+".value)")
i=i+1
}
//son.focus()
i=1
combostatus=''
cstatus=stringa.split("_")
while (cstatus[i]!=null) {
combostatus=combostatus+cstatus[i]
i=i+1
}
return combostatus;
}
}

//funzione che restituisce il valore corrente di un radiobutton
function getTemplate(rbl){

return rbl.selectedvalue;
}


function PopUpTemplate(address, rbl) {
var winPopUp;
winPopUp = window.open(address + document.getElementById(rbl).SelectedValue, '', 'toolbar=0,statusbar=0,scrollbars=yes,location=0,menubar=0,resizable=0,width=610,height=400,left = 100,top = 100');
} 

function EMAddress(address, provider) {
var At="@";
document.write('<a hr' + 'ef="ma' + 'il' + 'to:' + address + At + provider + '" >' + address + At + provider + '</a>')
}