

function update_field_POST(table2edt, field2edt, pk2edt, pkValue2edt){
	document.getElementById('table').value=table2edt;
	document.getElementById('field').value=field2edt.id;
	document.getElementById('field_value').value=field2edt.value;
	document.getElementById('pk').value=pk2edt;
	document.getElementById('pk_value').value=pkValue2edt;
	upd_via_post.submit();
	
}

function switchObj(obj, idobj){
		
	for (i=0; i<obj.length; i++){
			how=(document.getElementById('tr_'+obj[i]).style.display=='none')?'':'none';
			document.getElementById('tr_'+obj[i]).style.display=how;
	}
	
	document.getElementById('head_'+idobj).style.display=how;

	image=document.getElementById('img_'+idobj);
	src=(how=='none')?'images/piu.gif':'images/meno.gif';
	image.src=src;
}

function setStatusMode(m){
	
	switch(m) { 
		case 0: 
		document.getElementById('imageStatus').src='img/verde.gif';
		document.getElementById('tdStatus').innerHTML='&nbsp;Ok...';
		break; 
	
		case 1: 
		document.getElementById('imageStatus').src='img/rosso.gif';
		document.getElementById('tdStatus').innerHTML='&nbsp;...attendere il trasferimento del file...';
		break; 
	}

}


function openWindow(nome, url, w, h, scorrimento, status, resizable) {
	var win = null;
	var pagina, nome, LeftPosition, TopPosition, settings;
	nome=nome;
	// scorrimento [yes | no]
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h-(screen.width*5/100))/2 : 0;
	settings ='height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scorrimento+', resizable=' +resizable+', status=' +status;
	win = window.open(url,nome,settings);
}

function view_child(obj) {
	var result = "";
	for (var i in obj) {
		result += 'obj' + "." + i + " = " + obj[i] + "<br>";
	}
	
	var w=window.open()
	w.document.write(result);
	return result;
}

function refresh_obj(id){
/*
	AGGIORNA L' SRC DI UN OGGETTO
*/
	document.getElementById(id).src=document.getElementById(id).src+'?ssid='+Math.random();
}


function php_serialize(obj){
	
	// SERIALIZZA UN OGGETTO PER LA SPEDIZIONE VIA GET O POST O PER IL SALVATAGGIO COME STRINGA.
	
    var string = '';

    if (typeof(obj) == 'object') {
        if (obj instanceof Array) {
            string = 'a:';
            tmpstring = '';
            count = 0;
            for (var key in obj) {
                tmpstring += php_serialize(key);
                tmpstring += php_serialize(obj[key]);
                count++;
            }
            string += count + ':{';
            string += tmpstring;
            string += '}';
        } else if (obj instanceof Object) {
            classname = obj.toString();

            if (classname == '[object Object]') {
                classname = 'StdClass';
            }

            string = 'O:' + classname.length + ':"' + classname + '":';
            tmpstring = '';
            count = 0;
            for (var key in obj) {
                tmpstring += php_serialize(key);
                if (obj[key]) {
                    tmpstring += php_serialize(obj[key]);
                } else {
                    tmpstring += php_serialize('');
                }
                count++;
            }
            string += count + ':{' + tmpstring + '}';
        }
    } else {
        switch (typeof(obj)) {
            case 'number':
                if (obj - Math.floor(obj) != 0) {
                    string += 'd:' + obj + ';';
                } else {
                    string += 'i:' + obj + ';';
                }
                break;
            case 'string':
                string += 's:' + obj.length + ':"' + obj + '";';
                break;
            case 'boolean':
                if (obj) {
                    string += 'b:1;';
                } else {
                    string += 'b:0;';
                }
                break;
        }
    }

    return string;
}


var wswindow_w=720;
var wswindow_h=690;


function WS_start(step){

        switch(step) {
            case 1:
				openWindow('shop', 'shop.php', wswindow_w, wswindow_h, 'yes', 'yes', 'no')
                break;
				
            case 2:

                break;
				
            case 3:

                break;
        }

}



