baseTopPop = 129;
baseHeightPop = 148;

function popShow(popId,margin)
{
	if (popId=='alllooking')
	{
		baseTopPop = 307;
		baseHeightPop = 289;
	}
	else
	{
		baseTopPop = 185;
		baseHeightPop = 150;
	}

	var pos = $(popId+'_box').getPosition();

	if (popId=='allnew')
	{
		heightBound = document.body.clientHeight-baseHeightPop-15;
		topBound = baseTopPop+18;
	}
	else
	{
		heightBound = document.body.clientHeight-baseHeightPop;
		topBound = baseTopPop;
	}

	leftBound = pos.x;
	document.getElementById(popId).style.left = pos.x+'px';
	document.getElementById(popId).style.visibility = 'visible';
	document.getElementById(popId).style.display = 'block';
	changeOpac(96,popId);
	var myEffect = new Fx.Morph(popId, {duration: 1000, transition: Fx.Transitions.Sine.easeOut});
	myEffect.start({
    	'height': [0, heightBound],
	    'top': [545, topBound]
	});
}


function popClose(popId,margin)
{
	if (popId=='alllooking')
	{
		baseTopPop = 307;
		baseHeightPop = 289;
	}
	else
	{
		baseTopPop = 185;
		baseHeightPop = 150;
	}
	
	heightBound = document.body.clientHeight-baseHeightPop-15;
	leftBound = Math.round((document.body.clientWidth-1000)/2)+margin;
	var myEffect = new Fx.Morph(popId, {duration: 1000, transition: Fx.Transitions.Sine.easeOut});
	myEffect.start({
    	'height': [heightBound, 0],
	    'top': [325, 545]
	});
	setTimeout("document.getElementById('" + popId + "').style.visibility = 'hidden';document.getElementById('" + popId + "').style.display = 'none';",1000);
//	    'width': [313, 0],
//    	'left': [leftBound,0],
}


var statusEVC = 0;
var prevEVC = "";
var prevstatusEVC = 0;
function validEVC(val,obj)
{
	if (prevEVC==val)
	{
		statusEVC = prevstatusEVC;
		return;
	}
	statusEVC = 0;
	document.getElementById('submitButton').disabled = true;
	prevEVC = val;

	ajaxRequest_init();

	ajaxRequest.open('GET', '/config/custom/validEVC.asp?n='+val,true);

	ajaxRequest.onreadystatechange = function() {
		if (ajaxRequest.readyState == 4) {
			if (ajaxRequest.status == 200) {
				if (val == ajaxRequest.responseText)
				{
					statusEVC = 1;
					prevstatusEVC = statusEVC;
					obj.value = val;
					obj.style.backgroundColor = '#00CC00';
					document.getElementById('img_'+obj.name).src='/layouts/defaut/fr/design/valid.png';
					document.getElementById('submitButton').disabled = false;
				}
				else
				{
					statusEVC = 0;
					prevstatusEVC = statusEVC;
					obj.style.backgroundColor = '#CC0000';
					document.getElementById('img_'+obj.name).src='/graphisme/blank.png';
				}
			}
		}
	};

	ajaxRequest.send(null);
}


var prevChassis="";
function getChassis(val,nam)
{
	if (prevChassis==val) return;
	prevChassis = val;

	document.getElementById("model").innerHTML = "<select id=\"VehiculeModel\" name=\"VehiculeModel\" tabindex=\"2\"></select><img src=\"/layouts/defaut/fr/design/notvalid.png\" width=\"16\" height=\"16\" align=\"absbottom\" id=\"img_VehiculeModel\" />";

	document.getElementById("chassis").innerHTML = "<select id=\"VehiculeChassis\" name=\"VehiculeChassis\" tabindex=\"3\"></select><img src=\"/layouts/defaut/fr/design/notvalid.png\" width=\"16\" height=\"16\" align=\"absbottom\" id=\"img_VehiculeChassis\" />";

	ajaxRequest_init();

	ajaxRequest.open('GET', '/config/custom/chassis.asp?v='+val, true);

	ajaxRequest.onreadystatechange = function() {
		if (ajaxRequest.readyState == 4) {
			if (ajaxRequest.status == 200) {
				document.getElementById(nam).innerHTML = ajaxRequest.responseText;
			}
		}
	};

	ajaxRequest.send(null);
}


var prevModel="";
function getModel(val,nam)
{
	if (prevModel==val) return;
	prevModel = val;

	ajaxRequest_init();

	ajaxRequest.open('GET', '/config/custom/model.asp?v='+val, true);

	ajaxRequest.onreadystatechange = function() {
		if (ajaxRequest.readyState == 4) {
			if (ajaxRequest.status == 200) {
				document.getElementById(nam).innerHTML = ajaxRequest.responseText;
			}
		}
	};

	ajaxRequest.send(null);
}

