// JavaScript Document
  var SetDisplayDiv=function(){
  	  SetDisplayDiv.arrObj= Array();
	  
  };
  

 SetDisplayDiv.addEventW=function(el,evname,func){
		if (el.attachEvent) { // IE
			//alert("entra: "+el.value+"  :  "+evname);
			el.attachEvent("on" + evname, func);
		} else if (el.addEventListener) { // Gecko / W3C
			el.addEventListener(evname, func, true);
		} else {
			el["on" + evname] = func;
		}
}
SetDisplayDiv.setup=function (params){
  	function param_default(pname, def) { 
		//alert(SetDisplayDiv.arrObj.length-1);
		if (typeof params[pname] == "undefined") { params[pname] = def; } 
		else {SetDisplayDiv.arrObj[SetDisplayDiv.arrObj.length-1][pname]=params[pname];}
	};
	SetDisplayDiv.arrObj[SetDisplayDiv.arrObj.length]=Array();
	param_default("radioName",null);
	param_default("radioValue",null);
	param_default("radioEvent",null);
	param_default("divId",null);
  }
  SetDisplayDiv.addEvent = function(func) {
  	var m,j;
	for(j=0;j<SetDisplayDiv.arrObj.length;j++){
		arrayRadio=document.getElementsByName(SetDisplayDiv.arrObj[j].radioName);
		evname=SetDisplayDiv.arrObj[j].radioEvent;
		for(m=0;m<arrayRadio.length;m++){
			el=arrayRadio[m];
			if (el.attachEvent) { // IE
				//alert("entra: "+el.value+"  :  "+evname);
				el.attachEvent("on" + evname, func);
			} else if (el.addEventListener) { // Gecko / W3C
				el.addEventListener(evname, func, true);
			} else {
				el["on" + evname] = func;
			}
		}
	}
};

  	SetDisplayDiv.radioChecado=function(arrayRadio){
	var i;
		for(i=0;i<arrayRadio.length;i++)
			if(arrayRadio[i].checked==true)
				return i;
		return -1;
	}
	SetDisplayDiv.setDisplay=function(){
		var locked;
		for(j=0;j<SetDisplayDiv.arrObj.length;j++){
			arrayRadio=document.getElementsByName(SetDisplayDiv.arrObj[j].radioName);
			checado=SetDisplayDiv.radioChecado(arrayRadio);
			if(checado>-1){
				objdivS=document.getElementById(SetDisplayDiv.arrObj[j].divId);
				if(arrayRadio[checado].value==SetDisplayDiv.arrObj[j].radioValue){
					objdivS.style.display='';
					locked=SetDisplayDiv.arrObj[j].divId;
				}
				else{
					if(locked!=SetDisplayDiv.arrObj[j].divId)
						objdivS.style.display='none';
				}
			}
		}
		
	}
	SetDisplayDiv();

SetDisplayDiv.Start=function (){
 	SetDisplayDiv.setDisplay();

	SetDisplayDiv.addEvent(SetDisplayDiv.setDisplay);
	window.onload=function(){
		SetDisplayDiv.setDisplay();
		SetDisplayDiv.addEvent(SetDisplayDiv.setDisplay);
	}
	//SetDisplayDiv.addEventW(window,"load",SetDisplayDiv.setDisplay);
	//SetDisplayDiv.addEventW(window,"load",SetDisplayDiv.addEvent);
 }
 