/*!
* Fonctions JS utilise pour le site Mon-SysAdmin.com
*/


	/** Test Mobile **/
	if (window.innerWidth <= 480 ) 
		location.href='http://m.mon-sysadmin.com';


/**
* affichage validite email
*/

	function display_email(email,lg)
	{
		var txt = '';
		
		if (lg == "en")
		{
			txt = "<span style=\"color:#1A7917\">This email is correct<\/span>";
			txt2 = "<span style=\"color:#cc0000\">Email not correct!<\/span>";
		}
		else
		{
			txt = "<span style=\"color:#1A7917\">Cet email est correct<\/span>";
			txt2 = "<span style=\"color:#cc0000\">Cet email est invalide!<\/span>";
		}

		if (verifEmail(email))
		{
			if(texte = file('./inc/verifEmail.php?email='+escape(email)))
			{
				if(texte == 2 || texte == 1)
					writediv(txt,"pseudobox");
				else
					writediv(texte,"pseudobox");
			}
		}
		else
			writediv(txt2,"pseudobox");
	}


/**
* permet de passer des variables creees lors d'un formulaire js et donc pas connu par php ( car js apres le php ) en GET
* et donc recuperable via GET en php
*/

	function transfertGet(serveur, prestation)
	{
		window.location='register.php?id_serveur='+serveur+'&prestation='+prestation+'';
	}


/**
* Affiche liste prestations en fonction du serveur choisi
*/

	function writeListPres(id_serveur,lg)
	{
		if (id_serveur == "")
		{
			writediv("","fastPres");
// 			hide("envoyerOk");
		}
		else
		{
			var txt = '';

			if (lg == "en")
			{
				txt = "<h4>Your server</h4> <span style=\"color:#cc0000\">There is no server for this hoster!<\/span>";
				txt2 = "<h4>Mon-SysAdmin outsorcing</h4>";
				txt3 = "<h4>Votre serveur</h4> <span style=\"color:#cc0000\">There is a mistake in the fast order!<\/span>";
			}
			else
			{
				txt = "<h4>Votre serveur</h4> <span style=\"color:#cc0000\">Il y a aucune prestation pour ce serveur!<\/span>";
				txt2 = '<h4>Infog&eacute;rance Mon-SysAdmin</h4>  <img src="./inc/img/favicon.png" alt="" />';
				txt3 = "<h4>Votre serveur</h4> <span style=\"color:#cc0000\">Il y a une erreur dans la commande rapide!<\/span>";
			}

			if(texte = file('./inc/showListPres.php?id_serv='+id_serveur))
			{
				if(texte == 0)
					writediv(txt,"fastPres");
				else
				{
					writediv(texte,"fastPres");
					writediv(txt2,"fastInf");
				}
			}	
			else
				writediv(txt3,"fastPres");
		}
	}


/**
* affichage validite code postal + ville
*/

	function display_cpVille(value,lg)
	{
		var txt = '';

		if (lg == "en")
		{
			txt = "<span style=\"color:#1A7917\">ZIP Code correct<\/span>";
			txt2 = "<span style=\"color:#cc0000\">ZIP Code not correct<\/span>";
		}
		else
		{
			txt = "<span style=\"color:#1A7917\">Code postal correct<\/span>";
			txt2 = "<span style=\"color:#cc0000\">Code postal incorrect<\/span>";
		}


		if (cpVille(value))
		{
			writediv(txt,"Rcp");
				texte = file('./inc/Cp-Ville.php?cp='+value);
			writediv(texte,"Rville");
		}
		else
		{
			writediv(txt2,"Rcp");
			writediv('<input type="text" name="ville" id="ville" value="" readonly="readonly"\/>',"Rville");
		}
	}

/**
* Si on ne choisit rien dans les prestations, on enleve le bouton commander
*/
	function verifOk(id,value)
	{
		if(value == "")
			hide(id);
		else
			show(id);
	}



