var grey_box = document.getElementById('greybox_box');
var greybox_content = document.getElementById('greybox_content');

var grey_box_profile = document.getElementById('greybox_box_profile');
var greybox_content_profile = document.getElementById('greybox_content_profile');

var scroll = new Fx.Scroll(window, {
	duration: 500,
	transition: Fx.Transitions.Quad.easeInOut
});

function open_greybox(content) {
	//greybox_resize();
	greybox_content.innerHTML = content;
	grey_box.style.display = 'block';
//	scroll.toElement('greybox_box');
}

function open_greybox_default(content) {
	//greybox_resize();
	var header = '<div style="width:600px;position:relative;margin-left:auto;margin-right:auto;"><div style="width:620px;text-align:right;margin-left:auto;margin-right:auto;"><a href="javascript:close_greybox()" style="padding-left: 10px;padding-right: 10px;background: #ccc;font-family:arial;font-size:20px;color: #cc0000;text-decoration: none;">Fermer&nbsp;<img src="/vzg_images/petites-annonces/btn-close.gif" border="0" /></a></div><div style="width:600px;position: relative;margin-left: auto;margin-right: auto;border: 10px solid #CCC;background: #FFF;" id="greybox_html_content">';
	var footer = '</div></div>';
	greybox_content.innerHTML = header+content+footer;
	grey_box.style.display = 'block';
//	scroll.toElement('greybox_box');
}

function open_greybox_profile(content) {
	//greybox_resize();
	greybox_content_profile.innerHTML = content;
	grey_box_profile.style.display = 'block';
	scroll.toElement('greybox_box');
}

function close_greybox() {
	greybox_content_profile.innerHTML = '';
	grey_box_profile.style.display = 'none';
	greybox_content.innerHTML = '';
	grey_box.style.display = 'none';
}

function greybox_resize(){  
	var frame = document.getElementById("greybox_box");  
	var htmlheight = document.body.parentNode.scrollHeight;  
	var windowheight = window.innerHeight;
	if ( htmlheight < windowheight ) {
		document.body.style.height = windowheight + "px";
		frame.style.height = windowheight + "px";
	} else {
		document.body.style.height = htmlheight + "px";
		frame.style.height = htmlheight + "px";
	}
}
