function a2fav(title, url){
if(title==undefined) title="DzDeal Community";
if(url==undefined) url="http://www.dzdeal.com";
if(window.sidebar){
	window.sidebar.addPanel(title, url,"");
}else if(window.external){
	window.external.AddFavorite( url, title); 
	}
else if(window.opera && window.print){
	return true;
	}
}
function $$$(el){return document.getElementById(el);}
function sid(){return '&'+new Date().getTime();}
function v(el){return $$$(el).value;}
function oo(el){$$$(el).style.display='block';return;}
function toggle(el){if($$$(el).style.display=='none')$$$(el).style.display='block';else $$$(el).style.display='none';}
function c(el){$$$(el).style.display='none';return;}
function lgo(){tb_show("D&eacute;connexion","http://www.dzdeal.com/inc/engine.php?loggout=1&width=400&height=150",null);}
function advanced_s(){tb_show("Recherche approfondie","http://www.dzdeal.com/search/index.php?search=1&width=400&height=380",null);}
function within(el,txt,ca,keep_overlay_closed){
	if(!el)el='working_division';
	oo(el);
	$$$(el).innerHTML=txt;
	if(!keep_overlay_closed)
	oo('overlay');
	if(ca){setTimeout("c('"+el+"');c('overlay')",ca);}
}


function nomination_det(iad, title, immo){
	if(immo==true)
	var dire='nomination_details';
	else
	var dire='details';
	popup('../'+dire+'/index.php?id='+iad, title);
}

function Exchange(i){if(i==undefined) i=0; return popup('http://www.dzdeal.com/exchange/?exchange='+i);}
function popup(url,title,w,h){
	if(title==undefined) title='&nbsp;';
	w=900;
	h=500;
	jQuery(function(){
	setTimeout(function(){tb_show(title, url+"&TB_iframe=true&width="+w+"&height="+h+"", null);}, 10);
	});
}

//BOTH
function gnl(s,ss,tt){
	var u='http://www.dzdeal.com/search_gate/index.php?advancedsearch=1&s='+s+'&ss='+ss+'&tt='+tt;
	$("#TopLeft").html('<div id="lll">Chargement en cours</div>');
	$.post(u, function(data){
			$("#TopLeft").html(data);
			return;
 	});
}
function addslashes(s){
    return(s+'').replace(/([\\"'])/g, "\\$1").replace(/\0/g, "\\0");
}

function SS(fsf){
	var sec;
	(fsf==true) ? sec='2' : sec='';
	var d=addslashes(v('ss_keyword'+sec));
	var cat=v('qw'+sec);
	var str = "d="+d+"&s_in=*&w=*&a=*&o=*&cat="+cat+"&sub_cat=*&pa=*&pb=*&dh=*&ord_by=entry_date:desc&rpp=6&om=*";
	Searching(str, false);
}

function Searching(u,rapidos){
	if(rapidos==true){
		var u='http://www.dzdeal.com/search_gate/index.php?advancedsearch=r&'+u;
		$("#rr").html('<img src="http://www.dzdeal.com/images/loader.gif"/> Verification');
		$.post(u, function(data){
			if(data=='ERROR_STRING_INVALID'){
			$("#rr").html('<span style="color:#FF0000;">Term invalid!</span>');
			Al('designation',true);
			return;
			}
			$("#rr").html(data);
			return;
 	});
	return;
	}
	var container='TopLeft';
	$("#"+container).html('<div id="lll">Recherche en cours</div>');
	var u='http://www.dzdeal.com/search_gate/index.php?advancedsearch=1&'+u;
	$.post(u, function(data){
			$("#"+container).html(data);
			return;
 	});
}

function l5d(){
	var u='../Accueil/?l5d=1&sid='+sid();
	$$$('l5d').innerHTML='<img src="../images/ajax.gif" style="margin-left:55px;margin-top:0px;"/>';
	$.post(u, function(data){
			$$$('l5d').innerHTML=data;
			return;
 	});
}

function uo(){
	
}
function Fav(did){
	var u='http://www.dzdeal.com/inc/engine.php?fav='+did;
	var spn='favBtn'+did;
	$$$(spn).innerHTML='<img src="http://www.dzdeal.com/images/loader.gif" style="margin:0 30px;"/>';
	$.post(u, function(data){
		$$$(spn).innerHTML=data;
	});
}
function modifydeal(deal){
	location.href='../existing/?d='+deal;
}

function getdealsof(dealer){
	var u='http://www.dzdeal.com/his_ads/?d='+dealer;
	scr(100);
	var container='TopLeft';
	$("#"+container).html('<div id="lll">Chargement en cours...</div>');
	$.post(u, function(data){
			$("#"+container).html(data);
			return;
 	});
}

function getItems(sub_cat){
	var trade=v('marque');
	var u='../new/?getItems='+sub_cat+'&trade='+trade+'&sid='+sid();
	$$$("model_holder").innerHTML='<img src="../images/loader_.gif"/>';
	$.post(u, function(data){
			$$$("model_holder").innerHTML=data;
			return;
 	});
}

function wst(Y){window.scrollTo(0, Y);}

function reCaptcha(){$$$('captchaFrame').src='../inc/Captcha.php';}

function gv(region,prin,custom_id){
	if(!custom_id) custom_id='ville';
	if(region=='NONE') return;
	if(region=='ALL') return c(prin);
	var u='http://www.dzdeal.com/Accueil/index.php?gv='+region+'&custom_id='+custom_id+'&sid='+sid();
	$("#"+prin).html('<div id="lll" style="padding:0;padding-left:22px;width:150px;margin:0;">Patientez svp</div>');
	$.post(u, function(data){
		$("#"+prin).html(data);
		return;
 	});
}



function numbersonly(e,ch) {
if(ch==undefined) H='price_error'; else H=ch;
var unicode=e.charCode? e.charCode : e.keyCode;
if(unicode!=8){
	if(unicode<48 || unicode>57){
	within(H,'Uniquement des chiffres svp.',3000,true);
	return false;
	}
	else{
	c(H);
	$$$(H).innerHTML='&nbsp;';
	return true;
	
	}
}
}


function Al(i,BLNK,MSG){
	st(i).background='red';
	if(MSG==undefined)MSG='';
	if(BLNK) setTimeout("Blink('"+i+"','"+MSG+"')",150);
}

function Blink(el, m){
	if(m)alert(m);
	try{
		var C=100;
		var N_TOUT;
		var bgcol='red';
		var fcol='white';
		for(var I=1; I<8; I++){
		N_TOUT = I * C;
		if(bgcol=='red') {
			bgcol='white';
			fcol='red';
		}else{
			bgcol='red';
			fcol='white';
		}
		setTimeout("st('"+el+"').background='"+bgcol+"';st('"+el+"').color='"+fcol+"'",N_TOUT);
		if(I==7) setTimeout("st('"+el+"').color='gray'",N_TOUT+100);
		}
	}catch(e){}
}

function s_of(i,w,s){(w==true) ? w=false : w=true; $(i).disabled=w; if(w==true && !s)t_l(i); else t_l(i,s);}
function t_l(i,s){try{if(!s)$(i).options[0].selected=true; else $(i).options[s].selected=true;}catch(e){}}
function st(elem){return $$$(elem).style;}