function changeImg(obj) {
  	var strSrc = obj.src;
	
	if(strSrc.indexOf('_off') != -1) {
 			rExp = /_off/gi;
   		obj.src = strSrc.replace(rExp,'_on');
	}
	else {
   		rExp = /_on/gi;
      		obj.src = strSrc.replace(rExp,'_off');
	}
}

function changeClass(intID) {
   	var strSrc = document.getElementById('TD' + intID).className;
	if(strSrc.indexOf('_off') != -1) {
  		rExp = /_off/gi;
   		document.getElementById('TD' + intID).className = strSrc.replace(rExp,'_on');
	}
	else {
	    rExp = /_on/gi;
        document.getElementById('TD' + intID).className = strSrc.replace(rExp,'_off');
	}
}

function initImage(imageId, intSpeed) {
  image = document.getElementById(imageId);
  setOpacity(image, 0);
  image.style.visibility = 'visible';
  fadeIn(imageId,0, intSpeed);
}

function setOpacity(obj, opacity) {
  opacity = (opacity == 100)?99.999:opacity;
  
  // IE/Win
  obj.style.filter = "alpha(opacity:"+opacity+")";
  
  // Safari<1.2, Konqueror
  obj.style.KHTMLOpacity = opacity/100;
  
  // Older Mozilla and Firefox
  obj.style.MozOpacity = opacity/100;
  
  // Safari 1.2, newer Firefox and Mozilla, CSS3
  obj.style.opacity = opacity/100;
}

function fadeIn(objId,opacity,intSpeed) {
  if (document.getElementById) {
    obj = document.getElementById(objId);
    if (opacity <= 100) {
      setOpacity(obj, opacity);
      opacity += 1;
      window.setTimeout("fadeIn('"+objId+"',"+opacity+")", intSpeed);
    }
  }
}

function setSelected(obj, strValue, strDefault){
	var strTemp;
	if(strValue!=''){
		for (var i=0;i<obj.length;i++){
			if(obj[i].value==strValue){obj[i].selected=true;}
		}
	}else{
		for (var i=0;i<obj.length;i++){
			if(obj[i].value==strDefault){obj[i].selected=true;}
		}
	}
}
function setRadioChecked(obj, strValue, strDefault){
	var strTemp;
	if(strValue!=''){;
		for (var i=0;i<obj.length;i++){
			if(obj[i].value==strValue){obj[i].checked=true;}
		}
	}else{
		for (var i=0;i<obj.length;i++){
			if(obj[i].value==strDefault){obj[i].checked=true;}
		}
	}
}
function setChecked(obj, strValue, strDefault){
	var strTemp;
	if(strValue!=''){;
		if(obj.value==strValue){obj.checked=true;}
	}else{
		if(obj.value==strDefault){obj.checked=true;}
	}
}

