$(document).ready(function (){
	var flashvars = {};
	if (swfobject.getQueryParamValue("skip")) {
		flashvars.Skip = swfobject.getQueryParamValue("skip");
	}
	var params = {
	  menu: "false",
	  allowfullscreen:"true",
	  wmode:"opaque"
	};
	var attributes = {
	  id: "fl-content",
	  name: "fl-content"
	};
	swfobject.embedSWF("swf/oxbowPhone_2_2.swf", "fl-content", "100%", "100%", "9.0.115.0", "swf/expressInstall.swf", flashvars, params, attributes);
	$("#ref").show();
	
	$("#header #logo").click(function() {
		var link = $(this).attr("rel");
		window.open(link, "_blank");
		return false;
	});
	
	
});

function openHeader(){
	$("#header").animate({top:'0px'},750);
}
function closePopins(){
	$("#popins .background, #popins .content .top .close").unbind('click');
	$("#popins").hide();
	$("#popins").html('&nbsp;');
}
function openLots() {
	$("#popins").html('<div class="background"></div><div class="content"><div class="top"><a href="#close" class="close"></a></div><div class="title"><div class="title_lots"></div></div><div class="cont"><div class="cont_lots"></div></div></div>');

	$("#popins .background, #popins .content").animate({opacity:0},0);
	$("#popins").show();
	$("#popins .content").show();
	
	$("#popins .background").animate({opacity:0.5},250);
	$("#popins .content").animate({opacity:1},750);

	$("#popins .background, #popins .content .top .close").click(function(){
		closePopins();
		return false;
	});
}

function openReglement() {
	$("#popins").html('<div class="background"></div><div class="content"><div class="top"><a href="#close" class="close"></a></div><div class="title"><div class="title_regle"></div></div><div class="cont_regle"></div></div>');
	
	$("#popins .background, #popins .content").animate({opacity:0},0);
	$("#popins").show();
	$("#popins .content").show();
	
	$("#popins .background").animate({opacity:0.5},250);
	$("#popins .content").animate({opacity:1},750);

	$("#popins .background, #popins .content .top .close").click(function(){
		closePopins();
		return false;
	});
	
	getReglement();
}
function getReglement() {
	$.ajax({
	type: "GET",
	url: "includes/reglement.html",
	error:function(msg){
		alert( "Erreur : " + msg );
	},
	success:function(data){
		$("#popins .content .cont_regle").html(data);
		$("#popins .content .cont_regle").jScrollPane();
	}});
}

function closeCustom(){
	$("#popins .background, #popins .custom .top .close").unbind('click');
	$("#popins").hide();
	$("#popins").html('&nbsp;');
}
function openCustom() {
	$("#popins").html('<div class="background"></div><div class="custom"><div class="top"><a href="#close" class="close"></a></div><div class="title"><div class="title_custom"></div></div><div class="cont"><div class="cont_custom"></div></div></div>');
	
	$("#popins .background, #popins .custom").animate({opacity:0},0);
	$("#popins").show();
	$("#popins .custom").show();
	
	$("#popins .background").animate({opacity:0.5},250);
	$("#popins .custom").animate({opacity:1},750);

	$("#popins .background, #popins .custom .top .close").click(function(){
		closeCustom();
		return false;
	});

	getCustom();
}
function getCustom() {
	$.ajax({
	type: "GET",
	url: "includes/custom.html",
	error:function(msg){
		alert( "Erreur : " + msg );
	},
	success:function(data){
		$("#popins .custom .cont .cont_custom").html(data);
	}});
}
/*
360
*/
function closePopin360(){
	$("#popin360 .background, #popin360 .content .top .close").unbind('click');
	$("#popin360").hide();
	$("#popin360").html('&nbsp;');
}
function openPopin360() {
	$("#popin360").html('<div class="background"></div><div class="content"><div class="top"><a href="#close" class="close"></a></div><div class="cont"></div></div>');

	$("#popin360 .background, #popin360 .content").animate({opacity:0},0);
	$("#popin360").show();
	$("#popin360 .content").show();
	
	$("#popin360 .background").animate({opacity:0.5},250);
	$("#popin360 .content").animate({opacity:1},750, function () {$("#popin360 .content .cont").html('<div class="cont_360"><iframe id="frame360" src="includes/popin3D/index.html" width="580" height="580" align="center" marginheight="0" marginwidth="0" frameborder="0" scrolling="no"></iframe></div>');});

	$("#popin360 .background, #popin360 .content .top .close").click(function(){
		closePopin360();
		return false;
	});
}


function openWindow(pageUrl) {
	var winName = Math.round(9999*Math.random()) + new Date().getTime();
	var winNew = window.open(pageUrl,winName);
	winNew.focus();
}
