var varia = ""
IE = $.browser.msie
FF = $.browser.mozilla
w = $(window)
var current_size = 0
function spacer_ajuste(){
	if(current_size != w.height()){
		current_size = w.height()
	$c = $("body").children(":visible").not("#spacer")
	$spacer = $("#spacer")
	var tot_height = 0
	for(var i=0 ; i < $c.length ; i++ ){
		tot_height += $c.eq(i).height()
	}
	var sub  =w.height()-tot_height
	if(sub <= 0 ){
		sub=0
	}
	$spacer.css({height:sub+"px"})
	}
}


$(document).ready(function(){
$("a.close_video").click(function(){
	$.simpleDialog.close()
	$(this).hide()
	
})
	
var random =""	
if(IE){
	var t = new Date()
	random = "?t="+Math.random(t.getTime())
}

var flashvars = {};
var params = {
	wmode: "transparent",
	menu: "false",
	scale: "noScale",
	allowscriptaccess: "always"
	};
swfobject.embedSWF("/commun/home/home.swf"+random, "homeFlash", "100%", "600", "10.0.0", "/js/swfobject/expressInstall.swf", flashvars, params);



var  timer=setInterval("spacer_ajuste()", 300);


$("#footer li > a.interne").click(function(){
	varia = $(this).children("code").html()
	
	}).simpleDialog( { showCloseLabel:false,open:function(){ setVideo() },close: function () { $("a.close_video").hide()} } );


})
function setVideo(){
	var value = varia
	if(!IE){
	var h = 180
	var w = 320
	}else{
		var h = 5
		var w = 5
	}
	var flashvars = {flv:value};
	var params = {wmode:"transparent"};
	xt_click(this,'C','','HOME_video:'+value,'A')
	swfobject.embedSWF("/commun/FLVplayer/FLVplayer.swf", "v", w, h, "10.0.0", "/js/swfobject/expressInstall.swf", flashvars, params);
	$("#v").parent().height(h).width(w)
	
	
}
function setVideoSize(h,w){
	$e = $("#v").parent().parent().parent()
	
	$eH = $e.height()
	$eW = $e.width()
	$eTop = $e.offset().top
	$eLeft = $e.offset().left
	
	
	
	
	/*if(!FF){
		h+=50
		w+=70
	}*/	
	
		$e.width(w).height(h).css("top",($eTop-(h-$eH)/2)+"px").css("left",($eLeft-(w-$eW)/2)+"px")
		$("#v").height(h).width(w)
		.parent().height(h).width(w)
		.parent().height(h).width(w)
	
	$("a.close_video").css({
		top:($e.offset().top+6)+"px",
		left:($e.offset().left+w-14)+"px"
	}).show()
	
	}
	
	
	
	/*********************************************************************
	*			:: VDETECTION DE LA PRESENCE DE FLASH ::
	*********************************************************************/
	//http://www.featureblend.com/license.txt
	var FlashDetect=new function(){var self=this;self.installed=false;self.raw="";self.major=-1;self.minor=-1;self.revision=-1;self.revisionStr="";var activeXDetectRules=[{"name":"ShockwaveFlash.ShockwaveFlash.7","version":function(obj){return getActiveXVersion(obj);}},{"name":"ShockwaveFlash.ShockwaveFlash.6","version":function(obj){var version="6,0,21";try{obj.AllowScriptAccess="always";version=getActiveXVersion(obj);}catch(err){}
	return version;}},{"name":"ShockwaveFlash.ShockwaveFlash","version":function(obj){return getActiveXVersion(obj);}}];var getActiveXVersion=function(activeXObj){var version=-1;try{version=activeXObj.GetVariable("$version");}catch(err){}
	return version;};var getActiveXObject=function(name){var obj=-1;try{obj=new ActiveXObject(name);}catch(err){obj={activeXError:true};}
	return obj;};var parseActiveXVersion=function(str){var versionArray=str.split(",");return{"raw":str,"major":parseInt(versionArray[0].split(" ")[1],10),"minor":parseInt(versionArray[1],10),"revision":parseInt(versionArray[2],10),"revisionStr":versionArray[2]};};var parseStandardVersion=function(str){var descParts=str.split(/ +/);var majorMinor=descParts[2].split(/\./);var revisionStr=descParts[3];return{"raw":str,"major":parseInt(majorMinor[0],10),"minor":parseInt(majorMinor[1],10),"revisionStr":revisionStr,"revision":parseRevisionStrToInt(revisionStr)};};var parseRevisionStrToInt=function(str){return parseInt(str.replace(/[a-zA-Z]/g,""),10)||self.revision;};self.majorAtLeast=function(version){return self.major>=version;};self.minorAtLeast=function(version){return self.minor>=version;};self.revisionAtLeast=function(version){return self.revision>=version;};self.versionAtLeast=function(major){var properties=[self.major,self.minor,self.revision];var len=Math.min(properties.length,arguments.length);for(i=0;i<len;i++){if(properties[i]>=arguments[i]){if(i+1<len&&properties[i]==arguments[i]){continue;}else{return true;}}else{return false;}}};self.FlashDetect=function(){if(navigator.plugins&&navigator.plugins.length>0){var type='application/x-shockwave-flash';var mimeTypes=navigator.mimeTypes;if(mimeTypes&&mimeTypes[type]&&mimeTypes[type].enabledPlugin&&mimeTypes[type].enabledPlugin.description){var version=mimeTypes[type].enabledPlugin.description;var versionObj=parseStandardVersion(version);self.raw=versionObj.raw;self.major=versionObj.major;self.minor=versionObj.minor;self.revisionStr=versionObj.revisionStr;self.revision=versionObj.revision;self.installed=true;}}else if(navigator.appVersion.indexOf("Mac")==-1&&window.execScript){var version=-1;for(var i=0;i<activeXDetectRules.length&&version==-1;i++){var obj=getActiveXObject(activeXDetectRules[i].name);if(!obj.activeXError){self.installed=true;version=activeXDetectRules[i].version(obj);if(version!=-1){var versionObj=parseActiveXVersion(version);self.raw=versionObj.raw;self.major=versionObj.major;self.minor=versionObj.minor;self.revision=versionObj.revision;self.revisionStr=versionObj.revisionStr;}}}}}();};FlashDetect.JS_RELEASE="1.0.4";
/*******************************************************************
*
*	:: JAVASCRIPT HOME V2 ::
*
*
*******************************************************************/	
$(document).ready(function()
{
	if(FlashDetect.major < 10)
	{
		$("#popin_flash").modal()
	}
	
	// chargment du swf //
	var flashvars = {};
	var params = {
	wmode: "transparent",
	menu: "false",
	scale: "noScale",
	allowscriptaccess: "always"
};
	var attributes = {};

 	swfobject.embedSWF("/commun/video_home/M1.swf", "swf", "882", "276", "9.0.0", "expressInstall.swf", flashvars, params, attributes);
	
	// intégration de la type //
	Cufon.replace("h2")
	Cufon.replace("h1")
	$("#home>a.bloc_flash").click(function(){return false})
	// animations //
	$("#home>a").hover(function()
	{
		$(this).stop()
		$(this).children().css("background-position", "0 0")
		$(this).children().children(".info").animate(
			{
				marginTop : 0
			}, 500, "easeOutBack")
	}, function()
	{
		$(this).stop()
		$(this).children().css("background-position", "0 -177px")
		$(this).children().children(".info").animate(
			{
				marginTop : 85
			}, 500, "easeOutBack")
	})
	

})

function lancementPage()
{
	$(document).ready(function()
	{
		window.location.href = "/solutions-domotique-personnalisee/";
	})
}
function lancementMesProjets()
{
	$(document).ready(function()
	{
		if( $('#compte').text() == "Mon Compte" )
			{ alert_modal('connexion_popin'); }
		else
			{ window.location.href = "/solutions-domotique-personnalisee/mon-compte/"; }
	})
}	
	
function Alert(txt)
{
$(document).ready(function(){
	$("body").prepend(txt)
})
}	
	
	
	
	
	
	
	
	
	
	
	
	
	
