function inizializza(){
	if (document.all) { // creo le variabili per la sintassi di IE
		documento="document.all";
		parA="[\"";
		parB="\"]";
		stile=".style.";
	}else if (document.layers){ //NN4
		documento="document.layers";
		parA="[\"";
		parB="\"]";
		stile=".";
		stile2=".currentStyle";
	}else if (document.getElementById) { // Opera e NN6
		documento="document.getElementById";
		parA="(\"";
		parB="\")";
		stile=".style.";
	}
} 


function setstile(mioelement,miostile,miovalore) {
     eval(documento+parA+mioelement+parB+stile+miostile+"='"+miovalore+"';");
}

function getstile2(mioelement,miostile) {
     eval(documento+parA+mioelement+parB+stile2+miostile);
}

function wipeInOut(elId){
	var row = dojo.byId(elId);
	if (row.style.height=='0px'){
		dojo.fx.html.wipeIn(row, 300);	
	}else{
		dojo.fx.html.wipeOut(row, 300);
	}
}


function getStyle(el, style) {
   if(!document.getElementById) return;
   
     var value = el.style[toCamelCase(style)];
   
    if(!value)
        if(document.defaultView)
            value = document.defaultView.
                 getComputedStyle(el, "").getPropertyValue(style);
       
        else if(el.currentStyle)
            value = el.currentStyle[toCamelCase(style)];
     
     return value;
}


function toCamelCase( sInput ) {
    var oStringList = sInput.split('-');
    if(oStringList.length == 1)    
        return oStringList[0];
    var ret = sInput.indexOf("-") == 0 ? 
    	oStringList[0].charAt(0).toUpperCase() + oStringList[0].substring(1) : oStringList[0];
    for(var i = 1, len = oStringList.length; i < len; i++){
        var s = oStringList[i];
        ret += s.charAt(0).toUpperCase() + s.substring(1)
    }
    return ret;
}




function showHide(mioelement,el2){
el = eval(documento+parA+mioelement+parB+";");
	if (getStyle(el,'display') == 'none'){setstile(mioelement,'display','block');}else{setstile(mioelement,'display','none');}
}

function getstile(mioelement,miostile) {
     eval(documento+parA+mioelement+parB+stile+miostile+";");
}



function setdisabilitato(mioelement,miovalore) {
     eval(documento+parA+mioelement+parB+".disabled="+miovalore+";");
}

function setformvalue(mioelement,miovalore) {
	document.forms['dmd_form'].elements[mioelement].value=miovalore;
}

function SetSelectedValue(mioelement,miovalore) {
	theSelect = document.forms['dmd_form'].elements[mioelement];
	for (prop in theSelect.options) {
		if (theSelect.options[prop].value == miovalore)
			theSelect.selectedIndex = prop;
	}
}


function setparentdisabled(tabella,miovalore){
	element = 'ana__parent_txt';		document.forms['dmd_form'].elements[element].disabled=miovalore;
	element = 'ana__partitaiva';		document.forms['dmd_form'].elements[element].disabled=miovalore;
	element = tabella+'__citta';				document.forms['dmd_form'].elements[element].disabled=miovalore;
	element = tabella+'__op_address';		document.forms['dmd_form'].elements[element].disabled=miovalore;
	element = tabella+'__address';			document.forms['dmd_form'].elements[element].disabled=miovalore;
	element = tabella+'__cap';					document.forms['dmd_form'].elements[element].disabled=miovalore;
	element = tabella+'__provincia_sigla';	document.forms['dmd_form'].elements[element].disabled=miovalore;
	element = tabella+'__regione';			document.forms['dmd_form'].elements[element].disabled=miovalore;
	element = tabella+'__nazione';			document.forms['dmd_form'].elements[element].disabled=miovalore;
	element = 'ana__tel_lavoro';								document.forms['dmd_form'].elements[element].disabled=0;
	//if(document.forms['dmd_form'].elements[element].value=='###') document.forms['dmd_form'].elements[element].value='';
	element = 'ana__op_unitaoperativa';			document.forms['dmd_form'].elements[element].disabled=0;
	//if(document.forms['dmd_form'].elements[element].value=='###') document.forms['dmd_form'].elements[element].value='';
	setstile('lavoroForm','display','block');
}



function setnewparent(id){
	setparentdisabled('ind_parent',0);
	setformvalue('ana__parent','');
	setformvalue('ana__parent_txt','');
	setformvalue('ana__partitaiva','');
	setformvalue('lavoro__id',id);
	setformvalue('ana__ind_parent',id);
	setformvalue('lavoro__address','');
	setformvalue('lavoro__citta','');
	setformvalue('lavoro__provincia_sigla','');
	setformvalue('lavoro__cap','');	
	setformvalue('lavoro__nazione','ITALIA');
	
	document.forms['dmd_form'].elements['ind_parent__op_address'].selectedIndex=1;
	document.forms['dmd_form'].elements['ind_parent__regione'].selectedIndex=0;
}





inizializza(); //lancio la funzione che inizializza le variabili
