//menu deroulant
window.onload=function (){
	window['lksNav'] =  document.getElementById('menu').getElementsByTagName('li');
	for(var i in window['lksNav']){
		window['lksNav'][i].onmouseover = function(){
		if(typeof(window['ssNavOn']) != 'undefined') window['ssNavOn'].style.display = 'none';
		var ssNav = this.getElementsByTagName('ul');
		if(typeof(ssNav[0]) != 'undefined'){
			window['ssNavOn'] = ssNav[0];
			window['ssNavOn'].style.display = 'inline';
			this.className = "sel";
			this.onmouseout = function(){
				window['ssNavOn'].style.display = 'none';
				this.className = "";
				}
			}
		}
	}
}

// image aléatoire de la Home
son = new Array();
son[0] = '../images/index/pizza-boy.jpg';
son[1] = '../images/index/pizza-girl.jpg';
son[2] = '../images/index/pizza-beauty.jpg';
var nbre = son.length;
n = Math.floor(Math.random()* +nbre);
//
//ss menus de la nav
window.onload=function (){
window['lksNav'] =  document.getElementById('menu').getElementsByTagName('li');
for(var i in window['lksNav']){
window['lksNav'][i].onmouseover = function(){
if(typeof(window['ssNavOn']) != 'undefined') window['ssNavOn'].style.display = 'none';
var ssNav = this.getElementsByTagName('ul');
if(typeof(ssNav[0]) != 'undefined'){
window['ssNavOn'] = ssNav[0];
window['ssNavOn'].style.display = 'inline';
this.className = "sel";
this.onmouseout = function(){
window['ssNavOn'].style.display = 'none';
this.className = "";
}
}
}
}
}
//

/* textZoom */
var min=13;
var max=40;
function zoomFontSize(cible,selecteur,zoom) {
   var p = document.getElementById(cible).getElementsByTagName(selecteur);
			if (zoom=='+') {
   for(i=0;i<p.length;i++) {
      if(p[i].style.fontSize) {
         var s = parseInt(p[i].style.fontSize.replace("px",""));
      } else {
         var s = 13;
      }
      if(s!=max) {
         s += 1;
      }
      p[i].style.fontSize = s+"px"
   }
}
else if (zoom=='-') {
   for(i=0;i<p.length;i++) {
      if(p[i].style.fontSize) {
         var s = parseInt(p[i].style.fontSize.replace("px",""));
      } else {
         var s = 13;
      }
      if(s!=min) {
         s -= 1;
      }
      p[i].style.fontSize = s+"px"
   } 
	}
}

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

   var url_mobile = mobile_base_url;
   var html_1 = 'Version mobile pour ';
   var html_2 = '<br><a href="'+url_mobile+'">casa-pizza.com/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;
      }
   }
}

