<!--


/*----------------------------------------------------------
								POPUP
----------------------------------------------------------*/
if(top.frames.length==0) document.write("<center><a href='http://www.lanciahf.eu'><font size='2'><b>RETOUR AU SITE / BACK TO WEBSITE</b></font></a></center>");

var newWin;	


function sOpenPop(url, name)
{
	if(name)
		name='ompop';
	
	openPop(url, name, true, 500, 310, false, true, false, false);
}

function sOpenPopS(url, name, width, height)
{
	openPop(url, name, true, width, height, false, true, false, false);
}

function openPop(url, name, refresh, width, height, resizable, scrollbars,toolbar, menubar)
{
	var settings='';
	var reOpen=true;

	if(newWin==null)
		newWin = new Array();

	if(newWin[name])
	{

		if(!newWin[name].closed)
		{
			reOpen=false;

			if(refresh && newWin[name].document)
				newWin[name].document.location=url;

			resizeWindow(newWin[name], width, height);

			newWin[name].moveTo((screen.width-width)/2, (screen.height-height)/2);


			newWin[name].focus();

		}
		
	}

	if(reOpen)
	{

		leftf = (screen.width-width)/2;
		topf  = (screen.height-height)/2;

		settings = "width="+width+",height="+height+", top="+topf +",left="+leftf+",";
		settings += "scrollbars=" + ((scrollbars) ? "yes," : "no,");
		settings += "toolbar=" + ((toolbar) ? "yes," : "no,");
		settings += "menubar=" + ((menubar) ? "yes," : "no,");
		settings += "resizable=" + ((resizable) ? "yes" : "no");

		newWin[name] = window.open(url, name, settings);
		//--Sécurité si la fenêtre n'a pas été détectée par le code précédent
		resizeWindow(newWin[name],width, height);
		newWin[name].focus();
	}	

}

function resizeWindow(win, width, height)
{
		win.resizeTo(width +10 , height + 30);		
		win.document.width = width;
		win.document.height = height;

}


function redirectParent(urlParent)
{
	var reOpen=true;
	var opener = window.opener;


	if(opener)
	{
		if(!opener.closed)
		{
			opener.document.location = urlParent;
			reOpen = false;
		}

	}

	if(reOpen)
		childWin = window.open(urlParent, 'par');

	self.close();
}


function reConnectFromPop(urlConnect)
{
	var reOpen	=	true;
	var opener	=	window.opener;


	if(opener)
	{
		if(!opener.closed)
		{
			opener.document.location = urlConnect;
			reOpen = false;
		}

	}

	if(reOpen)
		childWin = window.open(urlConnect, 'par');

	self.close();
}


/*----------------------------------------------------------
						FORM
----------------------------------------------------------*/
function getForm(formName)
{
	var form = document.forms[formName];

	return form;
}


function submitForm(oForm, formName)
{
	var form;

	if(oForm)
		form = oForm;
	else
		form = getForm(formName);

	if(form)
		form.submit();
}

function setFieldValue(oForm, fieldName, fieldValue)
{
	if(oForm)
	{
		if(oForm.elements[fieldName]!=null)
			oForm.elements[fieldName].value=fieldValue;
		
	}
}

/* resize the iframe to fit the contens */


function getDocHeight(doc) {
var docHt = 0, sh, oh;
if (doc.height) docHt = doc.height;
else if (doc.body) {
if (doc.body.scrollHeight) docHt = sh = doc.body.scrollHeight;
if (doc.body.offsetHeight) docHt = oh = doc.body.offsetHeight;
if (sh && oh) docHt = Math.max(sh, oh);
}
return docHt;
}

function setIframeHeight(iframeName) {
var iframeWin = window.frames[iframeName];
var iframeEl = document.getElementById? document.getElementById(iframeName): document.all? document.all[iframeName]: null;
if ( iframeEl && iframeWin ) {
iframeEl.style.height = "auto"; // helps resize (for some) if new doc shorter than previous
var docHt = getDocHeight(iframeWin.document);
// need to add to height to be sure it will all show
if (docHt) iframeEl.style.height = docHt + 30 + "px";
}
}

function loadIframe(iframeName, url) {
if ( window.frames[iframeName] ) {
window.frames[iframeName].location = url;
return false;
}
else return true;
}


function goSetHeight() {
if (parent == window) return;
// arg: id of iframe element this doc is to be loaded into
else parent.setIframeHeight('contens');
}

function popUp(page, name, details) {
newWin=window.open(page, name, details);
newWin.focus();
return false;
}


//-->




