function swapimg(id, url){
var a=document.getElementById("mainimagewrap"+id);
a.style.opacity=0;
a.style.filter="alpha(style=0,opacity=0)";
var img = new Image(); // this new image will use the onload properly
img.onload = function() {
var b=document.getElementById("mainimage"+id);
b.src = url;
setTimeout("fadein("+10+", 'mainimagewrap"+id+"')",25); 
}
img.src = url;
}

function fadein(s, id){
if(typeof(z)!="undefined"){clearTimeout(z);}
var c=document.getElementById(id);
c.style.opacity=s/100;
c.style.filter="alpha(style=0,opacity="+s+")";
s=s+5;
if(s<=100){z=setTimeout("fadein("+s+", '"+id+"')",25);}
}

function showhide(id){
if(document.getElementById("i"+id).style.display!='none'){
	$("#i"+id).toggle();
} else {
	$("#i"+id).fadeIn('fast');
}
}
