/* Javascript file */ var slideshow = 0; var slideshowIndex = 1; var slideshowInterval = 5000; var allNewsHeader = new Array(6); var allNewsDate = new Array(6); var allNewsText = new Array(6); allNewsHeader[0] = 'Något fel!'; allNewsDate[0] = '2010-08-31'; allNewsText[0] = 'Några har inte fått sin inbjudan...'; allNewsHeader[1] = 'GRATTIS!'; allNewsDate[1] = '2010-08-31'; allNewsText[1] = 'Wilmer och Ludde fyller 2 år idag!'; allNewsHeader[2] = 'GRATTIS ARION'; allNewsDate[2] = '2010-08-29'; allNewsText[2] = '1:a Hp junkl 3:e bästa blenheimhane'; allNewsHeader[3] = 'SKÖNT!!!'; allNewsDate[3] = '2010-08-25'; allNewsText[3] = 'Alice patella och ögon ua!'; allNewsHeader[4] = 'KENNELTRÄFF'; allNewsDate[4] = '2010-08-11'; allNewsText[4] = 'Den 5 september kl 12.00 på Laxå BK'; allNewsHeader[5] = 'Nya bilder!'; allNewsDate[5] = '2010-07-26'; allNewsText[5] = 'Galleriet fylls på vartefter bilder kommer....'; /** * Returns a browser compatible reference to the parameter object */ function DHTMLObj(object) { if (document.all) { return document.all[object]; } else if (document.getElementById) { return document.getElementById(object); } else if (document.layers) { document[object].open(); return document[object]; } } /** * Add this site to the browser's Favorite list */ function addToFavorites() { var url = "http://www.tillpix.se"; var name = "Kennel Tillpix - Cavalierer "; if (window.external) { window.external.AddFavorite(url,name) } else if (navigator.appName == "Netscape") { window.sidebar.addPanel(name,url,""); } else { alert("Tryck CTRL+D (Netscape) eller CTRL+T (Opera) för att spara sidan som ett bokmärke"); } } /** * Open a new window without the navigation panel * @param string path is the path to the page to open * @param int w is the width of the opened window * @param int h is the height of the opened window */ function newWin(path,w,h) { var centerScreen = Math.floor((screen.width / 2) - (w/2)); var properties="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,"; properties += "width=" + w + ",height=" + h + ",top=30,left=" +centerScreen; unique = new Date(); unique = unique.getSeconds()+"_"+unique.getMinutes()+"_"+unique.getHours(); window.open(path, unique, properties); } /** * Set this site as the startpage */ function setAsStartpage(link) { if (document.all) { link.style.behavior = "url(#default#homepage)"; link.setHomePage("http://www.tillpix.se"); } else { alert("Det går inte att automatiskt spara sidan som din startsida med den webbläsare som du använder. Öppna inställningarna för webbläsaren för att manuellt lägga in Tillpix.se som din startsida."); } } /* * Start news slideshow */ function startSlideshow () { if (slideshow == 0) { slideshow = setTimeout('updateSlideshow ()', slideshowInterval); } } /* * Stop news slideshow */ function stopSlideshow () { if (slideshow) { clearTimeout(slideshow); slideshow = 0; } } /** * Switch the css dislay property for a given object [block -> none, none -> block] * @param string objName is the DHTML id of the object to switch display for */ function switchDisplay(objName) { var obj = DHTMLObj(objName); if (obj.style.display != 'block') { obj.style.display = 'block'; } else { obj.style.display = 'none'; } } /* * Update news slideshow */ function updateSlideshow () { slideshowIndex ++; if (slideshowIndex >= allNewsHeader.length) { slideshowIndex = 0; } DHTMLObj("newsTitle").innerHTML = allNewsHeader[slideshowIndex]; DHTMLObj("newsDate").innerHTML = allNewsDate[slideshowIndex]; DHTMLObj("newsText").innerHTML = allNewsText[slideshowIndex]; slideshow = setTimeout('updateSlideshow()', slideshowInterval); }