var edit_lodge_resort_ajaxboxCaption;	//	AJAXBOX CAPTION FOR EDIT LODGE - PLACES
var edit_lodge_resort_ajaxbox;			//	AJAXBOX CONTROL FOR EDIT LODGE - PLACES
var edit_lodge_resort_Comment;			//	COMMENT CONTROL FOR EDIT LODGE - PLACES

var edit_lodge_avail_From;			//	FROM CONTROL FOR EDIT LODGE - AVAILABILITIES
var edit_lodge_avail_To;			//	TO CONTROL FOR EDIT LODGE - AVAILABILITIES
var edit_lodge_avail_Colocation;	//	COLOCATION CONTROL FOR EDIT LODGE - AVAILABILITIES
var edit_lodge_avail_Exchange;		//	EXCHANGE CONTROL FOR EDIT LODGE - AVAILABILITIES
var edit_lodge_avail_Rentals;		//	RENTALS CONTROL FOR EDIT LODGE - AVAILABILITIES
var edit_lodge_avail_Comments;		//	COMMENTS CONTROL FOR EDIT LODGE - AVAILABILITIES
var edit_lodge_avail_ID;			//	HIDDEN ID CONTROL FOR EDIT LODGE - AVAILABILITIES


var resourcePath;
var applicationPath;

//http://www.cartosoft.com/mapicons/index.php

/********************************************/
/*				REGISTRATION				*/
/********************************************/

function regCtrlEmail(textValue,controlName,returnControl)
{	
	if (textValue.length > 0)
	{
		var returnMsg = "";
		//TEST EMAIL VIA REGEX
		if (!AjaxMethod.regExEmail(textValue).value)
			returnMsg += AjaxMethod.renderMessageBox("Email is not valid","Validation").value;
			
		//TEST EMAIL IN DATABASE
		if (AjaxMethod.uniqueUser(textValue).value)
			returnMsg += AjaxMethod.renderMessageBox("Email is still used","Validation").value;

		renderMessage(returnMsg,controlName,textValue,returnControl);	
	}		
}

function regCtrlUsername(textValue,controlName,returnControl)
{
	if (textValue.length > 0)
	{
		var returnMsg = "";
		//TEST USER IN DATABASE
		if (AjaxMethod.uniqueUser(textValue).value)
			returnMsg += AjaxMethod.renderMessageBox("User is still used","Validation").value;
		
		renderMessage(returnMsg,controlName,textValue,returnControl);		
	}	
}

function regCtrlPassword(textValue,controlName,returnControl)
{
	var returnMsg="";
	if (textValue.length != 0)
	{
		if (textValue.length < 6)
		{
			returnMsg = AjaxMethod.renderMessageBox("Password must be minimum of 6 characters in length ","Validation").value;
			renderMessage(returnMsg,controlName,'',returnControl);		
		}	
		else
			renderMessage(returnMsg,controlName,textValue,returnControl);	
	}	
}

function renderMessage(msgText,controlName,controlText,returnControl)
{
	if(msgText.length >0)
	{
		//setTimeout(function() {document.getElementById(controlName).focus()},50); 
		document.getElementById(controlName).focus();		
		document.getElementById(returnControl).innerHTML = msgText;	
		document.getElementById(controlName).value = controlText;				
	}
	else
	{
		document.getElementById(controlName).value = controlText;
		document.getElementById(returnControl).innerHTML = "";
	}
}

function selectModeSearch(modeSelect,mode,ajaxBox,idlanguage)
{
	document.getElementById(modeSelect).value = mode;	
	document.getElementById(ajaxBox+'_txtCaption').removeAttribute("Lookup");
	if (mode == "1")	//COUNTRIES
		document.getElementById(ajaxBox+'_txtCaption').setAttribute('Lookup','AjaxMethod.SearchCo(\''+ idlanguage + '\')');
	if (mode == "2")	//REGIONS
		document.getElementById(ajaxBox+'_txtCaption').setAttribute('Lookup','AjaxMethod.SearchRe(\''+ idlanguage + '\')');
	if (mode == "3")	//RESORTS
		document.getElementById(ajaxBox+'_txtCaption').setAttribute('Lookup','AjaxMethod.SearchPlaces(\''+ idlanguage + '\')');
	
}

function showSearchSelected(id,modeSelect,idlanguage)
{
	var mode = document.getElementById(modeSelect).value;
	switch(idlanguage)
	{
		case "us":
			if (mode == "1")	//COUNTRIES
				window.location.replace(applicationPath + 'us/country.aspx/'+ document.getElementById(id).value);
			if (mode == "2")	//REGIONS
				window.location.replace(applicationPath + 'us/area.aspx/'+ document.getElementById(id).value);
			if (mode == "3")
				window.location.replace(applicationPath + 'us/resort.aspx/'+ document.getElementById(id).value);
			break;
		case "fr":
			if (mode == "1")	//COUNTRIES
				window.location.replace(applicationPath + 'pays.aspx/'+ document.getElementById(id).value);
			if (mode == "2")	//REGIONS
				window.location.replace(applicationPath + 'region.aspx/'+ document.getElementById(id).value);
			if (mode == "3")
				window.location.replace(applicationPath + 'station.aspx/'+ document.getElementById(id).value);
			break;
	}		
}

/********************************************/
/*				PLACES						*/
/********************************************/

function resortList(country,idLanguage,controlDiv)
{
	alert(controlDiv);
	country = document.getElementById(country);
	var idCountry =  country.options[country.selectedIndex].value;
	document.getElementById(controlDiv).innerHTML = AjaxMethod.filtresPlaces(idCountry,idLanguage).value;	
}

function renderPrimaryName(textValue,controlName)
{
	document.getElementById(controlName).value = AjaxMethod.RemoveDiacritics(textValue).value;	
}

function getLatLngByIdPlace(textValue,controlLat,controlLng)
{	
	controlLat = document.getElementById(controlLat);	
	controlLng = document.getElementById(controlLng);	
	var latlng = AjaxMethod.getLatLng(textValue).value;
	controlLat.value = latlng.substring(0,latlng.indexOf('|'));			
	controlLng.value = latlng.substring(latlng.indexOf('|')+1,latlng.length);			
}

function getPlacesNearByLodge(lat,lng,idLodge)
{
	//ON RECUPERE LA PLACE LA PLUS PROCHE DE LA LODGE
	var idPlace = AjaxMethod.getPlace_FromLatLng(lat,lng).value;
	
	//ON RECUPERE ET ON AJOUTE LES PLACES PROCHES DE LA PLACE LA PLUS PROCHE DE LA LODGE
	if (idPlace!="")
	{
		var toto = AjaxMethod.getPlaceDistances(idPlace).value;
		var r = new Array();
		eval(toto);	
		for (var key in r) {
		
			//DATABASE
			AjaxMethod.addLodgePlace(idLodge,r[key],'');
			//CONTROL GMAP
			var latlng = AjaxMethod.getLatLng(r[key]).value;
			var lat = latlng.substring(0,latlng.indexOf('|'));
			var lng = latlng.substring(latlng.indexOf('|')+1,latlng.length);
			addPointGmap(lat,lng,'',r[key]);		
		}	
		
		//TEST FADE OUT JQUERY
		$("div#divAutoPlace").html(AjaxMethod.renderMessageBox("Les stations proches de votre r&eacute;sidences ont &eacute;t&eacute; ajoute&eacute;es automatiquement.<br>Pensez &agrave; les commentez au maximum pour vos visiteurs","Information").value);
		$("div#divAutoPlace").fadeIn();
		$("div#divAutoPlace").fadeOut(5000);
	}
}



function renderRegionsByCountry(idCountry,controlName,idLanguage)
{
	controlName = document.getElementById(controlName);
	controlName.length = 0;
	var profil = AjaxMethod.getRegionsByCountry(idCountry,idLanguage).value;
	if (profil != null && profil != "") {
		var r = new Array();
		eval(profil);	
		var oOption = document.createElement("OPTION");
		oOption.value = "-";
		oOption.text  = "Select one item";					
		controlName.options.add(oOption);
		for (var key in r) {
			oOption = document.createElement("OPTION");
			oOption.value = key;
			oOption.text  = r[key];					
			controlName.options.add(oOption);
		}
	}
}

function gmapLoadPlace(ctrlMap,ctrlLat,ctrlLong)
{ 
	if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById(ctrlMap));		
        var center = new GLatLng(document.getElementById(ctrlLat).value, document.getElementById(ctrlLong).value);
        map.setCenter(center, 2);
        map.setMapType(G_PHYSICAL_MAP);
        map.addMapType(G_PHYSICAL_MAP);
        map.enableScrollWheelZoom();
        map.enableDoubleClickZoom();
        map.addControl(new GMapTypeControl());        
       
        var blueIcon = new GIcon(G_DEFAULT_ICON);
		//blueIcon.image = "../res/_traverseer/gmapflake.png";
		blueIcon.image = resourcePath + "gmapflake.png";
		blueIcon.iconSize = new GSize(40, 45);
                
		// Set up our GMarkerOptions object
		markerOptions = {icon:blueIcon,draggable: true};
     	var marker = new GMarker(center, markerOptions);
       
		GEvent.addListener(marker, "dragstart", function() {
			map.closeInfoWindow();
		});

		GEvent.addListener(marker, "dragend", function() {
			var point = marker.getPoint(); 
			document.getElementById(ctrlLat).value = point.lat();
			document.getElementById(ctrlLong).value = point.lng();	
		});

		map.addOverlay(marker);	
	}	
}

/********************************************/
/*			MEMBERS - WISHLIST				*/
/********************************************/

function addWishList(idMember,textValue,controlDiv)
{	
	var idPlace = document.getElementById(textValue).value;
	if (idPlace.length > 0){
		AjaxMethod.addWishlist(idMember,idPlace);
		document.getElementById(controlDiv).innerHTML = AjaxMethod.getWishlist(idMember,controlDiv).value;
	}
}

function delWishList(idMember,idPlace,controlDiv)
{
	if (idPlace.length > 0){
		AjaxMethod.delWishlist(idMember,idPlace);
		document.getElementById(controlDiv).innerHTML = AjaxMethod.getWishlist(idMember,controlDiv).value;
	}
}


/********************************************/
/*					LODGES					*/
/********************************************/

/*
function gmapLoadLodge()
{ 
	if (GBrowserIsCompatible()) {
		var ctrlLat = document.getElementById(edit_lodge_resort_HiddenLat).value;
		var ctrlLong = document.getElementById(edit_lodge_resort_HiddenLng).value
		var map = mapObj;		
        var center = new GLatLng(ctrlLat, ctrlLong);
        if (ctrlLat != 30)
			map.setCenter(center, 11);
		else
			map.setCenter(center, 2);
        map.addMapType(G_PHYSICAL_MAP);
        map.setMapType(G_PHYSICAL_MAP);
        map.enableDoubleClickZoom();
        map.addControl(new GLargeMapControl());
        map.addControl(new GMapTypeControl());          
     
	}	
}*/

/*
function registerDivGmap(divId,lodgeLat,lodgeLng)
{		
	if (GBrowserIsCompatible()) {
		mapObj = new GMap2(document.getElementById(divId));	
		edit_lodge_resort_HiddenLat = 	lodgeLat;
		edit_lodge_resort_HiddenLng = 	lodgeLng;		
	}
}
*/


/********************************************/
/*			LODGES	- TRANSACTIONS			*/
/********************************************/

function addLodgeTransaction(lodge,transaction,controlDiv)
{
	transaction = document.getElementById(transaction);
	var idTransaction =  transaction.options[transaction.selectedIndex].value;
	if (lodge.length > 0){
		AjaxMethod.addLodgeTransaction(lodge,idTransaction);
		document.getElementById(controlDiv).innerHTML = AjaxMethod.getLodgeTransaction(lodge,controlDiv).value;
	}
}

function delLodgeTransaction(lodge,transaction,controlDiv)
{
	if (lodge.length > 0){
		AjaxMethod.delLodgeTransaction(lodge,transaction);
		document.getElementById(controlDiv).innerHTML = AjaxMethod.getLodgeTransaction(lodge,controlDiv).value;
	}
}


/********************************************/
/*			LODGES	- AVAILABILITIES		*/
/********************************************/

function addLodgeAvailability(lodge,start,end,controlDiv,colocation,exchange,rentals,comments)
{
	var startDate = document.getElementById(start).value;
	var endDate = document.getElementById(end).value;
	var isColocation = document.getElementById(colocation).checked;
	var isExchange = document.getElementById(exchange).checked;
	var isRentals = document.getElementById(rentals).checked;
	var commentaires = document.getElementById(comments).value;	
	var availID = document.getElementById(edit_lodge_avail_ID).value ;
	
	if (lodge.length > 0){
		if (document.getElementById(edit_lodge_avail_ID).value.length == 0)
			AjaxMethod.addLodgeAvailability(lodge,startDate,endDate,isColocation,isExchange,isRentals,commentaires);
		else
			AjaxMethod.editLodgeAvailability(availID,startDate,endDate,isColocation,isExchange,isRentals,commentaires);

		//ON VIDE LE FORMULAIRE
		document.getElementById(controlDiv).innerHTML = AjaxMethod.getLodgeAvailability(lodge,controlDiv).value;
		document.getElementById(start).value = "";
		document.getElementById(end).value = "";
		document.getElementById(colocation).checked = false;
		document.getElementById(exchange).checked = false;
		document.getElementById(rentals).checked = false;
		document.getElementById(comments).value = "";
		
		document.getElementById(edit_lodge_avail_ID).value = "";	
		
				
		//ON CREE LE WIDGET
		AjaxMethod.writeLodgeAvailabilityWidget(lodge);	
	}	
}

function delLodgeAvailability(lodge,availability,controlDiv)
{	
	if (lodge.length > 0){
		AjaxMethod.delLodgeAvailability(lodge,availability);
		document.getElementById(controlDiv).innerHTML = AjaxMethod.getLodgeAvailability(lodge,controlDiv).value;
	}
}

function editLodgeAvailability(id)
{
	objAvail = AjaxMethod.getLodgeAvailabilityById(id).value;
	document.getElementById(edit_lodge_avail_From).value = objAvail.startDate_string;
	document.getElementById(edit_lodge_avail_To).value = objAvail.endDate_string;
	if(objAvail.colocation)
		document.getElementById(edit_lodge_avail_Colocation).checked = true;
	if(objAvail.exchange)
		document.getElementById(edit_lodge_avail_Exchange).checked = true;
	if(objAvail.rentals)
		document.getElementById(edit_lodge_avail_Rentals).checked = true;
	document.getElementById(edit_lodge_avail_Comments).value = objAvail.comments;
	
	//ON INSCRIT AVAILABILITY ID
	document.getElementById(edit_lodge_avail_ID).value = id;

	
}

function registerLodgeAvailabilities(_from,_to,_coloc,_exchange,_rentals,_comment,_hiddenID)
{
	edit_lodge_avail_From			= _from;
	edit_lodge_avail_To				= _to;
	edit_lodge_avail_Colocation		= _coloc;
	edit_lodge_avail_Exchange		= _exchange;
	edit_lodge_avail_Rentals		= _rentals;
	edit_lodge_avail_Comments		= _comment;
	edit_lodge_avail_ID				= _hiddenID;
}



/********************************************/
/*				LODGES	- PLACES			*/
/********************************************/

function registerLodgePlace_AjaxBoxCaption(ajaxBox)
{
	var placeCaption = ajaxBox.replace('txtCaptionId','txtCaption');
	edit_lodge_resort_ajaxboxCaption = placeCaption;
	edit_lodge_resort_ajaxbox = ajaxBox;
}

function registerLodgePlace_Comment(txtComment)
{
	
	edit_lodge_resort_Comment = txtComment;
}

function registerResourcePath(path)
{
	resourcePath = path;
}

function registerApplicationPath(path)
{
	applicationPath = path;
}

function buildLodgePlaces(lodge,controlDiv,comment)
{
	return AjaxMethod.getLodgePlaces(lodge,controlDiv,comment).value;
}


function addLodgePlace(lodge,place,comment,controlDiv)
{
	commentVal = document.getElementById(comment).value;
	placeVal = document.getElementById(place).value
	if (lodge.length > 0){
		//DATABASE
		AjaxMethod.addLodgePlace(lodge,placeVal,commentVal);
		//CONTROL GMAP
		var latlng = AjaxMethod.getLatLng(placeVal).value;
		var lat = latlng.substring(0,latlng.indexOf('|'));
		var lng = latlng.substring(latlng.indexOf('|')+1,latlng.length);
		addPointGmap(lat,lng,commentVal,placeVal);
		
		var placeCaption = place.replace('txtCaptionId','txtCaption');
		document.getElementById(placeCaption).value ="";
		document.getElementById(comment).value = "";
	}
}

function delLodgePlace(lodge,place)
{	
	if (lodge.length > 0){
		AjaxMethod.delLodgePlace(lodge,place);
	}
}


/*
function editLodgePlace(lodge,place,controlDiv,comment)
{
	document.getElementById(edit_lodge_resort_ajaxboxCaption).value = place;
	document.getElementById(edit_lodge_resort_ajaxbox).value = place;
	document.getElementById(comment).value = AjaxMethod.getLodgePlaceComments(lodge,place).value;
	//eval(AjaxMethod.reloadPlacesAdd(lodge).value);
}
*/

function editLodgePlace(newpointID,lodge,place)
{
	document.getElementById(edit_lodge_resort_ajaxboxCaption).value = AjaxMethod.getPlaceName(place).value;
	document.getElementById(edit_lodge_resort_ajaxbox).value = place;
	document.getElementById(edit_lodge_resort_Comment).value = AjaxMethod.getLodgePlaceComments(lodge,place).value;
	editMode = "true";
	editNum = newpointID;
	//eval(AjaxMethod.reloadPlacesAdd(lodge).value);
}


/********************************************/
/*				LODGES	- VOTES				*/
/********************************************/

function voteForLodge(idLodge,idMember,ipAddress,idDiv,nbVote)
{
	var returnValue = AjaxMethod.addLodgeVote(idLodge,idMember,ipAddress).value;
	if(returnValue == "True")
	{
		AjaxMethod.updateLodgeVote(idLodge);
		var toto = parseInt(nbVote) + 1;
		document.getElementById(idDiv).innerHTML = toto;
	}	
}

/********************************************/
/*				LODGES	- ITEMS			*/
/********************************************/

function addLodgeItem(idLodge,idItem,itemsDiv)
{
	AjaxMethod.addLodgeItem(idLodge,idItem);
	document.getElementById(itemsDiv).innerHTML = AjaxMethod.getLodgeItems_EditLodge(idLodge,itemsDiv).value;
	
}
function delLodgeItem(idLodge,idItem,itemsDiv)
{
	AjaxMethod.delLodgeItem(idLodge,idItem);
	document.getElementById(itemsDiv).innerHTML = AjaxMethod.getLodgeItems_EditLodge(idLodge,itemsDiv).value;
}

function createItem_EditLodge(idItem,idMember,idLodge,divSelectedItems,divAllItems)
{
	var itemTxt = document.getElementById(idItem).value;
	itemTxt = AjaxMethod.RemoveDiacritics(itemTxt).value;
	if (itemTxt.length > 0)
	{
		AjaxMethod.createItem_EditLodge(itemTxt,idMember);	
		addLodgeItem(idLodge,itemTxt,divSelectedItems)
		document.getElementById(divAllItems).innerHTML = AjaxMethod.getAllItems_EditLodge(idLodge,divSelectedItems).value;
		document.getElementById(idItem).value = "";
	}

	
}

/********************************************/
/*					MAIL BOX				*/
/********************************************/

var divMailMain;			//DIV MAIN MAIL
var lastViewFolder;			//CONTIENT LE DERNIER FOLDER VISITE
var memberId;			//CONTIENT LE DERNIER FOLDER VISITE
function registerDivMail(controlDiv)
{
	divMailMain = controlDiv;
}

function loadMail(folderId,typeId,member)
{
	memberId = member;
	lastViewFolder = folderId;
	document.getElementById(divMailMain).innerHTML = AjaxMethod.getAllMail(folderId,typeId,member).value;		
}


function loadOneMail(mailID)
{
	document.getElementById(divMailMain).innerHTML = AjaxMethod.getOneMail(mailID,'nolight').value;					
}

function loadOneDiscussion(mailID)
{
	document.getElementById(divMailMain).innerHTML = AjaxMethod.getOneDiscussion(mailID).value;					
}

function deleteOneMail(mailID)
{
	var resultat = confirm('Delete this mail ?'); 
	if(resultat =="1") {	
		AjaxMethod.deleteOneMail(mailID);	
		document.getElementById(divMailMain).innerHTML = AjaxMethod.getAllMail(lastViewFolder,"to",memberId).value;					
	}
}

function markAsUnread(mailID)
{
	AjaxMethod.markAsUnread(mailID);	
	document.getElementById(divMailMain).innerHTML = AjaxMethod.getAllMail(lastViewFolder,"to",memberId).value;					
}



/********************************************/
/*					COMMON					*/
/********************************************/

function showDiv(controlId,controlDiv)
{
	document.getElementById(controlId).style.display = "none";
	document.getElementById(controlDiv).style.display = "inline";
}

function clicclacDiv(controlDiv)
{
	if (document.getElementById(controlDiv).style.display == "inline")
		document.getElementById(controlDiv).style.display = "none";
	else if(document.getElementById(controlDiv).style.display == "none")
		document.getElementById(controlDiv).style.display = "inline";
}

function washAjax(controlID)
{	
	document.getElementById(controlID + '_txtCaption').value ="";
}


function ctrlRequired(controlID)
{
	if (document.getElementById(controlID).value.length == 0)
		return false;
	else 
		return true;
}

function setCurrentLanguage(idL)
{
	//AjaxMethod.setCurrentLanguage(idL);
	var url = AjaxMethod.ResetCurrentLanguage(idL).value;
	window.location.replace(url);
}


/********************************************/
/*			JQUERY - EDIT LODGE				*/
/********************************************/

var imgW;
var imgH;
var control_X ;
var control_Y ;
var control_W ;
var control_H ;
var maxW;
var maxH;

function registerControl_jQueryCrop(x,y,w,h)
{
	control_X	= x;	
	control_Y	= y;	
	control_W	= w;	
	control_H	= h;
}

function loadImgCrop(imgUrl,imgControl,divMessage,tmpMaxW,tmpMaxH)
{
	
	imgUrlValue = document.getElementById(imgUrl).value;
	if (imgUrlValue.length != 0)
	{
		document.getElementById(imgControl).src = imgUrlValue;
		imgW = AjaxMethod.getImageW(imgUrlValue).value;
		imgH = AjaxMethod.getImageH(imgUrlValue).value;		
		
		/*
		if (imgW > 640  || imgH > 480)
		{
			document.getElementById(divMessage).innerHTML = AjaxMethod.renderMessageBox("Votre image est trop large","Warning").value;
			document.getElementById(imgUrl).value ="";
			document.getElementById(imgControl).width = "1";
			document.getElementById(imgControl).height = "1";
		}
		else	
		{
			doImageCropping(imgControl);
			document.getElementById(divMessage).innerHTML = AjaxMethod.renderMessageBox("Vous devez recadrer votre image","Information").value;
		}
		*/
		
		maxW = tmpMaxW;
		maxH = tmpMaxH;
		doImageCropping(imgControl);
		document.getElementById(divMessage).innerHTML = AjaxMethod.renderMessageBox("Vous devez recadrer votre image","Information").value;
		
	}
	
}

function doImageCropping(imgControl)
{	
/*
	var imgW_jQ = 610;
	var imgH_jQ = 250;
	if (imgW > imgW_jQ)
		imgW = 610;
	if (imgH > imgH_jQ)
		imgH = 250;
		*/
		
	if (imgW > maxW)
		imgW = maxW;
	if (imgH > maxH)
		imgH = maxH;
		
	jQuery('#' + imgControl).Jcrop({
			onSelect:	 verifCoords,
			minSize: [imgW,imgH],
			maxSize: [imgW,imgH]
			});    
}

function verifCoords(c)
{
	
	document.getElementById(control_X).value	=	c.x;	
	document.getElementById(control_Y).value	=	c.y;
	document.getElementById(control_W).value	=	c.w;
	document.getElementById(control_H).value	=	c.h;
}

function verifTailleImage(imgUrl,imgControl,divMessage,tmpMaxW,tmpMaxH)
{
	var imageUrlValue = document.getElementById(imgUrl).value;
	if (imageUrlValue.length != 0)
	{
		document.getElementById(imgControl).src = imageUrlValue;
		var W = AjaxMethod.getImageW(imageUrlValue).value;
		var H = AjaxMethod.getImageH(imageUrlValue).value;	
		
		
		if (W > tmpMaxW || H > tmpMaxH)
		{
			document.getElementById(imgControl).src = imgUrlValue;
			document.getElementById(divMessage).innerHTML = AjaxMethod.renderMessageBox("Votre image est trop large (max " + tmpMaxW + "x" + tmpMaxH + " )","Warning").value;
			document.getElementById(imgUrl).value ="";
		}
	}	
}


/********************************************/
/*			ANNOUNCEMENTS					*/
/********************************************/
function addAnnouncementPlace(txtPlace, divPlaces, hiddenPlaces)
{
	var idPlace = document.getElementById(txtPlace).value;
	if (document.getElementById(hiddenPlaces).value.indexOf(idPlace)==-1)
	{
		document.getElementById(hiddenPlaces).value += idPlace + ";";
		document.getElementById(divPlaces).innerHTML +="<a href=\"#\"  onclick=\"removeAnnouncementPlace('" + idPlace + "','" + divPlaces + "','" + hiddenPlaces + "');getAnnouncementPlace('" + divPlaces + "','" + hiddenPlaces + "');return false;\">" + AjaxMethod.getPlaceName(idPlace).value + "</a> - ";
	}
}

function getAnnouncementPlace(divPlaces,hiddenPlaces)
{
	//get all id
	var places = document.getElementById(hiddenPlaces).value;	
	var reg = ";"
	var tab = places.split(reg);
	document.getElementById(divPlaces).innerHTML	=	"";
	for (var i=0; i<tab.length - 1 ; i++) {
	
		document.getElementById(divPlaces).innerHTML +="<a href=\"#\" onclick=\"removeAnnouncementPlace('" + tab[i] + "','" + divPlaces + "','" + hiddenPlaces + "');getAnnouncementPlace('" + divPlaces + "','" + hiddenPlaces + "');return false;\">" + AjaxMethod.getPlaceName(tab[i]).value + "</a> - ";
	}	
}

function removeAnnouncementPlace(idPlace, divPlaces, hiddenPlaces)
{	
	document.getElementById(hiddenPlaces).value = document.getElementById(hiddenPlaces).value.replace(idPlace + ";","");
}
