function CreateBookmarkLink(title, url) {
	title = title || "Chateau Classic";
	url = url || location.href;
	
	if (window.sidebar) { // Mozilla Firefox Bookmark
		window.sidebar.addPanel(title, url, "");
	} else if (window.external ) { // IE Favorite
		window.external.AddFavorite(url, title);
	} else if (window.opera && window.print) { // Opera Hotlist
		var elem = document.createElement('a');
		elem.setAttribute('href',url);
		elem.setAttribute('title',title);
		elem.setAttribute('rel','sidebar');
		elem.click();
	}
}

function movepied()
{
	p = document.getElementById("pied");
	if (p && p.offsetHeight!=null)
	{		
		var c = document.getElementById("centre");
		var d = document.getElementById("droite");
		var g = document.getElementById("gauche");
		
		var elHeight = Math.max(c.offsetHeight, d.offsetHeight, g.offsetHeight);
		var elList = [c, d, g];
		
		for (var k = 0; k < 3; k++) {
			var elObject = elList[k];
			if (document.styleSheets) {
				var sheet = document.styleSheets[1]; // Second stylesheet "structure.css"
				if (sheet.addRule) {
					// Microsoft
					sheet.addRule('#' + elObject.id, 'height: ' + elHeight + 'px');
				}  else if (sheet.insertRule) {
					// W3C Compatible
					sheet.insertRule('#' + elObject.id + ' {height: ' + elHeight + 'px}', sheet.cssRules.length);
				} else {
					// Who knows
					elObject.style.height = elHeight + "px";
				}
			} else {
				elObject.style.height = elHeight + "px";
			}
		}
		return;
		/*
		if (minheight!=c.offsetTop + c.offsetHeight)
		{
			c.style.height = ((minheight-g.offsetTop)-15)+"px";
		}
		else
		{
			d.style.height = ((p.offsetTop-d.offsetTop)-15)+"px";
		}
		*/
	}
}

function OpenPopDownList(href)
{
	window.open(href,'choixlist','height=230,width=520');
	return false;
}

function OpenPopPerso(href)
{
	window.open(href,'choixperso','height=330,width=410');
	return false;
}

function ValidateSendTo()
{
	frm = document.forms['fsendto'];
	if (frm.elements['sendto'].value == "downlist")
	{
		return OpenPopDownList(frm.action + "?sendto=downlist&" + frm.elements['stvalue'].value);
	}
	else
	{
		return true;
	}
}

function ShowLinkSendTo(obj)
{
	/* Build URL */
	var url = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'www.chateauclassic.com/verif_sendto.asp?' + $(obj).closest("form").serialize();
	/* Create dialog if it doesn't exist */
	if ($('#jquery-message-dialog').size() == 0) {
		$('<div id="jquery-message-dialog"></div>')
			.html('')
			.appendTo('body');
	}
	/* Show dialog with link */
	var dlg = $('#jquery-message-dialog')
		.html('<a href="' + url + '" target="_blank">' + url + '</a>')
		.dialog({
			autoOpen: false,
			modal: true,
			title: 'Link',
			minHeight: 50,
			minWidth: 600
		});
	/* Open dialog */
	dlg.dialog('open');
	
	return false;
}

function SelectImage()
{
	e = document.getElementById("sendto");
	switch (e.value.substring(0,3))
	{
		case "dow":
			e.className = "combost downlistst";
			break;
		case "pdf":
			e.className = "combost pdfst";
			break;
		default:
			e.className = "combost excelst";
			break;
	}
}

function ConfirmBox(Titre)
{
	return (confirm(Titre));
}

function SelectRadio(id)
{
	document.getElementById(id).checked = true;
}

function Blink(id,speed)
{
	e = document.getElementById(id)
	e.style.visibility = (e.style.visibility = 'hidden') ? 'visible' : 'hidden';
}

window.onload = function()
{
movepied();
InitScroll();
InitPopup();
//setInterval(Blink(id,5000);',speed);
}
window.resize = function() {movepied();}
