function getStyleObject(objectId) {
    // cross-browser function to get an object's style object given its id
    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;
    }
} // getStyleObject

function changeObjectVisibility(objectId, newVisibility) {
    // get a reference to the cross-browser style object and make sure the object exists
    var styleObject = getStyleObject(objectId);
    if(styleObject) {
	styleObject.visibility = newVisibility;
	return true;
    } else {
	// we couldn't find the object, so we can't change its visibility
	return false;
    }
} // changeObjectVisibility

function moveObject(objectId, newXCoordinate, newYCoordinate) {
    // get a reference to the cross-browser style object and make sure the object exists
    var styleObject = getStyleObject(objectId);
    if(styleObject) {
	styleObject.left = newXCoordinate;
	styleObject.top = newYCoordinate;
	return true;
    } else {
	// we couldn't find the object, so we can't very well move it
	return false;
    }
} // moveObject

function imagePopup(imageID){
	window.open("/imagePopup.php?id="+imageID,"imagePopup","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, width=475px, height=430px");
}

function popupAdd(residence){
	window.open("/agadmin/agadminAction/popupAdd/0/"+residence,"imagePopup","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, width=800px, height=600px");
}

function popupEdit(id, residence){
	window.open("/agadmin/agadminAction/popupEdit/"+id+"/"+residence,"imagePopup","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, width=1024px, height=600px");
}
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}


champsCompte = new Array("inscription[lastname]","inscription[firstname]","inscription[street]","inscription[city]","inscription[zipcode]","inscription[country]","inscription[telephoneathome]","inscription[telephoneathome2]","inscription[fax]","inscription[GSM]","inscription[email]");
champsCompteVisible = new Array("annonce[lastname]","annonce[firstname]","annonce[street]","annonce[city]","annonce[zipcode]","annonce[country]","annonce[telephoneathome]","annonce[telephoneathome2]","annonce[fax]","annonce[GSM]","annonce[email]");
//fonction qui permet de remplir tous les champs text d'un formulaire par rapport a un autre
function remplitChampsVisible(){
	for(i=0;i<=champsCompte.length-1;i++){
		document.formulaire.elements[champsCompteVisible[i]].value=document.formulaire.elements[champsCompte[i]].value;
	}	
}


function effaceMyAccount(v){
	if (confirm("Voulez-vous vraiment supprimer votre compte MyatHome ?")){
		window.location="/myaccount/myAccountAction/deleteMyAccount/"+v;
	}
}
