function showEditWindow(winHeight, winWidth, winName, winURL, closeMethod) {
	var win = new Window({className: "alphacube", title: winName, width: winWidth, height:winHeight, destroyOnClose: true, recenterAuto:false, onClose:closeMethod}); 
	//win.getContent().update("<h1>Hello world !!</h1>"); 
	win.setURL(winURL);
	win.showCenter(true);
}

function updateAvatar() {
	//alert('Update Avatar');
	new Ajax.Request('/editfield/form:profile,field:avatar/get/', {method:'get', 
									 onSuccess: function(transport){ 
													var response = transport.responseText;
													document.getElementById('avatarImage').src = response;
												}
	});
}

function updateSignature() {
	new Ajax.Request('/editfield/form:profile,field:signature/get/', {method:'get', 
									 onSuccess: function(transport){ 
													var response = transport.responseText;
													document.getElementById('signature').innerHTML = response;
												}
	});
}

function updateLocation() {
	new Ajax.Request('/editfield/form:profile,field:location/get/', {method:'get', 
									 onSuccess: function(transport){ 
													var response = transport.responseText;
													document.getElementById('location').innerHTML = response;
												}
	});
}

/**
 * winHeight: height of the window in pixels
 * winWidth: width of the window in pixels
 * winName: name of the window
 * winURL: URL of the window to open
 * winUpdateURL: URL to call when the window is closed
 * winUpdateElement: the element to update with the window is closed
 */
function openEditSummaryWindow(winHeight, winWidth, winName, winURL, winUpdateURL, winUpdateElement) {
	var win = new Window({className: "alphacube", title: winName, width: winWidth, height: winHeight, showEffect:  Element.show, hideEffect: Element.hide, destoryOnClose: false, recenterAuto:false, onClose:
							function() {
								new Ajax.Request(winUpdateURL, {method: 'get',
																onSuccess: function(transport) {
																				var response = transport.responseText;
																				document.getElementById(winUpdateElement).innerHTML = response;
																}}
												)
							}
						});
	win.setURL(winURL);
	win.showCenter(true);
}

function openEditSummaryCoverWindow(winHeight, winWidth, winName, winURL, winUpdateURL, winUpdateElement) {
	var win = new Window({className: "alphacube", title: winName, width: winWidth, height: winHeight, showEffect:  Element.show, hideEffect: Element.hide, destoryOnClose: false, recenterAuto:false, onClose:
							function() {
								new Ajax.Request(winUpdateURL, {method: 'get',
																onSuccess: function(transport) {
																				var response = transport.responseText;
																				document.getElementById(winUpdateElement).src = response;
																}}
												)
							}
						});
	win.setURL(winURL);
	win.showCenter(true);
}

function showHide(eleid) {
	var ele = null;
	if(document.getElementById) {
		ele = document.getElementById(eleid);
	} else if(document.layers)  {
		ele = document.id;
	} else {
		ele = document.all.id;
	}
	if( ele == null ) {
		return;
	}
	
	if(ele.style.display == "inline" ) {
		ele.style.display = "none";
	} else {
		ele.style.display = "inline";
	}
	//alert(ele.style.display);
}