/* PressTIC 2006 Nawer */

/**************** Numerama App *****************************/

	rat8.hard_sendquickcom = function(myform,myinfo){
	 	var divform = document.getElementById(myform);
	 	var sendbtn = document.getElementById(myinfo+"sendbtn");
	 	var text = divform.comtext.value;
	 	
	 	var id_f = divform.idf.value;
	 	if(text=='' || text == 'Votre commentaire ici !')return;
	 	sendbtn.innerHTML = "patientez...";

		var params = '';
		params ='mode=hard_sendcom';
		params +='&comtext='+encodeURIComponent(text);
		params +='&idf='+id_f;
		params +='&sinfo='+myinfo;
		sys.Net.ReqPOST('/include/io/input_hard.php',params,rat8.hard_sendcomreceivedata);
	}

	rat8.hard_sendquickcom2 = function(myform,myinfo){
	 	var divform = document.getElementById(myform);
	 	var sendbtn = document.getElementById(myinfo+"sendbtn");
	 	var text = divform.comtext.value;
	 	
	 	var id_f = divform.idf.value;
	 	if(text=='' || text == 'Votre commentaire ici !')return;
	 	sendbtn.innerHTML = "patientez...";

		var params = '';
		params ='mode=hard_sendcom';
		params +='&comtext='+encodeURIComponent(text);
		params +='&idf='+id_f;
		params +='&sinfo='+myinfo;
		sys.Net.ReqPOST('/include/io/input_hard.php',params,rat8.hard_sendcomreceivedata);
	}

	rat8.hard_sendcom = function(myform,myinfo){
	 	var divform = document.getElementById(myform);
	 	var sendbtn = document.getElementById(myinfo+"sendbtn");
	 	var text = divform.comtext.value;
	 	
	 	var id_f = divform.idf.value;
	 	if(text=='' || text == 'Votre commentaire ici !')return;
	 	sendbtn.innerHTML = "patientez...";

		var valnote = 0;
		for(i=0;i<divform.notehard.length;i++){
			if(divform.notehard[i].checked == true)
				valnote = divform.notehard[i].value;
		}

		var params = '';
		params ='mode=hard_sendcom';
		params +='&comtext='+encodeURIComponent(text);
		params +='&notehard='+encodeURIComponent(valnote);
		params +='&idf='+id_f;
		params +='&sinfo='+myinfo;
		sys.Net.ReqPOST('/include/io/input_hard.php',params,rat8.hard_sendcomreceivedata);
	}

	rat8.hard_sendcomreceivedata = function(html){
	 	var rvalue = html.substr(0,3);
	 	html = html.substr(4);
	 	if(rvalue == 'not'){
	 	 	var sinfo = html.substr(0,html.indexOf("##_##"));
	 	 	html = html.substr(html.indexOf("##_##")+5);
	 	 	var divinfo = document.getElementById(sinfo);
		 	divinfo.innerHTML = html;
	 	}
	 	else if (rvalue == 'yes'){
	 	 	var sinfo = html.substr(0,html.indexOf("##_##"));
	 	 	html = html.substr(html.indexOf("##_##")+5);
	 	 	var divinfo = document.getElementById(sinfo);
	 	 	divinfo.innerHTML = html;
	 	}
	 	else if (rvalue == 'ye2'){
	 	 	var sinfo = html.substr(0,html.indexOf("##_##"));
	 	 	html = html.substr(html.indexOf("##_##")+5);
	 	 	var divinfo = document.getElementById(sinfo);
	 	 	divinfo.innerHTML = html;
	 	 	var theref = location.href.substr(0,location.href.indexOf("#"));
	 	 	location.href = theref;
	 	}
		else{
	 	 /*	var divinfo = document.getElementById('mycomnewsbox2');
		 	divinfo.innerHTML = html;*/
		 //	alert(html);
		 	alert('erreur serveur');
		}
	}
	
	rat8.hard_login = function(myinfo){
	 	var member_name = document.getElementById(myinfo+'inpth_login').value;
	 	var member_pwd = document.getElementById(myinfo+'inpth_pwd').value;
	 	var member_idf = document.getElementById(myinfo+'inpth_idf').value;
	 	var comtextsave = document.getElementById('comtextsave').value;
	 	var infoh_login = document.getElementById(myinfo+'infologin');
	 	
	 	if(member_name=='' || member_pwd == '')return;
	 	sys.API.ShowElement(infoh_login);
	 	infoh_login.innerHTML = 'patientez...';
		var params = '';
		params ='mode=hard_login';
		params +='&login='+member_name;
		params +='&pwd='+member_pwd;
		params +='&idf='+member_idf;
		params +='&comtext='+encodeURIComponent(comtextsave);
		params +='&sinfo='+myinfo;
		sys.Net.ReqPOST('/include/io/input_hard.php',params,rat8.hard_loginreceivedata);
	}
	
	rat8.hard_loginreceivedata = function(html){
	 //	alert(html);
	 	var rvalue = html.substr(0,3);
	 	
	 	if(rvalue == 'not'){
	 	 	html = html.substr(4);
	 	 	var sinfo = html.substr(0,html.indexOf("##_##"));
	 	 	html = html.substr(html.indexOf("##_##")+5);
	 	 	var infoh_login = document.getElementById(sinfo+'infologin');
		 	infoh_login.innerHTML = html;
	 	}
	 	else if (rvalue == 'yes' || rvalue == 'ye2'){
	 	 	rat8.hard_sendcomreceivedata(html);
	 	}
		else{
		 	alert('erreur serveur');
		}
	}
	
	rat8.hard_register = function(myinfo){
	 	var member_name = document.getElementById(myinfo+'inptr_login').value;
	 	var member_pwd = document.getElementById(myinfo+'inptr_pwd').value;
	 	var member_pwd2 = document.getElementById(myinfo+'inptr_pwd2').value;
	 	var member_idf = document.getElementById(myinfo+'inptr_idf').value;
	 	var member_mail = document.getElementById(myinfo+'inptr_mail').value;
	 	var member_key = document.getElementById(myinfo+'key').value;
	 	var comtextsave = document.getElementById('comtextsave').value;
	 	var infor_register = document.getElementById(myinfo+'inforegister');
	 	
	 	if(member_name=='' || member_pwd == '' || member_key == '')return;
	 	sys.API.ShowElement(infor_register);
	 	infor_register.innerHTML = 'patientez...';
		var params = '';
		params ='mode=log_register';
		params +='&login='+member_name;
		params +='&pwd='+member_pwd;
		params +='&pwd2='+member_pwd2;
		params +='&mail='+member_mail;
		params +='&idf='+member_idf;
		params +='&comtext='+encodeURIComponent(comtextsave);
		params +='&key='+member_key;
		params +='&sinfo='+myinfo;
		sys.Net.ReqPOST('/include/io/input_hard.php',params,rat8.hard_registerreceivedata);
	}
	
	rat8.hard_registerreceivedata = function(html){
	 	var rvalue = html.substr(0,3);
	 	if(rvalue == 'not'){
	 	 html = html.substr(4);
	 	 	var sinfo = html.substr(0,html.indexOf("##_##"));
	 	 	html = html.substr(html.indexOf("##_##")+5);
	 	 	var infor_register = document.getElementById(sinfo+'inforegister');
	 	 	var mycaptcha = document.getElementById(sinfo+'mycaptcha');
	 	 	mycaptcha.innerHTML = "<img src=\"/img/fimg_captcha.php?"+Math.random()+"\" alt=\"\"/>";
		 	infor_register.innerHTML = html;
	 	}
	 	else if (rvalue == 'yes' || rvalue == 'ye2'){
	 	 	rat8.hard_sendcomreceivedata(html);
	 	 /*	var sinfo = html.substr(0,html.indexOf("##_##"));
	 	 	html = html.substr(html.indexOf("##_##")+5);
		 	var id_f = document.getElementById(sinfo+'inptr_idf').value;
		 	var text = document.getElementById('comtextsave').value;
		 	var infor_register = document.getElementById(sinfo);
			infor_register.innerHTML = html;*/

	 	}
		else{
		 	alert('erreur serveur');
		}
	}
	
	rat8.hard_afterregister = function(myinfo){
	 	var text = document.getElementById('comtextsave').value;
	 	var idf_after  = document.getElementById('idf_after').value;
	 	//alert(text);
		var params = '';
		params ='mode=hard_sendcom';
		params +='&comtext='+encodeURIComponent(text);
		params +='&idf='+idf_after;
		params +='&sinfo='+myinfo;
	//	alert(params);
		sys.Net.ReqPOST('/include/io/input_hard.php',params,rat8.hard_afterregisterreceivedata);
	}
	
	rat8.hard_afterregisterreceivedata = function(html){
	 	var rvalue = html.substr(0,3);
	 	html = html.substr(4);
	 	if(rvalue == 'not'){
	 	 	var sinfo = html.substr(0,html.indexOf("##_##"));
	 	 	html = html.substr(html.indexOf("##_##")+5);
	 	 	var infor_register = document.getElementById('infoafterregister');
		 	infor_register.innerHTML = html;
	 	}
	 	else if (rvalue == 'yes'){
	 	 	var sinfo = html.substr(0,html.indexOf("##_##"));
	 	 	html = html.substr(html.indexOf("##_##")+5);
		 	var id_f = document.getElementById('idf_after').value;
		 	var text = document.getElementById('comtextsave').value;
		 	var infor_register = document.getElementById(sinfo);
			infor_register.innerHTML = html;

	 	}
	 	else if (rvalue == 'ye2'){
	 	 	var sinfo = html.substr(0,html.indexOf("##_##"));
	 	 	html = html.substr(html.indexOf("##_##")+5);
	 	 	var divinfo = document.getElementById(sinfo);
	 	 	divinfo.innerHTML = html;
	 	 	var theref = location.href.substr(0,location.href.indexOf("#"));
	 	 	location.href = theref;
	 	}
		else{
		 	alert('erreur serveur'+html);
		}
	}
	
	rat8.hvotequick = function(f,val){
	 	var votequick_info = document.getElementById('votequick_info');
		var params = '';
		params +='mode=hardvote';
		params +='&idf='+f;
		params +='&note='+val;
		
 	 	votequick_info.style.color = '#FF0000';
 	 	votequick_info.innerHTML = 'Vote en cours...';

		sys.Net.ReqPOST('/include/io/input_hard.php',params,rat8.hvotequickreceivedata);
	}
	
	rat8.hvotequickreceivedata = function(html){
	 	var votequick_info = document.getElementById('votequick_info');
	 	var votequick_rating = document.getElementById('votequick_rating');
	 	var commentquick_bloc = document.getElementById('commentquick_bloc');
	 	votequick_info.innerHTML = '';
	 	var rvalue = html.substr(0,3);
	 	html = html.substr(3);
	 	if(rvalue == 'not'){
	 	 	votequick_info.style.color = '#FF0000';
		 	votequick_info.innerHTML = html;
	 	}
	 	else if (rvalue == 'yes'){
	 	 	var vote = html.substr(0,1);
	 	 	html = html.substr(1);
	 	 	votequick_info.style.color = '#FF0000';
	 	 	votequick_info.innerHTML = 'Votre vote ('+vote+'/5) est pris en compte, merci !';
 	 		sys.API.ShowElement(commentquick_bloc);
 	 		sys.API.HideElement(votequick_rating);
		}
		else{
		 	votequick_info.innerHTML = 'Erreur serveur';
		}
	}
	
	rat8.hvotequick2 = function(f,val){
	 	var votequick_info2 = document.getElementById('votequick_info2');
		var params = '';
		params +='mode=hardvote';
		params +='&idf='+f;
		params +='&note='+val;
		
 	 	votequick_info2.style.color = '#FF0000';
 	 	votequick_info2.innerHTML = 'Vote en cours...';

		sys.Net.ReqPOST('/include/io/input_hard.php',params,rat8.hvotequick2receivedata);
	}
	
	rat8.hvotequick2receivedata = function(html){
	 	var votequick_info2 = document.getElementById('votequick_info2');
	 	var votequick_rating2 = document.getElementById('votequick_rating2');
	 	votequick_info2.innerHTML = '';
	 	var rvalue = html.substr(0,3);
	 	html = html.substr(3);
	 	if(rvalue == 'not'){
	 	 	votequick_info2.style.color = '#FF0000';
		 	votequick_info2.innerHTML = html;
	 	}
	 	else if (rvalue == 'yes'){
	 	 	var vote = html.substr(0,1);
	 	 	html = html.substr(1);
	 	 	votequick_info2.style.color = '#FF0000';
	 	 	votequick_info2.innerHTML = 'Votre vote ('+vote+'/5) est pris en compte, merci !';
 	 		sys.API.HideElement(votequick_rating2);
		}
		else{
		 	votequick_info2.innerHTML = 'Erreur serveur';
		}
	}
	
	rat8.launchcomphisto = function(){
	 	var tabint = document.getElementsByTagName('input');
	 	var tabc = new Array();
	 	for(var i=0;i<tabint.length;i++){
	 	 	if(tabint[i].className == 'comphistoclass' && tabint[i].checked)
	 	 		tabc.push(tabint[i].value);
	 	}
	 	if(tabc.length > 1 ){
	 	 	location.href = "http://"+location.hostname+"/comparer-les-prix/c/"+tabc.join(',');
	 	}
	 	else{
	 	 	alert("Merci de cocher au moins un produit pour le comparer");
	 	}
	}
	
	rat8.launchcompsimilar = function(){
	 	var tabint = document.getElementsByTagName('input');
	 	var tabc = new Array();
	 	for(var i=0;i<tabint.length;i++){
	 	 	if(tabint[i].className == 'compclass' && tabint[i].checked)
	 	 		tabc.push(tabint[i].value);
	 	}
	 	if(tabc.length > 1 ){
	 	 	location.href = "http://"+location.hostname+"/comparer-les-prix/c/"+tabc.join(',');
	 	}
	 	else{
	 	 	alert("Merci de cocher au moins un produit pour le comparer");
	 	}
	}
	
	rat8.disphisto = function(){
	 	var historicproduct = document.getElementById('historicproduct');
	 	var similarproduct = document.getElementById('similarproduct');
	 	var btnsimilarproduct = document.getElementById('btnsimilarproduct');
	 	var btnhistoricproduct = document.getElementById('btnhistoricproduct');
	 	var txtsimilarproduct = document.getElementById('txtsimilarproduct');
	 	var txthistoricproduct = document.getElementById('txthistoricproduct');
	 	sys.API.ShowElement(historicproduct);
	 	sys.API.HideElement(similarproduct);
	 	sys.API.ShowElement(btnhistoricproduct);
	 	sys.API.HideElement(btnsimilarproduct);
	 	sys.API.ShowElement(txtsimilarproduct);
	 	sys.API.HideElement(txthistoricproduct);
	}
	
	rat8.dispsimilar = function(){
	 	var historicproduct = document.getElementById('historicproduct');
	 	var similarproduct = document.getElementById('similarproduct');
	 	var btnsimilarproduct = document.getElementById('btnsimilarproduct');
	 	var btnhistoricproduct = document.getElementById('btnhistoricproduct');
	 	var txtsimilarproduct = document.getElementById('txtsimilarproduct');
	 	var txthistoricproduct = document.getElementById('txthistoricproduct');
	 	sys.API.HideElement(historicproduct);
	 	sys.API.ShowElement(similarproduct);
	 	sys.API.HideElement(btnhistoricproduct);
	 	sys.API.ShowElement(btnsimilarproduct);
	 	sys.API.HideElement(txtsimilarproduct);
	 	sys.API.ShowElement(txthistoricproduct);
	}
	
	rat8.show_loadingv = function(typev,url){
		var hardvidsembed = document.getElementById('hardvidsembed');
		var ramahtml = '<object width="560" height="337"><param name="movie" value="http://www.youtube.com/v/'+url+'&rel=1"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/'+url+'" type="application/x-shockwave-flash" wmode="transparent" width="560" height="337"></embed></object>';
		hardvidsembed.innerHTML = ramahtml;
	}
	
	rat8.hard_prequickcom2 = function(){
	 	var bloc_captcha2 = document.getElementById('bloc_captcha2');
	 	var blocpresendbtn = document.getElementById('blocpresendbtn');
	 	sys.API.HideElement(blocpresendbtn);
	 	sys.API.ShowElement(bloc_captcha2);
	}
	
	rat8.hard_cleaninptmail = function(myinput){
	 	var myinput = document.getElementById(myinput);
	 	if(myinput.value == 'adresse@email.com'){
	 	 	myinput.value = '';
	 	 	myinput.style.color = '#000';
	 	}
	 	
	}
	
	rat8.hard_warnprice_follow = function(myform,myinfo){
	 	var divform = document.getElementById(myform);
	 	var follow = document.getElementById(myform+"_follow");
		sys.API.ShowElement(follow);
	}
	
	rat8.hard_warnprice_send = function(myform,myinfo){
	 	var divform = document.getElementById(myform);
	 	var inpt_warn_price = document.getElementById("inpt_warn_price");
	 	var inpt_warn_mail = document.getElementById("inpt_warn_mail");
	 	var inpt_warn_idf = document.getElementById("inpt_warn_idf");
	 	var sendbtn = document.getElementById(myform+"sendbtn_final");
	 	var divmyinfo = document.getElementById(myinfo);
	 	
	 	if(inpt_warn_mail.value == 'adresse@email.com')return;
	 	var price = inpt_warn_price.value;
	 	var mail = inpt_warn_mail.value;
	 	var idf = inpt_warn_idf.value;
	 	
	 	divmyinfo.innerHTML = "patientez...";

		var params = '';
		params ='mode=hard_warnprice_send';
		params +='&price='+encodeURIComponent(price);
		params +='&mail='+encodeURIComponent(mail);
		params +='&idf='+encodeURIComponent(idf);
		params +='&sinfo='+myinfo;
		sys.Net.ReqPOST('/include/io/input_hard.php',params,rat8.hard_warnprice_sendreceivedata);
	}
	
	rat8.hard_warnprice_sendreceivedata = function(html){
	 	var rvalue = html.substr(0,3);
	 	html = html.substr(4);
	 	if(rvalue == 'not'){
	 	 	var sinfo = html.substr(0,html.indexOf("##_##"));
	 	 	html = html.substr(html.indexOf("##_##")+5);
	 	 	var divinfo = document.getElementById(sinfo);
		 	divinfo.innerHTML = html;
	 	}
	 	else if (rvalue == 'yes'){
	 	 	var sinfo = html.substr(0,html.indexOf("##_##"));
	 	 	html = html.substr(html.indexOf("##_##")+5);
	 	 	var divinfo = document.getElementById(sinfo);
	 	 	divinfo.innerHTML = html;
	 	}
	 	else if (rvalue == 'ye2'){
	 	 	var sinfo = html.substr(0,html.indexOf("##_##"));
	 	 	html = html.substr(html.indexOf("##_##")+5);
	 	 	var divinfo = document.getElementById(sinfo);
	 	 	divinfo.innerHTML = html;
	 	}
		else{
	 	 /*	var divinfo = document.getElementById('mycomnewsbox2');
		 	divinfo.innerHTML = html;*/
		 	alert(html);
		 	alert('erreur serveur');
		}
	}
