var help_pass = "L\'IMEI est un code unique de 15 chiffres. Vous pouvez l\'obtenir en saisissant le code *#06# sur le clavier de votre téléphone portable. Il est également inscrit sur l\'étiquette se trouvant sous la batterie.";

var help_fav = "Ajouter ce site à vos favoris ?";
var help_reco = "Recommander ce site à un(e) ami(e) ?";
var help_home = "Mettre ce site en page de démarrage ?";

if (document.getElementById)
	{
	if(navigator.appName.substring(0,3) == 'Net')
	document.captureEvents(Event.MOUSEMOVE);
	}

function ShowDescription(txt,width,height)
{
 var c;
 width = width ? "width='"+width+"'" : "";
 height = height ? "height='"+height+"'" : "";
 c = '<table border="0" cellpadding="0" cellspacing="0" bgcolor="#000000" '+width+' '+height+'><tr><td>';
 c+= '<table width="100%" border="0" cellpadding="2" cellspacing="1"><tr><td bgcolor="#56666E">';
 c+= '<span style="color:#FFFFFF;font-size:11px;font-family:Tahoma,Verdana,Arial">';
 c+= '<center>' + txt + '</center></td></tr></table></td></tr></table>';
 if (document.getElementById) {
  document.onmousemove = FollowMouse;
  document.getElementById('FlyingMsg').innerHTML = c;
  document.getElementById('FlyingMsg').style.visibility = 'visible';
 }
}

function FollowMouse(e)
{
 var x = (navigator.appName.substring(0,3) == "Net") ? e.pageX : event.x+document.body.scrollLeft;
 var y = (navigator.appName.substring(0,3) == "Net") ? e.pageY : event.y+document.body.scrollTop;
 document.getElementById('FlyingMsg').style.left = x - 60;
 document.getElementById('FlyingMsg').style.top  = y + 20;
}

function HideDescription() {
 if (document.getElementById) {
  document.onmousemove = null;
  document.getElementById('FlyingMsg').style.visibility = "hidden";
 }
}

function favoris()
{
  var nomSite = "Abar GSM, le spécialiste du déblocage";
  var urlSite = "http://abargsm.free.fr";
  if ( navigator.appName != 'Microsoft Internet Explorer' ){ 
    window.sidebar.addPanel(nomSite,urlSite,''); 
  }else { 
    window.external.AddFavorite(urlSite,nomSite); 
  } 
  return false ;
}

function affichehomepage(obj){
  obj.style.behavior='url(#default#homepage)';
  obj.setHomePage('http://abargsm.free.fr');
}

function noclick()
{
if (event.button==2)
	{
	alert('Abar GSM © 2008');
	}
}
document.onmousedown=noclick

function VerificationFormulaireContact()
{
if (document.contact.objet.value == "Aucun sujet")
	{
    alert("Veuillez choisir l'objet de votre demande !");
    document.contact.objet.focus();
    return false;
	}
if (document.contact.message.value == "")
	{
    alert("Veuillez saisir le message à envoyer !");
    document.contact.message.focus();
    return false;
	}
if (document.contact.nom.value == "")
	{
    alert("Veuillez saisir votre nom !");
    document.contact.nom.focus();
    return false;
	}
if ((VerificationEmail(document.contact.mail) == false) || (document.contact.mail.value == "abargsm@free.fr"))
    {
    alert("Votre adresse email n'est pas valide !");
    document.contact.mail.focus();
    return false;
    }
return true;
}

function VerificationFormulaire()
{
if (document.unlock_form.imei.value == "")
	{
    alert("Veuillez saisir votre IMEI à 15 chiffres !");
    document.unlock_form.imei.focus();
    return false;
	}
if (isNaN(document.unlock_form.imei.value))
	{
    alert("IMEI incorrect ... Veuillez saisir uniquement des chiffres !");
    document.unlock_form.imei.focus();
    return false;
	}
if ( document.unlock_form.imei.value.length < 15)
   	{
	alert("Votre IMEI doit comporter 15 chiffres !");
	document.unlock_form.imei.focus();
	return false;
	}

if (!verif_imei() || document.unlock_form.imei.value == "000000000000000")
	{
	alert("Votre IMEI est invalide, veuillez le vérifier !");
	document.unlock_form.imei.focus();
	return false;
	}

if (VerificationEmail(document.unlock_form.email) == false || (document.unlock_form.email.value == "abargsm@free.fr"))
    {
    alert("Votre adresse email n'est pas valide !");
    document.unlock_form.email.focus();
    return false;
    }

return true;
}

function VerificationEmail(elm)
{
if (elm.value.indexOf("@") != "-1" &&
    elm.value.indexOf(".") != "-1" &&
    elm.value != "")
    return true;

return false;
}

function verif_imei()
{
var i,j;
var pair,impair;
var imeipair = new Array();
var imeiimpair = new Array()
var total=0;
pair=0;
impair=0;
for (j=0; j<document.unlock_form.imei.value.length; j++)
		{
		if ((j%2)==0)
			{
			imeipair[pair]=document.unlock_form.imei.value.charAt(j);
			pair++;
			}
		if ((j%2)==1)
			{
			imeiimpair[impair]=document.unlock_form.imei.value.charAt(j)*2;
			if (imeiimpair[impair]>=10)
				{
				imeiimpair[impair]=1+(imeiimpair[impair]-10)
				}
			impair++;
			}
		}
for (i=0; i<7; i++)
	{
	total=parseInt(total)+parseInt(imeiimpair[i])+parseInt(imeipair[i]);
	}
if(total%10!=0)
	{
	total=(total+(10-(total%10)))-total;
	}
else
     	{
	total=0;
	}
if (document.unlock_form.imei.value.charAt(14)!=total)
	{
	return false;
	}
else return true;
}

function checkCheckBox(form)
{
if (form.cgv.checked == false )
	{
    alert('Vous devez accepter les Conditions Générales de Vente');
	return false;
	}
else
    {
	return true;
    }
return false;
}
