// Dynamic Layer Object
// sophisticated layer/element targeting and animation object which provides the core functionality needed in most DHTML applications
// 19990604

// Copyright (C) 1999 Dan Steinman
// Distributed under the terms of the GNU Library General Public License
// Available at http://www.dansteinman.com/dynapi/
////////////////////////////////////////////////////////////////
//On a change write methode pour ns5. 2001 par BeauBeau
//On a change clip methode; ie = ns5, "ns" a ete change a "ns4" . 2001 par BeauBeau
//On a change pour ns5 this.x ....+ 'px' 2002 par BeauBeau
////////////////////////////////////////////////////////////////
function DynLayer(id,nestref,frame) {
	//if (!is.ns5 && !DynLayer.set && !frame) DynLayerInit();
	if (!DynLayer.set && !frame) DynLayerInit();//by BeauBeau 2003
	this.frame = frame || self;
	if (is.ns) {
		if (is.ns4) {
			if (!frame) {
				if (!nestref) var nestref = DynLayer.nestRefArray[id]
				if (!DynLayerTest(id,nestref)) return
				this.css = (nestref)? eval("document."+nestref+".document."+id) : document.layers[id]
			}
			else this.css = (nestref)? eval("frame.document."+nestref+".document."+id) : frame.document.layers[id]
			this.elm = this.event = this.css
			this.doc = this.css.document
		}
		else if (is.ns5) {
			this.elm = document.getElementById(id)
			this.css = this.elm.style
			this.doc = document
			}
		this.x =  (is.ns4)? this.css.left : this.elm.offsetLeft + 'px';//by BeauBeau
		this.y =  (is.ns4)? this.css.top : this.elm.offsetTop + 'px';//by BeauBeau
		this.w = (is.ns4)? this.css.clip.width : this.elm.offsetWidth + 'px'; //by BeauBeau
		this.h = (is.ns4)? this.css.clip.height : this.elm.offsetHeight + 'px'; //by BeauBeau
		
			}
	else if (is.ie) {
		if(is.ie4){
			this.elm = this.event = this.frame.document.all[id]
			this.css = this.frame.document.all[id].style
			this.doc = document
		}
		else{///////////////////////is.ie5, is.ie6/////////////////////////by BeauBeau
			this.elm = this.event = document.getElementById(id)
			this.css = this.elm.style
			this.doc = document
		}
		this.x = this.elm.offsetLeft
		this.y = this.elm.offsetTop
		this.w = (is.ie4)? this.css.pixelWidth : this.elm.offsetWidth//by BeauBeau
		this.h = (is.ie4)? this.css.pixelHeight : this.elm.offsetHeight//by BeauBeau
		
	}
	this.id = id
	this.nestref = nestref
	this.obj = id + "DynLayer"
	eval(this.obj + "=this")
}
/*function DynLayerCopyProp(){
	this.propArray = new Array();
	this.propArray[0] = this.elm;
	this.propArray[1] = this.event;
	this.propArray[2] = this.doc;
	this.propArray[3] = this.x;
	this.propArray[4] = this.y;
	this.propArray[5] = this.w;
	this.propArray[6] = this.h;
	this.propArray[7] = this.id;
	this.propArray[8] = this.frame;
	return this.propArray;
}
DynLayer.prototype.copyProp = DynLayerCopyProp;*/
function DynLayerMoveTo(x,y) {
	if (x!=null) {
		this.x = x
		if (is.ns || is.ie5over) this.css.left = (is.ns5over)? this.x + 'px': this.x;
		else this.css.pixelLeft = this.x
	}
	if (y!=null) {
		this.y = y
		if (is.ns || is.ie5over) this.css.top = (is.ns5over)? this.y + 'px': this.y;
		else this.css.pixelTop = this.y
	}
}
function DynLayerMoveBy(x,y) {
	this.moveTo(parseFloat(this.x)+x,parseFloat(this.y)+y)
}
function DynLayerShow() {
	this.css.visibility = (is.ns4)? "show" : "visible"
}
function DynLayerHide() {
	this.css.visibility = (is.ns4)? "hide" : "hidden"
}
DynLayer.prototype.moveTo = DynLayerMoveTo
DynLayer.prototype.moveBy = DynLayerMoveBy
DynLayer.prototype.show = DynLayerShow
DynLayer.prototype.hide = DynLayerHide
DynLayerTest = new Function('return true')

// DynLayerInit Function
function DynLayerInit(nestref) {
	if (!DynLayer.set) DynLayer.set = true
	if (is.ns4) {
		if (nestref) ref = eval('document.'+nestref+'.document')
		else {nestref = ''; ref = document;}
		for (var i=0; i<ref.layers.length; i++) {
			var divname = ref.layers[i].name
			DynLayer.nestRefArray[divname] = nestref
			var index = divname.indexOf("Div")
			if (index > 0) {
				eval(divname.substr(0,index)+' = new DynLayer("'+divname+'","'+nestref+'")')
			}
			if (ref.layers[i].document.layers.length > 0) {
				DynLayer.refArray[DynLayer.refArray.length] = (nestref=='')? ref.layers[i].name : nestref+'.document.'+ref.layers[i].name
			}
		}
		if (DynLayer.refArray.i < DynLayer.refArray.length) {
			DynLayerInit(DynLayer.refArray[DynLayer.refArray.i++])
		}
	}
	else if (is.ie4) {
		for (var i=0; i<document.all.tags("DIV").length; i++) {
			var divname = document.all.tags("DIV")[i].id
			var index = divname.indexOf("Div")
			if (index > 0) {
				eval(divname.substr(0,index)+' = new DynLayer("'+divname+'")')
			}
		}
	}
	else if (is.iens5over) {
		for (var i=0; i<document.getElementsByTagName("DIV").length; i++) {
			if(document.getElementsByTagName("DIV")[i].id != ''){
				var divname = document.getElementsByTagName("DIV")[i].id
				var index = divname.indexOf("Div")
				if (index > 0) {//alert(divname+' ,'+index+' ,'+divname.substr(0,index))
					eval(divname.substr(0,index)+' = new DynLayer("'+divname+'")');
				}
			}
		}
	}
	return true
}
DynLayer.nestRefArray = new Array()
DynLayer.refArray = new Array()
DynLayer.refArray.i = 0
DynLayer.set = false

// Slide Methods
function DynLayerSlideTo(endx,endy,inc,speed,fn) {
	if (endx == null) endx = parseFloat(this.x);
	if (endy == null) endy = parseFloat(this.y);
	var distx = endx - parseFloat(this.x);
	var disty = endy - parseFloat(this.y);
	this.slideStart(endx,endy,distx,disty,inc,speed,fn);
}
function DynLayerSlideBy(distx,disty,inc,speed,fn) {
	var endx = this.x + distx
	var endy = this.y + disty
	this.slideStart(endx,endy,distx,disty,inc,speed,fn)
}
function DynLayerSlideStart(endx,endy,distx,disty,inc,speed,fn) {
	if (this.slideActive) return
	if (!inc) inc = 10
	if (!speed) speed = 20
	var num = Math.sqrt(Math.pow(distx,2) + Math.pow(disty,2))/inc;
	if (num==0) return
	var dx = distx/num
	var dy = disty/num
	if (!fn) fn = null
	this.slideActive = true
	this.slide(dx,dy,endx,endy,num,1,speed,fn)
}
function DynLayerSlide(dx,dy,endx,endy,num,i,speed,fn) {
	if (!this.slideActive) return
	if (i++ < num) {//alert(i + ','+dy )
		this.moveBy(dx,dy)
		this.onSlide()
		if (this.slideActive) setTimeout(this.obj+".slide("+dx+","+dy+","+endx+","+endy+","+num+","+i+","+speed+",\""+fn+"\")",speed)
		else this.onSlideEnd()
	}
	else {
		this.slideActive = false
		this.moveTo(endx,endy)
		this.onSlide()
		this.onSlideEnd()
		eval(fn)
	}
}
function DynLayerSlideInit() {}
DynLayer.prototype.slideInit = DynLayerSlideInit
DynLayer.prototype.slideTo = DynLayerSlideTo
DynLayer.prototype.slideBy = DynLayerSlideBy
DynLayer.prototype.slideStart = DynLayerSlideStart
DynLayer.prototype.slide = DynLayerSlide
DynLayer.prototype.onSlide = new Function()
DynLayer.prototype.onSlideEnd = new Function()

// Clip Methods
function DynLayerClipInit(clipTop,clipRight,clipBottom,clipLeft) {
	if (is.ie || is.ns5) {
		if (arguments.length==4) this.clipTo(clipTop,clipRight,clipBottom,clipLeft)
		else if (is.ie4) this.clipTo(0,this.css.pixelWidth,this.css.pixelHeight,0)
	}
}
function DynLayerClipTo(t,r,b,l) {
	if (t==null) t = this.clipValues('t')
	if (r==null) r = this.clipValues('r')
	if (b==null) b = this.clipValues('b')
	if (l==null) l = this.clipValues('l')
	if (is.ns4) {
		this.css.clip.top = t
		this.css.clip.right = r
		this.css.clip.bottom = b
		this.css.clip.left = l
	}
	else if (is.ie || is.ns5) this.css.clip = "rect("+t+"px "+r+"px "+b+"px "+l+"px)"
}
function DynLayerClipBy(t,r,b,l) {
	this.clipTo(this.clipValues('t')+t,this.clipValues('r')+r,this.clipValues('b')+b,this.clipValues('l')+l)
}
function DynLayerClipValues(which) {
	if (is.ie || is.ns5) var clipv = this.css.clip.split("rect(")[1].split(")")[0].split("px")
	if (which=="t") return (is.ns4)? this.css.clip.top : Number(clipv[0])
	if (which=="r") return (is.ns4)? this.css.clip.right : Number(clipv[1])
	if (which=="b") return (is.ns4)? this.css.clip.bottom : Number(clipv[2])
	if (which=="l") return (is.ns4)? this.css.clip.left : Number(clipv[3])
}
DynLayer.prototype.clipInit = DynLayerClipInit
DynLayer.prototype.clipTo = DynLayerClipTo
DynLayer.prototype.clipBy = DynLayerClipBy
DynLayer.prototype.clipValues = DynLayerClipValues

// Write Method
function DynLayerWrite(html) {
	if (is.ns4) {				////////C'est ecrit par Beaubea
		this.doc.open()
		this.doc.write(html)
		this.doc.close()
	}
	else if(is.iens5over){				////////C'est ecrit par Beaubea
		this.elm.innerHTML = html	////////C'est ecrit par Beaubea
	}								////////C'est ecrit par Beaubea
	else if (is.ie4) {
		this.event.innerHTML = html
	}
}
DynLayer.prototype.write = DynLayerWrite

// BrowserCheck Object
function BrowserCheck() {
	var os = navigator.userAgent.toUpperCase();
	if(os.indexOf("MAC") >= 0) this.os = "MacOS";
	if(os.indexOf("WIN") >= 0) this.os = "windows";
	if(os.indexOf("X11") >= 0) this.os = "UNIX";
	if(os.indexOf("LINUX") >= 0) this.os = "Linux";
	if(!(this.os == "MacOS" || this.os == "windows" || this.os == "UNIX" || this.os == "Linux")) this.os = os;
	this.mac = (this.os == "MacOS");
	this.win = (this.os == "windows");
	this.unix = (this.os == "UNIX");
	this.linux = (this.os == "Linux");
	var b = navigator.appName;
	if (b=="Netscape") this.b = "ns";
	else if (b=="Microsoft Internet Explorer") this.b = "ie";
	else this.b = b;
	this.version = navigator.appVersion;
	this.v = parseInt(this.version);
	this.ns = (this.b=="ns" && this.v>=4);
	this.ns4 = (this.b=="ns" && this.v==4);
	this.ns5 = ((this.b=="ns" && this.v==5) || navigator.userAgent.indexOf('Gecko/')>0 || navigator.userAgent.indexOf('Opera')!=-1);
	this.ie = (this.b=="ie" && this.v>=4);
	this.ie4 = (navigator.userAgent.indexOf('MSIE 4')>0);
	this.ie5 = (navigator.userAgent.indexOf('MSIE 5')>0);
	this.ie6 = (navigator.userAgent.indexOf('MSIE 6')>0);
	this.ie7 = (navigator.userAgent.indexOf('MSIE 7')>0);
	if (this.ie4) this.v = 4;
	if (this.ie5) this.v = 5;
	if (this.ie6) this.v = 6;
	if (this.ie7) this.v = 7;
	if(navigator.userAgent.indexOf('Opera')!=-1 && this.ns5 && this.ie6) this.ns5 = false;
	this.min = (this.ns||this.ie);
	this.ns5over = (this.ns && this.v >= 5);//NS 5 and over
	this.ie5over = (this.ie && this.v >= 5);//IE 5 and over
	this.ie6over = (this.ie && this.v >= 6) ;//IE 6 and over
	if(document.layers) this.ns4 = true;
	if(!document.getElementById && document.all) this.ie4 = true;
	if(document.getElementById && !document.all){
		this.ns5 = true;
		this.ns5over = true;
	}
	if(document.getElementById && document.all){
		this.ie5over = true;
		this.ie6over =true;
	}
	this.iens5over = (this.ns5over || this.ie5over);//IE, NS 5 and over
	this.opera = navigator.userAgent.indexOf('Opera')!=-1;
	if(this.opera && this.v == 9) this.ns5over = true;
}
is = new BrowserCheck()

// CSS Function
function css(id,left,top,width,height,color,vis,z,other,other2,other3,other4,other5,other6,other7,other8,other9,other10,other11,other12) {
	if (id=="START") return '<style type="text/css">\n<\!\-\-\n'
	else if (id=="END") return '\-\->\n</style>\n'
	var str = (left!=null && top!=null)? '#'+id+' {position:absolute; left:'+left+'px; top:'+top+'px;' : '#'+id+' {position:relative;'
	if (arguments.length>=4 && width!=null) str += ' width:'+width+'px;'
	if (arguments.length>=5 && height!=null) {
		str += ' height:'+height+'px;'
		if (arguments.length<9 || other.indexOf('clip')==-1) str += ' clip:rect(0px '+width+'px '+height+'px 0px);'
	}
	if (arguments.length>=6 && color!=null) str += (is.ns4)? ' layer-background-color:'+color+';' : ' background-color:'+color+';'
	if (arguments.length>=7 && vis!=null) str += ' visibility:'+vis+';'
	if (arguments.length>=8 && z!=null) str += ' z-index:'+z+';'
	if (arguments.length>=9 && other!=null) str += ' '+other+';'
	if (arguments.length>=10 && other2!=null) str += ' '+other2+';'
	if (arguments.length>=11 && other3!=null) str += ' '+other3+';'
	if (arguments.length>=12 && other4!=null) str += ' '+other4+';'
	if (arguments.length>=13 && other5!=null) str += ' '+other5+';'
	if (arguments.length>=14 && other6!=null) str += ' '+other6+';'
	if (arguments.length>=15 && other7!=null) str += ' '+other7+';'
	if (arguments.length>=16 && other8!=null) str += ' '+other8+';'
	if (arguments.length>=17 && other9!=null) str += ' '+other9+';'
	if (arguments.length>=18 && other10!=null) str += ' '+other10+';'
	if (arguments.length>=19 && other11!=null) str += ' '+other11+';'
	if (arguments.length==20 && other12!=null) str += ' '+other12+';'
	str += '}\n'
	return str
}
function cssNonClip(id,left,top,width,height,color,vis,z,other,other2,other3,other4,other5,other6,other7,other8,other9,other10,other11,other12) {
	if (id=="START") return '<style type="text/css">\n<\!\-\-\n'
	else if (id=="END") return '\-\->\n</style>\n'
	var str = (left!=null && top!=null)? '#'+id+' {position:absolute; left:'+left+'px; top:'+top+'px;' : '#'+id+' {position:relative;'
	if (arguments.length>=4 && width!=null) str += ' width:'+width+'px;'
	if (arguments.length>=5 && height!=null) str += ' height:'+height+'px;'
	if (arguments.length>=6 && color!=null) str += (is.ns4)? ' layer-background-color:'+color+';' : ' background-color:'+color+';'
	if (arguments.length>=7 && vis!=null) str += ' visibility:'+vis+';'
	if (arguments.length>=8 && z!=null) str += ' z-index:'+z+';'
	if (arguments.length>=9 && other!=null) str += ' '+other+';'
	if (arguments.length>=10 && other2!=null) str += ' '+other2+';'
	if (arguments.length>=11 && other3!=null) str += ' '+other3+';'
	if (arguments.length>=12 && other4!=null) str += ' '+other4+';'
	if (arguments.length>=13 && other5!=null) str += ' '+other5+';'
	if (arguments.length>=14 && other6!=null) str += ' '+other6+';'
	if (arguments.length>=15 && other7!=null) str += ' '+other7+';'
	if (arguments.length>=16 && other8!=null) str += ' '+other8+';'
	if (arguments.length>=17 && other9!=null) str += ' '+other9+';'
	if (arguments.length>=18 && other10!=null) str += ' '+other10+';'
	if (arguments.length>=19 && other11!=null) str += ' '+other11+';'
	if (arguments.length==20 && other12!=null) str += ' '+other12+';'
	str += '}\n'
	return str
}
function writeCSS(str,showAlert) {
	str = css('START')+str+css('END')
	document.write(str)
	if (showAlert) alert(str)
}
////////////////////////////////////////BeauBeau
function cssClass(classname,width,height,color,vis,z,other,other2,other3,other4,other5,other6,other7,other8,other9,other10,other11,other12,other13,other14,other15,other16,other17,other18,other19,other20) {
	var str = classname + '{';
	if (arguments.length>=2 && width!=null) str += ' width:'+width+'px;'
	if (arguments.length>=3 && height!=null) {
		str += ' height:'+height+'px;'
		if (arguments.length<7 || other.indexOf('clip')==-1) str += ' clip:rect(0px '+width+'px '+height+'px 0px);'
	}
	if (arguments.length>=4 && color!=null) str += (is.ns4)? ' layer-background-color:'+color+';' : ' background-color:'+color+';'
	if (arguments.length>=5 && vis!=null) str += ' visibility:'+vis+';'
	if (arguments.length>=6 && z!=null) str += ' z-index:'+z+';'
	if (arguments.length>=7 && other!=null) str += ' '+other+';'
	if (arguments.length>=8 && other2!=null) str += ' '+other2+';'
	if (arguments.length>=9 && other3!=null) str += ' '+other3+';'
	if (arguments.length>=10 && other4!=null) str += ' '+other4+';'
	if (arguments.length>=11 && other5!=null) str += ' '+other5+';'
	if (arguments.length>=12 && other6!=null) str += ' '+other6+';'
	if (arguments.length>=13 && other7!=null) str += ' '+other7+';'
	if (arguments.length>=14 && other8!=null) str += ' '+other8+';'
	if (arguments.length>=15 && other9!=null) str += ' '+other9+';'
	if (arguments.length>=16 && other10!=null) str += ' '+other10+';'
	if (arguments.length>=17 && other11!=null) str += ' '+other11+';'
	if (arguments.length>=18 && other12!=null) str += ' '+other12+';'
	if (arguments.length>=19 && other13!=null) str += ' '+other13+';'
	if (arguments.length>=20 && other14!=null) str += ' '+other14+';'
	if (arguments.length>=21 && other15!=null) str += ' '+other15+';'
	if (arguments.length>=22 && other16!=null) str += ' '+other16+';'
	if (arguments.length>=23 && other17!=null) str += ' '+other17+';'
	if (arguments.length>=24 && other18!=null) str += ' '+other18+';'
	if (arguments.length>=25 && other19!=null) str += ' '+other19+';'
	if (arguments.length==26 && other20!=null) str += ' '+other20+';'
	str += '}\n'
	return str
}
function cssClassNonClip(classname,width,height,color,vis,z,other,other2,other3,other4,other5,other6,other7,other8,other9,other10,other11,other12,other13,other14,other15,other16,other17,other18,other19,other20) {
	var str = classname + '{';
	if (arguments.length>=2 && width!=null) str += ' width:'+width+'px;'
	if (arguments.length>=3 && height!=null) str += ' height:'+height+'px;';
	if (arguments.length>=4 && color!=null) str += (is.ns4)? ' layer-background-color:'+color+';' : ' background-color:'+color+';'
	if (arguments.length>=5 && vis!=null) str += ' visibility:'+vis+';'
	if (arguments.length>=6 && z!=null) str += ' z-index:'+z+';'
	if (arguments.length>=7 && other!=null) str += ' '+other+';'
	if (arguments.length>=8 && other2!=null) str += ' '+other2+';'
	if (arguments.length>=9 && other3!=null) str += ' '+other3+';'
	if (arguments.length>=10 && other4!=null) str += ' '+other4+';'
	if (arguments.length>=11 && other5!=null) str += ' '+other5+';'
	if (arguments.length>=12 && other6!=null) str += ' '+other6+';'
	if (arguments.length>=13 && other7!=null) str += ' '+other7+';'
	if (arguments.length>=14 && other8!=null) str += ' '+other8+';'
	if (arguments.length>=15 && other9!=null) str += ' '+other9+';'
	if (arguments.length>=16 && other10!=null) str += ' '+other10+';'
	if (arguments.length>=17 && other11!=null) str += ' '+other11+';'
	if (arguments.length>=18 && other12!=null) str += ' '+other12+';'
	if (arguments.length>=19 && other13!=null) str += ' '+other13+';'
	if (arguments.length>=20 && other14!=null) str += ' '+other14+';'
	if (arguments.length>=21 && other15!=null) str += ' '+other15+';'
	if (arguments.length>=22 && other16!=null) str += ' '+other16+';'
	if (arguments.length>=23 && other17!=null) str += ' '+other17+';'
	if (arguments.length>=24 && other18!=null) str += ' '+other18+';'
	if (arguments.length>=25 && other19!=null) str += ' '+other19+';'
	if (arguments.length==26 && other20!=null) str += ' '+other20+';'
	str += '}\n'
	return str
}
function DynLayerSetBG(color) {
	if (is.ns4) this.doc.bgColor = color
	else if (is.ie || is.ns5) this.css.backgroundColor = color
}
function DynLayerSetFgColor(fntcolor){
	if (is.ie || is.ns5)  this.css.color = fntcolor;
	
}
function DynLayerSetWH(w,h,clipornot){
	if(clipornot == null){
		if(is.ns4){
			if(w != null && h != null){
				this.css.clip.width = w;
				this.css.clip.height = h;
			}
			else if(w != null && h == null) this.css.clip.width = w;
			else if(w == null && h != null) this.css.clip.height = h;
		}
		else{
			if(w != null && h != null){
				this.css.width = (!is.ns5over)? w :w + 'px';
				this.css.height = (!is.ns5over)? h :h + 'px';
			}
			else if(w != null && h == null) this.css.width = (is.ie)? w :w + 'px';
			else if(w == null && h != null) this.css.height = (is.ie)? h :h + 'px';
		}
	}
	else if(clipornot) this.clipTo(0,w,h,0);
}
function DynLayerDisplay(hide){
	if(!document.getElementById) return;
	if(this.css.display == 'block') this.css.display = 'none';
	else this.css.display = 'block';
	if(hide) this.css.display = 'none';
}
DynLayer.prototype.bgcolor = DynLayerSetBG;
DynLayer.prototype.fgcolor = DynLayerSetFgColor;
DynLayer.prototype.changeWH = DynLayerSetWH;
DynLayer.prototype.display = DynLayerDisplay;

////////////////////////////////////////////////////////////
/////function pour heriter des methodes dans le superClass
function copy_undef_properties(src, dest){
	for (var prop in src) {
		if (typeof(dest[prop]) == "undefined") { 
			dest[prop] = src[prop];
		}
	}
}
// 継承関数
function inherit(subClass, superClass) {
	if(superClass == null) superClass = DynLayer;
	copy_undef_properties(superClass.prototype, subClass.prototype);
	/*for (var prop in superClass.prototype) {
		subClass.prototype[prop] = superClass.prototype[prop];
	}*/
	
}

// 動的継承関数
function dynamic_inherit(instance, dynamicClass, 
						 arg1, arg2, arg3, arg4, arg5,
						 arg6, arg7, arg8, arg9, arg10){
	if(dynamicClass == null) dynamicClass = DynLayer;
	copy_undef_properties(dynamicClass.prototype, instance);
	instance.temp = dynamicClass;
	instance.temp(arg1, arg2, arg3, arg4, arg5, 
				  arg6, arg7, arg8, arg9, arg10); 
	return instance;
}
///////////////////////////////////////////////////
function copy_properties(src, dest){
	for (var prop in src) {
		dest[prop] = src[prop];
	}
}
// 強制的な継承関数
function force_inherit(subClass, superClass){
	if(superClass == null) superClass = DynLayer;
	copy_properties(superClass.prototype, subClass.prototype);
}

// 強制的な動的継承関数
function force_dynamic_inherit(instance, dynamicClass, 
							   arg1, arg2, arg3, arg4, arg5,
							   arg6, arg7, arg8, arg9, arg10){
	if(dynamicClass == null) dynamicClass = DynLayer;
	copy_properties(dynamicClass.prototype, instance);
	instance.temp = dynamicClass;
	instance.temp(arg1, arg2, arg3, arg4, arg5, 
				  arg6, arg7, arg8, arg9, arg10); 
	return instance;
}
/*************************************************
on a besoin d'ecrire aussi
	subClass.prototype.dyn = DynLayer;
	subobjet = new subClass();
	
	il faut executer
		subobjet.dyn(id,nestref,parent);
	apres load tous les elements de HTML.
	
***************************************************/
function writedynDIV(id,str,showAlert){
	var divStr = '<div id="' + id + '">' + str + '<\/div>\n';
	document.write(divStr);
	if(showAlert) alert(divStr);
}
function writeNestDyn(id,start_end,showAlert){
	var divStr;
	if(start_end == 'start') divStr = '<div id="' + id + '">\n';
	else if(start_end == 'end')  divStr = '<\/div>\n';
	if(showAlert) alert(divStr);
	document.write(divStr);
}
function addDivTag(id,showAlert){
	if(document.getElementsByTagName && document.createElement){
		var newDiv = document.createElement('div');//div要素を作成し、以下属性をセット
		newDiv.id = id;
		var bodyTag = document.getElementsByTagName('body')[0];//head要素
		bodyTag.appendChild(newDiv);
		//var txtNode = document.createTextNode(txt);
		if(showAlert) alert('<div id="'+newDiv.id+'"><\/div>');
		//newDiv.appendChild(txtNode);
	}
	else alert('DOM 未対応です')
}
////Il faut ecrire apres onload (c'est a dire dans init())
function setDiv(id,txt){
	//ecrire div tag
	if(document.getElementsByTagName && document.createElement) addDivTag(id);
	else writedynDIV(id,txt);
	
	var len = id.length;
	var obj;
	if(id.substr(len-3,3 ) == 'Div'){
		var objlen = len-3;
		obj = id.substring(0,objlen);
	}
	else obj = id + 'obj';
	eval(obj + '= new DynLayer(id)');
	eval(obj + '.write(txt)');
}
///////////C'est la function d'ecrire *.js fichier.
//////////mais c'est con pour ns4!!!
function importJS(filename,step,folda,js,showAlert){
	var stepStr = '';
	var start = '<script type="text/javascript" src="';
	var end = '"><\/script>';
	var jsimprt;
	if(step > 0){
		for(var i=1;i<=step;i++){
			stepStr += '../';
		}
	}
	else if(step == 0 || step == null) stepStr = '';
	if(folda == null || folda == '') folda = '';
	else folda += '/'
	if(js || js == null){
		jsimprt = start + stepStr  + folda + 'js/' + filename + '.js' + end;
	}
	else if(!js) jsimprt = start + stepStr  + folda + filename + '.js' + end;
	document.writeln(jsimprt);
	if(showAlert) alert(jsimprt);
}
function addScriptTag(srcpass,showAlert){
	if(document.getElementsByTagName && document.createElement){
		var newScript = document.createElement('script');//script要素を作成し、以下属性をセット
		newScript.type = 'text/javascript';
		newScript.src = srcpass + '.js';
		var headTag = document.getElementsByTagName('head')[0];//head要素
		headTag.appendChild(newScript);
		if(showAlert) alert('<script " type="'+newScript.type+'" src="'+newScript.src+'">')
	}
	else alert('DOM 未対応です');
}
function assignCSS(src,showAlert){
	var cssSrc = '<link rel="stylesheet" type="text/css" href="' + src + '.css" />';
	document.write(cssSrc);
	if(showAlert) alert(cssSrc);
}
function addCSSlinkTag(src,showAlert){
	if(document.getElementsByTagName && document.createElement){
		var newlink = document.createElement('link');//link要素を作成し、以下属性をセット
		newlink.rel = 'stylesheet';
		newlink.type = 'text/css';
		newlink.href = src + '.css';
		var headTag = document.getElementsByTagName('head')[0];//head要素
		headTag.appendChild(newlink);
		if(showAlert) alert('<link rel="'+newlink.rel+'" type="'+newlink.type+'" href="'+newlink.href+'">')
	}
	else alert('DOM 未対応です')
}
function openNewPage(newwin,url,name,tool,loca,sts,menu,scrll,resz,W,H,L,T){
	if(url != null){
		eval('newwin = window.open(url, name,"toolbar=' + tool + ',location='+ loca + ',status=' + sts + ',menubar=' + menu + ',scrollbars='+ scrll + ',resizable='+ resz + ',width='+ W + ',height='+ H +',Top='+  T + ',Left='+ L + '")')
	}
	else{
		eval('newwin = window.open("",name,"toolbar=' + tool + ',location='+ loca + ',status=' + sts + ',menubar=' + menu + ',scrollbars='+ scrll + ',resizable='+ resz + ',width='+ W + ',height='+ H +',Top='+  T + ',Left='+ L + '")')
	}
}
var NewWin;
function openNewWindow(url,name,tool,loca,sts,menu,scrll,resz,W,H,L,T){
	if(url != null){
		eval('NewWin = window.open(url, name,"toolbar=' + tool + ',location='+ loca + ',status=' + sts + ',menubar=' + menu + ',scrollbars='+ scrll + ',resizable='+ resz + ',width='+ W + ',height='+ H +',Top='+  T + ',Left='+ L + '")')
	}
	else{
		eval('NewWin = window.open("",name,"toolbar=' + tool + ',location='+ loca + ',status=' + sts + ',menubar=' + menu + ',scrollbars='+ scrll + ',resizable='+ resz + ',width='+ W + ',height='+ H +',Top='+  T + ',Left='+ L + '")')
	}
}