var idOn = 'none';
var subOn = 'none';
function opacity(id, opacStart, opacEnd, millisec) {
//speed for each frame
var speed = Math.round(millisec / 100);
var timer = 0;

	if(idOn != id){
		if(idOn != 'none') {
			for(i = opacEnd; i >= opacStart; i--) {
				setTimeout("changeOpac(" + i + ",'" + idOn + "')",(timer * speed));
				timer++;
			}
		}
		idOn = id;
		
		for(i = opacStart; i <= opacEnd; i++){
			setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
			timer++;
		}
	}
}

function opaChange(id, oGo, oStop, millisec) {
//speed for each frame
var speed = Math.round(millisec / 100);
var timer = 0;

	
		if(oGo > oStop) 
		{
			for(i = oGo; i >= oStop; i--) 
			{
				setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
				timer++;
			}
		}
		else 
		{
			for(i = oGo; i <= oStop; i++)
			{
				setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
				timer++;
			}
		}
}

//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 changeText(txtid,txt,imgid,imgList){
	showText("sp");
	document.getElementById(txtid).innerHTML=txt;
	
	var imgStr = '';
	imgArr = imgList.split(' ');
	
	for (x in imgArr){
		imgStr = imgStr + '<img src="blank.gif" width="50" height="150" alt="" /><img src="scimages/' + imgArr[x] + '"  /><img src="blank.gif" width="50" height="150" alt="" />';
	}
	document.getElementById(imgid).innerHTML=imgStr;
}

function changeSub(subId){

	if (subOn != subId){
		if (subOn != 'none'){
			hideText(subOn);
			showText('mainsub');
			navId = subOn.replace(/sub/,"nav");
			showImg(navId);
			subOn = 'none';
		}
		if ((subId != 'close')&&(subId != subOn)){
			subOn = subId;
			showText(subId);
			hideText('mainsub');
			navId = subOn.replace(/sub/,"nav");
			hideImg(navId);				
		}
	}
	
}

function showText(txtId){
	document.getElementById(txtId).style.display="";
}

function hideText(txtId){
	document.getElementById(txtId).style.display="none";
}

function showImg(imgId){
	document.getElementById(imgId).style.visibility="visible";
}

function hideImg(imgId){
	document.getElementById(imgId).style.visibility="hidden";
}

function swapImage(nm,image){
document.getElementById(nm).src=image;
}


function MM_preloadImages() { //v3.0
	var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
	if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}