/*

	[ site.js ]

*/

var Site = {

	start: function(){

		/* Detect if IE6 or older to launch PNG transparency support */
		var oldBrowser = (/MSIE ((5\.5)|6)/.test(navigator.userAgent) && navigator.platform == "Win32");

		if (oldBrowser) {
			$.getScript('assets/scripts/png.js', function(){
				$('#logo img').ifixpng();
			});
		}

		/* SlideViewer image slideshow in index.html */
		if ($('#slideshow').length > 0) {
			$.getScript('assets/scripts/easing.js', function(){
				$.getScript('assets/scripts/slideviewer.js', function(){
					$('#slideshow').slideView();
					setTimeout("nextImg()", 5000);
				});
			});
		}

		/* SWF Object handling Flash content in produits.html */
		if ($('#page-produits').length > 0) {

			var flashvars = {};
			var params = {
				quality: 'high',
				scale: 'showall',
				wmode: 'window',
				allowFullScreen: 'true'
			};
			var attributes = {};

			swfobject.embedSWF('container.swf', 'page-body', '100%', '670', '9.0.0', 'assets/flash/expressInstall.swf', flashvars, params, attributes);

		}

		/* If Element HR is found, replace it with a DIV.hr for presentation in all browsers */
	 	$('hr:not(.spacer, .more)').replaceWith('<div class="hr"></div>');

		/* Open external links in new windows */
		$('a[rel="external"]').attr({
			target: "_blank",
			title: "Lien s'ouvrant dans une nouvelle fenêtre"
		});

	}

}

/* ############################################# */

var img = 0;

function nextImg()
{
	var slides = $('#slideshow ul').find("li").size();
	$("div#stripTransmitter0 a:eq("+img+")").click();
	img = (img > slides) ? 0 : img + 1;
	setTimeout("nextImg()", 5000);
}

/* ############################################# */

$(document).ready(function(){
	Site.start();
});

/* Code is poetry */