| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309 | // * date 2011/10/19 */*** misc*/// ------ TRACE ------function trace(s,o){  if(window.console && window.console.debug){    arguments.length === 2 ? window.console.debug(s,o) : window.console.debug(s);  }else if(window.console && window.console.log){    arguments.length === 2 ? window.console.log(s,o) : window.console.log(s);  }};// ------ LOADJSCSSFILE ------function loadjscssfile(filename, filetype){ if (filetype=="js"){ //if filename is a external JavaScript file  var fileref=document.createElement('script')  fileref.setAttribute("type","text/javascript")  fileref.setAttribute("src", filename) } else if (filetype=="css"){ //if filename is an external CSS file  var fileref=document.createElement("link")  fileref.setAttribute("rel", "stylesheet")  fileref.setAttribute("type", "text/css")  fileref.setAttribute("href", filename) } if (typeof fileref!="undefined")  document.getElementsByTagName("head")[0].appendChild(fileref)}// ------ TIMEOUTfunction Timeout(fn, interval) {    var id = setTimeout(fn, interval);    this.cleared = false;    this.clear = function () {        this.cleared = true;        clearTimeout(id);    };}// ------ HEXTORGB convert hex to rgb color ------function HexToRGB(h){	if(h.charAt(0)=="#"){		var coul = h.substring(1,7);		var r = parseInt(coul.substring(0,2),16);		var g = parseInt(coul.substring(2,4),16);		var b = parseInt(coul.substring(4,6),16);		return 'rgb('+r+', '+g+', '+b+')';	}else{		return null;		}}// ------ PAIR check if number is pair of impair ------function pair(n){return typeof n=='number'?(n%2==0?true:false):null;}// ------ RANDOM ------function random(n1,n2){	return arguments.length === 1 && typeof n1 === 'number'? Math.random()*n1 : ( arguments.length === 2 && typeof n1 === typeof n2 && typeof n1 === 'number' ? n1 + Math.random()*(n2-n1) : NaN );}function randomInt(n1,n2){	var rand = arguments.length === 1 && typeof n1 === 'number'? Math.random()*n1 : ( arguments.length === 2 && typeof n1 === typeof n2 && typeof n1 === 'number' ? n1 + Math.random()*(n2-n1) : NaN );	return parseInt(rand);}// ------ ROUNDED ------function round(n,granularity){	if(arguments.length == 1){		n = Math.round(n);	}else{		granularity = granularity.toString();		granularity = granularity.replace(/./gi, 0);		granularity = granularity.replace(/^./gi, 1);		granularity = parseInt(granularity);		n = Math.round(n*granularity)/granularity;	}	return n;}// ------ FLOOR ------function floor(n,granularity){	if(arguments.length == 1){		n = Math.floor(n);	}else{		granularity = granularity.toString();		granularity = granularity.replace(/./gi, 0);		granularity = granularity.replace(/^./gi, 1);		granularity = parseInt(granularity);		n = Math.floor(n*granularity)/granularity;	}	return n;}// ------ CEIL ------function ceil(n,granularity){	if(arguments.length == 1){		n = Math.ceil(n);	}else{		granularity = granularity.toString();		granularity = granularity.replace(/./gi, 0);		granularity = granularity.replace(/^./gi, 1);		granularity = parseInt(granularity);		n = Math.ceil(n*granularity)/granularity;	}	return n;}/*** String*/// ------ TRIM remove multiple, leading or trailing spaces ------String.prototype.trim = function() {	return this.replace(/(^\s*)|(\s*$)/gi,"").replace(/[ ]{2,}/gi," ").replace(/\n /,"\n");}// ------ remove all accents, for sort() by example ------var Latinise={};Latinise.latin_map={"Á":"A","Ă":"A","Ắ":"A","Ặ":"A","Ằ":"A","Ẳ":"A","Ẵ":"A","Ǎ":"A","Â":"A","Ấ":"A","Ậ":"A","Ầ":"A","Ẩ":"A","Ẫ":"A","Ä":"A","Ǟ":"A","Ȧ":"A","Ǡ":"A","Ạ":"A","Ȁ":"A","À":"A","Ả":"A","Ȃ":"A","Ā":"A","Ą":"A","Å":"A","Ǻ":"A","Ḁ":"A","Ⱥ":"A","Ã":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ḃ":"B","Ḅ":"B","Ɓ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ć":"C","Č":"C","Ç":"C","Ḉ":"C","Ĉ":"C","Ċ":"C","Ƈ":"C","Ȼ":"C","Ď":"D","Ḑ":"D","Ḓ":"D","Ḋ":"D","Ḍ":"D","Ɗ":"D","Ḏ":"D","Dz":"D","Dž":"D","Đ":"D","Ƌ":"D","DZ":"DZ","DŽ":"DZ","É":"E","Ĕ":"E","Ě":"E","Ȩ":"E","Ḝ":"E","Ê":"E","Ế":"E","Ệ":"E","Ề":"E","Ể":"E","Ễ":"E","Ḙ":"E","Ë":"E","Ė":"E","Ẹ":"E","Ȅ":"E","È":"E","Ẻ":"E","Ȇ":"E","Ē":"E","Ḗ":"E","Ḕ":"E","Ę":"E","Ɇ":"E","Ẽ":"E","Ḛ":"E","Ꝫ":"ET","Ḟ":"F","Ƒ":"F","Ǵ":"G","Ğ":"G","Ǧ":"G","Ģ":"G","Ĝ":"G","Ġ":"G","Ɠ":"G","Ḡ":"G","Ǥ":"G","Ḫ":"H","Ȟ":"H","Ḩ":"H","Ĥ":"H","Ⱨ":"H","Ḧ":"H","Ḣ":"H","Ḥ":"H","Ħ":"H","Í":"I","Ĭ":"I","Ǐ":"I","Î":"I","Ï":"I","Ḯ":"I","İ":"I","Ị":"I","Ȉ":"I","Ì":"I","Ỉ":"I","Ȋ":"I","Ī":"I","Į":"I","Ɨ":"I","Ĩ":"I","Ḭ":"I","Ꝺ":"D","Ꝼ":"F","Ᵹ":"G","Ꞃ":"R","Ꞅ":"S","Ꞇ":"T","Ꝭ":"IS","Ĵ":"J","Ɉ":"J","Ḱ":"K","Ǩ":"K","Ķ":"K","Ⱪ":"K","Ꝃ":"K","Ḳ":"K","Ƙ":"K","Ḵ":"K","Ꝁ":"K","Ꝅ":"K","Ĺ":"L","Ƚ":"L","Ľ":"L","Ļ":"L","Ḽ":"L","Ḷ":"L","Ḹ":"L","Ⱡ":"L","Ꝉ":"L","Ḻ":"L","Ŀ":"L","Ɫ":"L","Lj":"L","Ł":"L","LJ":"LJ","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ń":"N","Ň":"N","Ņ":"N","Ṋ":"N","Ṅ":"N","Ṇ":"N","Ǹ":"N","Ɲ":"N","Ṉ":"N","Ƞ":"N","Nj":"N","Ñ":"N","NJ":"NJ","Ó":"O","Ŏ":"O","Ǒ":"O","Ô":"O","Ố":"O","Ộ":"O","Ồ":"O","Ổ":"O","Ỗ":"O","Ö":"O","Ȫ":"O","Ȯ":"O","Ȱ":"O","Ọ":"O","Ő":"O","Ȍ":"O","Ò":"O","Ỏ":"O","Ơ":"O","Ớ":"O","Ợ":"O","Ờ":"O","Ở":"O","Ỡ":"O","Ȏ":"O","Ꝋ":"O","Ꝍ":"O","Ō":"O","Ṓ":"O","Ṑ":"O","Ɵ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Õ":"O","Ṍ":"O","Ṏ":"O","Ȭ":"O","Ƣ":"OI","Ꝏ":"OO","Ɛ":"E","Ɔ":"O","Ȣ":"OU","Ṕ":"P","Ṗ":"P","Ꝓ":"P","Ƥ":"P","Ꝕ":"P","Ᵽ":"P","Ꝑ":"P","Ꝙ":"Q","Ꝗ":"Q","Ŕ":"R","Ř":"R","Ŗ":"R","Ṙ":"R","Ṛ":"R","Ṝ":"R","Ȑ":"R","Ȓ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꜿ":"C","Ǝ":"E","Ś":"S","Ṥ":"S","Š":"S","Ṧ":"S","Ş":"S","Ŝ":"S","Ș":"S","Ṡ":"S","Ṣ":"S","Ṩ":"S","Ť":"T","Ţ":"T","Ṱ":"T","Ț":"T","Ⱦ":"T","Ṫ":"T","Ṭ":"T","Ƭ":"T","Ṯ":"T","Ʈ":"T","Ŧ":"T","Ɐ":"A","Ꞁ":"L","Ɯ":"M","Ʌ":"V","Ꜩ":"TZ","Ú":"U","Ŭ":"U","Ǔ":"U","Û":"U","Ṷ":"U","Ü":"U","Ǘ":"U","Ǚ":"U","Ǜ":"U","Ǖ":"U","Ṳ":"U","Ụ":"U","Ű":"U","Ȕ":"U","Ù":"U","Ủ":"U","Ư":"U","Ứ":"U","Ự":"U","Ừ":"U","Ử":"U","Ữ":"U","Ȗ":"U","Ū":"U","Ṻ":"U","Ų":"U","Ů":"U","Ũ":"U","Ṹ":"U","Ṵ":"U","Ꝟ":"V","Ṿ":"V","Ʋ":"V","Ṽ":"V","Ꝡ":"VY","Ẃ":"W","Ŵ":"W","Ẅ":"W","Ẇ":"W","Ẉ":"W","Ẁ":"W","Ⱳ":"W","Ẍ":"X","Ẋ":"X","Ý":"Y","Ŷ":"Y","Ÿ":"Y","Ẏ":"Y","Ỵ":"Y","Ỳ":"Y","Ƴ":"Y","Ỷ":"Y","Ỿ":"Y","Ȳ":"Y","Ɏ":"Y","Ỹ":"Y","Ź":"Z","Ž":"Z","Ẑ":"Z","Ⱬ":"Z","Ż":"Z","Ẓ":"Z","Ȥ":"Z","Ẕ":"Z","Ƶ":"Z","IJ":"IJ","Œ":"OE","ᴀ":"A","ᴁ":"AE","ʙ":"B","ᴃ":"B","ᴄ":"C","ᴅ":"D","ᴇ":"E","ꜰ":"F","ɢ":"G","ʛ":"G","ʜ":"H","ɪ":"I","ʁ":"R","ᴊ":"J","ᴋ":"K","ʟ":"L","ᴌ":"L","ᴍ":"M","ɴ":"N","ᴏ":"O","ɶ":"OE","ᴐ":"O","ᴕ":"OU","ᴘ":"P","ʀ":"R","ᴎ":"N","ᴙ":"R","ꜱ":"S","ᴛ":"T","ⱻ":"E","ᴚ":"R","ᴜ":"U","ᴠ":"V","ᴡ":"W","ʏ":"Y","ᴢ":"Z","á":"a","ă":"a","ắ":"a","ặ":"a","ằ":"a","ẳ":"a","ẵ":"a","ǎ":"a","â":"a","ấ":"a","ậ":"a","ầ":"a","ẩ":"a","ẫ":"a","ä":"a","ǟ":"a","ȧ":"a","ǡ":"a","ạ":"a","ȁ":"a","à":"a","ả":"a","ȃ":"a","ā":"a","ą":"a","ᶏ":"a","ẚ":"a","å":"a","ǻ":"a","ḁ":"a","ⱥ":"a","ã":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ḃ":"b","ḅ":"b","ɓ":"b","ḇ":"b","ᵬ":"b","ᶀ":"b","ƀ":"b","ƃ":"b","ɵ":"o","ć":"c","č":"c","ç":"c","ḉ":"c","ĉ":"c","ɕ":"c","ċ":"c","ƈ":"c","ȼ":"c","ď":"d","ḑ":"d","ḓ":"d","ȡ":"d","ḋ":"d","ḍ":"d","ɗ":"d","ᶑ":"d","ḏ":"d","ᵭ":"d","ᶁ":"d","đ":"d","ɖ":"d","ƌ":"d","ı":"i","ȷ":"j","ɟ":"j","ʄ":"j","dz":"dz","dž":"dz","é":"e","ĕ":"e","ě":"e","ȩ":"e","ḝ":"e","ê":"e","ế":"e","ệ":"e","ề":"e","ể":"e","ễ":"e","ḙ":"e","ë":"e","ė":"e","ẹ":"e","ȅ":"e","è":"e","ẻ":"e","ȇ":"e","ē":"e","ḗ":"e","ḕ":"e","ⱸ":"e","ę":"e","ᶒ":"e","ɇ":"e","ẽ":"e","ḛ":"e","ꝫ":"et","ḟ":"f","ƒ":"f","ᵮ":"f","ᶂ":"f","ǵ":"g","ğ":"g","ǧ":"g","ģ":"g","ĝ":"g","ġ":"g","ɠ":"g","ḡ":"g","ᶃ":"g","ǥ":"g","ḫ":"h","ȟ":"h","ḩ":"h","ĥ":"h","ⱨ":"h","ḧ":"h","ḣ":"h","ḥ":"h","ɦ":"h","ẖ":"h","ħ":"h","ƕ":"hv","í":"i","ĭ":"i","ǐ":"i","î":"i","ï":"i","ḯ":"i","ị":"i","ȉ":"i","ì":"i","ỉ":"i","ȋ":"i","ī":"i","į":"i","ᶖ":"i","ɨ":"i","ĩ":"i","ḭ":"i","ꝺ":"d","ꝼ":"f","ᵹ":"g","ꞃ":"r","ꞅ":"s","ꞇ":"t","ꝭ":"is","ǰ":"j","ĵ":"j","ʝ":"j","ɉ":"j","ḱ":"k","ǩ":"k","ķ":"k","ⱪ":"k","ꝃ":"k","ḳ":"k","ƙ":"k","ḵ":"k","ᶄ":"k","ꝁ":"k","ꝅ":"k","ĺ":"l","ƚ":"l","ɬ":"l","ľ":"l","ļ":"l","ḽ":"l","ȴ":"l","ḷ":"l","ḹ":"l","ⱡ":"l","ꝉ":"l","ḻ":"l","ŀ":"l","ɫ":"l","ᶅ":"l","ɭ":"l","ł":"l","lj":"lj","ſ":"s","ẜ":"s","ẛ":"s","ẝ":"s","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ᵯ":"m","ᶆ":"m","ń":"n","ň":"n","ņ":"n","ṋ":"n","ȵ":"n","ṅ":"n","ṇ":"n","ǹ":"n","ɲ":"n","ṉ":"n","ƞ":"n","ᵰ":"n","ᶇ":"n","ɳ":"n","ñ":"n","nj":"nj","ó":"o","ŏ":"o","ǒ":"o","ô":"o","ố":"o","ộ":"o","ồ":"o","ổ":"o","ỗ":"o","ö":"o","ȫ":"o","ȯ":"o","ȱ":"o","ọ":"o","ő":"o","ȍ":"o","ò":"o","ỏ":"o","ơ":"o","ớ":"o","ợ":"o","ờ":"o","ở":"o","ỡ":"o","ȏ":"o","ꝋ":"o","ꝍ":"o","ⱺ":"o","ō":"o","ṓ":"o","ṑ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","õ":"o","ṍ":"o","ṏ":"o","ȭ":"o","ƣ":"oi","ꝏ":"oo","ɛ":"e","ᶓ":"e","ɔ":"o","ᶗ":"o","ȣ":"ou","ṕ":"p","ṗ":"p","ꝓ":"p","ƥ":"p","ᵱ":"p","ᶈ":"p","ꝕ":"p","ᵽ":"p","ꝑ":"p","ꝙ":"q","ʠ":"q","ɋ":"q","ꝗ":"q","ŕ":"r","ř":"r","ŗ":"r","ṙ":"r","ṛ":"r","ṝ":"r","ȑ":"r","ɾ":"r","ᵳ":"r","ȓ":"r","ṟ":"r","ɼ":"r","ᵲ":"r","ᶉ":"r","ɍ":"r","ɽ":"r","ↄ":"c","ꜿ":"c","ɘ":"e","ɿ":"r","ś":"s","ṥ":"s","š":"s","ṧ":"s","ş":"s","ŝ":"s","ș":"s","ṡ":"s","ṣ":"s","ṩ":"s","ʂ":"s","ᵴ":"s","ᶊ":"s","ȿ":"s","ɡ":"g","ᴑ":"o","ᴓ":"o","ᴝ":"u","ť":"t","ţ":"t","ṱ":"t","ț":"t","ȶ":"t","ẗ":"t","ⱦ":"t","ṫ":"t","ṭ":"t","ƭ":"t","ṯ":"t","ᵵ":"t","ƫ":"t","ʈ":"t","ŧ":"t","ᵺ":"th","ɐ":"a","ᴂ":"ae","ǝ":"e","ᵷ":"g","ɥ":"h","ʮ":"h","ʯ":"h","ᴉ":"i","ʞ":"k","ꞁ":"l","ɯ":"m","ɰ":"m","ᴔ":"oe","ɹ":"r","ɻ":"r","ɺ":"r","ⱹ":"r","ʇ":"t","ʌ":"v","ʍ":"w","ʎ":"y","ꜩ":"tz","ú":"u","ŭ":"u","ǔ":"u","û":"u","ṷ":"u","ü":"u","ǘ":"u","ǚ":"u","ǜ":"u","ǖ":"u","ṳ":"u","ụ":"u","ű":"u","ȕ":"u","ù":"u","ủ":"u","ư":"u","ứ":"u","ự":"u","ừ":"u","ử":"u","ữ":"u","ȗ":"u","ū":"u","ṻ":"u","ų":"u","ᶙ":"u","ů":"u","ũ":"u","ṹ":"u","ṵ":"u","ᵫ":"ue","ꝸ":"um","ⱴ":"v","ꝟ":"v","ṿ":"v","ʋ":"v","ᶌ":"v","ⱱ":"v","ṽ":"v","ꝡ":"vy","ẃ":"w","ŵ":"w","ẅ":"w","ẇ":"w","ẉ":"w","ẁ":"w","ⱳ":"w","ẘ":"w","ẍ":"x","ẋ":"x","ᶍ":"x","ý":"y","ŷ":"y","ÿ":"y","ẏ":"y","ỵ":"y","ỳ":"y","ƴ":"y","ỷ":"y","ỿ":"y","ȳ":"y","ẙ":"y","ɏ":"y","ỹ":"y","ź":"z","ž":"z","ẑ":"z","ʑ":"z","ⱬ":"z","ż":"z","ẓ":"z","ȥ":"z","ẕ":"z","ᵶ":"z","ᶎ":"z","ʐ":"z","ƶ":"z","ɀ":"z","ff":"ff","ffi":"ffi","ffl":"ffl","fi":"fi","fl":"fl","ij":"ij","œ":"oe","st":"st","ₐ":"a","ₑ":"e","ᵢ":"i","ⱼ":"j","ₒ":"o","ᵣ":"r","ᵤ":"u","ᵥ":"v","ₓ":"x"};String.prototype.latinise=function(){return this.replace(/[^A-Za-z0-9\[\] ]/g,function(a){return Latinise.latin_map[a]||a})};String.prototype.latinize=String.prototype.latinise;String.prototype.isLatin=function(){return this==this.latinise()}/*** Array*/// ------ UNIQUE reduces duplicates ------array_unique = function(ar){	var r = new Array();	o:for(var i = 0, n = ar.length; i < n; i++)	{		for(var x = 0, y = r.length; x < y; x++)		{			if(r[x]==ar[i])			{				continue o;			}		}		r[r.length] = ar[i];	}	return r;};// ------ SUBSTRACT substract two array ------array_subtract = function(ara1,ara2) {  var aRes = new Array() ;  for (var i = ara1.length-1; i >= 0; i--)    if(array_contains(ara2,ara1[i]))      aRes.push(ara1[i]);  return aRes ;}/*			SHUFFLE Add a shuffle function to Array object prototype		author: Stephane Roucheray		src: http://sroucheray.org/blog/2009/11/array-sort-should-not-be-used-to-shuffle-an-array/		found 2011/09/08.*/array_shuffle = function(ar){    var i = ar.length, j, temp;    if ( i == 0 ) return;    while ( --i ) {        j = Math.floor( Math.random() * ( i + 1 ) );        temp = ar[i];        ar[i] = ar[j];        ar[j] = temp;    }    return ar;};// ------ CONTAINS ------array_contains = function(ar, obj) {    var i = ar.length;    while (i--)        if (ar[i] === obj)            return true;    return false;};// ------ REMOVE ------// /!\	Found on the Internet, not sure of efficiency.// Array.prototype.remove = function(v) {//     var x, _i, _len, _results;//     _results = [];//     for (_i = 0, _len = this.length; _i < _len; _i++) {//         x = this[_i];//         if (x !== v) {//             _results.push(x);//         }//     }//     return _results;// };array_remove = function(ar){    var what, a= arguments, L= a.length, ax;    while(L && ar.length){        what= a[--L];        while((ax= ar.indexOf(what))!= -1){            ar.splice(ax, 1);        }    }    return ar;};// for IE// if(!Array.prototype.indexOf){//     Array.prototype.indexOf= function(what, i){//         i= i || 0;//         var L= this.length;//         while(i< L){//             if(this[i]=== what) return i;//             ++i;//         }//         return -1;//     };// }array_indexOf = function(ar, what, i){    i= i || 0;    var L= ar.length;    while(i< L){        if(ar[i]=== what) return i;        ++i;    }    return -1;};// ------ SUBSTRACT substract two array ------function array_subtract(ara1,ara2) {  var aRes = new Array() ;  for (var i = ara1.length-1; i >= 0; i--)    if( !array_contains(ara1[i],ara2) )      aRes.push(ara1[i]);  return aRes ;};/*** Objects**/// ------ OBJECTSIZE get the length of objects ------function objectSize(o) {	var len = o.length ? --o.length : 0;	for (var k in o)		len++;	return len;}// Object.prototype.size = function () {// 	// var len = this.length ? --this.length : -1; // POURQUOI NE FONCTIONNE PAS?// 	var len = this.length ? --this.length : -2;// 	for (var k in this)// 		len++;// 	return len;// }function objectIsEmpty(obj){	for (var prop in obj) {		if (obj.hasOwnProperty(prop))			return false;	}	return true;};// ------ OBJECTGETKEY get key of index ------function objectGetKey(o,index){	var i = 0;	for (var k in o){		if (k === 'length' || !o.hasOwnProperty(k)) 			continue;		if(i == index) 			return k;		i ++;	}}// Object.prototype.getKey = function(index){// 	var i = 0;// 	for (var key in this){// 		if (key === 'length' || !this.hasOwnProperty(key)) // 			continue;// 		if(i == index) // 			return key;// 		i ++;// 	}// }// ------ OBJECTSORT sort object ------function objectSort(o,value) {    var connection = new Array();	for (var i = objectSize(o) - 1; i >= 0; i--){		var k = objectGetKey(o,i);		for (var j = objectSize(o[k].wit) - 1; j >= 0; j--){			var k2 = objectGetKey(o[k].wit,j);			if (k2==value) {				var the_wit = parseFloat(o[k].wit[k2]);				connection.push( {wit:the_wit,nid:k} );			};		};	};	connection.sort(function(a,b){		// return (a.wit - b.wit);//ascending		return (b.wit - a.wit);//descending	});	var o_sort = {};	for (var i = connection.length - 1; i >= 0; i--){		// o_sort[connection[i].wit+'-'+connection[i].nid] = o[connection[i].nid];		o_sort[connection[i].nid] = o[connection[i].nid];	};	return o_sort;}/*** trigo*/// -------- getElementAngle ----------// L'angle 0 correspond au nord (vers le haut)// Exemple : getElementAngle(posElementX, posElementY, posSourisX, posSourisY)//			 Ceci retournera l'angle de l'élément par rapport à la position de la sourisfunction getElementAngle(x1, y1, x2, y2) {	var adj = x2 - x1;	var opp = y2 - y1;		var angle = Math.abs(Math.atan(opp/adj) * 180/Math.PI);		if (adj > 0 && opp < 0 ) {		angle = 90 - angle;	}	else if (adj >= 0 && opp >= 0) {		angle += 90;	}	else if (adj < 0 && opp >= 0) {		angle = 180 + (90 - angle);	}	else {		angle += 270;	}		return angle;}// * date 2011/10/19 */*** misc*/// ------ TRACE ------function trace(s,o){  if(window.console && window.console.debug){    arguments.length === 2 ? window.console.debug(s,o) : window.console.debug(s);  }else if(console && console.log){    arguments.length === 2 ? console.log(s,o) : console.log(s);  }};// ------ LOADJSCSSFILE ------function loadjscssfile(filename, filetype){ if (filetype=="js"){ //if filename is a external JavaScript file  var fileref=document.createElement('script')  fileref.setAttribute("type","text/javascript")  fileref.setAttribute("src", filename) } else if (filetype=="css"){ //if filename is an external CSS file  var fileref=document.createElement("link")  fileref.setAttribute("rel", "stylesheet")  fileref.setAttribute("type", "text/css")  fileref.setAttribute("href", filename) } if (typeof fileref!="undefined")  document.getElementsByTagName("head")[0].appendChild(fileref)};// ------ TIMEOUTfunction Timeout(fn, interval) {    var id = setTimeout(fn, interval);    this.cleared = false;    this.clear = function () {        this.cleared = true;        clearTimeout(id);    };}// ------ HEXTORGB convert hex to rgb color ------function HexToRGB(h){	if(h.charAt(0)=="#"){		var coul = h.substring(1,7);		var r = parseInt(coul.substring(0,2),16);		var g = parseInt(coul.substring(2,4),16);		var b = parseInt(coul.substring(4,6),16);		return 'rgb('+r+', '+g+', '+b+')';	}else{		return null;		}}// ------ PAIR check if number is pair of impair ------function pair(n){return typeof n=='number'?(n%2==0?true:false):null;}// ------ RANDOM ------function random(n1,n2){	return arguments.length === 1 && typeof n1 === 'number'? Math.random()*n1 : ( arguments.length === 2 && typeof n1 === typeof n2 && typeof n1 === 'number' ? n1 + Math.random()*(n2-n1) : NaN );}function randomInt(n1,n2){	var rand = arguments.length === 1 && typeof n1 === 'number'? Math.random()*n1 : ( arguments.length === 2 && typeof n1 === typeof n2 && typeof n1 === 'number' ? n1 + Math.random()*(n2-n1) : NaN );	return parseInt(rand);}// ------ ROUNDED ------function round(n,granularity){	if(arguments.length == 1){		n = Math.round(n);	}else{		granularity = granularity.toString();		granularity = granularity.replace(/./gi, 0);		granularity = granularity.replace(/^./gi, 1);		granularity = parseInt(granularity);		n = Math.round(n*granularity)/granularity;	}	return n;}// ------ FLOOR ------function floor(n,granularity){	if(arguments.length == 1){		n = Math.floor(n);	}else{		granularity = granularity.toString();		granularity = granularity.replace(/./gi, 0);		granularity = granularity.replace(/^./gi, 1);		granularity = parseInt(granularity);		n = Math.floor(n*granularity)/granularity;	}	return n;}// ------ CEIL ------function ceil(n,granularity){	if(arguments.length == 1){		n = Math.ceil(n);	}else{		granularity = granularity.toString();		granularity = granularity.replace(/./gi, 0);		granularity = granularity.replace(/^./gi, 1);		granularity = parseInt(granularity);		n = Math.ceil(n*granularity)/granularity;	}	return n;}/*** String*/// ------ TRIM remove multiple, leading or trailing spaces ------String.prototype.trim = function() {	return this.replace(/(^\s*)|(\s*$)/gi,"").replace(/[ ]{2,}/gi," ").replace(/\n /,"\n");}// ------ remove all accents, for sort() by example ------var Latinise={};Latinise.latin_map={"Á":"A","Ă":"A","Ắ":"A","Ặ":"A","Ằ":"A","Ẳ":"A","Ẵ":"A","Ǎ":"A","Â":"A","Ấ":"A","Ậ":"A","Ầ":"A","Ẩ":"A","Ẫ":"A","Ä":"A","Ǟ":"A","Ȧ":"A","Ǡ":"A","Ạ":"A","Ȁ":"A","À":"A","Ả":"A","Ȃ":"A","Ā":"A","Ą":"A","Å":"A","Ǻ":"A","Ḁ":"A","Ⱥ":"A","Ã":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ḃ":"B","Ḅ":"B","Ɓ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ć":"C","Č":"C","Ç":"C","Ḉ":"C","Ĉ":"C","Ċ":"C","Ƈ":"C","Ȼ":"C","Ď":"D","Ḑ":"D","Ḓ":"D","Ḋ":"D","Ḍ":"D","Ɗ":"D","Ḏ":"D","Dz":"D","Dž":"D","Đ":"D","Ƌ":"D","DZ":"DZ","DŽ":"DZ","É":"E","Ĕ":"E","Ě":"E","Ȩ":"E","Ḝ":"E","Ê":"E","Ế":"E","Ệ":"E","Ề":"E","Ể":"E","Ễ":"E","Ḙ":"E","Ë":"E","Ė":"E","Ẹ":"E","Ȅ":"E","È":"E","Ẻ":"E","Ȇ":"E","Ē":"E","Ḗ":"E","Ḕ":"E","Ę":"E","Ɇ":"E","Ẽ":"E","Ḛ":"E","Ꝫ":"ET","Ḟ":"F","Ƒ":"F","Ǵ":"G","Ğ":"G","Ǧ":"G","Ģ":"G","Ĝ":"G","Ġ":"G","Ɠ":"G","Ḡ":"G","Ǥ":"G","Ḫ":"H","Ȟ":"H","Ḩ":"H","Ĥ":"H","Ⱨ":"H","Ḧ":"H","Ḣ":"H","Ḥ":"H","Ħ":"H","Í":"I","Ĭ":"I","Ǐ":"I","Î":"I","Ï":"I","Ḯ":"I","İ":"I","Ị":"I","Ȉ":"I","Ì":"I","Ỉ":"I","Ȋ":"I","Ī":"I","Į":"I","Ɨ":"I","Ĩ":"I","Ḭ":"I","Ꝺ":"D","Ꝼ":"F","Ᵹ":"G","Ꞃ":"R","Ꞅ":"S","Ꞇ":"T","Ꝭ":"IS","Ĵ":"J","Ɉ":"J","Ḱ":"K","Ǩ":"K","Ķ":"K","Ⱪ":"K","Ꝃ":"K","Ḳ":"K","Ƙ":"K","Ḵ":"K","Ꝁ":"K","Ꝅ":"K","Ĺ":"L","Ƚ":"L","Ľ":"L","Ļ":"L","Ḽ":"L","Ḷ":"L","Ḹ":"L","Ⱡ":"L","Ꝉ":"L","Ḻ":"L","Ŀ":"L","Ɫ":"L","Lj":"L","Ł":"L","LJ":"LJ","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ń":"N","Ň":"N","Ņ":"N","Ṋ":"N","Ṅ":"N","Ṇ":"N","Ǹ":"N","Ɲ":"N","Ṉ":"N","Ƞ":"N","Nj":"N","Ñ":"N","NJ":"NJ","Ó":"O","Ŏ":"O","Ǒ":"O","Ô":"O","Ố":"O","Ộ":"O","Ồ":"O","Ổ":"O","Ỗ":"O","Ö":"O","Ȫ":"O","Ȯ":"O","Ȱ":"O","Ọ":"O","Ő":"O","Ȍ":"O","Ò":"O","Ỏ":"O","Ơ":"O","Ớ":"O","Ợ":"O","Ờ":"O","Ở":"O","Ỡ":"O","Ȏ":"O","Ꝋ":"O","Ꝍ":"O","Ō":"O","Ṓ":"O","Ṑ":"O","Ɵ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Õ":"O","Ṍ":"O","Ṏ":"O","Ȭ":"O","Ƣ":"OI","Ꝏ":"OO","Ɛ":"E","Ɔ":"O","Ȣ":"OU","Ṕ":"P","Ṗ":"P","Ꝓ":"P","Ƥ":"P","Ꝕ":"P","Ᵽ":"P","Ꝑ":"P","Ꝙ":"Q","Ꝗ":"Q","Ŕ":"R","Ř":"R","Ŗ":"R","Ṙ":"R","Ṛ":"R","Ṝ":"R","Ȑ":"R","Ȓ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꜿ":"C","Ǝ":"E","Ś":"S","Ṥ":"S","Š":"S","Ṧ":"S","Ş":"S","Ŝ":"S","Ș":"S","Ṡ":"S","Ṣ":"S","Ṩ":"S","Ť":"T","Ţ":"T","Ṱ":"T","Ț":"T","Ⱦ":"T","Ṫ":"T","Ṭ":"T","Ƭ":"T","Ṯ":"T","Ʈ":"T","Ŧ":"T","Ɐ":"A","Ꞁ":"L","Ɯ":"M","Ʌ":"V","Ꜩ":"TZ","Ú":"U","Ŭ":"U","Ǔ":"U","Û":"U","Ṷ":"U","Ü":"U","Ǘ":"U","Ǚ":"U","Ǜ":"U","Ǖ":"U","Ṳ":"U","Ụ":"U","Ű":"U","Ȕ":"U","Ù":"U","Ủ":"U","Ư":"U","Ứ":"U","Ự":"U","Ừ":"U","Ử":"U","Ữ":"U","Ȗ":"U","Ū":"U","Ṻ":"U","Ų":"U","Ů":"U","Ũ":"U","Ṹ":"U","Ṵ":"U","Ꝟ":"V","Ṿ":"V","Ʋ":"V","Ṽ":"V","Ꝡ":"VY","Ẃ":"W","Ŵ":"W","Ẅ":"W","Ẇ":"W","Ẉ":"W","Ẁ":"W","Ⱳ":"W","Ẍ":"X","Ẋ":"X","Ý":"Y","Ŷ":"Y","Ÿ":"Y","Ẏ":"Y","Ỵ":"Y","Ỳ":"Y","Ƴ":"Y","Ỷ":"Y","Ỿ":"Y","Ȳ":"Y","Ɏ":"Y","Ỹ":"Y","Ź":"Z","Ž":"Z","Ẑ":"Z","Ⱬ":"Z","Ż":"Z","Ẓ":"Z","Ȥ":"Z","Ẕ":"Z","Ƶ":"Z","IJ":"IJ","Œ":"OE","ᴀ":"A","ᴁ":"AE","ʙ":"B","ᴃ":"B","ᴄ":"C","ᴅ":"D","ᴇ":"E","ꜰ":"F","ɢ":"G","ʛ":"G","ʜ":"H","ɪ":"I","ʁ":"R","ᴊ":"J","ᴋ":"K","ʟ":"L","ᴌ":"L","ᴍ":"M","ɴ":"N","ᴏ":"O","ɶ":"OE","ᴐ":"O","ᴕ":"OU","ᴘ":"P","ʀ":"R","ᴎ":"N","ᴙ":"R","ꜱ":"S","ᴛ":"T","ⱻ":"E","ᴚ":"R","ᴜ":"U","ᴠ":"V","ᴡ":"W","ʏ":"Y","ᴢ":"Z","á":"a","ă":"a","ắ":"a","ặ":"a","ằ":"a","ẳ":"a","ẵ":"a","ǎ":"a","â":"a","ấ":"a","ậ":"a","ầ":"a","ẩ":"a","ẫ":"a","ä":"a","ǟ":"a","ȧ":"a","ǡ":"a","ạ":"a","ȁ":"a","à":"a","ả":"a","ȃ":"a","ā":"a","ą":"a","ᶏ":"a","ẚ":"a","å":"a","ǻ":"a","ḁ":"a","ⱥ":"a","ã":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ḃ":"b","ḅ":"b","ɓ":"b","ḇ":"b","ᵬ":"b","ᶀ":"b","ƀ":"b","ƃ":"b","ɵ":"o","ć":"c","č":"c","ç":"c","ḉ":"c","ĉ":"c","ɕ":"c","ċ":"c","ƈ":"c","ȼ":"c","ď":"d","ḑ":"d","ḓ":"d","ȡ":"d","ḋ":"d","ḍ":"d","ɗ":"d","ᶑ":"d","ḏ":"d","ᵭ":"d","ᶁ":"d","đ":"d","ɖ":"d","ƌ":"d","ı":"i","ȷ":"j","ɟ":"j","ʄ":"j","dz":"dz","dž":"dz","é":"e","ĕ":"e","ě":"e","ȩ":"e","ḝ":"e","ê":"e","ế":"e","ệ":"e","ề":"e","ể":"e","ễ":"e","ḙ":"e","ë":"e","ė":"e","ẹ":"e","ȅ":"e","è":"e","ẻ":"e","ȇ":"e","ē":"e","ḗ":"e","ḕ":"e","ⱸ":"e","ę":"e","ᶒ":"e","ɇ":"e","ẽ":"e","ḛ":"e","ꝫ":"et","ḟ":"f","ƒ":"f","ᵮ":"f","ᶂ":"f","ǵ":"g","ğ":"g","ǧ":"g","ģ":"g","ĝ":"g","ġ":"g","ɠ":"g","ḡ":"g","ᶃ":"g","ǥ":"g","ḫ":"h","ȟ":"h","ḩ":"h","ĥ":"h","ⱨ":"h","ḧ":"h","ḣ":"h","ḥ":"h","ɦ":"h","ẖ":"h","ħ":"h","ƕ":"hv","í":"i","ĭ":"i","ǐ":"i","î":"i","ï":"i","ḯ":"i","ị":"i","ȉ":"i","ì":"i","ỉ":"i","ȋ":"i","ī":"i","į":"i","ᶖ":"i","ɨ":"i","ĩ":"i","ḭ":"i","ꝺ":"d","ꝼ":"f","ᵹ":"g","ꞃ":"r","ꞅ":"s","ꞇ":"t","ꝭ":"is","ǰ":"j","ĵ":"j","ʝ":"j","ɉ":"j","ḱ":"k","ǩ":"k","ķ":"k","ⱪ":"k","ꝃ":"k","ḳ":"k","ƙ":"k","ḵ":"k","ᶄ":"k","ꝁ":"k","ꝅ":"k","ĺ":"l","ƚ":"l","ɬ":"l","ľ":"l","ļ":"l","ḽ":"l","ȴ":"l","ḷ":"l","ḹ":"l","ⱡ":"l","ꝉ":"l","ḻ":"l","ŀ":"l","ɫ":"l","ᶅ":"l","ɭ":"l","ł":"l","lj":"lj","ſ":"s","ẜ":"s","ẛ":"s","ẝ":"s","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ᵯ":"m","ᶆ":"m","ń":"n","ň":"n","ņ":"n","ṋ":"n","ȵ":"n","ṅ":"n","ṇ":"n","ǹ":"n","ɲ":"n","ṉ":"n","ƞ":"n","ᵰ":"n","ᶇ":"n","ɳ":"n","ñ":"n","nj":"nj","ó":"o","ŏ":"o","ǒ":"o","ô":"o","ố":"o","ộ":"o","ồ":"o","ổ":"o","ỗ":"o","ö":"o","ȫ":"o","ȯ":"o","ȱ":"o","ọ":"o","ő":"o","ȍ":"o","ò":"o","ỏ":"o","ơ":"o","ớ":"o","ợ":"o","ờ":"o","ở":"o","ỡ":"o","ȏ":"o","ꝋ":"o","ꝍ":"o","ⱺ":"o","ō":"o","ṓ":"o","ṑ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","õ":"o","ṍ":"o","ṏ":"o","ȭ":"o","ƣ":"oi","ꝏ":"oo","ɛ":"e","ᶓ":"e","ɔ":"o","ᶗ":"o","ȣ":"ou","ṕ":"p","ṗ":"p","ꝓ":"p","ƥ":"p","ᵱ":"p","ᶈ":"p","ꝕ":"p","ᵽ":"p","ꝑ":"p","ꝙ":"q","ʠ":"q","ɋ":"q","ꝗ":"q","ŕ":"r","ř":"r","ŗ":"r","ṙ":"r","ṛ":"r","ṝ":"r","ȑ":"r","ɾ":"r","ᵳ":"r","ȓ":"r","ṟ":"r","ɼ":"r","ᵲ":"r","ᶉ":"r","ɍ":"r","ɽ":"r","ↄ":"c","ꜿ":"c","ɘ":"e","ɿ":"r","ś":"s","ṥ":"s","š":"s","ṧ":"s","ş":"s","ŝ":"s","ș":"s","ṡ":"s","ṣ":"s","ṩ":"s","ʂ":"s","ᵴ":"s","ᶊ":"s","ȿ":"s","ɡ":"g","ᴑ":"o","ᴓ":"o","ᴝ":"u","ť":"t","ţ":"t","ṱ":"t","ț":"t","ȶ":"t","ẗ":"t","ⱦ":"t","ṫ":"t","ṭ":"t","ƭ":"t","ṯ":"t","ᵵ":"t","ƫ":"t","ʈ":"t","ŧ":"t","ᵺ":"th","ɐ":"a","ᴂ":"ae","ǝ":"e","ᵷ":"g","ɥ":"h","ʮ":"h","ʯ":"h","ᴉ":"i","ʞ":"k","ꞁ":"l","ɯ":"m","ɰ":"m","ᴔ":"oe","ɹ":"r","ɻ":"r","ɺ":"r","ⱹ":"r","ʇ":"t","ʌ":"v","ʍ":"w","ʎ":"y","ꜩ":"tz","ú":"u","ŭ":"u","ǔ":"u","û":"u","ṷ":"u","ü":"u","ǘ":"u","ǚ":"u","ǜ":"u","ǖ":"u","ṳ":"u","ụ":"u","ű":"u","ȕ":"u","ù":"u","ủ":"u","ư":"u","ứ":"u","ự":"u","ừ":"u","ử":"u","ữ":"u","ȗ":"u","ū":"u","ṻ":"u","ų":"u","ᶙ":"u","ů":"u","ũ":"u","ṹ":"u","ṵ":"u","ᵫ":"ue","ꝸ":"um","ⱴ":"v","ꝟ":"v","ṿ":"v","ʋ":"v","ᶌ":"v","ⱱ":"v","ṽ":"v","ꝡ":"vy","ẃ":"w","ŵ":"w","ẅ":"w","ẇ":"w","ẉ":"w","ẁ":"w","ⱳ":"w","ẘ":"w","ẍ":"x","ẋ":"x","ᶍ":"x","ý":"y","ŷ":"y","ÿ":"y","ẏ":"y","ỵ":"y","ỳ":"y","ƴ":"y","ỷ":"y","ỿ":"y","ȳ":"y","ẙ":"y","ɏ":"y","ỹ":"y","ź":"z","ž":"z","ẑ":"z","ʑ":"z","ⱬ":"z","ż":"z","ẓ":"z","ȥ":"z","ẕ":"z","ᵶ":"z","ᶎ":"z","ʐ":"z","ƶ":"z","ɀ":"z","ff":"ff","ffi":"ffi","ffl":"ffl","fi":"fi","fl":"fl","ij":"ij","œ":"oe","st":"st","ₐ":"a","ₑ":"e","ᵢ":"i","ⱼ":"j","ₒ":"o","ᵣ":"r","ᵤ":"u","ᵥ":"v","ₓ":"x"};String.prototype.latinise=function(){return this.replace(/[^A-Za-z0-9\[\] ]/g,function(a){return Latinise.latin_map[a]||a})};String.prototype.latinize=String.prototype.latinise;String.prototype.isLatin=function(){return this==this.latinise()}/*** Array*/// ------ UNIQUE reduces duplicates ------array_unique = function(ar){	var r = new Array();	o:for(var i = 0, n = ar.length; i < n; i++)	{		for(var x = 0, y = r.length; x < y; x++)		{			if(r[x]==ar[i])			{				continue o;			}		}		r[r.length] = ar[i];	}	return r;};// ------ SUBSTRACT substract two array ------array_subtract = function(ara1,ara2) {  var aRes = new Array() ;  for (var i = ara1.length-1; i >= 0; i--)    if(array_contains(ara2,ara1[i]))      aRes.push(ara1[i]);  return aRes ;}/*			SHUFFLE Add a shuffle function to Array object prototype		author: Stephane Roucheray		src: http://sroucheray.org/blog/2009/11/array-sort-should-not-be-used-to-shuffle-an-array/		found 2011/09/08.*/array_shuffle = function(ar){    var i = ar.length, j, temp;    if ( i == 0 ) return;    while ( --i ) {        j = Math.floor( Math.random() * ( i + 1 ) );        temp = ar[i];        ar[i] = ar[j];        ar[j] = temp;    }    return ar;};// ------ CONTAINS ------array_contains = function(ar, obj) {    var i = ar.length;    while (i--)        if (ar[i] === obj)            return true;    return false;};// ------ REMOVE ------// /!\	Found on the Internet, not sure of efficiency.// Array.prototype.remove = function(v) {//     var x, _i, _len, _results;//     _results = [];//     for (_i = 0, _len = this.length; _i < _len; _i++) {//         x = this[_i];//         if (x !== v) {//             _results.push(x);//         }//     }//     return _results;// };array_remove = function(ar){    var what, a= arguments, L= a.length, ax;    while(L && ar.length){        what= a[--L];        while((ax= ar.indexOf(what))!= -1){            ar.splice(ax, 1);        }    }    return ar;};// for IE// if(!Array.prototype.indexOf){//     Array.prototype.indexOf= function(what, i){//         i= i || 0;//         var L= this.length;//         while(i< L){//             if(this[i]=== what) return i;//             ++i;//         }//         return -1;//     };// }array_indexOf = function(ar, what, i){    i= i || 0;    var L= ar.length;    while(i< L){        if(ar[i]=== what) return i;        ++i;    }    return -1;};// ------ SUBSTRACT substract two array ------function array_subtract(ara1,ara2) {  var aRes = new Array() ;  for (var i = ara1.length-1; i >= 0; i--)    if( !array_contains(ara1[i],ara2) )      aRes.push(ara1[i]);  return aRes ;};/*** Objects**/// ------ OBJECTSIZE get the length of objects ------function objectSize(o) {	var len = o.length ? --o.length : 0;	for (var k in o)		len++;	return len;}// Object.prototype.size = function () {// 	// var len = this.length ? --this.length : -1; // POURQUOI NE FONCTIONNE PAS?// 	var len = this.length ? --this.length : -2;// 	for (var k in this)// 		len++;// 	return len;// }function objectIsEmpty(obj){	for (var prop in obj) {		if (obj.hasOwnProperty(prop))			return false;	}	return true;};// ------ OBJECTGETKEY get key of index ------function objectGetKey(o,index){	var i = 0;	for (var k in o){		if (k === 'length' || !o.hasOwnProperty(k)) 			continue;		if(i == index) 			return k;		i ++;	}}// Object.prototype.getKey = function(index){// 	var i = 0;// 	for (var key in this){// 		if (key === 'length' || !this.hasOwnProperty(key)) // 			continue;// 		if(i == index) // 			return key;// 		i ++;// 	}// }// ------ OBJECTSORT sort object ------function objectSort(o,value) {    var connection = new Array();	for (var i = objectSize(o) - 1; i >= 0; i--){		var k = objectGetKey(o,i);		for (var j = objectSize(o[k].wit) - 1; j >= 0; j--){			var k2 = objectGetKey(o[k].wit,j);			if (k2==value) {				var the_wit = parseFloat(o[k].wit[k2]);				connection.push( {wit:the_wit,nid:k} );			};		};	};	connection.sort(function(a,b){		// return (a.wit - b.wit);//ascending		return (b.wit - a.wit);//descending	});	var o_sort = {};	for (var i = connection.length - 1; i >= 0; i--){		// o_sort[connection[i].wit+'-'+connection[i].nid] = o[connection[i].nid];		o_sort[connection[i].nid] = o[connection[i].nid];	};	return o_sort;}/*** trigo*/// -------- getElementAngle ----------// L'angle 0 correspond au nord (vers le haut)// Exemple : getElementAngle(posElementX, posElementY, posSourisX, posSourisY)//			 Ceci retournera l'angle de l'élément par rapport à la position de la sourisfunction getElementAngle(x1, y1, x2, y2) {	var adj = x2 - x1;	var opp = y2 - y1;		var angle = Math.abs(Math.atan(opp/adj) * 180/Math.PI);		if (adj > 0 && opp < 0 ) {		angle = 90 - angle;	}	else if (adj >= 0 && opp >= 0) {		angle += 90;	}	else if (adj < 0 && opp >= 0) {		angle = 180 + (90 - angle);	}	else {		angle += 270;	}		return angle;}// @koala-prepend "gui_ck_fw/gui.js"// @codekit-prepend "gui.js"(function($) {  Drupal.behaviors.init_theme = {};  Drupal.behaviors.init_theme.attach = function (context) {    // Growl-style system messages    $('#messages-and-help > div.messages:not(.processed)')      .addClass('processed')      .each(function() {        // If a message meets these criteria, we don't autoclose        // - contains a link        // - is an error or warning        // - contains a lenghthy amount of text        if ($('a', this).size() || $(this).is('.error') || $(this).is('.warning') || $(this).text().length > 100) {          $(this).prepend("<span class='close'>X</span>");          $('span.close', this).click(function() {            $(this).parent().slideUp('fast');          });        }        else {          // This essentially adds a 3 second pause before hiding the message.          $(this).animate({opacity:1}, 5000, 'linear', function() {            $(this).slideUp('fast');          });        }      });  };  Drupal.behaviors.materio = {};  Drupal.behaviors.materio.attach = function(context) {};  MaterioBaseTheme = function(){    var _settings = Drupal.settings,        _themeSettings = _settings.materiobasetheme,        _strings = _themeSettings.strings,        _History = window.History,        _this = this,        _$content = $('#content'),        _jsp,        _$tooltip = $('<div id="tooltip" class="op-hidden">').appendTo('body'),        _$homeUtilities, _$homeBlockDidactique, _hoverHomeDidactique = false, _homeTimeInterval,        _touch = $('html').is('.touch'),        _statePushed = false,        // touch scroll        position = {x:null,y:null},        translate3d_content = 0,        _isLoggedIn = !$('body').is('.not-logged-in'),        _isFrontNotLogged = $('body').is('.front.not-logged-in'),        _isMembershipForm = $('body').is('.page-node-11186'), //$('body').is('.page-node-11187') || ,        // _isBreveMateriauNodePage = $('body').is('.node-type-breve') || $('body').is('.node-type-materiau');        _isBreveMateriauNodePage = _themeSettings.page_callback == 'node_page_view' && (_themeSettings.node_type == 'materiau' || _themeSettings.node_type == 'breve'),        _resizeTimer,        _max_480 = function(){ return (viewport().width < 479); },        _480_768 = function(){ return ( !_max_480() && _max_768() ); },        _max_768 = function(){ return (viewport().width < 767); },        _768_980 = function(){ return ( !_max_768() && _max_980() ); },        _max_980 = function(){ return (viewport().width < 979); },        _980_1200 = function(){ return ( !_max_980() && _max_1200() ); },        _max_1200 = function(){ return (viewport().width < 1199); },        _previewIsOpen = false,        _viewmodes = {          bookmark : 50,          cardsmall :    100,          cardmedium :   210,          cardbig :      425,          cardfull :     850        };    // DEV    var v1, v2, v3, v4, v5; // generic variable used in many cases to avoid to create new memory block with new vars    function init(){      // trace('init MaterioBaseTheme');      checkIE();      initHistoryNav();      if(_isFrontNotLogged)        initHome();      if(_isMembershipForm)        initMembershipForm();      initForms();      initLayout();      initInfinitScroller();      initEvents();      initKeyboardShortcuts();      initViewmodes();      if(_isBreveMateriauNodePage)        $.event.trigger({ type : 'resultschanged', container : '#content>.inner-content'});      setTimeout(function(){        $.event.trigger({ type : 'theme-ready' });      },100);    };    /**    * checkIE    *    */    function checkIE(){      // alert('check ie');      if($('.oldie body').size() && !readCookie('oldie_checked')){        setTimeout(function(){          createCookie('oldie_checked', 1);          alert('Afin de profiter pleinement des fonctionalités de materio.com, nous vous invitons a mettre a jour votre navigateur dans ça denière version. Celui ci n\'étant pas compatible avec les technologie employer par materio.com, vous risquer de rencontrer des difficulter de navigation.');        }, 4000);      }    };    /**    * history navigation    */    function initHistoryNav(){      var state = _History.getState();      // _History.log('initial:', state.data, state.title, state.url);      _History.Adapter.bind(window,'statechange',onHistoryStateChange);      $(document).bind('new-history-page', onNewHistoryPage);    };    function onNewHistoryPage(event){      //trace('theme :: onNewHistoryPage', event);      var title = event.title.replace(/<(?:.|\n)*?>/gm, '')  + ' | ' + _strings.site_name;      // trace('MaterioBaseTheme :: onNewHistoryPage : title', title);      _statePushed = true;      _History.pushState({content:event.content, pagetitle:event.title}, title, event.path);    };    function onHistoryStateChange(event){      // trace('theme :: onHistoryStateChange', event);      var state = _History.getState();      // _History.log('statechange:', state.data, state.title, state.url);      // google analytics      $.event.trigger({        type : 'record-stat',        path : state.url      });      // TODO:  History : empty content if we go back to the homepage      // change the current url for feedbacks      $('input[name=location]','#feedback-form').attr('value', state.url);      $.event.trigger({        type:'materio-page-title-refresh-block',        title : state.data.pagetitle      });      // this condition is to avoid retriggering probleme when a module pushState and then is retriggered by state-changed      if(!_statePushed){        _statePushed = false;        $('.inner-content',_$content).html(state.data.content);        $.event.trigger('history-state-change');      }    };    /**    * home    */    function initHome(){      $('img.lazy', '#block-materio-didactique-materio-didactique-home').each(function(){        var $img = $(this);        $img.attr('src', $img.attr('data-original'));      });      if(_max_768()){        initHomeDidactiqueMobile();      }else{        initHomeDidactiqueDesktop();      }    };    function initHomeDidactiqueMobile(){      // trace('initHomeDidactiqueMobile');      _$homeBlockDidactique = $('#block-materio-didactique-materio-didactique-home');      $('.node-didactique', _$homeBlockDidactique)        .find('.field-name-title-field')          .bind('click', clickOnHomeDidactiqueTitle);    };    function clickOnHomeDidactiqueTitle(e){      // trace('clickOnHomeDidactiqueTitle');      var $node = $(this).parent('.node-didactique');      if($node.is('.opened')){        $node.removeClass('opened');//.slideUp();      }else{        $('.node-didactique', _$homeBlockDidactique).removeClass('opened');//.slideUp();        $node.addClass('opened');//.slideDown();        $('html,body').animate({scrollTop: $node.offset().top - $('#header').h()});      }    };    function initHomeDidactiqueDesktop(){      // trace("initHomeDidactiqueDesktop");      _$homeUtilities = $('#utilities');      _$homeBlockDidactique = $('#block-materio-didactique-materio-didactique-home')        .append('<div class="slides"/>')        .append('<div class="tabs"/>')        // .append('<i class="icon-circle-arrow-up"/><i class="icon-circle-arrow-down"/>')        .bind('mouseenter', function(event) { _hoverHomeDidactique = true; })        .bind('mouseleave', function(event) { _hoverHomeDidactique = false; });      $('.node-didactique',_$homeBlockDidactique).each(function(index) {        if(index){          $(this).addClass('op-hidden');        }else{          $(this).addClass('op-visible');        }        $('.field-name-title-field', this)          .clone()          .addClass(index ? '' : 'active')          .click(function(event){            $(this).addClass('active').siblings().removeClass('active');            _$homeBlockDidactique.find('.node-didactique').removeClass('op-visible').addClass('op-hidden').eq(index).removeClass('op-hidden').addClass('op-visible');          })          .appendTo($('.tabs', _$homeBlockDidactique));      }).appendTo($('.slides', _$homeBlockDidactique));      if(!_touch){        $(document).bind('scroll', function(event){          if($(window).scrollTop() == 0) {            if(_$homeUtilities.is('.closed')){              _$homeUtilities.removeClass('closed');//.removeClass('scroll-closed');              launchHomeDidactiqueInterval();              initLayout();            }          }else{            if(!_$homeUtilities.is('.closed')){              _$homeUtilities.addClass('closed');//.addClass('scroll-closed');              clearInterval(_homeTimeInterval);              initLayout();            }          }        });      }      // launchHomeDidactiqueInterval();      $(document)        .bind('cbox_complete', function(){ clearInterval(_homeTimeInterval); })        .bind('cbox_closed', function(){ launchHomeDidactiqueInterval(); });      $('.side.oops a').click(function(event) {        event.preventDefault();      //   $(document).scrollTop(0);      //   $('#edit-mail', "#block-materio-user-user-register").focus();        window.location.href = $(this).attr('href');        return false;      });    };    function launchHomeDidactiqueInterval(){      _homeTimeInterval = setInterval(function(){        if(!_hoverHomeDidactique){          var $next = $('.tabs .active', _$homeBlockDidactique).next();          if(!$next.length)              $next = $('.tabs .active', _$homeBlockDidactique).siblings().eq(0);          $next.trigger('click');        }      }, 15000);    };    /**    * layout    */    function initLayout(){      if(!_max_768()){        var height = $('#header').h() + $('#tasks').h();        if(!_max_480() && !_touch ){          height += $('#utilities').h()+15;        }        //$('#main').css('margin-top', height+15);        // $('#container').css('padding-top', height+15);        if(!$('html').is(".ie8")){          $('#container').animate({'padding-top':height}, 300);        }      }    };    /**    * infinit scroll    */    function initInfinitScroller(){      // trace("initInfinitScroller");      $.event.trigger({        type : 'init-scroller-pager',        pager : $('ul.pager', '#content')      });      $(document).bind('scroll', function(event){        // trace('scroll event binded');        checkInfinitScroller();      });    };    function checkInfinitScroller(){      // trace('checkInfinitScroller');      // if(!_touch){      // }else{        if($(window).scrollTop() + $(window).height() > getDocHeight() - 200) {          infinitScrollPager();        }      // }    };    function infinitScrollPager(){      // trace('MaterioBaseTheme :: infinitScrollPager');      if($('ul.pager', '#content').length){        var $nextpage = $('ul.pager .pager-current', '#content').next(),            href = $('a', $nextpage).attr('href');        if(href){          $.event.trigger({ type : 'record-stat', path : href }); // google analytics          $.event.trigger({ type : 'load-scroller-pager', href : href });        }      }    };    /**    * events    */    function initEvents(){      //trace('MaterioBaseTheme :: initEvents');      $(document)        .bind('init-layout', initLayout)        .bind('loading-content', onLoadingContent)        .bind('loaded-content', onLoadedContent)        .bind('resultschanged', onResultsChanged)        .bind('resultscompleted', onResultsCompleted)        .bind('mybookmarks-block-updated', onMybookmarksBlockUpdate)        .bind('mylists-block-builded', onMyListsBlockBuilded)        .bind('mylists-block-updated', onMyListsBlockUpdate)        .bind('flagGlobalAfterLinkUpdate', onAfterFlaging)        .bind('record-stat', onRecordStat)        .bind('view-mode-changed', onViewModeChanged)        .bind('ajax-register-block-loaded', onAjaxRegisterBlockLoaded);      $(window)        .bind('resize', onResizeWindow);      initFlagsEvent();      $('#block-user-login h2, #block-menu-menu-top-menu h2').bind('click', function(event) {        event.preventDefault();        $(this).parent('.block').toggleClass('hovered');        $('.hovered').not($(this).parent('.block')).removeClass('hovered');        return false;      });      $('#block-materio-search-api-materio-search-api-viewmode .viewmode-link').bind('vm-clicked-active', function(event) {        $(this).parents('.block').toggleClass('hovered');        $('.hovered').not($(this).parents('.block')).removeClass('hovered');      });      $('#block-materio-search-api-materio-search-api-viewmode .viewmode-link').bind('vm-clicked', function(event) {        $(this).parents('.block').removeClass('hovered');        $('.hovered').not($(this).parents('.block')).removeClass('hovered');      });    };    function onLoadingContent(event){      _$content.addClass('faded');      $('#materio-search-api-search-form').addClass('loading');    };    function onLoadedContent(event){      // trace('MaterioBaseTheme :: onLoadedContent',event);      _$content.removeClass('faded');      $('#materio-search-api-search-form').removeClass('loading');    };    function onResultsChanged(event){      // trace('MaterioBaseTheme :: onResultsChanged',event);      $(document).scrollTop(0);      focusCard($('#content .search-results, #content .actuality-items').children('.node:first-child'));      onResultsCompleted(event);    };    function onResultsCompleted(event){      // trace('theme :: onResultsCompleted', event);      checkInfinitScroller();      if(event.container != undefined){        // trace('theme :: container is ok : '+event.container)        setTimeout(function(){ // why this time out ?          initCards(event.container);          setUpGrid(event.container);        }, 100);      }    };    function initCards(container){      //TODO : refactore this function, to much features in there      //trace('theme :: initCards', container);      var $container = $(container);      $container.children('.node:not(.listened)')        .bind('mouseenter focused mousemove click mouseleave', onCardEventDispatcher)        .each(function(i){          protectFigures(this);          if(_isLoggedIn){            if(!$container.is('.modal-content')){              // do not add preview btn if we are already on a preview              initPreview(this);            }else{              // if we are on preview mode add a close btn (only for associated materials)              if(!$(this).is(":first-child")){                var $closebtn = $('<section><i class="icon-remove"></i></section>');                $closebtn.bind('click', function(){                  $(this).parents('.node-materiau').remove();                });                $('nav.nav', this).append($closebtn);              }            }          }        })        .addClass('listened');    };    function setUpGrid(container){      var $card, top, old_top, col = 0, line = 0;      $(container).children('.node')        .each(function(i){          $card = $(this);          top = $card.offset().top;          if(old_top != top){            line ++;            old_top = top;            col = 0;          }          col ++;          $card.attr('column', col).attr('line', line);        });    };    function onViewModeChanged(event){      if(_isBreveMateriauNodePage){        // if(!_isloadingresults){          $.event.trigger('loading-content');          var url = _settings.basePath+_settings.pathPrefix+'materio_search_api_ajax/node/'+_themeSettings.node_nid;          $.getJSON(url,            function(json){              //trace('json', json);              $.event.trigger('loaded-content');              $('#content>.inner-content').html(json.node);              $.event.trigger({ type : 'resultschanged', container : '#content>.inner-content'});          });        // }      }    };    /**    * CARDS    */    function onCardEventDispatcher(event){      // trace('onCardEvent', event);      var vmode = event.currentTarget.className.match(/vm-([a-z|A-Z]+)/);      var cf = 'on_'+event.type+'_card';      var f = 'on_'+event.type+'_'+vmode[1];      if(typeof _this[cf] == 'function')        _this[cf].call(this, event);      if(typeof _this[f] == 'function')        _this[f].call(this, event);    };    // function initLayoutCardDispatcher($card){    //   // trace('$card', $card);    //   var vmode = $card.attr('class').match(/vm-([a-z|A-Z]+)/);    //   var f = 'init_layout_'+vmode[1];    //   if(typeof _this[f] == 'function')    //     _this[f].call(this, $card);    // };    /**    * commons Cards    */    // MaterioBaseTheme.prototype.init_layout_card = function($card){    //   trace('initLayoutCardBig');    // };    // MaterioBaseTheme.prototype.on_mouseenter_card = function(event){    //   //trace('MaterioBaseTheme :: on_mouseenter_card', event);    // };    MaterioBaseTheme.prototype.on_mousemove_card = function(event){      //trace('on_mousemove_Card', event);      focusCard($(this));    };    // MaterioBaseTheme.prototype.on_click_card = function(event){    //   trace('on_click_card', event);    // };    // MaterioBaseTheme.prototype.on_mouseleave_card = function(event){    //   // trace('on_mouseleave_Card', event);    // };    /**    * cards small    */    // MaterioBaseTheme.prototype.init_layout_cardsmall = function($card){    //   trace('initLayoutCardBig');    // };    MaterioBaseTheme.prototype.on_mouseenter_cardsmall = function(event){      //trace('MaterioBaseTheme :: on_mouseenter_cardsmall', event);      showLazyLoadedImages(event.currentTarget);    };    MaterioBaseTheme.prototype.on_focused_cardsmall = function(event){      // trace('theme :: on_focused_cardsmall',event);      v1 = $(this);      v2 = v1.offset();      _$tooltip        .html($('.group-header', this).clone().addClass('smallcard'))        .css({          top:v2.top,//- event.layerY,          left:v2.left + 5 + ($(this).w())// - event.layerX        })        .removeClass('op-hidden').addClass('op-visible');    };    MaterioBaseTheme.prototype.on_mousemove_cardsmall = function(event){      // trace('on_mousemove_Card', event);      horiHoverImagesSwitcher(event);      _$tooltip        .css({          top:event.pageY - _$tooltip.h() -5,// - event.layerY,          left:event.pageX + 5 + ($(this).w() - event.layerX)        });    };    // MaterioBaseTheme.prototype.on_click_cardsmall = function(event){    //   trace('on_click_cardsmall', event);    // };    MaterioBaseTheme.prototype.on_mouseleave_cardsmall = function(event){      // trace('on_mouseleave_Card', event);      $('.images img.op-visible', this)        .removeClass('op-visible').addClass('op-hidden')          .eq(0)            .removeClass('op-hidden').addClass('op-visible');      if($(this).is('.focused'))        _$tooltip.removeClass('op-visible').addClass('op-hidden');    };    /**    * cards medium    */    // MaterioBaseTheme.prototype.init_layout_cardmedium = function($card){      // trace('initLayoutCardMedium');      // var ch = $card.h() - $('.group-header', $card).h() -30;      // columnsPage($('.field-name-field-description, .field-name-body', $card), 210, ch);    // };    MaterioBaseTheme.prototype.on_mouseenter_cardmedium = function(event){      // trace('on_mouseenter_cardmedium');      // show lazy images      showLazyLoadedImages(event.currentTarget);      // columnize texts      $card = $(event.currentTarget);      if(!$('.columnized', $card).size() && !$('body').is('.role-7', 'role-2') ){        var ch = $card.h() - $('.group-header', $card).h() -30;        columnsPage($('.field-name-field-description, .field-name-body', $card), 210, ch);        $('.group-side-4', $card).wrapInner('<div class="column-wrapper">').find('.field-item').addClass('dontsplit');        columnsPage($('.group-side-4 .column-wrapper', $card), 210, ch);      }      // add associated materials links      prepareAssociatedMaterials(event.currentTarget);    };    MaterioBaseTheme.prototype.on_mousemove_cardmedium = function(event){      //trace('on_mousemove_cardmedium');      horiHoverImagesSwitcher(event);    };    MaterioBaseTheme.prototype.on_click_cardmedium = function(event){      // trace('on_click_cardmedium', event);      if(!$(event.target).is('.flag') && !$(event.target).parent().is('.flag'))        sideSwitcher(event);    };    MaterioBaseTheme.prototype.on_mouseleave_cardmedium = function(event){      v1 = $('.side.op-visible');      if(v1.is('.oops','.upgrade') || $('.upgrade', v1).size()){        sideSwitcher(event, 0);      }    };    /**    * cards Big    */    // MaterioBaseTheme.prototype.init_layout_cardbig = function($card){      //trace('initLayoutCardBig');      // columnsPage($('.field-name-field-description, .field-name-body', $card), 425, 270);    // };    MaterioBaseTheme.prototype.on_mouseenter_cardbig = function(event){      // trace('on_mouseenter_cardbig');      showLazyLoadedImages(event.currentTarget);      if(!$('.columnized', event.currentTarget).size()){        columnsPage($('.field-name-field-description, .field-name-body', event.currentTarget), 425, 270);        $('.group-4', event.currentTarget).wrapInner('<div class="column-wrapper">').find('.field-item').addClass('dontsplit');        columnsPage($('.group-4 .column-wrapper', event.currentTarget), 425, 270);      }      // add associated materials links      prepareAssociatedMaterials(event.currentTarget);    };    MaterioBaseTheme.prototype.on_mousemove_cardbig = function(event){      // trace('on_mousemove_cardbig');      horiHoverImagesSwitcher(event);    };    MaterioBaseTheme.prototype.on_click_cardbig = function(event){      //trace('on_click_cardbig');      sideSwitcher(event);    };    MaterioBaseTheme.prototype.on_mouseleave_cardbig = function(event){      if($('.side.op-visible').is('.oops') || $('.side.op-visible').is('.upgrade')){        sideSwitcher(event, 0);      }    };    /**    * cards Full    */    // MaterioBaseTheme.prototype.init_layout_cardfull = function($card){    //   trace('initLayoutCardFull');    // };    MaterioBaseTheme.prototype.on_mouseenter_cardfull = function(event){      // trace('on_mouseenter_cardfull');      showLazyLoadedImages(event.currentTarget);      // add associated materials links      prepareAssociatedMaterials(event.currentTarget);    };    MaterioBaseTheme.prototype.on_mousemove_cardfull = function(event){      // trace('on_mousemove_cardfull');      horiHoverImagesSwitcher(event);    };    // MaterioBaseTheme.prototype.on_click_cardfull = function(event){    //   trace('on_click_cardfull');    // };    // MaterioBaseTheme.prototype.on_mouseleave_cardfull = function(event){    //   trace('on_mouseleave_cardfull');    // };    /**    * horiHoverImagesSwitcher    */    function horiHoverImagesSwitcher(event){      // trace('horiHoverImagesSwitcher', event);      var $curtar = $(event.currentTarget);      // TODO : event.layerX doesn't exists in IE8 so we have to calculate the mouse position from offsetX, pageY, etc      // var layerX = event.layerX ? event.layerX : event.clientX - event.currentTarget.offsetLeft;      var layerX = event.clientX - event.currentTarget.offsetLeft;      // trace("layerX", layerX);      if(layerX && $curtar.is('.image-ready')  ){ // && !$curtar.is('.image-buged')        var $imgs = $('.group-images figure', event.currentTarget);        if($(event.target).parents('.group-images').length){          var imgw = $imgs.eq(0).w(),              rapport = imgw/$imgs.length,              mx = layerX > imgw ? imgw-1 : layerX,              rapport_pos = Math.floor(mx / rapport);          // trace('rapport_pos = '+rapport_pos+' | event.layerX = '+event.layerX);          rapport_pos = rapport_pos < 0 ? 0 : ( rapport_pos > ($imgs.length - 1) ? $imgs.length - 1 : rapport_pos);          if(!$imgs.eq(rapport_pos).is('.op-visible')){            // google analytics            $.event.trigger({              type : 'record-stat',              categorie : 'Card event',              action : 'image slide switch',              label : rapport_pos            });            $imgs            .removeClass('op-visible').addClass('op-hidden')            .eq(rapport_pos)              .removeClass('op-hidden').addClass('op-visible');          }        }else{          // $curtar.addClass('image-buged');          $imgs.removeClass('op-visible').addClass('op-hidden');          $imgs.eq(0).removeClass('op-hidden').addClass('op-visible');        }      }    };    /**    * protectImages    */    function protectFigures(context){      // trace('protectFigures');      context = context == null ? 'body' : context;      $('figure:not(.protected)', context)        .append('<img class="blank" src="'+_settings.basePath+_themeSettings.themePath+'/img/blank.gif" />')        .addClass('protected')        .bind("contextmenu", function(e){          alert("Cette image est soumise au droit d'auteur.");          return false;        });    };    /**    * initPreview    */    function initPreview(node){      $('nav.nav', node).append($('<section class="preview"><i class="fi-eye"></i></section>').bind('click', onClickPreviewCardBtn));    };    function onClickPreviewCardBtn(event){      // trace('theme :: onClickPreviewCardBtn', event);      event.preventDefault();      //trace('Theme :: previewCard', event);      previewCard($(this).parents('.node'));      return false;    };    function previewCard($card){      // trace('theme :: previewCard',$card);      // get the nid from card class      var matches = $card.attr('class').match(/\bnode-(\d+)\b/);      // select viewmode regarding the window size      var viewmode = false;      var cur_vm = getCurrentViewmode();      for(var vm in _viewmodes)        if(vm != cur_vm && _viewmodes[vm] > _viewmodes[cur_vm] && _viewmodes[vm] < $(window).width())          viewmode = vm;      // ajax load card's node      if(typeof matches[1] !== undefined && viewmode){        $.event.trigger('loading-content');        $.getJSON(_settings.basePath+_settings.pathPrefix+'materio_search_api_ajax/node/'+matches[1],          {viewmode:viewmode},          function(json){            //trace('json', json);            $.event.trigger('loaded-content');            previewLoaded(json);        });      }    };    function previewLoaded(json){      var $modal = $('<div>').addClass('modal-content').append(json.node);      var $modal_wrapper = $('.modal-wrapper');      if(!$modal_wrapper.size())        $modal_wrapper = $('<div>').addClass('modal-wrapper').append($('<div>').addClass('modal-bg')).appendTo('body');      $modal_wrapper        .append($modal)        .bind('click', function(event) {          _previewIsOpen = false;          $(this).remove();        });      $modal.bind('click', function(event) {       event.stopPropagation();      });      _previewIsOpen = true;      initCards('.modal-content');      $.event.trigger({ type : 'previewloaded', container : '.modal-content'});    };    /**    * GRID    */    function moveGridFocus(event, side){      var $old_focused = $('#content .search-results, #content .actuality-items')            .children('.node.focused').first();      var $new_focused;      switch(side){        case 'r':          $new_focused = $old_focused.next();          break;        case 'l':          $new_focused = $old_focused.prev();          break;        case 'u':        case 'd':          var dir = side == "d" ? 1 : -1;          var column = $old_focused.attr('column');          while( ($new_focused == undefined || !$new_focused.size()) && column > 0){            $new_focused = $('.node[column='+column+'][line='+(parseInt($old_focused.attr('line'))+dir)+']');            column --;          }          break;      }      focusCard($new_focused);      docScrollTo($new_focused);    };    function focusCard($card){      // trace('theme :: focusCard', $card);      if(!$card.size() || $card.is('.focused') || $card.parents('.modal-content').size())        return;      $('#content .search-results, #content .actuality-items')        .children('.node.focused')        .removeClass('focused');      $card.addClass('focused');      if(_previewIsOpen){        previewCard($card);      }      $card.trigger('focused');    };    /**    * lazyloadimages    */    // function initLazyLoad(context){      // $('figure:first-child img.lazy', context).lazyload();//{        // container:'#content'      // });      // TODO:  propage this event to the card near it to anticipate the mouseenter      // $(context).bind('mousemove', showLazyLoadedImages);    // };    function showLazyLoadedImages(context){      //trace('MaterioBaseTheme :: initLazyLoad : mouseenter', this);      var $this = $(context);      if( !$this.is('.lazy-processed') ){        $this          .addClass('lazy-processed')          // .find('figure img.lazy')          .find('img.lazy')            .each(function(index){              var $img = $(this);              $img.attr('src', $img.attr('data-original')).removeAttr('data-original');            });        setTimeout(function(){          $this.addClass('image-ready');        }, 300);      }    };    /**    * prepareAssociatedMaterials    */    function prepareAssociatedMaterials(card){      // trace('prepareAssociatedMaterials', card);      $('.field-name-field-materiau-ref a:not(.prepared)', card).addClass("prepared").bind('click', onClickAssociatedMaterial);    };    /**    * onClickAssociatedMaterial    */    function onClickAssociatedMaterial(event){      // trace("onClickAssociatedMaterial");      event.preventDefault();      var $this = $(this);      // trace('href', $(this).attr('href'));      var nid = $this.attr('href').match(/^\/(fr|en)\/node\/(\d+)$/)[2];      // trace("nid", nid);      var $prt = $this.parents('.node-materiau');      if($prt.parent().is('.modal-content')){        // if we are on preview mode        // remove already loaded associated        $prt.parent().find('.node-'+nid+'.associated').remove();        loadAssociatedNode($prt, nid);      }else{        // if we are on normal grid mode        var $n = $prt.nextUntil('.node-materiau:not(.associated)').filter('.node-'+nid);        // trace('n', $n);        if($n.size()){          // trace('focus', nid);          // focus on already loaded node          focusCard($n);          // docScrollTo($isnodeexisting);        }else{          // trace('load associated', nid);          loadAssociatedNode($prt, nid);        }      }      return false;    };    function loadAssociatedNode($prt, nid){      // console.log('loadAssociatedNode | nid = '+nid);      var viewmode = $prt.attr('class').match(/vm-([^\s]+)/);      // trace('viewmode match', viewmode);      // if(!_isloadingresults){        $.event.trigger('loading-content');        var url = _settings.basePath+_settings.pathPrefix+'materio_search_api_ajax/node/'+nid;        $.getJSON(url,          {viewmode:viewmode[1]},          function(json){            //trace('json', json);            $.event.trigger('loaded-content');            displayAssociated($prt, $(json.node));            $.event.trigger({              type : 'resultscompleted',              container : '#content .actuality-items, #content .search-results'            });        });      // }    };    function displayAssociated($prt, $n){      $n.addClass('associated').addClass('just-added');      $prt.after($n);      initCards($prt.parent());      (function($n){        setTimeout(function(){          $n.removeClass('just-added');          focusCard($n);        }, 100);      }($n));    };    /**    * sideSwitcher    */    function sideSwitcher(event, delta){      var $sides = $('.side', event.currentTarget);      if($sides.length > 1){        if( typeof delta == 'undefined'){          var delta = 0;          $sides.each(function(i) {            if($(this).is('.op-visible')){              delta = i+1;              return false;            }          });          delta = delta == 0 ? 1 : (delta == $sides.length ? 0 : delta);        }        // google analytics        $.event.trigger({          type : 'record-stat',          categorie : 'Card event',          action : 'side switch',          label : delta        });        $sides.addClass('op-hidden').removeClass('op-visible')          .eq(delta).removeClass('op-hidden').addClass('op-visible');      }    };    /**    * columnsPage    */    function columnsPage($elmt, cw, ch){      // trace('columnsPage');      var cls = Math.ceil($elmt.h()/ch);      $elmt        .addClass('columnized')        .width(cw*cls)        .columnize({          width:cw,          height:ch,          lastNeverTallest:true        });      if(cls > 1){        $elmt.find('.column').each(function(index) {          var $this = $(this);          if(!$this.find('*').length){            $this.prev().addClass('last');            $this.remove();            return true;          }        });        $elmt.find('.column').each(function(index) {          var $this = $(this);          if(!$this.is('.first'))            $this.children('*:first-child').prepend('<span cw="'+cw+'" col="'+(index-1)+'" class="column-switcher prev-column">‹</span> ...');          if(!$this.is('.last'))            $this.children('*:last-child').append('... <span cw="'+cw+'" col="'+(index+1)+'" class="column-switcher next-column">›</span>');        });        $('.column-switcher', $elmt).bind('click', onColumnSwitcherClick);      }    };    function onColumnSwitcherClick(event){      event.preventDefault();      //trace('onColumnSwitcherClick', event);      var $this = $(event.currentTarget),          $columnized = $this.parents('.columnized');      // google analytics      $.event.trigger({        type : 'record-stat',        categorie : 'Card event',        action : 'column switch',        label : $this.attr('col')      });      $columnized.css({        marginLeft : -1 * $this.attr('cw') * $this.attr('col') +'px'      });      return false;    }    /**    * initViewmodes    */    function initViewmodes(){      checkViewmodesResponsive();    };    function checkViewmodesResponsive(){      if(_480_768()){        if($('.viewmode-link.active').is('.viewmode-cardfull')){          $('.viewmode-cardbig').trigger('click');        }      }else if(_max_480()){        if($('.viewmode-link.active').is('.viewmode-cardbig, .viewmode-cardfull')){          $('.viewmode-cardmedium').trigger('click');        }      }    };    function getCurrentViewmode(){      for(var vm in _viewmodes)        if($('.viewmode-link.active.viewmode-'+vm).size())          return vm;    };    /**    * FLAGS    */    function initFlagsEvent(){      $('.bookmarks, .mylists .flaged').children('.node:not(.listened)')        .bind('mouseenter mousemove click mouseleave', onCardEventDispatcher)        // .each(function(event){ initLayoutCardDispatcher($(this)); })        .addClass('listened');    };    function onAfterFlaging(event){      //trace('MaterioBaseTheme :: onAfterFlaging', event);      // WARNING to use event variables i had to hack flag.js from flag module (change the event declaration)      var $target = $(event.link).parents('article.node');      if(event.flagStatus == 'flag'){        $target.addClass('flaged');      }else if(event.flagStatus == 'unflag'){        if($('.flag-lists-entity-links a.unflag-action', $target).length == 0)          $target.removeClass('flaged');      }    };    function onMybookmarksBlockUpdate(event){      initFlagsEvent();      initLayout();    };    function onClickList(event){      //trace('onClickList', event);      var $link = $(event.currentTarget).addClass('active'),          name = $link.attr('name'),          $block = $link.parents('.block'),          $flaged = $('.flaged.'+name, $block).addClass('active');      $link.siblings().removeClass('active');      $flaged.siblings().removeClass('active');      createCookie('materiomyflaglistsopened', name, 1);      $flaged.parents('.mylists').height($flaged.h());      initLayout();    };    function onMyListsBlockUpdate(event){      //trace('MaterioBaseTheme :: onMyListsBlockUpdate', event);      initFlagsEvent();      // initLazyLoad(this);      // TODO:  refresh contents (search results) to see new flaglist links.      initLayout();    };    function onMyListsBlockBuilded(event){      //trace('MaterioBaseTheme :: onMyListsBlockBuilded', event);      // initLazyLoad(event.block);      showLazyLoadedImages(event.block);    };    /**    * cards bookmark    */    // MaterioBaseTheme.prototype.init_layout_bookmark = function($card){    //   trace('initLayoutCardBig');    // };    MaterioBaseTheme.prototype.on_mouseenter_bookmark = function(event){      //trace('on_mouseenter_bookmark', event);      _$tooltip        .html($('.group-header', this).clone())        .css({          top:event.pageY - _$tooltip.h() -5,//- event.layerY,          left:event.pageX + 5 + ($(this).w() - event.layerX)        })        .removeClass('op-hidden').addClass('op-visible');    };    MaterioBaseTheme.prototype.on_mousemove_bookmark = function(event){      // trace('on_mousemove_Card', event);      // if(event.layerX)      //   horiHoverImagesSwitcher(event);      _$tooltip        .css({          top:event.pageY - _$tooltip.h() -5,// - event.layerY,          left:event.pageX + 5 + ($(this).w() - event.layerX)        });    };    // MaterioBaseTheme.prototype.on_click_bookmark = function(event){    //   trace('on_click_bookmark', event);    // };    MaterioBaseTheme.prototype.on_mouseleave_bookmark = function(event){      // trace('on_mouseleave_Card', event);      $('.images img.op-visible', this)        .removeClass('op-visible').addClass('op-hidden')          .eq(0)            .removeClass('op-hidden').addClass('op-visible');      _$tooltip.removeClass('op-visible').addClass('op-hidden');    };    /**    * keyboradshortcuts    */    function initKeyboardShortcuts(){      $(document)        .bind('keydown', 'Shift+:',shortcut_focusSearchField)        .bind('keydown', '/',shortcut_focusSearchField)        .bind('keydown', 'Alt+1',shortcut_viewmodeSmall)        .bind('keydown', 'Alt+2',shortcut_viewmodeMedium)        .bind('keydown', 'Alt+3',shortcut_viewmodeBig)        .bind('keydown', 'Alt+4',shortcut_viewmodeFull)        .bind('keydown', 'space',shortcut_togglePreview)        .bind('keydown', 'esc',shortcut_closeModaleContent)        .bind('keydown', 'up',shortcut_onUpArrow)        .bind('keydown', 'right',shortcut_onRightArrow)        .bind('keydown', 'down',shortcut_onDownArrow)        .bind('keydown', 'left',shortcut_onLeftArrow);    };    function shortcut_focusSearchField(e){      // trace("focusSearchField");      if($('#edit-searchfield').size()){        var stat_event = { type : 'record-stat', categorie : 'Shortcuts'};        stat_event.action = 'slash';        stat_event.label = 'Focus on search text field';        $.event.trigger(stat_event);        $('#edit-searchfield').focus();        e.stopPropagation();        e.preventDefault();        return false;      }    };    function shortcut_viewmodeSmall(e){      if($('a.viewmode-link.viewmode-cardsmall').size()){        var stat_event = { type : 'record-stat', categorie : 'Shortcuts'};        stat_event.action = 'Alt+1';        stat_event.label = 'Change view mode : card small';        $.event.trigger(stat_event);        $('a.viewmode-link.viewmode-cardsmall').click();        return false;      }    };    function shortcut_viewmodeMedium(e){      if($('a.viewmode-link.viewmode-cardmedium').size()){        var stat_event = { type : 'record-stat', categorie : 'Shortcuts'};        stat_event.action = 'Alt+2';        stat_event.label = 'Change view mode : card medium';        $.event.trigger(stat_event);        $('a.viewmode-link.viewmode-cardmedium').click();        return false;      }    };    function shortcut_viewmodeBig(e){      if($('a.viewmode-link.viewmode-cardbig').size()){        var stat_event = { type : 'record-stat', categorie : 'Shortcuts'};        stat_event.action = 'Alt+3';        stat_event.label = 'Change view mode : card big';        $.event.trigger(stat_event);        $('a.viewmode-link.viewmode-cardbig').click();        return false;      }    };    function shortcut_viewmodeFull(e){      if($('a.viewmode-link.viewmode-cardfull').size()){        var stat_event = { type : 'record-stat', categorie : 'Shortcuts'};        stat_event.action = 'Alt+4';        stat_event.label = 'Change view mode : card full';        $.event.trigger(stat_event);        $('a.viewmode-link.viewmode-cardfull').click();        return false;      }    };    function shortcut_togglePreview(e){      // trace('theme :: shortcut_togglePreview', e);      $.event.trigger({        type : 'record-stat',        categorie : 'Shortcuts',        action : 'Space',        label : 'Space toggle preview'      });      if(_previewIsOpen){        if($('body>.modal-wrapper').size()){          $('body>.modal-wrapper').click();          _previewIsOpen = false;          return false;        }      }else{        previewCard($('#content .search-results, #content .actuality-items').children('.node.focused:first'));      }    };    function shortcut_closeModaleContent(e){      if($('body>.modal-wrapper').size()){        $.event.trigger({          type : 'record-stat',          categorie : 'Shortcuts',          action : 'Esc',          label : 'Esc from modal content'        });        $('body>.modal-wrapper').click();        _previewIsOpen = false;        return false;      }    };    function shortcut_onUpArrow(e){      // trace('theme :: shortcut_onTopArrow', e);      moveGridFocus(e, 'u');    };    function shortcut_onRightArrow(e){      // trace('theme :: shortcut_onRightArrow', e);      moveGridFocus(e, 'r');    };    function shortcut_onDownArrow(e){      // trace('theme :: shortcut_onDownArrow', e);      moveGridFocus(e, 'd');    };    function shortcut_onLeftArrow(e){      // trace('theme :: shortcut_onLeftArrow', e);      moveGridFocus(e, "l");    };    /**    * Misc    */    function onResizeWindow(e){      clearInterval(_resizeTimer);      _resizeTimer = setTimeout(function(){        initLayout();        checkViewmodesResponsive();        setUpGrid("#content .actuality-items, #content .search-results");      }, 200);    };    /**    * Statics    */    function initMembershipForm() {      switch(window.location.hash){        case '#flocon':          $('#edit-submitted-column-left-membership-options-1').attr('checked', 'checked');          // $options.trigger('change');          break;        case '#etoile':          $('#edit-submitted-column-left-membership-options-2').attr('checked', 'checked');          break;        case '#4etoiles':          $('#edit-submitted-column-left-membership-options-3').attr('checked', 'checked');          break;        // default:        //   switchMembershipShipFormFields($options);        //   break      }      $('#webform-component-column-left--membership-options')        .change(function(event){          //trace('changed');          if( $('input[type="radio"]:checked', this).is('#edit-submitted-column-left-membership-options-3') ){            $('#webform-component-column-right--collaborators').show();          }else{            $('#webform-component-column-right--collaborators').hide();          }          $('div.form-item.selected', this).removeClass('selected');          $('input[type="radio"]:checked', this).parents('div.form-item').addClass('selected');        })        .trigger('change');      // $('#webform-component-column-left--membership-options input[checked="checked"]').parents('div.form-item').addClass('selected');    };    /** helpers */    $.fn.h = function(){      if(this.css('height') == undefined)        return 0;      return parseInt(this.css('height')) + parseInt(this.css('padding-top')) + parseInt(this.css('padding-bottom'));    };    $.fn.w = function(){      if(this.css('width') == undefined)        return 0;      return parseInt(this.css('width')) + parseInt(this.css('padding-left')) + parseInt(this.css('padding-right'));    };    function getDocHeight() {        var D = document;        return Math.max(            Math.max(D.body.scrollHeight, D.documentElement.scrollHeight),            Math.max(D.body.offsetHeight, D.documentElement.offsetHeight),            Math.max(D.body.clientHeight, D.documentElement.clientHeight)        );    };    // http://andylangton.co.uk/articles/javascript/get-viewport-size-javascript/    function viewport() {      var e = window, a = 'inner';      if (!('innerWidth' in window )) {        a = 'client';        e = document.documentElement || document.body;      }      return { width : e[ a+'Width' ] , height : e[ a+'Height' ] };    };    /**    * Forms    */    function initForms(){      $('#edit-searchfield:not(.processed)')        .bind('focus', function(event) {          var $this = $(this);          //$this.attr('value', 'test');          // trace('value', $this.val());          // trace('default', $this.attr('default'));          if($this.val() == $this.attr('default'))            $this.val('');        })        .bind('focusout', function(event) {          var $this = $(this);          if($this.val() == "")            $this.val($this.attr('default'));        })        .addClass('processed');        hideLabelsFromRegisterForm();    };    function hideLabelsFromRegisterForm () {      var $this, id,label, description;      $('input.form-text', '#block-user-login, #block-materio-user-user-register, , #block-materio-user-user-createaccount').each(function(i) {        $this = $(this);        id = $this.attr('id');        label = $('label[for='+id+']').hide().text();        description = $this.parent().find('.description').hide().text();        if($this.attr('placeholder') == '')          $this.attr('placeholder',label);        $this.attr('title',description);      });    };    function onAjaxRegisterBlockLoaded (event) {      // console.log('onAjaxRegisterBlockLoaded');      hideLabelsFromRegisterForm();    };    /**    * cookies    */    function createCookie(name,value,days) {      if (days) {        var date = new Date();        date.setTime(date.getTime()+(days*24*60*60*1000));        var expires = "; expires="+date.toGMTString();      }      else var expires = "";      document.cookie = name+"="+value+expires+"; path=/";    };    function readCookie(name) {      var nameEQ = name + "=";      var ca = document.cookie.split(';');      for(var i=0;i < ca.length;i++) {        var c = ca[i];        while (c.charAt(0)==' ') c = c.substring(1,c.length);        if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);      }      return null;    };    function eraseCookie(name) {      createCookie(name,"",-1);    };    /**    * google analytics    */    function onRecordStat(event){      //trace('onRecordStat', event);      // path, category, action, opt_label, opt_value      if(typeof _gaq !== 'undefined'){        if(event.path){          _gaq.push(['_trackPageview', event.path]);        }else{          _gaq.push(['_trackEvent', event.categorie, event.action, event.label, event.value]);        }      }    };    /**    * docScrollTo    */    function docScrollTo($e){      // $(document).scrollTop($e.offset().top);      if($e.size())        $('html,body').animate({          scrollTop: $e.offset().top - $(window).height()*0.5 + $e.height()*0.5        }, 500);    };    init();  };  $(document).ready(function() {    var materiobasetheme = new MaterioBaseTheme();  });  /** * Attach collapse behavior to the feedback form block. */  Drupal.behaviors.feedbackForm = {    attach: function (context) {      $('#block-feedback-form', context).once('feedback', function () {        var $block = $(this);        $block.find('span.feedback-link')          .prepend('<span id="feedback-form-toggle">feedback</span> ')          .css('cursor', 'pointer')          .toggle(function () {              Drupal.feedbackFormToggle($block, false);            },            function() {              Drupal.feedbackFormToggle($block, true);            }          );        $block.find('form').hide();        $block.show();      });    }  };  /**   * Collapse or uncollapse the feedback form block.   */  Drupal.feedbackFormToggle = function ($block, enable) {    $block.find('form').slideToggle('medium');    if (enable) {      $('#feedback-form-toggle', $block).html('feedback');    }    else {      $('#feedback-form-toggle', $block).html('feedback (close)');    }  };})(jQuery);
 |