Ciao a tutti, non sono molto ferrato in javascript, potreste dirmi se questo codice è corretto?:

codice:
<script language="Javascript">
<!--

//Detect firefox

if(navigator.userAgent.indexOf("Firefox")!=-1){
var versionindex=navigator.userAgent.indexOf("Firefox")+8
if (parseInt(navigator.userAgent.charAt(versionindex))>=1)
function StartImage (URL)
{
	w = 500+5*2+5+20;
	h = 400+5*2+80;
	imgwindow = window.open(URL,"imgwindow"," scrollbar=no, toolbar=no, fullscreen=no, resizable=yes,width="+w+",height="+h);
	imgwindow.focus();
}

}



//Detect IE5.5+
version=0
if (navigator.appVersion.indexOf("MSIE")!=-1){
temp=navigator.appVersion.split("MSIE")
version=parseFloat(temp[1])
}

if (version>=5.5) //NON IE browser will return 0
function StartImage (URL)
{
	w = 500+5*2+5+20;
	h = 400+5*2+80;
	imgwindow = window.open("immagini/test2"+URL,"imgwindow"," scrollbar=no, toolbar=no, fullscreen=no, resizable=yes,width="+w+",height="+h);
	imgwindow.focus();
}



//Detect Opera

if(navigator.userAgent.indexOf("Opera")!=-1){
var versionindex=navigator.userAgent.indexOf("Opera")+6
if (parseInt(navigator.userAgent.charAt(versionindex))>=8)
function StartImage (URL)
{
	w = 500+5*2+5+20;
	h = 400+5*2+80;
	imgwindow = window.open("immagini/test"+URL,"imgwindow"," scrollbar=no, toolbar=no, fullscreen=no, resizable=yes,width="+w+",height="+h);
	imgwindow.focus();
}

}



-->
</script>
In pratica vorrei che solo una delle 3 function startimage (url) venisse eseguita, a seconda del browser rilevato. Dai mie prove però mi viene eseguita sempre l'ultima delle 3 (ho provato anche con if... else...).

Grazie