// JavaScript Document
var iFooterClosed = true; 
onresize = function(){CenterWrapper()}


function CenterWrapper() {
	var iHeight = GetHeight();
	var iWidth = GetWidth();
	
	if (isMobille())
	{
		document.getElementById("wrapper").style.left = "0px";
		document.getElementById("wrapper").style.top = "0px";
		document.body.style.backgroundColor = "#FFF";
		document.body.style.backgroundImage = "none"; 
		document.body.style.overflow = "visible";
		document.getElementById("wrapper").style.left = "0px";
		document.getElementById("wrapper").style.top ="0px";
		document.body.style.height = "100%";
		document.body.style.width = "100%";
	}
	else
	{
		document.getElementById("wrapper").style.left = (((GetWidth()-1024)/2)-0)+"px";
		document.getElementById("wrapper").style.top = (((GetHeight()-690)/2)-0)+"px";
		document.body.style.backgroundPosition = (((GetWidth()-1024)/2)-8)+ "px " + (((GetHeight()-690)/2)-8)+"px";
		
		if ((GetWidth() >= 1024) && (GetHeight() >= 690))
		{
			document.body.style.overflow = "hidden";
		}
		else
		{
			document.body.style.overflow = "visible";
		}
		if(GetWidth() < 1024)
		{
			document.getElementById("wrapper").style.left = "0px";
		}
		if(GetHeight() < 690)
		{
			document.getElementById("wrapper").style.top = "0px";
		}
	}
}

function GetHeight()
{
        var y = 0;
        if (self.innerHeight)
        {
                y = self.innerHeight;
        }
        else if (document.documentElement && document.documentElement.clientHeight)
        {
                y = document.documentElement.clientHeight;
        }
        else if (document.body)
        {
                y = document.body.clientHeight;
        }
        return y;
}

function GetWidth()
{
        var x = 0;
        if (self.innerHeight)
        {
                x = self.innerWidth;
        }
        else if (document.documentElement && document.documentElement.clientHeight)
        {
                x = document.documentElement.clientWidth;
        }
        else if (document.body)
        {
                x = document.body.clientWidth;
        }
        return x;
}

function isMobille()
{
	//Initialize our user agent string to lower case.
	var uagent = navigator.userAgent.toLowerCase();
	if ((uagent.search("iphone") > -1) ||
		(uagent.search("ipod") > -1) ||
		(uagent.search("series60") > -1) || 
        (uagent.search("symbian") > -1) || 
		(uagent.search("android") > -1) ||
		(uagent.search("windows ce") > -1) ||
		(uagent.search("blackberry") > -1) ||
		(uagent.search("palm") > -1))
      return true;
   	else
      return false;
}

function Login(formulaire) 
{
	var server = "takdi.com";

	// Do not edit below this point
	var username = formulaire.strName.value;
	username = username.replace(/@/gi, "%40");
	var password = formulaire.strPWD.value;
	//alert(username +'-'+password);
	
	if (username && password && server) 
	{
		
		var ftpsite = "ftp://" + username + ":" + password + "@" + server;
		//alert(ftpsite);
		window.open(ftpsite);
	}
	else 
	{
		alert("Entrez un nom et mot de passe svp!");
	}
	return false;
}

$(window).load(
function()
{
	$('#wrapper').css('background-color','#444444');
}
);

$(document).ready(function(){
				var idelaiPourRapetisse = 750;
				if (isMobille()){idelaiPourRapetisse = 0;}
				CenterWrapper();
				// animattion show footer
				$('#onglet').click(
				function()
				{
					if(iFooterClosed)
					{
						$(".cover", $('.boxgrid'))
						.clearQueue()
						.stop()
						.animate({top:'504px'},{queue:false,duration:560,easing:'easeOutExpo'});
					}
					else
					{
						$(".cover",$('.boxgrid'))
						.animate({top:'682px'},{queue:true,duration:560,easing:'easeInExpo'});
					}
					iFooterClosed = !iFooterClosed;
				});
				
				//changer le curseur de souri
				$('#onglet').hover(function() 
				{
					 $(this).css('cursor','pointer');
			 	}, function() 
				{
			 		$(this).css('cursor','auto');
				});


			});//fin de documer ready
