/*
 * Index page scripts 
 */

/* 
 * Preload onmouseover images
 */
function preload_image(_image) {
	var image = new Image;
	image.src = _image;
}

/* 
 * Change county image onmouseover on index page 
 */
function change_image(region) {
	var ShowItem = document.getElementById("area_image");
	var LinkItem = document.getElementById("county_" + region);
	ShowItem.style.backgroundImage = 'url(img/map_' + region + '.gif)';
	LinkItem.style.textDecoration = "underline";
	return true;
}

/* 
 * Change back county image onmouseout on index page
 */ 
function hide_image(region) {
	var ShowItem = document.getElementById("area_image");
	var LinkItem = document.getElementById("county_" + region);
	ShowItem.style.backgroundImage = 'url(../img/none.gif)';
	LinkItem.style.textDecoration = "none";
	return true;
}

var newWin;
function popUp(page, name, details)
{
	newWin=window.open(page, name, details);
	newWin.focus();    
	return false;  
}    

function add_bookmark()
{
	var ua=navigator.userAgent.toLowerCase();
	var konq=(ua.indexOf('konqueror')!=-1);
	var saf=(ua.indexOf('webkit')!=-1);
	var mac=(ua.indexOf('mac')!=-1);
	var ctrlKey=mac?'Command/Cmd':'CTRL';

	if(window.external && (!document.createTextNode ||(typeof(window.external.AddFavorite)=='unknown'))) {
		window.external.AddFavorite("http://www.leboncoin.fr/","Petites annonces gratuites d'occasion - leboncoin.fr");
	}
	else if(konq) {
		alert('Veuillez appuyer sur CTRL + B pour ajouter ce site à vos favoris.');
	} else if(window.opera) {
		void(0);
	} else if(window.home||saf) {
		alert('Veuillez appuyer sur '+ctrlKey+' + D pour ajouter ce site à vos favoris.');

	} else if(!window.print || mac) {
		alert('Veuillez appuyer sur Command/Cmd + D pour ajouter ce site à vos favoris.');    
	} else {
		alert('Votre navigateur internet n\'étant pas reconnu, vous devrez ajouter ce site manuellement à vos favoris.');
	}
}

