﻿   var maxw = 450;
   var lastopendiv = 'TD1';
   var tmr;
   function ExpandDiv(id){
        if(id != lastopendiv){
            var obj = getElementStyle(id);
            var objlast = getElementStyle(lastopendiv);
            obj.display = '';
            if(parseInt(obj.width)<maxw){
                obj.width = (parseInt(obj.width) + 30) + 'px';
                tmr = setTimeout("ExpandDiv('" + id + "');",10);                
            }else{
                obj.width = maxw+'px';
                clearTimeout(tmr); 
                if(document.getElementById(id).firstChild){
                    document.getElementById(id).firstChild.style.display = '';
                }
                lastopendiv = id;                           
            }  
            
            if(parseInt(objlast.width)>0){
                objlast.width = (parseInt(objlast.width) - 30) + 'px';                
            }else{
                objlast.width = '0px';
                objlast.display='none';                
            }            
        }        
   }
   
   function HideOtherDivs(id){
   if(id != lastopendiv){
    if(document.getElementById(lastopendiv).firstChild){
       document.getElementById(lastopendiv).firstChild.style.display = 'none';
   }}
   for(var i=1;i<=4;i++){
        if(('TD'+i != id) && ('TD'+i != lastopendiv)){
            if(document.getElementById('TD'+i).firstChild){
                document.getElementById('TD'+i).firstChild.style.display = 'none';
            }
            document.getElementById('TD'+i).style.width = 0;
            document.getElementById('TD'+i).style.display = 'none';            
        }
    }
    clearTimeout(tmr); 
    ExpandDiv(id);
   }
   
   function getElementStyle(objectId)
{
    if (document.getElementById && document.getElementById(objectId)){
    //W3C DOM
    return document.getElementById(objectId).style;
    }
    else if (document.all && document.all(objectId)) {
	// MSIE 4 DOM
	return document.all(objectId).style;
    } else if (document.layers && document.layers[objectId]) {
	// NN 4 DOM.. note: this won't find nested layers
	return document.layers[objectId];
    } else {
        return false;
    }
}

var timer;
var newsrc;
var value = new Number();
var img_wd,img_hgt;

function setopacity(obj,mode){ //Sets the opacity of targetobject based on the passed in value setting (0 to 1 and in between)
       
    if(mode=='inc'){ value =15; }
    else{ value = -15; }
    var targetobject=document.getElementById(obj);
   
	if (targetobject.filters && targetobject.filters[0]){ //IE syntax
	      if (typeof targetobject.filters[0].opacity=="number") {//IE6
		  	    targetobject.filters[0].opacity = value+parseInt(targetobject.filters[0].opacity);
		  	    }
		    else{ //IE 5.5
		        var fil = targetobject.style.filter;
	             fil = fil.substring(fil.indexOf('alpha(opacity=')+'alpha(opacity='.length,fil.lastIndexOf(')'));
	             fil = parseInt(fil)+value;
	             targetobject.style.filter = "alpha(opacity="+fil+")";
	            }
        if(targetobject.filters[0].opacity<=0){
            document.getElementById(obj).src=newsrc;
            if (document.layers) {
              document.getElementById(obj).style.height=img_hgt;
              document.getElementById(obj).style.width=img_wd;
             } else {  
                  document.getElementById(obj).style.height=img_hgt+"px";
                  document.getElementById(obj).style.width=img_wd+"px";
             }
            clearInterval(timer);
            timer = setInterval('setopacity("'+obj+'","inc");',50);
        }
        if(targetobject.filters[0].opacity==100){
            clearInterval(timer);                
        }
	}
	else if (typeof targetobject.style.opacity!="undefined") //Standard opacity syntax
       {
        targetobject.style.opacity=(parseInt(targetobject.style.opacity*100)+value)/100;		      
        
        if(parseInt(targetobject.style.opacity*100)<=0){
            document.getElementById(obj).src=newsrc;
             if (document.layers) {
              document.getElementById(obj).style.height=img_hgt;
              document.getElementById(obj).style.width=img_wd;
             } else {  
                  document.getElementById(obj).style.height=img_hgt+"px";
                  document.getElementById(obj).style.width=img_wd+"px";
             }
            clearInterval(timer);
            timer = setInterval('setopacity("'+obj+'","inc");',50);
        }
        if(parseInt(targetobject.style.opacity*100)==100){
            clearInterval(timer);                
        }
       }	 
	        
}
