/////////////////////////////////////////////////////
//                                                 //
//  DEFAULT SCRIPTS                                //
//  ---------------------------------------------  //
/////////////////////////////////////////////////////


/////////////////////////////////////////////////////
//                                                 //
//  LIBRAIRIE DHTML                                //
//  ---------------------------------------------  //
/////////////////////////////////////////////////////

var exclude=1, agt=navigator.userAgent.toLowerCase(), ie=0, ns=0, op=0, mz7=0, kde=0, saf=0, fx=0, w3c=0;
var myObj, object;

//Configurables
var domaine='id-find.com';

if(typeof navigator.vendor!="undefined" && navigator.vendor=="KDE"){
	var thisKDE=agt;
	var splitKDE=thisKDE.split("konqueror/");
	var aKDE=splitKDE[1].split("; ");
	var KDEn=parseFloat(aKDE[0]);
	if(KDEn>=2.2){kde=1; ns=1; exclude=0;}
	}
else if(agt.indexOf('webtv')!=-1){exclude=1;}
else if(typeof window.opera!="undefined"){
	exclude=0;
	if(/opera[\/ ][5]/.test(agt)){op=1;}
	if(/opera[\/ ][6]/.test(agt)){op=1;}
	if(/opera[\/ ][7-9]/.test(agt)){op=1;}
	}
else if(typeof document.all!="undefined"&&!kde){
	exclude=0;
	if(typeof document.getElementById!="undefined"){ie=1}
	}
else if(typeof document.getElementById!="undefined"){
	exclude=0;
	if (agt.indexOf("firefox")!=-1){fx=1;}
	if(agt.indexOf("netscape")!=-1){ns=1;}
	else if(agt.indexOf("gecko")!=-1){mz7=1;}
	if(agt.indexOf("safari")!=-1 || (typeof document.childNodes!="undefined" && typeof document.all=="undefined" && typeof navigator.taintEnabled=="undefined")){mz7=0;saf=1;}
	}
else if((agt.indexOf('mozilla')!=-1)&&(parseInt(navigator.appVersion)>=4)){exclude=1}
if(agt.indexOf('escape')!=-1){exclude=1}
if(typeof navigator.__ice_version!="undefined"){exclude=1}

w3c = (ie || ns || fx || saf);


// FONCTIONS DHTML ***********************************************

function getInputValue(objId,ieObj,nsObj){
	if (w3c){
		myObj = document.getElementById(objId);
		if (myObj != null) {
			if (fx || saf){
				return myObj.value
			}else{
				return myObj.getAttribute('value')
			}
		}else{ return '' }
	}else{
		if (ie) {
			myObj = eval(ieObj);
			if (myObj != null) {
				return myObj.value
			}else{ return '' }
		}else{
			myObj = eval(nsObj);
			if (myObj != null) {
				return myObj.value
			}else{ return '' }
}}}

function getSelectValue(objId,ieObj,nsObj){
	if (w3c){
		myObj = document.getElementById(objId);
		if (myObj != null) {
			return myObj.options[myObj.selectedIndex].value
		}else{ return '' }
	}else{
		if (ie) {
			myObj = eval(ieObj);
			if (myObj != null) {
				return myObj.options[myObj.selectedIndex].value
			}else{ return '' }
		}else{
			myObj = eval(nsObj);
			if (myObj != null) {
				return myObj.options[myObj.selectedIndex].value
			}else{ return '' }
}}}

function focusOnObject(objId,ieObj,nsObj){
	if (w3c){
		myObj = document.getElementById(objId);
	}else{
		(ie) ? myObj = eval(ieObj) : myObj = eval(nsObj)
	}
	if (myObj != null){
		myObj.focus();
		myObj.select();
}}

function submitForm(formId,ieFormId,nsFormId){
	if (w3c){
		myObj = document.getElementById(formId);
		if (myObj != null) myObj.submit()
	}else{
		(ie) ? myObj = eval(ieFormId) : myObj = eval(nsFormId)
		if (myObj != null) myObj.submit()
}}


function setPicture(objId,value){
	object = document.getElementById(objId);
    if (object != null){ 
        object.src = value
    }
}


// FONCTIONS DIVERSES *******************************************

function openWindow(whichOne,tools,scrolling,resize,w,h){
	var t = parseInt((screen.availHeight - h)/2);
	var l = parseInt((screen.availWidth - w)/2);
	tcsopen = window.open(whichOne, domaine,'toolbar='+tools+',location=no,directories=no,status=yes,menubar=no,scrollbars='+scrolling+',resizable='+resize+',width='+w+',height='+h+',top='+t+',left='+l);
	if (ie) {
		if (tcsopen.closed==false) tcsopen.focus()
	}else{
		tcsopen.focus()
	}
}

function openWindowNoStatus(whichOne,tools,scrolling,resize,w,h){
	var t = parseInt((screen.availHeight - h)/2);
	var l = parseInt((screen.availWidth - w)/2);
	
	tcsopen = window.open(whichOne,'idf','toolbar='+tools+',location=no,directories=no,status=no,menubar=no,scrollbars='+scrolling+',resizable='+resize+',width='+w+',height='+h+',top='+t+',left='+l);
	if (document.all) {
		if (tcsopen.closed==false) tcsopen.focus()
	}else{
		tcsopen.focus()
	}
}

function swapImgRestore() {
  var i,x,a=document.sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function preloadImages() { 
  var d=document; if(d.images){ if(!d.p) d.p=new Array();
    var i,j=d.p.length,a=preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.p[j]=new Image; d.p[j++].src=a[i];}}
}

function findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function swapImage() {
  var i,j=0,x,a=swapImage.arguments; document.sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=findObj(a[i]))!=null){document.sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function showLayer(objId){
	if (w3c){
		var styleObject;
		myObj = document.getElementById(objId);
		if (myObj != null){
			styleObject = myObj.style;
            styleObject['visibility'] = 'visible';
		}
	}else{alert("Le site n'est pas compatible avec votre navigateur.")}	
}

function hideLayer(objId){
	if (w3c){
		var styleObject;
		myObj = document.getElementById(objId);
		if (myObj != null){
			styleObject = myObj.style;
            styleObject['visibility'] = 'hidden';
		}
	}else{alert("Le site n'est pas compatible avec votre navigateur.")}
}

function deplaceLayer(objId, l, t){
	if (w3c){
		var styleObject;
		myObj = document.getElementById(objId);
		if (myObj != null){
			styleObject = myObj.style;
            styleObject['left'] = l;
            styleObject['top'] = t;
		}
	}else{alert("Le site n'est pas compatible avec votre navigateur.")}
}


