show_duration=[3,6];

show_title=[[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]];
show_url=[[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]];
show_src=[[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]];
show_ads=[[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]];
show_ct=[[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]];
function switchAd(n1) {
	var randomdur=(Math.floor(Math.random()*((show_duration[1]-show_duration[0]+1)*10))/10)+show_duration[0];
	var n=(show_ct[n1]+1)%show_src[n1].length;
	if (show_ads[n1][n] && (show_ads[n1][n].complete || show_ads[n1][n].complete==null)) {
		document.getElementById("Ad_Image"+n1).src = show_ads[n1][show_ct[n1]=n].src;
		if(document.getElementById("featured_title"+n1)){
			document.getElementById("featured_title"+n1).innerHTML = show_title[n1][n];
		}
		if(document.getElementById("featured_url"+n1)){
			document.getElementById("featured_url"+n1).href="/my-portfolio/projects/"+show_url[n1][n];
		}
	}
	show_ads[n1][n=(show_ct[n1]+1)%show_src[n1].length] = new Image;
	show_ads[n1][n].src = show_src[n1][n];
	setTimeout("switchAd("+n1+")",randomdur*1000);
}
function doLink(n1){
	alert(show_ct[n1]);
//	alert(show_url[n1][show_ct[n1]]);
//	document.location.href=show_url[n1][show_ct[n1]];
}
onload = function(){
	for(i=0;i<30;i++){
		if(document.getElementById("Ad_Image"+i)) switchAd(i);
	}
}