// image aléatoire de la Home
son = new Array();
son[0] = 'http://www.club-sandwich.net/images/index2/couple-sandwich.jpg';
son[1] = 'http://www.club-sandwich.net/images/index2/big-snack.jpg';
son[2] = 'http://www.club-sandwich.net/images/index2/burger-chic.jpg';
son[3] = 'http://www.club-sandwich.net/images/index2/sandwich-etages.jpg';
var nbre = son.length;
n = Math.floor(Math.random()* +nbre);

// ouverture popup
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


/* textZoom */
var zoomIs = 0;
var maxZoom = 11;
var minZoom = 0;
function initTextZoom()
{
	$('.textZoomIn').click(function(){
		if(zoomIs<=maxZoom-1){	
			zoomIs++;	
			if(zoomIs>0)
			{
				$('.article').removeClass('zoomIs_'+(zoomIs-1));
			}
			$('.article').addClass('zoomIs_'+zoomIs);
		}
		return false;
	});
	
	$('.textZoomOut').click(function(){
		if(zoomIs>minZoom){
			zoomIs--;
			if(zoomIs<maxZoom)
			{
				$('.article').removeClass('zoomIs_'+(zoomIs+1));
			}
			$('.article').addClass('zoomIs_'+zoomIs);
		}
		return false;
	});
	
}

/* détection téléphone mobile */
function detectDevice(user_agent)
{
   if (!mobile_base_url)
   {
      mobile_base_url = 'http://www.club-sandwich.net/mobile'
   }

   var url_mobile = mobile_base_url;
   var html_1 = 'Version mobile pour ';
   var html_2 = '<br><a href="'+url_mobile+'">club-sandwich.net/mobile</a>';

   // Liste des supports mobiles
   var device = new Array(
                  "Android",
                  "Blackberry",
                  "Blazer",
                  "Handspring",
                  "iPhone",
                  "iPod",
                  "Kyocera",
                  "LG",
                  "Motorola",
                  "Nokia",
                  "Palm",
                  "PlayStation Portable",
                  "Samsung",
                  "Smartphone",
                  "SonyEricsson",
                  "Symbian",
                  "WAP",
                  "Windows CE"
                );

   var max_device = device.length;

   for(i=0 ; i<max_device ; i++)
   {
      if(user_agent.indexOf(device[i]) != -1)
      {
         if (device[i] == "iPhone")
         {
            document.getElementById('annonce_site_mobile').innerHTML = html_1 + 'l\'Iphone' + html_2;
            document.getElementById('annonce_site_mobile').style.display = 'block';
         }
         else if (device[i] == "iPod")
         {
            document.getElementById('annonce_site_mobile').innerHTML = html_1 + 'l\'iPod Touch' + html_2;
            document.getElementById('annonce_site_mobile').style.display = 'block';
         }
         else if (device[i] == "Android")
         {
            document.getElementById('annonce_site_mobile').innerHTML = html_1 + 'Android' + html_2;
            document.getElementById('annonce_site_mobile').style.display = 'block';
         }
         else
         {
            document.location = url_mobile;
         }
         return;
      }
   }
}

