/**
 * 
 * Cas d'utilisation:
 *   - salc_tech.html?nose=ABCDEF123456H70
 *   	[sousVersion=][antiArch=][arch=][lang=][autres=]
 *   - salc_tech.html?Probleme=NoDeSeriePerdu (boutique.php)
 *   - Consulter la fonction Initialisation_Automatique()
 * 
 */

var OS = '';
var OSVersion = '';
var texteur = '';
var texteurVersion = '';
var editionAntidote = '';

var leBoutonQuestionRepondueNonRedigerAEteCliquay = false;
new Event.observe(window, 'load', impl_onLoad);

function cacherElement(element)
{
	// On s'assure de rendre l'élément visible préalablement car sinon IE6 ne cache pas le contenu des
	// TR comme il faut (salc_tech.html)
	element.style.display = '';
	element.style.display = 'none';
}

function montrerElement(element)
{
	element.show();
}

// Gestionnaires d'ŽvŽnements
function OnChange(objet)
{
	switch($F('Probleme'))
	{
		case 'Compatibilite':
			window.location.href = 'a_spec.html';
			return;
		case 'OuAcheter':
			window.location.href = 'achat.html';
			return;
		case 'Autres':
			montrerElement($('confirmationBonEndroit'));
			$('confirmerNote').checked = false;
			$('soumettre').disabled = true;
			break;
		default:
			cacherElement($('confirmationBonEndroit'));
			$('soumettre').disabled = false;
	}
	AideDynamique($F('Probleme'), '', '', '', '', '');
}

function impl_onLoad(event)
{
	AideDynamique($F('Probleme'), '', '', '', '', '');
}

function CacherIncomplet()
{
	$('prenom').style.background = 'white';
	$('nom').style.background = 'white';
	$('email').style.background = 'white';
	$('Probleme').style.background = 'white';
}

///////////////////
function Soumettre()
{
	CacherIncomplet();
	var complet = true;

	if($F('prenom').length < 1)
	{
		complet = false;
		$('prenom').style.background = 'yellow';
	}
	if($F('nom').length < 1)
	{
		complet = false;
		$('nom').style.background = 'yellow';
	}

	if($F('email').length < 4)
	{
		complet = false;
		$('email').style.background = 'yellow';
	}

	if($F('Probleme') == "")
	{
		complet = false;
		$('Probleme').style.background = 'yellow';
	}

	if(complet)
	{
		var _Edition = '';
		var _Probleme = $F('Probleme');
		var _SystemeExploitation = '';
		var _SystemeExploitationVersion = '';
		var _Texteur = '';
		var _TexteurVersion = '';

		new Ajax.Request("salc/scripts/statistiques.php", {
			method: 'post',
			asynchronous: false,
			parameters: {
										Edition: _Edition,
										Probleme: _Probleme,
										SystemeExploitation: _SystemeExploitation,
										SystemeExploitationVersion: _SystemeExploitationVersion,
										Texteur: _Texteur,
										TexteurVersion: _TexteurVersion,
										Action: 'SoumettreQuestion'
									}
			});

		document.formulaire.submit();
	}
	else
	{
		alert("Vous n'avez pas complété tous les champs requis.");
	}
}

