if(navigator.appName == 'Microsoft Internet Explorer'){
	largScreen = document.documentElement.clientWidth;
	hautScreen = document.documentElement.clientHeight;
}
else{
	largScreen = window.innerWidth;
	hautScreen = window.innerHeight;
}

function onlynumbers(f) {
	if (!/^\d*$/.test(f.value)) {
		//alert("Ce champ ne doit contenir que des chiffres !");
		f.value = f.value.replace(/[^\d]/g,"");
	}
} 

function getXhr() {

	var xhr_object = null;
	
	if(window.XMLHttpRequest)
	   xhr_object = new XMLHttpRequest();
	else if(window.ActiveXObject)
	   xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
	else
	   alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
	   
	return xhr_object;
}

function setNationality() {

	v=document.getElementById("nationality").value;
	if(v!=-2 && v!=-1) {
		document.location.href="index.php?p=home&nationality="+v;
		}
	return false;
}


function fav () { 
    siteURL = "http://www.annonces.co.il/" 
    siteNOM = "[Annonces.co.il] - Le Portail Juif des annonces gratuites"
    function myMessage (raccourciClavier) { 
        alert ("Utilisez '" + raccourciClavier + "'\npour ajouter " + siteNOM + " dans vos favoris !"); 
    } 

    //Konqueror 
    if (navigator.userAgent.indexOf('Konqueror') >= 0) { 
    /*Test a effectuer avant tout les autres car repond TRUE aux differents tests sans pouvoir les exploiter*/ 
        myMessage("CTRL + B"); 
    } 
     
    else if (window.external) { 
        /* Internet Explorer 4+, et ses dÃ©rivÃ©s (Crazy Browser, Avent Browser ...) */ 
        window.external.AddFavorite(siteURL,siteNOM); 
    } 
  
    else if (document.all && (navigator.userAgent.indexOf('Win') < 0)) { 
        /* Internet Explorer Mac */ 
        myMessage("POMME + D"); 
    } 
     
    else if (window.opera && window.print) { 
        /* Opera 6+ */ 
        myMessage("CTRL + T"); 
    } 
     
    else if (window.sidebar) { 
        /* Netscape 6+ ; Mozilla, FireFox et compagnie (K-Meleon ...) */ 
        window.sidebar.addPanel(siteNOM,siteURL,""); 
    } 
     
    else if (document.layers) { 
        /* Netsccape 4 */ 
        myMessage("CTRL + D"); 
    } 
     
    else alert ("Cette fonction n'est pas disponible pour votre navigateur."); 
}

function setHeading() {
				
	v=document.getElementById("heading").value;
	document.location.href="index.php?p=publier-annonce&head_inner="+v;
}

function setHeading_2() {
				
	v=document.getElementById("heading").value;
	document.location.href="index.php?p=mes-annonces&head_inner="+v;
}

function setHeading_3() {
				
	v=document.getElementById("heading").value;
	document.location.href="index.php?p=creer-alerte&head_inner="+v;
}


function compter(f) {

	var max=1000;
	var txt=f.description.value;
	var nb=txt.length;
	if (nb>max) { 
		alert("Pas plus de "+max+" caracteres dans ce champ");
		f.description.value=txt.substring(0,max);
		nb=max;
	}
	f.nbcar.value=(1000-nb);
}

function setCountry() {

	xhr_object = getXhr();	
	
	selection = document.getElementById('country');
	idCountry = selection.options[selection.selectedIndex].value;
											
	xhr_object.open( "POST", "ajax-server.php", true );
	
	xhr_object.setRequestHeader( "Content-type", "application/x-www-form-urlencoded" ); 
	
	xhr_object.send( "idCountry="+idCountry );
	
	xhr_object.onreadystatechange = function() {
		if(xhr_object.readyState == 4 && xhr_object.status == 200)
		{
			document.getElementById('regiondiv').innerHTML = xhr_object.responseText;
		}
	}
}

function ajasm_showbox(cibleid) {
	document.getElementById(cibleid).style.display='block';
}
function ajasm_closebox(cibleid) {
	document.getElementById(cibleid).style.display='none';
}

function setabuse(vv) {
	abuseval=vv;
	document.getElementById("btok").disabled=false;
}

function ajasm_abuse() {
	m=abuseval;
	if (m==0) return false;
	
	document.getElementById("testes").innerHTML='';
	
	ajasm_obj=getXhr();
	
	ajasm_obj.open( "GET", "ajax-server.php?abuseEval="+m, true );
	ajasm_obj.send(null);

	ajasm_obj.onreadystatechange = function() {   
		if ((ajasm_obj.readyState == 4)&&(ajasm_obj.status==200)) {
			document.getElementById("testes").innerHTML=ajasm_obj.responseText;
			document.getElementById("btok").disabled=true;
		}
	}
	/*ajasm_obj.send(null);*/
}

function ajasm_friend() {

	a=document.getElementById("his_mail").value;
	
	document.getElementById("resmes").innerHTML='';
	
	ajasm_obj=getXhr();
	
	ajasm_obj.open( "GET", "ajax-server.php?his_mail="+a, true );
	ajasm_obj.send(null);

	ajasm_obj.onreadystatechange = function() {   
		if ((ajasm_obj.readyState == 4)&&(ajasm_obj.status==200)) {
			document.getElementById("resmes").innerHTML=ajasm_obj.responseText;
			document.getElementById("btok2").disabled=true;
		}
	}
	/*ajasm_obj.send(null);*/
}

function ajasm_reply() {

	c=document.getElementById("announce_mail").value;
	
	document.getElementById("resmes2").innerHTML='';
	
	ajasm_obj=getXhr();
	
	ajasm_obj.open( "GET", "ajax-server.php?announce_mail="+c, false );
	ajasm_obj.send(null);

  b=document.getElementById("message").value;
  id=document.getElementById("announce_id").value;

	document.getElementById("resmes2").innerHTML='';
	
	ajasm_obj=getXhr();

	ajasm_obj.open( "GET", "ajax-server.php?message="+b+"&id="+id, true );
	ajasm_obj.send(null);

	ajasm_obj.onreadystatechange = function() {   
		if ((ajasm_obj.readyState == 4)&&(ajasm_obj.status==200)) {
			document.getElementById("resmes2").innerHTML=ajasm_obj.responseText;
			document.getElementById("btok3").disabled=true;
		}
	}
	/*ajasm_obj.send(null);*/
}


function ShowUploadBox(source_id) {
	document.getElementById("uploaddiv").style.left=0+source_id.offsetLeft+"px";
	document.getElementById("uploaddiv").style.top=150+source_id.offsetHeight+"px";
	ajasm_showbox('uploaddiv');
}

function deletepic(pn) {
	document.getElementById("dpic").value=pn;
	frm_UP.submit();
}

function dspbar(sflag) {
	document.getElementById("updiv").style.display='block';
	document.getElementById("waitdiv").style.display='none';
	if (sflag) {
		document.getElementById("updiv").style.display='none';
		document.getElementById("waitdiv").style.display='block';
	}
}
function btstates() {
	vb=document.getElementById("photo").value;
	stt1=false;
	stt2=true;
	state='none';
	if (vb!="") {
		stt1=true;
		stt2=false;
		state='block';
	}
	document.getElementById("finish").disabled=stt1;
	document.getElementById("uploadit").disabled=stt2;
	document.getElementById("blkimg").style.display=state;
}

function openBook(){
	var container = document.createElement('div');
	container.style.height = hautScreen+'px';
	container.style.width = largScreen+'px';
	container.style.top = '0px';
	container.style.left = '0px';
	container.style.backgroundColor = 'black';
	container.style.opacity = '0.9';
	container.style.position = 'fixed';

	var player = document.createElement('div');
	player.style.height = '500px';
	player.style.width = '650px';
	player.style.left = (largScreen/2)-320+'px';
	player.style.top = '50px';
	player.style.backgroundColor = 'white';
	player.style.border = '1px solid black';
	player.style.padding = '5px';
	player.style.position = 'fixed';
	
	player.innerHTML = '<div><p style="float: left; padding: 5px; margin: 0; font-size: 16px; font-family: Georgia;"><b>Se Loger</b></p><p style="float: right; text-align: right; padding: 5px; margin: 0;"><a href="#" onclick="closeBook(this); return false;"><img src="images/fermer.png" alt="close" title="Fermer" width=20 height=20 border=0 /></a></p></div>';
	player.innerHTML += '<div><object style="width:650px;height:455px" ><param name="movie" value="http://static.issuu.com/webembed/viewers/style1/v1/IssuuViewer.swf?mode=embed&amp;layout=http%3A%2F%2Fskin.issuu.com%2Fv%2Flight%2Flayout.xml&amp;showFlipBtn=true&amp;documentId=110601083518-4d6777cb452c46a3ba3f70d6aac2563c&amp;docName=seloger_5&amp;username=tobeweb&amp;loadingInfoText=Se%20Loger&amp;et=1307431058368&amp;er=91" /><param name="allowfullscreen" value="true"/><param name="menu" value="false"/><embed src="http://static.issuu.com/webembed/viewers/style1/v1/IssuuViewer.swf" type="application/x-shockwave-flash" allowfullscreen="true" menu="false" style="width:650px;height:455px" flashvars="mode=embed&amp;layout=http%3A%2F%2Fskin.issuu.com%2Fv%2Flight%2Flayout.xml&amp;showFlipBtn=true&amp;documentId=110601083518-4d6777cb452c46a3ba3f70d6aac2563c&amp;docName=seloger_5&amp;username=tobeweb&amp;loadingInfoText=Se%20Loger&amp;et=1307431058368&amp;er=91" /></object><div style="width:650px;text-align:left;"><a href="http://issuu.com/tobeweb/docs/seloger_5?mode=embed&amp;layout=http%3A%2F%2Fskin.issuu.com%2Fv%2Flight%2Flayout.xml&amp;showFlipBtn=true" target="_blank">Open publication</a> - Free <a href="http://issuu.com" target="_blank">publishing</a> - <a href="http://issuu.com/search?q=immobilier" target="_blank">More immobilier</a></div></div>';

	container.appendChild(player);
	document.getElementById('contentAll').style.display = 'none';
	document.body.appendChild(container);
}

function closeBook(img_close){
	img_close.parentNode.parentNode.parentNode.parentNode.parentNode.removeChild(img_close.parentNode.parentNode.parentNode.parentNode);
	document.getElementById('contentAll').style.display = 'block';
}

window.onload = function(){

}
