/*
 overlibmws.js core module - Copyright Foteos Macrides 2002-2004
   Initial: August 18, 2002 - Last Revised: July 1, 2004
 This module is subject to the same terms of usage as for Erik Bosrup's overLIB,
 although only a minority of the code and API now correspond with Erik's version.
 See the Change History and Command Reference for overlibmws via:

	http://www.macridesweb.com/oltest/

****
 overLIB -- You may not remove or change this notice.
 Copyright Erik Bosrup 1998-2004
 You can get Erik's version via: http://www.bosrup.com/web/overlib/
 Published under an open source license: http://www.bosrup.com/web/overlib/license.html

 Do not sell this as your own work. For details on copying or changing this script
 read the license agreement. Please give credit on sites that use overLIB and submit
 changes of the script so other people can use them as well.
*/

////////
// PRE-INIT -- Ignore these lines, configuration is below.
////////
var OLloaded=0,pmCnt=1,pMtr=new Array(),OLv,OLudf,OLrefXY;
var OLpct=new Array("83%","67%","83%","100%","117%","150%","200%","267%");
var OLbubblePI=0,OLcrossframePI=0,OLdebugPI=0,OLdraggablePI=0,OLexclusivePI=0,OLfilterPI=0;
var OLfunctionPI=0,OLhidePI=0,OLiframePI=0,OLovertwoPI=0,OLscrollPI=0,OLshadowPI=0;
if(typeof OLgateOK=='undefined')var OLgateOK=1;
var OLxPos=0;
var OLyPos=0;
OLregCmds(
 'inarray,caparray,caption,sticky,nofollow,background,noclose,mouseoff,offdelay,right,left,'
+'center,offsetx,offsety,fgcolor,bgcolor,cgcolor,textcolor,capcolor,closecolor,width,wrap,'
+'wrapmax,height,border,base,status,autostatus,autostatuscap,snapx,snapy,fixx,fixy,relx,rely,'
+'midx,midy,ref,refc,refp,refx,refy,fgbackground,bgbackground,cgbackground,padx,pady,fullhtml,'
+'below,above,vcenter,capicon,textfont,captionfont,closefont,textsize,captionsize,closesize,'
+'timeout,delay,hauto,vauto,nojustx,nojusty,closetext,closeclick,closetitle,fgclass,bgclass,'
+'cgclass,capbelow,textpadding,textfontclass,captionpadding,captionfontclass,closefontclass,'
+'donothing,divid,divclass');

////////
// DEFAULT CONFIGURATION -- See overlibConfig.txt for descriptions.
////////
if(typeof ol_divid=='undefined')var ol_divid="overDiv";
if(typeof ol_divclass=='undefined')var ol_divclass="overDiv";
if(typeof ol_fgcolor=='undefined')var ol_fgcolor="#CCCCFF";
if(typeof ol_bgcolor=='undefined')var ol_bgcolor="#333399";
if(typeof ol_cgcolor=='undefined')var ol_cgcolor="#333399";
if(typeof ol_textcolor=='undefined')var ol_textcolor="#000000";
if(typeof ol_capcolor=='undefined')var ol_capcolor="#FFFFFF";
if(typeof ol_closecolor=='undefined')var ol_closecolor="#EEEEFF";
if(typeof ol_textfont=='undefined')var ol_textfont="Verdana,Arial,Helvetica";
if(typeof ol_captionfont=='undefined')var ol_captionfont="Verdana,Arial,Helvetica";
if(typeof ol_closefont=='undefined')var ol_closefont="Verdana,Arial,Helvetica";
if(typeof ol_textsize=='undefined')var ol_textsize=1;
if(typeof ol_captionsize=='undefined')var ol_captionsize=1;
if(typeof ol_closesize=='undefined')var ol_closesize=1;
if(typeof ol_fgclass=='undefined')var ol_fgclass="";
if(typeof ol_bgclass=='undefined')var ol_bgclass="";
if(typeof ol_cgclass=='undefined')var ol_cgclass="";
if(typeof ol_textpadding=='undefined')var ol_textpadding=2;
if(typeof ol_textfontclass=='undefined')var ol_textfontclass="";
if(typeof ol_captionpadding=='undefined')var ol_captionpadding=2;
if(typeof ol_captionfontclass=='undefined')var ol_captionfontclass="";
if(typeof ol_closefontclass=='undefined')var ol_closefontclass="";
if(typeof ol_close=='undefined')var ol_close="Close";
if(typeof ol_closeclick=='undefined')var ol_closeclick=0;
if(typeof ol_closetitle=='undefined')var ol_closetitle="Click to Close";
if(typeof ol_text=='undefined')var ol_text="Default Text";
if(typeof ol_cap=='undefined')var ol_cap="";
if(typeof ol_capbelow=='undefined')var ol_capbelow=0;
if(typeof ol_background=='undefined')var ol_background="";
if(typeof ol_width=='undefined')var ol_width=200;
if(typeof ol_wrap=='undefined')var ol_wrap=0;
if(typeof ol_wrapmax=='undefined')var ol_wrapmax=0;
if(typeof ol_height=='undefined')var ol_height= -1;
if(typeof ol_border=='undefined')var ol_border=1;
if(typeof ol_base=='undefined')var ol_base=0;
if(typeof ol_offsetx=='undefined')var ol_offsetx=10;
if(typeof ol_offsety=='undefined')var ol_offsety=10;
if(typeof ol_sticky=='undefined')var ol_sticky=0;
if(typeof ol_nofollow=='undefined')var ol_nofollow=0;
if(typeof ol_noclose=='undefined')var ol_noclose=0;
if(typeof ol_mouseoff=='undefined')var ol_mouseoff=0;
if(typeof ol_offdelay=='undefined')var ol_offdelay=300;
if(typeof ol_hpos=='undefined')var ol_hpos=RIGHT;
if(typeof ol_vpos=='undefined')var ol_vpos=BELOW;
if(typeof ol_status=='undefined')var ol_status="";
if(typeof ol_autostatus=='undefined')var ol_autostatus=0;
if(typeof ol_snapx=='undefined')var ol_snapx=0;
if(typeof ol_snapy=='undefined')var ol_snapy=0;
if(typeof ol_fixx=='undefined')var ol_fixx= -1;
if(typeof ol_fixy=='undefined')var ol_fixy= -1;
if(typeof ol_relx=='undefined')var ol_relx=null;
if(typeof ol_rely=='undefined')var ol_rely=null;
if(typeof ol_midx=='undefined')var ol_midx=null;
if(typeof ol_midy=='undefined')var ol_midy=null;
if(typeof ol_ref=='undefined')var ol_ref="";
if(typeof ol_refc=='undefined')var ol_refc='UL';
if(typeof ol_refp=='undefined')var ol_refp='UL';
if(typeof ol_refx=='undefined')var ol_refx=0;
if(typeof ol_refy=='undefined')var ol_refy=0;
if(typeof ol_fgbackground=='undefined')var ol_fgbackground="";
if(typeof ol_bgbackground=='undefined')var ol_bgbackground="";
if(typeof ol_cgbackground=='undefined')var ol_cgbackground="";
if(typeof ol_padxl=='undefined')var ol_padxl=1;
if(typeof ol_padxr=='undefined')var ol_padxr=1;
if(typeof ol_padyt=='undefined')var ol_padyt=1;
if(typeof ol_padyb=='undefined')var ol_padyb=1;
if(typeof ol_fullhtml=='undefined')var ol_fullhtml=0;
if(typeof ol_capicon=='undefined')var ol_capicon="";
if(typeof ol_frame=='undefined')var ol_frame=self;
if(typeof ol_timeout=='undefined')var ol_timeout=0;
if(typeof ol_delay=='undefined')var ol_delay=0;
if(typeof ol_hauto=='undefined')var ol_hauto=0;
if(typeof ol_vauto=='undefined')var ol_vauto=0;
if(typeof ol_nojustx=='undefined')var ol_nojustx=0;
if(typeof ol_nojusty=='undefined')var ol_nojusty=0;
////////
// ARRAY CONFIGURATION - See overlibConfig.txt for descriptions.
////////
if(typeof ol_texts=='undefined')var ol_texts=new Array("Text 0","Text 1");
if(typeof ol_caps=='undefined')var ol_caps=new Array("Caption 0","Caption 1");
////////
// END CONFIGURATION -- Don't change anything below, all configuration is above.
////////

////////
// INIT -- Runtime variables.
////////
var o3_divid="overDiv",o3_divclass="overDiv",o3_text="",o3_cap="",o3_sticky=0,o3_nofollow=0,o3_background="",o3_noclose=0,o3_mouseoff=0;
var o3_offdelay=300,o3_hpos=RIGHT,o3_offsetx=10,o3_offsety=10,o3_fgcolor="",o3_bgcolor="";
var o3_cgcolor="",o3_textcolor="",o3_capcolor="",o3_closecolor="",o3_width=200,o3_wrap=0;
var o3_wrapmax=0,o3_height= -1,o3_border=1,o3_base=0,o3_status="",o3_autostatus=0,o3_snapx=0;
var o3_snapy=0,o3_fixx= -1,o3_fixy= -1,o3_relx=null,o3_rely=null,o3_midx=null,o3_midy=null;
var o3_ref="",o3_refc='UL',o3_refp='UL',o3_refx=0,o3_refy=0,o3_fgbackground="";
var o3_bgbackground="",o3_cgbackground="",o3_padxl=0,o3_padxr=0,o3_padyt=0,o3_padyb=0;
var o3_fullhtml=0,o3_vpos=BELOW,o3_capicon="",o3_textfont="Verdana,Arial,Helvetica";
var o3_captionfont="Verdana,Arial,Helvetica",o3_closefont="Verdana,Arial,Helvetica";
var o3_textsize=1,o3_captionsize=1,o3_closesize=1,o3_frame=self,o3_timeout=0,o3_delay=0;
var o3_hauto=0,o3_vauto=0,o3_nojustx=0,o3_nojusty=0,o3_close="Close",o3_closeclick=0;
var o3_closetitle="",o3_fgclass="",o3_bgclass="",o3_cgclass="",o3_textpadding=2;
var o3_textfontclass="",o3_captionpadding=2,o3_captionfontclass="",o3_closefontclass="";
var o3_capbelow=0,CSSOFF=DONOTHING,CSSCLASS=DONOTHING;
// Display state variables
var o3_x=0,o3_y=0,o3_showingsticky=0,o3_allowmove=0,o3_removecounter=0;
var o3_delayid=0,o3_timerid=0,o3_showid=0;
// Our layer
var over=null,OLfnRef="",OLhover=0;
// Decide browser version
var OLua=navigator.userAgent.toLowerCase();
var OLns4=(navigator.appName=='Netscape'&&parseInt(navigator.appVersion)==4);
var OLns6=(document.getElementById)?1:0;
var OLie4=(document.all)?1:0;
var OLmac=(OLua.indexOf('mac')>=0)?1:0;
var OLsaf=(OLua.indexOf('safari')>=0)?1:0;
var OLkon=(OLua.indexOf('konqueror')>=0)?1:0;
var OLopr=(OLua.indexOf('opera')>=0)?1:0;
var OLop7=(OLopr&&document.createTextNode)?1:0;
if(OLopr){OLns4=OLns6=0;if(!OLop7)OLie4=0;}
var OLieM=((OLie4&&OLmac)&&!(OLsaf||OLkon||OLopr))?1:0;
var OLdr='document.body';
var OLie5=0,OLie55=0;if(OLie4&&!OLopr){
if((OLv=OLua.match(/msie (\d\.\d+)\.*/i))&&(OLv=parseFloat(OLv[1]))>=5.0){
OLie5=1;OLns6=0;if(OLv>=5.5)OLie55=1;
if(typeof document.compatMode!='undefined'&&document.compatMode=='CSS1Compat')
OLdr='document.documentElement';}if(OLns6)OLie4=0;}
if(OLns4)window.onresize=function(){location.reload();}
// Capture events or diffuse the public functions.
var OLchkMseCapture=1,OLcapExtent;
if(OLns4||OLie4||OLns6)OLmouseCapture();
else{overlib=nd=cClick=OLpageDefaults=no_overlib;ver3fix=true;}

////////
// PUBLIC FUNCTIONS
////////
// overlib(arg0, ..., argN); Loads defaults then args into global runtime variables.
function overlib(){
if(!(OLloaded&&OLgateOK))return;
if((OLexclusivePI)&&OLisExclusive(overlib.arguments))return true;
if(OLchkMseCapture)OLmouseCapture();
if(over)cClick(true);
// Load defaults to runtime.
OLloadP1or2();o3_close=ol_close;o3_closeclick=ol_closeclick;o3_closetitle=ol_closetitle;
o3_noclose=ol_noclose;o3_mouseoff=ol_mouseoff;o3_offdelay=ol_offdelay;o3_sticky=ol_sticky;
o3_closecolor=ol_closecolor;o3_closefont=ol_closefont;o3_closesize=ol_closesize;
o3_closefontclass=ol_closefontclass;
OLsetRunTimeVar();
OLfnRef="";OLhover=0;o3_frame=ol_frame;
OLparseTokens('o3_',overlib.arguments);
if(OLns4)over=o3_frame.document.layers[o3_divid];
else if(OLie4)over=o3_frame.document.all[o3_divid];
else if(OLns6)over=o3_frame.document.getElementById(o3_divid);
over.className=o3_divclass;
if(OLbubblePI&&o3_bubble)OLchkForBubbleEffect();
if(OLdebugPI&&o3_allowdebug!="")OLsetDebugCanShow(o3_allowdebug);
if(OLshadowPI)OLinitShadow();
if(OLiframePI)OLinitIframe();
if(OLfilterPI)OLinitFilterLyr();
// Prepare status line
if(OLexclusivePI&&o3_exclusive&&o3_exclusivestatus!="")o3_status=o3_exclusivestatus;
else if(o3_autostatus==2&&o3_cap!="")o3_status=o3_cap;
else if(o3_autostatus==1&&o3_text!="")o3_status=o3_text;
if(o3_delay==0){return OLmain();
}else{o3_delayid=setTimeout("OLmain()",o3_delay);
// Set status line now if specified.
if(o3_status!=""){self.status=o3_status;return true;}
else if(!(OLop7&&event&&event.type=='mouseover'))return false;}
}

// Clears popups if appropriate
function nd(time){
if(!(OLloaded&&OLgateOK))return;
if((OLexclusivePI)&&OLisExclusive())return true;
if(time&&!o3_delay){if(o3_timerid>0)clearTimeout(o3_timerid);
o3_timerid=(OLhover&&!OLcursorOff())?0:setTimeout("cClick()",(o3_timeout=time));
}else{if(o3_removecounter>=1)o3_showingsticky=0;if(o3_showingsticky==0){
o3_allowmove=0;if(over)OLhideObject(over);}else{o3_removecounter++;}}
return true;
}

// The Close function for stickies
function cClick(pos){
if(OLloaded&&OLgateOK){OLhover=0;if(over)OLhideObject(over);o3_showingsticky=0;}
ol_elem=document.getElementById(o3_divid);
ol_elem.innerHTML='';
if(!pos){
	OLxPos=0;OLyPos=0;
}
return false;
}

// Set page-specific defaults.
function OLpageDefaults(){
OLparseTokens('ol_',OLpageDefaults.arguments);
}

// For unsupported browsers.
function no_overlib(){return ver3fix;}

////////
// OVERLIB MAIN FUNCTION SET
////////
function OLmain(){
o3_delay=0;
// Act on NOCLOSE or MOUSEOFF if in our frame, otherwise, ignore.
if(o3_frame==self){if(o3_noclose)OLoptMOUSEOFF(0);else if(o3_mouseoff)OLoptMOUSEOFF(1);}
// Create and write layer content
OLdoLyr();
// For initial layer placement, even stickies may be moved.
o3_allowmove=0;
// Initiate a timer for timeout
if(o3_timeout>0){
if(o3_timerid>0)clearTimeout(o3_timerid);o3_timerid=setTimeout("cClick()",o3_timeout);}
// Use REFerence if requested (center on failure)
if(o3_ref){OLrefXY=OLgetRefXY(o3_ref);if(OLrefXY[0]==null){o3_ref="";o3_midx=0;o3_midy=0;}}
// Place and show layer
if(OLdraggablePI)OLcheckDrag();
OLdisp(o3_status);if(o3_status!="")return true;
else if(!(OLop7&&event&&event.type=='mouseover'))return false;
}

// Loads defaults for primaries or secondaries
function OLloadP1or2(){
o3_text=ol_text;o3_cap=ol_cap;o3_capbelow=ol_capbelow;o3_textpadding=ol_textpadding;
o3_captionpadding=ol_captionpadding;o3_border=ol_border;o3_base=ol_base;o3_status=ol_status;
o3_autostatus=ol_autostatus;o3_nofollow=ol_nofollow;o3_width=ol_width;o3_wrap=ol_wrap;
o3_wrapmax=ol_wrapmax;o3_height=ol_height;o3_hpos=ol_hpos;o3_vpos=ol_vpos;o3_offsetx=ol_offsetx;
o3_offsety=ol_offsety;o3_snapx=ol_snapx;o3_snapy=ol_snapy;o3_relx=ol_relx;o3_rely=ol_rely;
o3_midx=ol_midx;o3_midy=ol_midy;o3_ref=ol_ref;o3_refc=ol_refc;o3_refp=ol_refp;o3_refx=ol_refx;
o3_refy=ol_refy;o3_fixx=ol_fixx;o3_fixy=ol_fixy;o3_nojustx=ol_nojustx;o3_nojusty=ol_nojusty;
o3_hauto=ol_hauto;o3_vauto=ol_vauto;o3_timeout=ol_timeout;o3_delay=ol_delay;
o3_fgcolor=ol_fgcolor;o3_bgcolor=ol_bgcolor;o3_cgcolor=ol_cgcolor;o3_textcolor=ol_textcolor;
o3_capcolor=ol_capcolor;o3_textfont=ol_textfont;o3_captionfont=ol_captionfont;
o3_textsize=ol_textsize;o3_captionsize=ol_captionsize;o3_fgbackground=ol_fgbackground;
o3_bgbackground=ol_bgbackground;o3_cgbackground=ol_cgbackground;o3_capicon=ol_capicon;
o3_background=ol_background;o3_padxl=ol_padxl;o3_padxr=ol_padxr;o3_padyt=ol_padyt;
o3_padyb=ol_padyb;o3_fullhtml=ol_fullhtml;o3_fgclass=ol_fgclass;o3_bgclass=ol_bgclass;
o3_cgclass=ol_cgclass;o3_textfontclass=ol_textfontclass;o3_captionfontclass=ol_captionfontclass;
}

// Chooses LGF 
function OLdoLGF(){
return (o3_background!=''||o3_fullhtml)?OLcontentBackground(o3_text,o3_background,o3_fullhtml):
(o3_cap=="")?OLcontentSimple(o3_text):
(o3_sticky)?OLcontentCaption(o3_text,o3_cap,o3_close):OLcontentCaption(o3_text,o3_cap,'');
}

// Creates and writes layer content
function OLdoLyr(){
// Create content
if(o3_background==''&&!o3_fullhtml){
if(o3_fgbackground!='')o3_fgbackground=' background="'+o3_fgbackground+'"';
if(o3_bgbackground!='')o3_bgbackground=' background="'+o3_bgbackground+'"';
if(o3_cgbackground!='')o3_cgbackground=' background="'+o3_cgbackground+'"';
if(o3_fgcolor!='')o3_fgcolor=' bgcolor="'+o3_fgcolor+'"';
if(o3_bgcolor!='')o3_bgcolor=' bgcolor="'+o3_bgcolor+'"';
if(o3_cgcolor!='')o3_cgcolor=' bgcolor="'+o3_cgcolor+'"';
if(o3_height>0)o3_height=' height="'+o3_height+'"';else o3_height='';}
//if(!OLns4)OLrepositionTo(over,(OLns6?20:0),0);
var lyrHtml=OLdoLGF();
// If sticky, initialize
if(o3_sticky){if(o3_timerid>0){clearTimeout(o3_timerid);o3_timerid=0;}
o3_showingsticky=1;o3_removecounter=0;}
// Write layer
if(o3_wrap&&!o3_fullhtml){
OLlayerWrite(lyrHtml);o3_width=(OLns4?over.clip.width:over.offsetWidth);
o3_wrap=0;if(o3_wrapmax>0&&o3_width>o3_wrapmax)o3_width=o3_wrapmax;lyrHtml=OLdoLGF();}
OLlayerWrite(lyrHtml);o3_width=(OLns4?over.clip.width:over.offsetWidth);
if(OLbubblePI&&o3_bubble)OLgenerateBubble(lyrHtml);
}

////////
// LAYER GENERATION FUNCTIONS
////////
// Makes simple table without caption
function OLcontentSimple(text){
var txt=
'<table'+(o3_wrap?'':' width="'+o3_width+'"')+o3_height+' border="0" cellpadding="'+o3_border
+'" cellspacing="0"'+(o3_bgclass?' class="'+o3_bgclass+'"':o3_bgcolor+o3_bgbackground)
+'><tr><td><table width="100%"'+o3_height+' border="0" cellpadding="'+o3_textpadding
+'" cellspacing="0"'+(o3_fgclass?' class="'+o3_fgclass+'"':o3_fgcolor+o3_fgbackground)
+'><tr><td valign="top"'+(o3_fgclass?' class="'+o3_fgclass+'"':'')+'>'
+OLlgfUtil(0,o3_textfontclass,'div',o3_textcolor,o3_textfont,o3_textsize)+text
+OLlgfUtil(1,'','div')+'</td></tr></table>'+((o3_base>0&&!o3_wrap)?
('<table width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td height="'+o3_base
+'"></td></tr></table>'):'')+'</td></tr></table>';
OLsetBackground('');
return txt;
}

// Makes table with caption and optional close link
function OLcontentCaption(text,title,close){
var closing='',closeevent='onmouseover',caption,maintxt,txt,footer;
if(o3_closeclick==1)closeevent=(o3_closetitle?'title="'+o3_closetitle+'" ':'')+'onclick';
if(o3_capicon!='')o3_capicon='<img src="'+o3_capicon+'" /> ';
if (close != "") closing='<div class="overlibclose"><a href="javascript:return '+OLfnRef+'cClick();" '+closeevent+'="return '+OLfnRef+'cClick();">'+close+'</a></div>';
caption='<div class="overlibcaption">'+title+'</div>';
maintxt='<div id="overlibcontent">'+text+'</div>';
footer='<div id="overlibfooter"><a href="javascript:void(0);" onclick="return cClick();" title="'+o3_closetitle+'">'+o3_closetitle+'</a></div>';
txt='<div id="overlibheader" class="overlibheader">'+caption+closing+'</div>'+maintxt+footer;
OLsetBackground('');
return txt;
}

// Sets the background picture, padding and lots more. :)
function OLcontentBackground(text, picture, hasfullhtml){
var txt;if(hasfullhtml){txt=text;}else{txt=
'<table'+(o3_wrap?'':' width="'+o3_width+'"')+' border="0" cellpadding="0" cellspacing="0" '
+'height="'+o3_height+'"><tr><td colspan="3" height="'+o3_padyt+'"></td></tr><tr><td width="'
+o3_padxl+'"></td><td valign="top"'+(o3_wrap?'':' width="'+(o3_width-o3_padxl-o3_padxr)+'"')+'>'
+OLlgfUtil(0,o3_textfontclass,'div',o3_textcolor,o3_textfont,o3_textsize)+text+
OLlgfUtil(1,'','div')+'</td><td width="'+o3_padxr+'"></td></tr><tr><td colspan="3" height="'
+o3_padyb+'"></td></tr></table>';}
OLsetBackground(picture);
return txt;
}

// LGF utility.
function OLlgfUtil(end,tfc,ele,col,fac,siz){
if(end)return ('</'+(OLns4?'font':ele)+'>');else return (tfc?'<div class="'+tfc+'">':
('<'+(OLns4?'font color="'+col+'" face="'+OLquoteMultiNameFonts(fac)+'" size="'+siz:ele
+' style="color:'+col+';font-family:'+OLquoteMultiNameFonts(fac)+';font-size:'+siz+';'
+(ele=='span'?'text-decoration:underline;':''))+'">'));
}

// Quotes multi-word font names
function OLquoteMultiNameFonts(theFont){
var i,v,pM=theFont.split(',');
for(i=0;i<pM.length;i++){v=pM[i];v=v.replace(/^\s+/,'').replace(/\s+$/,'');
if(/\s/.test(v) && !/['"]/.test(v)){v="\'"+v+"\'";pM[i]=v;}}
return pM.join();
}

// Loads a picture into the div.
function OLsetBackground(pic){
if(pic==''){
if(OLns4)over.background.src=null;else if(OLie4||OLns6)over.style.backgroundImage='none';
}else{
if(OLns4)over.background.src=pic;else if(OLie4||OLns6)over.style.backgroundImage='url('+pic+')';}
}

////////
// HANDLING FUNCTIONS
////////
// Displays the popup
function OLdisp(statustext){
if(o3_allowmove==0){
if(OLshadowPI)OLdispShadow();if(OLiframePI)OLdispIfShim();
OLplaceLayer();o3_showid=setTimeout("OLshowObject(over)",1);
o3_allowmove=(o3_sticky||o3_nofollow)?0:1;}
if(statustext!="")self.status=statustext;
}

// Decides where we want the popup.
function OLplaceLayer(){
var X,Y,pgLeft,pgTop,pWd=o3_width,pHt,iWd=100,iHt=100,SB=0,LM=0,CX=0,TM=0,BM=0,CY=0;
// HORIZONTAL PLACEMENT
if(eval('o3_frame.'+OLdr)&&typeof eval('o3_frame.'+OLdr).clientWidth=='number'&&
eval('o3_frame.'+OLdr).clientWidth>0)iWd=eval('o3_frame.'+OLdr).clientWidth;
else if(typeof(o3_frame.innerWidth)=='number'){
SB=Math.ceil(1.4*(o3_frame.outerWidth-o3_frame.innerWidth));if(SB>20)SB=20;
iWd=o3_frame.innerWidth;}pgLeft=(OLie4)?eval('o3_frame.'+OLdr).scrollLeft:o3_frame.pageXOffset;
if(OLie55&&OLfilterPI&&o3_filtershadow)SB=CX=5;else
if((OLshadowPI)&&bkdrop&&o3_shadow&&o3_shadowx){SB+=((o3_shadowx>0)?o3_shadowx:0);
LM=((o3_shadowx<0)?Math.abs(o3_shadowx):0);CX=Math.abs(o3_shadowx);}
if(o3_ref!=""||o3_fixx> -1||o3_relx!=null||o3_midx!=null){
if(o3_ref!=""){
// Relative to a REFerence
X=OLrefXY[0];if(OLie55&&OLfilterPI&&o3_filtershadow){if(o3_refp=='UR'||o3_refp=='LR')X -= 5;}
else if((OLshadowPI)&&bkdrop&&o3_shadow&&o3_shadowx){  
if(o3_shadowx<0&&(o3_refp=='UL'||o3_refp=='LL'))X += o3_shadowx;
else if(o3_shadowx>0&&(o3_refp=='UR'||o3_refp=='LR'))X -= o3_shadowx;}
}else{if(o3_midx!=null){
// Middle of popup relative to middle of window
X=parseInt(pgLeft+((iWd-pWd-SB-LM)/2)+o3_midx);
}else{if(o3_relx!=null){
// Relative to window margins
if(o3_relx>=0)X=pgLeft+o3_relx+LM;else X=pgLeft+o3_relx+iWd-pWd-SB;
}else{
// Fixed position
X=o3_fixx+LM;}}}
}else{
// From mouse
if(o3_hauto){
if(o3_hpos==LEFT&&o3_x-pgLeft<iWd/2&&o3_x-pWd-o3_offsetx<pgLeft+LM)o3_hpos=RIGHT;else
if(o3_hpos==RIGHT&&o3_x-pgLeft>iWd/2&&o3_x+pWd+o3_offsetx>pgLeft+iWd-SB)o3_hpos=LEFT;}
X=(o3_hpos==CENTER)?parseInt(o3_x-((pWd+CX)/2)+o3_offsetx):
(o3_hpos==LEFT)?o3_x-o3_offsetx-pWd:o3_x+o3_offsetx;
if(o3_snapx>1){
// Snapping
var snapping=X % o3_snapx;
if(o3_hpos==LEFT){X=X-(o3_snapx+snapping);}else{X=X+(o3_snapx-snapping);}}}
if(!o3_nojustx&&X+pWd>pgLeft+iWd-SB)
// Justify
X=iWd+pgLeft-pWd-SB;if(!o3_nojustx&&X-LM<pgLeft)X=pgLeft+LM;
// VERTICAL PLACEMENT
pgTop=OLie4?eval('o3_frame.'+OLdr).scrollTop:o3_frame.pageYOffset;
if(OLie4||(o3_frame.document.body&&typeof o3_frame.document.body.clientHeight=='number'&&
o3_frame.document.body.clientHeight>0))iHt=eval('o3_frame.'+OLdr).clientHeight;
else if(typeof(o3_frame.innerHeight)=='number')iHt=o3_frame.innerHeight;
if(OLbubblePI&&o3_bubble)pHt=OLbubbleHt;else pHt=OLns4?over.clip.height:over.offsetHeight;
if((OLshadowPI)&&bkdrop&&o3_shadow&&o3_shadowy){TM=(o3_shadowy<0)?Math.abs(o3_shadowy):0;
if(OLie55&&OLfilterPI&&o3_filtershadow)BM=CY=5;else
BM=(o3_shadowy>0)?o3_shadowy:0;CY=Math.abs(o3_shadowy);}
if(o3_ref!=""||o3_fixy> -1||o3_rely!=null||o3_midy!=null){
if(o3_ref!=""){
// Relative to a REFerence
Y=OLrefXY[1];if(OLie55&&OLfilterPI&&o3_filtershadow){if(o3_refp=='LL'||o3_refp=='LR')Y -= 5;}
else if((OLshadowPI)&&bkdrop&&o3_shadow&&o3_shadowy){
if(o3_shadowy<0&&(o3_refp=='UL'||o3_refp=='UR'))Y+=o3_shadowy;else
if(o3_shadowy>0&&(o3_refp=='LL'||o3_refp=='LR'))Y-=o3_shadowy;}
}else{if(o3_midy!=null){
// Middle of popup relative to middle of window
Y=parseInt(pgTop+((iHt-pHt-CY)/2)+o3_midy);
}else{if(o3_rely!=null){
// Relative to window margins
if(o3_rely>=0)Y=pgTop+o3_rely+TM;else Y=pgTop+o3_rely+iHt-pHt-BM;}else{
// Fixed position
Y=o3_fixy+TM;}}}
}else{
// From mouse
if(o3_vauto){
if(o3_vpos==ABOVE&&o3_y-pgTop<iHt/2&&o3_y-pHt-o3_offsety<pgTop)o3_vpos=BELOW;else
if(o3_vpos==BELOW&&o3_y-pgTop>iHt/2&&o3_y+pHt+o3_offsety+(OLns4?17:0)>pgTop+iHt-BM)
o3_vpos=ABOVE;}Y=(o3_vpos==VCENTER)?parseInt(o3_y-((pHt+CY)/2)+o3_offsety):
(o3_vpos==ABOVE)?o3_y-(pHt+o3_offsety+BM):o3_y+o3_offsety+TM;
if(o3_snapy>1){
// Snapping
var snapping=Y % o3_snapy;
if(pHt>0&&o3_vpos==ABOVE){Y=Y-(o3_snapy+snapping);}else{Y=Y+(o3_snapy-snapping);}}}
if(!o3_nojusty&&Y+pHt+BM>pgTop+iHt)
// Justify
Y=pgTop+iHt-pHt-BM;if(!o3_nojusty&&Y-TM<pgTop)Y=pgTop+TM;
// Actually move the object.
OLrepositionTo(over,X,Y);if(OLns6){iHt=o3_frame.innerHeight;OLrepositionTo(over,X,Y);}
if(OLshadowPI)OLrepositionShadow(X,Y);
if(OLiframePI)OLrepositionIfShim(X,Y);
if(OLscrollPI)OLchkScroll(X-pgLeft,Y-pgTop);
}

// Gets location of a REFerence object
function OLgetRefXY(ref){
var mn=ref,mref=OLgetRefById(mn,o3_frame.document),mkObj,of,refXY;
if(mref==null)mref=OLgetRefByName(mn,o3_frame.document);if(mref==null)return [null,null];
mkObj=mref;refXY=[o3_refx,o3_refy];
if(OLns4){if(typeof mref.length!='undefined'&&mref.length>1){
mkObj=mref[0];refXY[0]+=mref[0].x+mref[1].pageX;refXY[1]+=mref[0].y+mref[1].pageY;
}else{if((mref.toString().indexOf('Image')!= -1)||(mref.toString().indexOf('Anchor')!= -1)){
refXY[0]+=mref.x;refXY[1]+=mref.y;}else{refXY[0]+=mref.pageX;refXY[1]+=mref.pageY;}}
}else{refXY[0]+=OLpageLoc(mref,'Left');refXY[1]+=OLpageLoc(mref,'Top');}
of=OLgetRefOffsets(mkObj);refXY[0]+=of[0];refXY[1]+=of[1];
return refXY;
}

// Gets popup vs REFerence offsets
function OLgetRefOffsets(mkObj){
var mc=o3_refc.toUpperCase(),mp=o3_refp.toUpperCase(),mW=mH=pW=pH=0,off=[0,0];
pW=(OLbubblePI&&o3_bubble)?o3_width:OLns4?over.clip.width:over.offsetWidth;
pH=(OLbubblePI&&o3_bubble)?OLbubbleHt:OLns4?over.clip.height:over.offsetHeight;
if((!OLop7)&&mkObj.toString().indexOf('Image')!= -1){mW=mkObj.width;mH=mkObj.height;
}else if((!OLop7)&&mkObj.toString().indexOf('Anchor')!= -1){mc=o3_refc='UL';}else{
mW=(OLns4)?mkObj.clip.width:mkObj.offsetWidth;mH=(OLns4)?mkObj.clip.height:mkObj.offsetHeight;}
if(mc=='UL'){off=(mp=='UR')?[-pW,0]:(mp=='LL')?[0,-pH]:(mp=='LR')?[-pW,-pH]:[0,0];
}else if(mc=='UR'){off=(mp=='UR')?[mW-pW,0]:(mp=='LL')?[mW,-pH]:(mp=='LR')?[mW-pW,-pH]:[mW,0];
}else if(mc=='LL'){off=(mp=='UR')?[-pW,mH]:(mp=='LL')?[0,mH-pH]:(mp=='LR')?[-pW,mH-pH]:[0,mH];
}else if(mc=='LR'){off=(mp=='UR')?[mW-pW,mH]:(mp=='LL')?[mW,mH-pH]:(mp=='LR')?[mW-pW,mH-pH]:
[mW,mH];}
return off;
}

// Gets x or y location of object
function OLpageLoc(o,t){
var l=0;
while(o.offsetParent&&o.offsetParent.tagName.toLowerCase()!='html'){
l+=o['offset'+t];o=o.offsetParent;}l+=o['offset'+t];
return l;
} 

// Gets REFerence by id (or name synonym for post-NS4 browsers)
function OLgetRefById(l,d){
var r="",j;d=(d||document);
if(d.all){return d.all[l];}else if(d.getElementById){return d.getElementById(l);
}else if(d.layers&&d.layers.length>0){if(d.layers[l])return d.layers[l];
for(j=0;j<d.layers.length;j++){r=OLgetRefById(l,d.layers[j].document);if(r)return r;}}
return null;
}

// Seeks REFerence by name if not found by id
function OLgetRefByName(l,d){
var r=null,j;d=(d||document);
if(typeof d.images[l]!='undefined'&&d.images[l]){return d.images[l];
}else if(typeof d.anchors[l]!='undefined'&&d.anchors[l]){return d.anchors[l];
}else if(d.layers&&d.layers.length>0){
for(j=0;j<d.layers.length;j++){r=OLgetRefByName(l,d.layers[j].document);
if(r&&r.length>0)return r;else if(r)return [r,d.layers[j]];}}
return null;
}

// Moves the layer
function OLmouseMove(e){
var e=(e)?e:event;
if(e.pageX){o3_x=e.pageX;o3_y= e.pageY;}
else if(e.clientX){
o3_x=e.clientX+eval('o3_frame.'+OLdr).scrollLeft;
o3_y=e.clientY+eval('o3_frame.'+OLdr).scrollTop;}
if(o3_allowmove){OLplaceLayer();if(OLhidePI)OLhideUtil(0,1,1,0,0,0);}
if(OLhover&&OLcursorOff())if(o3_offdelay<1)cClick();else
{if(o3_timerid>0)clearTimeout(o3_timerid);o3_timerid=setTimeout("cClick()",o3_offdelay);}
}

// Capture the mouse and chain other scripts.
function OLmouseCapture(){
var fN,mseHandler=OLmouseMove,re=/function[ ]+(\w+)\(/;
OLcapExtent=document;
if(document.onmousemove||(!OLie4&&window.onmousemove)){
if(window.onmousemove)OLcapExtent=window;
fN=OLcapExtent.onmousemove.toString().match(re)
if(!fN||fN[1]=='anonymous'||fN[1]=='OLmouseMove'){OLchkMseCapture=0;return;}
var str=fN[1]+'(e);'+'OLmouseMove(e);';mseHandler=new Function('e',str)}
OLcapExtent.onmousemove=mseHandler
if(OLns4)OLcapExtent.captureEvents(Event.MOUSEMOVE)
}

////////
// PARSING FUNCTION -- Does the actual command parsing.
////////
function OLparseTokens(pf,ar){
var v,md= -1,par=(pf!='ol_');
OLudf=(par&&!ar.length?1:0);
for(i=0;i< ar.length;i++){
if(md<0){
// Arg is maintext,unless it's a number
if(typeof ar[i]=='number'){OLudf=(par?1:0);i--;}
else{switch(pf){
case 'ol_':ol_text=ar[i];break;
default:o3_text=ar[i];}}
md=0;
}else{
if(ar[i]==INARRAY){OLudf=0;eval(pf+'text=ol_texts['+ar[++i]+']');continue;}
if(ar[i]==CAPARRAY){eval(pf+'cap=ol_caps['+ar[++i]+']');continue;}
if(ar[i]==CAPTION){eval(pf+"cap='"+OLescSglQt(ar[++i])+"'");continue;}
if(ar[i]==DIVID){eval(pf+"divid='"+OLescSglQt(ar[++i])+"'");continue;}
if(ar[i]==DIVCLASS){eval(pf+"divclass='"+OLescSglQt(ar[++i])+"'");continue;}
if(ar[i]==STICKY){eval(pf+'sticky=('+pf+'sticky==0)?1:0');continue;}
if(ar[i]==-STICKY){eval(pf+'sticky=0');continue;}
if(ar[i]==NOFOLLOW){eval(pf+'nofollow=('+pf+'nofollow==0)?1:0');continue;}
if(ar[i]==-NOFOLLOW){eval(pf+'nofollow=0');continue;}
if(ar[i]==BACKGROUND){eval(pf+"background='"+OLescSglQt(ar[++i])+"'");continue;}
if(ar[i]==NOCLOSE){eval(pf+'noclose=('+pf+'noclose==0)?1:0');continue;}
if(ar[i]==-NOCLOSE){eval(pf+'noclose=0');continue;}
if(ar[i]==MOUSEOFF){eval(pf+'mouseoff=('+pf+'mouseoff==0)?1:0');continue;}
if(ar[i]==-MOUSEOFF){eval(pf+'mouseoff=0');continue;}
if(ar[i]==OFFDELAY){eval(pf+'offdelay='+ar[++i]);continue;}
if(ar[i]==RIGHT||ar[i]==LEFT||ar[i]==CENTER){eval(pf+'hpos='+ar[i]);continue;}
if(ar[i]==OFFSETX){eval(pf+'offsetx='+ar[++i]);continue;}
if(ar[i]==OFFSETY){eval(pf+'offsety='+ar[++i]);continue;}
if(ar[i]==FGCOLOR){eval(pf+'fgcolor="'+ar[++i]+'"');continue;}
if(ar[i]==BGCOLOR){eval(pf+'bgcolor="'+ar[++i]+'"');continue;}
if(ar[i]==CGCOLOR){eval(pf+'cgcolor="'+ar[++i]+'"');continue;}
if(ar[i]==TEXTCOLOR){eval(pf+"textcolor='"+OLescSglQt(ar[++i])+"'");continue;}
if(ar[i]==CAPCOLOR){eval(pf+"capcolor='"+OLescSglQt(ar[++i])+"'");continue;}
if(ar[i]==CLOSECOLOR){eval(pf+"closecolor='"+OLescSglQt(ar[++i])+"'");continue;}
if(ar[i]==WIDTH){eval(pf+'width='+ar[++i]);continue;}
if(ar[i]==WRAP){eval(pf+'wrap=('+pf+'wrap==0)?1:0');continue;}
if(ar[i]==-WRAP){eval(pf+'wrap=0');continue;}
if(ar[i]==WRAPMAX){eval(pf+'wrapmax='+ar[++i]);continue;}
if(ar[i]==HEIGHT){eval(pf+'height='+ar[++i]);continue;}
if(ar[i]==BORDER){eval(pf+'border='+ar[++i]);continue;}
if(ar[i]==BASE){eval(pf+'base='+ar[++i]);continue;}
if(ar[i]==STATUS){eval(pf+"status='"+OLescSglQt(ar[++i])+"'");continue;}
if(ar[i]==AUTOSTATUS){eval(pf+'autostatus=('+pf+'autostatus==1)?0:1');continue;}
if(ar[i]==-AUTOSTATUS){eval(pf+'autostatus=('+pf+'autostatus==2)?2:0');continue;}
if(ar[i]==AUTOSTATUSCAP){eval(pf+'autostatus=('+pf+'autostatus==2)?0:2');continue;}
if(ar[i]==-AUTOSTATUSCAP){eval(pf+'autostatus=('+pf+'autostatus==1)?1:0');continue;}
if(ar[i]==CLOSETEXT){eval(pf+"close='"+OLescSglQt(ar[++i])+"'");continue;}
if(ar[i]==SNAPX){eval(pf+'snapx='+ar[++i]);continue;}
if(ar[i]==SNAPY){eval(pf+'snapy='+ar[++i]);continue;}
if(ar[i]==FIXX){eval(pf+'fixx='+ar[++i]);continue;}
if(ar[i]==FIXY){eval(pf+'fixy='+ar[++i]);continue;}
if(ar[i]==RELX){eval(pf+'relx='+ar[++i]);continue;}
if(ar[i]==RELY){eval(pf+'rely='+ar[++i]);continue;}
if(ar[i]==MIDX){eval(pf+'midx='+ar[++i]);continue;}
if(ar[i]==MIDY){eval(pf+'midy='+ar[++i]);continue;}
if(ar[i]==REF){eval(pf+"ref='"+OLescSglQt(ar[++i])+"'");continue;}
if(ar[i]==REFC){eval(pf+"refc='"+OLescSglQt(ar[++i])+"'");continue;}
if(ar[i]==REFP){eval(pf+"refp='"+OLescSglQt(ar[++i])+"'");continue;}
if(ar[i]==REFX){eval(pf+'refx='+ar[++i]);continue;}
if(ar[i]==REFY){eval(pf+'refy='+ar[++i]);continue;}
if(ar[i]==FGBACKGROUND){eval(pf+"fgbackground='"+OLescSglQt(ar[++i])+"'");continue;}
if(ar[i]==BGBACKGROUND){eval(pf+"bgbackground='"+OLescSglQt(ar[++i])+"'");continue;}
if(ar[i]==CGBACKGROUND){eval(pf+"cgbackground='"+OLescSglQt(ar[++i])+"'");continue;}
if(ar[i]==PADX){eval(pf+'padxl='+ar[++i]);eval(pf+'padxr='+ar[++i]);continue;}
if(ar[i]==PADY){eval(pf+'padyt='+ar[++i]);eval(pf+'padyb='+ar[++i]);continue;}
if(ar[i]==FULLHTML){eval(pf+'fullhtml=('+pf+'fullhtml==0)?1:0');continue;}
if(ar[i]==-FULLHTML){eval(pf+'fullhtml=0');continue;}
if(ar[i]==BELOW||ar[i]==ABOVE||ar[i]==VCENTER){eval(pf+'vpos='+ar[i]);continue;}
if(ar[i]==CAPICON){eval(pf+'capicon="'+ar[++i]+'"');continue;}
if(ar[i]==TEXTFONT){eval(pf+"textfont='"+OLescSglQt(ar[++i])+"'");continue;}
if(ar[i]==CAPTIONFONT){eval(pf+"captionfont='"+OLescSglQt(ar[++i])+"'");continue;}
if(ar[i]==CLOSEFONT){eval(pf+"closefont='"+OLescSglQt(ar[++i])+"'");continue;}
if(ar[i]==TEXTSIZE){eval(pf+"textsize='"+ar[++i]+"'");continue;}
if(ar[i]==CAPTIONSIZE){eval(pf+"captionsize='"+ar[++i]+"'");continue;}
if(ar[i]==CLOSESIZE){eval(pf+"closesize='"+ar[++i]+"'");continue;}
if(ar[i]==TIMEOUT){eval(pf+'timeout='+ar[++i]);continue;}
if(ar[i]==DELAY){eval(pf+'delay='+ar[++i]);continue;}
if(ar[i]==HAUTO){eval(pf+'hauto=('+pf+'hauto==0)?1:0');continue;}
if(ar[i]==-HAUTO){eval(pf+'hauto=0');continue;}
if(ar[i]==VAUTO){eval(pf+'vauto=('+pf+'vauto==0)?1:0');continue;}
if(ar[i]==-VAUTO){eval(pf+'vauto=0');continue;}
if(ar[i]==NOJUSTX){eval(pf+'nojustx=('+pf+'nojustx==0)?1:0');continue;}
if(ar[i]==-NOJUSTX){eval(pf+'nojustx=0');continue;}
if(ar[i]==NOJUSTY){eval(pf+'nojusty=('+pf+'nojusty==0)?1:0');continue;}
if(ar[i]==-NOJUSTY){eval(pf+'nojusty=0');continue;}
if(ar[i]==CLOSECLICK){eval(pf+'closeclick=('+pf+'closeclick==0)?1:0');continue;}
if(ar[i]==-CLOSECLICK){eval(pf+'closeclick=0');continue;}
if(ar[i]==CLOSETITLE){eval(pf+"closetitle='"+OLescSglQt(ar[++i])+"'");continue;}
if(ar[i]==FGCLASS){eval(pf+"fgclass='"+OLescSglQt(ar[++i])+"'");continue;}
if(ar[i]==BGCLASS){eval(pf+"bgclass='"+OLescSglQt(ar[++i])+"'");continue;}
if(ar[i]==CGCLASS){eval(pf+"cgclass='"+OLescSglQt(ar[++i])+"'");continue;}
if(ar[i]==TEXTPADDING){eval(pf+'textpadding='+ar[++i]);continue;}
if(ar[i]==TEXTFONTCLASS){eval(pf+"textfontclass='"+OLescSglQt(ar[++i])+"'");continue;}
if(ar[i]==CAPTIONPADDING){eval(pf+'captionpadding='+ar[++i]);continue;}
if(ar[i]==CAPTIONFONTCLASS){eval(pf+"captionfontclass='"+OLescSglQt(ar[++i])+"'");continue;}
if(ar[i]==CLOSEFONTCLASS){eval(pf+"closefontclass='"+OLescSglQt(ar[++i])+"'");continue;}
if(ar[i]==CAPBELOW){eval(pf+'capbelow=('+pf+'capbelow==0)?1:0');continue;}
if(ar[i]==-CAPBELOW){eval(pf+'capbelow=0');continue;}
if(ar[i]==DONOTHING){continue;}
i=OLparseCmdLine(pf,i,ar);}}
if((OLfunctionPI)&&OLudf&&o3_function)o3_text=o3_function();
if(pf=='o3_')OLfontSize();
}

////////
// LAYER FUNCTIONS
////////
// Writes to a layer
function OLlayerWrite(txt){
txt+="\n";
if(OLns4){over.document.write(txt);over.document.close();
}else if(typeof over.innerHTML!='undefined'){if(OLieM)over.innerHTML='';over.innerHTML=txt;
}else{range=o3_frame.document.createRange();range.setStartAfter(over);
domfrag=range.createContextualFragment(txt);
while(over.hasChildNodes()){over.removeChild(over.lastChild);}
over.appendChild(domfrag);}
}

// Make an object visible
function OLshowObject(obj){
var theObj=(OLns4?obj:obj.style);o3_showid=0;
if(((OLfilterPI)&&!OLchkFilter(theObj))||!OLfilterPI)theObj.visibility="visible";
if(OLshadowPI)OLshowShadow();if(OLiframePI)OLshowIfShim();if(OLhidePI)OLhideUtil(1,1,0);
}

// Hides an object
function OLhideObject(obj){
var theObj=(OLns4?obj:obj.style);
if(o3_showid>0){clearTimeout(o3_showid);o3_showid=0;}
if(OLiframePI)OLhideIfShim();if(OLshadowPI)OLhideShadow();
theObj.visibility="hidden";
if(OLhidePI)OLhideUtil(0,0,1);if((OLfilterPI)&&o3_filter)OLcleanupFilter(theObj);
if(o3_timerid>0)clearTimeout(o3_timerid);if(o3_delayid>0)clearTimeout(o3_delayid);
o3_timerid=0;o3_delayid=0;
self.status="";
if(OLdraggablePI&&o3_dragging)OLclearDrag();
if(over.onmouseover)over.onmouseover=null;
if(OLscrollPI)OLclearScroll();
}

// Move a layer
function OLrepositionTo(obj,xL,yL,draggable){
if(!draggable){
	if(OLxPos){xL=OLxPos;}
	if(OLyPos){yL=OLyPos;}
}
var theObj=(OLns4?obj:obj.style);
theObj.left=(OLns4?xL:xL+'px');
theObj.top=(OLns4?yL:yL+'px');
OLxPos=xL;OLyPos=yL;
}

// Check position of cursor relative to overDiv; mouseOut function
function OLcursorOff(){
if(OLovertwoPI&&over==over2)return false;
var theObj=(OLns4?over:over.style),pHt=OLns4?over.clip.height:over.offsetHeight;
var left=parseInt(theObj.left),top=parseInt(theObj.top);
var right=left+o3_width,bottom=top+((OLbubblePI&&o3_bubble)?OLbubbleHt:pHt);
if(o3_x<left||o3_x>right||o3_y<top||o3_y>bottom)return true;
return false;
}

////////
// COMMAND FUNCTIONS
////////
// Sets up mouseoff feature for stickies
function OLoptMOUSEOFF(close){
if(!close)o3_close="";
over.onmouseover=function(){OLhover=1;if(o3_timerid>0){clearTimeout(o3_timerid);o3_timerid=0;}}
}

function OLescSglQt(str){
return str.toString().replace(/'/g,"\\'");
}

function OLhasDims(str){
return /[%\-a-z]+$/.test(str);
}

function OLfontSize(){
var i;
if(OLhasDims(o3_textsize)){if(OLns4)o3_textsize="2";}else
if(!OLns4){i=parseInt(o3_textsize);o3_textsize=(i>0&&i<8)?OLpct[i]:OLpct[0];}
if(OLhasDims(o3_captionsize)){if(OLns4)o3_captionsize="2";}else
if(!OLns4){i=parseInt(o3_captionsize);o3_captionsize=(i>0&&i<8)?OLpct[i]:OLpct[0];}
if(OLhasDims(o3_closesize)){if(OLns4)o3_closesize="2";}else
if(!OLns4){i=parseInt(o3_closesize);o3_closesize=(i>0&&i<8)?OLpct[i]:OLpct[0];}
}

////////
//  REGISTRATION ROUTINES
////////
function OLsetRunTimeVar(){
if(typeof runTime!='undefined'&&runTime.length)for(var k=0;k<runTime.length;k++)runTime[k]();
}

function OLparseCmdLine(pf,i,args){
if(typeof cmdLine!='undefined'&&cmdLine.length){for(var k=0;k<cmdLine.length;k++){
var j=cmdLine[k](pf,i,args);if(j>-1){i=j;break;}}}
return i;
}

function OLisFunc(fnRef){
var rtn=true;
if(typeof fnRef=='object'){for(var i=0;i<fnRef.length;i++){
if(typeof fnRef[i]=='function')continue;rtn=false;break;}
}else if(typeof fnRef!='function')rtn=false;
return rtn;
}

function OLregCmds(cmdStr){
if(typeof cmdStr!='string')return;
var pM=cmdStr.split(',');pMtr=pMtr.concat(pM);
for(var i=0;i<pM.length;i++)eval(pM[i].toUpperCase()+'='+pmCnt++);
}

function OLregRunTimeFunc(functions){
if(OLisFunc(functions)){
if(typeof runTime=='undefined')runTime=new Array();
if(typeof functions=='object')runTime=runTime.concat(functions);
else runTime[runTime.length++]=functions;}
}

function OLregCmdLineFunc(functions){
if(OLisFunc(functions)){
if(typeof cmdLine=='undefined')cmdLine=new Array();
if(typeof functions=='object')cmdLine=cmdLine.concat(functions);
else cmdLine[cmdLine.length++]=functions;}
}

OLloaded=1;
/*
 overlibmws_draggable.js plug-in module - Copyright Foteos Macrides 2002=2004
   For support of the DRAGGABLE feature.
   Initial: August 24, 2002 - Last Revised: April 3, 2004
 See the Change History and Command Reference for overlibmws via:

	http://www.macridesweb.com/oltest/

 License agreement for the standard overLIB applies.  Access license via:
     http://www.bosrup.com/web/overlib/license.html
*/

// PRE-INIT
OLloaded=0;
OLregCmds('draggable');

/////////
// DEFAULT CONFIGURATION
if(typeof ol_draggable=='undefined')var ol_draggable=0;
// END CONFIGURATION
/////////

// INIT
var o3_draggable=0,o3_dragging=0,OLmMv;

// Loads runtime variable defaults.
function OLloadDraggable(){
o3_draggable=ol_draggable;
}

// For commandline parser.
function OLparseDraggable(pf,i,ar){
var k=i;
if(k<ar.length){
if(ar[k]==DRAGGABLE){eval(pf+'draggable=('+pf+'draggable==0)?1:0');return k;}
if(ar[k]==-DRAGGABLE){eval(pf+'draggable=0');return k;}}
return -1;
}

/////////
// DRAGGABLE SUPPORT FUNCTIONS
/////////
// Act on DRAGGABLE if sticky and in our frame, otherwise, make sure dragging is off.
function OLcheckDrag(){
if(o3_draggable&&o3_sticky&&(o3_frame==self)){if(!o3_dragging)OLinitDrag();}
else{if(o3_dragging)OLclearDrag();}
}

function OLinitDrag(){
OLmMv=OLcapExtent.onmousemove;
if(OLns4){
document.captureEvents(Event.MOUSEDOWN|Event.CLICK);
document.onmousedown=OLgrabEl;
document.onclick=function(e){return routeEvent(e);}
}else{
// Hacked by Loopinglechat Permet au drag and drop de n'agir que sur la partie header de l'overlib	
document.getElementById('overlibheader').onmousedown=OLgrabEl;
document.getElementById('overlibheader').style.cursor="move";
//over.onmousedown=OLgrabEl;
//if(OLie4&&over.onselectstart!='undefined')over.onselectstart=function(){return false;}
//over.style.cursor="move";
}
o3_dragging=1;
return true;
}

function OLgrabEl(e){
var e=(e)?e:event;
var cKy=(OLns4?e.modifiers&Event.ALT_MASK:(!OLop7)?e.altKey:e.ctrlKey);
if(cKy){
if(OLie4&&over.onselectstart!='undefined')over.onselectstart=null;
if(!OLns4)over.style.cursor="auto";
document.onmouseup=function(){
if(!OLns4){
if(OLie4&&over.onselectstart!='undefined') over.onselectstart=function(){return false;}
if(!OLns4)over.style.cursor="move";}}
return(OLns4?routeEvent(e):true);}
OLmMv(e);
if(OLns4){
cX=e.pageX;cY=e.pageY;
}else{
cX=o3_x-(parseInt(over.style.left));cY=o3_y-(parseInt(over.style.top));
if((OLshadowPI)&&bkdrop&&o3_shadow){
cbX=o3_x-(parseInt(bkdrop.style.left));cbY=o3_y-(parseInt(bkdrop.style.top));}}
if(OLns4)document.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);
OLcapExtent.onmousemove=OLmoveEl;
document.onmouseup=function(){OLcapExtent.onmousemove=OLmMv;document.onmouseup=null;}
return (OLns4?routeEvent(e):false);
}

function OLmoveEl(e){
OLmMv(e);
if(OLns4){
newX=e.pageX;newY=e.pageY;
over.moveBy(newX-cX,newY-cY);
if((OLshadowPI)&&bkdrop&&o3_shadow)bkdrop.moveBy(newX-cX,newY-cY);
cX=newX;cY=newY;
}else{
OLrepositionTo(over,o3_x-cX,o3_y-cY,true);
if((OLiframePI)&&OLie55&&OLifShim)OLrepositionTo(OLifShim,o3_x-cX,o3_y-cY,true);
if((OLshadowPI)&&bkdrop&&o3_shadow){
OLrepositionTo(bkdrop,o3_x-cbX,o3_y-cbY,true);
if((OLiframePI)&&OLie55&&OLifShimShadow)OLrepositionTo(OLifShimShadow,o3_x-cbX,o3_y-cbY,true);}}
if(OLhidePI)OLhideUtil(0,1,1,0,0,0);
return false;
}

function OLclearDrag(){
if(OLns4){
document.releaseEvents(Event.MOUSEDOWN|Event.MOUSEUP|Event.CLICK);
document.onmousedown=document.onmouseup=document.onclick=null;
}else if(OLie4||OLns6){
over.onmousedown=null;
if(OLie4&&over.onselectstart!='undefined')over.onselectstart=null;
over.style.cursor="auto";}
o3_dragging=0;
}

////////
// PLUGIN REGISTRATIONS
////////
OLregRunTimeFunc(OLloadDraggable);
OLregCmdLineFunc(OLparseDraggable);

OLdraggablePI=1;
OLloaded=1;
/*
 overlibmws_hide.js plug-in module - Copyright Foteos Macrides 2003-2004
   For hiding elements.
   Initial: November 13, 2003 - Last Revised: April 3, 2004
 See the Change History and Command Reference for overlibmws via:

	http://www.macridesweb.com/oltest/

 License agreement for the standard overLIB applies.  Access license via:
	http://www.bosrup.com/web/overlib/license.html
*/

// PRE-INIT
OLloaded=0;
OLregCmds('hideselectboxes,hidebyid,hidebyidall,hidebyidns4');

/////////
// DEFAULT CONFIGURATION
if(typeof ol_hideselectboxes=='undefined')var ol_hideselectboxes=0;
if(typeof ol_hidebyid=='undefined')var ol_hidebyid='';
if(typeof ol_hidebyidall=='undefined')var ol_hidebyidall='';
if(typeof ol_hidebyidns4=='undefined')var ol_hidebyidns4='';
// END CONFIGURATION
/////////

// INIT
var o3_hideselectboxes=0,o3_hidebyid='',o3_hidebyidall='',o3_hidebyidns4='';
var OLselNum,OLselectOK=(OLop7||((OLselNum=navigator.userAgent.match(/Gecko\/(\d{8})/i))&&
parseInt(OLselNum[1])>=20030624))?1:0;

// Loads runtime variable defaults.
function OLloadHide(){
o3_hideselectboxes=ol_hideselectboxes;o3_hidebyid=ol_hidebyid;o3_hidebyidall=ol_hidebyidall;
o3_hidebyidns4=ol_hidebyidns4;
}

// For commandline parser.
function OLparseHide(pf,i,ar){
var k=i;
if(k<ar.length){
if(ar[k]==HIDESELECTBOXES){eval(pf+'hideselectboxes=('+pf+'hideselectboxes==0)?1:0');return k;}
if(ar[k]==-HIDESELECTBOXES){eval(pf+'hideselectboxes=0');return k;}
if(ar[k]==HIDEBYID){eval(pf+"hidebyid='"+OLescSglQt(ar[++k])+"'");return k;}
if(ar[k]==HIDEBYIDALL){eval(pf+"hidebyidall='"+OLescSglQt(ar[++k])+"'");return k;}
if(ar[k]==HIDEBYIDNS4){eval(pf+"hidebyidns4='"+OLescSglQt(ar[++k])+"'");return k;}}
return -1;
}

////////
// HIDE SUPPORT FUNCTIONS
////////
// handle the commands with id parameters
function OLchkHide(hide){
if(OLiframePI&&OLie55)return;
var theID,theObj,i;
if(o3_hidebyid&&typeof o3_hidebyid=='string'&&!(o3_hideselectboxes&&OLns6)&&!OLop7&&!OLns4){
theID=o3_hidebyid.replace(/[ ]/ig,'').split(',');
for(i=0;i<theID.length;i++){
theObj=(OLie4?o3_frame.document.all[theID[i]]:
OLns6?o3_frame.document.getElementById(theID[i]):null);
if(theObj!='undefined'&&theObj)theObj.style.visibility=(hide?'hidden':'visible');}}
if(o3_hidebyidall&&typeof o3_hidebyidall=='string'){
theID=o3_hidebyidall.replace(/[ ]/ig,'').split(',');
for(i=0;i<theID.length;i++){
theObj=(OLie4?o3_frame.document.all[theID[i]]:
OLns6?o3_frame.document.getElementById(theID[i]):
OLns4?o3_frame.document.eval(theID[i]):null);
if(theObj!='undefined'&&theObj){theObj=(
OLns4)?theObj:theObj.style;
theObj.visibility=(hide?'hidden':'visible');}}}
if(o3_hidebyidns4&&OLns4&&typeof o3_hidebyid=='string'){
theID=o3_hidebyidns4.replace(/[ ]/ig,'').split(',');
for(i=0;i<theID.length;i++){
theObj=o3_frame.document.eval(theID[i]);
if(theObj!='undefined'&&theObj)theObj.visibility=(hide?'hidden':'visible');}}
}

// handle the HIDESELECTBOXES command
function OLselectBoxes(hide,all){
var px=over.offsetLeft,py=over.offsetTop,pw=over.offsetWidth,ph=over.offsetHeight;
var bx=px,by=py,bw=pw,bh=ph;
if(!this.object)this.object=o3_frame.document.getElementsByTagName("object");
if(this.object.length>0){var sx,sy,sw,sh,i,obj=this.object,objp;
for(i=0;i<obj.length;i++){sx=0;sy=0;
if(obj[i].offsetParent){objp=obj[i];while(objp.offsetParent&&objp.offsetParent.tagName.toLowerCase()!='body'){
objp=objp.offsetParent;sx+=objp.offsetLeft;sy+=objp.offsetTop;}
sx+=obj[i].offsetLeft;sy+=obj[i].offsetTop;sw=obj[i].offsetWidth;sh=obj[i].offsetHeight;
if(hide){if((px+pw>sx&&px<sx+sw&&py+ph>sy&&py<sy+sh)||(bx+bw>sx&&bx<sx+sw&&by+bh>sy&&by<sy+sh)){
if(obj[i].style.visibility!="hidden")obj[i].style.visibility="hidden";
}}else{if(all||(px+pw<sx||px>sx+sw||py+ph<sy||py>sy+sh)&&(bx+bw<sx||bx>sx+sw||by+bh<sy||by>sy+sh)){
if(obj[i].style.visibility!="visible")obj[i].style.visibility="visible";}}}}}
if((OLiframePI&&OLie55)||OLselectOK||OLns4)return;
if(!this.sel)this.sel=o3_frame.document.getElementsByTagName("select");
if((OLshadowPI)&&bkdrop&&o3_shadow){bx=bkdrop.offsetLeft;by=bkdrop.offsetTop;
bw=bkdrop.offsetWidth;bh=bkdrop.offsetHeight;}
var sx,sy,sw,sh,i,sel=this.sel,selp;
for(i=0;i<sel.length;i++){
sx=0;sy=0;
if(sel[i].offsetParent){
selp=sel[i];while(selp.offsetParent&&selp.offsetParent.tagName.toLowerCase()!='body'){
selp=selp.offsetParent;sx+=selp.offsetLeft;sy+=selp.offsetTop;}
sx+=sel[i].offsetLeft;sy+=sel[i].offsetTop;sw=sel[i].offsetWidth;sh=sel[i].offsetHeight;
if(!OLie4&&sel[i].size<2)continue;
else if(hide){
if((px+pw>sx&&px<sx+sw&&py+ph>sy&&py<sy+sh)||(bx+bw>sx&&bx<sx+sw&&by+bh>sy&&by<sy+sh)){
if(sel[i].style.visibility!="hidden")sel[i].style.visibility="hidden";}
}else{
if(all||(px+pw<sx||px>sx+sw||py+ph<sy||py>sy+sh)&&(bx+bw<sx||bx>sx+sw||by+bh<sy||by>sy+sh)){
if(sel[i].style.visibility!="visible")sel[i].style.visibility="visible";}}}}
}

// Utility call sets
function OLhideUtil(a1,a2,a3,a4,a5,a6){
if(a4==null){OLchkHide(a1);if(o3_hideselectboxes)OLselectBoxes(a2,a3);
}else{OLchkHide(a1);OLchkHide(a2);
if(o3_hideselectboxes){OLselectBoxes(a3,a4);OLselectBoxes(a5,a6);}}
}

////////
// PLUGIN REGISTRATIONS
////////
OLregRunTimeFunc(OLloadHide);
OLregCmdLineFunc(OLparseHide);

OLhidePI=1;
OLloaded=1;
/*
 overlibmws_iframe.js plug-in module - Copyright Foteos Macrides 2003-2004
   Masks system controls to prevent obscuring of popops for IE v5.5 or higher.
   Initial: October 19, 2003 - Last Revised: June 27, 2004
 See the Change History and Command Reference for overlibmws via:

	http://www.macridesweb.com/oltest/

 License agreement for the standard overLIB applies.  Access license via:
	http://www.bosrup.com/web/overlib/license.html
*/

// PRE-INIT
OLloaded=0;

// INIT
var OLifShim=null,OLifShimShadow=null,OLifShimOvertwo=null,OLifShimSrc='';

////////
// IFRAME SHIM SUPPORT FUNCTIONS
////////
function OLinitIframe(){
if(!OLie55)return;
OLifShimSrc=(document.URL.indexOf('https://')==0)?'/blank.html':'javascript:void(0)';
var theObj;
if((OLovertwoPI)&&over2&&over==over2){
theObj=o3_frame.document.all['overIframeOvertwo'];
if(theObj=='undefined'||!theObj||OLifShimOvertwo!=theObj){
OLifShimOvertwo=null;OLgetIfShimOvertwoRef();}return;}
theObj=o3_frame.document.all['overIframe'];
if(theObj=='undefined'||!theObj||OLifShim!=theObj){
OLifShim=null;OLgetIfShimRef();}
if((OLshadowPI)&&o3_shadow){
theObj=o3_frame.document.all['overIframeShadow'];
if(theObj=='undefined'||!theObj||OLifShimShadow!=theObj){
OLifShimShadow=null;OLgetIfShimShadowRef();}}
}

function OLsetIfShimRef(obj,i,s,z){
with(obj){id=i;src=s;}
with(obj.style){position='absolute';top=0;left=0;width=1;height=1;visibility='hidden';
zIndex=over.style.zIndex-z;filter='Alpha(style=0,opacity=0)';}
}

function OLgetIfShimRef(){
if(OLifShim||!OLie55)return;
var body=o3_frame.document.all.tags('body')[0];
OLifShim=o3_frame.document.createElement('iframe');
if(typeof OLifShim.style.filter!='string'){if(typeof OLifShim!='undefined')
OLifShim.style.display='none';OLifShim=null;OLie55=false;return;}
body.insertBefore(OLifShim,body.firstChild);
OLsetIfShimRef(OLifShim,'overIframe',OLifShimSrc,2);
}

function OLgetIfShimShadowRef(){
if(OLifShimShadow||!OLie55)return;
var body=o3_frame.document.all.tags('body')[0];
OLifShimShadow=o3_frame.document.createElement('iframe');
if(typeof OLifShimShadow.style.filter!='string'){if(typeof OLifShimShadow!='undefined')
OLifShimShadow.style.display='none';OLifShimShadow=null;OLie55=false;return;}
body.insertBefore(OLifShimShadow,body.firstChild);
OLsetIfShimRef(OLifShimShadow,'overIframeShadow',OLifShimSrc,3);
}

function OLgetIfShimOvertwoRef(){
if(OLifShimOvertwo||!OLie55)return;
var body=o3_frame.document.all.tags('body')[0];
OLifShimOvertwo=o3_frame.document.createElement('iframe');
if(typeof OLifShimOvertwo.style.filter!='string'){if(typeof OLifShimOvertwo!='undefined')
OLifShimOvertwo.style.display='none';OLifShimOvertwo=null;OLie55=false;return;}
body.insertBefore(OLifShimOvertwo,body.firstChild);
OLsetIfShimRef(OLifShimOvertwo,'overIframeOvertwo',OLifShimSrc,1);
}

function OLsetDispIfShim(obj,w,h){
with(obj.style){width=w+'px';height=h+'px';clip='rect(0px '+w+'px '+h+'px 0px)';}
obj.filters.alpha.enabled=true;
}

function OLdispIfShim(){
if(!OLie55)return;
var wd=over.offsetWidth,ht=over.offsetHeight;
if((OLovertwoPI)&&over2&&over==over2){
if(!OLifShimOvertwo)return;
OLsetDispIfShim(OLifShimOvertwo,wd,ht);return;}
if(!OLifShim)return;
OLsetDispIfShim(OLifShim,wd,ht);
if((!OLshadowPI)||!o3_shadow||!OLifShimShadow)return;
OLsetDispIfShim(OLifShimShadow,wd,ht);
}

function OLshowIfShim(){
if(OLifShim){OLifShim.style.visibility="visible";
if((OLshadowPI)&&o3_shadow&&OLifShimShadow)OLifShimShadow.style.visibility="visible";}
}

function OLhideIfShim(){
if(OLifShim)OLifShim.style.visibility="hidden";
if((OLshadowPI)&&o3_shadow&&OLifShimShadow)OLifShimShadow.style.visibility="hidden";
}

function OLrepositionIfShim(X,Y){
if(OLie55){if((OLovertwoPI)&&over2&&over==over2){
if(OLifShimOvertwo)OLrepositionTo(OLifShimOvertwo,X,Y);}
else{if(OLifShim){OLrepositionTo(OLifShim,X,Y);if((OLshadowPI)&&o3_shadow&&OLifShimShadow)
OLrepositionTo(OLifShimShadow,X+o3_shadowx,Y+o3_shadowy);}}}
}

OLiframePI=1;
OLloaded=1;
/*
 overlibmws_exclusive.js plug-in module - Copyright Foteos Macrides 2003-2004
   For support of the EXCLUSIVE feature.
   Initial: November 7, 2003 - Last Revised: April 3, 2004
 See the Change History and Command Reference for overlibmws via:

	http://www.macridesweb.com/oltest/

 License agreement for the standard overLIB applies.  Access license via:
	http://www.bosrup.com/web/overlib/license.html
*/

// PRE-INIT
OLloaded=0;
OLregCmds('exclusive,exclusivestatus,exclusiveoverride');

/////////
// DEFAULT CONFIGURATION
if(typeof ol_exclusive=='undefined')var ol_exclusive=0;
if(typeof ol_exclusivestatus=='undefined')var ol_exclusivestatus=
'Please act on or close the open popup.';
if(typeof ol_exclusiveoverride=='undefined')var ol_exclusiveoverride=0;
// END CONFIGURATION
/////////

// INIT
var o3_exclusive=0,o3_exclusivestatus='',o3_exclusiveoverride=0;

// Loads runtime variable defaults.
function OLloadExclusive(){
o3_exclusive=ol_exclusive;o3_exclusivestatus=ol_exclusivestatus;
o3_exclusiveoverride=ol_exclusiveoverride;
}

// For commandline parser.
function OLparseExclusive(pf,i,ar){
var k=i;
if(k<ar.length){
if(ar[k]==EXCLUSIVE){eval(pf+'exclusive=('+pf+'exclusive==0)?1:0');return k;}
if(ar[k]==-EXCLUSIVE){eval(pf+'exclusive=0');return k;}
if(ar[k]==EXCLUSIVESTATUS){eval(pf+"exclusivestatus='"+OLescSglQt(ar[++k])+"'");return k;}
if(ar[k]==EXCLUSIVEOVERRIDE){eval(pf+'exclusiveoverride=('+pf+'exclusiveoverride==0)?1:0');
return k;}
if(ar[k]==-EXCLUSIVEOVERRIDE){eval(pf+'exclusiveoverride=0');return k;}}
return -1;
}

/////////
// EXCLUSIVE SUPPORT FUNCTIONS
/////////
// indicate whether popup is exclusive and set status message if so. 
function OLisExclusive(args){
if((args!=null)&&OLhasOverRide(args))o3_exclusiveoverride=(ol_exclusiveoverride==0)?1:0;
else o3_exclusiveoverride=ol_exclusiveoverride;
var rtnVal=(o3_exclusive&&!o3_exclusiveoverride&&o3_showingsticky);
if(rtnVal)self.status=o3_exclusivestatus;
return rtnVal;
}

// check the overlib arguments for the EXCLUSIVEOVERRIDE command
function OLhasOverRide(args){
var rtnFlag=0;
for(var i=0;i<args.length;i++){
if(typeof args[i]=='number'&&args[i]==EXCLUSIVEOVERRIDE){
rtnFlag=1;break;}}
return rtnFlag;
}

////////
// PLUGIN REGISTRATIONS
////////
OLregRunTimeFunc(OLloadExclusive);
OLregCmdLineFunc(OLparseExclusive);

OLexclusivePI=1;
OLloaded=1;
// Paramètres globaux
$.ajaxSetup({error:ajaxError,beforeSend:ajaxPrepare,success:ajaxSuccess,cache:false});
function ajaxError(obj,msg){}
function ajaxPrepare(){ajaxLoader('init');}
function ajaxSuccess(msg){if(checkAuthentification(msg)){ajaxLoader('end');}else{return false;}}
function checkAuthentification(msg){
	if(msg!=undefined && msg.indexOf('auth.css')!==-1){
		window.location='/manage/';
		window.setTimeout(void(0),5000);
		return false;
	}
	return true;
}

function clearsetup(){$.ajaxSetup({error:ajaxError,beforeSend:function(){},success:function(){}});}
function reinitsetup(){$.ajaxSetup({error:ajaxError,beforeSend:ajaxPrepare,success:ajaxSuccess});}
/**
	* function updateDivContent
	*
	* Mise à jour du contenu d'un bloc DIV à partir du contenu d'une url
	*
	* @access public
	*
	* @param string url : url du contenu
	* @param string divid : identifiant du bloc DIV contenant la mise à jour
	* @param bool  get_js : est ce que la fonction doit remonter du javascript
	* @param bool  url_js : url du code javascript
	* @param bool  append : si vrai, le contenu reçu sera ajouté au contenu du DIV
	*/
function updateDivContent(url,divid,get_js,url_js, append){
	$.ajax({type: 'GET',url: url,complete:onComplete});
	function onComplete(obj,msg){
		var contentText=getResponseText(obj);
		if(append!=true){
			$('#'+divid).html(contentText);
// 			document.getElementById(divid).innerHTML=contentText;
		}else{
			document.getElementById(divid).innerHTML+=contentText;
		}
// 		if(get_js){
// 			getAutoJavascript(contentText,divid);
// 		}
		if(typeof Emajine_Layers_Obj!='undefined') Emajine_Layers_Obj.getFormActions();
		getFieldFocus(divid);
		if(typeof initManageHeight!='undefined') initManageHeight();
		if(typeof initLayerHeight!='undefined') initLayerHeight();
	}
}

/**
	* function displayContent
	*
	* Ouverture d'un overlib affichant le contenu d'une url
	*
	* @access public
	*
	* @param string url : url du contenu
	* @param string caption : titre de l'overlib
	* @param string closecaption : titre du lien de fermeture
	* @param string divid : identifiant du bloc DIV de l'overlib l'overlib
	* @param string params : une chaine contenant des paramètres supplémentaires pour l'ouverture de l'overlib
	* @param bool  get_js : est ce que la fonction doit remonter du javascript
	* @param bool  url_js : url du code javascript
	*/
function displayContent(url,caption,closecaption,divclass,params,get_js,url_js,callback_function) {
	var ol_param='';
	if(divclass){ol_param+=",DIVCLASS,'"+divclass+"'"}
	if(params){ol_param+=','+params}
	if(!closecaption){closecaption='Close';}
	if(ol_param){
		if(ol_param.search('DIVID')==-1){ol_param+=",DIVID,'overDiv'";}
		var ol="overlib('Please wait...',CAPTION,caption,STICKY,CLOSECLICK,CLOSETEXT,'x',CLOSETITLE,closecaption,DRAGGABLE,HIDESELECTBOXES,CENTER"+ol_param+");";
		eval(ol);
	}else{
		overlib('Please wait...',CAPTION,caption,STICKY,CLOSECLICK,CLOSETEXT,'x',CLOSETITLE,closecaption,DRAGGABLE,HIDESELECTBOXES,CENTER);
	}
	if(divclass!=='confirm' && divclass!=='od_confirm')
		$('#overDiv').css('display','none');
	$.ajax({type: 'GET',url: url,complete:onComplete});
	function onComplete(obj,msg){
		var contentText=getResponseText(obj);
// 		document.getElementById('overlibcontent').innerHTML=contentText;
		$('#overlibcontent').html(contentText);
		getFieldFocus('overlibcontent');
// 		getAutoJavascript(contentText,'overlibcontent');
		if(OLiframePI){OLdispIfShim();}
		if(callback_function){eval(callback_function);}
		if(divclass!=='confirm' && divclass!=='od_confirm')
			$('#overDiv').center();
	}
}

/**
	* function displayOverlib
	*
	* Ouverture d'un overlib affichant un contenu donné en paramètre
	*
	* @access public
	*
	* @param string content : contenu
	* @param string caption : titre de l'overlib
	* @param string closecaption : titre du lien de fermeture
	* @param string divid : identifiant du bloc DIV de l'overlib l'overlib
	* @param string params : une chaine contenant des paramètres supplémentaires pour l'ouverture de l'overlib
	*/
function displayOverlib(content,caption,closecaption,divclass,params) {
	var ol_param='';
	if(divclass){ol_param+=",DIVCLASS,'"+divclass+"'"}
	if(params){ol_param+=','+params}
	if(!closecaption){closecaption='Close';}
	if(ol_param){
		if(ol_param.search('DIVID')==-1){ol_param+=",DIVID,'overDiv'";}
		var ol="overlib(content,CAPTION,caption,STICKY,CLOSECLICK,CLOSETEXT,'x',CLOSETITLE,closecaption,DRAGGABLE,HIDESELECTBOXES,VAUTO"+ol_param+");";
		eval(ol);
	}else{
		overlib(content,CAPTION,caption,STICKY,CLOSECLICK,CLOSETEXT,'x',CLOSETITLE,closecaption,DRAGGABLE,HIDESELECTBOXES,VAUTO);
	}

}

/**
	* function cancelOverDiv
	*
	* Fermeture d'un overlib
	*
	* @access public
	*/
function cancelOverDiv(){
	cClick();
}

/**
	* function submitOverForm
	*
	* Soumission d'un formulaire via XMLHTTPREQUEST et affichage (optionnel) du résultat dans un div
	*
	* @access public
	*
	* @param string url : url du contenu
	* @param string formid : identifiant du formaulaire a soumettre
	* @param string resultid : identifiant du bloc recevant le contenu
	* @param string errorid : identifiant du bloc recevant le contenu en cas d'erreur
	* @param string onresultfunctions : code javascript à exécuter en cas de résultat
	* @param string onerrorfunctions : code javascript à exécuter en cas d'erreur
	*/
function submitOverForm(url,formid,resultid,errorid,onresultfunctions,onerrorfunctions,get_js,url_js){
	var get='&';
	if(formid){
		var forms=$('form');
		for(var x=0;x<forms.length;x++){
			if(forms[x].getAttribute('id')==formid) frm=forms[x];
		}
		if(frm){
			for (var i = 0; i < frm.length; i++){
				if(frm.elements[i].name){
					if(frm.elements[i].type=='select-multiple'){
						var selectvalues='';
						opt=frm.elements[i].options;
						for (var cpt=0; cpt < opt.length; cpt++) {
							 if (opt[cpt].selected) {
									selectvalues+=preparePostValue(opt[cpt].value)+'!';
							 }
						}
						get+=frm.elements[i].name+'='+selectvalues+'&';
					}else if(frm.elements[i].type=='checkbox' || frm.elements[i].type=='radio'){
						if(frm.elements[i].checked){
							get+=frm.elements[i].name+'='+preparePostValue(frm.elements[i].value)+'&';
						}
					}else{
						get+=frm.elements[i].name+'='+preparePostValue(frm.elements[i].value)+'&';
					}
				}
			}
		}
	}
	$.ajax({type: 'POST',url: url,data:get,complete:onComplete});
	function onComplete(obj,msg){
		if (resultid || errorid){
			var error=false;
			var contentText=getResponseText(obj);
			var js_div=resultid;
			if(errorid){
				if(errorid=='overeditcontent') errorid='emajine_layer_content_overEdit'+insertElementLayerID;
				var regexp=contentText.match(/error-(.*)/);
				if(regexp){
					$('#'+errorid).html(contentText.replace('error-',''));
					if(typeof Emajine_Layers_Obj!='undefined') Emajine_Layers_Obj.getFormActions();
					getFieldFocus(errorid);
					if(onerrorfunctions){eval(onerrorfunctions);}
					js_div=errorid;
					error=true;
				}
			}
			if(resultid && !error){
				if(resultid=='overeditcontent') resultid='emajine_layer_content_overEdit'+insertElementLayerID
// 				document.getElementById(resultid).innerHTML=contentText;
				$('#'+resultid).html(contentText);
				if(typeof Emajine_Layers_Obj!='undefined') Emajine_Layers_Obj.getFormActions();
				getFieldFocus(resultid);
				
			}
			if(onresultfunctions && !error){eval(onresultfunctions);}
			if(typeof onWindowResize!='undefined') onWindowResize();
			if(typeof getConfigFormActions=='function') getConfigFormActions();
		}
// 		if(get_js) getAutoJavascript(contentText,js_div);
	}
}

/**
	* function preparePostValue
	*
	* Suppression de caractère spéciaux dans les valeurs devant passer en POST
	*
	* @access public
	*
	* @param string value : valeur à préparer
	*
	* @return string output : valeur préparé
	*/
function preparePostValue(value){
	return encodeURIComponent(value);
}

/**
	* function sendRequest
	*
	* Envoi une requete HTTP simple
	*
	* @access public
	*
	* @param string url : requete
	* @param string onresultfunctions : function executer en cas de reponse positive
	* @param boolean lock : active le pleasewait
	* @param boolean sync : active le mode synchrone
	*/
var requestLock = false;
function sendRequest(url, onresultfunctions, lock,sync){
	if(typeof sync =='undefined') sync=false;
	if(lock){
		if(requestLock){
			return void(0);
		}else{
			$('#pleasewait').style.display = "block";
			requestLock = true;
		}
	}
	var xmlhttp=getXmlHttpObject();
	if(sync){
		xmlhttp.open("GET",url, false);
		xmlhttp.send(null);
		if(xmlhttp.status == 200){
			var contentText=getResponseText(xmlhttp);
			if(onresultfunctions) eval(onresultfunctions);
			$('#pleasewait').style.display = "none";
			requestLock = false;
		}
	}else{
		xmlhttp.open("GET",url, true);
		xmlhttp.onreadystatechange=function(){
			if (xmlhttp.readyState==4) {
				if(xmlhttp.status == 200){
					var contentText=getResponseText(xmlhttp);
					if(onresultfunctions) eval(onresultfunctions);
// 					$('#pleasewait').style.display = "none";
					requestLock = false;
				}
			}
		}
		xmlhttp.send(null);
	}
}
/**
	* Enlève un élément du DOM. (la méthode elmt.remove() n'existe pas !)
*/
function removeElement(elmtId){
	var elmt;
	if (elmt = $('#'+elmtId)){
		elmt.parentNode.removeChild(elmt);
		return true;
	}
	return false;
}

/**
	* function getResponseText
	*
	* Récupère la variable responseText
	*
	* @access public
	*/
function getResponseText(xmlhttpObj){
	if(xmlhttpObj.responseText.indexOf('<!--endOfProgressBar-->')!=-1){
		return xmlhttpObj.responseText.substr(xmlhttpObj.responseText.indexOf('<!--endOfProgressBar-->')+23);
	}
	return xmlhttpObj.responseText;
}

/**
	* function getProgressBar
	*
	* Affichage d'une progressbar pour l'attente de réponse d'xmlhttprequest
	*
	* @access public
	*/
function ajaxLoader(step){
	if(! $('#ajaxLoader').length){
		$('<div id="ajaxLoader" style="display:none;z-index:1000;position:absolute;"></div>').appendTo('body');
	}
	if(step==='init'){
		$('#ajaxLoader').text('Veuillez patienter...').center().show();
	}else{
		$('#ajaxLoader').text('OK').hide('slow');
	}
}
function getProgressBar(xmlhttpObj){
	if(! document.getElementById('pleasewait')){
		var pleasewait=document.createElement('div');
		pleasewait.id='pleasewait';
		pleasewait.className='static';
		pleasewait.setAttribute('style','position: absolute; display: block; z-index: 1000;text-align:center;');
		var title=document.createElement('h1');
		title.innerHTML='Veuillez patientez';
		pleasewait.appendChild(title);
		var loader=document.createElement('img');
		loader.src='/common_images/ajax-loader.gif';
		pleasewait.appendChild(loader);
		document.getElementsByTagName('body')[0].appendChild(pleasewait);
	}else{
		pleasewait=document.getElementById('pleasewait');
	}
	var state=xmlhttpObj.readyState;
	if(state==4){
		pleasewait.style.display = "none";
	}else if(state==3){
		var contentText=xmlhttpObj.responseText;
		if(typeof contentText!=='undefined' && contentText.match(/^[0-9,]*$/)){
			var nb=0;
			if(contentText.lastIndexOf(',')!=-1)
				nb=contentText.substr(contentText.lastIndexOf(',')+1);
			if(! document.getElementById('emajineProgressBarPercent')){
				var emajineProgressBar=document.createElement('div');
				emajineProgressBar.id='emajineProgressBar';
				
				var emajineProgressBarPercent=document.createElement('div');
				emajineProgressBarPercent.id='emajineProgressBarPercent';
				emajineProgressBarPercent.innerHTML='&nbsp;';
				emajineProgressBar.appendChild(emajineProgressBarPercent);
// 				var emajineProgressBarInfos=document.createElement('span');
// 				emajineProgressBarInfos.id='emajineProgressBarInfos';
// 				emajineProgressBarInfos.innerHTML='0%';
// 				emajineProgressBar.appendChild(emajineProgressBarInfos);
				pleasewait.appendChild(emajineProgressBar);
			}else{
				var emajineProgressBar=document.getElementById('emajineProgressBar');
				var emajineProgressBarPercent=document.getElementById('emajineProgressBarPercent');
				emajineProgressBarPercent.style.width='0%';
// 				var emajineProgressBarInfos=document.getElementById('emajineProgressBarInfos');
			}
			pleasewait.className='progressBar';
			emajineProgressBar.style.display='block';
// 			emajineProgressBarInfos.innerHTML=nb+'%';
			emajineProgressBarPercent.style.width=nb+'%';
		}
	}else{
		if(state==1){
			pleasewait.style.display = "block";
			var height=pleasewait.offsetHeight;
			var width=pleasewait.offsetWidth;
			pleasewait.style.display = "none";
			var parentWindow=document.documentElement;
			var pHeight=parentWindow.clientHeight;
			var pWidth=parentWindow.offsetWidth;
			var sTop=parentWindow.scrollTop;
			var sLeft=parentWindow.scrollLeft;
			var posY=(pHeight/2)-(height/2)+sTop;
			var posX=(pWidth/2)-(width/2)+sLeft;
			pleasewait.style.top=posY+"px";
			pleasewait.style.left=posX+"px";
			pleasewait.className='static';
			if(document.getElementById('emajineProgressBar'))
				document.getElementById('emajineProgressBar').style.display='none';
		}
		pleasewait.style.display = "block";
	}
}

/**
	* function getAutoJavascript
	*
	* Execution du javascript présent dans un texte
	*
	* @access public
	*
	* @param string content : texte a parser
	*
	*/
function getAutoJavascript(content,divid){
	if(document.getElementById(divid)) {
		var scripts=document.getElementById(divid).getElementsByTagName('script')
		if(scripts.length>0){
			for(var i in scripts){
				if(typeof scripts[i]!=='undefined'){
					if(typeof scripts[i].type!=='undefined'){
						if(scripts[i].src){
							// Il faudrait que les scripts soient préchargés...
							//getJavascript(scripts[i].src);
						}else if(scripts[i].innerHTML){
							var script=scripts[i].innerHTML;
							var headobj = document.getElementsByTagName('head').item(0);
							var scriptobj = document.createElement('script');
							if (typeof scriptobj != 'object') scriptobj = document.standardCreateElement('script');
							scriptobj.setAttribute('type','text/javascript');
							scriptobj.text = script;
							scriptobj.defer="false";
							headobj.appendChild(scriptobj);
						}
					}
				}
			}
		}
	}
}

function getJavascript(url_js){
	loadJavascriptSync(url_js);
}
function loadJavascriptSync(url_js){
	$.ajax({type: 'GET',url:url_js,complete:onComplete});
	function onComplete(obj,msg){
		var contentText=getResponseText(obj);
		var headobj = document.getElementsByTagName('head').item(0);
		var scriptobj = document.createElement('script');
		if (typeof scriptobj != 'object') scriptobj = document.standardCreateElement('script');
		scriptobj.setAttribute('type','text/javascript');
		scriptobj.setAttribute('defer',"false");
		scriptobj.text = contentText;
		scriptobj.defer="false";
		headobj.appendChild(scriptobj);
	}
}

function getFieldFocus(divId){
	var isFocus=false;
	$('#'+divId+' form input').each(function(v,e){if(!isFocus){$(e).focus();isFocus=true;}});
}

/**
	* function getXmlHttpObject
	*
	* Création d'un objet XmlHttpRequest
	*
	* @access public
	*/
function getXmlHttpObject(){
	var xmlhttp;try {xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");} catch (e) {try {xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");} catch (E) {	xmlhttp = false;}}if (!xmlhttp && typeof XMLHttpRequest!=undefined) {xmlhttp = new XMLHttpRequest();} else if(!xmlhttp){xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");}return xmlhttp; }
var baseURL = "http://"+window.location.hostname+"/manage/";
var insertElementLayerID=0;
var lastOverEdit=false;

// Emajine_Layers Class
var Emajine_Layers=function(){
	this._emajine_layers_stack=new Array();
	this._emajine_layers_active_zindex=550;
	this._emajine_layers_mask_zindex=150;
	this.layer_css_class='emajine_class'; // class css par défaut
	this.layer_close_title='Fermer';
	this.layer_position='0';
}

// Ouverture d'un nouveau layer
Emajine_Layers.prototype.open_emajine_layer=function(layer_id,layer_caption){
	if(this._emajine_layers_stack.length===0){
		this._create_emajine_mask_layer();
		this._emajine_layers_active_zindex=550;
	}
	this.layer_id=layer_id;
	this.layer_caption=layer_caption;
	var layer_exists=this.emajine_layer_exists();
	if(layer_exists===false)
		this._create_emajine_layer();
	
	var layerDiv=false;
	$('div.ressource_layer').each(function(i,v){
		if(v.id==layer_id) layerDiv=$(v);
		
	});
	if(!layerDiv) layerDiv=$('#'+this.layer_id);
	this.layer_div=layerDiv;
		
	this._pile_up_emajine_layers_stack();
	
	if(layer_exists===false){
		var levelClass='layerLevel'+this._emajine_layers_stack.length;
		this.layer_div.addClass(levelClass);
		this._set_emajine_layer_structure();
	}
}

// Création du nouveau mask
Emajine_Layers.prototype._create_emajine_mask_layer=function(){
	var mask_layer=$('<div id="mask"></div>');
	mask_layer.css('height',$(window).height()+'px');
	mask_layer.css('width',$(window).width()+'px');
	mask_layer.css('z-index',this._emajine_layers_mask_zindex);
	$('body').append(mask_layer);
	this.emajine_layer_hide_elements('select,object');
}

// Suppresion du mask
Emajine_Layers.prototype._remove_emajine_mask_layer=function(){
	$('#mask').remove();
	this.emajine_layer_show_elements('select,object');
}


// Création du nouveau layer
Emajine_Layers.prototype._create_emajine_layer=function(){
	var emajine_layer=$('<div id="'+this.layer_id+'" class="'+this.layer_css_class+'" style="position:absolute;display:none"></div>');
	$('body').append(emajine_layer);
	this._emajine_layers_active_zindex++;
	this._emajine_layers_stack.push(this.layer_id);
}

// Gestion de l'empilement des layers
Emajine_Layers.prototype._pile_up_emajine_layers_stack=function(pile_up_by_stack){
	if(this._emajine_layers_stack.length>0){
		for(var x in this._emajine_layers_stack){
			if(typeof pile_up_by_stack!=='undefined'){
				if(document.getElementById(this._emajine_layers_stack[x]) && document.getElementById(this._emajine_layers_stack[x]).style.zIndex>pile_up_by_stack)
					document.getElementById(this._emajine_layers_stack[x]).style.zIndex--;
			}else{
				if(this._emajine_layers_stack[x]===this.layer_id){
					this.layer_div.css('z-index',this._emajine_layers_active_zindex);
				}
			}
		}
		this.emajine_layer_hide_elements('select');
		this.emajine_layer_hide_elements('object');
	}
}

// Affichage d'un contenu dans le layer courant
Emajine_Layers.prototype.display_layer_content=function(content){
	document.getElementById('emajine_layer_content_'+this.layer_id).innerHTML=content;
	//$('#emajine_layer_content_'+this.layer_id).html(content);
}

// Gestion d'un contenu obtenu par XMLHTTPREQUEST dans le layer courant
Emajine_Layers.prototype.getAjaxContent=function(url,get_js,url_js){
	var contentDiv='emajine_layer_content_'+this.layer_id;
	var layerObj=this;
	$.ajax({type: 'GET',url: url,complete:onComplete});
	function onComplete(obj,msg){
		var contentText=getResponseText(obj);
		document.getElementById(contentDiv).innerHTML=contentText;
		//$('#'+contentDiv).html(contentText);
		getAutoJavascript(contentText,contentDiv);
		layerObj.getFormActions();
		layerObj.setLayerDimension();
		getFieldFocus(contentDiv);
		//initManageHeight();
		initLayerHeight();
		if(typeof get_js==='function') get_js();
	}
}

Emajine_Layers.prototype.getFormActions=function(){
	var button='';
	var layerID='#emajine_layer_content_'+this.layer_id;
	$(layerID+' #submit input').each(function(i,v){
		var name=$(v).attr('name');
		if(name==='submit'){
			var label='Sauvegarder';
		}else{
			var label=$(v).val();
		}
		var onclick=$(v).attr('onclick');
		if(!onclick && $(v).attr('type')==='submit')
			onclick='$(\'#formpersonnalise\').submit();';
		if($(v).attr('type')!=='submit' || name!=='submit')
			$(layerID+' form').append($('<input type="hidden" id="'+name+'" name="'+name+'" value="" />'));
		onclick='$(\'#'+name+'\').val(\''+label+'\');'+onclick;
		if($.browser.msie) onclick+='anonymous();';
		button+='<span class="save"><a href="javascript:void(0);" onclick="'+onclick+'" title="'+label+'">'+label+'</a></span>';
	});
	var cancelLabel='Annuler';
	if(button=='')
		var cancelLabel='Fermer';
	if(this.layer_id==='expand'){
		var cancelLabel='Enregistrer et fermer';
		button='<span class="save">'+
					'<a href="javascript:void(0);" title="'+this.layer_close_title+'" onclick="$(\'#emajine_layer_close_'+this.layer_id+' a\').click()">'+
				cancelLabel+'</a></span>';
	}else if(button){
		button+='<span class="cancel">'+
					'<span>ou&nbsp;</span>'+
					'<a href="javascript:void(0);" title="'+this.layer_close_title+'" onclick="$(\'#emajine_layer_close_'+this.layer_id+' a\').click()">'+
						cancelLabel+'</a>'+
				'</span>';
		$('#emajine_layer_content_'+this.layer_id+' #submit').remove();
	}else{
		button='<span class="cancel">'+
					'<a href="javascript:void(0);" title="'+this.layer_close_title+'" onclick="$(\'#emajine_layer_close_'+this.layer_id+' a\').click()">'+
				cancelLabel+'</a></span>';
	}
	$('#emajine_layer_footer_'+this.layer_id+' div.submit').html(button);
	var layerID=this.layer_id;
	$(document).ready(function(){
		var width=0;
		$('#emajine_layer_footer_'+layerID+' div.submit > span').each(function(i,v){
			width+=$(v).outerWidth({margin:true});
		});
		if(width<100) width=270;
		$('#emajine_layer_footer_'+layerID+' div.submit').css('width',(width+20)+'px');
	});
}

Emajine_Layers.prototype.setLayerDimension=function(){
	this.layer_div.children('div.emajine_layer_content').windowsHeight(100);
	this.layer_div.hCenter().windowsHeight();
	this.layer_div.css('display','block');
}

// Suppression d'un layer
Emajine_Layers.prototype.cancel_emajine_layer=function(layer_id){
	var layerDiv=false;
	$('div.ressource_layer').each(function(i,v){
		if(v.id==layer_id) layerDiv=$(v);
	});
	if(!layerDiv) layerDiv=$('#'+layer_id);
	var emajine_layer=layerDiv;
	var currentZIndex=emajine_layer.css('z-index');
	emajine_layer.remove();
	for(var x in this._emajine_layers_stack)
		if(this._emajine_layers_stack[x]===layer_id)
			break;
	this._emajine_layers_stack.splice(x,1);
	this._pile_up_emajine_layers_stack(currentZIndex);

	if(this._emajine_layers_stack.length===0){
		this._remove_emajine_mask_layer();
	}else{
		this.emajine_layer_show_elements('select');
		this.emajine_layer_show_elements('object');
	}
}

Emajine_Layers.prototype._set_emajine_layer_structure=function(){
	var emajine_layer_structure=
		'<div class="emajine_layer_header">'+
			'<span class="emajine_layer_caption" id="emajine_layer_caption_'+this.layer_id+'">'+this.layer_caption+'</span>'+
			'<span class="emajine_layer_close" id="emajine_layer_close_'+this.layer_id+'">'+
				'<a href="javascript:void(0);" title="'+this.layer_close_title+'" onclick="Emajine_Layers_Obj.cancel_emajine_layer(\''+this.layer_id+'\')">'+
					this.layer_close_title+
				'</a>'+
			'</span>'+
		'</div>'+
		'<div class="emajine_layer_content" id="emajine_layer_content_'+this.layer_id+'">'+
		'</div>'+
		'<div class="emajine_layer_footer" id="emajine_layer_footer_'+this.layer_id+'">'+
			'<div class="formulaire">'+
				'<div class="submit"></div>'+
		'</div>'+
		'</div>';
	this.layer_div.html(emajine_layer_structure);
}

// Définition de la classe Css à utiliser
Emajine_Layers.prototype.set_emajine_layer_css_class=function(css_class){
	this.layer_css_class=css_class;
}

// Définition du titre du bouton ferme
Emajine_Layers.prototype.set_emajine_layer_close_title=function(close_title){
	this.layer_close_title=close_title;
}

// Définition de la position du layer
Emajine_Layers.prototype.set_emajine_layer_position=function(position){
	this.layer_position=position;
}

// Est ce que le layer existe ?
Emajine_Layers.prototype.emajine_layer_exists=function(){
	for(var x in this._emajine_layers_stack)
		if(this._emajine_layers_stack[x]===this.layer_id)
			return true;
	return false;
}

Emajine_Layers.prototype.emajine_layer_show_elements=function(elementType){
	$(elementType).css('visibility','visible');
}
Emajine_Layers.prototype.emajine_layer_hide_elements=function(elementType){
	$(elementType).css('visibility','hidden');
}

Emajine_Layers.prototype.emajine_layer_get_stack=function(){
	return this._emajine_layers_stack;
}

Emajine_Layers.prototype.emajine_layer_get_element_id_by_token=function(token){
	var tmp=Emajine_Layers_Obj.emajine_layer_get_stack();
	tmp=tmp.reverse();
	for(var x=0;x<tmp.length;x++){
		if(tmp[x].indexOf(token)!=-1){
			return tmp[x];
		}
	}
}




//--------------------------
// Elements and functions Declarations
//--------------------------

Emajine_Layers_Obj=new Emajine_Layers();

function open_div(element_id,caption,url,js){
	Emajine_Layers_Obj.set_emajine_layer_css_class('ressource_layer');
	var enabled_js=false;
	var js_url=null;
	if(js){
		if(js==='auto'){
			enabled_js='auto';
		}else if(typeof js==='function'){
			enabled_js=js;
		}else{
			enabled_js=true;
			js_url=js
		}
	}
	Emajine_Layers_Obj.set_emajine_layer_position('top');	Emajine_Layers_Obj.open_emajine_layer(element_id,caption);
	Emajine_Layers_Obj.getAjaxContent(url,enabled_js,js_url);
}
open_ressource_div=open_div;

// insertion d'un élément d'e-majine manage avec la wikibar
function insertRessourceContent(url,caption,layer_id) {

	
	
	if(typeof caption=='undefined'){
		caption='_insert_element_';
	}
	if(typeof layer_id=='undefined'){
		layer_id='overDivInsert'+insertElementLayerID;
		insertElementLayerID++;
	}
// 	url+='&layer_id='+layer_id;
	var closecaption='Close';
	displayContent(url,caption,closecaption,'od_action',false,'auto');
// 	Emajine_Layers_Obj.set_emajine_layer_css_class('overDivInsert');
// 	Emajine_Layers_Obj.set_emajine_layer_position('center');
// 	// 	
// 	Emajine_Layers_Obj.open_emajine_layer(layer_id,caption);
// 	Emajine_Layers_Obj.getAjaxContent(baseURL+url,'auto');
}

function cancelInsertDiv(){
	Emajine_Layers_Obj.cancel_emajine_layer(Emajine_Layers_Obj.emajine_layer_get_element_id_by_token('overDivInsert'));
}

function showZoom(content,caption){
	layer_id='overDivZoom'+insertElementLayerID;
	insertElementLayerID++;
	Emajine_Layers_Obj.set_emajine_layer_css_class('overZoom');
	Emajine_Layers_Obj.set_emajine_layer_position('top');
	Emajine_Layers_Obj.open_emajine_layer(layer_id,caption);
	var winHeight = document.documentElement.scrollTop;
	document.getElementById(layer_id).style.top=(5+winHeight)+'px';
	document.getElementById(layer_id).style.left='5px';
	
	var content_div='emajine_layer_content_'+layer_id;
	document.getElementById(content_div).innerHTML=content;
	
	Emajine_Layers_Obj.layer_div.style.display='block';
}

function getEditBloc(url,caption,closecaption,js,url_js) {
//TODO : FAIRE DU DIV UN ID UNIQUE POUR PAS L'ECRASER
// 	layer_id='overDiv'+insertElementLayerID;
// 	$("#overDiv").clone().insertAfter("#overDiv").attr('id','overDiv'+(insertElementLayerID));
// 	lastOverDiv=layer_id;
// 	insertElementLayerID++;
// 	params = "DIVID,'"+layer_id+"'";
	params =false;
	if(!closecaption){closecaption='Close';}
	displayContent(url,caption,closecaption,'od_action',params,'auto',false,false);

	
}

function cancelEditBloc(){
// 	Emajine_Layers_Obj.cancel_emajine_layer(Emajine_Layers_Obj.emajine_layer_get_element_id_by_token('overEdit'));
 	cancelOverDiv();
}