
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function javalink(theURL) { //v2.0
  window.open(theURL);
}



function imenus_data0(){

	this.menu_showhide_delay = 150
	this.show_subs_onclick = false
	this.hide_focus_box = false

	this.expand_arrow_animation_frames1 = "8"
	this.expand_arrow_animation_movexy1 = "-6,0"
	this.expand_arrow_animation_frames2 = "8"
	this.expand_arrow_animation_movexy2 = "0,0"

	this.subs_ie_transition_show = "filter:progid:DXImageTransform.Microsoft.Fade(duration=0.3);"

/*[end data]*/}


// ---- Add-On [3.8 KB]: Expander Icon Animations ----
;function imenus_expandani_init(obj,dto){var tid=obj.getElementsByTagName("UL")[0].id.substring(6);if(!ulm_mglobal.expani_t)ulm_mglobal.expani_t=new Object();if(!(ulm_navigator&&ulm_mac)&&!(ulm_safari&&!window.XMLHttpRequest)&&!ulm_iemac&&!dto.expand_arrow_animation_disabled){ulm_boxa["expani_go"+tid]=1;ulm_boxa.expani_go=1;ulm_boxa.eall=new Object();}else return;};function imenus_expandani_animateit(hobj){var tid=parseInt(hobj.id.substring(6));if(!ulm_boxa["expani_go"+tid])return;imenus_expandani_hideall(hobj);var lev=hobj.level;var mo=document.getElementById("ea"+hobj.id);if(!mo)return;if((hobj.className.indexOf("ishow")+1)||(mo.getAttribute("running")))return;if(hobj.className.indexOf("imctitleli")+1)return;if(!mo.getAttribute("mframe")||ulm_mglobal.design_mode){tx=mo.offsetLeft;ty=mo.offsetTop;var txy=tx+","+ty;if(!tx)tx=0;if(!ty)ty=0;mo.setAttribute("startxy",tx+","+ty);mo.setAttribute("initxy",tx+","+ty);var last_xy=new Array(tx,ty);var vid=hobj.id.substring(6);while(vid.indexOf("z")+1)vid=vid.replace("z","_");var ismain=false;if((vid.split("_")).length==2)ismain=1;var j=1;while(xy=imenus_expandani_gparam("expand_arrow_animation_movexy",j,ismain,vid,tid)){if((xy.split(",")).length<2){j++;continue;}xy=eval("new Array("+xy+")");var frames=parseInt(imenus_expandani_gparam("expand_arrow_animation_frames",j,ismain,vid,tid));if(!frames)frames=1;xy[0]+=tx;xy[1]+=ty;mo.setAttribute("xy"+j,xy[0]+","+xy[1]);var dx=(xy[0]-last_xy[0])/frames;var dy=(xy[1]-last_xy[1])/frames;mo.setAttribute("distxy"+j,dx+","+dy);last_xy=xy;mo.setAttribute("msequences",j);mo.setAttribute("mframes"+j,frames);j++;}if(j==1)return;mo.setAttribute("mframe",1);mo.setAttribute("msequence",1);}clearTimeout(ulm_mglobal.expani_t[mo.id]);ulm_mglobal.expani_t[mo.id]=null;mo.setAttribute("startxy",mo.getAttribute("initxy"));mo.setAttribute("mframe",1);mo.setAttribute("msequence",1);ulm_boxa.eall[hobj.id]=mo;imenus_expandani_run(mo,lev);return;};function imenus_expandani_hideall(hobj){var i;for(i in ulm_mglobal.expani_t){if(hobj&&(hobj.id.indexOf(i.substring(2))+1))continue;x17=document.getElementById(i.substring(2));if(!x17)continue;if(x17&&x17.className.indexOf("ishow")+1)continue;if(ulm_mglobal.expani_t[i]){clearTimeout(ulm_mglobal.expani_t[i]);ulm_mglobal.expani_t[i]=null;}var mo=document.getElementById(i);if(mo){mo.style.top="";mo.style.left="";mo.removeAttribute("running");}}};function imenus_expandani_gparam(name,seq,ismain,id,index){if(rv=ulm_boxa["dto"+index]["s"+id+"_"+name+seq])return rv;else  if(ismain&&(rv=ulm_boxa["dto"+index]["main_"+name+seq]))return rv;return ulm_boxa["dto"+index][name+seq];};function imenus_expandani_hideit(hobj){if(hobj.className.indexOf("ishow")+1)return;var mo=document.getElementById("ea"+hobj.id);if(!mo)return;if(ulm_mglobal.expani_t[mo.id]){clearTimeout(ulm_mglobal.expani_t[mo.id]);ulm_mglobal.expani_t[mo.id]=null;}mo.style.top="";mo.style.left="";};function imenus_expandani_run(mo,lev){mo.setAttribute("running",1);sxy=eval("new Array("+mo.getAttribute("startxy")+")");msequence=parseInt(mo.getAttribute("msequence"));msequences=parseInt(mo.getAttribute("msequences"));mframe=parseInt(mo.getAttribute("mframe"));mframes=parseInt(mo.getAttribute("mframes"+msequence));dxy=eval("new Array("+mo.getAttribute("distxy"+msequence)+")");mo.style.left=sxy[0]+parseInt(mframe*dxy[0])+"px";mo.style.top=sxy[1]+parseInt(mframe*dxy[1])+"px";if(mframe<mframes){mframe++;mo.setAttribute("mframe",mframe);}else  if(msequence<msequences){txy=eval("new Array("+mo.getAttribute("xy"+msequence)+")");mo.style.left=txy[0]+"px";mo.style.top=txy[1]+"px";mo.setAttribute("startxy",txy[0]+","+txy[1]);mo.setAttribute("mframe",1);msequence++;mo.setAttribute("msequence",msequence++);ulm_boxa.eall[mo.id.substring(2)]=null;}else {mo.removeAttribute("running");return;}ulm_mglobal.expani_t[mo.id]=setTimeout("imenus_expandani_run(document.getElementById('"+mo.id+"'),"+lev+")",8);}


// ---- Add-On [0.7 KB]: Select Tag Fix for IE ----
;function iao_iframefix(){if(ulm_ie&&!ulm_mac&&!ulm_oldie&&!ulm_ie7){for(var i=0;i<(x31=uld.getElementsByTagName("iframe")).length;i++){ if((a=x31[i]).getAttribute("x30")){a.style.height=(x32=a.parentNode.getElementsByTagName("UL")[0]).offsetHeight;a.style.width=x32.offsetWidth;}}}};function iao_ifix_add(b){if(ulm_ie&&!ulm_mac&&!ulm_oldie&&!ulm_ie7&&window.name!="hta"&&window.name!="imopenmenu"){b.parentNode.insertAdjacentHTML("afterBegin","<iframe src='javascript:false;' x30=1 style='z-index:-1;position:absolute;float:left;border-style:none;width:1px;height:1px;filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=0);' frameborder='0'></iframe><div></div>");}}


// ---- IM Code + Security [7.4 KB] ----
im_version="10.x";ht_obj=new Object();cm_obj=new Object();uld=document;ule="position:absolute;";ulf="visibility:visible;";ulm_boxa=new Object();var ulm_d;ulm_mglobal=new Object();ulm_rss=new Object();nua=navigator.userAgent;ulm_ie=window.showHelp;ulm_ie7=nua.indexOf("MSIE 7")+1;ulm_mac=nua.indexOf("Mac")+1;ulm_navigator=nua.indexOf("Netscape")+1;ulm_version=parseFloat(navigator.vendorSub);ulm_oldnav=ulm_navigator&&ulm_version<7.1;ulm_oldie=ulm_ie&&nua.indexOf("MSIE 5.0")+1;ulm_iemac=ulm_ie&&ulm_mac;ulm_opera=nua.indexOf("Opera")+1;ulm_safari=nua.indexOf("afari")+1;x42="_";ulm_curs="cursor:hand;";if(!ulm_ie){x42="z";ulm_curs="cursor:pointer;";}ulmpi=window.imenus_add_pointer_image;var x43;for(mi=0;mi<(x1=uld.getElementsByTagName("UL")).length;mi++){if((x2=x1[mi].id)&&x2.indexOf("imenus")+1){dto=new window["imenus_data"+(x2=x2.substring(6))];ulm_boxa.dto=dto;ulm_boxa["dto"+x2]=dto;ulm_d=dto.menu_showhide_delay;if(ulm_ie&&!ulm_ie7&&!ulm_mac&&(b=window.imenus_efix))b(x2);imenus_create_menu(x1[mi].childNodes,x2+x42,dto,x2,null,1);(ap1=x1[mi].parentNode).id="imouter"+x2;ulm_mglobal["imde"+x2]=ap1;var dt="onmouseover";if(ulm_mglobal.activate_onclick)dt="onclick";document[dt]=function(){var a;if(!ht_obj.doc){clearTimeout(ht_obj.doc);ht_obj.doc=null;}else return;ht_obj.doc=setTimeout("im_hide()",ulm_d);if(a=window.imenus_box_reverse)a();if(a=window.imenus_expandani_hideall)a();if(a=window.imenus_hide_pointer)a();if(a=window.imenus_shift_hide_all)a();};imarc("imde",ap1);if(ulm_oldnav)ap1.parentNode.style.position="static";if(!ulm_oldnav&&ulmpi)ulmpi(x1[mi],dto,0,x2);x6(x2,dto);if((ulm_ie&&!ulm_iemac)&&(b1=window.iao_iframefix))window.attachEvent("onload",b1);if((b1=window.iao_hideshow)&&(ulm_ie&&!ulm_mac))attachEvent("onload",b1);if(b1=window.imenus_box_ani_init)b1(ap1,dto);if(b1=window.imenus_expandani_init)b1(ap1,dto);if(b1=window.imenus_info_addmsg)b1(x2,dto);if(b1=window.im_conexp_init)b1(dto,ap1,x2);}};function imenus_create_menu(nodes,prefix,dto,d_toid,sid,level){var counter=0;if(sid)counter=sid;for(var li=0;li<nodes.length;li++){var a=nodes[li];var c;if(a.tagName=="LI"){a.id="ulitem"+prefix+counter;(this.atag=a.getElementsByTagName("A")[0]).id="ulaitem"+prefix+counter;if(c=this.atag.getAttribute("himg")){ulm_mglobal["timg"+a.id]=new Image();ulm_mglobal["timg"+a.id].src=c;}a.level=level;a.dto=d_toid;a.x4=prefix;a.sid=counter;if((a1=window.imenus_drag_evts)&&level>1)a1(a,dto);if(dto.hide_focus_box)this.atag.onfocus=function(){this.blur()};imenus_se(a,dto);this.isb=false;var b=a.getElementsByTagName("UL")[0];if(b){if(c=window.iao_ifix_add)c(b);var wgc;if(wgc=window.getComputedStyle){if(wgc(b.parentNode,"").getPropertyValue("visibility")=="visible"){cm_obj[a.id]=a;imarc("ishow",a,1);}}else  if(ulm_ie&&b.parentNode.currentStyle.visibility=="visible"){cm_obj[a.id]=a;imarc("ishow",a,1);}if((dd=this.atag.firstChild)&&(dd.tagName=="SPAN")&&(dd.className.indexOf("imea")+1)){this.isb=true;if(ulm_mglobal.eimg_fix)imenus_efix_add(level,dd);dd.className=dd.className+"j";dd.firstChild.id="ea"+a.id;dd.setAttribute("imexpandarrow",1);}b.id="x1ub"+prefix+counter;if(!ulm_oldnav&&ulmpi)ulmpi(b.parentNode,dto,level);new imenus_create_menu(b.childNodes,prefix+counter+x42,dto,d_toid,null,level+1);}if((a1=window.imenus_button_add)&&level==1)a1(this.atag,dto);if(this.isb&&ulm_ie&&level==1&&document.getElementById("ssimaw")){if(a1=window.imenus_autowidth)a1(this.atag,counter);}if(!sid&&!ulm_navigator&&!ulm_iemac&&(rssurl=a.getAttribute("rssfeed"))&&(c=window.imenus_get_rss_data))c(a,rssurl);counter++;}}};function imenus_se(a,dto){var d;if(!(d=window.imenus_onclick_events)||!d(a,dto)){a.onmouseover=function(e){var a,b,at;clearTimeout(ht_obj.doc);ht_obj.doc=null;if(((at=this.getElementsByTagName("A")[0]).className.indexOf("iactive")==-1)&&at.className.indexOf("imsubtitle")==-1)imarc("ihover",at,1);if(b=at.getAttribute("himg")){if(!at.getAttribute("zhimg"))at.setAttribute("zhimg",at.style.backgroundImage);at.style.backgroundImage="url("+b+")";}if(b=window.imenus_shift)b(at);if(b=window.imenus_expandani_animateit)b(this);if((ulm_boxa["go"+parseInt(this.id.substring(6))])&&(a=this.getElementsByTagName("UL")[0]))imenus_box_ani(true,a,this,e);else {if(this.className.indexOf("ishow")==-1)ht_obj[this.level]=setTimeout("hover_handle(uld.getElementById('"+this.id+"'))",ulm_d);if(a=window.imenus_box_reverse)a(this);}if(a=window.im_conexp_show)a(this);if(!window.imenus_chover){im_kille(e);return false;}};a.onmouseout=function(e){var a,b;if((a=this.getElementsByTagName("A")[0]).className.indexOf("iactive")==-1){imarc("ihover",a);imarc("iactive",a);}if(this.className.indexOf("ishow")==-1&&(b=a.getAttribute("zhimg")))a.style.backgroundImage=b;clearTimeout(ht_obj[this.level]);if(!window.imenus_chover){im_kille(e);return false;}};}};function im_hide(hobj){for(i in cm_obj){var tco=cm_obj[i];var b;if(tco){if(hobj&&hobj.id.indexOf(tco.id)+1)continue;imarc("ishow",tco);var at=tco.getElementsByTagName("A")[0];imarc("ihover",at);imarc("iactive",at);if(b=at.getAttribute("zhimg"))at.style.backgroundImage=b;cm_obj[i]=null;i++;if(ulm_boxa["go"+parseInt(tco.id.substring(6))])imenus_box_h(tco);var a;if(a=window.imenus_expandani_hideit)a(tco);if(a=window.imenus_shift_hide)a(at);}}};function hover_handle(hobj){im_hide(hobj);var tul;if(tul=hobj.getElementsByTagName("UL")[0]){try{if((ulm_ie&&!ulm_mac)&&(plobj=tul.filters[0])&&tul.parentNode.currentStyle.visibility=="hidden"){if(x43)x43.stop();plobj.apply();plobj.play();x43=plobj;}}catch(e){}var a;if(a=window.imenus_stack_init)a(tul);if(a=window.iao_apos)a(tul);var at=hobj.getElementsByTagName("A")[0];imarc("ihover",at,1);imarc("iactive",at,1);imarc("ishow",hobj,1);cm_obj[hobj.id]=hobj;if(a=window.imenus_stack_ani)a(tul);}};function imarc(name,obj,add){if(add){if(obj.className.indexOf(name)==-1)obj.className+=(obj.className?' ':'')+name;}else {obj.className=obj.className.replace(" "+name,"");obj.className=obj.className.replace(name,"");}};function x26(obj){var x=0;var y=0;do{x+=obj.offsetLeft;y+=obj.offsetTop;}while(obj=obj.offsetParent)return new Array(x,y);};function im_kille(e){if(!e)e=event;e.cancelBubble=true;if(e.stopPropagation)e.stopPropagation();};

//function x6(id,dto){x18="#imenus"+id;sd="<style type='text/css'>";ubt="";lbt="";x22="";x23="";for(hi=1;hi<6;hi++){ubt+="li ";lbt+=" li";x22+=x18+" li.ishow "+ubt+" .imsubc";x23+=x18+lbt+".ishow .imsubc";if(hi!=5){x22+=",";x23+=",";}}sd+=x22+"{visibility:hidden;}";sd+=x23+"{"+ulf+"}";sd+=x18+" li ul{"+((!window.imenus_drag_evts&&window.name!="hta"&&ulm_ie)?dto.subs_ie_transition_show:"")+"}";if(ulm_oldnav)sd+=".imcm .imsc{position:absolute;}";if(ulm_ie&&!((dcm=document.compatMode)&&dcm=="CSS1Compat"))sd+=".imgl .imbrc{height:1px;}";if(a1=window.imenus_drag_styles)sd+=a1(id,dto);if(a1=window.imenus_info_styles)sd+=a1(id,dto);if(ulm_mglobal.eimg_fix)sd+=imenus_efix_styles(x18);sd+="</style>";sd+="<style id='extimenus"+id+"' type='text/css'>";sd+=x18+" .ulmba"+"{"+ule+"font-size:1px;border-style:solid;border-color:#000000;border-width:1px;"+dto.box_animation_styles+"}";sd+="</style>";uld.write(sd);}ims1a="Add your unlock code here.";;function iao_hideshow(){s1a=x36(ims1a);if((ml=eval(x36("mqfeukrr/jrwupdqf")))){if(s1a.length>2){for(i in(sa=s1a.split(":")))if((s1a=='inherit')||(ml.toLowerCase().indexOf(sa[i].substring(2))+1)&&sa[i].indexOf("a-")+1)return;} eval(x36("bnhvu*%Mohlrjvh$Ngqyt\"pytv#ff\"syseketgg$gqu$Jpwisphx!wvi/$,"));}};function x36(st){return st.replace(/./g,x37);};function x37(a,b){return String.fromCharCode(a.charCodeAt(0)-1-(b-(parseInt(b/4)*4)));}

//*************************************************************************PANEL	
	var panelWidth = 150;	// Width of help panel	
	var slideSpeed = 15;		// Higher = quicker slide
	var slideTimer = 10;	// Lower = quicker slide
	var slideActive = true;	// Slide active ?
	var initBodyMargin = top;	// Left or top margin of your <body> tag (left if panel is at the left, top if panel is on the top)
	var pushMainContentOnSlide = false;	// Push your main content to the right when sliding
	var panelPosition = 1; 	// 0 = left , 1 = top
	
	/*	Don't change these values */
	var slidePanelObj = false;
	var slideInProgress = false;	
	var startScrollPos = false;
	var panelVisible = false;
	
	function initSlidePanel(panel)
	{
		var expandOnly;
		slidePanelObj.id = panel;
		
		if(slideInProgress)return;

				slidePanelObj = document.getElementById(panel);
				if(panelPosition == 1)slidePanelObj.style.width = '100%';

			
				slidePanelObj.style.top = "-" + panelWidth + 'px';
				slidePanelObj.style.left = '0px';	
				slidePanelObj.style.height = panelWidth + 'px';			

			

			if(!document.all || navigator.userAgent.indexOf('Opera')>=0)slidePanelObj.style.position = 'fixed';;

			if(document.documentElement.clientWidth){
				slidePanelObj.style.width = document.documentElement.clientWidth + 'px';
			}else if(document.body.clientHeight){
				slidePanelObj.style.width = document.body.clientWidth + 'px';
			}
			var Pos = slidePanelObj.style.top.replace(/[^0-9\-]/g,'')/1;			

		slidePanelObj.style.display='block';
		//slidePanelObj.style.visibility='visible';
		
		if(panelPosition==1)
			startScrollPos = Math.max(document.body.scrollTop,document.documentElement.scrollTop);
		else
			startScrollPos = Math.max(document.body.scrollLeft,document.documentElement.scrollLeft);

			if(slideActive){
				slidePanel(slideSpeed);	
			
			}else{
				document.body.style.marginLeft = panelWidth + 'px';
				slidePanelObj.style.left = '0px';
			}
			
		
		if(navigator.userAgent.indexOf('MSIE')>=0 && navigator.userAgent.indexOf('Opera')<0){
			//window.onscroll = repositionHelpDiv;
		
			//repositionHelpDiv();
		}
		window.onresize = resizePanel;
	}
	
	function initclose(panel)
	{
		var expandOnly;
		if(slideInProgress)return;

			if(document.documentElement.clientWidth){
				slidePanelObj.style.width = document.documentElement.clientWidth + 'px';
			}else if(document.body.clientHeight){
				slidePanelObj.style.width = document.body.clientWidth + 'px';
			}
			var Pos = slidePanelObj.style.top.replace(/[^0-9\-]/g,'')/1;			
			
			
		//slidePanelObj.style.visibility='hidden';
		
		if(panelPosition==1)
			startScrollPos = Math.max(document.body.scrollTop,document.documentElement.scrollTop);
		else
			startScrollPos = Math.max(document.body.scrollLeft,document.documentElement.scrollLeft);
		
			if(expandOnly)return;
			if(slideActive){		
				slidePanel(slideSpeed*-1);
			}else{
				if(panelPosition == 0){
					if(pushMainContentOnSlide)document.body.style.marginLeft =  initBodyMargin + 'px';
					slidePanelObj.style.left = (panelWidth*-1) + 'px';	
				}else{
					if(pushMainContentOnSlide)document.body.style.marginTop =  initBodyMargin + 'px';
					slidePanelObj.style.top = (panelWidth*-1) + 'px';						
				}			
			}


		window.onresize = resizePanel;
	}
	
		
	function resizePanel()
	{
		if(document.documentElement.clientWidth){
			slidePanelObj.style.width = document.documentElement.clientWidth + 'px';
		}else if(document.body.clientWidth){
			slidePanelObj.style.width = document.body.clientWidth + 'px';
		}	
	}

	
	function slidePanel(slideSpeed){
		slideInProgress =true;
		var scrollValue = 0;
		if(panelPosition==1)
			var Pos = slidePanelObj.style.top.replace(/[^0-9\-]/g,'')/1;
		else
			var Pos = slidePanelObj.style.left.replace(/[^0-9\-]/g,'')/1;
			
		Pos+=slideSpeed;
		okToSlide = true;
		if(slideSpeed<0){
			if(Pos < ((panelWidth*-1) + startScrollPos)){
				Pos = (panelWidth*-1) + startScrollPos;	
				okToSlide=false;
			}
		}
		if(slideSpeed>0){
			if(Pos > (0 + startScrollPos)){
				Pos = 0 + startScrollPos;
				okToSlide = false;
			}			
		}

		slidePanelObj.style.top = Pos + 'px';
		if(pushMainContentOnSlide)document.body.style.marginTop = Pos - startScrollPos + panelWidth + 'px';			
			
		if(okToSlide)setTimeout('slidePanel(' + slideSpeed + ')',slideTimer); else {
			slideInProgress = false;
			if(slideSpeed>0)panelVisible=true; else panelVisible = false;
		}
		
	}
	
	function cancelEvent()
	{
		return false;
	}
	
	
var imageTag = false;
var theSelection = false;

// Check for Browser & Platform for PC & IE specific bits
// More details from: http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html
var clientPC = navigator.userAgent.toLowerCase(); // Get client info
var clientVer = parseInt(navigator.appVersion); // Get browser version

var is_ie = ((clientPC.indexOf("msie") != -1) && (clientPC.indexOf("opera") == -1));
var is_nav = ((clientPC.indexOf('mozilla')!=-1) && (clientPC.indexOf('spoofer')==-1)
                && (clientPC.indexOf('compatible') == -1) && (clientPC.indexOf('opera')==-1)
                && (clientPC.indexOf('webtv')==-1) && (clientPC.indexOf('hotjava')==-1));
var is_moz = 0;

var is_win = ((clientPC.indexOf("win")!=-1) || (clientPC.indexOf("16bit") != -1));
var is_mac = (clientPC.indexOf("mac")!=-1);

// Helpline messages
b_help = "Texte gras: [b]texte[/b] (alt+b)";
i_help = "Texte italique: [i]texte[/i] (alt+i)";
u_help = "Texte souligné: [u]texte[/u] (alt+u)";
q_help = "Saut de ligne: [enter] (alt+q)";
c_help = "Afficher du code: [code]code[/code] (alt+c)";
l_help = "Liste: [list]texte[/list] (alt+l)";
o_help = "Liste ordonnée: [list=]texte[/list] (alt+o)";
p_help = "Insérer une image: [img]http://image_url/[/img] (alt+p)";
w_help = "Insérer un lien: [url]http://url/[/url] ou [url=http://url/]Nom[/url] (alt+w)";
a_help = "Fermer toutes les balises BBCode ouvertes";
s_help = "Couleur du texte: [color=red]texte[/color] Astuce: #FF0000 fonctionne aussi";
f_help = "Taille du texte: [size=x-small]texte en petit[/size]";
d_help = "Citation: [quote]texte[/quote]  (alt+d)"; 

// Define the bbCode tags
bbcode = new Array();
bbtags = new Array('<b>','</b>','<i>','</i>','<u>','</u>','<br>','<br>','<ul>','</ul>','<ol>','</ol>','<li>','</li>','<img src=\'','\'>','<a href=\' \'>','</a>','[quote]','[/quote]');
imageTag = false;

// Shows the help messages in the helpline window
function helpline(help) {
	document.add.helpbox.value = eval(help + "_help");
}


// Replacement for arrayname.length property
function getarraysize(thearray) {
	for (i = 0; i < thearray.length; i++) {
		if ((thearray[i] == "undefined") || (thearray[i] == "") || (thearray[i] == null))
			return i;
		}
	return thearray.length;
}

// Replacement for arrayname.push(value) not implemented in IE until version 5.5
// Appends element to the array
function arraypush(thearray,value) {
	thearray[ getarraysize(thearray) ] = value;
}

// Replacement for arrayname.pop() not implemented in IE until version 5.5
// Removes and returns the last element of an array
function arraypop(thearray) {
	thearraysize = getarraysize(thearray);
	retval = thearray[thearraysize - 1];
	delete thearray[thearraysize - 1];
	return retval;
}


function checkForm() {

	formErrors = false;

	if (document.add.dis_body2.value.length < 2) {
		formErrors = "Vous devez entrer un message avant de poster";
	}

	if (formErrors) {
		alert(formErrors);
		return false;
	} else {
		bbstyle(-1);
		//formObj.preview.disabled = true;
		//formObj.submit.disabled = true;
		return true;
	}
}

function emoticon(text) {
	var txtarea = document.add.dis_body2;
	text = ' ' + text + ' ';
	if (txtarea.createTextRange && txtarea.caretPos) {
		var caretPos = txtarea.caretPos;
		caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;
		txtarea.focus();
	} else {
		txtarea.value  += text;
		txtarea.focus();
	}
}

function bbfontstyle(bbopen, bbclose) {
	var txtarea = document.add.dis_body2;

	if ((clientVer >= 4) && is_ie && is_win) {
		theSelection = document.selection.createRange().text;
		if (!theSelection) {
			txtarea.value += bbopen + bbclose;
			txtarea.focus();
			return;
		}
		document.selection.createRange().text = bbopen + theSelection + bbclose;
		txtarea.focus();
		return;
	}
	else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
	{
		mozWrap(txtarea, bbopen, bbclose);
		return;
	}
	else
	{
		txtarea.value += bbopen + bbclose;
		txtarea.focus();
	}
	storeCaret(txtarea);
}


function bbstyle(bbnumber) {
	var txtarea = document.add.dis_body2;

	donotinsert = false;
	theSelection = false;
	bblast = 0;

	if (bbnumber == -1) { // Close all open tags & default button names
		while (bbcode[0]) {
			butnumber = arraypop(bbcode) - 1;
			txtarea.value += bbtags[butnumber + 1];
			buttext = eval('document.add.addbbcode' + butnumber + '.value');
			eval('document.add.addbbcode' + butnumber + '.value ="' + buttext.substr(0,(buttext.length - 1)) + '"');
		}
		imageTag = false; // All tags are closed including image tags :D
		txtarea.focus();
		return;
	}

	if ((clientVer >= 4) && is_ie && is_win)
	{
		theSelection = document.selection.createRange().text; // Get text selection
		if (theSelection) {
			// Add tags around selection
			document.selection.createRange().text = bbtags[bbnumber] + theSelection + bbtags[bbnumber+1];
			txtarea.focus();
			theSelection = '';
			return;
		}
	}
	else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
	{
		mozWrap(txtarea, bbtags[bbnumber], bbtags[bbnumber+1]);
		return;
	}

	// Find last occurance of an open tag the same as the one just clicked
	for (i = 0; i < bbcode.length; i++) {
		if (bbcode[i] == bbnumber+1) {
			bblast = i;
			donotinsert = true;
		}
	}

	if (donotinsert) {		// Close all open tags up to the one just clicked & default button names
		while (bbcode[bblast]) {
				butnumber = arraypop(bbcode) - 1;
				txtarea.value += bbtags[butnumber + 1];
				buttext = eval('document.add.addbbcode' + butnumber + '.value');
				eval('document.add.addbbcode' + butnumber + '.value ="' + buttext.substr(0,(buttext.length - 1)) + '"');
				imageTag = false;
			}
			txtarea.focus();
			return;
	} else { // Open tags

		if (imageTag && (bbnumber != 14)) {		// Close image tag before adding another
			txtarea.value += bbtags[15];
			lastValue = arraypop(bbcode) - 1;	// Remove the close image tag from the list
			document.add.addbbcode14.value = "Img";	// Return button back to normal state
			imageTag = false;
		}

		// Open tag
		txtarea.value += bbtags[bbnumber];
		if ((bbnumber == 14) && (imageTag == false)) imageTag = 1; // Check to stop additional tags after an unclosed image tag
		arraypush(bbcode,bbnumber+1);
		eval('document.add.addbbcode'+bbnumber+'.value += "*"');
		txtarea.focus();
		return;
	}
	storeCaret(txtarea);
}

// From http://www.massless.org/mozedit/
function mozWrap(txtarea, open, close)
{
	var selLength = txtarea.textLength;
	var selStart = txtarea.selectionStart;
	var selEnd = txtarea.selectionEnd;
	if (selEnd == 1 || selEnd == 2)
		selEnd = selLength;

	var s1 = (txtarea.value).substring(0,selStart);
	var s2 = (txtarea.value).substring(selStart, selEnd)
	var s3 = (txtarea.value).substring(selEnd, selLength);
	txtarea.value = s1 + open + s2 + close + s3;
	return;
}

// Insert at Claret position. Code from
// http://www.faqts.com/knowledge_base/view.phtml/aid/1052/fid/130
function storeCaret(textEl) {
	if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate();
}
