
var maxw = 1020;
var maxh = 1380;
var minw = 1000;
var minh = 870;

var pages = new Array();
pages[0] = ["team.aspx", 600];
pages[1] = ["realisations.aspx", 930];
pages[2] = ["fan.aspx", 650];
pages[3] = ["afficheform.aspx", 750];
pages[4] = ["calendar.aspx", 600];
pages[5] = ["fanthnx.html", 200];
var pageids = ["team", "realisations", "fan", "affiche", "calender"];


var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{
			string: navigator.userAgent,
			subString: "Chrome",
			identity: "Chrome"
		},
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari",
			versionSearch: "Version"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			   string: navigator.userAgent,
			   subString: "iPhone",
			   identity: "iPhone/iPod"
	    },
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};
BrowserDetect.init();


var pageId = 0;
function closePage() {

    closeIframe(true);
}
function showPage(iPageId) {

    pageId = parseInt(iPageId);

    ///alert("iframe ok"
    if (pageId < 5) top.frames[0].setSource(pages[pageId][0], pageId, pages[pageId][1]);
    else onSourceComplete();
}
function showMenu() {
    var obj = swfobject.getObjectById("flashcontent");

    obj.gotoHome();
}
function onSourceComplete() {
		top.frames[0][0].setNavitem(pageId);
    openIframe(pages[pageId][1]);
}

function showNextPage() {

}

//window
var viewportwidth;
var viewportheight;

function resizewindow() {



    // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight

    if (typeof window.innerWidth != 'undefined') {
        viewportwidth = window.innerWidth,
      viewportheight = window.innerHeight
    }

    // IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)

    else if (typeof document.documentElement != 'undefined'
     && typeof document.documentElement.clientWidth !=
     'undefined' && document.documentElement.clientWidth != 0) {
        viewportwidth = document.documentElement.clientWidth,
       viewportheight = document.documentElement.clientHeight
    }

    // older versions of IE

    else {
        viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
       viewportheight = document.getElementsByTagName('body')[0].clientHeight
    }
    var flashcontentr = document.getElementById("flashcontent");
    var browserCheck = (document.all) ? 1 : 0; // ternary operator statements to check if IE. set 1 if is, set 0 if not.

		if( browserCheck == 0 )  // if MSIE is set greater than 0 (e.g. 1)
		{
		       if(BrowserDetect.OS =="Mac")
		       			 flashcontentr = document.getElementById("flashcontent");
		       	else flashcontentr=document.body;
		}
    
    if (viewportwidth < minw) {
        viewportwidth = minw;
        flashcontentr.style.overflowX = "auto";
    }
    else flashcontentr.style.overflowX = "hidden";
    if (viewportheight < minh) {
        viewportheight = minh;
        flashcontentr.style.overflowY = "auto";
    }
    else flashcontentr.style.overflowY = "hidden";
    var tmpwidth = viewportwidth;
    var tmpheight = viewportheight;
    if (viewportwidth > maxw) tmpwidth = maxw;
    if (viewportheight > maxh) tmpheight = maxh;

    setFlashContent(tmpwidth, tmpheight);
    try {
        setTimeout("initFlashDimensions()", 100);
    } catch (e) { }


}

function setFlashContent(viewwidth, viewheight) {

    var flashcontent = document.getElementById("flashcontent");
    flashcontent.style.width = viewwidth + "px";
    var leftpx = ((viewportwidth - viewwidth) / 2);
    if (leftpx < 0) leftpx = 0;
    flashcontent.style.left = leftpx + "px";

    var toppx = ((viewportheight - viewheight) / 2);
    if (toppx < 0) toppx = 0;
    flashcontent.style.top = toppx + "px";
    flashcontent.style.height = viewheight + "px";

    document.getElementById("pageframe").style.left = (leftpx + 14) + "px";
    document.getElementById("pageframe").style.top = (toppx + 147) + "px";

}
function initFlashDimensions() {


    try {
        var obj = swfobject.getObjectById("flashcontent");
        obj.setDimensions(viewportwidth, viewportheight);
    }
    catch (e) { setTimeout("initFlashDimensions()", 100); }

}

function setCurrentDimensions(swidth, sheight) {
    setFlashContent(swidth, sheight);
    document.getElementById("flashcontent").style.visibility = "visible";
}