/*************************************************
	Questionnaire de satisfation client
	Créé par damien @ oceanet
	09:24 10/06/2008
**************************************************/

function afficheQuestionnaireClient(){

	//agrandissement du cadre de message service
	document.getElementById('containerService').style.height = "384px";

	document.getElementById('str-msg-service').style.height = "340px";
	document.getElementById('str-msg-service').style.width = "384px";
	document.getElementById('str-msg-service').style.margin = "0";
	document.getElementById('str-msg-service').style.padding = "10px";

	initMsg(0);
	
	//titre du popup
	document.getElementById('titre-msg-service').innerHTML = "Questionnaire client";

	//contenu du popup
	var form = document.createElement('form');
	form.setAttribute('action', '');
	form.setAttribute('method', 'post');
	form.setAttribute('id', 'formQuestClient');
	
	
	var Q1 = document.createElement('p');
	Q1.appendChild(document.createTextNode('Comment nous avez-vous connu ?'));
	
	var R1select = document.createElement('select');
	R1select.style.width = '384px';
	R1select.setAttribute('name', 'connaissance');
	
	R1select.appendChild(createOption('Bouche à oreille (amis, relation)', 'Bouche à oreille (amis, relation)'));
	R1select.appendChild(createOption('Recommandation (fournisseur)', 'Recommandation (fournisseur)'));
	R1select.appendChild(createOption('Annuaire (pages jaunes)', 'Annuaire (pages jaunes)'));
	R1select.appendChild(createOption('Internet (moteur de recherche)', 'Internet (moteur de recherche)'));
	R1select.appendChild(createOption('Internet (comparateur de prix)', 'Internet (comparateur de prix)'));
	R1select.appendChild(createOption('Promotions/Publicité', 'Promotions/Publicité'));
	R1select.appendChild(createOption('Autres', 'Autres'));
	
	form.appendChild(Q1);
	form.appendChild(R1select);
	
	

	
	var Q2 = document.createElement('p');
	Q2.style.paddingTop = "15px";
	Q2.appendChild(document.createTextNode('Merci de préciser votre réponse:'));
	
	var R2 = document.createElement('textarea');
	R2.style.width = '380px';
	R2.style.height = '75px';
	R2.style.padding = '0';
	R2.style.margin = '0';
	R2.setAttribute('name', 'connaissance_precision');
	
	form.appendChild(Q2);
	form.appendChild(R2);
	
	
	
	var Q3 = document.createElement('p');
	Q3.style.paddingTop = "15px";
	Q3.appendChild(document.createTextNode('Notre site a-t-il répondu à votre besoin ?'));
	
	var R3a = (document.all) ? document.createElement("<input type='radio' NAME='besoin' value='oui'/>") : document.createElement('input');
	R3a.setAttribute('type', 'radio');
	R3a.setAttribute('name', 'besoin');
	R3a.setAttribute('value', 'oui');
	R3a.setAttribute('id', 'besoin_oui');
	R3a.checked = true; 
	R3a.onclick = 	function(){
						document.getElementById('pourquoi_Q').style.display = 'none';
						document.getElementById('pourquoi_R').style.display = 'none';
						document.getElementById('containerService').style.top = "200px";
						document.getElementById('containerService').style.height = "384px";
						document.getElementById('str-msg-service').style.height = "340px";
					};
	
	var R3b = document.createElement('label');
	R3b.setAttribute('for', 'besoin_oui');
	R3b.style.padding = '0px 10px 0px 2px';
	R3b.appendChild(document.createTextNode('Oui'));
	

	var R3c = (document.all) ? document.createElement("<input type='radio' NAME='besoin' value='non'/>") : document.createElement('input');
	R3c.setAttribute('type', 'radio');
	R3c.setAttribute('name', 'besoin');
	R3c.setAttribute('value', 'non');
	R3c.value = 'non';
	R3c.setAttribute('id', 'besoin_non');
	R3c.onclick = 	function(){
						document.getElementById('pourquoi_Q').style.display = 'block';
						document.getElementById('pourquoi_R').style.display = 'block';
						document.getElementById('pourquoi_R').focus();
						document.getElementById('containerService').style.top = "150px";
						document.getElementById('containerService').style.height = "474px";
						document.getElementById('str-msg-service').style.height = "430px";
					};
	
	var R3d = document.createElement('label');
	R3d.setAttribute('for', 'besoin_non');
	R3d.style.padding = '0px 10px 0px 2px';
	R3d.appendChild(document.createTextNode('Non'));
	
	form.appendChild(Q3);
	form.appendChild(R3a);
	form.appendChild(R3b);
	form.appendChild(R3c);
	form.appendChild(R3d);
	
	
	
	var Q3bis = document.createElement('p');
	Q3bis.style.paddingTop = "15px";
	Q3bis.style.display = 'none';
	Q3bis.setAttribute('id', 'pourquoi_Q');
	Q3bis.appendChild(document.createTextNode('Pourquoi ?'));
	
	var R3bis = document.createElement('textarea');
	R3bis.style.width = '380px';
	R3bis.style.height = '55px';
	R3bis.style.padding = '0';
	R3bis.style.margin = '0';
	R3bis.style.display = 'none';
	R3bis.setAttribute('name', 'pourquoi');
	R3bis.setAttribute('id', 'pourquoi_R');
	
	form.appendChild(Q3bis);
	form.appendChild(R3bis);
	
	
	
	
	var Q4 = document.createElement('p');
	Q4.style.paddingTop = "15px";
	Q4.appendChild(document.createTextNode('Remarque ? Suggestion ! Faites-le nous savoir!'));
	
	var R4 = document.createElement('textarea');
	R4.style.width = '380px';
	R4.style.height = '75px';
	R4.style.padding = '0';
	R4.style.margin = '0';
	R4.setAttribute('name', 'remarque');
	
	form.appendChild(Q4);
	form.appendChild(R4);
	
	
	
	var annuler = document.createElement('a');
	annuler.setAttribute('href', 'javascript:msgServ.closeMessage();');
	annuler.setAttribute('class', 'btn');
	annuler.className = 'btn';
	annuler.style.cssFloat = 'left';
	annuler.style.styleFloat = 'left';
	annuler.style.marginRight = '15px';
	annuler.appendChild(document.createTextNode('Annuler'));
	
	form.appendChild(annuler);
	
	
	var valider = document.createElement('a');
	valider.setAttribute('href', 'javascript:document.getElementById("formQuestClient").submit();');
	valider.setAttribute('class', 'btn');
	valider.className = 'btn';
	valider.style.cssFloat = 'left';
	valider.style.styleFloat = 'left';
	valider.appendChild(document.createTextNode('Valider'));
	
	form.appendChild(valider);
	
	document.getElementById('str-msg-service').appendChild(form);
	document.getElementById('containerService').style.top = "100px";
}


function createOption(value, label){
	var opt = document.createElement('option');
	opt.appendChild(document.createTextNode(label));
	opt.setAttribute('value', value);
	opt.value = value;
	
	return opt;
}