var step=0;
function backStep(){	
	if (step==3){
		document.getElementById('thirdCircle').innerHTML='<img src="/en/contactus/img/circlehollow.png" />';	
		document.getElementById('bulkContent').innerHTML="";
		document.getElementById('contactdropDown').style.display="block";
		document.getElementById('contactformInfo').style.display="block";
// 		document.getElementById('contactInfo').style.display="block";
// 		document.getElementById('contactFAQ').style.display="none";

		
		
		
		
	}
	else if (step==2){
		document.getElementById('secondCircle').innerHTML='<img src="/en/contactus/img/circlehollow.png" />';
		document.getElementById('contactdropDown').style.display="block";
		document.getElementById('bulkContent').innerHTML="";
		document.getElementById('step1Div').style.display="block";
		document.getElementById('step1Drop').selectedIndex=0;
		document.getElementById('leftSelect').style.visibility="hidden";
		document.getElementById('rightSelect').style.visibility="hidden";
		document.getElementById('contactformInfo').style.display="block";
		document.getElementById('contactButtons').style.visibility="hidden";
// 		document.getElementById('contactFAQ').style.display="none";
	}
	step--;

}

function firstChange(){
	step=2;
	document.getElementById('contactButtons').style.visibility="visible";
	
	document.getElementById('secondCircle').innerHTML='<img src="/en/contactus/img/circlefull.png" />';
	
	choice=document.getElementById('step1Drop').value;
	switch (choice)
	{
		case "potential":
			document.getElementById('leftSelect').style.visibility="visible";
			document.getElementById('rightSelect').style.visibility="visible";
			potDrop();
			break;
		case "existing":	
			document.getElementById('leftSelect').style.visibility="visible";
			document.getElementById('rightSelect').style.visibility="visible";
			existDrop();
			break;
		case "becoming":
			potForm();
			break;
		case "other":
			document.getElementById('leftSelect').style.visibility="visible";
			document.getElementById('rightSelect').style.visibility="visible";
			otherDrop();
			break;
		default:
			document.getElementById('rightSelect').style.visibility="hidden";
			document.getElementById('leftSelect').style.visibility="hidden";			
			break;	
	}

} 


function secondChange(){
	step=3;
	
	firstChoice=document.getElementById('step1Drop').value;
	secondChoice=document.getElementById('step2Drop').value;

	if (secondChoice=="") return;


	document.getElementById('thirdCircle').innerHTML='<img src="/en/contactus/img/circlefull.png" />';
// 	document.getElementById('contactInfo').style.display="none";
	

	document.getElementById('bulkContent').innerHTML="";	
	
	
	switch (firstChoice){
		case "potential":
			firstPotChoice(secondChoice);
			break;
		case "existing":
			firstExistChoice(secondChoice);
			break;
		case "becoming":
			break;
		case "other":
			firstOtherChoice(secondChoice);
			break;
		
	}

	
	
} 



function firstPotChoice(secondChoice){
	/*
	switch (secondChoice)
	{
		case "911":	
			getFaq("geos","911");			
			break;
		case "time":
			getFaq("time","zone");
			break;
		case "activate":
			getFaq("tech");
			break;
		case "buy":
			getFaq("ship");
			break;
		case "help":
			getFaq("check","help");
			break;
		case "share":
			getFaq("share");
			break;
		case "promocode":
			getFaq("code","promo");
			break;
		case "sms":
			getFaq("sms","text");
			break;
		case "other":
			getFaq("");
			break;
		default:
			break;
	}*/
	potForm();

}

function firstExistChoice(secondChoice){
	/*
	switch (secondChoice)
	{
		case "911":
			getFaq("geos","911");
			break;
		case "billing":
			getFaq("time","bill");
			break;
		case "time":
			getFaq("time","zone");
			break;
		case "lost":
			getFaq("lost","stolen","replace");
			break;
		case "profile":
			getFaq("profile");
			break;
		case "help":
			getFaq("checkin","help");
			break;
		case "sms":
			getFaq("sms","text");
			break;
		case "share":
			getFaq("share");
			break;
		case "web":
			getFaq("registration");
			break;
		case "other":;
			getFaq("");
			break;
		default:
			break;
	}*/
	existForm();

}

function firstOtherChoice(secondChoice){
	/*
	switch (secondChoice)
	{
		case "911":
			getFaq("geos","911");
			break;
		case "billing":
			getFaq("time","bill");
			break;
		case "time":
			getFaq("time","zone");
			break;
		case "activate":
			getFaq("tech");
			break;
		case "buy":
			getFaq("ship");
			break;
		case "help":
			getFaq("checkin","help");
			break;
		case "promocode":
			getFaq("code","promo");
			break;
		case "sms":
			getFaq("sms","text");
			break;
		case "share":
			getFaq("share");
			break;
		case "other":
			getFaq("");
			break;
		default:
			break;
	}*/
	otherForm();

}

function thirdChange(){
	step=4;
	document.getElementById('fourthCircle').innerHTML='<img src="/en/contactus/img/circlefull.png" />';	
	document.getElementById('thirdCircle').innerHTML='<img src="/en/contactus/img/circlefull.png" />';
	document.getElementById('secondCircle').innerHTML='<img src="/en/contactus/img/circlefull.png" />';
	document.getElementById('contactdropDown').style.display="none";
	document.getElementById('contactformInfo').style.display="none";
	document.getElementById('contactButtons').style.visibility="visible";
	document.getElementById('contactBackButton').style.display="none";
	document.getElementById('checkMark').style.display="block";
	document.getElementById('bulkContent').innerHTML=''+
	'<div id="contactThanks"><b>MERCI!</b> <br />'+
	'Votre demande a &eacute;t&eacute;  transmise &agrave; notre Service &agrave; la client&egrave;le; vous recevrez une r&eacute;ponse d&egrave;s que  possible. <br />'+
	'Veuillez poursuivre  votre visite.</div>';
	
}

function potForm(){
	firstChoice=document.getElementById('step1Drop').selectedIndex;
	firstText=document.getElementById('step1Drop').options[firstChoice].text;
	secondChoice=document.getElementById('step2Drop').selectedIndex;
	secondText=document.getElementById('step2Drop').options[secondChoice].text;
	//document.getElementById('step2Drop').blur();
	document.getElementById('contactdropDown').style.display="none";
	document.getElementById('contactformInfo').style.display="none";
	document.getElementById('bulkContent').innerHTML=''+
	'<form name="inputForm" action="/fr/contactus/backend/submitForm.php" method="POST" onSubmit="return checkrequired(this)">'+
	'<input type="hidden" name="source" value="contact_revamp_ca_fr">'+
	'<input type="hidden" name="note1" value="'+firstText+'">'+
	'<input type="hidden" name="note2" value="'+secondText+'">'+
	'<span style="font-size:12pt; padding-left:25px;">Veuillez remplir le formulaire ci-dessous: </span>'+
	'<span style="font-size:10pt;color:red">(* Renseignements requis)</span>'+
	'<div style="padding-left:25px;"><br><br><table><tr>'+
	'<td nowrap >ADRESSE DE COURRIEL:</td><td nowrap><input type="text" name="email" maxLength="40" size="25" id="required1"><span style="color:red"> *</span></td>'+
	'</tr><tr>'+
	'<td width="120px" nowrap >NOM:</td><td nowrap><input type="text" name="firstname" maxLength="15" size="25" id="required2"><span style="color:red"> *</span></td>'+
	'</tr><tr>'+
	'<td colspan="2"><table><tr><td nowrap>NO DE T&Eacute;L&Eacute;PHONE PRINCIPAL:</td><td nowrap><input type="text" name="phone" maxLength="20" size="16" ></td></tr></table></td>'+
	'<td width="125">NO DE T&Eacute;L&Eacute;PHONE SECONDAIRE:</td><td nowrap><input type="text" name="note3" id="note3" maxLength="50" size="20"></td>'+
	'</tr><tr>'+
	'<td>VILLE:</td><td nowrap><input type="text" name="city" maxLength="20" size="25"></td>'+
	'<td>PAYS:</td><td nowrap><input type="text" name="country" maxLength="50" size="20"></td>'+
	'</tr><tr>'+
	'<td>&nbsp;</td>'+
	'</tr><tr>'+
	'<td colspan="2">COMMENT AVEZ-VOUS<br>ENTENDU PARLER DE SPOT? '+
	'<select name="note6[]" id="note6" onchange="otherSpecify()"><option>Magazine</option><option>Publicit&eacute; &agrave; la radio</option><option>Publicit&eacute; &agrave; la t&eacute;l&eacute;</option><option>Publicit&eacute; en ligne</option><option>Autre</option></select></td>'+
	'<td><div id="otherText" style="visibility:hidden">PR&Eacute;CISEZ:</div></td><td><div id="otherBox" style="visibility:hidden"><input type="text" name="note6[]" id="otherTextBox" maxLength="50" size="20"></div></td>'+
	'</tr><tr>'+
	'<td>QUESTION:</td><td colspan="3"><textarea rows="4" cols="55" name="note4" ></textarea></td>'+
	'</tr></table></div>'+
	'<div id="bottomButt" align="right" style="margin-right:80px"><a onclick="document.inputForm.reset();return false;" href="#"><img alt="Clear" src="/fr/contactus/img/clear.png" /> </a> &nbsp; <input type="image" border="0" src="/fr/contactus/img/submit.png" /></div>'+
	'</form>';
	document.getElementById("required1").focus();

}

function otherSpecify(){
	var w=document.getElementById('note6').selectedIndex;
	choice=document.getElementById('note6').options[w].text;
	if (choice=="Autre"){
		document.getElementById('otherText').style.visibility="visible";
		document.getElementById('otherBox').style.visibility="visible";
	}
	else{
		document.getElementById('otherText').style.visibility="hidden";
		document.getElementById('otherTextBox').value="";
		document.getElementById('otherBox').style.visibility="hidden";
	}

}

function existForm(){
	document.getElementById('contactdropDown').style.display="none";
	document.getElementById('contactformInfo').style.display="none";
	
	firstChoice=document.getElementById('step1Drop').selectedIndex;
	firstText=document.getElementById('step1Drop').options[firstChoice].text;
	secondChoice=document.getElementById('step2Drop').selectedIndex;
	secondText=document.getElementById('step2Drop').options[secondChoice].text;

	document.getElementById('bulkContent').innerHTML=''+
	'<form name="inputForm" action="/fr/contactus/backend/submitForm.php" method="POST" onSubmit="return checkrequired(this)">'+
	'<input type="hidden" name="source" value="contact_revamp_ca_fr">'+
	'<input type="hidden" name="note1" value="'+firstText+'">'+
	'<input type="hidden" name="note2" value="'+secondText+'">'+
	'<span style="font-size:12pt; padding-left:25px;">Veuillez remplir le formulaire ci-dessous: </span>'+
	'<span style="font-size:10pt;color:red">(* Renseignements requis)</span>'+
	'<div style="padding-left:25px;"><br><br><table><tr>'+
	'<td width="120px" nowrap >SPOT ESN #:</td><td nowrap><input type="text" name="note5" maxLength="15" size="25" id="required1"><span style="color:red"> *</span></td>'+
	'</tr><tr>'+
	'<td nowrap >ADRESSE DE COURRIEL:</td><td nowrap><input type="text" name="email" maxLength="40" size="25" id="required2"><span style="color:red"> *</span></td>'+
	'</tr><tr>'+
	'<td nowrap>NOM:</td><td nowrap><input type="text" name="firstname" maxLength="50" size="25" id="required3"><span style="color:red"> *</span></td>'+
	'</tr><tr>'+
	'<td colspan="2"><table><tr><td nowrap>NO DE T&Eacute;L&Eacute;PHONE PRINCIPAL:</td><td nowrap><input type="text" name="phone" maxLength="20" size="16" ></td></tr></table></td>'+
	'<td width="125">NO DE T&Eacute;L&Eacute;PHONE SECONDAIRE:</td><td nowrap><input type="text" name="note3" maxLength="50" size="20"></td>'+
	'</tr><tr>'+
	'<td>VILLE:</td><td nowrap><input type="text" name="city" maxLength="20" size="25"></td>'+
	'<td>PAYS:</td><td nowrap><input type="text" name="country" maxLength="50" size="20"></td>'+
	'</tr><tr>'+
	'<td>QUESTION:</td><td colspan="3"><textarea rows="4" cols="55" name="note4" ></textarea></td>'+
	'</tr></table></div>'+
	'<div id="bottomButt" align="right" style="margin-right:80px"><a onclick="document.inputForm.reset();return false;" href="#"><img alt="Clear" src="/fr/contactus/img/clear.png" /> </a> &nbsp;  <input type="image" border="0" src="/fr/contactus/img/submit.png" /></div>'+
	'</form>';
	document.getElementById("required1").focus();
}

function otherForm(){
	firstChoice=document.getElementById('step1Drop').selectedIndex;
	firstText=document.getElementById('step1Drop').options[firstChoice].text;
	secondChoice=document.getElementById('step2Drop').selectedIndex;
	secondText=document.getElementById('step2Drop').options[secondChoice].text;

	document.getElementById('contactdropDown').style.display="none";
	document.getElementById('contactformInfo').style.display="none";
	document.getElementById('bulkContent').innerHTML=''+
	'<form name="inputForm" action="/fr/contactus/backend/submitForm.php" method="POST" onSubmit="return checkrequired(this)">'+
	'<input type="hidden" name="source" value="contact_revamp_ca_fr">'+
	'<input type="hidden" name="note1" value="'+firstText+'">'+
	'<input type="hidden" name="note2" value="'+secondText+'">'+
	'<span style="font-size:12pt; padding-left:25px;">Veuillez remplir le formulaire ci-dessous: </span>'+
	'<span style="font-size:10pt;color:red">(* Renseignements requis)</span>'+
	'<div style="padding-left:25px;"><br><br><table><tr>'+
	'<td width="120px" nowrap >SPOT ESN #:</td><td nowrap><input type="text" name="note5" maxLength="15" size="25"></td>'+
	'</tr><tr>'+
	'<td nowrap >ADRESSE DE COURRIEL:</td><td nowrap><input type="text" name="email" maxLength="40" size="25" id="required1"><span style="color:red"> *</span></td>'+
	'</tr><tr>'+
	'<td width="120px" nowrap >NOM:</td><td nowrap><input type="text" name="firstname" maxLength="15" size="25" id="required2"><span style="color:red"> *</span></td>'+
	'</tr><tr>'+
	'<td colspan="2"><table><tr><td nowrap>NO DE T&Eacute;L&Eacute;PHONE PRINCIPAL:</td><td nowrap><input type="text" name="phone" maxLength="20" size="16" ></td></tr></table></td>'+
	'<td width="125">NO DE T&Eacute;L&Eacute;PHONE SECONDAIRE:</td><td nowrap><input type="text" name="note3" maxLength="50" size="20"></td>'+
	'</tr><tr>'+
	'<td>VILLE:</td><td nowrap><input type="text" name="city" maxLength="20" size="25"></td>'+
	'<td>PAYS:</td><td nowrap><input type="text" name="country" maxLength="50" size="20"></td>'+
	'</tr><tr>'+
	'<td>&nbsp;</td>'+
	'</tr><tr>'+
	'<td colspan="2">COMMENT AVEZ-VOUS<br>ENTENDU PARLER DE SPOT? '+
	'<select name="note6[]" id="note6" onchange="otherSpecify()"><option>Magazine</option><option>Publicit&eacute; &agrave; la radio</option><option>Publicit&eacute; &agrave; la t&eacute;l&eacute;</option><option>Publicit&eacute; en ligne</option><option>Autre</option></select></td>'+
	'<td><div id="otherText" style="visibility:hidden">PR&Eacute;CISEZ:</div></td><td><div id="otherBox" style="visibility:hidden"><input type="text" name="note6[]" maxLength="50" size="20"></div></td>'+
	'</tr><tr>'+
	'<td>QUESTION:</td><td colspan="3"><textarea rows="4" cols="55" name="note4" ></textarea></td>'+
	'</tr></table></div>'+
	'<div id="bottomButt" align="right" style="margin-right:80px"><a onclick="document.inputForm.reset();return false;" href="#"><img alt="Clear" src="/fr/contactus/img/clear.png" /> </a> &nbsp;<input type="image" border="0" src="/fr/contactus/img/submit.png" /></div>'+
	'</form>';
	document.getElementById("required1").focus();

}


/*


var http_request = false;
function makeRequest(url, parameters) {
	http_request = false;
	if (window.XMLHttpRequest) { // Mozilla, Safari,...
		http_request = new XMLHttpRequest();
        	if (http_request.overrideMimeType) {
            		http_request.overrideMimeType('text/html');
         	}
      		} else if (window.ActiveXObject) { // IE
         		try {
            			http_request = new ActiveXObject("Msxml2.XMLHTTP");
         		} catch (e) {
            			try {
               				http_request = new ActiveXObject("Microsoft.XMLHTTP");
            			} catch (e) {}
       		}
    	}
    	if (!http_request) {
        	alert('Cannot create XMLHTTP instance');
         	return false;
      	}
      	http_request.onreadystatechange = alertContents;
      	http_request.open('GET', url + parameters, true);
      	http_request.send(null);
}

function getFaq(searchVal,searchVal2,searchVal3){
	if (searchVal3)
		makeRequest("/en/contactus/backend/getfaq.php","?faq="+searchVal+"&faq2="+searchVal2+"&faq3="+searchVal3);
	else if (searchVal2)
		makeRequest("/en/contactus/backend/getfaq.php","?faq="+searchVal+"&faq2="+searchVal2);
	else
		makeRequest("/en/contactus/backend/getfaq.php","?faq="+searchVal);
}

function alertContents(){
	if (http_request.readyState == 4 && http_request.status == 200) {
        	var recdoc = http_request.responseText;	
		//alert ("::"+recdoc+"::");
			document.getElementById('contactInfo').style.display="block";
			document.getElementById('contactFAQ').style.display="none";
			document.getElementById('contactFAQ').innerHTML=recdoc;

	} 

}
*/

function readCookie(name) {

	var cookiename = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') 
			c = c.substring(1,c.length);
		if (c.indexOf(cookiename) == 0) 
			return c.substring(cookiename.length,c.length);
	}
	return null;
}

function killCookie(cookieName) {
	  document.cookie = cookieName + 
                    '=; expires=-1;' +
                    "path=/; domain=." +
                    window.location.hostname;
  	return true;
}
