function changeSector()
{
	document.frm.submit();
}

function submitForm()
{
	document.frm.submit();
}

function switchPageDetail(url)
{
	document.frm.action = url;
	document.frm.submit();
}

function profilModification(id)
{
	var confirmation = confirm("Votre profil sera modifié. Souhaitez-vous continuer?");
	if(confirmation){
	document.getElementById("userAction").value = "profilModification";
	document.getElementById("memberID").value = id;
	document.frm.action = "admin/adminActionUser.php";
	document.frm.submit();
	}
}

function addClassified()
{
	document.getElementById("userAction").value = "addClassified";
	document.frm.action = "admin/adminActionUser.php";
	document.frm.submit();
}

function modifyClassified(id)
{
	var confirmation = confirm("Cette annonce sera modifiée. Souhaitez-vous continuer?");
	if(confirmation){
	document.getElementById("userAction").value = "modifyClassified";
	document.getElementById("adID").value = id;
	document.frm.action = "admin/adminActionUser.php";
	document.frm.submit();
	}
}

function deleteClassified(id)
{
	var confirmation = confirm("Cette annonce sera supprimée. Souhaitez-vous continuer?");
	if(confirmation){
	document.getElementById("userAction").value = "deleteClassified";
	document.getElementById("adID").value = id;
	document.frm.action = "admin/adminActionUser.php";
	document.frm.submit();
	}
}

function addHomeService()
{
	document.getElementById("userAction").value = "addHomeService";
	document.frm.action = "admin/adminActionUser.php";
	document.frm.submit();
}

function modifyHomeService(id)
{
	var confirmation = confirm("Cette fiche sera modifiée. Souhaitez-vous continuer?");
	if(confirmation){
	document.getElementById("userAction").value = "modifyHomeService";
	document.getElementById("adID").value = id;
	document.frm.action = "admin/adminActionUser.php";
	document.frm.submit();
	}
}

function deleteHomeService(id)
{
	var confirmation = confirm("Cette fiche sera supprimée. Souhaitez-vous continuer?");
	if(confirmation){
	document.getElementById("userAction").value = "deleteHomeService";
	document.getElementById("adID").value = id;
	document.frm.action = "admin/adminActionUser.php";
	document.frm.submit();
	}
}

function addStoreService()
{
	document.getElementById("userAction").value = "addStoreService";
	document.frm.action = "admin/adminActionUser.php";
	document.frm.submit();
}

function modifyStoreService(id)
{
	var confirmation = confirm("Cette fiche sera modifiée. Souhaitez-vous continuer?");
	if(confirmation){
	document.getElementById("userAction").value = "modifyStoreService";
	document.getElementById("adID").value = id;
	document.frm.action = "admin/adminActionUser.php";
	document.frm.submit();
	}
}

function deleteStoreService(id)
{
	var confirmation = confirm("Cette fiche sera supprimée. Souhaitez-vous continuer?");
	if(confirmation){
	document.getElementById("userAction").value = "deleteStoreService";
	document.getElementById("adID").value = id;
	document.frm.action = "admin/adminActionUser.php";
	document.frm.submit();
	}
}

function uploadImage(memberID,id)
{
	document.getElementById("memberID").value = memberID;
	document.getElementById("adID").value = id;
	document.frm.action = "inc-gestion-image.php";
	document.frm.submit();
}

function uploadLogo(id)
{
	document.getElementById("memberID").value = id;
	document.frm.action = "inc-gestion-image.php";
	document.frm.submit();
}

function deleteImage(id,adID,imagePath)
{
	var confirmation = confirm("Cette image sera supprimée. Souhaitez-vous continuer?");
	if(confirmation){
	document.getElementById("userAction").value = "deleteImage";
	document.getElementById("imageID").value = id;
	document.getElementById("adID").value = adID;
	document.getElementById("imagePath").value = imagePath;
	document.frm.action = "admin/adminActionUser.php";
	document.frm.submit();
	}
}

function deleteLogo(id,memberID,imagePath)
{
	var confirmation = confirm("Cette image sera supprimée. Souhaitez-vous continuer?");
	if(confirmation){
	document.getElementById("userAction").value = "deleteImage";
	document.getElementById("imageID").value = id;
	document.getElementById("memberID").value = memberID;
	document.getElementById("imagePath").value = imagePath;
	document.frm.action = "admin/adminActionUser.php";
	document.frm.submit();
	}
}

function orderList(o)
{
	document.getElementById("order").value = o;
	document.frm.action = "";
	document.frm.submit();
}

function passwordRecovery() {
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(frm.userName.value)){
		document.getElementById("userAction").value = "passwordRecovery";
		document.frm.action = "admin/adminActionUser.php";
		document.frm.submit();
	}
	else{
		alert("Inscrivez le courriel relatif à votre compte");
	}
}

/*
Simple Image Trail script- By JavaScriptKit.com
Visit http://www.javascriptkit.com for this script and more
This notice must stay intact
*/

var offsetfrommouse=[15,25]; //image x,y offsets from cursor position in pixels. Enter 0,0 for no offset
var displayduration=0; //duration in seconds image should remain visible. 0 for always.

var defaultimageheight = 40;	// maximum image size.
var defaultimagewidth = 40;	// maximum image size.

var timer;

function PopupImage(img) {
	titre="sos-informatik.com";
	w=open("",'image','width=400,height=400,toolbar=no,scrollbars=yes,resizable=no');	
	w.document.write("<HTML><HEAD><TITLE>"+titre+"</TITLE></HEAD>");
	w.document.write("<SCRIPT language=javascript>function checksize()  { if (document.images[0].complete) {  window.resizeTo(document.images[0].width+12,document.images[0].height+30); window.focus();} else { setTimeout('check()',250) } }</"+"SCRIPT>");
	w.document.write("<BODY onload='checksize()' leftMargin=0 topMargin=0 marginwidth=0 marginheight=0><IMG src='"+img+"' border=0>");
	w.document.write("");
	w.document.write("</BODY></HTML>");
	w.document.close();
}

var t_id = setInterval(animate,20);
var pos=0;
var dir=2;
var len=0;

function animate()
{
var elem = document.getElementById('progress');
if(elem != null) {
if (pos==0) len += dir;
if (len>32 || pos>79) pos += dir;
if (pos>79) len -= dir;
if (pos>79 && len==0) pos=0;
elem.style.left = pos;
elem.style.width = len;
}
}

function remove_loading() {
this.clearInterval(t_id);
var targelem = document.getElementById('loader_container');
targelem.style.display='none';
targelem.style.visibility='hidden';
var t_id = setInterval(animate,60);
}

function gettrailobj(){
if (document.getElementById)
return document.getElementById("preview_div").style
}

function gettrailobjnostyle(){
if (document.getElementById)
return document.getElementById("preview_div")
}


function truebody(){
return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}


function hidetrail(){	
	gettrailobj().display= "none";
	document.onmousemove=""
	gettrailobj().left="-500px"
	clearTimeout(timer);
}

function showtrail(imagename,title,width,height){
	i = imagename
	t = title
	w = width
	h = height
	timer = setTimeout("show('"+i+"',t,w,h);",200);
}
function show(imagename,title,width,height){
    var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth - offsetfrommouse[0]
	var docheight=document.all? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(window.innerHeight)

	if( (navigator.userAgent.indexOf("Konqueror")==-1  || navigator.userAgent.indexOf("Firefox")!=-1 || (navigator.userAgent.indexOf("Opera")==-1 && navigator.appVersion.indexOf("MSIE")!=-1)) && (docwidth>650 && docheight>500)) {
		( width == 0 ) ? width = defaultimagewidth: '';
		( height == 0 ) ? height = defaultimageheight: '';
			
		//width+=30
		//height+=55
		defaultimageheight = height
		defaultimagewidth = width
	
		document.onmousemove=followmouse; 
		
		newHTML = '<div class="border_preview" style="width:'+  width +'px;height:'+ height +'px"><div id="loader_container"><div id="loader"><div id="loader_bg"><div id="progress"> </div></div></div></div>';
		//newHTML = newHTML + '<h2 class="title_h2">' + ' '+title + '</h2>'
		
    	newHTML = newHTML + '<div class="preview_temp_load"><img onload="javascript:remove_loading();" src="' + imagename + '" border="0"></div>';
		newHTML = newHTML + '</div>'; 
		
		if(navigator.userAgent.indexOf("MSIE")!=-1 && navigator.userAgent.indexOf("Opera")==-1 ){
			newHTML = newHTML+'<iframe src="about:blank" scrolling="no" frameborder="0" width="'+width+'" height="'+height+'"></iframe>';
		}		

		gettrailobjnostyle().innerHTML = newHTML;
		gettrailobj().display="block";
	}
}

function followmouse(e){

	var xcoord=offsetfrommouse[0]
	var ycoord=offsetfrommouse[1]

	var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-15
	var docheight=document.all? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(window.innerHeight)

	if (typeof e != "undefined"){
		if (docwidth - e.pageX < defaultimagewidth + 2*offsetfrommouse[0]){
			xcoord = e.pageX - xcoord - defaultimagewidth; // Move to the left side of the cursor
		} else {
			xcoord += e.pageX;
		}
		if (docheight - e.pageY < defaultimageheight + 2*offsetfrommouse[1]){
			ycoord += e.pageY - Math.max(0,(2*offsetfrommouse[1] + defaultimageheight + e.pageY - docheight - truebody().scrollTop));
		} else {
			ycoord += e.pageY;
		}

	} else if (typeof window.event != "undefined"){
		if (docwidth - event.clientX < defaultimagewidth + 2*offsetfrommouse[0]){
			xcoord = event.clientX + truebody().scrollLeft - xcoord - defaultimagewidth; // Move to the left side of the cursor
		} else {
			xcoord += truebody().scrollLeft+event.clientX
		}
		if (docheight - event.clientY < (defaultimageheight + 2*offsetfrommouse[1])){
			ycoord += event.clientY + truebody().scrollTop - Math.max(0,(2*offsetfrommouse[1] + defaultimageheight + event.clientY - docheight));
		} else {
			ycoord += truebody().scrollTop + event.clientY;
		}
	}
	gettrailobj().left=xcoord+"px"
	gettrailobj().top=ycoord+"px"

}

function openWindow() {
	w=window.open("politique-conditions-utilisations.php",'','width=400,height=500,toolbar=no,scrollbars=yes,resizable=no');	
	w.document.close();
}

function SUC(champ) //~~ initialisation ~~ Saisir Uniquement des Chiffres
//~~~~~~~~~~~~~~~~~~~~~~~~~~ #        #                             #
{
 this.champ=champ;
 var Lui=this;
 var ie = false; /*@cc_on ie = true; @*/
 if ( ie ) {
     this.champ.onkeypress = Lui.IE;
    }
 else  { 
     this.champ.onkeyup = function(e)
      {
       Lui.FF(this, e);
      }
    }
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUC.prototype.IE=function() //~~ pour Internet Explorer ~~
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
{
 if ( event.keyCode<0x30 || event.keyCode>0x39 )
 {
  event.returnValue= false;
 }
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUC.prototype.FF=function(zone,evt) //~~ pour FireFox ~~
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
{
 if ( evt.which<0x30 || evt.which>0x39 )
 {
  zone.value=zone.value.replace(/[^0-9]/g,"");
 }
}