function addcolor(picnum){
	var imageid = "front"+picnum;
	//alert(imageid);
    document.getElementById(imageid).src = "images/portfront/portfront"+picnum+"_b.jpg";
}
function remcolor(picnum){
	//alert(picnum);
	var imageid = "front"+picnum;
    document.getElementById(imageid).src = "images/portfront/portfront"+picnum+"_a.jpg";
}


var currentnum = 1;

//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 clickpic (divid, imageid, picnum, millisec){
	//Keeps track of the current pic number so users can scroll through
	if (picnum==0){
		currentnum++;
	}
	else if (picnum==10){
		currentnum--;
	}
	else {
		currentnum = picnum;
	}
	if (currentnum==10){
		currentnum=1;
	}
	if (currentnum==0){
		currentnum=9;
	}
		//alert (currentnum);
    var speed = Math.round(millisec / 100);
    var timer = 0; 
		     		//alert(divid);


	    //make image transparent
    changeOpac(0, imageid);

	     //make new image
    document.getElementById(imageid).src = "images/ads/large_ad_"+currentnum+".jpg";
	
	    //fade in image
    for(i = 0; i <= 100; i++) {
        setTimeout("changeOpac(" + i + ",'" + imageid + "')",(timer * speed));
        timer++;
    } 
	
	//var picarea = document.getElementById("largepic");
	//var picsrc = "images/"+currentnum+"-large.JPG";
	//picarea.src=picsrc;
	
	//Changes the text area
	var textarea = document.getElementById("slidetext");
	while (textarea.firstChild)
		textarea.removeChild(textarea.firstChild);
	switch (currentnum){
		case 1:
			inserttext = "Text for picture 1.";
			break;
		case 2:
			inserttext = "Text for picture 2.";
			break;
		case 3:
			inserttext = "Text for picture 3.";
			break;
		case 4:
			inserttext = "Text for picture 4.";
			break;
		case 5:
			inserttext = "Text for picture 5.";
			break;
		case 6:
			inserttext = "Text for picture 6.";
			break;
		case 7:
			inserttext = "Text for picture 7.";
			break;
		case 8:
			inserttext = "Text for picture 8.";
			break;
		case 9:
			inserttext = "Text for picture 9.";
			break;
	}
	textarea.appendChild(document.createTextNode(inserttext));
	var prevnum = currentnum;
}
