function htmlentities(a,b){var c={},symbol='',tmp_str='',entity='';tmp_str=a.toString();if(false===(c=this.get_html_translation_table('HTML_ENTITIES',b))){return false}c["'"]='&#039;';for(symbol in c){entity=c[symbol];tmp_str=tmp_str.split(symbol).join(entity)}return tmp_str}function getEditorContent(a){GetScrollPosition(a);return FCKeditorAPI.GetInstance(a).GetHTML()}function setEditorContent(a,b){var c=FCKeditorAPI.GetInstance(a);c.Events.AttachEvent('OnAfterSetHTML',SetScrollPosition);c.SetHTML(b)}function myReplace(a,b,c){var d=a.indexOf(b);var e=parseInt(a.indexOf(b))+parseInt(b.length);var f=a.length;return a.substring(0,d)+c+a.substring(e,f)}function myReplaceAll(a,b,c){iPos=-1;while(a!=''){iPos=a.indexOf(b);if(iPos==-1){return a}else{a=myReplace(a,b,c)}}return''}function html_entity_decode(a){var b,tarea=document.createElement('textarea');tarea.innerHTML=a;b=tarea.value;return b}function rand(a,b){var c=arguments.length;if(c==0){a=0;b=2147483647}else if(c==1){throw new Error('Warning: rand() expects exactly 2 parameters, 1 given');}return Math.floor(Math.random()*(b-a+1))+a}function ucfirst(a){a+='';var f=a.charAt(0).toUpperCase();return f+a.substr(1)}function get_html_translation_table(a,b){var c={},hash_map={},decimal=0,symbol='';var d={},constMappingQuoteStyle={};var e={},useQuoteStyle={};d[0]='HTML_SPECIALCHARS';d[1]='HTML_ENTITIES';constMappingQuoteStyle[0]='ENT_NOQUOTES';constMappingQuoteStyle[2]='ENT_COMPAT';constMappingQuoteStyle[3]='ENT_QUOTES';e=!isNaN(a)?d[a]:a?a.toUpperCase():'HTML_SPECIALCHARS';useQuoteStyle=!isNaN(b)?constMappingQuoteStyle[b]:b?b.toUpperCase():'ENT_COMPAT';if(e!=='HTML_SPECIALCHARS'&&e!=='HTML_ENTITIES'){throw new Error("Table: "+e+' not supported');}c['38']='&amp;';if(e==='HTML_ENTITIES'){c['160']='&nbsp;';c['161']='&iexcl;';c['162']='&cent;';c['163']='&pound;';c['164']='&curren;';c['165']='&yen;';c['166']='&brvbar;';c['167']='&sect;';c['168']='&uml;';c['169']='&copy;';c['170']='&ordf;';c['171']='&laquo;';c['172']='&not;';c['173']='&shy;';c['174']='&reg;';c['175']='&macr;';c['176']='&deg;';c['177']='&plusmn;';c['178']='&sup2;';c['179']='&sup3;';c['180']='&acute;';c['181']='&micro;';c['182']='&para;';c['183']='&middot;';c['184']='&cedil;';c['185']='&sup1;';c['186']='&ordm;';c['187']='&raquo;';c['188']='&frac14;';c['189']='&frac12;';c['190']='&frac34;';c['191']='&iquest;';c['192']='&Agrave;';c['193']='&Aacute;';c['194']='&Acirc;';c['195']='&Atilde;';c['196']='&Auml;';c['197']='&Aring;';c['198']='&AElig;';c['199']='&Ccedil;';c['200']='&Egrave;';c['201']='&Eacute;';c['202']='&Ecirc;';c['203']='&Euml;';c['204']='&Igrave;';c['205']='&Iacute;';c['206']='&Icirc;';c['207']='&Iuml;';c['208']='&ETH;';c['209']='&Ntilde;';c['210']='&Ograve;';c['211']='&Oacute;';c['212']='&Ocirc;';c['213']='&Otilde;';c['214']='&Ouml;';c['215']='&times;';c['216']='&Oslash;';c['217']='&Ugrave;';c['218']='&Uacute;';c['219']='&Ucirc;';c['220']='&Uuml;';c['221']='&Yacute;';c['222']='&THORN;';c['223']='&szlig;';c['224']='&agrave;';c['225']='&aacute;';c['226']='&acirc;';c['227']='&atilde;';c['228']='&auml;';c['229']='&aring;';c['230']='&aelig;';c['231']='&ccedil;';c['232']='&egrave;';c['233']='&eacute;';c['234']='&ecirc;';c['235']='&euml;';c['236']='&igrave;';c['237']='&iacute;';c['238']='&icirc;';c['239']='&iuml;';c['240']='&eth;';c['241']='&ntilde;';c['242']='&ograve;';c['243']='&oacute;';c['244']='&ocirc;';c['245']='&otilde;';c['246']='&ouml;';c['247']='&divide;';c['248']='&oslash;';c['249']='&ugrave;';c['250']='&uacute;';c['251']='&ucirc;';c['252']='&uuml;';c['253']='&yacute;';c['254']='&thorn;';c['255']='&yuml;'}if(useQuoteStyle!=='ENT_NOQUOTES'){c['34']='&quot;'}if(useQuoteStyle==='ENT_QUOTES'){c['39']='&#39;'}c['60']='&lt;';c['62']='&gt;';for(decimal in c){symbol=String.fromCharCode(decimal);hash_map[symbol]=c[decimal]}return hash_map}
function addslashes(str) {
	return (str+'').replace(/([\\"'])/g, "\\$1").replace(/\0/g, "\\0");
}
function trim(str) { 
	var str2 = "" + str;
	return str2.replace(/(^\s*)|(\s*$)/g,''); 
}
function strip_tags($text){
	return $text.replace('/<\/?[^>]+>/gi', '');
}
function urlencode(str) {
	var ret = str;
	ret = ret.toString();
	ret = encodeURIComponent(ret);
	ret = ret.replace(/%20/g, '+');
	return ret;
}
function noaccent(chaine) {
  temp = chaine.replace(/[ÀÁÂÃÄÅàáâãäå]/gi,"a")
  temp = temp.replace(/[ÈÉÊËèéêë]/gi,"e")
  temp = temp.replace(/[ÌÍÎÏìíîï]/gi,"i")
  temp = temp.replace(/[ÒÓÔÕÖØòóôõöø]/gi,"o")
  temp = temp.replace(/[ÙÚÛÜùúûü]/gi,"u")
  temp = temp.replace(/[Çç]/gi,"c")
  temp = temp.replace(/[ÿ]/gi,"y")
  temp = temp.replace(/[Ññ]/gi,"n")
  temp = myReplaceAll(temp, "œ", "oe")
  return temp
}
// Dynamic table
function view(id,infoSup,link) {
	if (link==null){link=1;}
	infoSup=replaceAll(infoSup,'#cote#','"');
	infoSup=replaceAll(infoSup,'#simpleCote#',"\\'");
	obj = eval("document.getElementById('"+id+"')");
	if (obj.style.visibility == 'visible') {
		obj.style.visibility = 'hidden';
		obj.innerHTML = '';
	}
	else {
		obj.style.visibility = 'visible';

		info = "";
		tab = infoSup.split('|');
		newLigne = true;
		newLigne2 = true;
		nbCol = 0;
		for (i=0; i<tab.length-1; i++) {
			if (i == 0) {
				info = "<table border=\"0\" cellspacing=\"0\" width=\"100%\" class=\"info\">";
			}
			if (newLigne) {
				if (nbCol%2==0){
					info += "<tr class=\"pair\">";
				} else {
					info += "<tr class=\"impair\">";
				}
			}
			newLigne = false;
			if (tab[i] == "<br>") {
				info += "</tr>";
				newLigne = true;
				newLigne2 = true;
				nbCol = nbCol+1;
			} else {
				if (tab[i] == "") {
					tab[i] = "&nbsp;";
				}
				if (nbCol%2==0){
					info += "<td class=\"pair\">";
				} else {
					info += "<td class=\"impair\">";
				}
				if (newLigne2==true && link==1) {
					info += "<a href=\"?module=flm_lst_detail&flm_id="+id+"#"+tab[i]+"\">"+tab[i]+"</a></td>";
				} else {
					info += tab[i]+"</td>";
				}
				newLigne2=false;
			}
		}
		if (info != ""){
			info += "</tr></table>";
		}
		obj.innerHTML = info;
	}
}

function display(id, target) {
	obj = eval("document.getElementById('"+id+"')");
	if (obj.style.visibility == 'visible') {
		obj.style.visibility = 'hidden';
		obj.style.display = 'none';
	}
	else {
		obj.style.visibility = 'visible';
		obj.style.display = 'block';
		if (target!='' && target!='#') {
			location.href=target;
		}
	}
}

function reduceRestoreBox(id, status) {
	if ($('imgrestore_' + id).style.display == 'none') {
		$('imgreduce_' + id).style.display = 'none';
		$('imgrestore_' + id).style.display = 'inline';
		$(id).style.display = 'none';
	} else {
		$('imgreduce_' + id).style.display = 'inline';
		$('imgrestore_' + id).style.display = 'none';
		$(id).style.display = 'block';
	}
}

//Dynamic menu
function viewMenu(elem, id) {
	for (ind=2; ind<=6; ind++) {
		obj = eval("document.getElementById('"+elem+ind+"')");
		if (obj != null) {
			obj.style.display = 'none';
		}
		
		obj = eval("document.getElementById('arrow_"+elem+ind+"')");
		if (obj != null) {
			obj.style.display = 'inline';
		}
	}
	
	obj = eval("document.getElementById('arrow_"+id+"')");
	if (obj != null) {
		obj.style.display = 'none';
	}
	
	obj = eval("document.getElementById('"+id+"')");
	if (obj != null) {
		obj.style.display = 'block';
	}
}

function loadDynamicInfoVisible(nme, ind, nbCol, nbRow, title, img, urlImg, txt, hg, wd) {
	obj = eval("document.getElementById('dynamicImg"+nme+"')");
	obj.style.visibility = 'visible';
	if (navigator.appName == "Microsoft Internet Explorer" && 
			navigator.appVersion.substring(0,1) < 7 && 
			img.toUpperCase().substring(img.length-3, img.length) == "PNG") {
					if (hg == 0 && wd == 0) {
						tmp_img = new Image();
	  				tmp_img.src = img;
	  				hg = tmp_img.height;
						wd = tmp_img.width;
	  			}
					obj.style.height = hg;
					obj.style.width = wd;
					
					obj.innerHTML = "<span id=\"imgLogoTV\" title=\"" + title + "\" alt=\"" + title + "\" "
				         + "style=\"width:" + wd + "px; height:" + hg + "px;display:inline-block;"
				         + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
				         + "(src=\'" + img + "\', sizingMethod='scale');\"></span>";
	} else {
		size = "";
		if (hg != 0 && wd != 0) {
			size += ' height="' + hg + '"';
			obj.style.height = hg;
		}
		if (wd != 0) {
			size += ' width="' + wd + '"';
			obj.style.width = wd;
		}
		obj.innerHTML='<img src="' + img + '" border="0" ' + size + ' title="' + title + '" alt="' + title + '" />';
	}
	
	obj = eval("document.getElementById('dynamicImgUrl"+nme+"')");
	if (obj) {
		obj.href = urlImg;
	}
	
	obj = eval("document.getElementById('dynamicInfo"+nme+"')");
	obj.innerHTML = txt;
	
	selColor = '#d0ffd4';
	for (i=0; i < nbRow; i++) {
		theCells = eval("document.getElementById('dynamic"+nme+i+"')").cells;
		for (j=0; j < nbCol; j++) {
			theCells[j].style.backgroundColor=bckgColorDefined;
		}
	}
	
	obj = eval("document.getElementById('dynamic"+nme+ind+"')");
	for (i=0; i < nbCol; i++) {
		obj.cells[i].style.backgroundColor=selColor;
	}
}

//Notes
function changeNote(val){
	if (val >= 1){
		document.getElementById('iconStar1').src = 'http://' + BobThequeHostname + '/img/icon_star_full.gif';
	}else {
		document.getElementById('iconStar1').src = 'http://' + BobThequeHostname + '/img/icon_star_empty.gif';
	}
	if (val >= 2){
		document.getElementById('iconStar2').src = 'http://' + BobThequeHostname + '/img/icon_star_full.gif';
	}else {
		document.getElementById('iconStar2').src = 'http://' + BobThequeHostname + '/img/icon_star_empty.gif';
	}
	if (val >= 3){
		document.getElementById('iconStar3').src = 'http://' + BobThequeHostname + '/img/icon_star_full.gif';
	}else {
		document.getElementById('iconStar3').src = 'http://' + BobThequeHostname + '/img/icon_star_empty.gif';
	}
	if (val >= 4){
		document.getElementById('iconStar4').src = 'http://' + BobThequeHostname + '/img/icon_star_full.gif';
	}else {
		document.getElementById('iconStar4').src = 'http://' + BobThequeHostname + '/img/icon_star_empty.gif';
	}
	if (val >= 5){
		document.getElementById('iconStar5').src = 'http://' + BobThequeHostname + '/img/icon_star_full.gif';
	}else {
		document.getElementById('iconStar5').src = 'http://' + BobThequeHostname + '/img/icon_star_empty.gif';
	}
	document.getElementById('note').value = val;
}

//Prices
function selectPrice(radio, dvd, ref, allPrv, radioOk, isGen){
	if (radioOk) {
		tab = allPrv.split('|');
		selColor = '#b3ffb7';
		for (i=0; i<tab.length-1; i++) {
			theCells = eval("document.getElementById('"+tab[i]+"')").cells;
			for (j=0; j<5; j++) {
				theCells[j].style.backgroundColor=bckgColorDefined;
			}
			obj = eval("document.getElementById('c_"+tab[i]+"')");
			if (obj != null) {
				obj.checked = false;
			}
		}
		theCells = eval("document.getElementById('"+radio+ref+"')").cells;
		for (j=0; j<5; j++) {
			theCells[j].style.backgroundColor=selColor;
		}
		obj = eval("document.getElementById('c_"+radio+ref+"')");
		obj.checked = true;
	}
	obj = eval("document.getElementById('priceFrame"+dvd+"')");
	if (isGen==true) {
		obj.src = 'http://' + BobThequeHostname + '/img/price/dvd_histo/'+ref+'.png';
	} else {
		obj.src = 'http://' + BobThequeHostname + '/price.php?ref_id='+ref;
	}
}

// Vérifications
function replaceAll(sStr,sSearch,sReplace) {
	iPos = -1;
	while (sStr != '') {
		iPos = sStr.indexOf(sSearch);
		if (iPos == -1) {
			return sStr;
		} else {
			sStr = sStr.replace(sSearch,sReplace);
		}
	}
	return '';
}

function checkError(original, name, ind) {
	checkbox = 'c' + name;
	checkbox2 = 'check' + name;
	input = name;
	if (ind!=''){ input = input + '['+ind+']'; }
	diff = 'diff' + name;

	obj = eval("document.getElementById('"+input+"')");
	if (obj.value != original) {
		obj = eval("document.getElementById('"+checkbox+"')");
		obj.checked = true ;
		obj = eval("document.getElementById('"+checkbox2+"')");
		obj.value = 1 ;
		obj = eval("document.getElementById('"+diff+"')");
		obj.value = obj.value + '' + ind;
	} else {
		obj = eval("document.getElementById('"+diff+"')");
		obj.value = replaceAll(obj.value, ind, "");
		if (obj.value=='') {
			obj = eval("document.getElementById('"+checkbox+"')");
			obj.checked = false ;
			obj = eval("document.getElementById('"+checkbox2+"')");
			obj.value = 0 ;
		}
	}
}

function myIsNumeric(input, origine, message) {
	obj = eval("document.getElementById('"+input+"')");
	if (!isNumeric(obj.value)) {
		if (message==null){
			message='Vous devez saisir un entier!';
		}
		alert(message);
		obj.value = origine;
		obj.value.focus();
	}
}

function isNumeric(sText) {
	sText = "" + sText;
	var ValidChars = "0123456789";
	var IsNumber=false;
	if (sText.length > 0) {
		IsNumber=true;
	}
	for (var i = 0; i < sText.length; i++) {
		var Char = sText.charAt(i);
		if (ValidChars.indexOf(Char) == -1) {
			IsNumber = false;
			break;
		}
	}
	return IsNumber;
} 

function isFloat(input, origine, message) {
	obj = eval("document.getElementById('"+input+"')");
	obj.value = obj.value.replace(",", ".");
	if (obj.value != parseFloat(obj.value)) {
		if (message==null){
			message='Vous devez saisir un réel!';
		}
		alert(message);
		obj.value = origine;
		obj.value.focus();
	}
}

//Requete AJAX
function createRequestObject() {
	var req = false;
  // branch for native XMLHttpRequest object
  if(window.XMLHttpRequest && !(window.ActiveXObject)) {
      try {
          req = new XMLHttpRequest();
      } catch(e) {
          req = false;
      }
  // branch for IE/Windows ActiveX version
  } else if(window.ActiveXObject) {
         try {
          req = new ActiveXObject("Msxml2.XMLHTTP");
        } catch(e) {
          try {
                req = new ActiveXObject("Microsoft.XMLHTTP");
          } catch(e) {
                req = false;
          }
      }
  }
  
	return req;
}

function selectTypeSearch(module, styleId, img, searchTextValue) {
		
	document.getElementById('module').value=module;
	if (module=='flm_comp') {
		document.getElementById('divSearch').className='ttNorm';
		document.getElementById('divComp').className='ttSel'+styleId;
		document.getElementById('infoComp').style.visibility='visible';
		listSearchCombo.deleteOption(4);
	} else {
		if (document.getElementById('divComp') != null) {
			document.getElementById('divComp').className='ttNorm';
			document.getElementById('divSearch').className='ttSel'+styleId;
			document.getElementById('infoComp').style.visibility='hidden';
			document.getElementById('infoComparateur').style.visibility='hidden';
			document.getElementById('infoComparateur').innerHTML='';
		}
		listSearchCombo.addOption([{value:4,text:"Prix DVD",img_src:"img/euro.png"}]);
	}
	imgObj = document.getElementById('typeImg')
	imgObj.src=img;
	imgObj.alt=trim(strip_tags(searchTextValue));
	imgObj.title=trim(strip_tags(searchTextValue));
	PngFunction=true;
	if (typeof document.body.style.maxHeight != "undefined") {
		PngFunction=false;
	}
	if (PngFunction==true) {
		DisplayPngPicture(imgObj);
	}
	document.getElementById('searchText').innerHTML=searchTextValue;
	
	if (document.getElementById('ttl').value!="" && document.getElementById('ttl').value.indexOf('Chercher un') != 0) {
		ttl = document.getElementById('ttl').value;
		FltTpe = listSearchCombo.getSelectedValue();
		params = '';
		if (document.getElementById('userSearch') != null) {
			params += '&userSearch=' + document.getElementById('userSearch').value;
		}
		if (document.getElementById('userId') != null) {
			params += '&userId=' + document.getElementById('userId').value;
		}
		location.href='?ttl='+ttl+'&btnFind=Chercher&module='+module+'&FltTpe='+FltTpe+params;
	}
}

function changeRadioSearch(type, film_ttl) {
	search_text = trim(document.getElementById('ttl').value);
	if (search_text.indexOf('Chercher un') == 0 || search_text.indexOf("Rechercher dans la collection de ") == 0) {
		search_text = '';
	}
	if (search_text == '') {
		document.getElementById('ttl').style.color = 'gray';
		if (type == 0) {
			if (film_ttl.indexOf("Rechercher dans la collection de ") == -1) {
				document.getElementById('ttl').value = 'Chercher un film (ex: ' + film_ttl + ')';
			} else {
				document.getElementById('ttl').value = film_ttl;
			}
		} else if (type == 1) {
			document.getElementById('ttl').value = 'Chercher un réalisateur (ex: George Lucas)';
		} else if (type == 2) {
			document.getElementById('ttl').value = 'Chercher un acteur (ex: Brad Pitt)';
		} else {
			document.getElementById('ttl').value = 'Chercher une catégorie  (ex: Action)';
		}
	} else {
		document.getElementById('ttl').style.color = 'black';
	}
}

function searchClick() {
	search_text = trim(document.getElementById('ttl').value);
	document.getElementById('ttl').style.color = 'black';
	if (search_text.indexOf('Chercher un') == 0 || search_text.indexOf("Rechercher dans la collection de ") == 0) {
		document.getElementById('ttl').value = '';
	}
}

function otherSearchCine(module, FltTpe) {
	search_text = document.getElementById('ttl').value;
	if (search_text.indexOf('ex: ') == 0) {
		search_text = '';
	}
	if (trim(search_text) != '') {
		location.href='?module=' + module + '&ttl=' + document.getElementById('ttl').value + '&FltTpe=' + FltTpe;
	} else {
		location.href='?module=' + module + '&ttl=%20&FltTpe=' + FltTpe;
	}
}
	
function changeRadioCine(type, ville_ex, code_postal_ex, flm_title_ex, salle_ex) {
	search_text = trim(document.getElementById('ttl').value);
	if (search_text.indexOf('ex: ') == 0) {
		search_text = '';
	}
	if (search_text == '') {
		document.getElementById('ttl').style.color = 'gray';
		if (type == 0) {
			document.getElementById('ttl').value = 'ex: ' + ville_ex;
		} else if (type == 1) {
			document.getElementById('ttl').value = 'ex: ' + code_postal_ex + ' ' + flm_title_ex;
		} else {
			document.getElementById('ttl').value = 'ex: ' + salle_ex;
		}
	} else {
		document.getElementById('ttl').style.color = 'black';
	}
}

function searchClickCine() {
	search_text = trim(document.getElementById('ttl').value);
	document.getElementById('ttl').style.color = 'black';
	if (search_text.indexOf('ex: ') == 0) {
		document.getElementById('ttl').value = '';
	}
}

function getUrl(url) {
	tabUrl = url.split("#");
	return tabUrl[0]; 
}

function delItem(delUrl, windowOpen, windowName, windowInfo) {
	if(confirm('Etes vous sûr de vouloir supprimer cet élément ?')) {
		if (windowOpen==true) {
    		window.open(delUrl, windowName, windowInfo);
    	} else {
    		location.href=delUrl;
    	}
	}
}

function moveItem(delUrl, windowOpen, windowName, windowInfo) {
	if(confirm('Etes vous sûr de vouloir retirer cet élément ?')) {
    	if (windowOpen==true) {
    		window.open(delUrl, windowName, windowInfo);
    	} else {
    		location.href=delUrl;
    	}
	}
}

function delItemWithMsg(delUrl, msg, windowOpen, windowName, windowInfo) {
	if(confirm(msg)) {
		if (windowOpen==true) {
    		window.open(delUrl, windowName, windowInfo);
    	} else {
    		location.href=delUrl;
    	}
	}
}

function nextPicture(picInput, imgUrlInput, curPicInput, tabPic) {
	obj = eval("document.getElementById('"+curPicInput+"')");
	curPicVal = obj.value;
	tabSmallPic = tabPic[0];
	tabBigPic = tabPic[1];
	
	nextPicVal = 0;
	if (curPicVal < tabSmallPic.length - 1) {
		nextPicVal = parseInt(curPicVal) + 1;
	}
	obj.value = nextPicVal;
	
	obj = eval("document.getElementById('"+picInput+"')");
	obj.src = tabSmallPic[nextPicVal];

	obj = eval("document.getElementById('"+imgUrlInput+"')");
	obj.href = tabBigPic[nextPicVal];
}

function previousPicture(picInput, imgUrlInput, curPicInput, tabPic) {
	obj = eval("document.getElementById('"+curPicInput+"')");
	curPicVal = obj.value;
	tabSmallPic = tabPic[0];
	tabBigPic = tabPic[1];
	
	nextPicVal = tabSmallPic.length - 1;
	if (curPicVal > 0) {
		nextPicVal = parseInt(curPicVal) - 1;
	}
	obj.value = nextPicVal;
	
	obj = eval("document.getElementById('"+picInput+"')");
	obj.src = tabSmallPic[nextPicVal];

	obj = eval("document.getElementById('"+imgUrlInput+"')");
	obj.href = tabBigPic[nextPicVal];
}

//Preload Image
function PreloadImage(image_url) {
	preload_image_object = new Image();
  preload_image_object.src = image_url;
}

function SaveWindowSize() {
	var wdt = 0;
	var hgt = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		wdt = window.innerWidth;
		hgt = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		wdt = document.documentElement.clientWidth;
		hgt = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		wdt = document.body.clientWidth;
		hgt = document.body.clientHeight;
	}
	EcrireCookie("width", wdt);
	EcrireCookie("height", hgt);
	
	if ('function' == typeof(viewHeaderFilmInfoResizeArrondi)) { viewHeaderFilmInfoResizeArrondi(); }
}

function SaveScreenSize() {
	EcrireCookie("width", screen.width);
	EcrireCookie("height", screen.height);
}

function EcrireCookie(nom, valeur)
{
	var argv=EcrireCookie.arguments;
	var argc=EcrireCookie.arguments.length;
	var expires=(argc > 2) ? argv[2] : null;
	var path=(argc > 3) ? argv[3] : null;
	var domain=(argc > 4) ? argv[4] : null;
	var secure=(argc > 5) ? argv[5] : false;
	document.cookie=nom+"="+escape(valeur)+
	((expires==null) ? "" : ("; expires="+expires.toGMTString()))+
	((path==null) ? "" : ("; path="+path))+
	((domain==null) ? "" : ("; domain="+domain))+
	((secure==true) ? "; secure" : "");
}

function LireCookie(nom) {
	if (document.cookie) {
		index = document.cookie.indexOf(nom);
		if (index != -1) {
			nDeb = (document.cookie.indexOf("=", index) + 1);
			nFin = document.cookie.indexOf(";", index);
			if (nFin == -1) {nFin = document.cookie.length;}
			return unescape(document.cookie.substring(nDeb, nFin));
		}
	}
	return null;
}

function AutoCompleteSelected(id, bckgColor, nbCol)
{
	theCells = eval("document.getElementById('"+id+"')").cells;
	for (j=0; j < nbCol; j++) {
		theCells[j].style.backgroundColor=bckgColor;
	}
}

function rateFilm(element, memo) {
  flm_id = memo.identity.replace("rate_flm_id_", "");
  var flm_id_tmp = flm_id.split("_");
  flm_id = flm_id_tmp[0];
  var httpSearchTitle = createRequestObject();
	httpSearchTitle.open('get', 'http://' + BobThequeHostname + '/php_ajax/search_flm_title.php?flm_id=' + flm_id);
	httpSearchTitle.onreadystatechange = function () { 
		if(httpSearchTitle.readyState == 4){
			var response = httpSearchTitle.responseText;
			if (response != ""){
				if (confirm('Etes-vous sûr de vouloir donner une note de ' + memo.rated + ' pour le film ' + response + '?')) {
				  var HttpRateFilm = CreateRequestObject();
					HttpRateFilm.open('get', 'http://' + BobThequeHostname + '/flm_note.php?flm_id=' + flm_id + '&note=' + memo.rated);
					HttpRateFilm.send(null);
					alert("Merci d'avoir voté pour le film " + response + ".");
				}
			}
		}
	}
	httpSearchTitle.send(null);
}

function rateNews(element, memo) {
  nws_id = memo.identity.replace("rate_nws_id_", "");
  alert("Merci d'avoir voté !");
  var HttpRateNews = CreateRequestObject();
	HttpRateNews.open('get', 'http://' + BobThequeHostname + '/news_cine_note.php?nws_id=' + nws_id + '&note=' + memo.rated);
	HttpRateNews.send(null);
}

function rateBobPlay(element, memo) {
  bobplay_id = memo.identity.replace("rate_bobplay_id_", "");
  alert("Merci d'avoir voté !");
  var HttpRateNews = CreateRequestObject();
	HttpRateNews.open('get', 'http://' + BobThequeHostname + '/bobplay_note.php?bob_play_id=' + bobplay_id + '&note=' + memo.rated);
	HttpRateNews.send(null);
}

function addToFavorite() {
	siteURL = "http://www.bobtheque.com/"
	siteNOM = "BobThèque"
	
	/*-- MESSAGE --*/
	function myMessageAddToFav(raccourciClavier) {
		alert ("Utilisez '" + raccourciClavier + "'\npour ajouter " + siteNOM + " dans vos favoris !");
	}
	
	//Konqueror
	if (navigator.userAgent.indexOf('Konqueror') >= 0) {
	/*Test a effectuer avant tout les autres car repond TRUE aux differents tests sans pouvoir les exploiter*/
		myMessageAddToFav("CTRL + B");
	} else if (window.sidebar) {
		/* Netscape 6+ ; Mozilla, FireFox et compagnie (K-Meleon ...) */
		window.sidebar.addPanel(siteNOM,siteURL,"");
	} else if (window.external) {
		/* Internet Explorer 4+, et ses dérivés (Crazy Browser, Avent Browser ...) */
		window.external.AddFavorite(siteURL,siteNOM);
	} else if (document.all && (navigator.userAgent.indexOf('Win') < 0)) {
		/* Internet Explorer Mac */
		myMessageAddToFav("POMME + D");
	} else if (window.opera && window.print) {
		/* Opera 6+ */
		myMessageAddToFav("CTRL + T");
	} else if (document.layers) {
		/* Netsccape 4 */
		myMessageAddToFav("CTRL + D");
	} else {
		alert("Cette fonction n'est pas disponible pour votre navigateur.");
	}
}

// Fonction de stockage des scripts à charger 
FuncOL = new Array(); 
function StkFunc(Obj) { 
    FuncOL[FuncOL.length] = Obj; 
} 
     
// Execution des scripts au chargement de la page 
window.onload = function() { 
    for(i=0; i<FuncOL.length; i++) 
        {FuncOL[i]();} 
}

// Fonction de stockage des scripts à charger lors d'un resize
FuncOR = new Array(); 
function StkFuncOR(Obj) { 
    FuncOR[FuncOR.length] = Obj; 
} 
     
// Execution des scripts au resize de la page 
window.onresize = function() { 
    for(i=0; i<FuncOR.length; i++) 
        {FuncOR[i]();} 
}

function CreateRequestObject() {
	var req = false;
  // branch for native XMLHttpRequest object
  if(window.XMLHttpRequest && !(window.ActiveXObject)) {
      try {
          req = new XMLHttpRequest();
      } catch(e) {
          req = false;
      }
  // branch for IE/Windows ActiveX version
  } else if(window.ActiveXObject) {
         try {
          req = new ActiveXObject("Msxml2.XMLHTTP");
        } catch(e) {
          try {
                req = new ActiveXObject("Microsoft.XMLHTTP");
          } catch(e) {
                req = false;
          }
      }
  }
  
	return req;
}

function GetBobAdvert(divBobAdvert, id, background, title, text, url, border, widthDef, heightDef, nbPub) {
	var HttpBobAdvert = CreateRequestObject();
	//alert('http://www.bobtheque.com/pub.php?divBobAdvert='+divBobAdvert+'&id='+id+'&background='+background+'&title='+title+'&text='+text+'&url='+url+'&border='+border+'&widthDef='+widthDef+'&heightDef='+heightDef+'&nbPub='+nbPub);
	HttpBobAdvert.open('get', 'http://' + BobThequeHostname + '/pub.php?divBobAdvert='+divBobAdvert+'&id='+id+'&widthDef='+widthDef+'&heightDef='+heightDef+'&nbPub='+nbPub+'&background='+background+'&title='+title+'&text='+text+'&url='+url+'&border='+border+'&'+new Date());
	HttpBobAdvert.onreadystatechange = function () { 
		if(HttpBobAdvert.readyState == 4){
			var response = HttpBobAdvert.responseText;
			if (response != ""){
				if(response.indexOf('|' != -1)) {
					var result = response.split('|');
					if (result.length > 1) {
						var pub = "";
						for (i=1; i<result.length; i++) {
							if (i > 1) { pub += "|"; }
							pub += result[i];
						}
						var obj = eval("document.getElementById('"+result[0]+"')");
						var refreshTime = 60000;
						if (obj != null) {
							obj.innerHTML = pub;
						} else {
							refreshTime = 2000;
						}
						setTimeout("GetBobAdvert('"+divBobAdvert+"', "+id+", '"+background+"', '"+title+"', '"+text+"', '"+url+"', '"+border+"', '"+widthDef+"', '"+heightDef+"', "+nbPub+")",refreshTime);
					}
				}
			}
		}
	};
	HttpBobAdvert.send(null);
}
function BobClickAdvert(id, url) {
	var HttpBobAdvert = CreateRequestObject();
	HttpBobAdvert.open('get', 'http://' + BobThequeHostname + '/pub.php?id='+id+'&click=true');
	HttpBobAdvert.send(null);
	window.open(url, 'BobAdvertClick'+id);
}


function DisplayBlogBangAds(divAd) {
	var objDiv = eval("document.getElementById('"+divAd+"')");
	if (objDiv != null) {
		/*if (navigator.appName == "Microsoft Internet Explorer") {
			document.write("<script src='http://www.blogbang.com/demo/js/blogbang_ad.php?id=8683842fd9' type='text/javascript'></script>");
		} else {
			var myScript = document.createElement("script");
			myScript.src = 'http://www.blogbang.com/demo/js/blogbang_ad.php?id=8683842fd9';
			objDiv.appendChild(myScript);
		}*/
		objDiv.innerHTML = '<iframe src="http://www.bobtheque.com/pub_google.php?width=468&height=60&format=468x60_as&type=image" width="468" height="60" scrolling="no" border="0" marginwidth="0" style="border:none;" frameborder="0"></iframe>';
	}
}

function DisplayBlogBangAdsSmall(divAd) {
	var objDiv = eval("document.getElementById('"+divAd+"')");
	if (objDiv != null) {
		if (navigator.appName == "Microsoft Internet Explorer") {
			document.write("<script src='http://www.blogbang.com/demo/js/blogbang_ad.php?id=20e7f872d6' type='text/javascript'></script>");
		} else {
			var myScript = document.createElement("script");
			myScript.src = 'http://www.blogbang.com/demo/js/blogbang_ad.php?id=20e7f872d6';
			objDiv.appendChild(myScript);
		}
		//objDiv.innerHTML = '<iframe src="http://www.bobtheque.com/pub_google.php?width=125&height=125&format=125x125_as&type=text" width="125" height="125" scrolling="no" border="0" marginwidth="0" style="border:none;" frameborder="0"></iframe>';
	}
}

/**
 * SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 */
if(typeof deconcept=="undefined"){var deconcept=new Object();}if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\"";_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1a=this.getParams();for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}var _1c=this.getVariablePairs().join("&");if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\">";_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _1d=this.getParams();for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false;}if(this.major>fv.major){return true;}if(this.minor<fv.minor){return false;}if(this.minor>fv.minor){return true;}if(this.rev<fv.rev){return false;}return true;};deconcept.util={getRequestParameter:function(_2b){var q=document.location.search||document.location.hash;if(_2b==null){return q;}if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return "";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;
var menuFooterIsDisplay = false;
var menuFooterFavoriteIsDisplay = false;
var menuFooterWallEvtIsDisplay = false;
var menuFooterGetMsgChat = false;
var userMakeClick = 0;
var timerMenuFooterGetNewUserMsgChatRequest = null;
var timerMenuFooterIsDisplayOK = null;
var timerMenuFooterGetMsgChatRequest = null;

function hideMenuFooterDiv() {
	if (menuFooterIsDisplay == true) {
		document.getElementById('menu_footer_div').innerHTML = '';
		document.getElementById('menu_footer_div').style.display = 'none';
		document.getElementById('menu_footer_div').style.opacity = 1;
		document.getElementById('menu_footer_div').style.filter = 'alpha(opacity=100)';
		
		menuFooterIsDisplay = false;
		menuFooterGetMsgChat = false;
	} 
	if (menuFooterFavoriteIsDisplay == true) {
		document.getElementById('menu_footer_fav_div').innerHTML = '';
		document.getElementById('menu_footer_fav_div').style.display = 'none';
		menuFooterFavoriteIsDisplay = false;
	} 
	if (menuFooterWallEvtIsDisplay == true) {
		document.getElementById('menu_footer_wall_evt_div').innerHTML = '';
		document.getElementById('menu_footer_wall_evt_div').style.display = 'none';
		menuFooterWallEvtIsDisplay = false;
	}
	userMakeClick = 1;
}

function MenuFooterFriendsOnline(alias) {
	menuFooterIsDisplay=false;
	menuFooterFavoriteIsDisplay = true;
	menuFooterWallEvtIsDisplay = true;
	hideMenuFooterDiv();
	
	document.getElementById('menu_footer_div').style.display = 'block';
	document.getElementById('menu_footer_div').style.opacity = 1;
	document.getElementById('menu_footer_div').style.filter = 'alpha(opacity=100)';
	document.getElementById('menu_footer_div').innerHTML = '<div id="divMenuFooterChatHeader" onClick="hideMenuFooterDiv();"><a href="javascript:void(0);"><img src="http://' + BobThequeHostname + '/img/remove.png" height="16" whidth="16" align="absmiddle" border="0" style="float:right;"/></a>BobThèque Live !</div>';
	document.getElementById('menu_footer_div').innerHTML += '<div align="center"><img src="http://' + BobThequeHostname + '/img/waiting_0.gif"></div>';
	
	var HttpListUserFriendsOnline = CreateRequestObject();
	HttpListUserFriendsOnline.open('get', 'http://' + BobThequeHostname + '/php_ajax/get_list_user_friends_online.php');
	HttpListUserFriendsOnline.onreadystatechange = function () { 
		if(HttpListUserFriendsOnline.readyState == 4){
			var listFriendsOnline = '<div id="divMenuFooterChatHeader" onClick="hideMenuFooterDiv();"><a href="javascript:void(0);"><img src="http://' + BobThequeHostname + '/img/remove.png" height="16" whidth="16" align="absmiddle" border="0" style="float:right;"/></a>BobThèque Live !</div><div id="divMenuFooterChat">';
			var nb_friends_online = 0;
			
			var response = HttpListUserFriendsOnline.responseText;
			if (response != ""){
				tabRes = response.split('\|');
				listFriendsOnline += "<font size=\"1\"><i><img src=\"http://" + BobThequeHostname + "/img/fleche_black3.gif\"/> Disponibles (" + ((tabRes.length-1)/4) + ")</i></font><br/><blockquote>";
				if (tabRes.length > 0) {
					var existMsgUserNotOnline = false;
					for (i=0; i < tabRes.length-1; i++) {
						if (existMsgUserNotOnline == true && tabRes[i+2] != -1) {
							listFriendsOnline += "<hr>";
							existMsgUserNotOnline = false;
						}
						
						listFriendsOnline += "<nobr>";
						if (tabRes[i+3] != 3) {
							listFriendsOnline += "<a href=\"javascript:void(0);\" onclick=\"MenuFooterChatWithFriend('" + alias + "', " + tabRes[i] + ", '" + tabRes[i+1] + "');\">";
						} else {
							listFriendsOnline += "<a href=\"javascript:void(0);\" onclick=\"MenuFooterConfirmAddUserToFriend(" + tabRes[i] + ", '" + tabRes[i+1] + "');MenuFooterChatWithFriend('" + alias + "', " + tabRes[i] + ", '" + tabRes[i+1] + "');\">";
						}
						if (tabRes[i+3] == 0) {	// user sleep
							listFriendsOnline += "<img src=\"http://" + BobThequeHostname + "/img/user_sleep.png\" border=\"0\" align=\"absmiddle\" alt=\"Ami non actif\" title=\"Ami non actif\">";
						} else if (tabRes[i+3] == 1) {	// user actif
							listFriendsOnline += "<img src=\"http://" + BobThequeHostname + "/img/user.gif\" border=\"0\" align=\"absmiddle\" alt=\"Ami en ligne\" title=\"Ami en ligne\">";
						} else if (tabRes[i+3] == 2) { // user not connected, but user friend
							listFriendsOnline += "<img src=\"http://" + BobThequeHostname + "/img/user_not_connect.gif\" border=\"0\" align=\"absmiddle\" alt=\"Ami non connecté\" title=\"Ami non connecté\">";
						} else { // user not connected, but user is not a friend
							listFriendsOnline += "<img src=\"http://" + BobThequeHostname + "/img/user_unknow.png\" border=\"0\" align=\"absmiddle\" alt=\"Utilisateur non présent dans votre liste d'ami\" title=\"Utilisateur non présent dans votre liste d'ami\">";
						}
						
						listFriendsOnline += " " + tabRes[i+1];
						if (tabRes[i+2] == 0) { // user with a msg
							listFriendsOnline += " <img src='http://" + BobThequeHostname + "/img/bullet02_green.gif' border='0' align='absmiddle' title='Vous avez reçu un message' alt='Vous avez reçu un message'/>";
						} else if (tabRes[i+2] == -1) { // user not connected, but a msg exists
							listFriendsOnline += " <img src='http://" + BobThequeHostname + "/img/bullet02_orange.gif' border='0' align='absmiddle' title='Vous avez reçu un message' alt='Vous avez reçu un message'/>";
							existMsgUserNotOnline = true;
						}
						listFriendsOnline += "</a> <a href=\"javascript:void(0);\" onClick=\"GetUsrFilmSharing(" + tabRes[i] + ", '" + tabRes[i+1] + "');\"><img src=\"http://" + BobThequeHostname + "/img/collection.png\" border=\"0\" height=\"16\" width=\"16\" align=\"absmiddle\" alt=\"Emprunter un film à votre ami\" title=\"Emprunter un film à votre ami\"></a></nobr><br/>";
						if (tabRes[i+2] != -1) { // count friends connected
							nb_friends_online++;
						}
						i = i+3;
					}
				} else {
					listFriendsOnline += "<b><font size=\"1\">Aucun amis connectés.</font></b>";
				}
				listFriendsOnline += "</blockquote>";
			} else {
				listFriendsOnline += "<font size=\"1\"><i><img src=\"http://" + BobThequeHostname + "/img/fleche_black3.gif\"/> Disponibles (0)</i></font><br/>";
				listFriendsOnline += "<blockquote><b><font size=\"1\">Aucun amis connectés.</font></b></blockquote>";
			}
			var userNbFriendsObj = document.getElementById('my_friend_list');
			if (userNbFriendsObj != null) {
				var nbFriendsOffline = parseInt(userNbFriendsObj.innerHTML) - nb_friends_online;
				if (nbFriendsOffline > 0) {
					listFriendsOnline += "<font size=\"1\" onClick=\"MenuFooterFriendsOffline('" + alias + "');\" style=\"cursor:pointer;\"><br/><i><img src=\"http://" + BobThequeHostname + "/img/fleche_black1.gif\" id=\"divMenuFooterFlecheUserOffline\"/> Hors Ligne (" + nbFriendsOffline + ")</i></font><br/>";
					listFriendsOnline += '<blockquote><div id="divMenuFooterListUserOffline" style=\"display:none;\"><div align="center"><img src="http://' + BobThequeHostname + '/img/waiting_0.gif"></div></div></blockquote>';
				}
			}
			
			var addFriendArea = "<hr><img src=\"http://" + BobThequeHostname + "/img/addfriend.png\" height=\"16\" width=\"16\" border=\"0\" title=\"Ajouter un ami\" alt=\"Ajouter un ami\" align=\"absmiddle\"/> ";
			addFriendArea += "<input type=\"text\" id=\"friend_pseudo\" value=\"\" style=\"width:102px;\" onClick=\"menuFooterVolontaryClick();\"/> <input type=\"button\" value=\"Ajouter\" onClick=\"addNewFriend();return false;\"/>";
			listFriendsOnline += "</div>" + addFriendArea;
			document.getElementById('menu_footer_div').innerHTML = listFriendsOnline;
			document.getElementById('span_friends_online').innerHTML = nb_friends_online;
			menuFooterGetMsgChat = false;
		}
	};
	HttpListUserFriendsOnline.send(null);
	timerMenuFooterIsDisplayOK = setTimeout("menuFooterIsDisplayOK()", 100);
}

function MenuFooterFriendsOffline(alias) {
	if (document.getElementById('divMenuFooterFlecheUserOffline').src.indexOf('img/fleche_black3.gif') != -1) {
		document.getElementById('divMenuFooterFlecheUserOffline').src = "http://" + BobThequeHostname + "/img/fleche_black1.gif";
		document.getElementById('divMenuFooterListUserOffline').style.display = 'none';
	} else {
		var HttpListUserFriendsOffline = CreateRequestObject();
		HttpListUserFriendsOffline.open('get', 'http://' + BobThequeHostname + '/php_ajax/get_list_user_friends_offline.php');
		HttpListUserFriendsOffline.onreadystatechange = function () { 
			if(HttpListUserFriendsOffline.readyState == 4){
				var response = HttpListUserFriendsOffline.responseText;
				if (response != ""){
					tabRes = response.split('\|');
					if (tabRes.length > 0) {
						var listFriendsOffline = "";
						
						document.getElementById('divMenuFooterFlecheUserOffline').src = "http://" + BobThequeHostname + "/img/fleche_black3.gif";
						document.getElementById('divMenuFooterListUserOffline').style.display = 'inline';
						
						for (i=0; i < tabRes.length-1; i++) {
							listFriendsOffline += "<nobr>";
							listFriendsOffline += "<a href=\"javascript:void(0);\" onclick=\"MenuFooterChatWithFriend('" + alias + "', " + tabRes[i] + ", '" + tabRes[i+1] + "');\">";
							listFriendsOffline += "<img src=\"http://" + BobThequeHostname + "/img/user_not_connect.gif\" border=\"0\" align=\"absmiddle\" alt=\"Ami non connecté\" title=\"Ami non connecté\">";
							listFriendsOffline += " " + tabRes[i+1] + "</a> <a href=\"javascript:void(0);\" onClick=\"GetUsrFilmSharing(" + tabRes[i] + ", '" + tabRes[i+1] + "');\"><img src=\"http://" + BobThequeHostname + "/img/collection.png\" border=\"0\" height=\"16\" width=\"16\" align=\"absmiddle\" alt=\"Emprunter un film à votre ami\" title=\"Emprunter un film à votre ami\"></a></nobr><br/>";
							i = i+1;
						}
						document.getElementById('divMenuFooterListUserOffline').innerHTML = listFriendsOffline;
					}
				}
			}
		};
		HttpListUserFriendsOffline.send(null);
	}
}

function MenuFooterChatWithFriend(alias, friend_usr_id, alias_friend) {
	menuFooterIsDisplay=false;
	document.getElementById('menuFooterAlertUserNewMsgChat').style.display = 'none';
	document.getElementById('menu_footer_div').style.display = 'block';
	document.getElementById('menu_footer_div').style.opacity = 1;
	document.getElementById('menu_footer_div').style.filter = 'alpha(opacity=100)';
	
	var chatHTML = '<div id="divMenuFooterChatHeader" onClick="hideMenuFooterDiv();"><a href="javascript:void(0);"><img src="http://' + BobThequeHostname + '/img/remove.png" height="16" whidth="16" align="absmiddle" border="0" style="float:right;"/></a>Chat avec ' + alias_friend + '</div>';
	chatHTML += '<div id="divMenuFooterChat"><div align="center" id="divMenuFooterChatLoading"><img src="http://' + BobThequeHostname + '/img/waiting_0.gif"></div></div>';
	chatHTML += '<div id="divMenuFooterChatLastMsgDtetme" style="display:none;"><font size="1"><i>Dernier message : </i></font></div>';
	chatHTML += '<hr><textarea id="menuFooterChatMsg" onClick="menuFooterVolontaryClick();" style="width:190px;"></textarea><br/>';
	chatHTML += '<input type="button" value="Envoyer" onClick="MenuFooterChatSendMessage(\'' + alias + '\', ' + friend_usr_id + ', \'' + alias_friend + '\');return false;" style="width:190px;"/>';
	
	document.getElementById('menu_footer_div').innerHTML = chatHTML;
	
	var HttpChatHistoMsg = CreateRequestObject();
	HttpChatHistoMsg.open('get', 'http://' + BobThequeHostname + '/php_ajax/chat_get_usr_msg.php?histo=true&usr_id=' + friend_usr_id);
	HttpChatHistoMsg.onreadystatechange = function () { 
		if(HttpChatHistoMsg.readyState == 4){
			var tabRes = HttpChatHistoMsg.responseText.split('&\|##\|&');
			document.getElementById('divMenuFooterChat').innerHTML = tabRes[1];
			menuFooterGetMsgChat = true;
			
			if (tabRes[0] != "") {
				document.getElementById('divMenuFooterChatLastMsgDtetme').style.display = 'inline';
				document.getElementById('divMenuFooterChatLastMsgDtetme').innerHTML = '<font size="1"><i>Dernier message : ' + tabRes[0] + '</i></font>';
			}
			
			timerMenuFooterGetMsgChatRequest = setTimeout("MenuFooterGetMsgChatRequest(" + friend_usr_id + ")", 100);
			
			var HttpChatReadMsg = CreateRequestObject();
			HttpChatReadMsg.open('get', 'http://' + BobThequeHostname + '/php_ajax/chat_set_usr_msg.php?read=true&usr_id=' + friend_usr_id);
			HttpChatReadMsg.send(null);
					
		}
	};
	HttpChatHistoMsg.send(null);
	
	timerMenuFooterIsDisplayOK = setTimeout("menuFooterIsDisplayOK()", 100);
}

function MenuFooterChatSendMessage(alias, friend_usr_id, alias_friend) {
	menuFooterIsDisplay=false;
	
	if (document.getElementById('divMenuFooterChatLoading') == null) {
		if (document.getElementById('menuFooterChatMsg').value != "") {
			strMsgChat = strip_tags(document.getElementById('menuFooterChatMsg').value);
			var HttpChatSendMsg = CreateRequestObject();
			HttpChatSendMsg.open('get', 'http://' + BobThequeHostname + '/php_ajax/chat_set_usr_msg.php?insert=true&usr_id=' + friend_usr_id + '&msg=' + urlencode(strMsgChat));
			HttpChatSendMsg.onreadystatechange = function () { 
				if(HttpChatSendMsg.readyState == 4){
					var response = HttpChatSendMsg.responseText;
					if (trim(response) != ""){
						document.getElementById('divMenuFooterChat').innerHTML = document.getElementById('divMenuFooterChat').innerHTML + "<i>" + response + "</i><br/>";
					} else {
						document.getElementById('divMenuFooterChat').innerHTML = document.getElementById('divMenuFooterChat').innerHTML + "<b>" + alias + ":</b> " + menuFooterFormatSentText(strMsgChat) + "<br/>";
					}
					document.getElementById('divMenuFooterChat').scrollTop = document.getElementById('divMenuFooterChat').scrollHeight;
					document.getElementById('menuFooterChatMsg').value = '';
					document.getElementById('divMenuFooterChatLastMsgDtetme').style.display = 'none';
				}
			};
			HttpChatSendMsg.send(null);
		}
	} else {
		alert('Veuillez patienter pendant le chargement du chat !');
	}
	
	timerMenuFooterIsDisplayOK = setTimeout("menuFooterIsDisplayOK()", 100);
}

function MenuFooterGetMsgChatRequest(friend_usr_id) {
	if (timerMenuFooterGetMsgChatRequest != null) {
		clearTimeout(timerMenuFooterGetMsgChatRequest);
		timerMenuFooterGetMsgChatRequest = null;
	}
	
	if (menuFooterGetMsgChat == true) {
		var HttpChatGetNewMsg = CreateRequestObject();
		HttpChatGetNewMsg.open('get', 'http://' + BobThequeHostname + '/php_ajax/chat_get_usr_msg.php?last=true&usr_id=' + friend_usr_id);
		HttpChatGetNewMsg.onreadystatechange = function () { 
			if(HttpChatGetNewMsg.readyState == 4){
				if (document.getElementById('divMenuFooterChat') != null) {
					var tabRes = HttpChatGetNewMsg.responseText.split('&\|##\|&');
					
					document.getElementById('divMenuFooterChat').innerHTML = document.getElementById('divMenuFooterChat').innerHTML + tabRes[1];
					document.getElementById('divMenuFooterChat').scrollTop = document.getElementById('divMenuFooterChat').scrollHeight;
					
					if (tabRes[0] != "") {
						document.getElementById('divMenuFooterChatLastMsgDtetme').style.display = 'inline';
						document.getElementById('divMenuFooterChatLastMsgDtetme').innerHTML = '<font size="1"><i>Dernier message : ' + tabRes[0] + '</i></font>';
					}
					
					var HttpChatReadMsg = CreateRequestObject();
					HttpChatReadMsg.open('get', 'http://' + BobThequeHostname + '/php_ajax/chat_set_usr_msg.php?read=true&usr_id=' + friend_usr_id);
					HttpChatReadMsg.send(null);
				}
			}
		};
		HttpChatGetNewMsg.send(null);
		timerMenuFooterGetMsgChatRequest = setTimeout("MenuFooterGetMsgChatRequest(" + friend_usr_id + ")", 10000);
	}
}

function MenuFooterGetNewUserMsgChatRequest(alias) {
	if (timerMenuFooterGetNewUserMsgChatRequest != null) {
		clearTimeout(timerMenuFooterGetNewUserMsgChatRequest);
		timerMenuFooterGetNewUserMsgChatRequest = null;
	}
	
	var HttpChatGetNewUserMsg = CreateRequestObject();
	HttpChatGetNewUserMsg.open('get', 'http://' + BobThequeHostname + '/php_ajax/chat_get_usr_msg.php?nb_no_read=true&usr_click=' + userMakeClick);
	userMakeClick = 0;
	HttpChatGetNewUserMsg.onreadystatechange = function () { 
		if(HttpChatGetNewUserMsg.readyState == 4){
			if (document.getElementById('menuFooterAlertUserNewMsgChat') != null) {
				if (HttpChatGetNewUserMsg.responseText > 0) {
					document.getElementById('menuFooterAlertUserNewMsgChat').style.display = 'inline';
					
					if (document.getElementById('menu_footer_div').style.display == 'none') {
						document.getElementById('menu_footer_div').style.opacity = 0.8;
						document.getElementById('menu_footer_div').style.filter = 'alpha(opacity=80)';
	
						document.getElementById('menu_footer_div').style.display = 'block';
						document.getElementById('menu_footer_div').innerHTML = '<div id="divMenuFooterChatHeader" onClick="hideMenuFooterDiv();"><a href="javascript:void(0);"><img src="http://' + BobThequeHostname + '/img/remove.png" height="16" whidth="16" align="absmiddle" border="0" style="float:right;"/></a>Message sur le chat</div>';
						document.getElementById('menu_footer_div').innerHTML += '<div align="center" onClick="MenuFooterFriendsOnline(\'' + alias + '\');" style="cursor:pointer;"><a href="javascript:void(0);">Vous avez reçu un message !</a><br/><br/></div>';
						
						if (timerMenuFooterIsDisplayOK != null) {
							clearTimeout(timerMenuFooterIsDisplayOK);
							timerMenuFooterIsDisplayOK = null;
						}
						timerMenuFooterIsDisplayOK = setTimeout("menuFooterIsDisplayOK()", 100);
					}
				} else {
					document.getElementById('menuFooterAlertUserNewMsgChat').style.display = 'none';
				}
			}
		}
	};
	HttpChatGetNewUserMsg.send(null);
	timerMenuFooterGetNewUserMsgChatRequest = setTimeout("MenuFooterGetNewUserMsgChatRequest('" + alias + "')", 30000);
}

function MenuFooterConfirmAddUserToFriend(friend_usr_id, alias_friend) {
	if (confirm("Voulez-vous ajouter " + alias_friend + " à votre liste d'amis ?")) {
		Modalbox.show('add_friend.php?usr_id=' + friend_usr_id + '&screen=friend', 'title: Ajouter un ami de votre liste, width: 400');
	}
}

function addNewFriend(alias) {
	menuFooterIsDisplay=false;
	if (alias == null) {
		searchValue = document.getElementById('friend_pseudo').value;
	} else {
		searchValue = alias;
	}
	if (searchValue != "") {
		var HttpSearchUsrId = CreateRequestObject();
		HttpSearchUsrId.open('get', 'http://' + BobThequeHostname + '/php_ajax/search_usr_id.php?alias=' + searchValue);
		HttpSearchUsrId.onreadystatechange = function () { 
			if(HttpSearchUsrId.readyState == 4){
				var usr_id = HttpSearchUsrId.responseText;
				if (usr_id != "") {
					Modalbox.show('add_friend.php?usr_id=' + usr_id + '&screen=friend', 'title: Ajouter un ami de votre liste, width: 400');
				} else {
					alert('Impossible de trouver ce membre, vérifiez que le pseudo saisit est correct!');
				}
			}
		};
		HttpSearchUsrId.send(null);
	} else {
		alert('Vous devez saisir le pseudo d\'un membre, avant de pouvoir l\'ajouter!');
	}
	timerMenuFooterIsDisplayOK = setTimeout("menuFooterIsDisplayOK()", 100);
}

function menuFooterVolontaryClick() {
	menuFooterIsDisplay=false;
	timerMenuFooterIsDisplayOK = setTimeout("menuFooterIsDisplayOK()", 100);
}

function menuFooterIsDisplayOK() {
	if (timerMenuFooterIsDisplayOK != null) {
		clearTimeout(timerMenuFooterIsDisplayOK);
		timerMenuFooterIsDisplayOK = null;
	}
	menuFooterIsDisplay = true;
}

function menuFooterFormatSentText(text_user){
	text_user = replaceAll(text_user, "\n", "<br/>");
	text_user = replaceAll(text_user, ":)","<img src='http://" + BobThequeHostname + "/shoutbox/images/smiley7.gif'>");
	text_user = replaceAll(text_user, ":-)","<img src='http://" + BobThequeHostname + "/shoutbox/images/smiley7.gif'>");
	text_user = replaceAll(text_user, ":(","<img src='http://" + BobThequeHostname + "/shoutbox/images/smiley2.gif'>");
	text_user = replaceAll(text_user, ":-(","<img src='http://" + BobThequeHostname + "/shoutbox/images/smiley2.gif'>");
	text_user = replaceAll(text_user, ":@","<img src='http://" + BobThequeHostname + "/shoutbox/images/smiley1.gif'>");
	text_user = replaceAll(text_user, ":?","<img src='http://" + BobThequeHostname + "/shoutbox/images/smiley3.gif'>");
	text_user = replaceAll(text_user, ":t","<img src='http://" + BobThequeHostname + "/shoutbox/images/smiley4.gif'>");
	text_user = replaceAll(text_user, ":3","<img src='http://" + BobThequeHostname + "/shoutbox/images/smiley5.gif'>");
	text_user = replaceAll(text_user, ":8","<img src='http://" + BobThequeHostname + "/shoutbox/images/smiley6.gif'>");
	text_user = replaceAll(text_user, ":p","<img src='http://" + BobThequeHostname + "/shoutbox/images/smiley8.gif'>");
	text_user = replaceAll(text_user, ";)","<img src='http://" + BobThequeHostname + "/shoutbox/images/smiley9.gif'>");
	text_user = replaceAll(text_user, ";-)","<img src='http://" + BobThequeHostname + "/shoutbox/images/smiley9.gif'>");
	text_user = replaceAll(text_user, ":&#039;(","<img src='http://" + BobThequeHostname + "/shoutbox/images/smiley10.gif'>");
	text_user = replaceAll(text_user, ":oui:","<img src='http://" + BobThequeHostname + "/shoutbox/images/smiley11.gif'>");
	text_user = replaceAll(text_user, ":non:","<img src='http://" + BobThequeHostname + "/shoutbox/images/smiley12.gif'>");
	text_user = replaceAll(text_user, ":bye:","<img src='http://" + BobThequeHostname + "/shoutbox/images/smiley13.gif'>");
	text_user = replaceAll(text_user, ":lalala:","<img src='http://" + BobThequeHostname + "/shoutbox/images/smiley14.gif'>");
	text_user = replaceAll(text_user, ":mdr:","<img src='http://" + BobThequeHostname + "/shoutbox/images/smiley15.gif'>");
	text_user = replaceAll(text_user, ":super:","<img src='http://" + BobThequeHostname + "/shoutbox/images/smiley16.gif'>");
	return text_user;
}

function MenuFooterFavorite(alias, URL, ttl) {
	menuFooterFavoriteIsDisplay=false;
	menuFooterIsDisplay = true;
	menuFooterWallEvtIsDisplay = true;
	hideMenuFooterDiv();
	
	document.getElementById('menu_footer_fav_div').style.display = 'block';
	document.getElementById('menu_footer_fav_div').innerHTML = '<div id="divMenuFooterChatHeader" onClick="hideMenuFooterDiv();"><a href="javascript:void(0);"><img src="http://' + BobThequeHostname + '/img/remove.png" height="16" whidth="16" align="absmiddle" border="0" style="float:right;"/></a>Favoris de ' + alias + '</div>';
	document.getElementById('menu_footer_fav_div').innerHTML += '<div align="center"><img src="http://' + BobThequeHostname + '/img/waiting_0.gif"></div>';
	
	var HttpListFavoriteUser = CreateRequestObject();
	HttpListFavoriteUser.open('get', 'http://' + BobThequeHostname + '/php_ajax/get_list_favorite_user.php');
	HttpListFavoriteUser.onreadystatechange = function () { 
		var nbFavorite = 0;
		var listFavorite = '<div id="divMenuFooterChatHeader" onClick="hideMenuFooterDiv();"><a href="javascript:void(0);"><img src="http://' + BobThequeHostname + '/img/remove.png" height="16" whidth="16" align="absmiddle" border="0" style="float:right;"/></a>Favoris de ' + alias + '</div>';
		listFavorite += "<div id=\"menu_footer_list_fav_div\"><table width=\"100%\">";
		if(HttpListFavoriteUser.readyState == 4){
			var response = HttpListFavoriteUser.responseText;
			if (response != ""){
				tabRes = response.split('\|');
				if (tabRes.length > 0) {
					for (i=0; i < tabRes.length-1; i++) {
						listFavorite += "<tr><td><a href=\"" + tabRes[i] + "\"><img src=\"http://" + BobThequeHostname + "/img/fav_bobtheque.png\" height=\"16\" width=\"16\" border=\"0\" title=\"Favoris\" alt=\"Favoris\" align=\"absmiddle\"/> " + replaceAll(tabRes[i+1], "#MyTmpSep#", "|") + "</a></td>";
						listFavorite += "<td><img src=\"http://" + BobThequeHostname + "/img/delfriend.gif\" height=\"16\" width=\"16\" border=\"0\" title=\"Supprimer des favoris\" alt=\"Supprimer des favoris\" align=\"absmiddle\" style=\"cursor:pointer;\" onClick=\"MenuFooterRemoveToFavorite('" + tabRes[i] + "')\"/></td></tr>";
						nbFavorite++;
						i++;
					}
				}
			}
		}
		listFavorite += "</table></div>";
		if (nbFavorite == 0) {
			listFavorite += "<div align=\"center\">Vous n'avez pas de favoris<br/></div>";
		} else {
			listFavorite += "<hr>";
		}
		listFavorite += "<div align=\"center\" style=\"padding-bottom:10px;\"><a href=\"javascript:void(0);\" onClick=\"MenuFooterAddToFavorite('" + URL + "', '" + addslashes(ttl) + "');\"><img src=\"http://" + BobThequeHostname + "/img/fav_add.png\" height=\"16\" width=\"16\" border=\"0\" title=\"Ajouter aux favoris\" alt=\"Ajouter aux favoris\" align=\"absmiddle\"/> Ajouter aux favoris</a></div>";
		document.getElementById('menu_footer_fav_div').innerHTML = listFavorite;
	};
	HttpListFavoriteUser.send(null);
	timerMenuFooterFavoriteIsDisplayOK = setTimeout("menuFooterFavoriteIsDisplayOK()", 100);
}

function menuFooterFavoriteVolontaryClick() {
	menuFooterFavoriteIsDisplay=false;
	timerMenuFooterFavoriteIsDisplayOK = setTimeout("menuFooterFavoriteIsDisplayOK()", 100);
}

var timerMenuFooterFavoriteIsDisplayOK = null;
function menuFooterFavoriteIsDisplayOK() {
	if (timerMenuFooterFavoriteIsDisplayOK != null) {
		clearTimeout(timerMenuFooterFavoriteIsDisplayOK);
		timerMenuFooterFavoriteIsDisplayOK = null;
	}
	menuFooterFavoriteIsDisplay = true;
}

function MenuFooterAddToFavorite(URL, ttl) {
	var HttpAddToFavorite = CreateRequestObject();
	HttpAddToFavorite.open('get', 'http://' + BobThequeHostname + '/php_ajax/favorite_user.php?add=true&url=' + urlencode(URL) + '&ttl=' + urlencode(ttl));
	HttpAddToFavorite.send(null);
	hideMenuFooterDiv();
}

function MenuFooterRemoveToFavorite(URL) {
	if (confirm("Etes vous sur de vouloir rectirer ce liende vos favoris ?")) {
		var HttpAddToFavorite = CreateRequestObject();
		HttpAddToFavorite.open('get', 'http://' + BobThequeHostname + '/php_ajax/favorite_user.php?del=true&url=' + urlencode(URL));
		HttpAddToFavorite.send(null);
		hideMenuFooterDiv();
	}
}

function GetUsrFilmSharing(usr_id, alias) {
	if (!Modalbox.initialized && !Modalbox.firstLoad) {
		Modalbox.initObject();
	}
	Modalbox.show('usr_list_film_share.php?usr_id=' + usr_id, {title: 'Emprunter un film à ' + alias, width:400, height: 500, zIndex: 99997});
}

function MenuFooterWallEvt(usr_id, alias) {
	menuFooterFavoriteIsDisplay=false;
	menuFooterIsDisplay = true;
	menuFooterFavoriteIsDisplay = true;
	hideMenuFooterDiv();
	
	document.getElementById('menu_footer_wall_evt_div').style.display = 'block';
	document.getElementById('menu_footer_wall_evt_div').innerHTML = '<div id="divMenuFooterChatHeader" onClick="hideMenuFooterDiv();"><a href="javascript:void(0);"><img src="http://' + BobThequeHostname + '/img/remove.png" height="16" whidth="16" align="absmiddle" border="0" style="float:right;"/></a>R&eacute;seau cin&eacute; de ' + alias + '</div>';
	document.getElementById('menu_footer_wall_evt_div').innerHTML += '<div align="center"><img src="http://' + BobThequeHostname + '/img/waiting_0.gif"></div>';
	
	var HttpWallEvtUser = CreateRequestObject();
	HttpWallEvtUser.open('get', 'http://' + BobThequeHostname + '/php_ajax/wall/get_wall_evt_user.php');
	HttpWallEvtUser.onreadystatechange = function () { 
		if(HttpWallEvtUser.readyState == 4){
			var nbWallEvt = 0;
			var listWallEvt = '<div id="divMenuFooterChatHeader" onClick="hideMenuFooterDiv();"><a href="javascript:void(0);"><img src="http://' + BobThequeHostname + '/img/remove.png" height="16" whidth="16" align="absmiddle" border="0" style="float:right;"/></a>R&eacute;seau cin&eacute; de ' + alias + '</div>';
			listWallEvt += "<div id=\"menu_footer_list_wall_evt_div\"><table width=\"100%\">";
			var response = HttpWallEvtUser.responseText;
			if (response != ""){
				tabRes = response.split('\|');
				if (tabRes.length > 0) {
					for (i=0; i < tabRes.length-1; i++) {
						listWallEvt += "<tr><td";
						if (tabRes[i] == 0) { // already read
							listWallEvt += " style=\"background-color:palegreen;\"";
						}
						listWallEvt += ">" + replaceAll(tabRes[i+1], "#MyTmpSep#", "|") + "</td></tr>";
						nbWallEvt++;
						i++;
					}
				}
			}
			if (nbWallEvt == 0) {
				listWallEvt += "<tr><td><div align=\"center\">Pas de nouvel &eacute;v&eacute;nement sur votre r&eacute;seau cin&eacute;<br/></div></td></tr>";
			}
			listWallEvt += "<tr><td><div align=\"center\"><hr/><a href='?module=wall&usr_id=" + usr_id + "'><img src='http://" + BobThequeHostname + "/img/connect_to_network_16.png' border='0' align='absmiddle'/> Voir mon réseau ciné</a></div></td></tr>";
			listWallEvt += "</table></div>";
			document.getElementById('menu_footer_wall_evt_div').innerHTML = listWallEvt;
		}
	};
	HttpWallEvtUser.send(null);
	timerMenuFooterWallEvtIsDisplayOK = setTimeout("menuFooterWallEvtIsDisplayOK()", 100);
}

function MenuFooterWallEvtCount() {
	document.getElementById('menu_footer_wall_evt_div_nb_new_evt').style.opacity = 0.6;
	document.getElementById('menu_footer_wall_evt_div_nb_new_evt').style.filter = 'alpha(opacity=60)';
	document.getElementById('menu_footer_wall_evt_div_nb_new_evt').innerHTML = '';
	document.getElementById('menu_footer_wall_evt_div_nb_new_evt').style.display = 'none';
	
	var HttpWallEvtCountUser = CreateRequestObject();
	HttpWallEvtCountUser.open('get', 'http://' + BobThequeHostname + '/php_ajax/wall/get_wall_nb_new_evt_user.php');
	HttpWallEvtCountUser.onreadystatechange = function () { 
		if(HttpWallEvtCountUser.readyState == 4){
			var response = HttpWallEvtCountUser.responseText;
			if (response > 0){
				if (response > 99) {
					response = 99;
				}
				document.getElementById('menu_footer_wall_evt_div_nb_new_evt').innerHTML = response;
				document.getElementById('menu_footer_wall_evt_div_nb_new_evt').style.display = 'block';
				if (document.getElementById('wall_evt_div_nb_new_evt') != null) {
					document.getElementById('wall_evt_div_nb_new_evt').innerHTML = '&nbsp;(' + response + ')';
				}
			}
		}
	};
	HttpWallEvtCountUser.send(null);
}

function menuFooterWallEvtVolontaryClick() {
	menuFooterWallEvtIsDisplay=false;
	timerMenuFooterWallEvtIsDisplayOK = setTimeout("menuFooterWallEvtIsDisplayOK()", 100);
}

var timerMenuFooterWallEvtIsDisplayOK = null;
function menuFooterWallEvtIsDisplayOK() {
	if (timerMenuFooterWallEvtIsDisplayOK != null) {
		clearTimeout(timerMenuFooterWallEvtIsDisplayOK);
		timerMenuFooterWallEvtIsDisplayOK = null;
	}
	menuFooterWallEvtIsDisplay = true;
}
//v.2.5 build 91111

/*
Copyright DHTMLX LTD. http://www.dhtmlx.com
You allowed to use this component or parts of it under GPL terms
To use it on other terms or get Professional edition of the component please contact us at sales@dhtmlx.com
*/
dhtmlx=function(obj){for (var a in obj)dhtmlx[a]=obj[a];return dhtmlx};dhtmlx.extend_api=function(name,map,ext){var t = window[name];if (!t)return;window[name]=function(obj){if (obj && typeof obj == "object" && !obj.tagName && !(obj instanceof Array)){var that = t.apply(this,(map._init?map._init(obj):arguments));for (var a in dhtmlx)if (map[a])this[map[a]](dhtmlx[a]);for (var a in obj){if (map[a])this[map[a]](obj[a]);else if (a.indexOf("on")==0){this.attachEvent(a,obj[a])}}}else
 var that = t.apply(this,arguments);if (map._patch)map._patch(this);return that||this};window[name].prototype=t.prototype;if (ext)dhtmlXHeir(window[name].prototype,ext)};dhtmlxAjax={get:function(url,callback){var t=new dtmlXMLLoaderObject(true);t.async=(arguments.length<3);t.waitCall=callback;t.loadXML(url)
 return t},
 post:function(url,post,callback){var t=new dtmlXMLLoaderObject(true);t.async=(arguments.length<4);t.waitCall=callback;t.loadXML(url,true,post)
 return t},
 getSync:function(url){return this.get(url,null,true)
 },
 postSync:function(url,post){return this.post(url,post,null,true)}};function dtmlXMLLoaderObject(funcObject, dhtmlObject, async, rSeed){this.xmlDoc="";if (typeof (async)!= "undefined")
 this.async=async;else
 this.async=true;this.onloadAction=funcObject||null;this.mainObject=dhtmlObject||null;this.waitCall=null;this.rSeed=rSeed||false;return this};dtmlXMLLoaderObject.prototype.waitLoadFunction=function(dhtmlObject){var once = true;this.check=function (){if ((dhtmlObject)&&(dhtmlObject.onloadAction != null)){if ((!dhtmlObject.xmlDoc.readyState)||(dhtmlObject.xmlDoc.readyState == 4)){if (!once)return;once=false;if (typeof dhtmlObject.onloadAction == "function")dhtmlObject.onloadAction(dhtmlObject.mainObject, null, null, null, dhtmlObject);if (dhtmlObject.waitCall){dhtmlObject.waitCall.call(this,dhtmlObject);dhtmlObject.waitCall=null}}}};return this.check};dtmlXMLLoaderObject.prototype.getXMLTopNode=function(tagName, oldObj){if (this.xmlDoc.responseXML){var temp = this.xmlDoc.responseXML.getElementsByTagName(tagName);if(temp.length==0 && tagName.indexOf(":")!=-1)
 var temp = this.xmlDoc.responseXML.getElementsByTagName((tagName.split(":"))[1]);var z = temp[0]}else
 var z = this.xmlDoc.documentElement;if (z){this._retry=false;return z};if ((_isIE)&&(!this._retry)){var xmlString = this.xmlDoc.responseText;var oldObj = this.xmlDoc;this._retry=true;this.xmlDoc=new ActiveXObject("Microsoft.XMLDOM");this.xmlDoc.async=false;this.xmlDoc["loadXM"+"L"](xmlString);return this.getXMLTopNode(tagName, oldObj)};dhtmlxError.throwError("LoadXML", "Incorrect XML", [
 (oldObj||this.xmlDoc),
 this.mainObject
 ]);return document.createElement("DIV")};dtmlXMLLoaderObject.prototype.loadXMLString=function(xmlString){{
 try{var parser = new DOMParser();this.xmlDoc=parser.parseFromString(xmlString, "text/xml")}catch (e){this.xmlDoc=new ActiveXObject("Microsoft.XMLDOM");this.xmlDoc.async=this.async;this.xmlDoc["loadXM"+"L"](xmlString)}};this.onloadAction(this.mainObject, null, null, null, this);if (this.waitCall){this.waitCall();this.waitCall=null}};dtmlXMLLoaderObject.prototype.loadXML=function(filePath, postMode, postVars, rpc){if (this.rSeed)filePath+=((filePath.indexOf("?") != -1) ? "&" : "?")+"a_dhx_rSeed="+(new Date()).valueOf();this.filePath=filePath;if ((!_isIE)&&(window.XMLHttpRequest))
 this.xmlDoc=new XMLHttpRequest();else {if (document.implementation&&document.implementation.createDocument){this.xmlDoc=document.implementation.createDocument("", "", null);this.xmlDoc.onload=new this.waitLoadFunction(this);this.xmlDoc.load(filePath);return}else
 this.xmlDoc=new ActiveXObject("Microsoft.XMLHTTP")};if (this.async)this.xmlDoc.onreadystatechange=new this.waitLoadFunction(this);this.xmlDoc.open(postMode ? "POST" : "GET", filePath, this.async);if (rpc){this.xmlDoc.setRequestHeader("User-Agent", "dhtmlxRPC v0.1 ("+navigator.userAgent+")");this.xmlDoc.setRequestHeader("Content-type", "text/xml")}else if (postMode)this.xmlDoc.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');this.xmlDoc.setRequestHeader("X-Requested-With","XMLHttpRequest");this.xmlDoc.send(null||postVars);if (!this.async)(new this.waitLoadFunction(this))()};dtmlXMLLoaderObject.prototype.destructor=function(){this.onloadAction=null;this.mainObject=null;this.xmlDoc=null;return null};dtmlXMLLoaderObject.prototype.xmlNodeToJSON = function(node){var t={};for (var i=0;i<node.attributes.length;i++)t[node.attributes[i].name]=node.attributes[i].value;t["_tagvalue"]=node.firstChild?node.firstChild.nodeValue:"";for (var i=0;i<node.childNodes.length;i++){var name=node.childNodes[i].tagName;if (name){if (!t[name])t[name]=[];t[name].push(this.xmlNodeToJSON(node.childNodes[i]))}};return t};function callerFunction(funcObject, dhtmlObject){this.handler=function(e){if (!e)e=window.event;funcObject(e, dhtmlObject);return true};return this.handler};function getAbsoluteLeft(htmlObject){return getOffset(htmlObject).left};function getAbsoluteTop(htmlObject){return getOffset(htmlObject).top};function getOffsetSum(elem) {var top=0, left=0;while(elem){top = top + parseInt(elem.offsetTop);left = left + parseInt(elem.offsetLeft);elem = elem.offsetParent};return {top: top, left: left}};function getOffsetRect(elem) {var box = elem.getBoundingClientRect();var body = document.body;var docElem = document.documentElement;var scrollTop = window.pageYOffset || docElem.scrollTop || body.scrollTop;var scrollLeft = window.pageXOffset || docElem.scrollLeft || body.scrollLeft;var clientTop = docElem.clientTop || body.clientTop || 0;var clientLeft = docElem.clientLeft || body.clientLeft || 0;var top = box.top + scrollTop - clientTop;var left = box.left + scrollLeft - clientLeft;return {top: Math.round(top), left: Math.round(left) }};function getOffset(elem) {if (elem.getBoundingClientRect && !_isChrome){return getOffsetRect(elem)}else {return getOffsetSum(elem)}};function convertStringToBoolean(inputString){if (typeof (inputString)== "string")
 inputString=inputString.toLowerCase();switch (inputString){case "1":
 case "true":
 case "yes":
 case "y":
 case 1:
 case true:
 return true;break;default: return false}};function getUrlSymbol(str){if (str.indexOf("?")!= -1)
 return "&"
 else
 return "?"
};function dhtmlDragAndDropObject(){if (window.dhtmlDragAndDrop)return window.dhtmlDragAndDrop;this.lastLanding=0;this.dragNode=0;this.dragStartNode=0;this.dragStartObject=0;this.tempDOMU=null;this.tempDOMM=null;this.waitDrag=0;window.dhtmlDragAndDrop=this;return this};dhtmlDragAndDropObject.prototype.removeDraggableItem=function(htmlNode){htmlNode.onmousedown=null;htmlNode.dragStarter=null;htmlNode.dragLanding=null};dhtmlDragAndDropObject.prototype.addDraggableItem=function(htmlNode, dhtmlObject){htmlNode.onmousedown=this.preCreateDragCopy;htmlNode.dragStarter=dhtmlObject;this.addDragLanding(htmlNode, dhtmlObject)};dhtmlDragAndDropObject.prototype.addDragLanding=function(htmlNode, dhtmlObject){htmlNode.dragLanding=dhtmlObject};dhtmlDragAndDropObject.prototype.preCreateDragCopy=function(e){if ((e||event)&& (e||event).button == 2)
 return;if (window.dhtmlDragAndDrop.waitDrag){window.dhtmlDragAndDrop.waitDrag=0;document.body.onmouseup=window.dhtmlDragAndDrop.tempDOMU;document.body.onmousemove=window.dhtmlDragAndDrop.tempDOMM;return false};window.dhtmlDragAndDrop.waitDrag=1;window.dhtmlDragAndDrop.tempDOMU=document.body.onmouseup;window.dhtmlDragAndDrop.tempDOMM=document.body.onmousemove;window.dhtmlDragAndDrop.dragStartNode=this;window.dhtmlDragAndDrop.dragStartObject=this.dragStarter;document.body.onmouseup=window.dhtmlDragAndDrop.preCreateDragCopy;document.body.onmousemove=window.dhtmlDragAndDrop.callDrag;window.dhtmlDragAndDrop.downtime = new Date().valueOf();if ((e)&&(e.preventDefault)){e.preventDefault();return false};return false};dhtmlDragAndDropObject.prototype.callDrag=function(e){if (!e)e=window.event;dragger=window.dhtmlDragAndDrop;if ((new Date()).valueOf()-dragger.downtime<100) return;if ((e.button == 0)&&(_isIE))
 return dragger.stopDrag();if (!dragger.dragNode&&dragger.waitDrag){dragger.dragNode=dragger.dragStartObject._createDragNode(dragger.dragStartNode, e);if (!dragger.dragNode)return dragger.stopDrag();dragger.dragNode.onselectstart=function(){return false};dragger.gldragNode=dragger.dragNode;document.body.appendChild(dragger.dragNode);document.body.onmouseup=dragger.stopDrag;dragger.waitDrag=0;dragger.dragNode.pWindow=window;dragger.initFrameRoute()};if (dragger.dragNode.parentNode != window.document.body){var grd = dragger.gldragNode;if (dragger.gldragNode.old)grd=dragger.gldragNode.old;grd.parentNode.removeChild(grd);var oldBody = dragger.dragNode.pWindow;if (_isIE){var div = document.createElement("Div");div.innerHTML=dragger.dragNode.outerHTML;dragger.dragNode=div.childNodes[0]}else
 dragger.dragNode=dragger.dragNode.cloneNode(true);dragger.dragNode.pWindow=window;dragger.gldragNode.old=dragger.dragNode;document.body.appendChild(dragger.dragNode);oldBody.dhtmlDragAndDrop.dragNode=dragger.dragNode};dragger.dragNode.style.left=e.clientX+15+(dragger.fx
 ? dragger.fx*(-1)
 : 0)
 +(document.body.scrollLeft||document.documentElement.scrollLeft)+"px";dragger.dragNode.style.top=e.clientY+3+(dragger.fy
 ? dragger.fy*(-1)
 : 0)
 +(document.body.scrollTop||document.documentElement.scrollTop)+"px";if (!e.srcElement)var z = e.target;else
 z=e.srcElement;dragger.checkLanding(z, e)};dhtmlDragAndDropObject.prototype.calculateFramePosition=function(n){if (window.name){var el = parent.frames[window.name].frameElement.offsetParent;var fx = 0;var fy = 0;while (el){fx+=el.offsetLeft;fy+=el.offsetTop;el=el.offsetParent};if ((parent.dhtmlDragAndDrop)){var ls = parent.dhtmlDragAndDrop.calculateFramePosition(1);fx+=ls.split('_')[0]*1;fy+=ls.split('_')[1]*1};if (n)return fx+"_"+fy;else
 this.fx=fx;this.fy=fy};return "0_0"};dhtmlDragAndDropObject.prototype.checkLanding=function(htmlObject, e){if ((htmlObject)&&(htmlObject.dragLanding)){if (this.lastLanding)this.lastLanding.dragLanding._dragOut(this.lastLanding);this.lastLanding=htmlObject;this.lastLanding=this.lastLanding.dragLanding._dragIn(this.lastLanding, this.dragStartNode, e.clientX,
 e.clientY, e);this.lastLanding_scr=(_isIE ? e.srcElement : e.target)}else {if ((htmlObject)&&(htmlObject.tagName != "BODY"))
 this.checkLanding(htmlObject.parentNode, e);else {if (this.lastLanding)this.lastLanding.dragLanding._dragOut(this.lastLanding, e.clientX, e.clientY, e);this.lastLanding=0;if (this._onNotFound)this._onNotFound()}}};dhtmlDragAndDropObject.prototype.stopDrag=function(e, mode){dragger=window.dhtmlDragAndDrop;if (!mode){dragger.stopFrameRoute();var temp = dragger.lastLanding;dragger.lastLanding=null;if (temp)temp.dragLanding._drag(dragger.dragStartNode, dragger.dragStartObject, temp, (_isIE
 ? event.srcElement
 : e.target))};dragger.lastLanding=null;if ((dragger.dragNode)&&(dragger.dragNode.parentNode == document.body))
 dragger.dragNode.parentNode.removeChild(dragger.dragNode);dragger.dragNode=0;dragger.gldragNode=0;dragger.fx=0;dragger.fy=0;dragger.dragStartNode=0;dragger.dragStartObject=0;document.body.onmouseup=dragger.tempDOMU;document.body.onmousemove=dragger.tempDOMM;dragger.tempDOMU=null;dragger.tempDOMM=null;dragger.waitDrag=0};dhtmlDragAndDropObject.prototype.stopFrameRoute=function(win){if (win)window.dhtmlDragAndDrop.stopDrag(1, 1);for (var i = 0;i < window.frames.length;i++){try{if ((window.frames[i] != win)&&(window.frames[i].dhtmlDragAndDrop))
 window.frames[i].dhtmlDragAndDrop.stopFrameRoute(window)}catch(e){}};try{if ((parent.dhtmlDragAndDrop)&&(parent != window)&&(parent != win))
 parent.dhtmlDragAndDrop.stopFrameRoute(window)}catch(e){}};dhtmlDragAndDropObject.prototype.initFrameRoute=function(win, mode){if (win){window.dhtmlDragAndDrop.preCreateDragCopy();window.dhtmlDragAndDrop.dragStartNode=win.dhtmlDragAndDrop.dragStartNode;window.dhtmlDragAndDrop.dragStartObject=win.dhtmlDragAndDrop.dragStartObject;window.dhtmlDragAndDrop.dragNode=win.dhtmlDragAndDrop.dragNode;window.dhtmlDragAndDrop.gldragNode=win.dhtmlDragAndDrop.dragNode;window.document.body.onmouseup=window.dhtmlDragAndDrop.stopDrag;window.waitDrag=0;if (((!_isIE)&&(mode))&&((!_isFF)||(_FFrv < 1.8)))
 window.dhtmlDragAndDrop.calculateFramePosition()};try{if ((parent.dhtmlDragAndDrop)&&(parent != window)&&(parent != win))
 parent.dhtmlDragAndDrop.initFrameRoute(window)}catch(e){};for (var i = 0;i < window.frames.length;i++){try{if ((window.frames[i] != win)&&(window.frames[i].dhtmlDragAndDrop))
 window.frames[i].dhtmlDragAndDrop.initFrameRoute(window, ((!win||mode) ? 1 : 0))}catch(e){}}};var _isFF = false;var _isIE = false;var _isOpera = false;var _isKHTML = false;var _isMacOS = false;var _isChrome = false;if (navigator.userAgent.indexOf('Macintosh')!= -1)
 _isMacOS=true;if (navigator.userAgent.toLowerCase().indexOf('chrome')>-1)
 _isChrome=true;if ((navigator.userAgent.indexOf('Safari')!= -1)||(navigator.userAgent.indexOf('Konqueror') != -1)){var _KHTMLrv = parseFloat(navigator.userAgent.substr(navigator.userAgent.indexOf('Safari')+7, 5));if (_KHTMLrv > 525){_isFF=true;var _FFrv = 1.9}else
 _isKHTML=true}else if (navigator.userAgent.indexOf('Opera')!= -1){_isOpera=true;_OperaRv=parseFloat(navigator.userAgent.substr(navigator.userAgent.indexOf('Opera')+6, 3))}else if (navigator.appName.indexOf("Microsoft")!= -1){_isIE=true;if (navigator.appVersion.indexOf("MSIE 8.0")!= -1 && document.compatMode != "BackCompat") _isIE=8}else {_isFF=true;var _FFrv = parseFloat(navigator.userAgent.split("rv:")[1])
};dtmlXMLLoaderObject.prototype.doXPath=function(xpathExp, docObj, namespace, result_type){if (_isKHTML || (!_isIE && !window.XPathResult))
 return this.doXPathOpera(xpathExp, docObj);if (_isIE){if (!docObj)if (!this.xmlDoc.nodeName)docObj=this.xmlDoc.responseXML
 else
 docObj=this.xmlDoc;if (!docObj)dhtmlxError.throwError("LoadXML", "Incorrect XML", [
 (docObj||this.xmlDoc),
 this.mainObject
 ]);if (namespace != null)docObj.setProperty("SelectionNamespaces", "xmlns:xsl='"+namespace+"'");if (result_type == 'single'){return docObj.selectSingleNode(xpathExp)}else {return docObj.selectNodes(xpathExp)||new Array(0)}}else {var nodeObj = docObj;if (!docObj){if (!this.xmlDoc.nodeName){docObj=this.xmlDoc.responseXML
 }else {docObj=this.xmlDoc}};if (!docObj)dhtmlxError.throwError("LoadXML", "Incorrect XML", [
 (docObj||this.xmlDoc),
 this.mainObject
 ]);if (docObj.nodeName.indexOf("document")!= -1){nodeObj=docObj}else {nodeObj=docObj;docObj=docObj.ownerDocument};var retType = XPathResult.ANY_TYPE;if (result_type == 'single')retType=XPathResult.FIRST_ORDERED_NODE_TYPE
 var rowsCol = new Array();var col = docObj.evaluate(xpathExp, nodeObj, function(pref){return namespace
 }, retType, null);if (retType == XPathResult.FIRST_ORDERED_NODE_TYPE){return col.singleNodeValue};var thisColMemb = col.iterateNext();while (thisColMemb){rowsCol[rowsCol.length]=thisColMemb;thisColMemb=col.iterateNext()};return rowsCol}};function _dhtmlxError(type, name, params){if (!this.catches)this.catches=new Array();return this};_dhtmlxError.prototype.catchError=function(type, func_name){this.catches[type]=func_name};_dhtmlxError.prototype.throwError=function(type, name, params){if (this.catches[type])return this.catches[type](type, name, params);if (this.catches["ALL"])return this.catches["ALL"](type, name, params);alert("Error type: "+arguments[0]+"\nDescription: "+arguments[1]);return null};window.dhtmlxError=new _dhtmlxError();dtmlXMLLoaderObject.prototype.doXPathOpera=function(xpathExp, docObj){var z = xpathExp.replace(/[\/]+/gi, "/").split('/');var obj = null;var i = 1;if (!z.length)return [];if (z[0] == ".")obj=[docObj];else if (z[0] == ""){obj=(this.xmlDoc.responseXML||this.xmlDoc).getElementsByTagName(z[i].replace(/\[[^\]]*\]/g, ""));i++}else
 return [];for (i;i < z.length;i++)obj=this._getAllNamedChilds(obj, z[i]);if (z[i-1].indexOf("[")!= -1)
 obj=this._filterXPath(obj, z[i-1]);return obj};dtmlXMLLoaderObject.prototype._filterXPath=function(a, b){var c = new Array();var b = b.replace(/[^\[]*\[\@/g, "").replace(/[\[\]\@]*/g, "");for (var i = 0;i < a.length;i++)if (a[i].getAttribute(b))
 c[c.length]=a[i];return c};dtmlXMLLoaderObject.prototype._getAllNamedChilds=function(a, b){var c = new Array();if (_isKHTML)b=b.toUpperCase();for (var i = 0;i < a.length;i++)for (var j = 0;j < a[i].childNodes.length;j++){if (_isKHTML){if (a[i].childNodes[j].tagName&&a[i].childNodes[j].tagName.toUpperCase()== b)
 c[c.length]=a[i].childNodes[j]}else if (a[i].childNodes[j].tagName == b)c[c.length]=a[i].childNodes[j]};return c};function dhtmlXHeir(a, b){for (var c in b)if (typeof (b[c])== "function")
 a[c]=b[c];return a};function dhtmlxEvent(el, event, handler){if (el.addEventListener)el.addEventListener(event, handler, false);else if (el.attachEvent)el.attachEvent("on"+event, handler)};dtmlXMLLoaderObject.prototype.xslDoc=null;dtmlXMLLoaderObject.prototype.setXSLParamValue=function(paramName, paramValue, xslDoc){if (!xslDoc)xslDoc=this.xslDoc

 if (xslDoc.responseXML)xslDoc=xslDoc.responseXML;var item =
 this.doXPath("/xsl:stylesheet/xsl:variable[@name='"+paramName+"']", xslDoc,
 "http:/\/www.w3.org/1999/XSL/Transform", "single");if (item != null)item.firstChild.nodeValue=paramValue
};dtmlXMLLoaderObject.prototype.doXSLTransToObject=function(xslDoc, xmlDoc){if (!xslDoc)xslDoc=this.xslDoc;if (xslDoc.responseXML)xslDoc=xslDoc.responseXML

 if (!xmlDoc)xmlDoc=this.xmlDoc;if (xmlDoc.responseXML)xmlDoc=xmlDoc.responseXML

 
 if (!_isIE){if (!this.XSLProcessor){this.XSLProcessor=new XSLTProcessor();this.XSLProcessor.importStylesheet(xslDoc)};var result = this.XSLProcessor.transformToDocument(xmlDoc)}else {var result = new ActiveXObject("Msxml2.DOMDocument.3.0");try{xmlDoc.transformNodeToObject(xslDoc, result)}catch(e){result = xmlDoc.transformNode(xslDoc)}};return result};dtmlXMLLoaderObject.prototype.doXSLTransToString=function(xslDoc, xmlDoc){var res = this.doXSLTransToObject(xslDoc, xmlDoc);if(typeof(res)=="string")
 return res;return this.doSerialization(res)};dtmlXMLLoaderObject.prototype.doSerialization=function(xmlDoc){if (!xmlDoc)xmlDoc=this.xmlDoc;if (xmlDoc.responseXML)xmlDoc=xmlDoc.responseXML
 if (!_isIE){var xmlSerializer = new XMLSerializer();return xmlSerializer.serializeToString(xmlDoc)}else
 return xmlDoc.xml};dhtmlxEventable=function(obj){obj.dhx_SeverCatcherPath="";obj.attachEvent=function(name, catcher, callObj){name='ev_'+name.toLowerCase();if (!this[name])this[name]=new this.eventCatcher(callObj||this);return(name+':'+this[name].addEvent(catcher))};obj.callEvent=function(name, arg0){name='ev_'+name.toLowerCase();if (this[name])return this[name].apply(this, arg0);return true};obj.checkEvent=function(name){return (!!this['ev_'+name.toLowerCase()])
 };obj.eventCatcher=function(obj){var dhx_catch = [];var z = function(){var res = true;for (var i = 0;i < dhx_catch.length;i++){if (dhx_catch[i] != null){var zr = dhx_catch[i].apply(obj, arguments);res=res&&zr}};return res};z.addEvent=function(ev){if (typeof (ev)!= "function")
 ev=eval(ev);if (ev)return dhx_catch.push(ev)-1;return false};z.removeEvent=function(id){dhx_catch[id]=null};return z};obj.detachEvent=function(id){if (id != false){var list = id.split(':');this[list[0]].removeEvent(list[1])}}};
//v.2.5 build 91111

/*
Copyright DHTMLX LTD. http://www.dhtmlx.com
You allowed to use this component or parts of it under GPL terms
To use it on other terms or get Professional edition of the component please contact us at sales@dhtmlx.com
*/
//v.2.5 build 91111

/*
Copyright DHTMLX LTD. http://www.dhtmlx.com
You allowed to use this component or parts of it under GPL terms
To use it on other terms or get Professional edition of the component please contact us at sales@dhtmlx.com
*/





function dhtmlXComboFromSelect(parent,size){if (typeof(parent)=="string")
 parent=document.getElementById(parent);size=size||parent.getAttribute("width")||(window.getComputedStyle?window.getComputedStyle(parent,null)["width"]:(parent.currentStyle?parent.currentStyle["width"]:0));if ((!size)||(size=="auto"))
 size=parent.offsetWidth||100;var z=document.createElement("SPAN");if(parent.style.direction=="rtl")z.style.direction = "rtl";parent.parentNode.insertBefore(z,parent);parent.style.display='none';var s_type = parent.getAttribute('opt_type');var w= new dhtmlXCombo(z,parent.name,size,s_type,parent.tabIndex);var x=new Array();var sel=0;for (var i=0;i<parent.options.length;i++){if (parent.options[i].selected)sel=i;var label=parent.options[i].innerHTML;var val=parent.options[i].getAttribute("value");if ((typeof(val)=="undefined")||(val===null)) val=label;x[i]={value:val,text:label,img_src:parent.options[i].getAttribute("img_src")}};w.addOption(x);parent.parentNode.removeChild(parent);w.selectOption(sel,null,true);if (parent.onchange)w.attachEvent("onChange",parent.onchange);return w};var dhtmlXCombo_optionTypes = [];function dhtmlXCombo(parent,name,width,optionType,tabIndex){if (typeof(parent)=="string")
 parent=document.getElementById(parent);this.dhx_Event();this.optionType = (optionType != window.undefined && dhtmlXCombo_optionTypes[optionType]) ? optionType : 'default';this._optionObject = dhtmlXCombo_optionTypes[this.optionType];this._disabled = false;if(parent.style.direction == "rtl")this.rtl = true;else this.rtl = false;if (!window.dhx_glbSelectAr){window.dhx_glbSelectAr=new Array();window.dhx_openedSelect=null;window.dhx_SelectId=1;dhtmlxEvent(document.body,"click",this.closeAll);dhtmlxEvent(document.body,"keydown",function(e){try {if ((e||event).keyCode==9) window.dhx_glbSelectAr[0].closeAll()}catch(e) {};return true})};if (parent.tagName=="SELECT")return dhtmlXComboFromSelect(parent);else
 this._createSelf(parent,name,width,tabIndex);dhx_glbSelectAr.push(this)};dhtmlXCombo.prototype.setSize = function(new_size){this.DOMlist.style.width=new_size+"px";if (this.DOMlistF)this.DOMlistF.style.width=new_size+"px";this.DOMelem.style.width=new_size+"px";this.DOMelem_input.style.width = Math.max(0,(new_size-19))+'px'};dhtmlXCombo.prototype.enableFilteringMode = function(mode,url,cache,autosubload){this._filter=convertStringToBoolean(mode);if (url){this._xml=url;this._autoxml=convertStringToBoolean(autosubload)};if (convertStringToBoolean(cache)) this._xmlCache=[]};dhtmlXCombo.prototype.setFilteringParam=function(name,value){if (!this._prs)this._prs=[];this._prs.push([name,value])};dhtmlXCombo.prototype.disable = function(mode){var z=convertStringToBoolean(mode);if (this._disabled==z)return;this.DOMelem_input.disabled=z;this._disabled=z};dhtmlXCombo.prototype.readonly = function(mode,autosearch){this.DOMelem_input.readOnly=mode ? true : false;if(autosearch===false || mode===false){this.DOMelem.onkeyup=function(ev){}}else {var that = this;this.DOMelem.onkeyup=function(ev){ev=ev||window.event;if (ev.keyCode!=9)ev.cancelBubble=true;if((ev.keyCode >= 48 && ev.keyCode <= 57)||(ev.keyCode >= 65 && ev.keyCode <= 90)){for(var i=0;i<that.optionsArr.length;i++){var text = that.optionsArr[i].text;if(text.toString().toUpperCase().indexOf(String.fromCharCode(ev.keyCode)) == 0){that.selectOption(i);break}};ev.cancelBubble=true}}}};dhtmlXCombo.prototype.getOption = function(value)
 {for(var i=0;i<this.optionsArr.length;i++)if(this.optionsArr[i].value==value)return this.optionsArr[i];return null};dhtmlXCombo.prototype.getOptionByLabel = function(value)
 {for(var i=0;i<this.optionsArr.length;i++)if(this.optionsArr[i].text==value || this.optionsArr[i]._ctext==value)return this.optionsArr[i];return null};dhtmlXCombo.prototype.getOptionByIndex = function(ind){return this.optionsArr[ind]};dhtmlXCombo.prototype.clearAll = function(all)
 {if (all)this.setComboText("");this.optionsArr=new Array();this.redrawOptions();if (all)this._confirmSelection()};dhtmlXCombo.prototype.deleteOption = function(value)
 {var ind=this.getIndexByValue(value);if(ind<0)return;if (this.optionsArr[ind]==this._selOption)this._selOption=null;this.optionsArr.splice(ind, 1);this.redrawOptions()};dhtmlXCombo.prototype.render=function(mode){this._skiprender=(!convertStringToBoolean(mode));this.redrawOptions()};dhtmlXCombo.prototype.updateOption = function(oldvalue, avalue, atext, acss)
 {var dOpt=this.getOption(oldvalue);if (typeof(avalue)!="object") avalue={text:atext,value:avalue,css:acss};dOpt.setValue(avalue);this.redrawOptions()};dhtmlXCombo.prototype.addOption = function(options)
 {if (!arguments[0].length || typeof(arguments[0])!="object")
 args = [arguments];else
 args = options;this.render(false);for (var i=0;i<args.length;i++){var attr = args[i];if (attr.length){attr.value = attr[0]||"";attr.text = attr[1]||"";attr.css = attr[2]||""};this._addOption(attr)};this.render(true)};dhtmlXCombo.prototype._addOption = function(attr)
 {dOpt = new this._optionObject();this.optionsArr.push(dOpt);dOpt.setValue.apply(dOpt,[attr]);this.redrawOptions()};dhtmlXCombo.prototype.getIndexByValue = function(val){for(var i=0;i<this.optionsArr.length;i++)if(this.optionsArr[i].value == val)return i;return -1};dhtmlXCombo.prototype.getSelectedValue = function(){return (this._selOption?this._selOption.value:null)};dhtmlXCombo.prototype.getComboText = function(){return this.DOMelem_input.value};dhtmlXCombo.prototype.setComboText = function(text){this.DOMelem_input.value=text};dhtmlXCombo.prototype.setComboValue = function(text){this.setComboText(text);for(var i=0;i<this.optionsArr.length;i++)if (this.optionsArr[i].data()[0]==text)
 return this.selectOption(i,null,true);this.DOMelem_hidden_input.value=text};dhtmlXCombo.prototype.getActualValue = function(){return this.DOMelem_hidden_input.value};dhtmlXCombo.prototype.getSelectedText = function(){return (this._selOption?this._selOption.text:"")};dhtmlXCombo.prototype.getSelectedIndex = function(){for(var i=0;i<this.optionsArr.length;i++)if(this.optionsArr[i] == this._selOption)return i;return -1};dhtmlXCombo.prototype.setName = function(name){this.DOMelem_hidden_input.name = name;this.DOMelem_hidden_input2 = name.replace(/(\]?)$/, "_new_value$1");this.name = name};dhtmlXCombo.prototype.show = function(mode){if (convertStringToBoolean(mode))
 this.DOMelem.style.display = "";else
 this.DOMelem.style.display = "none"};dhtmlXCombo.prototype.destructor = function()
 {var _sID = this._inID;this.DOMParent.removeChild(this.DOMelem);this.DOMlist.parentNode.removeChild(this.DOMlist);var s=dhx_glbSelectAr;this.DOMParent=this.DOMlist=this.DOMelem=0;this.DOMlist.combo=this.DOMelem.combo=0;for(var i=0;i<s.length;i++){if(s[i]._inID == _sID){s[i] = null;s.splice(i,1);return}}};dhtmlXCombo.prototype._createSelf = function(selParent, name, width, tab)
 {if (width.toString().indexOf("%")!=-1){var self = this;var resWidht=parseInt(width)/100;window.setInterval(function(){if (!selParent.parentNode)return;var ts=selParent.parentNode.offsetWidth*resWidht-2;if (ts<0)return;if (ts==self._lastTs)return;self.setSize(self._lastTs=ts)},500);var width=parseInt(selParent.offsetWidth)};var width=parseInt(width||100);this.ListPosition = "Bottom";this.DOMParent = selParent;this._inID = null;this.name = name;this._selOption = null;this.optionsArr = Array();var opt = new this._optionObject();opt.DrawHeader(this,name, width,tab);this.DOMlist = document.createElement("DIV");this.DOMlist.className = 'dhx_combo_list'+(this.rtl?"_rtl":"")+' '+(dhtmlx.skin?dhtmlx.skin+"_list":"");this.DOMlist.style.width=width-(_isIE?0:0)+"px";if (_isOpera || _isKHTML )this.DOMlist.style.overflow="auto";this.DOMlist.style.display = "none";document.body.insertBefore(this.DOMlist,document.body.firstChild);if (_isIE){this.DOMlistF = document.createElement("IFRAME");this.DOMlistF.style.border="0px";this.DOMlistF.className = 'dhx_combo_list';this.DOMlistF.style.width=width-(_isIE?0:0)+"px";this.DOMlistF.style.display = "none";this.DOMlistF.src="javascript:false;";document.body.insertBefore(this.DOMlistF,document.body.firstChild)};this.DOMlist.combo=this.DOMelem.combo=this;this.DOMelem_input.onkeydown = this._onKey;this.DOMelem_input.onkeypress = this._onKeyF;this.DOMelem_input.onblur = this._onBlur;this.DOMelem.onclick = this._toggleSelect;this.DOMlist.onclick = this._selectOption;this.DOMlist.onmousedown = function(){this._skipBlur=true};this.DOMlist.onkeydown = function(e){this.combo.DOMelem_input.focus();(e||event).cancelBubble=true;this.combo.DOMelem_input.onkeydown(e)
 };this.DOMlist.onmouseover = this._listOver};dhtmlXCombo.prototype._listOver = function(e)
 {e = e||event;e.cancelBubble = true;var node = (_isIE?event.srcElement:e.target);var that = this.combo;if ( node.parentNode == that.DOMlist ){if(that._selOption)that._selOption.deselect();if(that._tempSel)that._tempSel.deselect();var i=0;for (i;i<that.DOMlist.childNodes.length;i++){if (that.DOMlist.childNodes[i]==node)break};var z=that.optionsArr[i];that._tempSel=z;that._tempSel.select();if ((that._autoxml)&&((i+1)==that._lastLength)){that._fetchOptions(i+1,that._lasttext||"")}}};dhtmlXCombo.prototype._positList = function()
 {var pos=this.getPosition(this.DOMelem);if(this.ListPosition == 'Bottom'){this.DOMlist.style.top = pos[1]+22+"px";this.DOMlist.style.left = pos[0]+"px"}else if(this.ListPosition == 'Top'){this.DOMlist.style.top = pos[1] - this.DOMlist.offsetHeight+"px";this.DOMlist.style.left = pos[0]+"px"}else{this.DOMlist.style.top = pos[1]+"px";this.DOMlist.style.left = pos[0]+this.DOMelem.offsetWidth+"px"}};dhtmlXCombo.prototype.getPosition = function(oNode,pNode){if (_isChrome){if(!pNode)var pNode = document.body
 
 var oCurrentNode=oNode;var iLeft=0;var iTop=0;while ((oCurrentNode)&&(oCurrentNode!=pNode)){iLeft+=oCurrentNode.offsetLeft-oCurrentNode.scrollLeft;iTop+=oCurrentNode.offsetTop-oCurrentNode.scrollTop;oCurrentNode=oCurrentNode.offsetParent};if (pNode == document.body ){if (_isIE && _isIE<8){if (document.documentElement.scrollTop)iTop+=document.documentElement.scrollTop;if (document.documentElement.scrollLeft)iLeft+=document.documentElement.scrollLeft}else
 if (!_isFF){iLeft+=document.body.offsetLeft;iTop+=document.body.offsetTop}};return new Array(iLeft,iTop)};var pos = getOffset(oNode);return [pos.left, pos.top]};dhtmlXCombo.prototype._correctSelection = function(){if (this.getComboText()!="")
 for (var i=0;i<this.optionsArr.length;i++)if (!this.optionsArr[i].isHidden()){return this.selectOption(i,true,false)};this.unSelectOption()};dhtmlXCombo.prototype.selectNext = function(step){var z=this.getSelectedIndex()+step;while (this.optionsArr[z]){if (!this.optionsArr[z].isHidden())
 return this.selectOption(z,false,false);z+=step}};dhtmlXCombo.prototype._onKeyF = function(e){var that=this.parentNode.combo;var ev=e||event;ev.cancelBubble=true;if (ev.keyCode=="13" || ev.keyCode=="9" ){that._confirmSelection();that.closeAll()}else
 if (ev.keyCode=="27" ){that._resetSelection();that.closeAll()}else that._activeMode=true;if (ev.keyCode=="13" || ev.keyCode=="27" ){that.callEvent("onKeyPressed",[ev.keyCode])
 return false};return true};dhtmlXCombo.prototype._onKey = function(e){var that=this.parentNode.combo;(e||event).cancelBubble=true;var ev=(e||event).keyCode;if (ev>15 && ev<19)return true;if (ev==27)return;if ((that.DOMlist.style.display!="block")&&(ev!="13")&&(ev!="9")&&((!that._filter)||(that._filterAny)))
 that.DOMelem.onclick(e||event);if ((ev!="13")&&(ev!="9")){window.setTimeout(function(){that._onKeyB(ev)},1);if (ev=="40" || ev=="38")return false}else if (ev==9){that.closeAll();(e||event).cancelBubble=false}};dhtmlXCombo.prototype._onKeyB = function(ev)
 {if (ev=="40"){var z=this.selectNext(1)}else if (ev=="38"){this.selectNext(-1)}else{this.callEvent("onKeyPressed",[ev])
 if (this._filter)return this.filterSelf((ev==8)||(ev==46));for(var i=0;i<this.optionsArr.length;i++)if (this.optionsArr[i].data()[1]==this.DOMelem_input.value){this.selectOption(i,false,false);return false};this.unSelectOption()};return true};dhtmlXCombo.prototype._onBlur = function()
 {var self = this.parentNode._self;window.setTimeout(function(){if (self.DOMlist._skipBlur)return !(self.DOMlist._skipBlur=false);self._confirmSelection();self.callEvent("onBlur",[])},100)
 
 };dhtmlXCombo.prototype.redrawOptions = function(){if (this._skiprender)return;for(var i=this.DOMlist.childNodes.length-1;i>=0;i--)this.DOMlist.removeChild(this.DOMlist.childNodes[i]);for(var i=0;i<this.optionsArr.length;i++)this.DOMlist.appendChild(this.optionsArr[i].render())};dhtmlXCombo.prototype.loadXML = function(url,afterCall){this._load=true;this.callEvent("onXLS",[]);if (this._prs)for (var i=0;i<this._prs.length;i++)url+=[getUrlSymbol(url),escape(this._prs[i][0]),"=",escape(this._prs[i][1])].join("");if ((this._xmlCache)&&(this._xmlCache[url])){this._fillFromXML(this,null,null,null,this._xmlCache[url]);if (afterCall)afterCall()}else{var xml=(new dtmlXMLLoaderObject(this._fillFromXML,this,true,true));if (afterCall)xml.waitCall=afterCall;xml._cPath=url;xml.loadXML(url)}};dhtmlXCombo.prototype.loadXMLString = function(astring){var xml=(new dtmlXMLLoaderObject(this._fillFromXML,this,true,true));xml.loadXMLString(astring)};dhtmlXCombo.prototype._fillFromXML = function(obj,b,c,d,xml){if (obj._xmlCache)obj._xmlCache[xml._cPath]=xml;var toptag=xml.getXMLTopNode("complete");if (toptag.tagName!="complete")return;var top=xml.doXPath("//complete");var options=xml.doXPath("//option");var add = false;obj.render(false);if ((!top[0])||(!top[0].getAttribute("add"))){obj.clearAll();obj._lastLength=options.length;if (obj._xml){if ((!options)|| (!options.length)) 
 obj.closeAll();else {if (obj._activeMode){obj._positList();obj.DOMlist.style.display="block";if (_isIE)obj._IEFix(true)}}}}else {obj._lastLength+=options.length;add = true};for (var i=0;i<options.length;i++){var attr = new Object();attr.text = options[i].firstChild?options[i].firstChild.nodeValue:"";for (var j=0;j<options[i].attributes.length;j++){var a = options[i].attributes[j];if (a)attr[a.nodeName] = a.nodeValue};obj._addOption(attr)};obj.render(add!=true || (!!options.length));if ((obj._load)&&(obj._load!==true))
 obj.loadXML(obj._load);else{obj._load=false;if ((!obj._lkmode)&&(!obj._filter))
 obj._correctSelection()};var selected=xml.doXPath("//option[@selected]");if (selected.length)obj.selectOption(obj.getIndexByValue(selected[0].getAttribute("value")),false,true);obj.callEvent("onXLE",[])};dhtmlXCombo.prototype.unSelectOption = function(){if (this._selOption)this._selOption.deselect();if(this._tempSel)this._tempSel.deselect();this._tempSel=this._selOption=null};dhtmlXCombo.prototype._confirmSelection = function(data,status){if(arguments.length==0){var z=this.getOptionByLabel(this.DOMelem_input.value);data = z?z.value:this.DOMelem_input.value;status = (z==null);if (data==this.getActualValue()) return};this.DOMelem_hidden_input.value=data;this.DOMelem_hidden_input2.value = (status?"true":"false");this.callEvent("onChange",[]);this._activeMode=false};dhtmlXCombo.prototype._resetSelection = function(data,status){var z=this.getOption(this.DOMelem_hidden_input.value);this.setComboValue(z?z.data()[0]:this.DOMelem_hidden_input.value)
 this.setComboText(z?z.data()[1]:this.DOMelem_hidden_input.value)
 };dhtmlXCombo.prototype.selectOption = function(ind,filter,conf){if (arguments.length<3)conf=true;this.unSelectOption();var z=this.optionsArr[ind];if (!z)return;this._selOption=z;this._selOption.select();var corr=this._selOption.content.offsetTop+this._selOption.content.offsetHeight-this.DOMlist.scrollTop-this.DOMlist.offsetHeight;if (corr>0)this.DOMlist.scrollTop+=corr;corr=this.DOMlist.scrollTop-this._selOption.content.offsetTop;if (corr>0)this.DOMlist.scrollTop-=corr;var data=this._selOption.data();if (conf){this.setComboText(data[1]);this._confirmSelection(data[0],false)};if ((this._autoxml)&&((ind+1)==this._lastLength))
 this._fetchOptions(ind+1,this._lasttext||"");if (filter){var text=this.getComboText();if (text!=data[1]){this.setComboText(data[1]);dhtmlXRange(this.DOMelem_input,text.length+1,data[1].length)}}else
 this.setComboText(data[1]);this._selOption.RedrawHeader(this);this.callEvent("onSelectionChange",[])};dhtmlXCombo.prototype._selectOption = function(e)
 {(e||event).cancelBubble = true;var node=(_isIE?event.srcElement:e.target);var that=this.combo;while (!node._self){node = node.parentNode;if (!node)return};var i=0;for (i;i<that.DOMlist.childNodes.length;i++){if (that.DOMlist.childNodes[i]==node)break};that.selectOption(i,false,true);that.closeAll();that.callEvent("onBlur",[])
 that._activeMode=false};dhtmlXCombo.prototype.openSelect = function(){if (this._disabled)return;this.closeAll();this._positList();this.DOMlist.style.display="block";this.callEvent("onOpen",[]);if(this._tempSel)this._tempSel.deselect();if(this._selOption)this._selOption.select();if(this._selOption){var corr=this._selOption.content.offsetTop+this._selOption.content.offsetHeight-this.DOMlist.scrollTop-this.DOMlist.offsetHeight;if (corr>0)this.DOMlist.scrollTop+=corr;corr=this.DOMlist.scrollTop-this._selOption.content.offsetTop;if (corr>0)this.DOMlist.scrollTop-=corr};if (_isIE)this._IEFix(true);this.DOMelem_input.focus();if (this._filter)this.filterSelf()};dhtmlXCombo.prototype._toggleSelect = function(e)
 {var that=this.combo;if ( that.DOMlist.style.display == "block" ){that.closeAll()}else {that.openSelect()};(e||event).cancelBubble = true};dhtmlXCombo.prototype._fetchOptions=function(ind,text){if (text==""){this.closeAll();return this.clearAll()};var url=this._xml+((this._xml.indexOf("?")!=-1)?"&":"?")+"pos="+ind+"&mask="+encodeURIComponent(text);this._lasttext=text;if (this._load)this._load=url;else {if (!this.callEvent("onDynXLS",[text,ind])) return;this.loadXML(url)}};dhtmlXCombo.prototype.filterSelf = function(mode)
 {var text=this.getComboText();if (this._xml){this._lkmode=mode;return this._fetchOptions(0,text)};try{var filter=new RegExp("^"+text,"i")}catch (e){var filter=new RegExp("^"+text.replace(/([\[\]\{\}\(\)\+\*\\])/g,"\\$1"))};this.filterAny=false;for(var i=0;i<this.optionsArr.length;i++){var z=filter.test(this.optionsArr[i].text);this.filterAny|=z;this.optionsArr[i].hide(!z)};if (!this.filterAny){this.closeAll();this._activeMode=true}else {if (this.DOMlist.style.display!="block")this.openSelect();if (_isIE)this._IEFix(true)};if (!mode)this._correctSelection();else this.unSelectOption()};dhtmlXCombo.prototype._IEFix = function(mode){this.DOMlistF.style.display=(mode?"block":"none");this.DOMlistF.style.top=this.DOMlist.style.top;this.DOMlistF.style.left=this.DOMlist.style.left};dhtmlXCombo.prototype.closeAll = function()
 {if(window.dhx_glbSelectAr)for (var i=0;i<dhx_glbSelectAr.length;i++){if (dhx_glbSelectAr[i].DOMlist.style.display=="block"){dhx_glbSelectAr[i].DOMlist.style.display = "none";if (_isIE)dhx_glbSelectAr[i]._IEFix(false)};dhx_glbSelectAr[i]._activeMode=false}};function dhtmlXRange(InputId, Start, End)
{var Input = typeof(InputId)=='object' ? InputId : document.getElementById(InputId);try{Input.focus()}catch(e){};var Length = Input.value.length;Start--;if (Start < 0 || Start > End || Start > Length)Start = 0;if (End > Length)End = Length;if (Start==End)return;if (Input.setSelectionRange){Input.setSelectionRange(Start, End)}else if (Input.createTextRange){var range = Input.createTextRange();range.moveStart('character', Start);range.moveEnd('character', End-Length);range.select()}};dhtmlXCombo_defaultOption = function(){this.init()};dhtmlXCombo_defaultOption.prototype.init = function(){this.value = null;this.text = "";this.selected = false;this.css = ""};dhtmlXCombo_defaultOption.prototype.select = function(){if (this.content){this.content.className="dhx_selected_option"+(dhtmlx.skin?" combo_"+dhtmlx.skin+"_sel":"")}};dhtmlXCombo_defaultOption.prototype.hide = function(mode){this.render().style.display=mode?"none":""};dhtmlXCombo_defaultOption.prototype.isHidden = function(){return (this.render().style.display=="none")};dhtmlXCombo_defaultOption.prototype.deselect = function(){if (this.content)this.render();this.content.className=""};dhtmlXCombo_defaultOption.prototype.setValue = function(attr){this.value = attr.value||"";this.text = attr.text||"";this.css = attr.css||"";this.content=null};dhtmlXCombo_defaultOption.prototype.render = function(){if (!this.content){this.content=document.createElement("DIV");this.content._self = this;this.content.style.cssText='width:100%;overflow:hidden;'+this.css;if (_isOpera || _isKHTML )this.content.style.padding="2px 0px 2px 0px";this.content.innerHTML=this.text;this._ctext=_isIE?this.content.innerText:this.content.textContent};return this.content};dhtmlXCombo_defaultOption.prototype.data = function(){if (this.content)return [this.value,this._ctext ? this._ctext : this.text]};dhtmlXCombo_defaultOption.prototype.DrawHeader = function(self, name, width, tab)
{var z=document.createElement("DIV");z.style.width = width+"px";z.className = 'dhx_combo_box '+(dhtmlx.skin||"");z._self = self;self.DOMelem = z;this._DrawHeaderInput(self, name, width,tab);this._DrawHeaderButton(self, name, width);self.DOMParent.appendChild(self.DOMelem)};dhtmlXCombo_defaultOption.prototype._DrawHeaderInput = function(self, name, width,tab)
{if(self.rtl && _isIE){var z=document.createElement('textarea');z.style.overflow = "hidden";z.style.whiteSpace="nowrap"
 }else {var z=document.createElement('input');z.setAttribute("autocomplete","off");z.type = 'text'};z.className = 'dhx_combo_input';if(self.rtl){z.style.left = "18px";z.style.direction = "rtl";z.style.unicodeBidi = "bidi-override"};if (tab)z.tabIndex=tab;z.style.width = (width-19)+'px';self.DOMelem.appendChild(z);self.DOMelem_input = z;z = document.createElement('input');z.type = 'hidden';z.name = name;self.DOMelem.appendChild(z);self.DOMelem_hidden_input = z;z = document.createElement('input');z.type = 'hidden';z.name = (name||"").replace(/(\]?)$/, "_new_value$1");z.value="true";self.DOMelem.appendChild(z);self.DOMelem_hidden_input2 = z};dhtmlXCombo_defaultOption.prototype._DrawHeaderButton = function(self, name, width)
{var z=document.createElement('img');z.className = (self.rtl)?'dhx_combo_img_rtl':'dhx_combo_img';if(dhtmlx.image_path)dhx_globalImgPath = dhtmlx.image_path;z.src = (window.dhx_globalImgPath?dhx_globalImgPath:"")+'combo_select'+(dhtmlx.skin?"_"+dhtmlx.skin:"")+'.gif';self.DOMelem.appendChild(z);self.DOMelem_button=z};dhtmlXCombo_defaultOption.prototype.RedrawHeader = function(self)
{};dhtmlXCombo_optionTypes['default'] = dhtmlXCombo_defaultOption;dhtmlXCombo.prototype.dhx_Event=function()
{this.dhx_SeverCatcherPath="";this.attachEvent = function(original, catcher, CallObj)
 {CallObj = CallObj||this;original = 'ev_'+original;if ( ( !this[original] )|| ( !this[original].addEvent ) ) {var z = new this.eventCatcher(CallObj);z.addEvent( this[original] );this[original] = z};return ( original + ':' + this[original].addEvent(catcher) )};this.callEvent=function(name,arg0){if (this["ev_"+name])return this["ev_"+name].apply(this,arg0);return true};this.checkEvent=function(name){if (this["ev_"+name])return true;return false};this.eventCatcher = function(obj)
 {var dhx_catch = new Array();var m_obj = obj;var func_server = function(catcher,rpc)
 {catcher = catcher.split(":");var postVar="";var postVar2="";var target=catcher[1];if (catcher[1]=="rpc"){postVar='<?xml version="1.0"?><methodCall><methodName>'+catcher[2]+'</methodName><params>';postVar2="</params></methodCall>";target=rpc};var z = function() {};return z};var z = function()
 {if (dhx_catch)var res=true;for (var i=0;i<dhx_catch.length;i++){if (dhx_catch[i] != null){var zr = dhx_catch[i].apply( m_obj, arguments );res = res && zr}};return res};z.addEvent = function(ev)
 {if ( typeof(ev)!= "function" )
 if (ev && ev.indexOf && ev.indexOf("server:")== 0)
 ev = new func_server(ev,m_obj.rpcServer);else
 ev = eval(ev);if (ev)return dhx_catch.push( ev ) - 1;return false};z.removeEvent = function(id)
 {dhx_catch[id] = null};return z};this.detachEvent = function(id)
 {if (id != false){var list = id.split(':');this[ list[0] ].removeEvent( list[1] )}}};(function(){dhtmlx.extend_api("dhtmlXCombo",{_init:function(obj){if (obj.image_path)dhx_globalImgPath=obj.image_path;return [obj.parent, obj.name, (obj.width||"100%"), obj.type, obj.index ]},
 filter:"filter_command",
 auto_height:"enableOptionAutoHeight",
 auto_position:"enableOptionAutoPositioning",
 auto_width:"enableOptionAutoWidth",
 xml:"loadXML",
 readonly:"readonly",
 items:"addOption"
 },{filter_command:function(data){if (typeof data == "string")this.enableFilteringMode(true,data);else
 this.enableFilteringMode(data)}})})();//(c)dhtmlx ltd. www.dhtmlx.com
//v.2.5 build 91111

/*
Copyright DHTMLX LTD. http://www.dhtmlx.com
You allowed to use this component or parts of it under GPL terms
To use it on other terms or get Professional edition of the component please contact us at sales@dhtmlx.com
*/
//v.2.5 build 91111

/*
Copyright DHTMLX LTD. http://www.dhtmlx.com
You allowed to use this component or parts of it under GPL terms
To use it on other terms or get Professional edition of the component please contact us at sales@dhtmlx.com
*/

dhtmlXCombo_imageOption = function(){this.init()};dhtmlXCombo_imageOption.prototype = new dhtmlXCombo_defaultOption;dhtmlXCombo_imageOption.prototype.setValue = function(attr){this.value = attr.value||"";this.text = attr.text||"";this.css = attr.css||"";this.img_src = attr.img_src||this.getDefImage()};dhtmlXCombo_imageOption.prototype.render = function(){if (!this.content){this.content=document.createElement("DIV");this.content._self = this;this.content.style.cssText='width:100%;overflow:hidden;'+this.css;var html = '';if (this.img_src != '')html += '<img style="float:left;" src="'+this.img_src+'" />';html += '<div style="float:left">'+this.text+'</div>';this.content.innerHTML=html};return this.content};dhtmlXCombo_imageOption.prototype.data = function(){return [this.value,this.text,this.img_src]};dhtmlXCombo_imageOption.prototype.DrawHeader = function(self, name, width)
{var z=document.createElement("DIV");z.style.width = width+"px";z.className = 'dhx_combo_box';z._self = self;self.DOMelem = z;this._DrawHeaderImage(self, name, width);this._DrawHeaderInput(self, name, width-23);this._DrawHeaderButton(self, name, width);self.DOMParent.appendChild(self.DOMelem)};dhtmlXCombo_imageOption.prototype._DrawHeaderImage = function(self, name, width)
{var z= document.createElement('img');z.className = (self.rtl)? 'dhx_combo_option_img_rtl':'dhx_combo_option_img';z.style.visibility = 'hidden';self.DOMelem.appendChild(z);self.DOMelem_image=z};dhtmlXCombo_imageOption.prototype.RedrawHeader = function(self)
{self.DOMelem_image.style.visibility = 'visible';self.DOMelem_image.src = this.img_src};dhtmlXCombo_imageOption.prototype.getDefImage = function(self){return ""};dhtmlXCombo.prototype.setDefaultImage=function(url){dhtmlXCombo_imageOption.prototype.getDefImage=function(){return url}};dhtmlXCombo_optionTypes['image'] = dhtmlXCombo_imageOption;dhtmlXCombo_checkboxOption = function(){this.init()};dhtmlXCombo_checkboxOption.prototype = new dhtmlXCombo_defaultOption;dhtmlXCombo_checkboxOption.prototype.setValue = function(attr){this.value = attr.value||"";this.text = attr.text||"";this.css = attr.css||"";this.checked = attr.checked||0};dhtmlXCombo_checkboxOption.prototype.render = function(){if (!this.content){this.content=document.createElement("DIV");this.content._self = this;this.content.style.cssText='width:100%;overflow:hidden;'+this.css;var html = '';if(this.checked)html += '<input style="float:left;" type="checkbox" checked />';else html += '<input style="float:left;" type="checkbox" />';html += '<div style="float:left">'+this.text+'</div>';this.content.innerHTML=html;this.content.firstChild.onclick = function(e) {this.parentNode.parentNode.combo.DOMelem_input.focus();(e||event).cancelBubble=true;if(!this.parentNode.parentNode.combo.callEvent("onCheck",[this.parentNode._self.value,this.checked])){this.checked=!this.checked;return false}}};return this.content};dhtmlXCombo_checkboxOption.prototype.data = function(){return [this.value,this.text,this.render().firstChild.checked]};dhtmlXCombo_checkboxOption.prototype.DrawHeader = function(self, name, width)
{self.DOMelem = document.createElement("DIV");self.DOMelem.style.width = width+"px";self.DOMelem.className = 'dhx_combo_box';self.DOMelem._self = self;this._DrawHeaderCheckbox(self, name, width);this._DrawHeaderInput(self, name, width-18);this._DrawHeaderButton(self, name, width);self.DOMParent.appendChild(self.DOMelem)};dhtmlXCombo_checkboxOption.prototype._DrawHeaderCheckbox = function(self, name, width)
{var z= document.createElement('input');z.type='checkbox';z.className = (self.rtl)? 'dhx_combo_option_img_rtl':'dhx_combo_option_img';z.style.visibility = 'hidden';z.onclick = function(e) {(e||event).cancelBubble=true};self.DOMelem.appendChild(z);self.DOMelem_checkbox = z};dhtmlXCombo_checkboxOption.prototype.RedrawHeader = function(self)
{self.DOMelem_checkbox.style.visibility = '';self.DOMelem_checkbox.checked = this.content.firstChild.checked};dhtmlXCombo_optionTypes['checkbox'] = dhtmlXCombo_checkboxOption;dhtmlXCombo.prototype.getChecked=function(){var res=[];for(var i=0;i<this.optionsArr.length;i++)if(this.optionsArr[i].data()[2])
 res.push(this.optionsArr[i].value)
 return res};dhtmlXCombo.prototype.setChecked=function(index,mode){this.optionsArr[index].content.firstChild.checked=(!(mode===false))};dhtmlXCombo.prototype.setCheckedByValue=function(value,mode){return this.setChecked(this.getIndexByValue(value),mode)};
//v.2.5 build 91111

/*
Copyright DHTMLX LTD. http://www.dhtmlx.com
You allowed to use this component or parts of it under GPL terms
To use it on other terms or get Professional edition of the component please contact us at sales@dhtmlx.com
*/
//v.2.5 build 91111

/*
Copyright DHTMLX LTD. http://www.dhtmlx.com
You allowed to use this component or parts of it under GPL terms
To use it on other terms or get Professional edition of the component please contact us at sales@dhtmlx.com
*/

dhtmlXCombo.prototype.enableOptionAutoPositioning = function(fl){if(!this.ListAutoPosit)this.ListAutoPosit = 1;this.attachEvent("onOpen",function(){this._setOptionAutoPositioning(fl)})
 this.attachEvent("onXLE",function(){this._setOptionAutoPositioning(fl)})
 
};dhtmlXCombo.prototype._setOptionAutoPositioning = function(fl){if((typeof(fl)!="undefined")&&(!convertStringToBoolean(fl))){this.ListPosition = "Bottom";this.ListAutoPosit = 0;return true
 };var pos = this.getPosition(this.DOMelem);var bottom = this._getClientHeight() - pos[1] - this.DOMelem.offsetHeight;var height = (this.autoHeight)?(this.DOMlist.scrollHeight):parseInt(this.DOMlist.offsetHeight);if((bottom < height)&&(pos[1] > height)){this.ListPosition = "Top"}else this.ListPosition = "Bottom";this._positList()};dhtmlXCombo.prototype._getClientHeight = function(){return ((document.compatMode=='CSS1Compat') &&(!window.opera))?document.documentElement.clientHeight:document.body.clientHeight};dhtmlXCombo.prototype.setOptionWidth = function(width){if(arguments.length > 0){this.DOMlist.style.width = width+"px";if (this.DOMlistF)this.DOMlistF.style.width = width+"px"}};dhtmlXCombo.prototype.setOptionHeight = function(height){if(arguments.length>0){if(_isIE)this.DOMlist.style.height = this.DOMlistF.style.height = height+"px";else
 this.DOMlist.style.height = height+"px";this._positList()}};dhtmlXCombo.prototype.enableOptionAutoWidth = function(fl){if(!this._listWidthConf)this._listWidthConf = parseInt(this.DOMlist.style.width);if(arguments.length == 0){var fl = 1};if(convertStringToBoolean(fl)) {this.autoOptionWidth = 1;this.awOnOpen = this.attachEvent("onOpen",function(){this._setOptionAutoWidth()});this.awOnXLE = this.attachEvent("onXLE",function(){this._setOptionAutoWidth()})}else {if(typeof(this.awOnOpen)!= "undefined"){this.autoOptionWidth = 0;this.detachEvent(this.awOnOpen);this.detachEvent(this.awOnXLE);this.setOptionWidth(this._listWidthConf)}}};dhtmlXCombo.prototype._setOptionAutoWidth = function(){this.setOptionWidth(1);var x = this.DOMlist.offsetWidth;for ( var i=0;i<this.optionsArr.length;i++){var optWidth = (_isFF)?(this.DOMlist.childNodes[i].scrollWidth - 2):this.DOMlist.childNodes[i].scrollWidth;if (optWidth > x){x = this.DOMlist.childNodes[i].scrollWidth}};this.setOptionWidth(x)};dhtmlXCombo.prototype.enableOptionAutoHeight = function(fl,maxHeight){if(!this._listHeightConf)this._listHeightConf = (this.DOMlist.style.height=="")?100:parseInt(this.DOMlist.style.height);if(arguments.length==0)var fl = 1;this.autoHeight = convertStringToBoolean(fl);if(this.autoHeight){this.ahOnOpen = this.attachEvent("onOpen",function(){this._setOptionAutoHeight(fl,maxHeight);if(_isIE)this._setOptionAutoHeight(fl,maxHeight)})
 if(!this.awOnOpen)this.ahOnXLE = this.attachEvent("onXLE",function(){var that = this;window.setTimeout(function(){that.callEvent("onOpen",[])},1)})
 }else {if(typeof(this.ahOnOpen)!= "undefined"){this.detachEvent(this.ahOnOpen);this.detachEvent(this.ahOnXLE);this.setOptionHeight(this._listHeightConf)}}};dhtmlXCombo.prototype._setOptionAutoHeight = function(fl,maxHeight){if(convertStringToBoolean(fl)){this.setOptionHeight(1);var height = 0;if (this.optionsArr.length > 0){if(this.DOMlist.scrollHeight > this.DOMlist.offsetHeight){height= this.DOMlist.scrollHeight + 2}else height= this.DOMlist.offsetHeight;if((arguments.length > 1)&&(maxHeight)){var maxHeight = parseInt(maxHeight);height = (height>maxHeight)?maxHeight:height};this.setOptionHeight(height)
 }}};
//v.2.5 build 91111

/*
Copyright DHTMLX LTD. http://www.dhtmlx.com
You allowed to use this component or parts of it under GPL terms
To use it on other terms or get Professional edition of the component please contact us at sales@dhtmlx.com
*/
/*
ModalBox - The pop-up window thingie with AJAX, based on prototype and script.aculo.us.

Copyright Andrey Okonetchnikov (andrej.okonetschnikow@gmail.com), 2006-2007
All rights reserved.
 
VERSION 1.6.0
Last Modified: 12/13/2007
*/

if (!window.Modalbox)
	var Modalbox = new Object();
	

Modalbox.Methods = {
	overrideAlert: false, // Override standard browser alert message with ModalBox
	focusableElements: new Array,
	currFocused: 0,
	initialized: false,
	active: true,
	firstLoad: true,
	options: {
		title: "ModalBox Window", // Title of the ModalBox window
		overlayClose: true, // Close modal box by clicking on overlay
		width: 500, // Default width in px
		height: 90, // Default height in px
		overlayOpacity: .65, // Default overlay opacity
		overlayDuration: .25, // Default overlay fade in/out duration in seconds
		slideDownDuration: .5, // Default Modalbox appear slide down effect in seconds
		slideUpDuration: .5, // Default Modalbox hiding slide up effect in seconds
		resizeDuration: .25, // Default resize duration seconds
		inactiveFade: true, // Fades MB window on inactive state
		transitions: true, // Toggles transition effects. Transitions are enabled by default
		loadingString: "Please wait. Loading...", // Default loading string message
		closeString: "Close window", // Default title attribute for close window link
		closeValue: "&times;", // Default string for close link in the header
		params: {},
		method: 'get', // Default Ajax request method
		autoFocusing: true, // Toggles auto-focusing for form elements. Disable for long text pages.
		aspnet: false, // Should be use then using with ASP.NET costrols. Then true Modalbox window will be injected into the first form element.
		zIndex: null
	},
	_options: new Object,
	
	setOptions: function(options) {
		Object.extend(this.options, options || {});
	},
	
	initObject: function(options) {
		this.overrideAlert = false;
		this.focusableElements = new Array;
		this.currFocused = 0;
		this.initialized = false;
		this.active = true;
		
		this.options.title = "ModalBox Window";
		this.options.overlayClose = true;
		this.options.width = 500;
		this.options.height = 90;
		this.options.overlayOpacity = .65;
		this.options.overlayDuration = .25;
		this.options.slideDownDuration = .5;
		this.options.slideUpDuration = .5;
		this.options.resizeDuration = .25;
		this.options.inactiveFade = true;
		
		var arVersion = navigator.appVersion.split("MSIE");
		var version = parseFloat(arVersion[1]);
		if (navigator.appVersion.indexOf("MSIE")!=-1 && version < 7) {
			this.options.transitions = false;
		} else {
			this.options.transitions = true;
		}
		
		this.options.loadingString = "Please wait. Loading...";
		this.options.closeString = "Close window";
		this.options.closeValue = "&times;";
		this.options.params = {};
		this.options.method = 'get';
		this.options.autoFocusing = true;
		this.options.aspnet = false;
		this.options.zIndex = null;
		
		this.MBwindow.style.display = "none";
	},
	
	_init: function(options) {
		this.firstLoad = false;
		
		var arVersion = navigator.appVersion.split("MSIE");
		var version = parseFloat(arVersion[1]);
		if (navigator.appVersion.indexOf("MSIE")!=-1 && version < 7) {
			this.options.transitions = false;
		}
		
		// Setting up original options with default options
		Object.extend(this._options, this.options);
		this.setOptions(options);
		
		//Create the overlay
		if (this.options.zIndex) {
			var MBoverlay_style = "z-index: " + (this.options.zIndex - 1) + ";";
			this.MBoverlay = new Element("div", { id: "MB_overlay", opacity: "0", style: MBoverlay_style });
		} else {
			this.MBoverlay = new Element("div", { id: "MB_overlay", opacity: "0" });
		}
		
		//Create DOm for the window
		var MB_window_style = "display: none;";
		if (this.options.zIndex) {
			MB_window_style += "z-index: " + this.options.zIndex + ";";
		}
		this.MBwindow = new Element("div", {id: "MB_window", style: MB_window_style}).update(
			this.MBframe = new Element("div", {id: "MB_frame"}).update(
				this.MBheader = new Element("div", {id: "MB_header"}).update(
					this.MBcaption = new Element("div", {id: "MB_caption"})
				)
			)
		);
		this.MBclose = new Element("a", {id: "MB_close", title: this.options.closeString, href: "#"}).update("<span>" + this.options.closeValue + "</span>");
		this.MBheader.insert({'bottom':this.MBclose});
		
		this.MBcontent = new Element("div", {id: "MB_content"}).update(
			this.MBloading = new Element("div", {id: "MB_loading"}).update(this.options.loadingString)
		);
		this.MBframe.insert({'bottom':this.MBcontent});
		
		// Inserting into DOM. If parameter set and form element have been found will inject into it. Otherwise will inject into body as topmost element.
		// Be sure to set padding and marging to null via CSS for both body and (in case of asp.net) form elements. 
		var injectToEl = this.options.aspnet ? $(document.body).down('form') : $(document.body);
		injectToEl.insert({'top':this.MBwindow});
		injectToEl.insert({'top':this.MBoverlay});
		
		// Initial scrolling position of the window. To be used for remove scrolling effect during ModalBox appearing
		this.initScrollX = window.pageXOffset || document.body.scrollLeft || document.documentElement.scrollLeft;
		this.initScrollY = window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop;
		
		//Adding event observers
		this.hideObserver = this._hide.bindAsEventListener(this);
		this.kbdObserver = this._kbdHandler.bindAsEventListener(this);
		this._initObservers();

		this.initialized = true; // Mark as initialized
	},
	
	show: function(content, options) {
		if(!this.initialized) this._init(options); // Check for is already initialized
		
		this.content = content;
		this.setOptions(options);
		
		if(this.options.title) // Updating title of the MB
			$(this.MBcaption).update(this.options.title);
		else { // If title isn't given, the header will not displayed
			$(this.MBheader).hide();
			$(this.MBcaption).hide();
		}
		
		if(this.MBwindow.style.display == "none") { // First modal box appearing
			this._appear();
			this.event("onShow"); // Passing onShow callback
		}
		else { // If MB already on the screen, update it
			this._update();
			this.event("onUpdate"); // Passing onUpdate callback
		} 
	},
	
	hide: function(options) { // External hide method to use from external HTML and JS
		if(this.initialized) {
			// Reading for options/callbacks except if event given as a pararmeter
			if(options && typeof options.element != 'function') Object.extend(this.options, options); 
			// Passing beforeHide callback
			this.event("beforeHide");
			if(this.options.transitions)
				Effect.SlideUp(this.MBwindow, { duration: this.options.slideUpDuration, transition: Effect.Transitions.sinoidal, afterFinish: this._deinit.bind(this) } );
			else {
				$(this.MBwindow).hide();
				this._deinit();
			}
		} else throw("Modalbox is not initialized.");
	},
	
	_hide: function(event) { // Internal hide method to use with overlay and close link
		event.stop(); // Stop event propaganation for link elements
		/* Then clicked on overlay we'll check the option and in case of overlayClose == false we'll break hiding execution [Fix for #139] */
		if(event.element().id == 'MB_overlay' && !this.options.overlayClose) return false;
		this.hide();
	},
	
	alert: function(message){
		var html = '<div class="MB_alert"><p>' + message + '</p><input type="button" onclick="Modalbox.hide()" value="OK" /></div>';
		Modalbox.show(html, {title: 'Alert: ' + document.title, width: 300});
	},
		
	_appear: function() { // First appearing of MB
		if(Prototype.Browser.IE && !navigator.appVersion.match(/\b7.0\b/)) { // Preparing IE 6 for showing modalbox
			window.scrollTo(0,0);
			this._prepareIE("100%", "hidden"); 
		}
		this._setWidth();
		this._setPosition();
		if(this.options.transitions) {
			$(this.MBoverlay).setStyle({opacity: 0});
			new Effect.Fade(this.MBoverlay, {
					from: 0, 
					to: this.options.overlayOpacity, 
					duration: this.options.overlayDuration, 
					afterFinish: function() {
						new Effect.SlideDown(this.MBwindow, {
							duration: this.options.slideDownDuration, 
							transition: Effect.Transitions.sinoidal, 
							afterFinish: function(){ 
								this._setPosition(); 
								this.loadContent();
							}.bind(this)
						});
					}.bind(this)
			});
		} else {
			$(this.MBoverlay).setStyle({opacity: this.options.overlayOpacity});
			$(this.MBwindow).show();
			this._setPosition(); 
			this.loadContent();
		}
		this._setWidthAndPosition = this._setWidthAndPosition.bindAsEventListener(this);
		Event.observe(window, "resize", this._setWidthAndPosition);
	},
	
	resize: function(byWidth, byHeight, options) { // Change size of MB without loading content
		var wHeight = $(this.MBwindow).getHeight();
		var wWidth = $(this.MBwindow).getWidth();
		var hHeight = $(this.MBheader).getHeight();
		var cHeight = $(this.MBcontent).getHeight();
		var newHeight = ((wHeight - hHeight + byHeight) < cHeight) ? (cHeight + hHeight - wHeight) : byHeight;
		if(options) this.setOptions(options); // Passing callbacks
		if(this.options.transitions) {
			new Effect.ScaleBy(this.MBwindow, byWidth, newHeight, {
					duration: this.options.resizeDuration, 
				  	afterFinish: function() { 
						this.event("_afterResize"); // Passing internal callback
						this.event("afterResize"); // Passing callback
					}.bind(this)
				});
		} else {
			this.MBwindow.setStyle({width: wWidth + byWidth + "px", height: wHeight + newHeight + "px"});
			setTimeout(function() {
				this.event("_afterResize"); // Passing internal callback
				this.event("afterResize"); // Passing callback
			}.bind(this), 1);
			
		}
		
	},
	
	resizeToContent: function(options){
		
		// Resizes the modalbox window to the actual content height.
		// This might be useful to resize modalbox after some content modifications which were changed ccontent height.
		
		var byHeight = this.options.height - this.MBwindow.offsetHeight;
		if(byHeight != 0) {
			if(options) this.setOptions(options); // Passing callbacks
			this.resize(0, byHeight);
		}
	},
	
	resizeToInclude: function(element, options){
		
		// Resizes the modalbox window to the camulative height of element. Calculations are using CSS properties for margins and border.
		// This method might be useful to resize modalbox before including or updating content.
		
		var el = $(element);
		var elHeight = el.getHeight() + parseInt(el.getStyle('margin-top')) + parseInt(el.getStyle('margin-bottom')) + parseInt(el.getStyle('border-top-width')) + parseInt(el.getStyle('border-bottom-width'));
		if(elHeight > 0) {
			if(options) this.setOptions(options); // Passing callbacks
			this.resize(0, elHeight);
		}
	},
	
	_update: function() { // Updating MB in case of wizards
		$(this.MBcontent).update("");
		this.MBcontent.appendChild(this.MBloading);
		$(this.MBloading).update(this.options.loadingString);
		this.currentDims = [this.MBwindow.offsetWidth, this.MBwindow.offsetHeight];
		this.resize((this.options.width - this.currentDims[0]), (this.options.height - this.currentDims[1]), {_afterResize: this._loadAfterResize.bind(this) });
	},
	
	loadContent: function () {
		if(this.event("beforeLoad") != false) { // If callback passed false, skip loading of the content
			if(typeof this.content == 'string') {
				var htmlRegExp = new RegExp(/<\/?[^>]+>/gi);
				if(htmlRegExp.test(this.content)) { // Plain HTML given as a parameter
					this._insertContent(this.content.stripScripts());
					this._putContent(function(){
						this.content.extractScripts().map(function(script) { 
							return eval(script.replace("<!--", "").replace("// -->", ""));
						}.bind(window));
					}.bind(this));
				} else // URL given as a parameter. We'll request it via Ajax
					new Ajax.Request( this.content, { method: this.options.method.toLowerCase(), parameters: this.options.params, 
						onSuccess: function(transport) {
							var response = new String(transport.responseText);
							this._insertContent(transport.responseText.stripScripts());
							this._putContent(function(){
								response.extractScripts().map(function(script) { 
									return eval(script.replace("<!--", "").replace("// -->", ""));
								}.bind(window));
							});
						}.bind(this),
						onException: function(instance, exception){
							this.hide();
							throw('Modalbox Loading Error: ' + exception);
						}
					});
					
			} else if (typeof this.content == 'object') {// HTML Object is given
				this._insertContent(this.content);
				this._putContent();
			} else {
				this.hide();
				throw('Modalbox Parameters Error: Please specify correct URL or HTML element (plain HTML or object)');
			}
		}
	},
	
	_insertContent: function(content){
		$(this.MBcontent).hide().update("");
		if(typeof content == 'string') {
			setTimeout(function() { // Hack to disable content flickering in Firefox
				this.MBcontent.update(content);
			}.bind(this), 1);
		} else if (typeof content == 'object') { // HTML Object is given
			var _htmlObj = content.cloneNode(true); // If node already a part of DOM we'll clone it
			// If clonable element has ID attribute defined, modifying it to prevent duplicates
			if(content.id) content.id = "MB_" + content.id;
			/* Add prefix for IDs on all elements inside the DOM node */
			$(content).select('*[id]').each(function(el){ el.id = "MB_" + el.id; });
			this.MBcontent.appendChild(_htmlObj);
			this.MBcontent.down().show(); // Toggle visibility for hidden nodes
			if(Prototype.Browser.IE) // Toggling back visibility for hidden selects in IE
				$$("#MB_content select").invoke('setStyle', {'visibility': ''});
		}
	},
	
	_putContent: function(callback){
		// Prepare and resize modal box for content
		if(this.options.height == this._options.height) {
			setTimeout(function() { // MSIE sometimes doesn't display content correctly
				this.resize(0, $(this.MBcontent).getHeight() - $(this.MBwindow).getHeight() + $(this.MBheader).getHeight(), {
					afterResize: function(){
						this.MBcontent.show().makePositioned();
						this.focusableElements = this._findFocusableElements();
						this._setFocus(); // Setting focus on first 'focusable' element in content (input, select, textarea, link or button)
						setTimeout(function(){ // MSIE fix
							if(callback != undefined)
								callback(); // Executing internal JS from loaded content
							this.event("afterLoad"); // Passing callback
						}.bind(this),1);
					}.bind(this)
				});
			}.bind(this), 1);
		} else { // Height is defined. Creating a scrollable window
			this._setWidth();
			this.MBcontent.setStyle({overflow: 'auto', height: $(this.MBwindow).getHeight() - $(this.MBheader).getHeight() - 13 + 'px'});
			this.MBcontent.show();
			this.focusableElements = this._findFocusableElements();
			this._setFocus(); // Setting focus on first 'focusable' element in content (input, select, textarea, link or button)
			setTimeout(function(){ // MSIE fix
				if(callback != undefined)
					callback(); // Executing internal JS from loaded content
				this.event("afterLoad"); // Passing callback
			}.bind(this),1);
		}
	},
	
	activate: function(options){
		this.setOptions(options);
		this.active = true;
		$(this.MBclose).observe("click", this.hideObserver);
		if(this.options.overlayClose)
			$(this.MBoverlay).observe("click", this.hideObserver);
		$(this.MBclose).show();
		if(this.options.transitions && this.options.inactiveFade)
			new Effect.Appear(this.MBwindow, {duration: this.options.slideUpDuration});
	},
	
	deactivate: function(options) {
		this.setOptions(options);
		this.active = false;
		$(this.MBclose).stopObserving("click", this.hideObserver);
		if(this.options.overlayClose)
			$(this.MBoverlay).stopObserving("click", this.hideObserver);
		$(this.MBclose).hide();
		if(this.options.transitions && this.options.inactiveFade)
			new Effect.Fade(this.MBwindow, {duration: this.options.slideUpDuration, to: .75});
	},
	
	_initObservers: function(){
		$(this.MBclose).observe("click", this.hideObserver);
		if(this.options.overlayClose)
			$(this.MBoverlay).observe("click", this.hideObserver);
		if(Prototype.Browser.IE)
			Event.observe(document, "keydown", this.kbdObserver);
		else
			Event.observe(document, "keypress", this.kbdObserver);
	},
	
	_removeObservers: function(){
		$(this.MBclose).stopObserving("click", this.hideObserver);
		if(this.options.overlayClose)
			$(this.MBoverlay).stopObserving("click", this.hideObserver);
		if(Prototype.Browser.IE)
			Event.stopObserving(document, "keydown", this.kbdObserver);
		else
			Event.stopObserving(document, "keypress", this.kbdObserver);
	},
	
	_loadAfterResize: function() {
		this._setWidth();
		this._setPosition();
		this.loadContent();
	},
	
	_setFocus: function() { 
		/* Setting focus to the first 'focusable' element which is one with tabindex = 1 or the first in the form loaded. */
		if(this.focusableElements.length > 0 && this.options.autoFocusing == true) {
			var firstEl = this.focusableElements.find(function (el){
				return el.tabIndex == 1;
			}) || this.focusableElements.first();
			this.currFocused = this.focusableElements.toArray().indexOf(firstEl);
			firstEl.focus(); // Focus on first focusable element except close button
		} else if($(this.MBclose).visible())
			$(this.MBclose).focus(); // If no focusable elements exist focus on close button
	},
	
	_findFocusableElements: function(){ // Collect form elements or links from MB content
		this.MBcontent.select('input:not([type~=hidden]), select, textarea, button, a[href]').invoke('addClassName', 'MB_focusable');
		return this.MBcontent.select('.MB_focusable');
	},
	
	_kbdHandler: function(event) {
		var node = event.element();
		switch(event.keyCode) {
			case Event.KEY_TAB:
				event.stop();
				
				/* Switching currFocused to the element which was focused by mouse instead of TAB-key. Fix for #134 */ 
				if(node != this.focusableElements[this.currFocused])
					this.currFocused = this.focusableElements.toArray().indexOf(node);
				
				if(!event.shiftKey) { //Focusing in direct order
					if(this.currFocused == this.focusableElements.length - 1) {
						this.focusableElements.first().focus();
						this.currFocused = 0;
					} else {
						this.currFocused++;
						this.focusableElements[this.currFocused].focus();
					}
				} else { // Shift key is pressed. Focusing in reverse order
					if(this.currFocused == 0) {
						this.focusableElements.last().focus();
						this.currFocused = this.focusableElements.length - 1;
					} else {
						this.currFocused--;
						this.focusableElements[this.currFocused].focus();
					}
				}
				break;			
			case Event.KEY_ESC:
				if(this.active) this._hide(event);
				break;
			case 32:
				this._preventScroll(event);
				break;
			case 0: // For Gecko browsers compatibility
				if(event.which == 32) this._preventScroll(event);
				break;
			case Event.KEY_UP:
			case Event.KEY_DOWN:
			case Event.KEY_PAGEDOWN:
			case Event.KEY_PAGEUP:
			case Event.KEY_HOME:
			case Event.KEY_END:
				// Safari operates in slightly different way. This realization is still buggy in Safari.
				if(Prototype.Browser.WebKit && !["textarea", "select"].include(node.tagName.toLowerCase()))
					event.stop();
				else if( (node.tagName.toLowerCase() == "input" && ["submit", "button"].include(node.type)) || (node.tagName.toLowerCase() == "a") )
					event.stop();
				break;
		}
	},
	
	_preventScroll: function(event) { // Disabling scrolling by "space" key
		if(!["input", "textarea", "select", "button"].include(event.element().tagName.toLowerCase())) 
			event.stop();
	},
	
	_deinit: function()
	{	
		this._removeObservers();
		Event.stopObserving(window, "resize", this._setWidthAndPosition );
		if(this.options.transitions) {
			Effect.toggle(this.MBoverlay, 'appear', {duration: this.options.overlayDuration, afterFinish: this._removeElements.bind(this) });
		} else {
			this.MBoverlay.hide();
			this._removeElements();
		}
		$(this.MBcontent).setStyle({overflow: '', height: ''});
	},
	
	_removeElements: function () {
		$(this.MBoverlay).remove();
		$(this.MBwindow).remove();
		if(Prototype.Browser.IE && !navigator.appVersion.match(/\b7.0\b/)) {
			this._prepareIE("", ""); // If set to auto MSIE will show horizontal scrolling
			window.scrollTo(this.initScrollX, this.initScrollY);
		}
		
		/* Replacing prefixes 'MB_' in IDs for the original content */
		if(typeof this.content == 'object') {
			if(this.content.id && this.content.id.match(/MB_/)) {
				this.content.id = this.content.id.replace(/MB_/, "");
			}
			this.content.select('*[id]').each(function(el){ el.id = el.id.replace(/MB_/, ""); });
		}
		/* Initialized will be set to false */
		this.initialized = false;
		this.event("afterHide"); // Passing afterHide callback
		this.setOptions(this._options); //Settings options object into intial state
	},
	
	_setWidth: function () { //Set size
		$(this.MBwindow).setStyle({width: this.options.width + "px", height: this.options.height + "px"});
	},
	
	_setPosition: function () {
		$(this.MBwindow).setStyle({left: Math.round((Element.getWidth(document.body) - Element.getWidth(this.MBwindow)) / 2 ) + "px"});
	},
	
	_setWidthAndPosition: function () {
		$(this.MBwindow).setStyle({width: this.options.width + "px"});
		this._setPosition();
	},
	
	_getScrollTop: function () { //From: http://www.quirksmode.org/js/doctypes.html
		var theTop;
		if (document.documentElement && document.documentElement.scrollTop)
			theTop = document.documentElement.scrollTop;
		else if (document.body)
			theTop = document.body.scrollTop;
		return theTop;
	},
	_prepareIE: function(height, overflow){
		$$('html, body').invoke('setStyle', {width: height, height: height, overflow: overflow}); // IE requires width and height set to 100% and overflow hidden
		$$("select").invoke('setStyle', {'visibility': overflow}); // Toggle visibility for all selects in the common document
	},
	event: function(eventName) {
		if(this.options[eventName]) {
			var returnValue = this.options[eventName](); // Executing callback
			this.options[eventName] = null; // Removing callback after execution
			if(returnValue != undefined) 
				return returnValue;
			else 
				return true;
		}
		return true;
	}
};

Object.extend(Modalbox, Modalbox.Methods);

if(Modalbox.overrideAlert) window.alert = Modalbox.alert;

Effect.ScaleBy = Class.create();
Object.extend(Object.extend(Effect.ScaleBy.prototype, Effect.Base.prototype), {
  initialize: function(element, byWidth, byHeight, options) {
    this.element = $(element)
    var options = Object.extend({
	  scaleFromTop: true,
      scaleMode: 'box',        // 'box' or 'contents' or {} with provided values
      scaleByWidth: byWidth,
	  scaleByHeight: byHeight
    }, arguments[3] || {});
    this.start(options);
  },
  setup: function() {
    this.elementPositioning = this.element.getStyle('position');
      
    this.originalTop  = this.element.offsetTop;
    this.originalLeft = this.element.offsetLeft;
	
    this.dims = null;
    if(this.options.scaleMode=='box')
      this.dims = [this.element.offsetHeight, this.element.offsetWidth];
	 if(/^content/.test(this.options.scaleMode))
      this.dims = [this.element.scrollHeight, this.element.scrollWidth];
    if(!this.dims)
      this.dims = [this.options.scaleMode.originalHeight,
                   this.options.scaleMode.originalWidth];
	  
	this.deltaY = this.options.scaleByHeight;
	this.deltaX = this.options.scaleByWidth;
  },
  update: function(position) {
    var currentHeight = this.dims[0] + (this.deltaY * position);
	var currentWidth = this.dims[1] + (this.deltaX * position);
	
	currentHeight = (currentHeight > 0) ? currentHeight : 0;
	currentWidth = (currentWidth > 0) ? currentWidth : 0;
	
    this.setDimensions(currentHeight, currentWidth);
  },

  setDimensions: function(height, width) {
    var d = {};
    d.width = width + 'px';
    d.height = height + 'px';
    
	var topd  = Math.round((height - this.dims[0])/2);
	var leftd = Math.round((width  - this.dims[1])/2);
	if(this.elementPositioning == 'absolute' || this.elementPositioning == 'fixed') {
		if(!this.options.scaleFromTop) d.top = this.originalTop-topd + 'px';
		d.left = this.originalLeft-leftd + 'px';
	} else {
		if(!this.options.scaleFromTop) d.top = -topd + 'px';
		d.left = -leftd + 'px';
	}
    this.element.setStyle(d);
  }
});
//  Prototip 2.2 - 15-10-2009
//  Copyright (c) 2008-2009 Nick Stakenburg (http://www.nickstakenburg.com)
//
//  Licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Unported License
//  http://creativecommons.org/licenses/by-nc-nd/3.0/

//  More information on this project:
//  http://www.nickstakenburg.com/projects/prototip2/

var Prototip = {
  Version: '2.2'
};

var Tips = {
  options: {
    images: '../img/prototip/', // image path, can be relative to this file or an absolute url
    zIndex: 6000                      // raise if required
  }
};

eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('M.10(11,{4S:"1.6.1",37:{24:!!X.6u("24").3T},3I:p(a){4v{X.5n("<2E 4i=\'3A/3m\' 1C=\'"+a+"\'><\\/2E>")}4p(b){$$("4E")[0].J(I H("2E",{1C:a,4i:"3A/3m"}))}},41:p(){3.4b("2W");q a=/1I(?:-[\\w\\d.]+)?\\.3o(.*)/;3.36=(($$("2E[1C]").4J(p(b){L b.1C.25(a)})||{}).1C||"").3a(a,"");r.U=(/^(5B?:\\/\\/|\\/)/.4r(r.9.U))?r.9.U:3.36+r.9.U;3.3I(3.36+"3E.3o");o(!3.37.24){o(X.4O>=8&&!X.3H.2i){X.3H.3n("2i","5D:5Y-6g-6v:5A","#2r#4k")}Y{X.1b("3F:3l",p(){q b=X.4V();b.4Z="2i\\\\:*{5j:3h(#2r#4k)}"})}}r.2t();H.1b(3f,"3e",3.3e)},4b:p(a){o((5J 3f[a]=="5X")||(3.3d(3f[a].60)<3.3d(3["3K"+a]))){3L("11 4m "+a+" >= "+3["3K"+a]);}},3d:p(a){q b=a.3a(/3Q.*|\\./g,"");b=4s(b+"0".4u(4-b.1W));L a.4z("3Q")>-1?b-1:b},3c:p(a){L(a>0)?(-1*a):(a).4I()},3e:p(){r.3t()}});M.10(r,(p(){p a(b){o(!b){L}b.3w();o(b.18){b.E.1K();o(r.1i){b.1p.1K()}}r.1r=r.1r.3U(b)}L{1r:[],19:[],2t:p(){3.2s=3.1n},2b:{B:"3b",3b:"B",u:"1s",1s:"u",1T:"1T",1c:"1g",1g:"1c"},3R:{G:"1c",F:"1g"},39:p(b){L!!1Z[1]?3.2b[b]:b},1i:(p(c){q b=I 4F("4G ([\\\\d.]+)").4H(c);L b?(3u(b[1])<7):V})(4M.4N),2G:(2W.4P.4Q&&!X.4T),3n:p(b){3.1r.28(b)},1K:p(d){q g,e=[];1V(q c=0,b=3.1r.1W;c<b;c++){q f=3.1r[c];o(!g&&f.C==$(d)){g=f}Y{o(!f.C.3O){e.28(f)}}}a(g);1V(q c=0,b=e.1W;c<b;c++){q f=e[c];a(f)}d.1I=23},3t:p(){1V(q c=0,b=3.1r.1W;c<b;c++){a(3.1r[c])}},2g:p(d){o(d==3.3S){L}o(3.19.1W===0){3.2s=3.9.1n;1V(q c=0,b=3.1r.1W;c<b;c++){3.1r[c].E.s({1n:3.9.1n})}}d.E.s({1n:3.2s++});o(d.Q){d.Q.s({1n:3.2s})}3.3S=d},3X:p(b){3.34(b);3.19.28(b)},34:p(b){3.19=3.19.3U(b)},49:p(){r.19.1N("S")},T:p(c,g){c=$(c),g=$(g);q l=M.10({1a:{x:0,y:0},N:V},1Z[2]||{});q e=l.1t||g.2h();e.B+=l.1a.x;e.u+=l.1a.y;q d=l.1t?[0,0]:g.3N(),b=X.1A.2k(),h=l.1t?"22":"15";e.B+=(-1*(d[0]-b[0]));e.u+=(-1*(d[1]-b[1]));o(l.1t){q f=[0,0];f.G=0;f.F=0}q j={C:c.21()},k={C:M.29(e)};j[h]=l.1t?f:g.21();k[h]=M.29(e);1V(q i 4a k){4c(l[i]){R"4X":R"4Y":k[i].B+=j[i].G;17;R"51":k[i].B+=(j[i].G/2);17;R"53":k[i].B+=j[i].G;k[i].u+=(j[i].F/2);17;R"56":R"57":k[i].u+=j[i].F;17;R"5b":R"5c":k[i].B+=j[i].G;k[i].u+=j[i].F;17;R"5g":k[i].B+=(j[i].G/2);k[i].u+=j[i].F;17;R"5h":k[i].u+=(j[i].F/2);17}}e.B+=-1*(k.C.B-k[h].B);e.u+=-1*(k.C.u-k[h].u);o(l.N){c.s({B:e.B+"v",u:e.u+"v"})}L e}}})());r.2t();q 5k=5m.3q({2t:p(c,e){3.C=$(c);o(!3.C){3L("11: H 5o 5v, 5x 3q a 18.");L}r.1K(3.C);q a=(M.2B(e)||M.32(e)),b=a?1Z[2]||[]:e;3.1m=a?e:23;o(b.1R){b=M.10(M.29(11.31[b.1R]),b)}3.9=M.10(M.10({1h:V,1e:0,2Z:"#6l",1k:0,K:r.9.K,13:r.9.4n,1u:!(b.W&&b.W=="1P")?0.14:V,1o:V,1f:"1M",3Y:V,T:b.T,1a:b.T?{x:0,y:0}:{x:16,y:16},1D:(b.T&&!b.T.1t)?1d:V,W:"2D",D:V,1R:"2r",15:3.C,12:V,1A:(b.T&&!b.T.1t)?V:1d,G:V},11.31["2r"]),b);3.15=$(3.9.15);3.1k=3.9.1k;3.1e=(3.1k>3.9.1e)?3.1k:3.9.1e;o(3.9.U){3.U=3.9.U.4d("://")?3.9.U:r.U+3.9.U}Y{3.U=r.U+"3E/"+(3.9.1R||"")+"/"}o(!3.U.4L("/")){3.U+="/"}o(M.2B(3.9.D)){3.9.D={N:3.9.D}}o(3.9.D.N){3.9.D=M.10(M.29(11.31[3.9.1R].D)||{},3.9.D);3.9.D.N=[3.9.D.N.25(/[a-z]+/)[0].2e(),3.9.D.N.25(/[A-Z][a-z]+/)[0].2e()];3.9.D.1y=["B","3b"].4R(3.9.D.N[0])?"1c":"1g";3.1q={1c:V,1g:V}}o(3.9.1h){3.9.1h.9=M.10({2U:2W.4U},3.9.1h.9||{})}o(3.9.T.1t){q d=3.9.T.1l.25(/[a-z]+/)[0].2e();3.22=r.2b[d]+r.2b[3.9.T.1l.25(/[A-Z][a-z]+/)[0].2e()].2j()}3.3x=(r.2G&&3.1k);3.3y();r.3n(3);3.3z();11.10(3)},3y:p(){3.E=I H("P",{K:"1I"}).s({1n:r.9.1n});o(3.3x){3.E.S=p(){3.s("B:-3D;u:-3D;1F:2l;");L 3};3.E.O=p(){3.s("1F:19");L 3};3.E.19=p(){L(3.2R("1F")=="19"&&3u(3.2R("u").3a("v",""))>-5d)}}3.E.S();o(r.1i){3.1p=I H("5e",{K:"1p",1C:"3m:V;",5f:0}).s({2n:"27",1n:r.9.1n-1,5i:0})}o(3.9.1h){3.1Q=3.1Q.2P(3.2O)}3.1l=I H("P",{K:"1m"});3.12=I H("P",{K:"12"}).S();o(3.9.13||(3.9.1f.C&&3.9.1f.C=="13")){3.13=I H("P",{K:"2c"}).1U(3.U+"2c.2u")}},2v:p(){o(X.3l){3.2N();3.3V=1d;L 1d}Y{o(!3.3V){X.1b("3F:3l",3.2N);L V}}},2N:p(){$(X.2M).J(3.E);o(r.1i){$(X.2M).J(3.1p)}o(3.9.1h){$(X.2M).J(3.Q=I H("P",{K:"5E"}).1U(3.U+"Q.5H").S())}q g="E";o(3.9.D.N){3.D=I H("P",{K:"5I"}).s({F:3.9.D[3.9.D.1y=="1g"?"F":"G"]+"v"});q b=3.9.D.1y=="1c";3[g].J(3.2L=I H("P",{K:"5W 2z"}).J(3.40=I H("P",{K:"5Z 2z"})));3.D.J(3.1G=I H("P",{K:"67"}).s({F:3.9.D[b?"G":"F"]+"v",G:3.9.D[b?"F":"G"]+"v"}));o(r.1i&&!3.9.D.N[1].45().4d("6i")){3.1G.s({2n:"6j"})}g="40"}o(3.1e){q d=3.1e,f;3[g].J(3.1X=I H("6t",{K:"1X"}).J(3.1Y=I H("2J",{K:"1Y 38"}).s("F: "+d+"v").J(I H("P",{K:"2F 4o"}).J(I H("P",{K:"20"}))).J(f=I H("P",{K:"4q"}).s({F:d+"v"}).J(I H("P",{K:"4j"}).s({1x:"0 "+d+"v",F:d+"v"}))).J(I H("P",{K:"2F 4t"}).J(I H("P",{K:"20"})))).J(3.2H=I H("2J",{K:"2H 38"}).J(3.2I=I H("P",{K:"2I"}).s("2y: 0 "+d+"v"))).J(3.3p=I H("2J",{K:"3p 38"}).s("F: "+d+"v").J(I H("P",{K:"2F 4w"}).J(I H("P",{K:"20"}))).J(f.4x(1d)).J(I H("P",{K:"2F 4y"}).J(I H("P",{K:"20"})))));g="2I";q c=3.1X.2K(".20");$w("4A 4B 4C 4D").3r(p(j,h){o(3.1k>0){11.3s(c[h],j,{1J:3.9.2Z,1e:d,1k:3.9.1k})}Y{c[h].2w("3v")}c[h].s({G:d+"v",F:d+"v"}).2w("20"+j.2j())}.1j(3));3.1X.2K(".4j",".2H",".3v").1N("s",{1J:3.9.2Z})}3[g].J(3.18=I H("P",{K:"18 "+3.9.K}).J(3.1S=I H("P",{K:"1S"}).J(3.12)));o(3.9.G){q e=3.9.G;o(M.4K(e)){e+="v"}3.18.s("G:"+e)}o(3.D){q a={};a[3.9.D.1y=="1c"?"u":"1s"]=3.D;3.E.J(a);3.26()}3.18.J(3.1l);o(!3.9.1h){3.2Q({12:3.9.12,1m:3.1m})}},2Q:p(e){q a=3.E.2R("1F");3.E.s("F:1E;G:1E;1F:2l").O();o(3.1e){3.1Y.s("F:0");3.1Y.s("F:0")}o(e.12){3.12.O().3B(e.12);3.1S.O()}Y{o(!3.13){3.12.S();3.1S.S()}}o(M.32(e.1m)){e.1m.O()}o(M.2B(e.1m)||M.32(e.1m)){3.1l.3B(e.1m)}3.18.s({G:3.18.3C()+"v"});3.E.s("1F:19").O();3.18.O();q c=3.18.21(),b={G:c.G+"v"},d=[3.E];o(r.1i){d.28(3.1p)}o(3.13){3.12.O().J({u:3.13});3.1S.O()}o(e.12||3.13){3.1S.s("G: 2S%")}b.F=23;3.E.s({1F:a});3.1l.2w("2z");o(e.12||3.13){3.12.2w("2z")}o(3.1e){3.1Y.s("F:"+3.1e+"v");3.1Y.s("F:"+3.1e+"v");b="G: "+(c.G+2*3.1e)+"v";d.28(3.1X)}d.1N("s",b);o(3.D){3.26();o(3.9.D.1y=="1c"){3.E.s({G:3.E.3C()+3.9.D.F+"v"})}}3.E.S()},3z:p(){3.2T=3.1Q.1v(3);3.3G=3.S.1v(3);o(3.9.1D&&3.9.W=="2D"){3.9.W="2V"}o(3.9.W&&3.9.W==3.9.1f){3.1B=3.3J.1v(3);3.C.1b(3.9.W,3.1B)}o(3.13){3.13.1b("2V",p(d){d.1U(3.U+"4W.2u")}.1j(3,3.13)).1b("2X",p(d){d.1U(3.U+"2c.2u")}.1j(3,3.13))}q c={C:3.1B?[]:[3.C],15:3.1B?[]:[3.15],1l:3.1B?[]:[3.E],13:[],27:[]},a=3.9.1f.C;3.2Y=a||(!3.9.1f?"27":"C");3.1O=c[3.2Y];o(!3.1O&&a&&M.2B(a)){3.1O=3.1l.2K(a)}$w("O S").3r(p(g){q f=g.2j(),d=(3.9[g+"3M"].52||3.9[g+"3M"]);o(d=="2V"){d=="30"}Y{o(d=="2X"){d=="1M"}}3[g+"54"]=d}.1j(3));o(!3.1B&&3.9.W){3.C.1b(3.9.W,3.2T)}o(3.1O&&3.9.1f){3.1O.1N("1b",3.55,3.3G)}o(!3.9.1D&&3.9.W=="1P"){3.2C=3.N.1v(3);3.C.1b("2D",3.2C)}3.3P=3.S.2P(p(f,e){q d=e.58(".2c");o(d){d.59();e.5a();f(e)}}).1v(3);o(3.13||(3.9.1f&&(3.9.1f.C==".2c"))){3.E.1b("1P",3.3P)}o(3.9.W!="1P"&&(3.2Y!="C")){3.2m=p(){3.1z("O")}.1v(3);3.C.1b("1M",3.2m)}o(3.9.1f||3.9.1o){q b=[3.C,3.E];3.33=p(){r.2g(3);3.2o()}.1v(3);3.35=3.1o.1v(3);b.1N("1b","30",3.33).1N("1b","1M",3.35)}o(3.9.1h&&3.9.W!="1P"){3.2A=3.3W.1v(3);3.C.1b("1M",3.2A)}},3w:p(){o(3.9.W&&3.9.W==3.9.1f){3.C.1w(3.9.W,3.1B)}Y{o(3.9.W){3.C.1w(3.9.W,3.2T)}o(3.1O&&3.9.1f){3.1O.1N("1w")}}o(3.2C){3.C.1w("2D",3.2C)}o(3.2m){3.C.1w("2X",3.2m)}3.E.1w();o(3.9.1f||3.9.1o){3.C.1w("30",3.33).1w("1M",3.35)}o(3.2A){3.C.1w("1M",3.2A)}},2O:p(c,b){o(!3.18){o(!3.2v()){L}}3.N(b);o(3.2f){L}Y{o(3.3Z){c(b);L}}3.2f=1d;q e=b.5l(),d={2a:{1H:e.x,1L:e.y}};q a=M.29(3.9.1h.9);a.2U=a.2U.2P(p(g,f){3.2Q({12:3.9.12,1m:f.5p});3.N(d);(p(){g(f);q h=(3.Q&&3.Q.19());o(3.Q){3.1z("Q");3.Q.1K();3.Q=23}o(h){3.O()}3.3Z=1d;3.2f=23}.1j(3)).1u(0.6)}.1j(3));3.5q=H.O.1u(3.9.1u,3.Q);3.E.S();3.2f=1d;3.Q.O();3.5r=(p(){I 5s.5t(3.9.1h.3h,a)}.1j(3)).1u(3.9.1u);L V},3W:p(){3.1z("Q")},1Q:p(a){o(!3.18){o(!3.2v()){L}}3.N(a);o(3.E.19()){L}3.1z("O");3.5u=3.O.1j(3).1u(3.9.1u)},1z:p(a){o(3[a+"42"]){5w(3[a+"42"])}},O:p(){o(3.E.19()){L}o(r.1i){3.1p.O()}o(3.9.3Y){r.49()}r.3X(3);3.18.O();3.E.O();o(3.D){3.D.O()}3.C.43("1I:5y")},1o:p(a){o(3.9.1h){o(3.Q&&3.9.W!="1P"){3.Q.S()}}o(!3.9.1o){L}3.2o();3.5z=3.S.1j(3).1u(3.9.1o)},2o:p(){o(3.9.1o){3.1z("1o")}},S:p(){3.1z("O");3.1z("Q");o(!3.E.19()){L}3.44()},44:p(){o(r.1i){3.1p.S()}o(3.Q){3.Q.S()}3.E.S();(3.1X||3.18).O();r.34(3);3.C.43("1I:2l")},3J:p(a){o(3.E&&3.E.19()){3.S(a)}Y{3.1Q(a)}},26:p(){q c=3.9.D,b=1Z[0]||3.1q,d=r.39(c.N[0],b[c.1y]),f=r.39(c.N[1],b[r.2b[c.1y]]),a=3.1k||0;3.1G.1U(3.U+d+f+".2u");o(c.1y=="1c"){q e=(d=="B")?c.F:0;3.2L.s("B: "+e+"v;");3.1G.s({"2p":d});3.D.s({B:0,u:(f=="1s"?"2S%":f=="1T"?"50%":0),5C:(f=="1s"?-1*c.G:f=="1T"?-0.5*c.G:0)+(f=="1s"?-1*a:f=="u"?a:0)+"v"})}Y{3.2L.s(d=="u"?"1x: 0; 2y: "+c.F+"v 0 0 0;":"2y: 0; 1x: 0 0 "+c.F+"v 0;");3.D.s(d=="u"?"u: 0; 1s: 1E;":"u: 1E; 1s: 0;");3.1G.s({1x:0,"2p":f!="1T"?f:"27"});o(f=="1T"){3.1G.s("1x: 0 1E;")}Y{3.1G.s("1x-"+f+": "+a+"v;")}o(r.2G){o(d=="1s"){3.D.s({N:"46",5F:"5G",u:"1E",1s:"1E","2p":"B",G:"2S%",1x:(-1*c.F)+"v 0 0 0"});3.D.1R.2n="47"}Y{3.D.s({N:"48","2p":"27",1x:0})}}}3.1q=b},N:p(b){o(!3.18){o(!3.2v()){L}}r.2g(3);o(r.1i){q a=3.E.21();o(!3.2q||3.2q.F!=a.F||3.2q.G!=a.G){3.1p.s({G:a.G+"v",F:a.F+"v"})}3.2q=a}o(3.9.T){q j,h;o(3.22){q k=X.1A.2k(),c=b.2a||{};q g,i=2;4c(3.22.45()){R"5K":R"5L":g={x:0-i,y:0-i};17;R"5M":g={x:0,y:0-i};17;R"5N":R"5O":g={x:i,y:0-i};17;R"5P":g={x:i,y:0};17;R"5Q":R"5R":g={x:i,y:i};17;R"5S":g={x:0,y:i};17;R"5T":R"5U":g={x:0-i,y:i};17;R"5V":g={x:0-i,y:0};17}g.x+=3.9.1a.x;g.y+=3.9.1a.y;j=M.10({1a:g},{C:3.9.T.1l,22:3.22,1t:{u:c.1L||2x.1L(b)-k.u,B:c.1H||2x.1H(b)-k.B}});h=r.T(3.E,3.15,j);o(3.9.1A){q n=3.3g(h),m=n.1q;h=n.N;h.B+=m.1g?2*11.3c(g.x-3.9.1a.x):0;h.u+=m.1g?2*11.3c(g.y-3.9.1a.y):0;o(3.D&&(3.1q.1c!=m.1c||3.1q.1g!=m.1g)){3.26(m)}}h={B:h.B+"v",u:h.u+"v"};3.E.s(h)}Y{j=M.10({1a:3.9.1a},{C:3.9.T.1l,15:3.9.T.15});h=r.T(3.E,3.15,M.10({N:1d},j));h={B:h.B+"v",u:h.u+"v"}}o(3.Q){q e=r.T(3.Q,3.15,M.10({N:1d},j))}o(r.1i){3.1p.s(h)}}Y{q f=3.15.2h(),c=b.2a||{},h={B:((3.9.1D)?f[0]:c.1H||2x.1H(b))+3.9.1a.x,u:((3.9.1D)?f[1]:c.1L||2x.1L(b))+3.9.1a.y};o(!3.9.1D&&3.C!==3.15){q d=3.C.2h();h.B+=-1*(d[0]-f[0]);h.u+=-1*(d[1]-f[1])}o(!3.9.1D&&3.9.1A){q n=3.3g(h),m=n.1q;h=n.N;o(3.D&&(3.1q.1c!=m.1c||3.1q.1g!=m.1g)){3.26(m)}}h={B:h.B+"v",u:h.u+"v"};3.E.s(h);o(3.Q){3.Q.s(h)}o(r.1i){3.1p.s(h)}}},3g:p(c){q e={1c:V,1g:V},d=3.E.21(),b=X.1A.2k(),a=X.1A.21(),g={B:"G",u:"F"};1V(q f 4a g){o((c[f]+d[g[f]]-b[f])>a[g[f]]){c[f]=c[f]-(d[g[f]]+(2*3.9.1a[f=="B"?"x":"y"]));o(3.D){e[r.3R[g[f]]]=1d}}}L{N:c,1q:e}}});M.10(11,{3s:p(d,g){q j=1Z[2]||3.9,f=j.1k,c=j.1e,e={u:(g.4e(0)=="t"),B:(g.4e(1)=="l")};o(3.37.24){q b=I H("24",{K:"61"+g.2j(),G:c+"v",F:c+"v"});d.J(b);q i=b.3T("2d");i.62=j.1J;i.63((e.B?f:c-f),(e.u?f:c-f),f,0,64.65*2,1d);i.66();i.4f((e.B?f:0),0,c-f,c);i.4f(0,(e.u?f:0),c,c-f)}Y{q h;d.J(h=I H("P").s({G:c+"v",F:c+"v",1x:0,2y:0,2n:"47",N:"46",68:"2l"}));q a=I H("2i:69",{6a:j.1J,6b:"6c",6d:j.1J,6e:(f/c*0.5).6f(2)}).s({G:2*c-1+"v",F:2*c-1+"v",N:"48",B:(e.B?0:(-1*c))+"v",u:(e.u?0:(-1*c))+"v"});h.J(a);a.4g=a.4g}}});H.6h({1U:p(c,b){c=$(c);q a=M.10({4h:"u B",3i:"6k-3i",3j:"6m",1J:""},1Z[2]||{});c.s(r.1i?{6n:"6o:6p.6q.6r(1C=\'"+b+"\'\', 3j=\'"+a.3j+"\')"}:{6s:a.1J+" 3h("+b+") "+a.4h+" "+a.3i});L c}});11.3k={4l:p(a){o(a.C&&!a.C.3O){L 1d}L V},O:p(){o(11.3k.4l(3)){L}r.2g(3);3.2o();q d={};o(3.9.T){d.2a={1H:0,1L:0}}Y{q a=3.15.2h(),c=3.15.3N(),b=X.1A.2k();a.B+=(-1*(c[0]-b[0]));a.u+=(-1*(c[1]-b[1]));d.2a={1H:a.B,1L:a.u}}o(3.9.1h){3.2O(d)}Y{3.1Q(d)}3.1o()}};11.10=p(a){a.C.1I={};M.10(a.C.1I,{O:11.3k.O.1j(a),S:a.S.1j(a),1K:r.1K.1j(r,a.C)})};11.41();',62,404,'|||this||||||options|||||||||||||||if|function|var|Tips|setStyle||top|px||||||left|element|stem|wrapper|height|width|Element|new|insert|className|return|Object|position|show|div|loader|case|hide|hook|images|false|showOn|document|else||extend|Prototip|title|closeButton||target||break|tooltip|visible|offset|observe|horizontal|true|border|hideOn|vertical|ajax|fixIE|bind|radius|tip|content|zIndex|hideAfter|iframeShim|stemInverse|tips|bottom|mouse|delay|bindAsEventListener|stopObserving|margin|orientation|clearTimer|viewport|eventToggle|src|fixed|auto|visibility|stemImage|pointerX|prototip|backgroundColor|remove|pointerY|mouseleave|invoke|hideTargets|click|showDelayed|style|toolbar|middle|setPngBackground|for|length|borderFrame|borderTop|arguments|prototip_Corner|getDimensions|mouseHook|null|canvas|match|positionStem|none|push|clone|fakePointer|_inverse|close||toLowerCase|ajaxContentLoading|raise|cumulativeOffset|ns_vml|capitalize|getScrollOffsets|hidden|eventCheckDelay|display|cancelHideAfter|float|iframeShimDimensions|default|zIndexTop|initialize|png|build|addClassName|Event|padding|clearfix|ajaxHideEvent|isString|eventPosition|mousemove|script|prototip_CornerWrapper|WebKit419|borderMiddle|borderCenter|li|select|stemWrapper|body|_build|ajaxShow|wrap|_update|getStyle|100|eventShow|onComplete|mouseover|Prototype|mouseout|hideElement|borderColor|mouseenter|Styles|isElement|activityEnter|removeVisible|activityLeave|path|support|borderRow|inverseStem|replace|right|toggleInt|convertVersionString|unload|window|getPositionWithinViewport|url|repeat|sizingMethod|Methods|loaded|javascript|add|js|borderBottom|create|each|createCorner|removeAll|parseFloat|prototip_Fill|deactivate|fixSafari2|setup|activate|text|update|getWidth|9500px|styles|dom|eventHide|namespaces|insertScript|toggle|REQUIRED_|throw|On|cumulativeScrollOffset|parentNode|buttonEvent|_|_stemTranslation|_highest|getContext|without|_isBuilding|ajaxHide|addVisibile|hideOthers|ajaxContentLoaded|stemBox|start|Timer|fire|afterHide|toUpperCase|relative|block|absolute|hideAll|in|require|switch|include|charAt|fillRect|outerHTML|align|type|prototip_Between|VML|hold|requires|closeButtons|prototip_CornerWrapperTopLeft|catch|prototip_BetweenCorners|test|parseInt|prototip_CornerWrapperTopRight|times|try|prototip_CornerWrapperBottomLeft|cloneNode|prototip_CornerWrapperBottomRight|indexOf|tl|tr|bl|br|head|RegExp|MSIE|exec|abs|find|isNumber|endsWith|navigator|userAgent|documentMode|Browser|WebKit|member|REQUIRED_Prototype|evaluate|emptyFunction|createStyleSheet|close_hover|topRight|rightTop|cssText||topMiddle|event|rightMiddle|Action|hideAction|bottomLeft|leftBottom|findElement|blur|stop|bottomRight|rightBottom|9500|iframe|frameBorder|bottomMiddle|leftMiddle|opacity|behavior|Tip|pointer|Class|write|not|responseText|loaderTimer|ajaxTimer|Ajax|Request|showTimer|available|clearTimeout|cannot|shown|hideAfterTimer|vml|https|marginTop|urn|prototipLoader|clear|both|gif|prototip_Stem|typeof|LEFTTOP|TOPLEFT|TOPMIDDLE|TOPRIGHT|RIGHTTOP|RIGHTMIDDLE|RIGHTBOTTOM|BOTTOMRIGHT|BOTTOMMIDDLE|BOTTOMLEFT|LEFTBOTTOM|LEFTMIDDLE|prototip_StemWrapper|undefined|schemas|prototip_StemBox|Version|cornerCanvas|fillStyle|arc|Math|PI|fill|prototip_StemImage|overflow|roundrect|fillcolor|strokeWeight|1px|strokeColor|arcSize|toFixed|microsoft|addMethods|MIDDLE|inline|no|000000|scale|filter|progid|DXImageTransform|Microsoft|AlphaImageLoader|background|ul|createElement|com'.split('|'),0,{}));
Prototip.Styles={'default':{border:6,borderColor:'#c7c7c7',className:'default',closeButton:false,hideAfter:false,hideOn:'mouseleave',hook:false,radius:6,showOn:'mousemove',stem:{height:12,width:15}},'protoblue':{className:'protoblue',border:6,borderColor:'#116497',radius:6,stem:{height:12,width:15}},'darkgrey':{className:'darkgrey',border:6,borderColor:'#363636',radius:6,stem:{height:12,width:15}},'creamy':{className:'creamy',border:6,borderColor:'#ebe4b4',radius:6,stem:{height:12,width:15}},'protogrey':{className:'protogrey',border:6,borderColor:'#606060',radius:6,stem:{height:12,width:15}}};
