function no_cache()
{
	date_object = new Date();
	var param = date_object.getTime();

	return param;
}

function AjaxObject()
{
	if(window.XMLHttpRequest)
	{
		xhr_object = new XMLHttpRequest();
		return xhr_object;
	}
	else if(window.ActiveXObject)
	{
		xhr_object = new ActiveXObject('Microsoft.XMLHTTP');
		return xhr_object;
	}
	else
	{ 
		alert('Votre navigateur ne supporte pas les objets XMLHTTPRequest...');
		return;
	}
}

function checkForm()
{
	var reg = new RegExp('^[a-z0-9]+([_|\.|-]{1}[a-z0-9]+)*@[a-z0-9]+([_|\.|-]­{1}[a-z0-9]+)*[\.]{1}[a-z.]{2,6}$', 'i');

	if(document.getElementById('name').value == '')
	{
		alert('Please enter your name !');
		document.getElementById('name').style.backgroundColor = '#5c96d4';
		return false;
	}
	
	if(document.getElementById('company').value == '')
	{
		alert('Please enter your company !');
		document.getElementById('company').style.backgroundColor = '#5c96d4';
		return false;
	}
	
	if(document.getElementById('email').value == '')
	{
		alert('Please enter your email !');
		document.getElementById('email').style.backgroundColor = '#5c96d4';
		return false;
	}
		
	if(reg.test(document.getElementById('email').value) == false)
	{
		alert('Please enter a valid email !');
		document.getElementById('email').style.backgroundColor = '#5c96d4';
		return false;
	}
	
	return true;
}

function checkForm2()
{
	var reg = new RegExp('^[a-z0-9]+([_|\.|-]{1}[a-z0-9]+)*@[a-z0-9]+([_|\.|-]­{1}[a-z0-9]+)*[\.]{1}[a-z.]{2,6}$', 'i');

		
	if(document.getElementById('email').value == '')
	{
		alert('Please enter your email !');
		document.getElementById('email').style.backgroundColor = '#5c96d4';
		return false;
	}
		
	if(reg.test(document.getElementById('email').value) == false)
	{
		alert('Please enter a valid email !');
		document.getElementById('email').style.backgroundColor = '#5c96d4';
		return false;
	}
	
	return true;
}

function checkC()
{
	if(document.getElementById('name').value == '')
	{
		alert('Please enter your name !');
		document.getElementById('name').style.backgroundColor = '#5c96d4';
		return false;
	}
	
	if(document.getElementById('message').value == '')
	{
		alert('Please enter your message !');
		document.getElementById('message').style.backgroundColor = '#5c96d4';
		return false;
	}
	
	document.getElementById('add_comment').submit();
}

function checkFormFile()
{
	if(document.getElementById('cv_file').value == '')
	{
		alert('Please insert your file !');
		document.getElementById('cv_file').style.backgroundColor = '#5c96d4';
		return false;
	}
	
	return true;
}

var autoRotate = true;

function affichePromo(id1,id2,id3)
{
                //document.getElementById('bloc_promo'+id1).style.display = "block";
                //document.getElementById('bloc_promo'+id2).style.display = "none";
                //document.getElementById('bloc_promo'+id3).style.display = "none";
				$("#bloc_promo"+id2).hide();
				$("#bloc_promo"+id3).hide();
				$("#bloc_promo"+id1).fadeIn(1000);


				document.getElementById('cpt').value = id1;
                autoRotate = false;
}


function Timer()
{
                setTimeout("start()",6000);
}

function start()
{
		if(autoRotate)
		{
                if(document.getElementById('cpt').value == 1)
                {
					$("#bloc_promo2").fadeIn(1000);
					$("#bloc_promo3").hide();
					$("#bloc_promo1").hide();
					document.getElementById('cpt').value = 2;
                }
                else if(document.getElementById('cpt').value == 2)
                {
					$("#bloc_promo3").fadeIn(1000);
					$("#bloc_promo2").hide();
					$("#bloc_promo1").hide();
                    document.getElementById('cpt').value = 3;
                }
                else if(document.getElementById('cpt').value == 3)
                {
					$("#bloc_promo1").fadeIn(1000);
					$("#bloc_promo3").hide();
					$("#bloc_promo2").hide();
					document.getElementById('cpt').value = 1;
                }
                Timer();
		}
}
