function alertFctn(msg, elmtId) {
	
	myStickyWin = new StickyWin({
		content: '<div class="closeSticky">' + msg + '</div>',
		relativeTo: $(elmtId+'Input'),
        position: 'bottomLeft'
	});
	setTimeout(myStickyWin.hide, 2500);
	highlightField(elmtId);
	
//	alert(' message :'+msg+'element '+elmtId);
}
function alertFctnHighlight(msg, elmtId, highlightId) {
	myStickyWin = new StickyWin({
		content: '<div class="closeSticky">' + msg + '</div>',
		relativeTo: $(elmtId),
		position: 'bottomLeft'
	});
	setTimeout(myStickyWin.hide, 2500);
	highlightField(highlightId);
}
function highlightField(fieldName) {
	$(fieldName).set('morph', {duration: 500}).morph({
		color: ['#ffffff', '#000000'],
		backgroundColor: ['#d50926', '#ffffff']
	});
	
	return $(fieldName);
}

function menuItemOver(id) {
	$(id).getElements('div').each(function(item) {
		item.set('class', item.className+'On');
	});
}

function menuItemOut(id) {
	$(id).getElements('div').each(function(item) {
		item.set('class', item.className.substring(0, item.className.length-2));
	});
}

function updatePrices(code_country, duration, from) {
	myRequest = new Request({
		method: 'get', 
		url: BasePath + "/user/rt_fetchprice.php",
		onSuccess: function(responseText, responseXML) {
			$('Price').innerHTML = responseText + " €";
			$('Price').set('morph', {duration: 500}).morph({color: ['#000000', '#ffffff']});
		}
	});
	myRequest.send("language=" + Language + "&code_country=" + code_country + "&duration=" + duration + "&from=" + from);
}
function morphElements(elements, zone) {
	var Bgs = ['#ffffff', '#fbff98', '#f2b574', '#ff6464'];
	newZone = ((zone+1)%(parseInt($('nbZonesHidden').value)+1));
	
	elements.set('class', 't' + newZone).set('morph', {duration: 250}).morph({
		backgroundColor: [Bgs[zone], Bgs[newZone]]
	});
}

function setZoneMonth(year, month) {
	zone = parseInt($('CB_' + year + '_' + month).getElement('.dayinmonth').getElement('input').get('class').substr(1, 2));
	morphElements($('CB_' + year + '_' + month).getElements('.dayinmonth').getElement('input'), zone);
}
function setZoneDayInWeek(year, month, dayinweek) {
	zone = parseInt($('CB_' + year + '_' + month).getElement('.dayinmonth[id^=DIW' + dayinweek + ']').getElement('input').get('class').substr(1, 2));
	morphElements($('CB_' + year + '_' + month).getElements('.dayinmonth[id^=DIW' + dayinweek + ']').getElement('input'), zone);
}
function setZoneDay(year, month, day) {
	zone = parseInt($('BTN_' + year + '_' + month + '_' + day).get('class').substr(1, 2));
	morphElements($('BTN_' + year + '_' + month + '_' + day), zone);
}
function adTypeTranslationForURL(ad_type, language) {
	if (ad_type == "ALL") return("location");
	else if (ad_type == "LOCALS") return("chez-l-habitant");
	else if (ad_type == "SERVICE") return("logement-contre-service");
	else if (ad_type == "COLOC") return("colocation");
	else if (ad_type == "SEASONAL") return("location-vacance");
	else if (ad_type == "BEDNBREAKFAST") return("chambre-d-hotes");
	else return(ad_type);
}
function nicePopup() {
	SqueezeBox.open('message', {handler: 'adopt',size: {x: 400, y: 160}});
}
