var submitted = false;

function validateSubmit() {
    if (submitted) {
        return false;  // don't submit form
    } else {
        submitted = true;
        return true; // submit form
    }
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function popup (url) {
  window.open(url, 'new', 'scrollbars=yes, width=420, height=375, resizable=yes');
}

function isEmpty(element) {

	var isChecked;

 	for (i=0; i<element.length;i++) 
	{ 
 		if (element[i].checked == true) {
 			return false;
 		}
 	}

	return true;
}

function clearNoneOfTheAboveBox() {
	var n = document.getElementById("noneOfTheAbove");
	if (n != null) {
		n.checked = false;
	}
}

function clearOtherBoxes(obj) {
    var elements = document.forms[0].elements;
    var i = 0;

    while(elements[i]) {
        if(elements[i] == obj && elements[i].checked == true) {
            elements[i].checked = true;
        } else {
            elements[i].checked = false;
        }
        i++;
    }
}

	// knowledge base functions 
	
var kbWindow = null;	

function launchPortalNL() {
	winOptions = "width=680, height=500, scrollbars=0, resizable=1, status=0, toolbar=0, menubar=0, location=0";
	kbWindow = window.open("http://portal.knowledgebase.net/?cid=12737&c=5109&cpc=VmyPDB553qMt523R1NY530wvqQ4UxgJ6eu2xljWW", "CP12737", winOptions);
	return false;
}

function launchPortalFR() {
	winOptions = "width=680, height=500, scrollbars=0, resizable=1, status=0, toolbar=0, menubar=0, location=0";
	kbWindow = window.open("http://portal.knowledgebase.net/?cid=12736&c=5109&cpc=h830o4bau082CQUePylcVn2H", "CP12736", winOptions);
	return false;
	
}


function askKnowledgeBaseKeyword() {
	var topics = document.kbSearch.keywords.value;	
	askKnowledgeBase(topics);
}

function askKnowledgeBase(topics) {
var langParam = document.kbSearch.langCode.value;
	
	if(langParam == "fr") {
		 launchPortalFR();
		 kbWindow.location.href = 'http://portal.knowledgebase.net/search.asp?searchtype=allwords&searchby=keywords&c=5109&cid=12736&cpc=h830o4bau082CQUePylcVn2H&un=&pw=&searchstring='+escape(topics);
		 kbWindow.focus();
		// alert('FR');
	}
	else {
		launchPortalNL();	
		kbWindow.location.href = 'http://portal.knowledgebase.net/search.asp?searchtype=allwords&searchby=keywords&c=5109&cid=12737&cpc=VmyPDB553qMt523R1NY530wvqQ4UxgJ6eu2xljWW&un=&pw=&searchstring='+escape(topics);
		kbWindow.focus();
		// alert('NL');
	}
}



// END: Methods used with /help/contactus.html




// create the topicArray
var topicArray = new Array();

topicArray['Sondages'] = new Array();
topicArray['Sondages'][0] = "Problème technique avec un sondage";
topicArray['Sondages'][1] = "Message « Authentication failed »";
topicArray['Sondages'][2] = "Changer une réponse dans un sondage";
topicArray['Sondages'][3] = "Aucune réponse ne correspond à mon choix";
topicArray['Sondages'][4] = "Qualification pour les sondages";
topicArray['Sondages'][5] = "Données personnelles (âge, sexe...)";
topicArray['Sondages'][6] = "Je n'ai pas d'enfant de cet âge";
topicArray['Sondages'][7] = "Proposez-moi plus de sondages";
topicArray['Sondages'][8] = "Le sondage n'est pas disponible";
topicArray['Sondages'][9] = "Le sondage est trop long";
topicArray['Sondages'][10] = "Autre";

topicArray['Enquêtes'] = new Array();
topicArray['Enquêtes'][0] = "Technisch probleem met een enquête";
topicArray['Enquêtes'][1] = "« Authentication failed » bericht";
topicArray['Enquêtes'][2] = "Enquêteantwoord veranderen";
topicArray['Enquêtes'][3] = "Geen van de antwoorden is van toepassing";
topicArray['Enquêtes'][4] = "Uitgesloten voor deelname aan enquête";
topicArray['Enquêtes'][5] = "Persoonlijke gegevens delen";
topicArray['Enquêtes'][6] = "Ik heb geen kinderen van die leeftijd";
topicArray['Enquêtes'][7] = "Stuur meer enquêtes";
topicArray['Enquêtes'][8] = "Enquête niet beschikbaar";
topicArray['Enquêtes'][9] = "Enquête duurt te lang";
topicArray['Enquêtes'][10] = "Ander";

topicArray['Récompenses'] = new Array();
topicArray['Récompenses'][0] = "Mon compte de points Lightspeed";
topicArray['Récompenses'][1] = "Mes tickets pour le tirage au sort Lightspeed";
topicArray['Récompenses'][2] = "Le tirage au sort Lightspeed";
topicArray['Récompenses'][3] = "Mes points n'ont pas été crédités";
topicArray['Récompenses'][4] = "Points Lightspeed expirés";
topicArray['Récompenses'][5] = "Valeur de points Lightspeed";
topicArray['Récompenses'][6] = "Je n'ai pas reçu le cadeau commandé";
topicArray['Récompenses'][7] = "Envoi par la Poste des cadeaux Lightspeed";
topicArray['Récompenses'][8] = "Autre";

topicArray['Prijzen'] = new Array();
topicArray['Prijzen'][0] = "Waar vind ik mijn puntenaccount?";
topicArray['Prijzen'][1] = "Waar vind ik mijn loten voor de Loterij?";
topicArray['Prijzen'][2] = "De Lightspeed Loterij";
topicArray['Prijzen'][3] = "Ik heb geen punten gekregen voor een enquête";
topicArray['Prijzen'][4] = "Vervallen Lightspeed Punten?";
topicArray['Prijzen'][5] = "Waarde van Lightspeed Punten";
topicArray['Prijzen'][6] = "Ik heb mijn prijs niet ontvangen";
topicArray['Prijzen'][7] = "Verzendingsproblemen";
topicArray['Prijzen'][8] = "Ander";

topicArray['Inscription'] = new Array();
topicArray['Inscription'][0] = "Je n'ai pas reçu l'email de confirmation";
topicArray['Inscription'][1] = "J'ai perdu l'email de confirmation";
topicArray['Inscription'][2] = "J'ai un problème pour m'inscrire au panel";
topicArray['Inscription'][3] = "Problème avec l'email d'activation";
topicArray['Inscription'][4] = "Comment faire pour m'inscrire au panel?";
topicArray['Inscription'][5] = "Qui peut s'inscrire au panel?";
topicArray['Inscription'][6] = "L'inscription est-elle payante?";
topicArray['Inscription'][7] = "Inscription de plusieurs membres du foyer";
topicArray['Inscription'][8] = "Je n'habite pas en Belgique";
topicArray['Inscription'][9] = "Autre";

topicArray['Registratie'] = new Array();
topicArray['Registratie'][0] = "Ik heb geen bevestigingsemail gekregen";
topicArray['Registratie'][1] = "Ik heb mijn bevestigingsemail niet meer";
topicArray['Registratie'][2] = "Probleem tijdens registratieproces";
topicArray['Registratie'][3] = "De link in de activatie-email werkt niet";
topicArray['Registratie'][4] = "Hoe kan ik me inschrijven?";
topicArray['Registratie'][5] = "Wie kan lid worden van het panel?";
topicArray['Registratie'][6] = "Moet ik betalen om me in te schrijven?";
topicArray['Registratie'][7] = "Twee mensen uit hetzelfde gezin";
topicArray['Registratie'][8] = "Ik woon niet in België";
topicArray['Registratie'][9] = "Ander";

topicArray["Accès à l'Espace Membres"] = new Array();
topicArray["Accès à l'Espace Membres"][0] = "Je ne peux pas accéder à l'Espace Membres";
topicArray["Accès à l'Espace Membres"][1] = "Déconnection de l'Espace Membres";
topicArray["Accès à l'Espace Membres"][2] = "J'ai oublié mon mot de passe";
topicArray["Accès à l'Espace Membres"][3] = "Difficulté d'accès à l'Espace Membres";
topicArray["Accès à l'Espace Membres"][4] = "Autre";

topicArray['Log-in problemen'] = new Array();
topicArray['Log-in problemen'][0] = "Ik kan niet inloggen";
topicArray['Log-in problemen'][1] = "Ik kan niet uitloggen";
topicArray['Log-in problemen'][2] = "Ik ben mijn paswoord vergeten";
topicArray['Log-in problemen'][3] = "Ik moet steeds tweemaal inloggen";
topicArray['Log-in problemen'][4] = "Ander";

topicArray['Mini-sondages et QuickMatch'] = new Array();
topicArray['Mini-sondages et QuickMatch'][0] = "Je ne peux pas répondre aux mini-sondages";
topicArray['Mini-sondages et QuickMatch'][1] = "Résultats des mini-sondages";
topicArray['Mini-sondages et QuickMatch'][2] = "Le mini-sondage n'est pas accessible";
topicArray['Mini-sondages et QuickMatch'][3] = "J'ai déjà répondu au mini-sondage";
topicArray['Mini-sondages et QuickMatch'][4] = "Mini-sondage ancien";
topicArray['Mini-sondages et QuickMatch'][5] = "Problème avec un QuickMatch";
topicArray['Mini-sondages et QuickMatch'][6] = "Le QuickMatch n'est pas accessible";
topicArray['Mini-sondages et QuickMatch'][7] = "J'ai déjà répondu au QuickMatch";
topicArray['Mini-sondages et QuickMatch'][8] = "Je n'ai pas reçu mes points";
topicArray['Mini-sondages et QuickMatch'][9] = "Les résultats ne donnent pas 100%";
topicArray['Mini-sondages et QuickMatch'][10] = "Autre";

topicArray['Mini-poll/Quick Match'] = new Array();
topicArray['Mini-poll/Quick Match'][0] = "Ik kan niet meedoen aan de mini-poll";
topicArray['Mini-poll/Quick Match'][1] = "Resultaten van de mini-poll";
topicArray['Mini-poll/Quick Match'][2] = "Mini-poll niet beschikbaar";
topicArray['Mini-poll/Quick Match'][3] = "Ik heb al meegedaan aan de mini-poll";
topicArray['Mini-poll/Quick Match'][4] = "Vraag over een oude mini-poll";
topicArray['Mini-poll/Quick Match'][5] = "Probleem met Quick Match";
topicArray['Mini-poll/Quick Match'][6] = "Quick Match niet beschikbaar";
topicArray['Mini-poll/Quick Match'][7] = "Ik heb al meegedaan aan de Quick Match";
topicArray['Mini-poll/Quick Match'][8] = "Ik heb geen punten gekregen";
topicArray['Mini-poll/Quick Match'][9] = "De som van de resultaten is niet 100%";
topicArray['Mini-poll/Quick Match'][10] = "Ander";

topicArray['Données personnelles'] = new Array();
topicArray['Données personnelles'][0] = "Confidentialité des données personnelles";
topicArray['Données personnelles'][1] = "Spam";
topicArray['Données personnelles'][2] = "Manon dans mon carnet d'adresses";
topicArray['Données personnelles'][3] = "Autre";

topicArray['Privacy'] = new Array();
topicArray['Privacy'][0] = "Hoe wordt mijn privacy beschermd?"
topicArray['Privacy'][1] = "Spam emails";
topicArray['Privacy'][2] = "Emailadres van Emma toevoegen aan adresboek";
topicArray['Privacy'][3] = "Ander";

topicArray['Mise à jour'] = new Array();
topicArray['Mise à jour'][0] = "Changer mon adresse email"; 
topicArray['Mise à jour'][1] = "Changer mon mot de passe";
topicArray['Mise à jour'][2] = "Modifier mon adresse postale";
topicArray['Mise à jour'][3] = "Mettre à jour mes informations personnelles";
topicArray['Mise à jour'][4] = "Autre";


topicArray['Uw gegevens aanpassen'] = new Array();
topicArray['Uw gegevens aanpassen'][0] = "Mijn  emailadres veranderen";
topicArray['Uw gegevens aanpassen'][1] = "Mijn paswoord veranderen";
topicArray['Uw gegevens aanpassen'][2] = "Mijn postadres veranderen";
topicArray['Uw gegevens aanpassen'][3] = "Mijn persoonlijke informatie updaten";
topicArray['Uw gegevens aanpassen'][4] = "Ander";

topicArray['Questions générales'] = new Array();
topicArray['Questions générales'][0] = "Programme d'affiliation Lightspeed";
topicArray['Questions générales'][1] = "Emploi";
topicArray['Questions générales'][2] = "Parrainer un ami";
topicArray['Questions générales'][3] = "Autre";

topicArray['Algemene vragen'] = new Array();
topicArray['Algemene vragen'][0] = "Partners";
topicArray['Algemene vragen'][1] = "Vacatures";
topicArray['Algemene vragen'][2] = "Een vriend aanbevelen als panellid";
topicArray['Algemene vragen'][3] = "Ander";



topicArray['Désinscription'] = new Array();
topicArray['Désinscription'][0] = "Désinscription";
topicArray['Désinscription'][1] = "Pourquoi ai-je été désinscrit?";
topicArray['Désinscription'][2] = "Autre";

topicArray['Uitschrijven'] = new Array();
topicArray['Uitschrijven'][0] = "Uitschrijven";
topicArray['Uitschrijven'][1] = "Waarom ben ik verwijderd?";
topicArray['Uitschrijven'][2] = "Ander";


// this method takes the name of a "level 1" topic, which is used as a key in the topicArray
// associative array. it is keyed to a numerically-indexed array of its sub-topics.
// the function iterates through the given topics sub-topics and writes them to the
// sub-topic select box.

// It also takes a selected SubTopic and pre-selects it if there's a match. This is so the form
// can be pre-populated if the user is bounced back to it because of a validation error.

function populateSubTopicSelect( topic, topicdescription, subtopic, selected ) { 
 	// Remember topic description
 	document.forms["askQuestion"].topic_description.value = topicdescription;
 
	// select	= window.document.askQuestion.SubTopic; 
	select	= subtopic;
	string	= ""; 
  
	count	= 0; 
 
	// Clear the old list (above element 0) 
 
	select.options.length = count; 
 
		// Place all matching categories into Options. 
 
	for( i = 0; i < topicArray[topic].length; i++ ) { 
		string = topicArray[topic][i];
		
		isSelected = false;
		if (string == selected) {
			isSelected = true;
		}
		select.options[count++] = new Option( string, string, false, isSelected );

	}  
	var browser=navigator.appName;
	var b_version=navigator.appVersion;
	//alert("browser: "+browser);
	//alert("b_version: "+b_version);
	
	if(browser=="Microsoft Internet Explorer" && b_version.indexOf("MSIE 6.0")!=-1 && selected!=null && selected.length>0) {
		//alert(browser+" "+b_version);
		var subselectIndex = select.options.selectedIndex;
		select.options.selectedIndex = subselectIndex + 1;
	} 
}

function doContactUsSubmit(maxlength){
   if(document.askQuestion.comments.value.length > maxlength) {
	 alert(document.askQuestion.tooManyChar.value);
     document.askQuestion.comments.focus();
     return false; 
   }
   else {
	 askKnowledgeBase(document.askQuestion.subtopic.value);
	 document.askQuestion.submit();
     return true;
   } 
}

function doContactUsOnLoad(subtopic){
	var selectedIndex = document.askQuestion.topic.options.selectedIndex;
	//alert("topic selectedIndex "+selectedIndex);
	
	if (selectedIndex >= 0) {
		populateSubTopicSelect(document.askQuestion.topic.options[selectedIndex].value,
							   document.askQuestion.topic.options[selectedIndex].text,
							   document.askQuestion.subtopic,
							   subtopic);
	}								      	

}	
