var nn4 = (document.layers)? true : false; // Netscape 4.xx 
var iex = (document.all)? true : false; // IE4+ 
var dom = (document.getElementById && !document.all && !document.layers)? true: false; // compatible DOM, IE 5+, Netscape 6+, Mozilla, Firefox 

var language = '';
if(navigator.browserLanguage){
	language = navigator.browserLanguage;
}else{
	language = navigator.language;
}






//---------------------------------------------------------------------
$(document).ready(function() { 
	clearAll();
	$('#technicalcontent').show();
		
	$('a#technical').click(function() {
		$('#maincontent').removeClass().addClass("boxContentContact");
		$('#maincontent').slideUp('fast', function(){clearAll(); $('#technicalcontent').show();});
		$('#maincontent').slideDown('fast');
		return false;
	});
	
	$('a#activation').click(function() {
		$('#maincontent').removeClass().addClass("boxContentContact");
		$('#maincontent').slideUp('fast', function(){clearAll(); $('#activationcontent').show();});
		$('#maincontent').slideDown('fast');
		return false;
	});
	
	$('a#FAQ').click(function() {
		$('#maincontent').removeClass().addClass("boxContentContactExpand");					 
		$('#maincontent').slideUp('fast', function(){clearAll(); $('#faqcontent').show();});
		$('#maincontent').slideDown('fast');
		return false;
	});
}); 
//---------------------------------------------------------------------
 
 
//---------------------------------------------------------------------
function clearAll(){
 	$('#technicalcontent').hide();
	$('#activationcontent').hide();
	$('#faqcontent').hide();
}
//---------------------------------------------------------------------



//---------------------------------------------------------------------
function useHttpResponse() {
  if (http.readyState == 4) {
  	var myText = http.responseText;
	var mystr = "";
	if (myText.substring(0,1) == "0"){
			mystr = "<strong>Adresse email inconnue</strong>";
	}else{
			mystr = "<strong>Code d'activation envoyé avec succes</strong>";
	}
	
	if (dom) { 
		document.getElementById("resultmail").innerHTML = mystr;} 
	else if (iex) { 
		document.all["resultmail"].innerHTML = mystr;} 
	else if (nn4) { 
		document.layers["resultmail"].innerHTML = mystr;
	} 
	
	
	document.serialform.email.value = "";
  }
}
//---------------------------------------------------------------------




//---------------------------------------------------------------------
function useHttpResponseEN() {
  if (http.readyState == 4) {
  	var myText = http.responseText;
	var mystr = "";
	if (myText.substring(0,1) == "0"){
		mystr = "<strong>Unknown email address</strong>";
	}else{
		mystr = "<strong>Activation key sended successfully</strong>";
	}
	
	if (dom) { 
		document.getElementById("resultmail").innerHTML = mystr;} 
	else if (iex) { 
		document.all["resultmail"].innerHTML = mystr;} 
	else if (nn4) { 
		document.layers["resultmail"].innerHTML = mystr;
	} 
		
	document.serialform.email.value = "";
  }
}
//---------------------------------------------------------------------



//---------------------------------------------------------------------
function sendSerial(lng){
	var nbcar = document.serialform.email.value.length;
	if (nbcar >= 200) document.serialform.email.value = myText.substring(0,199);

	
	if (nbcar > 0){
		var myEmail = document.serialform.email.value;

		//ajax start
		if(window.XMLHttpRequest) // Firefox et autres
		   http = new XMLHttpRequest(); 
		else if(window.ActiveXObject){ // Internet Explorer 
		   try {
					http = new ActiveXObject("Msxml2.XMLHTTP");
				} catch (e) {
					http = new ActiveXObject("Microsoft.XMLHTTP");
				}
		}
		
		http.open("GET", "../paypal_ipn/getbackserial.php?email=" + myEmail , true);
		if (lng == 0)
			http.onreadystatechange = useHttpResponse;
		else
			http.onreadystatechange = useHttpResponseEN;
			
		http.send(null);
		
	}	
}
//---------------------------------------------------------------------
