function cacher_div(div){ var myDiv = document.getElementById(div); myDiv.style.visibility = 'hidden'; } function voir_div(div){ var myDiv = document.getElementById(div); myDiv.style.visibility = 'visible'; } function changeBG(category, titleColor){ if(!titleColor){ var titleColor = 'white'; } var bgImg = document.getElementById("background_img"); var titleCostes = document.getElementById("titleRef"); var subMenu = document.getElementById("submenu"); var clickImg = document.getElementById("click_img"); var leftSubMenu = parseInt(subMenu.style.width.replace('em','')) - 1; titleCostes.style.color = titleColor; if(!bgImg.src.match("images/"+category+".jpg")){ $('#submenu').animate({left:'-'+leftSubMenu + 'em'}, 1000, function() { $('#ulmenu').animate({opacity:0}, 1, function() { }); }); clickImg.src = "images/fleche_gauche.png"; bgImg.src = "images/"+category+".jpg"; } } function clickLink(buttonId){ var button = document.getElementById(buttonId) document.location = $(button).attr( 'href' ); } function createSource(srcValue, typeValue) { var newSource = document.createElement('source'); newSource.src = srcValue; newSource.type = typeValue; return newSource; } document.getElementsByClassName = function(cl) { var retnode = []; var myclass = new RegExp('\\b'+cl+'\\b'); var elem = this.getElementsByTagName('*'); for (var i = 0; i < elem.length; i++) { var classes = elem[i].className; if (myclass.test(classes)) retnode.push(elem[i]); } return retnode; }; function set_fullscreen(srcfile){ var fscr = document.getElementById('fullscreen'); fscr.style.visibility = 'visible'; //putoffalldiv(); var vid = fscr.getElementsByTagName('video')[0]; while (vid.hasChildNodes()) { vid.removeChild(vid.firstChild); } vid.insertBefore(createSource("videos/grand/" + srcfile + ".ogv", 'video/ogg'), vid.firstChild); vid.insertBefore(createSource("videos/grand/" + srcfile + ".mp4", 'video/mp4;'), vid.firstChild.nextSibling); vid.load(); vid.play(); var matr = document.getElementById('hotelcostes_background'); matr.style.visibility = 'hidden'; var clickCount = new Image(); clickCount.src = "videos_stats.php?video="+srcfile; } function reduce(){ if(!!document.createElement('video').canPlayType){ var fscr = document.getElementById('fullscreen'); fscr.style.visibility = 'hidden'; var vid = fscr.getElementsByTagName('video')[0]; vid.pause(); vid.removeChild(vid.firstChild); var matr = document.getElementById('hotelcostes_background'); matr.style.visibility = 'visible'; //putonalldiv(); } } function getBandWidth(){ var myBandWidth = gcookie('HotelCostesBandwidth'); if(myBandWidth == ''){ var imageAddr = "http://www.hotelcostes.com/images/videos/video_HD_1.jpg" + "?n=" + Math.random(); var download = new Image(); download.onload = function() { endTime = (new Date()).getTime() ; showResults(); } startTime = (new Date()).getTime() ; download.src = imageAddr; } } function showResults() { var duration = Math.round((endTime - startTime) / 1000) ; var bitsLoaded = downloadSize * 8 ; var speedMbps = (Math.round(bitsLoaded / duration)/1024 / 1024).toFixed(2) ; var res = scookie('HotelCostesBandwidth',speedMbps, 2); //alert ("Your connection speed is: \n" + // speedMbps + " Mbps\n") ; } function scookie(name,value,days){ var expire=new Date(); expire.setDate(expire.getDate()+days); document.cookie=name+'='+escape(value)+';expires='+expire.toGMTString(); return true; } function gcookie(name){ if(document.cookie.length>0){ var start=document.cookie.indexOf(name+"="); var pos = start+name.length+1; if(start!=0){ start=document.cookie.indexOf("; "+name+"="); pos = start+name.length+3; } if(start!=-1){ start=pos; var end=document.cookie.indexOf(";",start); if(end==-1){ end=document.cookie.length; } return unescape(document.cookie.substring(start,end)); } } return ''; }