| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969 | 
							- // ================================================================
 
- //                       CHEditor 5.1.9.4
 
- // ----------------------------------------------------------------
 
- // Homepage: http://www.chcode.com
 
- // EMail: support@chcode.com
 
- // Copyright (c) 1997-2019 CHSOFT
 
- // ================================================================
 
- var GB = {
 
-     colors: ['#000000', '#313131', '#434343', '#535353', '#666666', '#999999', '#a0a0a0', '#b5b5b5', '#c0c0c0', '#dcdcdc', '#eeeeee', '#ffffff',
 
-              '#ff0000', '#ff8000', '#ffff00', '#80ff00', '#00ff00', '#00ff99', '#00ffff', '#0080ff', '#0000ff', '#7f00ff', '#ff00ff', '#ff007f',
 
-              '#ffcccc', '#ffe5cc', '#ffffcc', '#e5ffcc', '#ccffcc', '#ccffe5', '#ccffff', '#cce5ff', '#ccccff', '#e5ccff', '#ffccff', '#ffcce5',
 
-              '#ff9999', '#ffcc99', '#ffff99', '#ccff99', '#99ff99', '#99ffcc', '#99ffff', '#99ccff', '#9999ff', '#cc99ff', '#ff99ff', '#ff99cc',
 
-              '#ff6666', '#ffb266', '#ffff66', '#b2ff66', '#66ff66', '#66ffb2', '#66ffff', '#66b2ff', '#6666ff', '#b266ff', '#ff66ff', '#ff66b2',
 
-              '#ff3333', '#ff9933', '#ffff33', '#99ff33', '#33ff33', '#33ff99', '#33ffff', '#3399ff', '#3333ff', '#9933ff', '#ff33ff', '#ff3399',
 
-              '#cc0000', '#cc6600', '#cccc00', '#66cc00', '#00cc00', '#00cc66', '#00cccc', '#0066cc', '#0000cc', '#6600cc', '#cc00cc', '#cc0066',
 
-              '#990000', '#994c00', '#999900', '#4c9900', '#009900', '#00994c', '#009999', '#004c99', '#000099', '#4c0099', '#990099', '#99004c',
 
-              '#660000', '#663300', '#666600', '#336600', '#006600', '#006633', '#006666', '#003366', '#000066', '#330066', '#660066', '#660033'],
 
-     offElementTags: {
 
-         button: 1, embed: 1, fieldset: 1, form: 1, hr: 1, img: 1, input: 1, object: 1, select: 1, table: 1, textarea: 1
 
-     },
 
-     selfClosingTags: {
 
-         area: 1, base: 1, br: 1, col: 1, command: 1, embed: 1, hr: 1, img: 1, input: 1, keygen: 1, link: 1, meta: 1,
 
-         param: 1, source: 1, track: 1, wbr: 1
 
-     },
 
-     textFormatTags: {
 
-         a: 1, addr: 1, acronym: 1, b: 1, bdo: 1, big: 1, cite: 1, code: 1, del: 1, dfn: 1, em: 1, font: 1, i: 1, ins: 1, kbd: 1,
 
-         q: 1, samp: 1, small: 1, strike: 1, strong: 1, sub: 1, sup: 1, time: 1, tt: 1, u: 1, 'var': 1, span: 1
 
-     },
 
-     textFormatBlockTags: {
 
-         address: 1, div: 1, h1: 1, h2: 1, h3: 1, h4: 1, h5: 1, h6: 1, p: 1, pre: 1, code: 1, section: 1, aside: 1, article: 1, figcaption: 1
 
-     },
 
-     newLineBeforeTags: {
 
-         address: 1, article: 1, aside: 1, audio: 1, blockquote: 1, body: 1, canvas: 1, code: 1, comment: 1, dd: 1, div: 1,
 
-         dl: 1, fieldset: 1, figcaption: 1, figure: 1, footer: 1, form: 1, h1: 1, h2: 1, h3: 1, h4: 1, h5: 1, h6: 1, head: 1,
 
-         header: 1, hggroup: 1, hr: 1, li: 1, noscript: 1, ol: 1, output: 1, p: 1, pre: 1, script: 1, section: 1, table: 1,
 
-         tbody: 1, td: 1, tfoot: 1, th: 1, thead: 1, title: 1, tr: 1, ul: 1, video: 1
 
-     },
 
-     lineHeightBlockTags: {
 
-         address: 1, article: 1, aside: 1, blockquote: 1, code: 1, dd: 1, div: 1, dt: 1, figcaption: 1, figure: 1,
 
-         h1: 1, h2: 1, h3: 1, h4: 1, h5: 1, h6: 1, li: 1, p: 1, pre: 1, section: 1, td: 1, th: 1
 
-     },
 
-     listTags: { dd: 1, dt: 1, li: 1 },
 
-     lineBreakTags: { address: 1, article: 1, aside: 1, dd: 1, div: 1, dt: 1, figcaption: 1, li: 1, p: 1, section: 1 },
 
-     doctype: '<!DOCTYPE html>',
 
-     popupWindow: {
 
-         ColorPicker: { tmpl: 'color_picker.html', width: 420, title: '색상 선택' },
 
-         Embed: { tmpl: 'media.html', width: 430, title: '미디어' },
 
-         EmotionIcon: { tmpl: 'icon.html', width: 300, title: '표정 아이콘' },
 
-         FlashMovie: { tmpl: 'flash.html', width: 584, title: '플래쉬 동영상' },
 
-         GoogleMap: { tmpl: 'google_map.html', width: 538, title: '구글 지도' },
 
-         ImageUpload: { tmpl: 'image.html', width: 700, title: '내 PC 사진 넣기' },
 
-         ImageUrl: { tmpl: 'image_url.html', width: 350, title: '웹 사진 넣기' },
 
-         Layout: { tmpl: 'layout.html', width: 430, title: '레이아웃' },
 
-         Link: { tmpl: 'link.html', width: 350, title: '하이퍼링크' },
 
-         ModifyTable: { tmpl: 'table_modify.html', width: 430, title: '표 고치기' },
 
-         Symbol: { tmpl: 'symbol.html', width: 450, title: '특수 문자' },
 
-         Table: { tmpl: 'table.html', width: 430, title: '표 만들기' }
 
-     },
 
-     fontName: {
 
-         kr: ['맑은 고딕', '돋움', '굴림', '바탕', '궁서'],
 
-         en: ['Arial', 'Comic Sans MS', 'Courier New', 'Georgia', 'HeadLineA', 'Impact', 'Tahoma', 'Times New Roman', 'Verdana']
 
-     },
 
-     fontStyle: {
 
-         FontSize: 'font-size', FontName: 'font-family', ForeColor: 'color', BackColor: 'background-color'
 
-     },
 
-     textAlign: {
 
-         JustifyLeft: '', JustifyCenter: 'center', JustifyRight: 'right', JustifyFull: 'justify'
 
-     },
 
-     listStyle: {
 
-         ordered: {
 
-             decimal: '숫자', 'lower-alpha': '영문 소문자', 'upper-alpha': '영문 대문자', 'lower-roman': '로마 소문자', 'upper-roman': '로마 대문자'
 
-         },
 
-         unOrdered: { desc: '동그라미', circle: '빈 원', square: '사각형' }
 
-     },
 
-     fontSize: {
 
-         pt: [7, 8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36],
 
-         px: [9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36, 48, 72]
 
-     },
 
-     formatBlock: {
 
-         P: '일반 텍스트',
 
-         H1: '제목 1',
 
-         H2: '제목 2',
 
-         H3: '제목 3',
 
-         H4: '제목 4',
 
-         H5: '제목 5',
 
-         H6: '제목 6',
 
-         ADDRESS: 'Address',
 
-         DIV: 'DIV',
 
-         PRE: 'Preformatted (PRE)'
 
-     },
 
-     lineHeight: {
 
-         '한 줄 간격': 1, '1.15': 1.15, '1.5': 1.5, '1.7': 1.7, '1.8': 1.8, '두 줄 간격': 2
 
-     },
 
-     textBlock: [
 
-         ['1px #dedfdf solid', '#f7f7f7'],
 
-         ['1px #aee8e8 solid', '#bfffff'],
 
-         ['1px #d3bceb solid', '#e6ccff'],
 
-         ['1px #e8e88b solid', '#ffff99'],
 
-         ['1px #c3e89e solid', '#d6ffad'],
 
-         ['1px #e8c8b7 solid', '#ffdcc9'],
 
-         ['1px #666666 dashed', '#ffffff'],
 
-         ['1px #d4d4d4 solid', '#ffffff'],
 
-         ['1px #cccccc inset', '#f7f7f7']
 
-     ],
 
-     node: {
 
-         element: 1, attribute: 2, text: 3, cdata_section: 4, entity_reference: 5, entity: 6,
 
-         processing_instruction: 7, comment: 8, document: 9, document_type: 10, document_fragment: 11,
 
-         notation: 12
 
-     },
 
-     selection: { none: 1, text: 2, element: 3 },
 
-     readyState: { 0: 'uninitialized', 1: 'loading', 2: 'loaded', 3: 'interactive', 4: 'complete' },
 
-     dragWindow: null,
 
-     colorDropper: null,
 
-     readyEditor: 0,
 
-     browser: {}
 
- };
 
- function isUndefined(obj) {
 
-     return obj === void (0); // obj === undefined;
 
- }
 
- function detechBrowser() {
 
-     function detect(ua) {
 
-         var iosdevice = getFirstMatch(/(ipod|iphone|ipad)/i).toLowerCase(),
 
-             likeAndroid = /like android/i.test(ua),
 
-             android = !likeAndroid && /android/i.test(ua),
 
-             versionIdentifier = getFirstMatch(/version\/(\d+(\.\d+)?)/i),
 
-             tablet = /tablet/i.test(ua),
 
-             mobile = !tablet && /[^\-]mobi/i.test(ua),
 
-             result,
 
-             osVersion = '',
 
-             osMajorVersion,
 
-             osname,
 
-             app;
 
-         function getFirstMatch(regex) {
 
-             var match = ua.match(regex);
 
-             return (match && match.length > 1 && match[1]) || '';
 
-         }
 
-         if (/opera|opr/i.test(ua)) {
 
-             result = {
 
-                 name: 'Opera', opera: true,
 
-                 version: versionIdentifier || getFirstMatch(/(?:opera|opr)[\s\/](\d+(\.\d+)?)/i)
 
-             };
 
-         } else if (/windows phone/i.test(ua)) {
 
-             result = {
 
-                 name: 'Windows Phone', windowsphone: true, msie: true,
 
-                 version: getFirstMatch(/iemobile\/(\d+(\.\d+)?)/i)
 
-             };
 
-         } else if (/msie|trident/i.test(ua)) {
 
-             result = {
 
-                 name: 'Internet Explorer', msie: true, version: getFirstMatch(/(?:msie |rv:)(\d+(\.\d+)?)/i)
 
-             };
 
-         } else if (/edge/i.test(ua)) {
 
-             result = {
 
-                 name: 'edge', edge: true, version: getFirstMatch(/(?:edge)\/(\d+(\.\d+)?)/i)
 
-             };
 
-         } else if (/chrome|crios|crmo/i.test(ua)) {
 
-             result = {
 
-                 name: 'Chrome', chrome: true, version: getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i)
 
-             };
 
-         } else if (iosdevice) {
 
-             result = {
 
-                 name: iosdevice === 'iphone' ? 'iPhone' : iosdevice === 'ipad' ? 'iPad' : 'iPod'
 
-             };
 
-             if (versionIdentifier) {
 
-                 result.version = versionIdentifier;
 
-             }
 
-         } else if (/firefox|iceweasel/i.test(ua)) {
 
-             result = {
 
-                 name: 'Firefox', firefox: true,
 
-                 version: getFirstMatch(/(?:firefox|iceweasel)[ \/](\d+(\.\d+)?)/i)
 
-             };
 
-             if (/\((mobile|tablet);[^\)]*rv:[\d\.]+\)/i.test(ua)) {
 
-                 result.firefoxos = true;
 
-             }
 
-         } else if (/silk/i.test(ua)) {
 
-             result = {
 
-                 name: 'Amazon Silk', silk: true, version: getFirstMatch(/silk\/(\d+(\.\d+)?)/i)
 
-             };
 
-         } else if (android) {
 
-             result = { name: 'Android', version: versionIdentifier };
 
-         } else if (/phantom/i.test(ua)) {
 
-             result = {
 
-                 name: 'PhantomJS', phantom: true, version: getFirstMatch(/phantomjs\/(\d+(\.\d+)?)/i)
 
-             };
 
-         } else if (/blackberry|\bbb\d+/i.test(ua) || /rim\stablet/i.test(ua)) {
 
-             result = {
 
-                 name: 'BlackBerry', blackberry: true,
 
-                 version: versionIdentifier || getFirstMatch(/blackberry[\d]+\/(\d+(\.\d+)?)/i)
 
-             };
 
-         } else if (/(web|hpw)os/i.test(ua)) {
 
-             result = {
 
-                 name: 'WebOS', webos: true,
 
-                 version: versionIdentifier || getFirstMatch(/w(?:eb)?osbrowser\/(\d+(\.\d+)?)/i)
 
-             };
 
-             if (/touchpad\//i.test(ua)) {
 
-                 result.touchpad = true;
 
-             }
 
-         } else if (/safari/i.test(ua)) {
 
-             result = {
 
-                 name: 'Safari', safari: true, version: versionIdentifier
 
-             };
 
-         } else {
 
-             result = {};
 
-         }
 
-         if (/(apple)?webkit/i.test(ua)) {
 
-             result.name = result.name || 'Webkit';
 
-             result.webkit = true;
 
-             if (!result.version && versionIdentifier) {
 
-                 result.version = versionIdentifier;
 
-             }
 
-         } else if (!result.opera && /gecko\//i.test(ua)) {
 
-             result.gecko = true;
 
-             result.version = result.version || getFirstMatch(/gecko\/(\d+(\.\d+)?)/i);
 
-             result.name = result.name || 'Gecko';
 
-         }
 
-         if (android || result.silk) {
 
-             result.android = true;
 
-         } else if (iosdevice) {
 
-             result[iosdevice] = true;
 
-             result.ios = true;
 
-         }
 
-         if (iosdevice) {
 
-             osVersion = getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i);
 
-             osVersion = osVersion.replace(/[_\s]/g, '.');
 
-         } else if (android) {
 
-             osVersion = getFirstMatch(/android[ \/\-](\d+(\.\d+)*)/i);
 
-         } else if (result.windowsphone) {
 
-             osVersion = getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i);
 
-         } else if (result.webos) {
 
-             osVersion = getFirstMatch(/(?:web|hpw)os\/(\d+(\.\d+)*)/i);
 
-         } else if (result.blackberry) {
 
-             osVersion = getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i);
 
-         }
 
-         if (osVersion) {
 
-             result.osversion = osVersion;
 
-         }
 
-         osMajorVersion = osVersion.split('.')[0];
 
-         if (tablet || iosdevice === 'ipad' ||
 
-             (android && (osMajorVersion === 3 || (osMajorVersion === 4 && !mobile))) ||
 
-             result.silk) {
 
-             result.tablet = true;
 
-         } else if (mobile || iosdevice === 'iphone' || iosdevice === 'ipod' || android ||
 
-                 result.blackberry || result.webos) {
 
-             result.mobile = true;
 
-         }
 
-         if (result.edge ||
 
-             (result.msie && result.version >= 10) ||
 
-             (result.chrome && result.version >= 20) ||
 
-             (result.firefox && result.version >= 20.0) ||
 
-             (result.safari && result.version >= 6) ||
 
-             (result.opera && result.version >= 10.0) ||
 
-             (result.ios && result.osversion && result.osversion.split('.')[0] >= 6) ||
 
-             (result.blackberry && result.version >= 10.1)) {
 
-             result.a = true;
 
-         } else if ((result.msie && result.version < 10) ||
 
-             (result.chrome && result.version < 20) ||
 
-             (result.firefox && result.version < 20.0) ||
 
-             (result.safari && result.version < 6) ||
 
-             (result.opera && result.version < 10.0) ||
 
-             (result.ios && result.osversion && result.osversion.split('.')[0] < 6)) {
 
-             result.c = true;
 
-         } else {
 
-             result.x = true;
 
-         }
 
-         osname = '';
 
-         if (/windows/i.test(ua)) {
 
-             osname = 'Windows';
 
-         } else if (/mac/i.test(ua)) {
 
-             osname = 'MacOS';
 
-         } else if (/x11/i.test(ua)) {
 
-             osname = 'UNIX';
 
-         } else if (/linux/i.test(ua)) {
 
-             osname = 'Linux';
 
-         } else if (/sunos/i.test(ua)) {
 
-             osname = 'Solaris';
 
-         } else {
 
-             osname = 'Unknown OS';
 
-         }
 
-         result.osname = osname;
 
-         if (osname === 'Windows') {
 
-             app = getFirstMatch(/(Windows NT\s(\d+)\.(\d+))/i);
 
-             switch (app) {
 
-                 case 'Windows NT 5.1': result.os = 'Windows XP'; break;
 
-                 case 'Windows NT 5.2': result.os = 'Windows 2003'; break;
 
-                 case 'Windows NT 6.0': result.os = 'Windows Vista'; break;
 
-                 case 'Windows NT 6.1': result.os = 'Windows 7'; break;
 
-                 case 'Windows NT 6.2': result.os = 'Windows 8'; break;
 
-                 case 'Windows NT 6.3': result.os = 'Windows 8.1'; break;
 
-                 case 'Windows NT 10.0': result.os = 'Windows 10'; break;
 
-                 default: result.os = app;
 
-             }
 
-         }
 
-         if (result.msie) {
 
-             if (result.version > 10) {
 
-                 result.msie_a = true;
 
-                 result.msie_bogus = true;
 
-             } else if (result.version > 8) {
 
-                 result.msie_b = true;
 
-                 result.msie_bogus = false;
 
-             } else {
 
-                 result.msie_c = true;
 
-                 result.msie_bogus = (result.os === 'Windows XP');
 
-             }
 
-         }
 
-         return result;
 
-     }
 
-     return detect(!isUndefined(navigator) ? navigator.userAgent : null);
 
- }
 
- function URI(uri) {
 
-     this.scheme = null;
 
-     this.authority = null;
 
-     this.path = '';
 
-     this.query = null;
 
-     this.fragment = null;
 
-     this.parseUri = function (uri) {
 
-         var m = uri.match(/^(([A-Za-z][0-9A-Za-z+.\-]*)(:))?((\/\/)([^\/?#]*))?([^?#]*)((\?)([^#]*))?((#)(.*))?/);
 
-         this.scheme = m[3] ? m[2] : null;
 
-         this.authority = m[5] ? m[6] : null;
 
-         this.path = m[7];
 
-         this.query = m[9] ? m[10] : null;
 
-         this.fragment = m[12] ? m[13] : null;
 
-         return this;
 
-     };
 
-     this.azToString = function () {
 
-         var result = '';
 
-         if (this.scheme !== null) {
 
-             result = result + this.scheme + ':';
 
-         }
 
-         if (this.authority !== null) {
 
-             result = result + '//' + this.authority;
 
-         }
 
-         if (this.path !== null) {
 
-             result = result + this.path;
 
-         }
 
-         if (this.query !== null) {
 
-             result = result + '?' + this.query;
 
-         }
 
-         if (this.fragment !== null) {
 
-             result = result + '#' + this.fragment;
 
-         }
 
-         return result;
 
-     };
 
-     this.toAbsolute = function (location) {
 
-         var baseUri = new URI(location),
 
-             URIAbs = this,
 
-             target = new URI(),
 
-             removeDotSegments = function (path) {
 
-                 var result = '', rm;
 
-                 while (path) {
 
-                     if (path.substr(0, 3) === '../' || path.substr(0, 2) === './') {
 
-                         path = path.replace(/^\.+/, '').substr(1);
 
-                     } else if (path.substr(0, 3) === '/./' || path === '/.') {
 
-                         path = '/' + path.substr(3);
 
-                     } else if (path.substr(0, 4) === '/../' || path === '/..') {
 
-                         path = '/' + path.substr(4);
 
-                         result = result.replace(/\/?[^\/]*$/, '');
 
-                     } else if (path === '.' || path === '..') {
 
-                         path = '';
 
-                     } else {
 
-                         rm = path.match(/^\/?[^\/]*/)[0];
 
-                         path = path.substr(rm.length);
 
-                         result = result + rm;
 
-                     }
 
-                 }
 
-                 return result;
 
-             };
 
-         if (baseUri.scheme === null) {
 
-             return false;
 
-         }
 
-         if (URIAbs.scheme !== null && URIAbs.scheme.toLowerCase() === baseUri.scheme.toLowerCase()) {
 
-             URIAbs.scheme = null;
 
-         }
 
-         if (URIAbs.scheme !== null) {
 
-             target.scheme = URIAbs.scheme;
 
-             target.authority = URIAbs.authority;
 
-             target.path = removeDotSegments(URIAbs.path);
 
-             target.query = URIAbs.query;
 
-         } else {
 
-             if (URIAbs.authority !== null) {
 
-                 target.authority = URIAbs.authority;
 
-                 target.path = removeDotSegments(URIAbs.path);
 
-                 target.query = URIAbs.query;
 
-             } else {
 
-                 if (URIAbs.path === '') {
 
-                     target.path = baseUri.path;
 
-                     target.query = URIAbs.query || baseUri.query;
 
-                 } else {
 
-                     if (URIAbs.path.substr(0, 1) === '/') {
 
-                         target.path = removeDotSegments(URIAbs.path);
 
-                     } else {
 
-                         if (baseUri.authority !== null && baseUri.path === '') {
 
-                             target.path = '/' + URIAbs.path;
 
-                         } else {
 
-                             target.path = baseUri.path.replace(/[^\/]+$/, '') + URIAbs.path;
 
-                         }
 
-                         target.path = removeDotSegments(target.path);
 
-                     }
 
-                     target.query = URIAbs.query;
 
-                 }
 
-                 target.authority = baseUri.authority;
 
-             }
 
-             target.scheme = baseUri.scheme;
 
-         }
 
-         target.fragment = URIAbs.fragment;
 
-         return target;
 
-     };
 
-     if (uri) {
 
-         this.parseUri(uri);
 
-     }
 
- }
 
- function setConfig() {
 
-     var config = {
 
-         allowedOnEvent: true,
 
-         colorToHex: true,
 
-         docTitle: '내 문서',
 
-         editAreaMargin: '5px 10px',
 
-         editorBgColor: '#fff',
 
-         editorFontColor: '#000',
 
-         editorFontName: '"맑은 고딕", "Malgun Gothic", gulim',
 
-         editorFontSize: '12px',
 
-         editorHeight: '300px',
 
-         editorPath: null,
 
-         editorWidth: '100%',
 
-         exceptedElements: { script: true, style: true, iframe: false },
 
-         fontSizeValue: 'px',     // [pt, px]
 
-         fullHTMLSource: false,
 
-         imgBlockMargin: '5px 0px',
 
-         imgCaptionFigure: 'border: 1px #ccc solid; background-color: #f0f0f0; margin: 0',
 
-         imgCaptionText: 'margin: 5px 5px; text-align: left; line-height: 17px',
 
-         imgCaptionWrapper: '',
 
-         imgDefaultAlign: 'left',   // [left, center, right]
 
-         imgJpegQuality: 0.92,     // JPEG 사진의 퀄리티 값, 최대값 1
 
-         imgMaxWidth: 800,      // 사진 최대 가로 크기, 이 크기 보다 크면 리사이징 처리
 
-         imgResizeMinLimit: 32,       // 사진 리사이징의 사용자 직접 입력 값이 이 값 보다 작으면, 이 값으로 설정
 
-         imgResizeSelected: 800,      // 사진 리사이징의 선택 입력 폼의 기본 선택 값
 
-         imgResizeValue: [120, 240, 320, 640, 800, -1], // -1 = 사용자 직접 입력
 
-         imgSetAttrAlt: true,
 
-         imgSetAttrWidth: 1,        // -1 = (width="100%"; height="auto"), 0 = 설정 안함, 1 = 기본값
 
-         imgUploadNumber: 12,
 
-         imgUploadSortName: false,
 
-         imgWaterMarkAlpha: 1,        // 워터마크 불투명도 (최대값 1)
 
-         imgWaterMarkUrl: '',       // 워터마크 이미지 URL (예: 'http://udomain.com/cheditor/icons/watermark.png')
 
-         includeHostname: true,
 
-         lineHeight: 1.7,
 
-         linkTarget: '_blank',
 
-         makeThumbnail: false,    // 사진의 썸네일 이미지 생성, 가로 크기는 thumbnailWidth 값, 세로는 자동 계산
 
-         paragraphCss: false,    // true = <p style='margin:0'></p>, false = <p></p>
 
-         removeIndent: false,
 
-         showTagPath: false,
 
-         tabIndent: 3,
 
-         tabIndex: 0,
 
-         thumbnailWidth: 120,
 
-         // 버튼 사용 유무
 
-         useSource: true,
 
-         usePreview: true,
 
-         usePrint: true,
 
-         useNewDocument: true,
 
-         useUndo: true,
 
-         useRedo: true,
 
-         useCopy: true,
 
-         useCut: true,
 
-         usePaste: true,
 
-         usePasteFromWord: true,
 
-         useSelectAll: true,
 
-         useStrikethrough: true,
 
-         useUnderline: true,
 
-         useItalic: true,
 
-         useSuperscript: false,
 
-         useSubscript: false,
 
-         useJustifyLeft: true,
 
-         useJustifyCenter: true,
 
-         useJustifyRight: true,
 
-         useJustifyFull: true,
 
-         useBold: true,
 
-         useOrderedList: true,
 
-         useUnOrderedList: true,
 
-         useOutdent: true,
 
-         useIndent: true,
 
-         useFontName: true,
 
-         useFormatBlock: true,
 
-         useFontSize: true,
 
-         useLineHeight: true,
 
-         useBackColor: true,
 
-         useForeColor: true,
 
-         useRemoveFormat: true,
 
-         useClearTag: true,
 
-         useSymbol: true,
 
-         useLink: true,
 
-         useUnLink: true,
 
-         useFlash: true,
 
-         useMedia: false,
 
-         useImage: true,
 
-         useImageUrl: false,
 
-         useSmileyIcon: true,
 
-         useHR: true,
 
-         useTable: true,
 
-         useModifyTable: true,
 
-         useMap: true,
 
-         useTextBlock: true,
 
-         useFullScreen: true,
 
-         usePageBreak: false
 
-     },
 
-     base, elem, i, editorUri, locationAbs;
 
-     if (config.editorPath === null) {
 
-         base = location.href;
 
-         elem = document.getElementsByTagName('base');
 
-         for (i = 0; i < elem.length; i++) {
 
-             if (elem[i].href) {
 
-                 base = elem[i].href;
 
-             }
 
-         }
 
-         elem = document.getElementsByTagName('script');
 
-         for (i = 0; i < elem.length; i++) {
 
-             if (elem[i].src) {
 
-                 editorUri = new URI(elem[i].src);
 
-                 if (/\/cheditor\.js$/.test(editorUri.path)) {
 
-                     locationAbs = editorUri.toAbsolute(base).azToString();
 
-                     delete locationAbs.query;
 
-                     delete locationAbs.fragment;
 
-                     config.editorPath = locationAbs.replace(/[^\/]+$/, '');
 
-                 }
 
-             }
 
-         }
 
-         if (config.editorPath === null) {
 
-             throw 'CHEditor 경로가 바르지 않습니다.\nmyeditor.config.editorPath를 설정하여 주십시오.';
 
-         }
 
-     }
 
-     this.storedSelections = [];
 
-     this.keyPressStoredSelections = [];
 
-     this.images = [];
 
-     this.editImages = {};
 
-     this.cheditor = {};
 
-     this.toolbar = {};
 
-     this.pulldown = {};
 
-     this.currentRS = {};
 
-     this.resizeEditor = {};
 
-     this.setFullScreenMode = false;
 
-     this.modalElementZIndex = 1001;
 
-     this.config = config;
 
-     this.templateFile = 'template.xml';
 
-     this.templatePath = config.editorPath + this.templateFile;
 
-     this.W3CRange = !(this.undefined(window.getSelection));
 
-     this.inputForm = 'textAreaId';
 
-     this.range = null;
 
-     this.tempTimer = null;
 
-     this.cheditor.tabSpaces = '';
 
-     this.cheditor.modifyState = false;
 
-     this.cheditor.tabSpaces = new Array(this.config.tabIndent + 1).join(' ');
 
- }
 
- function cheditor() {
 
-     this.toType = (function (global) {
 
-         var toString = cheditor.prototype.toString,
 
-             re = /^.*\s(\w+).*$/;
 
-         return function (obj) {
 
-             if (obj === global) {
 
-                 return 'global';
 
-             }
 
-             return toString.call(obj).replace(re, '$1').toLowerCase();
 
-         };
 
-     }(this));
 
-     this.undefined = isUndefined;
 
-     GB.browser = this.browser = detechBrowser();
 
-     if (this.undefined(document.execCommand)) {
 
-         alert('현재 브라우저에서 CHEditor를 실행할 수 없습니다.');
 
-         return null;
 
-     }
 
-     if (this.browser.msie && this.browser.version < 7) {
 
-         alert('CHEditor는 Internet Explorer 7 이하 버전은 지원하지 않습니다.');
 
-         return null;
 
-     }
 
-     try {
 
-         setConfig.call(this);
 
-         this.cheditor.id = (this.undefined(GB.readyEditor)) ? 1 : GB.readyEditor++;
 
-     } catch (e) {
 
-         alert(e.toString());
 
-         return null;
 
-     }
 
-     return this;
 
- }
 
- cheditor.prototype = {
 
-     //----------------------------------------------------------------
 
-     resetData: function () {
 
-         if (GB.browser.msie) {
 
-             if (this.undefined(this.cheditor.editArea.onreadystatechange)) {
 
-                 GB.browser.version = 11;
 
-             }
 
-             GB.browser.msie_bogus = (GB.browser.version < 8 || GB.browser.version > 10);
 
-             document.execCommand('BackgroundImageCache', false, true);
 
-         }
 
-         this.resetEditArea();
 
-     },
 
-     appendContents: function (contents) {
 
-         var div = this.doc.createElement('div');
 
-         this.editAreaFocus();
 
-         div.innerHTML = String(this.trimSpace(contents));
 
-         while (div.hasChildNodes()) {
 
-             this.doc.body.appendChild(div.firstChild);
 
-         }
 
-         this.editAreaFocus();
 
-     },
 
-     insertContents: function (contents) {
 
-         this.editAreaFocus();
 
-         this.doCmdPaste(String(this.trimSpace(contents)));
 
-     },
 
-     replaceContents: function (contents) {
 
-         this.editAreaFocus();
 
-         this.doc.body.innerHTML = '';
 
-         this.loadContents(contents);
 
-         this.editAreaFocus();
 
-     },
 
-     loadContents: function (contents) {
 
-         if (typeof contents === 'string') {
 
-             contents = this.trimSpace(contents);
 
-             if (contents) {
 
-                 this.cheditor.editArea.style.visibility = 'hidden';
 
-                 this.doc.body.innerHTML = contents;
 
-                 this.cheditor.editArea.style.visibility = 'visible';
 
-             }
 
-         }
 
-     },
 
-     setFolderPath: function () {
 
-         if (this.config.editorPath.charAt(this.config.editorPath.length - 1) !== '/') {
 
-             this.config.editorPath += '/';
 
-         }
 
-         this.config.iconPath = this.config.editorPath + 'icons/';
 
-         this.config.cssPath = this.config.editorPath + 'css/';
 
-         this.config.popupPath = this.config.editorPath + 'popup/';
 
-     },
 
-     checkInputForm: function () {
 
-         var textarea = document.getElementById(this.inputForm);
 
-         if (!textarea) {
 
-             throw 'ID가 "' + this.inputForm + '"인 textarea 개체를 찾을 수 없습니다.';
 
-         }
 
-         textarea.style.display = 'none';
 
-         this.cheditor.textarea = textarea;
 
-     },
 
-     setDesignMode: function (designMode, doc) {
 
-         var mode = designMode ? 'on' : 'off';
 
-         doc = doc || this.doc;
 
-         if (GB.browser.msie) {
 
-             if (doc.body.contentEditable !== designMode) {
 
-                 doc.body.contentEditable = designMode;
 
-             }
 
-             return;
 
-         }
 
-         if (doc.designMode !== mode) {
 
-             doc.designMode = mode;
 
-         }
 
-     },
 
-     openDoc: function (doc, contents) {
 
-         var html = '<html>' +
 
-             '<head><title>' + this.config.docTitle + '</title>' +
 
-             '<style></style></head><body>';
 
-         doc.open();
 
-         if (typeof contents === 'string') {
 
-             html += this.trimSpace(contents);
 
-         }
 
-         html += '</body></html>';
 
-         doc.write(html);
 
-         doc.close();
 
-     },
 
-     getWindowHandle: function (iframeObj) {
 
-         var iframeWin;
 
-         if (iframeObj.contentWindow) {
 
-             iframeWin = iframeObj.contentWindow;
 
-         } else {
 
-             throw '현재 브라우저에서 에디터를 실행할 수 없습니다.';
 
-         }
 
-         return iframeWin;
 
-     },
 
-     resetDoc: function () {
 
-         if (this.undefined(this.cheditor.editArea)) {
 
-             return false;
 
-         }
 
-         try {
 
-             this.editArea = this.getWindowHandle(this.cheditor.editArea);
 
-             this.doc = GB.browser.msie ? this.editArea.document : this.cheditor.editArea.contentDocument;
 
-             this.resetData();
 
-             return true;
 
-         } catch (e) {
 
-             alert(e.toString());
 
-             return false;
 
-         }
 
-     },
 
-     resetEditArea: function () {
 
-         this.openDoc(this.doc, this.cheditor.textarea.value);
 
-         this.setDocumentProp();
 
-     },
 
-     resetDocumentBody: function () {
 
-         this.doc.body.parentNode.replaceChild(this.doc.createElement('body'), this.doc.body);
 
-         this.setDocumentBodyProp();
 
-     },
 
-     setDocumentBodyProp: function () {
 
-         this.doc.body.setAttribute('spellcheck', 'false');
 
-         this.doc.body.setAttribute('hidefocus', '');
 
-     },
 
-     setDocumentProp: function () {
 
-         var oSheet,
 
-             bodyCss = 'font-size:' + this.config.editorFontSize +
 
-                 '; font-family:' + this.config.editorFontName +
 
-                 '; color:' + this.config.editorFontColor +
 
-                 '; margin:' + this.config.editAreaMargin +
 
-                 '; line-height:' + this.config.lineHeight,
 
-             tableCss = 'font-size:' + this.config.editorFontSize + '; line-height:' + this.config.lineHeight,
 
-             self = this;
 
-         this.setDefaultCss({ css: 'editarea.css', doc: this.doc });
 
-         oSheet = this.doc.styleSheets[0];
 
-         if (!this.W3CRange) {
 
-             oSheet.addRule('body', bodyCss);
 
-             oSheet.addRule('table', tableCss);
 
-         } else {
 
-             oSheet.insertRule('body {' + bodyCss + '}', 0);
 
-             oSheet.insertRule('table {' + tableCss + '}', 1);
 
-         }
 
-         this.setDocumentBodyProp();
 
-         this.cheditor.bogusSpacerName = 'ch_bogus_spacer';
 
-         this.addEvent(this.doc, 'paste', function (event) {
 
-             self.handlePaste(event);
 
-         });
 
-         if (!GB.browser.msie) {
 
-             this.doc.execCommand('defaultParagraphSeparator', false, 'p');
 
-         }
 
-         this.setDesignMode(true);
 
-         this.initDefaultParagraphSeparator();
 
-     },
 
-     initDefaultParagraphSeparator: function () {
 
-         var p = this.doc.createElement('p'), br;
 
-         if (this.doc.body.firstChild && this.doc.body.firstChild.nodeName.toLowerCase() === 'br') {
 
-             this.doc.body.removeChild(this.doc.body.firstChild);
 
-         }
 
-         if (this.W3CRange) {
 
-             if (!this.doc.body.hasChildNodes()) {
 
-                 this.doc.body.appendChild(p);
 
-                 if (!GB.browser.msie && !GB.browser.edge) {
 
-                     br = this.doc.createElement('br');
 
-                     br.className = this.cheditor.bogusSpacerName;
 
-                     p.appendChild(br);
 
-                     this.placeCaretAt(p, false);
 
-                 } else {
 
-                     this.placeCaretAt(p, false);
 
-                 }
 
-             }
 
-         } else {
 
-             this.doc.body.appendChild(p);
 
-             this.placeCaretAt(p, false);
 
-         }
 
-     },
 
-     handleBeforePaste: function () {
 
-         var range = this.getRange(), commonAncestorContainer, startOffset, wrapper;
 
-         this.backupRange();
 
-         if (!range.collapsed) {
 
-             range.deleteContents();
 
-             range = this.getRange();
 
-         }
 
-         commonAncestorContainer = range.commonAncestorContainer;
 
-         startOffset = range.startOffset;
 
-         wrapper = this.doc.createElement('div');
 
-         if (startOffset < 1 && commonAncestorContainer.nodeType === GB.node.text) {
 
-             commonAncestorContainer.parentNode.insertBefore(wrapper, commonAncestorContainer);
 
-         } else {
 
-             range.insertNode(wrapper);
 
-         }
 
-         this.placeCaretAt(wrapper, false);
 
-         return wrapper;
 
-     },
 
-     handlePaste: function (ev) {
 
-         var text, clip, elem, wrapper, pNode, space = [], div, self = this;
 
-         if (this.cheditor.mode === 'preview') {
 
-             return;
 
-         }
 
-         if (this.cheditor.paste !== 'text' && this.cheditor.mode === 'rich' && this.W3CRange) {
 
-             wrapper = this.handleBeforePaste();
 
-             setTimeout(function () {
 
-                 if (wrapper) {
 
-                     if (wrapper.hasChildNodes()) {
 
-                         text = wrapper.innerHTML;
 
-                         text = text.replace(/[\r\n]/g, '\u00a0');
 
-                         text = text.replace(/<font\s?([^>]+)>(\s+| +)<\/font>/gi, '\u00a0');
 
-                         text = text.replace(/<span\s?([^>]+)>(\s+| +)<\/span>/gi, '\u00a0');
 
-                         text = text.replace(/<\/?(font)\s?([^>]+)?>/gi, '');
 
-                         text = text.replace(/<strong>([\s ]+)<\/strong>/gi, '\u00a0');
 
-                         text = text.replace(/<b>([\s ]+)<\/b>/gi, '\u00a0');
 
-                         text = text.replace(/<em>([\s ]+)<\/em>/gi, '\u00a0');
 
-                         text = text.replace(/<i>([\s ]+)<\/i>/gi, '\u00a0');
 
-                         text = text.replace(/<\/?(colgroup|col\s?([^>]+))>/gi, '');
 
-                         text = text.replace(/<(\/)?strong>/gi, '<$1b>');
 
-                         text = text.replace(/<(\/)?em>/gi, '<$1i>');
 
-                         wrapper.innerHTML = text;
 
-                         if (wrapper.firstChild.nodeType === GB.node.text) {
 
-                             text = wrapper.firstChild.data;
 
-                             text = text.replace(/^( +|\s+)/g, '');
 
-                             wrapper.firstChild.data = text;
 
-                         }
 
-                         elem = wrapper.firstChild;
 
-                         while (elem) {
 
-                             wrapper.parentNode.insertBefore(elem, wrapper);
 
-                             elem = wrapper.firstChild;
 
-                         }
 
-                     }
 
-                     pNode = wrapper.parentNode;
 
-                     if (pNode) {
 
-                         if (pNode.firstChild === wrapper && pNode.lastChild === wrapper) {
 
-                             pNode.parentNode.removeChild(pNode);
 
-                         } else {
 
-                             pNode.removeChild(wrapper);
 
-                         }
 
-                     }
 
-                     self.setImageEvent(true);
 
-                 }
 
-             }, 50);
 
-             return;
 
-         }
 
-         if (ev !== null) {
 
-             clip = ev.clipboardData;
 
-             this.stopEvent(ev);
 
-         }
 
-         text = this.trimSpace((this.undefined(clip) || clip === null) ?
 
-             window.clipboardData.getData('Text') :
 
-                 clip.getData('text/plain'));
 
-         if (text !== '') {
 
-             text = text.replace(/\r/g, '');
 
-             if (this.cheditor.mode === 'code') {
 
-                 div = this.doc.createElement('div');
 
-                 text = this.htmlEncode(text);
 
-                 text = text.replace(/\s{2,}/gm, '\n');
 
-                 text = text.replace(/[\u200b\ufeff\xa0\u3000]+/g, '');
 
-                 if (GB.browser.msie && GB.browser.version < 9) {
 
-                     text = text.replace(/\n/g, '<br />');
 
-                     text = text.replace(/\t/g, '__CHEDITOR_TAB_SPACE__');
 
-                     text = text.replace(/\s/gm, ' ');
 
-                 }
 
-                 div.innerHTML = text;
 
-                 div.id = 'clipboardData';
 
-                 this.insertHTML(div);
 
-                 return;
 
-             }
 
-             text = this.htmlEncode(text);
 
-             text = text.replace(/[\r\n]+/g, '\n');
 
-             text = text.split('\n').join('<br>');
 
-             text = text.replace(/(\s{2,})/g, function (a, b) {
 
-                 space = b.split(/\s/);
 
-                 space.shift();
 
-                 return ' ' + space.join(' ');
 
-             });
 
-             this.insertHTML(text);
 
-             self.setImageEvent(true);
 
-         }
 
-     },
 
-     editAreaFocus: function () {
 
-         this.editArea.focus();
 
-     },
 
-     resizeGetY: function (evt) {
 
-         return GB.browser.msie ?
 
-                 window.event.clientY + document.documentElement.scrollTop + document.body.scrollTop :
 
-                     evt.clientY + window.pageYOffset;
 
-     },
 
-     resizeStart: function (evt) {
 
-         var self = this;
 
-         self.currentRS.elNode = self.cheditor.mode === 'code' ? self.cheditor.textContent : self.cheditor.editArea;
 
-         self.currentRS.cursorStartY = self.resizeGetY(evt);
 
-         self.currentRS.elStartTop = parseInt(self.currentRS.elNode.style.height, 10);
 
-         if (isNaN(self.currentRS.elStartTop)) {
 
-             self.currentRS.elStartTop = 0;
 
-         }
 
-         evt = evt || window.event;
 
-         self.resizeEditor.stopFunc = function (event) {
 
-             self.resizeStop(event);
 
-         };
 
-         self.resizeEditor.moveFunc = function (event) {
 
-             self.resizeMove(event);
 
-         };
 
-         if (GB.browser.msie) {
 
-             self.setDesignMode(false);
 
-         }
 
-         self.currentRS.elNode.style.visibility = 'hidden';
 
-         self.addEvent(document, 'mousemove', self.resizeEditor.moveFunc);
 
-         self.addEvent(document, 'mouseup', self.resizeEditor.stopFunc);
 
-         self.stopEvent(evt);
 
-     },
 
-     resizeMove: function (evt) {
 
-         var offset = this.resizeGetY(evt),
 
-             height = this.currentRS.elStartTop + offset - this.currentRS.cursorStartY;
 
-         if (height < 1) {
 
-             this.resizeStop(evt);
 
-             height = 1;
 
-         }
 
-         this.config.editorHeight = this.currentRS.elNode.style.height = height + 'px';
 
-         this.stopEvent(evt);
 
-     },
 
-     resizeStop: function (evt) {
 
-         this.stopEvent(evt);
 
-         this.removeEvent(document, 'mouseup', this.resizeEditor.stopFunc);
 
-         this.removeEvent(document, 'mousemove', this.resizeEditor.moveFunc);
 
-         this.currentRS.elNode.style.visibility = 'visible';
 
-         if (GB.browser.msie) {
 
-             this.setDesignMode(true);
 
-         }
 
-         if (this.cheditor.mode === 'code') {
 
-             this.config.editorHeight = (parseInt(this.config.editorHeight, 10)
 
-                 + parseInt(this.cheditor.textContent.getAttribute('xbar-height'), 10)) + 'px';
 
-             this.cheditor.textContent.focus();
 
-         } else if (this.cheditor.mode === 'rich') {
 
-             this.editAreaFocus();
 
-         }
 
-     },
 
-     switchEditorMode: function (changeMode) {
 
-         var self = this, i, className, interval;
 
-         this.editAreaFocus();
 
-         if (this.cheditor.mode === changeMode) {
 
-             return;
 
-         }
 
-         for (i in this.cheditor.modetab) {
 
-             if (this.cheditor.modetab.hasOwnProperty(i)) {
 
-                 className = this.cheditor.modetab[i].className;
 
-                 className = className.replace(/\-off$/, '');
 
-                 if (i !== changeMode) {
 
-                     this.cheditor.modetab[i].className = className + '-off';
 
-                 } else {
 
-                     this.cheditor.modetab[i].className = className;
 
-                 }
 
-             }
 
-         }
 
-         switch (changeMode) {
 
-             case 'rich':
 
-                 this.richMode();
 
-                 this.showTagSelector(true);
 
-                 break;
 
-             case 'code':
 
-                 if (this.cheditor.modifyState) {
 
-                     interval = setInterval(function () {
 
-                         if (!self.cheditor.modifyState) {
 
-                             clearInterval(interval);
 
-                             self.editMode();
 
-                         }
 
-                     }, 10);
 
-                 } else {
 
-                     this.editMode();
 
-                 }
 
-                 this.showTagSelector(false);
 
-                 break;
 
-             case 'preview':
 
-                 this.previewMode();
 
-                 this.showTagSelector(false);
 
-         }
 
-         this.cheditor.mode = changeMode;
 
-     },
 
-     initTemplate: function () {
 
-         var self = this,
 
-             httpRequest = null,
 
-             showError = function (msg) {
 
-                 alert(self.templateFile + ' 파일 로딩 중 오류가 발생하였습니다.\n원인: ' + msg);
 
-             },
 
-             templateReady = function () {
 
-                 var event;
 
-                 if (httpRequest.readyState === 4) {
 
-                     if (httpRequest.status === 200) {
 
-                         try {
 
-                             self.xmlDoc = httpRequest.responseXML || httpRequest;
 
-                             self.loadTemplate(self.xmlDoc);
 
-                             if (self.W3CRange) {
 
-                                 event = document.createEvent('Event');
 
-                                 event.initEvent(self.cheditor.id, true, true);
 
-                                 document.dispatchEvent(event);
 
-                             } else {
 
-                                 document.documentElement.loadEvent = self.cheditor.id;
 
-                             }
 
-                         } catch (e) {
 
-                             showError(e.toString());
 
-                         }
 
-                     } else {
 
-                         showError('XMLHttpRequest. Status ' + httpRequest.status);
 
-                     }
 
-                 }
 
-             };
 
-         if (window.XMLHttpRequest) {
 
-             httpRequest = new XMLHttpRequest();
 
-             if (httpRequest.overrideMimeType) {
 
-                 httpRequest.overrideMimeType('text/xml');
 
-             }
 
-             httpRequest.onreadystatechange = templateReady;
 
-             try {
 
-                 httpRequest.open('GET', self.templatePath, true);
 
-             }
 
-             catch (e) {
 
-                 showError(e + '참고: 에디터를 웹 서버에서 실행하여 주십시오.');
 
-             }
 
-             httpRequest.send();
 
-         } else if (window.ActiveXObject) {
 
-             httpRequest = new window.ActiveXObject('Microsoft.XMLDOM');
 
-             httpRequest.async = true;
 
-             httpRequest.onreadystatechange = templateReady;
 
-             httpRequest.load(self.templatePath);
 
-         } else {
 
-             showError('현재 브라우저에서 ' + self.templateFile + ' 파일을 사용할 수 없습니다.');
 
-         }
 
-     },
 
-     getCDATASection: function (node) {
 
-         var text = node.textContent || node.text;
 
-         return this.trimSpace(text.replace(/\n/g, '').replace(/(\s+?)<([^>]*)>/g, '<$2>'));
 
-     },
 
-     setToolbarBgPosition: function (elem, attr) {
 
-         elem.style.backgroundPosition = attr;
 
-     },
 
-     getToolbarBgPosition: function (elem) {
 
-         var pos;
 
-         switch (elem.className) {
 
-             case 'cheditor-tb-bg': pos = 3; break;
 
-             case 'cheditor-tb-bg-last': pos = 6; break;
 
-             case 'cheditor-tb-bg-single': pos = 9; break;
 
-             case 'cheditor-tb-bg30-first': pos = 12; break;
 
-             case 'cheditor-tb-bg30': pos = 15; break;
 
-             case 'cheditor-tb-bg30-last': pos = 18; break;
 
-             case 'cheditor-tb-bg55': pos = 21; break;
 
-             case 'cheditor-tb-bg40': pos = 24; break;
 
-             case 'cheditor-tb-bg44': pos = 27; break;
 
-             case 'cheditor-tb-bgcombo': pos = 30; break;
 
-             case 'cheditor-tb-bgcombo-last': pos = 33; break;
 
-             default: pos = 0;
 
-         }
 
-         return pos;
 
-     },
 
-     toolbarMouseOverUp: function (elem) {
 
-         var pos, obj;
 
-         if (elem.checked) {
 
-             return;
 
-         }
 
-         this.setToolbarBgPosition(elem.button, '0 ' + (~(((elem.pos + 1) * elem.height)) + 1) + 'px');
 
-         if ((elem.name === 'combobox' && elem.prev && elem.prev.checked) ||
 
-                 (elem.name === 'combo' && elem.next && elem.next.checked)) {
 
-             return;
 
-         }
 
-         if (elem.type === 'combobox') {
 
-             if (elem.prev.checked) {
 
-                 return;
 
-             }
 
-             obj = elem.prev;
 
-             pos = '0px ' + (~(((obj.pos + 1) * obj.height)) + 1) + 'px';
 
-             this.setToolbarBgPosition(obj.button, pos);
 
-         } else if (elem.type === 'combo') {
 
-             if (elem.prev && !elem.prev.checked && !elem.prev.active) {
 
-                 obj = elem.prev;
 
-                 pos = (~(obj.width) + 1) + 'px ' + (~(obj.pos * obj.height) + 1) + 'px';
 
-                 this.setToolbarBgPosition(obj.button, pos);
 
-             }
 
-             if (elem.next) {
 
-                 if (elem.next.checked) {
 
-                     return;
 
-                 }
 
-                 obj = elem.next;
 
-                 pos = (~(obj.width) + 1) + 'px ' + (~(((obj.pos + 1) * obj.height)) + 1) + 'px';
 
-                 this.setToolbarBgPosition(obj.button, pos);
 
-             }
 
-         } else {
 
-             if (!elem.prev || (elem.prev && elem.prev.checked)) {
 
-                 return;
 
-             }
 
-             obj = elem.prev;
 
-             if (obj.className === 'cheditor-tb-bg-first') {
 
-                 pos = (~(obj.width) + 1) + 'px 0';
 
-             } else {
 
-                 pos = (~(obj.width) + 1) + 'px ' + (~(obj.pos * obj.height) + 1) + 'px';
 
-             }
 
-             this.setToolbarBgPosition(obj.button, pos);
 
-         }
 
-     },
 
-     toolbarMouseDownOut: function (elem, mousedown) {
 
-         if (elem.next && elem.next.checked && !mousedown) {
 
-             this.setToolbarBgPosition(elem.button, (~(elem.width * 2) + 1) + 'px ' +
 
-                 (~(elem.pos * elem.height) + 1) + 'px');
 
-         }
 
-         if (elem.prev) {
 
-             if (elem.prev.active || (elem.prev.type === 'combo' && elem.checked)) {
 
-                 return;
 
-             }
 
-             if (elem.prev.checked) {
 
-                 this.setToolbarBgPosition(elem.prev.button, '0 ' +
 
-                     (~((elem.prev.pos + 2) * elem.prev.height) + 1) + 'px');
 
-                 return;
 
-             }
 
-             if (mousedown) {
 
-                 this.setToolbarBgPosition(elem.prev.button, (~(elem.prev.width * 2) + 1) + 'px ' +
 
-                     (~(elem.prev.pos * elem.prev.height) + 1) + 'px');
 
-             } else {
 
-                 this.setToolbarBgPosition(elem.prev.button,
 
-                     '0 ' + (~(elem.prev.pos * elem.prev.height) + 1) + 'px');
 
-             }
 
-         }
 
-     },
 
-     toolbarButtonChecked: function (elem) {
 
-         this.setToolbarBgPosition(elem.button, '0 ' + (~((elem.pos + 2) * elem.height) + 1) + 'px');
 
-         if (elem.prev && elem.prev.type === 'combo') {
 
-             if (elem.prev.checked || elem.checked) {
 
-                 return;
 
-             }
 
-             this.setToolbarBgPosition(elem.prev.button, (~(elem.prev.width * 2) + 1) + 'px ' +
 
-                 (~(elem.prev.pos * elem.prev.height) + 1) + 'px');
 
-         }
 
-         if (elem.prev && !elem.prev.checked) {
 
-             if (elem.checked) {
 
-                 this.setToolbarBgPosition(elem.prev.button, (~(elem.prev.width * 2) + 1) + 'px ' +
 
-                     (~(elem.prev.pos * elem.prev.height) + 1) + 'px');
 
-             } else {
 
-                 this.setToolbarBgPosition(elem.prev.button, '0 ' + (~(elem.prev.pos * elem.prev.height) + 1) + 'px');
 
-             }
 
-         }
 
-     },
 
-     toolbarButtonUnchecked: function (elem) {
 
-         if (elem.type === 'combobox' && !elem.checked) {
 
-             if (elem.prev.checked) {
 
-                 this.setToolbarBgPosition(elem.button,
 
-                     (~(elem.width) + 1) + 'px ' + (~(((elem.pos + 1) * elem.height)) + 1) + 'px');
 
-                 return;
 
-             }
 
-             this.setToolbarBgPosition(elem.prev.button, '0 ' + (~(elem.prev.pos * elem.prev.height) + 1) + 'px');
 
-         }
 
-         this.setToolbarBgPosition(elem.button, '0 ' + (~(elem.pos * elem.height) + 1) + 'px');
 
-         if (elem.prev && elem.prev.name === 'BackColor') {
 
-             this.setToolbarBgPosition(elem.prev.button, '0 ' + (~(elem.prev.pos * elem.prev.height) + 1) + 'px');
 
-         }
 
-     },
 
-     makeToolbarGrayscale: function (image) {
 
-         var context, imageData, filter, imgWidth = image.width, imgHeight = image.height,
 
-             canvas = this.doc.createElement('canvas');
 
-         filter = function (pixels) {
 
-             var d = pixels.data, i, r, g, b;
 
-             for (i = 0; i < d.length; i += 4) {
 
-                 r = d[i];
 
-                 g = d[i + 1];
 
-                 b = d[i + 2];
 
-                 d[i] = d[i + 1] = d[i + 2] = (r + g + b) / 3;
 
-             }
 
-             return pixels;
 
-         };
 
-         context = canvas.getContext('2d');
 
-         canvas.width = imgWidth;
 
-         canvas.height = imgHeight;
 
-         context.drawImage(image, 0, 0);
 
-         imageData = context.getImageData(0, 0, imgWidth, imgHeight);
 
-         filter(imageData);
 
-         context.putImageData(imageData, 0, 0);
 
-         return canvas.toDataURL();
 
-     },
 
-     toolbarSetBackgroundImage: function (elem, disable) {
 
-         var css = elem.firstChild.className,
 
-             tbEnable = (this.cheditor.toolbarGrayscale && elem.firstChild.style.backgroundImage);
 
-         css = css.replace(/-disable$/i, '');
 
-         if (disable) {
 
-             if (tbEnable) {
 
-                 elem.firstChild.style.backgroundImage = 'url(' + this.cheditor.toolbarGrayscale + ')';
 
-             }
 
-             css = css + '-disable';
 
-             elem.style.cursor = 'default';
 
-         } else {
 
-             if (tbEnable) {
 
-                 elem.firstChild.style.backgroundImage = 'url(' + this.toolbar.icon + ')';
 
-             }
 
-             elem.style.cursor = 'pointer';
 
-         }
 
-         elem.firstChild.className = css;
 
-     },
 
-     toolbarDisable: function (elem, disable) {
 
-         if (disable) {
 
-             this.toolbarSetBackgroundImage(elem.button, true);
 
-             this.toolbarButtonUnchecked(elem);
 
-             this.toolbarMouseDownOut(elem);
 
-             this.toolbar[elem.name].disabled = true;
 
-             return true;
 
-         }
 
-         this.toolbarSetBackgroundImage(elem.button, false);
 
-         this.toolbar[elem.name].disabled = false;
 
-         return false;
 
-     },
 
-     colorConvert: function (color, which, opacity) {
 
-         var colorDefs = [
 
-             {
 
-                 re: /^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,
 
-                 process: function (bits) {
 
-                     return [
 
-                         parseInt(bits[1], 10),
 
-                         parseInt(bits[2], 10),
 
-                         parseInt(bits[3], 10),
 
-                         1
 
-                     ];
 
-                 }
 
-             },
 
-             {
 
-                 re: /^rgba\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3}),\s*(\d+(?:\.\d+)?|\.\d+)\s*\)/,
 
-                 process: function (bits) {
 
-                     return [
 
-                         parseInt(bits[1], 10),
 
-                         parseInt(bits[2], 10),
 
-                         parseInt(bits[3], 10),
 
-                         parseFloat(bits[4])
 
-                     ];
 
-                 }
 
-             },
 
-             {
 
-                 re: /^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
 
-                 process: function (bits) {
 
-                     return [
 
-                         parseInt(bits[1], 16),
 
-                         parseInt(bits[2], 16),
 
-                         parseInt(bits[3], 16),
 
-                         1
 
-                     ];
 
-                 }
 
-             },
 
-             {
 
-                 re: /^([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])$/,
 
-                 process: function (bits) {
 
-                     return [
 
-                         parseInt(bits[1] * 2, 16),
 
-                         parseInt(bits[2] * 2, 16),
 
-                         parseInt(bits[3] * 2, 16),
 
-                         1
 
-                     ];
 
-                 }
 
-             }
 
-         ], r = null, g = null, b = null, a = null, i, re, processor, bits, channels, min, rData = null;
 
-         if (!which) {
 
-             which = 'rgba';
 
-         }
 
-         color = color.replace(/^\s*#|\s*$/g, '');
 
-         if (color.length === 3) {
 
-             color = color.replace(/(.)/g, '$1$1');
 
-         }
 
-         color = color.toLowerCase();
 
-         which = which.toLowerCase();
 
-         for (i = 0; i < colorDefs.length; i++) {
 
-             re = colorDefs[i].re;
 
-             processor = colorDefs[i].process;
 
-             bits = re.exec(color);
 
-             if (bits) {
 
-                 channels = processor(bits);
 
-                 r = channels[0];
 
-                 g = channels[1];
 
-                 b = channels[2];
 
-                 a = channels[3];
 
-             }
 
-         }
 
-         r = (r < 0 || isNaN(r)) ? 0 : ((r > 255) ? 255 : r);
 
-         g = (g < 0 || isNaN(g)) ? 0 : ((g > 255) ? 255 : g);
 
-         b = (b < 0 || isNaN(b)) ? 0 : ((b > 255) ? 255 : b);
 
-         a = (a < 0 || isNaN(a)) ? 0 : ((a > 1) ? 1 : a);
 
-         function hex(x) {
 
-             return ('0' + parseInt(x, 10).toString(16)).slice(-2);
 
-         }
 
-         switch (which) {
 
-             case 'rgba':
 
-                 if (opacity) {
 
-                     a = (255 - (min = Math.min(r, g, b))) / 255;
 
-                     r = ((r - min) / a).toFixed(0);
 
-                     g = ((g - min) / a).toFixed(0);
 
-                     b = ((b - min) / a).toFixed(0);
 
-                     a = a.toFixed(4);
 
-                 }
 
-                 rData = 'rgba(' + r + ',' + g + ',' + b + ',' + a + ')';
 
-                 break;
 
-             case 'rgb':
 
-                 rData = 'rgb(' + r + ',' + g + ',' + b + ')';
 
-                 break;
 
-             case 'hex':
 
-                 if (isNaN(parseInt(r, 10)) || isNaN(parseInt(g, 10)) || isNaN(parseInt(b, 10))) {
 
-                     return color;
 
-                 }
 
-                 rData = '#' + hex(r) + hex(g) + hex(b);
 
-                 break;
 
-         }
 
-         return rData;
 
-     },
 
-     toolbarUpdate: function (srcElement) {
 
-         var toolbar = this.toolbar,
 
-             range = this.getRange(),
 
-             isCollapsed = this.rangeCollapsed(range),
 
-             sType = GB.selection.text,
 
-             bControl = false, bTable = false, ancestorsLen = 0, bNoOff = { 'Link': 1 }, ancestors = [],
 
-             i, j, btn, cmd, autoOff, bDisable, el, wrapper, fontAttr, oldName, span, newAttr, defaultAttr,
 
-             state, css, node, alignment, pNode;
 
-         pNode = srcElement || this.getRangeElement(range);
 
-         switch (pNode.nodeType) {
 
-             case GB.node.element:
 
-                 sType = GB.selection.element;
 
-                 break;
 
-             case GB.node.text:
 
-                 sType = GB.selection.text;
 
-                 pNode = pNode.parentNode;
 
-                 break;
 
-             default:
 
-                 return;
 
-         }
 
-         if (sType === GB.selection.element && !isCollapsed) {
 
-             bControl = GB.offElementTags[pNode.nodeName.toLowerCase()];
 
-         } else {
 
-             node = pNode;
 
-             while (node && node.nodeType === GB.node.element && node.nodeName.toLowerCase() !== 'body') {
 
-                 ancestors.push(node);
 
-                 if (node.nodeName.toLowerCase() === 'td' || node.nodeName.toLowerCase() === 'th') {
 
-                     bTable = true;
 
-                 }
 
-                 node = node.parentNode;
 
-             }
 
-             ancestorsLen = ancestors.length;
 
-         }
 
-         if (!bTable && sType === GB.selection.element &&
 
-             (pNode.nodeName.toLowerCase() === 'table' || pNode.nodeName.toLowerCase() === 'td' ||
 
-              pNode.nodeName.toLowerCase() === 'th')) {
 
-             bTable = true;
 
-         }
 
-         alignment = { JustifyCenter: 'center', JustifyRight: 'right', JustifyFull: 'justify' };
 
-         for (i in toolbar) {
 
-             if (!toolbar.hasOwnProperty(i)) {
 
-                 continue;
 
-             }
 
-             btn = toolbar[i];
 
-             if (!btn.cmd) {
 
-                 continue;
 
-             }
 
-             cmd = btn.cmd;
 
-             autoOff = false;
 
-             if (bControl && sType === GB.selection.element) {
 
-                 if (btn.group !== 'Alignment') {
 
-                     autoOff = !(pNode.nodeName.toLowerCase() === 'img' && bNoOff[cmd]);
 
-                 }
 
-             }
 
-             if (btn.name === 'ModifyTable') {
 
-                 autoOff = !bTable;
 
-             }
 
-             bDisable = this.toolbarDisable(btn, autoOff);
 
-             if (btn.name === 'ForeColor' || btn.name === 'BackColor') {
 
-                 btn.button.lastChild.style.display = bDisable ? 'none' : 'block';
 
-             }
 
-             if (btn.autocheck === null) {
 
-                 continue;
 
-             }
 
-             switch (cmd) {
 
-                 case 'Copy':
 
-                 case 'Cut':
 
-                     this.toolbarDisable(btn, isCollapsed);
 
-                     break;
 
-                 case 'UnLink':
 
-                     if (GB.browser.firefox) {
 
-                         this.toolbarDisable(btn, (pNode.nodeName.toLowerCase() !== 'a' && !pNode.getAttribute('href')));
 
-                     } else {
 
-                         this.toolbarDisable(btn, this.doc.queryCommandEnabled(cmd) === false);
 
-                     }
 
-                     break;
 
-                 case 'FormatBlock':
 
-                     wrapper = btn.button.firstChild;
 
-                     oldName = wrapper.firstChild;
 
-                     el = false;
 
-                     span = document.createElement('span');
 
-                     for (j = 0; j < ancestorsLen; j++) {
 
-                         if (GB.formatBlock[ancestors[j].nodeName]) {
 
-                             span.appendChild(document.createTextNode(ancestors[j].nodeName));
 
-                             wrapper.replaceChild(span, oldName);
 
-                             el = true;
 
-                             break;
 
-                         }
 
-                     }
 
-                     if (!el) {
 
-                         span.appendChild(document.createTextNode('스타일'));
 
-                         wrapper.replaceChild(span, oldName);
 
-                     }
 
-                     this.unselectionElement(span);
 
-                     break;
 
-                 case 'ForeColor':
 
-                 case 'BackColor':
 
-                     if (cmd === 'BackColor' && !GB.browser.msie) {
 
-                         cmd = 'HiliteColor';
 
-                     }
 
-                     fontAttr = this.doc.queryCommandValue(cmd);
 
-                     if (fontAttr && !/^[rgb|#]/.test(fontAttr)) {
 
-                         fontAttr = (((fontAttr & 0x0000ff) << 16) | (fontAttr & 0x00ff00) | ((fontAttr & 0xff0000) >>> 16)).toString(16);
 
-                         fontAttr = '#000000'.slice(0, 7 - fontAttr.length) + fontAttr;
 
-                     } else {
 
-                         fontAttr = (cmd === 'ForeColor') ? this.config.editorFontColor : this.config.editorBgColor;
 
-                     }
 
-                     btn.button.lastChild.style.backgroundColor = fontAttr;
 
-                     break;
 
-                 case 'FontName':
 
-                 case 'FontSize':
 
-                     fontAttr = this.doc.queryCommandValue(cmd);
 
-                     wrapper = btn.button.firstChild;
 
-                     span = this.doc.createElement('span');
 
-                     if (cmd === 'FontSize') {
 
-                         fontAttr = pNode.style.fontSize;
 
-                         if (!fontAttr) {
 
-                             for (i = 0; i < ancestors.length; i++) {
 
-                                 fontAttr = ancestors[i].style.fontSize;
 
-                                 if (fontAttr) {
 
-                                     break;
 
-                                 }
 
-                             }
 
-                         }
 
-                     }
 
-                     if (fontAttr) {
 
-                         newAttr = fontAttr;
 
-                         newAttr = newAttr.replace(/'/g, '');
 
-                         span.appendChild(this.doc.createTextNode(newAttr));
 
-                         wrapper.replaceChild(span, wrapper.firstChild);
 
-                     }
 
-                     if (!span.hasChildNodes()) {
 
-                         defaultAttr = (cmd === 'FontSize') ? this.config.editorFontSize : this.config.editorFontName;
 
-                         if (wrapper.hasChildNodes()) {
 
-                             wrapper.removeChild(wrapper.firstChild);
 
-                         }
 
-                         defaultAttr = defaultAttr.replace(/'/g, '');
 
-                         span.appendChild(this.doc.createTextNode(defaultAttr));
 
-                         wrapper.appendChild(span);
 
-                     }
 
-                     this.unselectionElement(span);
 
-                     break;
 
-                 case 'LineHeight':
 
-                     wrapper = btn.button.firstChild;
 
-                     this.unselectionElement(wrapper.firstChild);
 
-                     break;
 
-                 default:
 
-                     if (!this.doc.queryCommandSupported(cmd)) {
 
-                         continue;
 
-                     }
 
-                     state = this.doc.queryCommandState(cmd);
 
-                     if (state === null) {
 
-                         continue;
 
-                     }
 
-                     if (GB.browser.msie && state === false && alignment[cmd]) {
 
-                         el = pNode;
 
-                         while (el && el.nodeName.toLowerCase() !== 'body') {
 
-                             if (GB.lineHeightBlockTags[el.nodeName.toLowerCase()]) {
 
-                                 css = this.getCssValue(el);
 
-                                 if (css) {
 
-                                     for (j = 0; j < css.length; j++) {
 
-                                         if (css[j].name.toLowerCase() === 'text-align' && css[j].value === alignment[cmd]) {
 
-                                             state = true;
 
-                                             break;
 
-                                         }
 
-                                     }
 
-                                 }
 
-                             }
 
-                             el = el.parentNode;
 
-                         }
 
-                     }
 
-                     if (state) {
 
-                         btn.checked = true;
 
-                         this.toolbarButtonChecked(btn);
 
-                         if (btn.type === 'combo' && btn.name === btn.next.node) {
 
-                             btn.next.active = true;
 
-                             this.setToolbarBgPosition(btn.next.button,
 
-                                 (~(btn.next.width) + 1) + 'px ' + (~(((btn.next.pos + 1) * btn.next.height)) + 1) + 'px');
 
-                         }
 
-                     } else {
 
-                         this.toolbarButtonUnchecked(btn);
 
-                         btn.checked = false;
 
-                         if (btn.next) {
 
-                             btn.next.active = false;
 
-                             if (btn.type === 'combo' && btn.name === btn.next.node) {
 
-                                 this.toolbarButtonUnchecked(btn.next);
 
-                             }
 
-                         }
 
-                     }
 
-             }
 
-         }
 
-     },
 
-     createButton: function (name, attr, prev) {
 
-         var self = this,
 
-             elem, icon, btnIcon, iconPos, method, cmd, check, type, node, btnHeight, btnWidth, text,
 
-             span, obj, btnClass, comboOut;
 
-         method = attr.getElementsByTagName('Execution')[0].getAttribute('method');
 
-         cmd = attr.getElementsByTagName('Execution')[0].getAttribute('value');
 
-         check = attr.getAttribute('check');
 
-         type = attr.getAttribute('type');
 
-         node = attr.getAttribute('node');
 
-         btnClass = attr.getAttribute('class');
 
-         btnWidth = attr.getAttribute('width');
 
-         btnHeight = attr.getAttribute('height');
 
-         elem = document.createElement('div');
 
-         elem.style.width = btnWidth + 'px';
 
-         elem.setAttribute('name', name);
 
-         elem.style.height = btnHeight + 'px';
 
-         elem.style.border = '0px solid transparent';
 
-         icon = attr.getElementsByTagName('Icon')[0];
 
-         btnIcon = document.createElement('div');
 
-         btnIcon.className = icon.getAttribute('class');
 
-         btnIcon.style.marginLeft = icon.getAttribute('margin') || '3px';
 
-         iconPos = icon.getAttribute('position');
 
-         if (iconPos) {
 
-             btnIcon.style.backgroundImage = 'url(' + self.toolbar.icon + ')';
 
-             btnIcon.style.backgroundRepeat = 'no-repeat';
 
-             self.setToolbarBgPosition(btnIcon, (~iconPos + 1) + 'px center');
 
-         } else {
 
-             text = icon.getAttribute('alt');
 
-             if (text) {
 
-                 span = document.createElement('span');
 
-                 span.appendChild(document.createTextNode(text));
 
-                 btnIcon.appendChild(span);
 
-             }
 
-         }
 
-         elem.appendChild(btnIcon);
 
-         obj = {
 
-             'autocheck': check,
 
-             'button': elem,
 
-             'className': btnClass,
 
-             'checked': false,
 
-             'cmd': cmd,
 
-             'colorNode': {},
 
-             'disabled': false,
 
-             'group': '',
 
-             'height': btnHeight,
 
-             'method': method,
 
-             'name': name,
 
-             'next': null,
 
-             'node': node,
 
-             'num': 0,
 
-             'pos': 0,
 
-             'prev': prev,
 
-             'type': type,
 
-             'width': btnWidth
 
-         };
 
-         if (prev) {
 
-             prev.next = obj;
 
-         }
 
-         elem.attr = obj;
 
-         self.toolbar[name] = obj;
 
-         self.addEvent(elem, 'mouseover', function (ev) {
 
-             if (!obj.disabled) {
 
-                 self.toolbarMouseOverUp(obj);
 
-             }
 
-             self.stopEvent(ev || window.event);
 
-         });
 
-         self.addEvent(elem, 'mousedown', function (ev) {
 
-             if (!obj.checked && !obj.disabled) {
 
-                 self.toolbarButtonChecked(obj);
 
-                 self.toolbarMouseDownOut(obj, true);
 
-                 if (obj.prev && obj.prev.type === 'combo' && !obj.prev.checked) {
 
-                     self.setToolbarBgPosition(obj.prev.button,
 
-                         '0 ' + (~((self.getToolbarBgPosition(obj.prev.button) + 1) * obj.prev.height) + 1) + 'px');
 
-                 }
 
-             }
 
-             if (obj.next) {
 
-                 obj.next.button.style.visibility = 'hidden';
 
-                 obj.next.button.style.visibility = 'visible';
 
-             }
 
-             self.stopEvent(ev || window.event);
 
-         });
 
-         self.addEvent(elem, 'click', function (ev) {
 
-             if (obj.disabled) {
 
-                 return;
 
-             }
 
-             switch (obj.method) {
 
-                 case 'doCmd':
 
-                     self.backupRange();
 
-                     self.doCmd(obj.cmd, null);
 
-                     break;
 
-                 case 'windowOpen':
 
-                     self.windowOpen(obj.cmd);
 
-                     break;
 
-                 case 'showPulldown':
 
-                     if (obj.checked) {
 
-                         obj.checked = false;
 
-                         self.boxHideAll();
 
-                         self.toolbarButtonUnchecked(obj);
 
-                         return;
 
-                     }
 
-                     obj.checked = true;
 
-                     self.showPulldown(obj.cmd, obj.button);
 
-                     self.toolbarButtonChecked(obj);
 
-                     self.toolbarMouseDownOut(obj, true);
 
-                     break;
 
-                 default:
 
-                     alert('지원하지 않는 명령입니다.');
 
-             }
 
-             self.stopEvent(ev || window.event);
 
-         });
 
-         comboOut = function (combo, startPos) {
 
-             self.setToolbarBgPosition(combo.button,
 
-                 startPos + 'px ' + (~(((self.getToolbarBgPosition(combo.button) + (combo.checked ? 2 : 1)) * combo.height)) + 1) + 'px');
 
-         };
 
-         self.addEvent(elem, 'mouseout', function () {
 
-             if (!obj.checked) {
 
-                 if (obj.type === 'combo') {
 
-                     if (obj.next) {
 
-                         if (!obj.next.checked) {
 
-                             self.toolbarButtonUnchecked(obj.next);
 
-                             self.toolbarMouseDownOut(obj.next, false);
 
-                         } else {
 
-                             return;
 
-                         }
 
-                     }
 
-                 }
 
-                 if (obj.type === 'combobox' && obj.prev.checked) {
 
-                     self.setToolbarBgPosition(obj.button,
 
-                         (~(obj.width) + 1) + 'px ' + (~(((obj.pos + 1) * obj.height)) + 1) + 'px');
 
-                     return;
 
-                 }
 
-                 self.toolbarButtonUnchecked(obj);
 
-                 self.toolbarMouseDownOut(obj, false);
 
-             } else {
 
-                 if (obj.node && obj.node === obj.prev.name) {
 
-                     if (!obj.prev.checked) {
 
-                         self.setToolbarBgPosition(obj.prev.button,
 
-                             '0 ' + (~((self.getToolbarBgPosition(obj.prev.button) + 1) * obj.prev.height) + 1) + 'px');
 
-                     }
 
-                     comboOut(obj, 0);
 
-                 }
 
-             }
 
-         });
 
-         return obj;
 
-     },
 
-     showToolbar: function (toolbar, toolbarWrapper) {
 
-         var self = this,
 
-             i, j, grpName, btn, btnLen, prevObj, attr, btnName, btnObj = null, btnNum, spacer,
 
-             currentColor, fullscreen, child, len,
 
-             toolbarIcon = toolbar.getElementsByTagName('Image').item(0).getAttribute('file'),
 
-             tmpArr = toolbarIcon.split(/\./),
 
-             group = toolbar.getElementsByTagName('Group'),
 
-             grpNum = group.length,
 
-             appendSpaceBlock = function (pNode) {
 
-                 var split = document.createElement('div');
 
-                 split.className = 'cheditor-tb-split';
 
-                 pNode.appendChild(split);
 
-             },
 
-             onClickEventHandler = function () {
 
-                 if (self.setFullScreenMode) {
 
-                     this.className = 'cheditor-tb-fullscreen';
 
-                     this.setAttribute('title', '전체 화면');
 
-                 } else {
 
-                     this.className = 'cheditor-tb-fullscreen-actual';
 
-                     this.setAttribute('title', '이전 크기로 복원');
 
-                 }
 
-                 self.fullScreenMode();
 
-             };
 
-         self.toolbar.icon = self.config.iconPath + toolbarIcon;
 
-         self.toolbar.iconDisable = self.config.iconPath + tmpArr[0] + '-disable' + '.' + tmpArr[1];
 
-         toolbarWrapper.className = 'cheditor-tb-wrapper';
 
-         fullscreen = document.createElement('span');
 
-         if (self.config.useFullScreen === true) {
 
-             fullscreen.appendChild(document.createTextNode('\u00a0'));
 
-             fullscreen.className = 'cheditor-tb-fullscreen';
 
-             fullscreen.setAttribute('title', '전체 화면');
 
-             (function () {
 
-                 fullscreen.onclick = onClickEventHandler;
 
-             })();
 
-         } else {
 
-             fullscreen.clsaaName = 'cheditor-tb-fullscreen-disable';
 
-         }
 
-         toolbarWrapper.appendChild(fullscreen);
 
-         for (i = 0; i < grpNum; i++) {
 
-             grpName = group[i].getAttribute('name');
 
-             if (grpName === 'Split') {
 
-                 appendSpaceBlock(toolbarWrapper);
 
-                 continue;
 
-             }
 
-             btn = group[i].getElementsByTagName('Button');
 
-             btnLen = btn.length;
 
-             btnNum = 0; btnObj = null;
 
-             for (j = 0; j < btnLen; j++) {
 
-                 attr = btn[j].getElementsByTagName('Attribute')[0];
 
-                 btnName = btn[j].getAttribute('name');
 
-                 if (!attr.getAttribute('node') && self.config['use' + btnName] !== true) {
 
-                     continue;
 
-                 }
 
-                 if (attr.getAttribute('type') === 'combobox' && self.config['use' + attr.getAttribute('node')] !== true) {
 
-                     continue;
 
-                 }
 
-                 btnObj = self.createButton(btnName, attr, btnObj);
 
-                 self.toolbar[btnObj.name].num = btnNum++;
 
-                 self.toolbar[btnObj.name].group = grpName;
 
-                 if (btn[j].getAttribute('tooltip') !== null) {
 
-                     btnObj.button.setAttribute('title', btn[j].getAttribute('tooltip'));
 
-                 }
 
-                 if (btnObj.name === 'ForeColor' || btnObj.name === 'BackColor') {
 
-                     currentColor = document.createElement('div');
 
-                     currentColor.className = 'cheditor-tb-color-btn';
 
-                     currentColor.style.backgroundColor = attr.getAttribute('default');
 
-                     btnObj.button.appendChild(currentColor);
 
-                 }
 
-                 toolbarWrapper.appendChild(btnObj.button);
 
-             }
 
-             if (btnObj === null) {
 
-                 continue;
 
-             }
 
-             prevObj = btnObj.prev;
 
-             if (!prevObj) {
 
-                 btnObj.button.className = btnObj.className;
 
-                 if (btnObj.className === 'cheditor-tb-bg') {
 
-                     btnObj.className = btnObj.className + '-single';
 
-                     btnObj.button.className = btnObj.className;
 
-                 }
 
-                 btnObj.pos = self.getToolbarBgPosition(btnObj.button);
 
-             } else {
 
-                 btnObj.className = btnObj.className + '-last';
 
-                 btnObj.button.className = btnObj.className;
 
-                 btnObj.pos = self.getToolbarBgPosition(btnObj.button);
 
-                 while (prevObj) {
 
-                     prevObj.button.className = prevObj.className;
 
-                     prevObj.pos = self.getToolbarBgPosition(prevObj.button);
 
-                     btnObj = prevObj;
 
-                     prevObj = prevObj.prev;
 
-                 }
 
-                 btnObj.className = btnObj.className + '-first';
 
-                 btnObj.button.className = btnObj.className;
 
-                 btnObj.pos = self.getToolbarBgPosition(btnObj.button);
 
-             }
 
-             spacer = document.createElement('div');
 
-             spacer.className = 'cheditor-tb-button-spacer';
 
-             toolbarWrapper.appendChild(spacer);
 
-         }
 
-         appendSpaceBlock(toolbarWrapper);
 
-         if (GB.browser.msie) {
 
-             child = toolbarWrapper.getElementsByTagName('div');
 
-             len = child.length;
 
-             for (i = 0; i < len; i++) {
 
-                 self.unselectionElement(child[i]);
 
-             }
 
-             self.unselectionElement(toolbarWrapper);
 
-         } else {
 
-             self.unselectionElement(toolbarWrapper);
 
-         }
 
-     },
 
-     unselectionElement: function (elem) {
 
-         if (!elem || elem.nodeType !== GB.node.element) {
 
-             return;
 
-         }
 
-         if (GB.browser.msie) {
 
-             elem.setAttribute('unselectable', 'on');
 
-             elem.setAttribute('contentEditable', 'false');
 
-         } else {
 
-             elem.onselectstart = new Function('return false');
 
-         }
 
-     },
 
-     createEditorElement: function (container, toolbar) {
 
-         var child = container.firstChild,
 
-             self = this,
 
-             i, id, tab, tabId, editArea, done = false, frameEl = false, tryScroll, textContent, node,
 
-             onClickEventHandler = function () {
 
-                 self.switchEditorMode(this.getAttribute('mode'));
 
-             },
 
-             onMouseDownEventHandler = function (evt) {
 
-                 self.resizeStart(evt);
 
-             },
 
-             modeOnMouseDownEventHandler = function (evt) {
 
-                 self.backupRange();
 
-                 self.stopEvent(evt);
 
-             },
 
-             pNode = self.cheditor.textarea.parentNode,
 
-             nNode = self.cheditor.textarea.nextSibling;
 
-         if (!child) {
 
-             return;
 
-         }
 
-         do {
 
-             id = child.getAttribute('id');
 
-             switch (id) {
 
-                 case 'toolbar':
 
-                     self.showToolbar(toolbar, child);
 
-                     self.cheditor.toolbarWrapper = child;
 
-                     break;
 
-                 case 'viewMode':
 
-                     self.cheditor[id] = child;
 
-                     self.cheditor.mode = 'rich';
 
-                     if (child.hasChildNodes()) {
 
-                         tab = child.childNodes;
 
-                         self.cheditor.modetab = {};
 
-                         for (i = 0; i < tab.length; i++) {
 
-                             tabId = tab[i].getAttribute('id');
 
-                             if (!tabId) {
 
-                                 continue;
 
-                             }
 
-                             if ((tabId === 'code' && self.config.useSource === false) ||
 
-                                 (tabId === 'preview' && self.config.usePreview === false)) {
 
-                                 tab[i].style.display = 'none';
 
-                                 tab[i].removeAttribute('id');
 
-                                 continue;
 
-                             }
 
-                             tab[i].setAttribute('mode', tabId);
 
-                             tab[i].onclick = onClickEventHandler;
 
-                             tab[i].onmousedown = modeOnMouseDownEventHandler;
 
-                             tab[i].removeAttribute('id');
 
-                             self.cheditor.modetab[tabId] = tab[i];
 
-                             self.unselectionElement(tab[i]);
 
-                         }
 
-                     }
 
-                     break;
 
-                 case 'editWrapper':
 
-                     node = child.firstChild;
 
-                     while (node) {
 
-                         if (node.nodeName.toLowerCase() === 'iframe') {
 
-                             editArea = node;
 
-                         } else if (node.nodeName.toLowerCase() === 'textarea') {
 
-                             textContent = node;
 
-                         }
 
-                         node = node.nextSibling;
 
-                     }
 
-                     editArea.style.height = self.config.editorHeight;
 
-                     editArea.style.backgroundColor = this.config.editorBgColor;
 
-                     self.cheditor.editArea = editArea;
 
-                     self.cheditor.editWrapper = child;
 
-                     self.cheditor.textContent = textContent;
 
-                     break;
 
-                 case 'modifyBlock':
 
-                     self.cheditor.editBlock = child;
 
-                     break;
 
-                 case 'tagPath':
 
-                     if (self.config.showTagPath) {
 
-                         self.cheditor.tagPath = child.firstChild;
 
-                         child.style.display = 'block';
 
-                     }
 
-                     break;
 
-                 case 'resizeBar':
 
-                     self.cheditor.resizeBar = child;
 
-                     child.onmousedown = onMouseDownEventHandler;
 
-                     self.unselectionElement(child);
 
-                     break;
 
-                 default: break;
 
-             }
 
-             child.removeAttribute('id');
 
-             child = child.nextSibling;
 
-         } while (child);
 
-         if (!nNode) {
 
-             pNode.appendChild(container);
 
-         } else {
 
-             pNode.insertBefore(container, nNode);
 
-         }
 
-         function ready() {
 
-             if (done) {
 
-                 return;
 
-             }
 
-             done = true;
 
-         }
 
-         if (GB.browser.msie) {
 
-             frameEl = window.frameElement !== null;
 
-             if (document.documentElement.doScroll && !frameEl) {
 
-                 tryScroll = function () {
 
-                     if (done) {
 
-                         return;
 
-                     }
 
-                     try {
 
-                         document.documentElement.doScroll('left');
 
-                         ready();
 
-                     } catch (e) {
 
-                         setTimeout(tryScroll, 10);
 
-                     }
 
-                 };
 
-                 tryScroll();
 
-             }
 
-             self.addEvent(document, 'readystatechange', function () {
 
-                 if (document.readyState === 'complete') {
 
-                     ready();
 
-                 }
 
-             });
 
-         } else {
 
-             self.addEvent(document, 'DOMContentLoaded', function () {
 
-                 ready();
 
-             });
 
-         }
 
-         container.style.width = self.config.editorWidth;
 
-         self.cheditor.container = container;
 
-     },
 
-     loadTemplate: function (xmlDoc) {
 
-         var self = this,
 
-             tmpl = xmlDoc.getElementsByTagName('Template').item(0),
 
-             toolbar = tmpl.getElementsByTagName('Toolbar').item(0),
 
-             cdata = tmpl.getElementsByTagName('Container').item(0).getElementsByTagName('Html').item(0),
 
-             html = self.getCDATASection(cdata),
 
-             tmpDiv = document.createElement('div'),
 
-             container, popupWindow, modalFrame, dragHandle;
 
-         if (!(tmpl.getElementsByTagName('Image').item(0).getAttribute('file'))) {
 
-             throw '툴바 아이콘 이미지 파일 이름이 정의되지 않았습니다.';
 
-         }
 
-         tmpDiv.innerHTML = html;
 
-         container = tmpDiv.firstChild;
 
-         self.createEditorElement(container, toolbar);
 
-         cdata = tmpl.getElementsByTagName('PopupWindow').item(0).getElementsByTagName('Html').item(0);
 
-         html = self.getCDATASection(cdata);
 
-         tmpDiv.innerHTML = html;
 
-         popupWindow = tmpDiv.firstChild;
 
-         self.cheditor.popupElem = popupWindow;
 
-         dragHandle = popupWindow.firstChild;
 
-         self.cheditor.dragHandle = dragHandle;
 
-         self.cheditor.popupTitle = dragHandle.getElementsByTagName('label')[0];
 
-         self.cheditor.popupFrameWrapper = dragHandle.nextSibling;
 
-         container.appendChild(popupWindow);
 
-         modalFrame = document.createElement('div');
 
-         modalFrame.className = 'cheditor-modalPopupTransparent';
 
-         self.cheditor.modalBackground = modalFrame;
 
-         self.cheditor.modalBackground.id = 'popupModalBackground';
 
-         self.cheditor.modalBackground.className = 'cheditor-popupModalBackground';
 
-         container.parentNode.insertBefore(modalFrame, container);
 
-         self.cheditor.htmlEditable = document.createElement('iframe');
 
-         self.cheditor.htmlEditable.style.display = 'none';
 
-         self.cheditor.htmlEditable.style.width = '1px';
 
-         self.cheditor.htmlEditable.style.height = '1px';
 
-         self.cheditor.htmlEditable.style.visibility = 'hidden';
 
-         container.appendChild(self.cheditor.htmlEditable);
 
-     },
 
-     imageEvent: function (img, action) {
 
-         var self = this,
 
-             onMouseUpEventHandler = function () {
 
-                 self.cheditor.editBlock.style.display = 'block';
 
-                 self.modifyImage(this);
 
-             },
 
-             onClickEventHandler = function () {
 
-                 self.cheditor.editBlock.style.display = 'block';
 
-                 self.modifyImage(this);
 
-             };
 
-         if (GB.browser.msie) {
 
-             if (!action) {
 
-                 img.onmouseup = null;
 
-                 return;
 
-             }
 
-             (function () {
 
-                 img.onmouseup = onMouseUpEventHandler;
 
-             })();
 
-         } else {
 
-             if (!action) {
 
-                 self.removeEvent(img, 'click', onClickEventHandler);
 
-                 return;
 
-             }
 
-             this.addEvent(img, 'click', onClickEventHandler);
 
-         }
 
-     },
 
-     setImageEvent: function (action) {
 
-         var images = this.doc.images, i,
 
-             len = images.length;
 
-         for (i = 0; i < len; i++) {
 
-             if (/icons\/em\//.test(images[i].src)) {
 
-                 continue;
 
-             }
 
-             this.imageEvent(images[i], action);
 
-         }
 
-     },
 
-     run: function () {
 
-         var self = this,
 
-             showEditor = function () {
 
-                 var grayImage = null;
 
-                 if (!self.resetDoc()) {
 
-                     return;
 
-                 }
 
-                 self.editAreaFocus();
 
-                 self.setEditorEvent();
 
-                 if (GB.browser.msie && GB.browser.version > 8 || GB.browser.a) {
 
-                     grayImage = new Image();
 
-                     grayImage.onload = function () {
 
-                         self.cheditor.toolbarGrayscale = self.makeToolbarGrayscale(this);
 
-                         self.toolbarUpdate();
 
-                     };
 
-                     grayImage.src = self.toolbar.icon;
 
-                     grayImage.style.width = '750px'; grayImage.style.height = '16px';
 
-                 } else {
 
-                     self.cheditor.toolbarGrayscale = null;
 
-                     self.toolbarUpdate();
 
-                 }
 
-                 self.setImageEvent(true);
 
-                 self.removeEvent(document, self.cheditor.id, showEditor);
 
-             };
 
-         try {
 
-             this.setFolderPath();
 
-             this.checkInputForm();
 
-         }
 
-         catch (e) {
 
-             alert(e.toString());
 
-             return;
 
-         }
 
-         self.setDefaultCss({ css: 'ui.css', doc: window.document });
 
-         if (this.W3CRange) {
 
-             this.addEvent(document, this.cheditor.id, showEditor);
 
-         } else {
 
-             document.documentElement.loadEvent = 0;
 
-             document.documentElement.attachEvent('onpropertychange', function (evt) {
 
-                 if (evt.propertyName === 'loadEvent') {
 
-                     showEditor();
 
-                 }
 
-             });
 
-         }
 
-         this.initTemplate();
 
-     },
 
-     fullScreenMode: function () {
 
-         var self = this,
 
-             container = self.cheditor.container,
 
-             windowSize, height,
 
-             child = container.firstChild,
 
-             except = 0,
 
-             editorHeight = parseInt(self.config.editorHeight, 10),
 
-             containerReSize = function () {
 
-                 windowSize = self.getWindowSize();
 
-                 container.style.width = windowSize.width + 'px';
 
-                 if (self.cheditor.mode === 'code') {
 
-                     self.resizeTextContent();
 
-                     height = (windowSize.height - except - 6 - parseInt(self.cheditor.textContent.getAttribute('xbar-height'), 10));
 
-                     self.cheditor.textContent.style.height = height + 'px';
 
-                 }
 
-                 self.cheditor.editArea.style.height = (windowSize.height - except - 6) + 'px';
 
-             },
 
-             onMouseDownEventHandler = function (evt) {
 
-                 self.resizeStart(evt);
 
-             };
 
-         self.editAreaFocus();
 
-         self.boxHideAll();
 
-         self.cheditor.editArea.style.visibility = 'hidden';
 
-         if (!self.setFullScreenMode) {
 
-             container.className = 'cheditor-container-fullscreen';
 
-             if (GB.browser.msie && GB.browser.version < 7) {
 
-                 self.cheditor.fullScreenFlag = document.createElement('span');
 
-                 self.cheditor.fullScreenFlag.style.display = 'none';
 
-                 container.parentNode.insertBefore(self.cheditor.fullScreenFlag, container);
 
-                 document.body.insertBefore(container, document.body.firstChild);
 
-             }
 
-             while (child) {
 
-                 if (child.className !== 'cheditor-editarea-wrapper' &&
 
-                     child.className !== 'cheditor-popup-window' &&
 
-                     child.className !== '') {
 
-                     except += child.offsetHeight;
 
-                 }
 
-                 child = child.nextSibling;
 
-             }
 
-             (function () {
 
-                 window.onresize = containerReSize;
 
-             })();
 
-             containerReSize();
 
-             self.cheditor.resizeBar.onmousedown = null;
 
-             self.cheditor.resizeBar.className = 'cheditor-resizebar-off';
 
-         } else {
 
-             window.onresize = null;
 
-             container.removeAttribute('style');
 
-             container.className = 'cheditor-container';
 
-             container.style.width = self.config.editorWidth;
 
-             if (self.cheditor.mode === 'code') {
 
-                 height = editorHeight - parseInt(self.cheditor.textContent.getAttribute('xbar-height'), 10);
 
-                 self.cheditor.textContent.style.height = height + 'px';
 
-             } else {
 
-                 self.cheditor.editArea.style.height = editorHeight + 'px';
 
-             }
 
-             (function () {
 
-                 self.cheditor.resizeBar.onmousedown = onMouseDownEventHandler;
 
-             })();
 
-             self.cheditor.resizeBar.className = 'cheditor-resizebar';
 
-             if (GB.browser.msie && GB.browser.version < 7) {
 
-                 self.cheditor.fullScreenFlag.parentNode.replaceChild(container, self.cheditor.fullScreenFlag);
 
-             }
 
-         }
 
-         self.cheditor.editArea.style.visibility = 'visible';
 
-         self.setFullScreenMode = !(self.setFullScreenMode);
 
-         self.editAreaFocus();
 
-     },
 
-     showPulldown: function (cmd, btn) {
 
-         switch (cmd) {
 
-             case 'FontName':
 
-                 this.showFontTypeMenu(btn);
 
-                 break;
 
-             case 'FontSize':
 
-                 this.showFontSizeMenu(btn);
 
-                 break;
 
-             case 'FormatBlock':
 
-                 this.showFormatBlockMenu(btn);
 
-                 break;
 
-             case 'ForeColor':
 
-             case 'BackColor':
 
-                 this.showColorMenu(btn);
 
-                 break;
 
-             case 'TextBlock':
 
-                 this.showTextBlockMenu(btn);
 
-                 break;
 
-             case 'LineHeight':
 
-                 this.showLineHeightMenu(btn);
 
-                 break;
 
-             case 'OrderedList':
 
-             case 'UnOrderedList':
 
-                 this.showOrderedListMenu(btn);
 
-         }
 
-     },
 
-     setPulldownClassName: function (labels, pNode) {
 
-         var i = 0, label;
 
-         for (; i < labels.length; i++) {
 
-             label = labels[i];
 
-             if (label.getAttribute('name') === pNode.firstChild.firstChild.firstChild.nodeValue) {
 
-                 label.parentNode.style.backgroundImage = 'url(' + this.config.editorPath + 'icons/checked.png)';
 
-                 label.parentNode.style.backgroundPosition = '0 center';
 
-                 label.parentNode.style.backgroundRepeat = 'no-repeat';
 
-             } else {
 
-                 label.parentNode.style.backgroundImage = '';
 
-             }
 
-             label.parentNode.className = 'cheditor-pulldown-mouseout';
 
-         }
 
-     },
 
-     showOrderedListMenu: function (pNode) {
 
-         var self = this,
 
-             menu = pNode.getAttribute('name'),
 
-             elem = self.pulldown[menu];
 
-         (function () {
 
-             if (!elem) {
 
-                 var cmd = (menu === 'UnOrderedListCombo') ? 'InsertUnOrderedList' : 'InsertOrderedList',
 
-                     outputHtml = document.createElement('div'),
 
-                     onClickEventHandler = function () {
 
-                         self.doCmdPopup(cmd, this.id, self.toolbar[menu].prev.checked);
 
-                     },
 
-                     onMouseOverEventHandler = function () {
 
-                         self.pulldownMouseOver(this);
 
-                     },
 
-                     onMouseOutEventHandler = function () {
 
-                         self.pulldownMouseOut(this);
 
-                     },
 
-                     list = (cmd === 'InsertUnOrderedList') ? GB.listStyle.unOrdered : GB.listStyle.ordered,
 
-                     i, div, label, li, ol;
 
-                 for (i in list) {
 
-                     if (list.hasOwnProperty(i)) {
 
-                         div = document.createElement('div');
 
-                         label = document.createElement('label');
 
-                         div.id = i;
 
-                         (function () {
 
-                             div.onclick = onClickEventHandler;
 
-                             div.onmouseover = onMouseOverEventHandler;
 
-                             div.onmouseout = onMouseOutEventHandler;
 
-                         })();
 
-                         self.pulldownMouseOut(div);
 
-                         label.style.fontFamily = 'verdana';
 
-                         label.style.textAlign = 'center';
 
-                         label.style.width = '15px';
 
-                         label.setAttribute('name', i);
 
-                         li = document.createElement('li');
 
-                         li.appendChild(document.createTextNode(list[i]));
 
-                         ol = document.createElement('ul');
 
-                         ol.style.width = '90px';
 
-                         ol.style.padding = '0 15px';
 
-                         ol.style.margin = '0px';
 
-                         ol.style.listStyleType = i;
 
-                         ol.style.cursor = 'default';
 
-                         ol.style.textAlign = 'left';
 
-                         ol.appendChild(li);
 
-                         label.appendChild(ol);
 
-                         div.appendChild(label);
 
-                         outputHtml.appendChild(div);
 
-                     }
 
-                 }
 
-                 self.createWindow(110, outputHtml);
 
-                 self.createPulldownFrame(outputHtml, menu);
 
-             }
 
-         })();
 
-         self.windowPos(pNode, menu);
 
-         self.displayWindow(pNode, menu);
 
-     },
 
-     showColorMenu: function (pNode) {
 
-         var menu = pNode.getAttribute('name'),
 
-             elem = this.pulldown[menu],
 
-             selectedColor = this.colorConvert(pNode.lastChild.style.backgroundColor, 'hex'),
 
-             i, len, nodes, node, outputHtml;
 
-         if (!elem) {
 
-             outputHtml = this.setColorTable(menu);
 
-             this.createWindow(220, outputHtml);
 
-             this.createPulldownFrame(outputHtml, menu);
 
-             elem = this.pulldown[menu];
 
-             elem.firstChild.className = 'cheditor-pulldown-color-container';
 
-         }
 
-         this.toolbar[menu].colorNode.selectedValue.style.backgroundColor = selectedColor;
 
-         this.toolbar[menu].colorNode.colorPicker.hidePicker();
 
-         this.toolbar[menu].colorNode.colorPicker.fromString(selectedColor);
 
-         this.toolbar[menu].colorNode.showPicker = false;
 
-         nodes = elem.getElementsByTagName('span');
 
-         len = nodes.length;
 
-         for (i = 0; i < len; i++) {
 
-             node = nodes[i];
 
-             node.style.backgroundImage = '';
 
-             if (node.id && node.id.toLowerCase() === selectedColor.toLowerCase()) {
 
-                 node.style.backgroundImage = 'url("' + this.config.iconPath + '/color_picker_tick.png")';
 
-                 node.style.backgroundRepeat = 'no-repeat';
 
-                 node.style.backgroundPosition = 'center center';
 
-             }
 
-         }
 
-         this.toolbar[menu].colorNode.selectedValue.style.backgroundImage = 'url("' +
 
-             this.config.iconPath + '/color_picker_tick.png")';
 
-         this.toolbar[menu].colorNode.selectedValue.style.backgroundRepeat = 'no-repeat';
 
-         this.toolbar[menu].colorNode.selectedValue.style.backgroundPosition = 'center center';
 
-         this.windowPos(pNode, menu);
 
-         this.displayWindow(pNode, menu);
 
-     },
 
-     showFontTypeMenu: function (pNode) {
 
-         var self = this,
 
-             menu = pNode.getAttribute('name'),
 
-             elem = self.pulldown[menu];
 
-         (function () {
 
-             if (!elem) {
 
-                 var fonts = null, type, i, div, label,
 
-                     outputHtml = self.doc.createElement('div'),
 
-                     onClickEventHandler = function () {
 
-                         self.doCmdPopup(menu, this.id);
 
-                     },
 
-                     onMouseOverEventHandler = function () {
 
-                         self.pulldownMouseOver(this);
 
-                     },
 
-                     onMouseOutEventHandler = function () {
 
-                         self.pulldownMouseOut(this);
 
-                     };
 
-                 for (type in GB.fontName) {
 
-                     if (GB.fontName.hasOwnProperty(type)) {
 
-                         fonts = GB.fontName[type];
 
-                         for (i = 0; i < fonts.length; i++) {
 
-                             div = self.doc.createElement('div');
 
-                             label = self.doc.createElement('label');
 
-                             div.id = fonts[i];
 
-                             (function () {
 
-                                 div.onclick = onClickEventHandler;
 
-                                 div.onmouseover = onMouseOverEventHandler;
 
-                                 div.onmouseout = onMouseOutEventHandler;
 
-                             })();
 
-                             label.style.fontFamily = fonts[i];//(type !== 'kr') ? fonts[i] : this.config.editorFontName;
 
-                             label.appendChild(self.doc.createTextNode(fonts[i]));
 
-                             label.setAttribute('name', fonts[i]);
 
-                             div.appendChild(label);
 
-                             outputHtml.appendChild(div);
 
-                         }
 
-                     }
 
-                 }
 
-                 self.createWindow(155, outputHtml);
 
-                 self.createPulldownFrame(outputHtml, menu);
 
-                 elem = self.pulldown[menu];
 
-             }
 
-         })();
 
-         self.setPulldownClassName(elem.firstChild.getElementsByTagName('LABEL'), pNode);
 
-         self.windowPos(pNode, menu);
 
-         self.displayWindow(pNode, menu);
 
-     },
 
-     showFormatBlockMenu: function (pNode) {
 
-         var self = this,
 
-             menu = pNode.getAttribute('name'),
 
-             elem = self.pulldown[menu];
 
-         (function () {
 
-             if (!elem) {
 
-                 var para, label, fontSize, div,
 
-                     outputHtml = document.createElement('div'),
 
-                     onClickEventHandler = function () {
 
-                         self.doCmdPopup('FormatBlock', '<' + this.id + '>');
 
-                     },
 
-                     onMouseOverEventHandler = function () {
 
-                         self.pulldownMouseOver(this);
 
-                     },
 
-                     onMouseOutEventHandler = function () {
 
-                         self.pulldownMouseOut(this);
 
-                     };
 
-                 for (para in GB.formatBlock) {
 
-                     if (GB.formatBlock.hasOwnProperty(para)) {
 
-                         div = document.createElement('div');
 
-                         div.id = para;
 
-                         (function () {
 
-                             div.onclick = onClickEventHandler;
 
-                             div.onmouseover = onMouseOverEventHandler;
 
-                             div.onmouseout = onMouseOutEventHandler;
 
-                         })();
 
-                         label = document.createElement('label');
 
-                         if (para.match(/H[123456]/)) {
 
-                             fontSize = { 'H1': '2em', 'H2': '1.5em', 'H3': '1.17em', 'H4': '1em', 'H5': '0.83em', 'H6': '0.75em' };
 
-                             label.style.fontWeight = 'bold';
 
-                             label.style.fontSize = fontSize[para];
 
-                             label.style.lineHeight = 1.4;
 
-                         } else if (para === 'ADDRESS') {
 
-                             label.style.fontStyle = 'italic';
 
-                         }
 
-                         label.appendChild(document.createTextNode(GB.formatBlock[para]));
 
-                         div.appendChild(label);
 
-                         label.setAttribute('name', GB.formatBlock[para]);
 
-                         outputHtml.appendChild(div);
 
-                     }
 
-                 }
 
-                 self.createWindow(150, outputHtml);
 
-                 self.createPulldownFrame(outputHtml, menu);
 
-                 elem = self.pulldown[menu];
 
-             }
 
-         })();
 
-         self.setPulldownClassName(elem.firstChild.getElementsByTagName('label'), pNode);
 
-         self.windowPos(pNode, menu);
 
-         self.displayWindow(pNode, menu);
 
-     },
 
-     showFontSizeMenu: function (pNode) {
 
-         var self = this,
 
-             menu = pNode.getAttribute('name'),
 
-             elem = self.pulldown[menu];
 
-         (function () {
 
-             if (!elem) {
 
-                 var size, div, label, text, i,
 
-                     value = GB.fontSize[self.config.fontSizeValue],
 
-                     len = value.length,
 
-                     outputHtml = document.createElement('div'),
 
-                     onClickEventHandler = function (e) {
 
-                         self.stopEvent(e);
 
-                         self.doCmdPopup(menu, this.id);
 
-                     },
 
-                     onMouseOverEventHandler = function () {
 
-                         self.pulldownMouseOver(this);
 
-                     },
 
-                     onMouseOutEventHandler = function () {
 
-                         self.pulldownMouseOut(this);
 
-                     };
 
-                 for (i = 0; i < len; i++) {
 
-                     size = value[i];
 
-                     div = document.createElement('div');
 
-                     label = document.createElement('label');
 
-                     text = size > 48 ? '가' : (size > 28 ? '가나다' : '가나다라');
 
-                     size = size + self.config.fontSizeValue;
 
-                     div.id = size;
 
-                     (function () {
 
-                         div.onclick = onClickEventHandler;
 
-                         div.onmouseover = onMouseOverEventHandler;
 
-                         div.onmouseout = onMouseOutEventHandler;
 
-                     })();
 
-                     div.style.fontSize = size;
 
-                     label.style.fontFamily = self.config.editorFontName;
 
-                     label.setAttribute('name', size);
 
-                     label.appendChild(document.createTextNode(text + '(' + size + ')'));
 
-                     div.appendChild(label);
 
-                     outputHtml.appendChild(div);
 
-                 }
 
-                 self.createWindow(350, outputHtml);
 
-                 outputHtml.style.height = '300px';
 
-                 outputHtml.style.overflow = 'auto';
 
-                 self.createPulldownFrame(outputHtml, menu);
 
-                 elem = self.pulldown[menu];
 
-             }
 
-         })();
 
-         self.setPulldownClassName(elem.firstChild.getElementsByTagName('LABEL'), pNode);
 
-         self.windowPos(pNode, menu);
 
-         self.displayWindow(pNode, menu);
 
-     },
 
-     showLineHeightMenu: function (pNode) {
 
-         var self = this,
 
-             menu = pNode.getAttribute('name'),
 
-             elem = self.pulldown[menu];
 
-         (function () {
 
-             if (!elem) {
 
-                 var i, div, label, text,
 
-                     outputHtml = document.createElement('div'),
 
-                     onClickEventHandler = function () {
 
-                         self.doCmdPopup('LineHeight', this.id);
 
-                     },
 
-                     onMouseOverEventHandler = function () {
 
-                         self.pulldownMouseOver(this);
 
-                     },
 
-                     onMouseOutEventHandler = function () {
 
-                         self.pulldownMouseOut(this);
 
-                     };
 
-                 for (i in GB.lineHeight) {
 
-                     if (!(GB.lineHeight.hasOwnProperty(i))) {
 
-                         continue;
 
-                     }
 
-                     if (!GB.lineHeight[i]) {
 
-                         break;
 
-                     }
 
-                     div = document.createElement('div');
 
-                     label = document.createElement('label');
 
-                     text = i;
 
-                     div.id = GB.lineHeight[i];
 
-                     (function () {
 
-                         div.onclick = onClickEventHandler;
 
-                         div.onmouseover = onMouseOverEventHandler;
 
-                         div.onmouseout = onMouseOutEventHandler;
 
-                     })();
 
-                     label.style.fontFamily = self.config.editorFontName;
 
-                     label.setAttribute('name', GB.lineHeight[i]);
 
-                     label.appendChild(document.createTextNode(text));
 
-                     div.appendChild(label);
 
-                     outputHtml.appendChild(div);
 
-                 }
 
-                 self.createWindow(100, outputHtml);
 
-                 self.createPulldownFrame(outputHtml, menu);
 
-                 elem = self.pulldown[menu];
 
-             }
 
-         })();
 
-         self.setPulldownClassName(elem.firstChild.getElementsByTagName('LABEL'), pNode);
 
-         self.windowPos(pNode, menu);
 
-         self.displayWindow(pNode, menu);
 
-     },
 
-     showTextBlockMenu: function (pNode) {
 
-         var self = this,
 
-             menu = pNode.getAttribute('name'),
 
-             elem = self.pulldown[menu];
 
-         (function () {
 
-             if (!elem) {
 
-                 var i, wrapper, div, label,
 
-                     outputHtml = document.createElement('div'),
 
-                     onClickEventHandler = function () {
 
-                         self.boxStyle(this);
 
-                     },
 
-                     onMouseOverEventHandler = function () {
 
-                         this.className = 'cheditor-pulldown-textblock-over';
 
-                     },
 
-                     onMouseOutEventHandler = function () {
 
-                         this.className = 'cheditor-pulldown-textblock-out';
 
-                     },
 
-                     quote = GB.textBlock;
 
-                 for (i = 0; i < quote.length; i++) {
 
-                     wrapper = document.createElement('div');
 
-                     div = document.createElement('div');
 
-                     (function () {
 
-                         div.onclick = onClickEventHandler;
 
-                         wrapper.onmouseover = onMouseOverEventHandler;
 
-                         wrapper.onmouseout = onMouseOutEventHandler;
 
-                     })();
 
-                     wrapper.className = 'cheditor-pulldown-textblock-out';
 
-                     div.id = i;
 
-                     div.style.border = quote[i][0];
 
-                     div.style.backgroundColor = quote[i][1];
 
-                     div.style.fontFamily = self.config.editorFontName;
 
-                     label = document.createElement('label');
 
-                     label.appendChild(document.createTextNode('가나다라 ABC'));
 
-                     div.appendChild(label);
 
-                     wrapper.appendChild(div);
 
-                     outputHtml.appendChild(wrapper);
 
-                 }
 
-                 self.createWindow(160, outputHtml);
 
-                 self.createPulldownFrame(outputHtml, menu);
 
-                 elem = self.pulldown[menu];
 
-                 elem.firstChild.className = 'cheditor-pulldown-textblock-container';
 
-             }
 
-         })();
 
-         self.windowPos(pNode, menu);
 
-         self.displayWindow(pNode, menu);
 
-     },
 
-     createPulldownFrame: function (contents, id) {
 
-         var div = document.createElement('div');
 
-         div.className = 'cheditor-pulldown-frame';
 
-         div.appendChild(contents);
 
-         this.pulldown[id] = div;
 
-         this.cheditor.container.firstChild.appendChild(div);
 
-     },
 
-     setDefaultCss: function (ar) {
 
-         var cssFile, head, found = false, children, i, href, css;
 
-         ar = ar || { css: 'editarea.css', doc: this.doc };
 
-         cssFile = this.config.cssPath + ar.css;
 
-         head = ar.doc.getElementsByTagName('head')[0];
 
-         if (this.undefined(head)) {
 
-             return;
 
-         }
 
-         if (head.hasChildNodes()) {
 
-             children = head.childNodes;
 
-             for (i = 0; i < children.length; i++) {
 
-                 if (children[i].nodeName.toLowerCase() === 'link') {
 
-                     href = children[i].getAttribute('href');
 
-                     if (href && href === cssFile) {
 
-                         found = true;
 
-                         break;
 
-                     }
 
-                 }
 
-             }
 
-         }
 
-         if (!found) {
 
-             css = head.appendChild(ar.doc.createElement('link'));
 
-             css.setAttribute('type', 'text/css');
 
-             css.setAttribute('rel', 'stylesheet');
 
-             css.setAttribute('media', 'all');
 
-             css.setAttribute('href', this.config.cssPath + ar.css);
 
-         }
 
-     },
 
-     setEditorEvent: function () {
 
-         var self = this,
 
-             onKeyDownEventHandler = function (evt) {
 
-                 if (self.cheditor.mode === 'preview') {
 
-                     self.stopEvent(evt);
 
-                     return;
 
-                 }
 
-                 self.doOnKeyDown(evt);
 
-             },
 
-             onKeyPressEventHandler = function (evt) {
 
-                 if (self.cheditor.mode === 'preview') {
 
-                     self.stopEvent(evt);
 
-                     return;
 
-                 }
 
-                 self.doOnKeyPress(evt);
 
-             },
 
-             onKeyUpEventHandler = function (evt) {
 
-                 if (self.cheditor.mode === 'preview') {
 
-                     self.stopEvent(evt);
 
-                     return;
 
-                 }
 
-                 self.doOnKeyUp(evt);
 
-             },
 
-             onMouseUpEventHandler = function (evt) {
 
-                 if (self.cheditor.mode === 'rich') {
 
-                     if (evt.clientX <= self.doc.body.offsetWidth) {
 
-                         self.doEditorEvent(evt);
 
-                     } else {
 
-                         self.restoreRange();
 
-                     }
 
-                     return;
 
-                 }
 
-                 if (self.cheditor.mode === 'preview') {
 
-                     self.stopEvent(evt);
 
-                 }
 
-             },
 
-             onMouseDownEventHandler = function (evt) {
 
-                 if (self.cheditor.mode === 'rich') {
 
-                     if (evt.clientX <= self.doc.body.offsetWidth) {
 
-                         // self.clearSelection();
 
-                     } else {
 
-                         self.backupRange();
 
-                     }
 
-                     self.boxHideAll();
 
-                     return;
 
-                 }
 
-                 if (self.cheditor.mode === 'preview') {
 
-                     self.stopEvent(evt);
 
-                 }
 
-             };
 
-         (function () {
 
-             self.addEvent(self.doc, 'keydown', onKeyDownEventHandler);
 
-             self.addEvent(self.doc, 'keypress', onKeyPressEventHandler);
 
-             self.addEvent(self.doc, 'keyup', onKeyUpEventHandler);
 
-             self.addEvent(self.doc, 'mouseup', onMouseUpEventHandler);
 
-             self.addEvent(self.doc, 'mousedown', onMouseDownEventHandler);
 
-         })();
 
-     },
 
-     addEvent: function (evTarget, evType, evHandler) {
 
-         if (evTarget.addEventListener) {
 
-             evTarget.addEventListener(evType, evHandler, false);
 
-         } else {
 
-             evTarget.attachEvent('on' + evType, evHandler);
 
-         }
 
-     },
 
-     removeEvent: function (elem, ev, func) {
 
-         if (elem.removeEventListener) {
 
-             elem.removeEventListener(ev, func, false);
 
-         } else {
 
-             elem.detachEvent('on' + ev, func);
 
-         }
 
-     },
 
-     stopEvent: function (ev) {
 
-         if (ev && ev.preventDefault) {
 
-             ev.preventDefault();
 
-             ev.stopPropagation();
 
-         } else {
 
-             ev = ev || window.event;
 
-             ev.cancelBubble = true;
 
-             ev.returnValue = false;
 
-         }
 
-     },
 
-     toolbarButtonOut: function (elemButton, nTop) {
 
-         elemButton.style.top = -nTop + 'px';
 
-     },
 
-     toolbarButtonOver: function (elemButton) {
 
-         var nTop = elemButton.style.top.substring(0, elemButton.style.top.length - 2);
 
-         elemButton.style.top = nTop - 22 + 'px';
 
-     },
 
-     getElement: function (elem, tag) {
 
-         if (!elem || !tag) {
 
-             return null;
 
-         }
 
-         while (elem && elem.nodeName.toLowerCase() !== tag.toLowerCase()) {
 
-             if (elem.nodeName.toLowerCase() === 'body') {
 
-                 break;
 
-             }
 
-             elem = elem.parentNode;
 
-         }
 
-         return elem;
 
-     },
 
-     hyperLink: function (href, target, title) {
 
-         var self = this,
 
-             links = null, i,
 
-             createLinks = function () {
 
-                 var range = self.restoreRange(),
 
-                     selectedLinks = [],
 
-                     linkRange = self.createRange(), selection = null, container = null, k;
 
-                 self.backupRange(range);
 
-                 if (self.W3CRange) {
 
-                     self.doc.execCommand("CreateLink", false, href);
 
-                     selection = self.getSelection();
 
-                     for (i = 0; i < selection.rangeCount; ++i) {
 
-                         range = selection.getRangeAt(i);
 
-                         container = range.commonAncestorContainer;
 
-                         if (self.getSelectionType(range) === GB.selection.text) {
 
-                             container = container.parentNode;
 
-                         }
 
-                         if (container.nodeName.toLowerCase() === 'a') {
 
-                             selectedLinks.push(container);
 
-                         } else {
 
-                             links = container.getElementsByTagName('a');
 
-                             for (k = 0; k < links.length; ++k) {
 
-                                 linkRange.selectNodeContents(links[k]);
 
-                                 if (linkRange.compareBoundaryPoints(range.END_TO_START, range) < 1 &&
 
-                                     linkRange.compareBoundaryPoints(range.START_TO_END, range) > -1) {
 
-                                     selectedLinks.push(links[k]);
 
-                                 }
 
-                             }
 
-                         }
 
-                     }
 
-                     linkRange.detach();
 
-                 } else {
 
-                     range = self.doc.selection.createRange();
 
-                     range.execCommand("UnLink", false);
 
-                     range.execCommand("CreateLink", false, href);
 
-                     switch (self.getSelectionType(range)) {
 
-                         case GB.selection.text:
 
-                             container = range.parentElement();
 
-                             break;
 
-                         case GB.selection.element:
 
-                             container = range.item(0).parentNode;
 
-                             break;
 
-                         default: return null;
 
-                     }
 
-                     if (container.nodeName.toLowerCase() === 'a') {
 
-                         selectedLinks.push(container);
 
-                     } else {
 
-                         links = container.getElementsByTagName('a');
 
-                         for (i = 0; i < links.length; ++i) {
 
-                             linkRange.moveToElementText(links[i]);
 
-                             if (linkRange.compareEndPoints("StartToEnd", range) > -1 &&
 
-                                 linkRange.compareEndPoints("EndToStart", range) < 1) {
 
-                                 selectedLinks.push(links[i]);
 
-                             }
 
-                         }
 
-                     }
 
-                 }
 
-                 return selectedLinks;
 
-             };
 
-         this.editArea.focus();
 
-         links = createLinks();
 
-         if (links) {
 
-             for (i = 0; i < links.length; ++i) {
 
-                 if (target) {
 
-                     links[i].setAttribute("target", target);
 
-                 }
 
-                 if (title) {
 
-                     links[i].setAttribute("title", title);
 
-                 }
 
-             }
 
-         }
 
-     },
 
-     getOffsetBox: function (el) {
 
-         var box = el.getBoundingClientRect(),
 
-             doc = this.doc.documentElement,
 
-             body = this.doc.body,
 
-             scrollTop = doc.scrollTop || body.scrollTop,
 
-             scrollLeft = doc.scrollLeft || body.scrollLeft,
 
-             clientTop = doc.clientTop || body.clientTop || 0,
 
-             clientLeft = doc.clientLeft || body.clientLeft || 0,
 
-             top = box.top + scrollTop - clientTop,
 
-             left = box.left + scrollLeft - clientLeft;
 
-         return { top: Math.round(top), left: Math.round(left) };
 
-     },
 
-     makeSpacerElement: function () {
 
-         var elem,
 
-             para = this.doc.createElement('p');
 
-         if (GB.browser.msie && GB.browser.version < 11 && GB.browser.version > 8) {
 
-             elem = this.doc.createComment(this.cheditor.bogusSpacerName);
 
-         } else if (GB.browser.msie_c) {
 
-             elem = this.createNbspTextNode();
 
-         } else {
 
-             elem = this.doc.createElement('br');
 
-             elem.className = this.cheditor.bogusSpacerName;
 
-         }
 
-         para.appendChild(elem);
 
-         return para;
 
-     },
 
-     boxStyle: function (el) {
 
-         var range, elem, ctx, textRange, frag, pNode,
 
-             blockQuote = this.doc.createElement('blockquote'),
 
-             para = null;
 
-         this.editAreaFocus();
 
-         range = this.range || this.getRange()
 
-         blockQuote.style.border = GB.textBlock[el.id][0];
 
-         blockQuote.style.backgroundColor = GB.textBlock[el.id][1];
 
-         blockQuote.style.padding = '5px 10px';
 
-         if (!this.W3CRange) {
 
-             ctx = range.htmlText;
 
-             blockQuote.innerHTML = ctx || ' ';
 
-             range.select();
 
-             this.insertHTML(blockQuote);
 
-             textRange = this.getRange();
 
-             elem = range.parentElement();
 
-             textRange.moveToElementText(elem);
 
-             textRange.collapse(false);
 
-             textRange.select();
 
-         } else {
 
-             try {
 
-                 frag = range.extractContents();
 
-                 if (!frag.firstChild) {
 
-                     para = this.makeSpacerElement();
 
-                     blockQuote.appendChild(para);
 
-                 } else {
 
-                     blockQuote.appendChild(frag);
 
-                 }
 
-                 range.insertNode(blockQuote);
 
-                 pNode = blockQuote.parentNode;
 
-                 while (pNode && pNode.nodeName.toLowerCase() !== 'body') {
 
-                     if (pNode.nodeName.toLowerCase() === 'p' || pNode.nodeName.toLowerCase() === 'div') {
 
-                         pNode.parentNode.insertBefore(blockQuote, pNode.nextSibling);
 
-                         break;
 
-                     }
 
-                     pNode = pNode.parentNode;
 
-                 }
 
-                 this.placeCaretAt(para || blockQuote, false);
 
-             } catch (ignore) {
 
-                 // --
 
-             }
 
-         }
 
-         this.boxHideAll();
 
-     },
 
-     insertFlash: function (elem) {
 
-         var embed = null, pos, str, obj, child, movieHeight, params = [], movieWidth, i,
 
-             div = this.doc.createElement('div');
 
-         this.editAreaFocus();
 
-         this.restoreRange();
 
-         if (typeof elem === 'string') {
 
-             elem = this.trimSpace(elem);
 
-             pos = elem.toLowerCase().indexOf('embed');
 
-             if (pos !== -1) {
 
-                 str = elem.substr(pos);
 
-                 pos = str.indexOf('>');
 
-                 div.innerHTML = '<' + str.substr(0, pos) + '>';
 
-                 embed = div.firstChild;
 
-             } else {
 
-                 div.innerHTML = elem;
 
-                 obj = div.getElementsByTagName('object')[0];
 
-                 if (obj && obj.hasChildNodes()) {
 
-                     child = obj.firstChild;
 
-                     movieWidth = (isNaN(obj.width) !== true) ? obj.width : 320;
 
-                     movieHeight = (isNaN(obj.height) !== true) ? obj.height : 240;
 
-                     do {
 
-                         if ((child.nodeName.toLowerCase() === 'param') &&
 
-                             (!this.undefined(child.name) && !this.undefined(child.value))) {
 
-                             params.push({ key: (child.name === 'movie') ? 'src' : child.name, val: child.value });
 
-                         }
 
-                         child = child.nextSibling;
 
-                     } while (child);
 
-                     if (params.length > 0) {
 
-                         embed = this.doc.createElement('embed');
 
-                         embed.setAttribute('width', movieWidth);
 
-                         embed.setAttribute('height', movieHeight);
 
-                         for (i = 0; i < params.length; i++) {
 
-                             embed.setAttribute(params[i].key, params[i].val);
 
-                         }
 
-                         embed.setAttribute('type', 'application/x-shockwave-flash');
 
-                     }
 
-                 }
 
-             }
 
-             if (embed) {
 
-                 if (this.W3CRange) {
 
-                     this.insertNodeAtSelection(embed);
 
-                 } else {
 
-                     this.doCmdPaste(embed.outerHTML);
 
-                 }
 
-             }
 
-         }
 
-     },
 
-     insertHtmlPopup: function (elem) {
 
-         this.editAreaFocus();
 
-         this.restoreRange();
 
-         if (!this.W3CRange) {
 
-             this.doCmdPaste((this.toType(elem) === 'string') ? elem : elem.outerHTML);
 
-         } else {
 
-             this.insertNodeAtSelection(elem);
 
-         }
 
-         this.clearStoredSelections();
 
-     },
 
-     insertHTML: function (html) {
 
-         if (!this.W3CRange) {
 
-             this.getRange().pasteHTML((this.toType(html) === 'string') ? html : html.outerHTML);
 
-         } else {
 
-             this.insertNodeAtSelection(html);
 
-         }
 
-     },
 
-     placeCaretAt: function (elem, az) {
 
-         var range = this.createRange(),
 
-             selection = this.getSelection();
 
-         if (this.undefined(az)) {
 
-             az = false;
 
-         }
 
-         if (this.W3CRange) {
 
-             selection.removeAllRanges();
 
-             try {
 
-                 if (elem.lastChild && elem.lastChild.nodeName.toLowerCase() === 'br') {
 
-                     az = true;
 
-                 }
 
-                 range.selectNodeContents(elem);
 
-             } catch (e) {
 
-                 range.selectNode(elem);
 
-             }
 
-             range.collapse(az);
 
-             try {
 
-                 selection.addRange(range);
 
-             } catch (e) {
 
-                 this.placeCaretAt(this.doc.body, az);
 
-             }
 
-         } else if (elem.nodeType === GB.node.element) {
 
-             range.moveToElementText(elem);
 
-             range.collapse(az);
 
-             range.select();
 
-         }
 
-     },
 
-     selectNodeContents: function (node, pos) {
 
-         var collapsed = !this.undefined(pos),
 
-             selection = this.getSelection(),
 
-             range = this.getRange();
 
-         if (node.nodeType === GB.node.element) {
 
-             range.selectNode(node);
 
-             if (collapsed) {
 
-                 range.collapse(pos);
 
-             }
 
-         }
 
-         selection.removeAllRanges();
 
-         selection.addRange(range);
 
-         return range;
 
-     },
 
-     insertNodeAtSelection: function (insertNode) {
 
-         var range = this.getRange(),
 
-             selection = this.getSelection(),
 
-             frag = this.doc.createDocumentFragment(),
 
-             lastNode = null,
 
-             elem, commonAncestorContainer, startOffset, pNode, tmpWrapper;
 
-         if (!range.collapsed) {
 
-             range.deleteContents();
 
-             range = this.getRange();
 
-         }
 
-         commonAncestorContainer = range.commonAncestorContainer;
 
-         startOffset = range.startOffset;
 
-         pNode = commonAncestorContainer;
 
-         if (pNode.nodeType === GB.node.text) {
 
-             pNode = pNode.parentNode;
 
-         }
 
-         this.removeBogusSpacer(pNode);
 
-         if (typeof insertNode === 'string') {
 
-             tmpWrapper = this.doc.createElement('div');
 
-             tmpWrapper.innerHTML = insertNode;
 
-             elem = tmpWrapper.firstChild;
 
-             while (elem) {
 
-                 lastNode = frag.appendChild(elem);
 
-                 elem = tmpWrapper.firstChild;
 
-             }
 
-         } else {
 
-             lastNode = frag.appendChild(insertNode);
 
-         }
 
-         if (startOffset < 1 && commonAncestorContainer.nodeType === GB.node.text) {
 
-             commonAncestorContainer.parentNode.insertBefore(frag, commonAncestorContainer);
 
-         } else {
 
-             range.insertNode(frag);
 
-         }
 
-         if (lastNode) {
 
-             range = range.cloneRange();
 
-             range.setStartAfter(lastNode);
 
-             selection.removeAllRanges();
 
-             selection.addRange(range);
 
-         }
 
-         this.toolbarUpdate();
 
-         return lastNode;
 
-     },
 
-     findBogusSpacer: function (elem, all) {
 
-         var self = this, result = [];
 
-         (function findBogusSpacer(elem) {
 
-             var i = 0, node;
 
-             for (; i < elem.childNodes.length; i++) {
 
-                 node = elem.childNodes[i];
 
-                 if ((node.nodeType === GB.node.element && node.className === self.cheditor.bogusSpacerName) ||
 
-                     (node.nodeType === GB.node.comment && node.nodeValue === self.cheditor.bogusSpacerName)) {
 
-                     result.push(node);
 
-                 }
 
-                 if (node.nodeType === GB.node.text && node.nodeValue === '\u00a0' && !node.nextSibling) {
 
-                     result.push(node);
 
-                 }
 
-                 if (all) {
 
-                     findBogusSpacer(node);
 
-                 }
 
-             }
 
-         })(elem);
 
-         return result;
 
-     },
 
-     removeBogusSpacer: function (elem, removeEmpty, all) {
 
-         var remove = this.findBogusSpacer(elem, all), i = 0;
 
-         for (; i < remove.length; i++) {
 
-             remove[i].parentNode.removeChild(remove[i]);
 
-         }
 
-         if (removeEmpty && !(elem.hasChildNodes())) {
 
-             elem.parentNode.removeChild(elem);
 
-         }
 
-     },
 
-     ieGetRangeAt: function (range) {
 
-         var self = this, start = {}, end = {};
 
-         function convert(result, bStart) {
 
-             var point = range.duplicate(),
 
-                 span = self.doc.createElement('span'),
 
-                 parent = point.parentElement(),
 
-                 cursor = self.createRange(),
 
-                 compareStr = bStart ? 'StartToStart' : 'StartToEnd';
 
-             point.collapse(bStart);
 
-             parent.appendChild(span);
 
-             cursor.moveToElementText(span);
 
-             while (cursor.compareEndPoints(compareStr, point) > 0 && span.previousSibling) {
 
-                 parent.insertBefore(span, span.previousSibling);
 
-                 cursor.moveToElementText(span);
 
-             }
 
-             result.container = span.nextSibling || span.previousSibling;
 
-             if (result.container === null) {
 
-                 result.container = span.parentNode;
 
-             }
 
-             parent.removeChild(span);
 
-         }
 
-         convert(start, true); convert(end, false);
 
-         return { startContainer: start.container, endContainer: end.container };
 
-     },
 
-     applyLineHeight: function (opt) {
 
-         var range = this.getRange(),
 
-             isBlockElement = function (elem) {
 
-                 return GB.lineHeightBlockTags[elem.toLowerCase()];
 
-             },
 
-             getNextLeaf = function (elem, endLeaf, value) {
 
-                 while (!elem.nextSibling) {
 
-                     elem = elem.parentNode;
 
-                     if (!elem) {
 
-                         return elem;
 
-                     }
 
-                 }
 
-                 if (elem === endLeaf) {
 
-                     return elem;
 
-                 }
 
-                 var leaf = elem.nextSibling;
 
-                 if (isBlockElement(leaf.nodeName)) {
 
-                     leaf.style.lineHeight = value;
 
-                 }
 
-                 while (leaf.firstChild) {
 
-                     leaf = leaf.firstChild;
 
-                     if (leaf.nodeType !== GB.node.text && isBlockElement(leaf.nodeName)) {
 
-                         leaf.style.lineHeight = value;
 
-                     }
 
-                 }
 
-                 return leaf;
 
-             },
 
-             applyBlockElement = function (elem) {
 
-                 while (elem) {
 
-                     if (elem.nodeName.toLowerCase() === "body") {
 
-                         para = self.doc.createElement("p");
 
-                         para.style.lineHeight = opt;
 
-                         if (elem.firstChild) {
 
-                             elem.insertBefore(para, elem.firstChild);
 
-                         } else {
 
-                             elem.appendChild(para);
 
-                             break;
 
-                         }
 
-                         nextNode = para.nextSibling;
 
-                         while (nextNode) {
 
-                             if (isBlockElement(nextNode.nodeName)) {
 
-                                 break;
 
-                             }
 
-                             para.appendChild(nextNode);
 
-                             nextNode = para.nextSibling;
 
-                         }
 
-                         break;
 
-                     }
 
-                     if (isBlockElement(elem.nodeName)) {
 
-                         elem.style.lineHeight = opt;
 
-                         break;
 
-                     }
 
-                     elem = elem.parentNode;
 
-                 }
 
-             },
 
-             ieRange, startContainer, endContainer, para, nextNode, startLeaf, endLeaf, nextLeaf;
 
-         if (!this.W3CRange) {
 
-             ieRange = this.ieGetRangeAt(range);
 
-             startContainer = ieRange.startContainer;
 
-             endContainer = ieRange.endContainer;
 
-         } else {
 
-             startContainer = range.startContainer;
 
-             endContainer = range.endContainer;
 
-         }
 
-         if (!this.doc.body.hasChildNodes() || !startContainer || !endContainer) {
 
-             throw "Object Error";
 
-         }
 
-         if (startContainer && startContainer.nodeName.toLowerCase() === "body") {
 
-             startContainer = startContainer.firstChild;
 
-         }
 
-         try {
 
-             if (startContainer === endContainer) {
 
-                 applyBlockElement(startContainer);
 
-             } else {
 
-                 startLeaf = startContainer;
 
-                 while (startLeaf) {
 
-                     if (startLeaf.nodeName.toLowerCase() === "body" || isBlockElement(startLeaf.nodeName)) {
 
-                         break;
 
-                     }
 
-                     startLeaf = startLeaf.parentNode;
 
-                 }
 
-                 endLeaf = endContainer;
 
-                 while (endLeaf) {
 
-                     if (endLeaf.nodeName.toLowerCase() === "body" || isBlockElement(endLeaf.nodeName)) {
 
-                         break;
 
-                     }
 
-                     endLeaf = endLeaf.parentNode;
 
-                 }
 
-                 if (startLeaf === endLeaf) {
 
-                     if (isBlockElement(startLeaf.nodeName)) {
 
-                         startLeaf.style.lineHeight = opt;
 
-                     } else {
 
-                         para = this.doc.createElement("p");
 
-                         para.style.lineHeight = opt;
 
-                         startLeaf.insertBefore(para, startLeaf.firstChild);
 
-                         nextNode = para.nextSibling;
 
-                         while (nextNode) {
 
-                             if (isBlockElement(nextNode.nodeName)) {
 
-                                 break;
 
-                             }
 
-                             para.appendChild(nextNode);
 
-                             nextNode = para.nextSibling;
 
-                         }
 
-                     }
 
-                 } else {
 
-                     applyBlockElement(startLeaf);
 
-                     while (startLeaf) {
 
-                         nextLeaf = getNextLeaf(startLeaf, endLeaf, opt);
 
-                         if (startLeaf === endLeaf) {
 
-                             break;
 
-                         }
 
-                         startLeaf = nextLeaf;
 
-                     }
 
-                 }
 
-             }
 
-         } catch (ignore) {
 
-             // --
 
-         }
 
-     },
 
-     doInsertImage: function (imgs, para, insertSpace) {
 
-         var range, i, count = 0, imgAttr, img, space, lastNode = null, pNode, div, selection,
 
-             len = imgs.length, self = this,
 
-             fragment = this.doc.createDocumentFragment();
 
-         function checkPara(pNode) {
 
-             var result = true, text;
 
-             if (!pNode.hasChildNodes()) {
 
-                 return false;
 
-             }
 
-             self.getNodeTree(pNode, function (node) {
 
-                 if (!node.node || node === pNode) {
 
-                     return;
 
-                 }
 
-                 if (node.type === GB.node.text) {
 
-                     text = self.trimSpace(node.node.nodeValue);
 
-                     if (!text || text === '\u00a0') {
 
-                         result = false;
 
-                     }
 
-                 } else if (node.type === GB.node.element
 
-                     && (node.name === 'br' && node.node.className === self.cheditor.bogusSpacerName)) {
 
-                     result = false;
 
-                 }
 
-             });
 
-             return result;
 
-         }
 
-         this.editAreaFocus();
 
-         range = this.restoreRange();
 
-         pNode = this.getRangeElement(range);
 
-         if (!pNode) {
 
-             return;
 
-         }
 
-         if (pNode.nodeName.toLowerCase() === 'body') {
 
-             pNode = this.doc.createElement('p');
 
-             if (this.W3CRange) {
 
-                 range.insertNode(pNode);
 
-             } else {
 
-                 range.pasteHTML(pNode.outerHTML);
 
-             }
 
-         }
 
-         if (para) {
 
-             do {
 
-                 if (GB.lineHeightBlockTags[pNode.nodeName.toLowerCase()]) {
 
-                     break;
 
-                 }
 
-                 pNode = pNode.parentNode;
 
-             } while (pNode && pNode.nodeName.toLowerCase() !== 'body');
 
-         }
 
-         for (i in imgs) {
 
-             if (!imgs.hasOwnProperty(i) || this.undefined(imgs[i])) {
 
-                 continue;
 
-             }
 
-             imgAttr = imgs[i];
 
-             img = this.doc.createElement('img');
 
-             img.setAttribute('src', imgAttr.fileUrl);
 
-             if (this.config.imgSetAttrWidth === 1) {
 
-                 img.style.width = imgAttr.width;
 
-                 img.style.height = imgAttr.height;
 
-             } else if (this.config.imgSetAttrWidth === -1) {
 
-                 img.style.width = '100%';
 
-                 img.style.height = 'auto';
 
-             }
 
-             if (this.config.imgSetAttrAlt) {
 
-                 img.setAttribute('alt', imgAttr.alt || imgAttr.origName);
 
-             } else {
 
-                 img.removeAttribute('alt');
 
-             }
 
-             count++;
 
-             if (para) {
 
-                 lastNode = fragment.appendChild(this.doc.createElement('p'));
 
-                 if (imgAttr.align !== 'left') {
 
-                     lastNode.style.textAlign = imgAttr.align;
 
-                 }
 
-                 lastNode.appendChild(img);
 
-                 if (insertSpace && count < len) {
 
-                     space = this.makeSpacerElement();
 
-                     fragment.appendChild(space);
 
-                 }
 
-             } else {
 
-                 lastNode = fragment.appendChild(img);
 
-                 if (insertSpace && count < len) {
 
-                     fragment.appendChild(this.doc.createTextNode('\u00a0'));
 
-                 }
 
-             }
 
-             this.images.push(imgAttr);
 
-         }
 
-         if (lastNode) {
 
-             if (para) {
 
-                 if (pNode.nodeName.toLowerCase() === 'p') {
 
-                     if (!checkPara(pNode)) {
 
-                         pNode.parentNode.replaceChild(fragment, pNode);
 
-                     } else {
 
-                         pNode.parentNode.insertBefore(fragment, pNode.nextSibling);
 
-                     }
 
-                 } else {
 
-                     if (!this.W3CRange) {
 
-                         div = this.doc.createElement('div');
 
-                         div.appendChild(fragment);
 
-                         range.pasteHTML(div.innerHTML);
 
-                     } else {
 
-                         range.insertNode(fragment);
 
-                     }
 
-                 }
 
-                 this.placeCaretAt(lastNode.nextSibling ? lastNode.nextSibling : lastNode, false);
 
-             } else {
 
-                 if (!this.W3CRange) {
 
-                     div = this.doc.createElement('div');
 
-                     div.appendChild(fragment);
 
-                     range.pasteHTML(div.innerHTML);
 
-                 } else {
 
-                     range.deleteContents();
 
-                     range.insertNode(fragment);
 
-                     range.setStartAfter(lastNode);
 
-                     range.setEndAfter(lastNode);
 
-                     selection = this.getSelection();
 
-                     selection.removeAllRanges();
 
-                     selection.addRange(range);
 
-                 }
 
-             }
 
-             this.setImageEvent(true);
 
-         }
 
-     },
 
-     showTagSelector: function (on) {
 
-         if (this.config.showTagPath !== true) {
 
-             return;
 
-         }
 
-         this.cheditor.tagPath.style.display = on ? 'block' : 'none';
 
-     },
 
-     getTextContentSelectionPos: function (newline) {
 
-         var textContent = this.cheditor.textContent,
 
-             start, end, docRange, startRange, endRange, textContentLength, normalizedText;
 
-         if (typeof textContent.selectionStart === 'number') {
 
-             start = textContent.selectionStart;
 
-             end = textContent.selectionEnd;
 
-         } else {
 
-             textContentLength = textContent.value.length;
 
-             normalizedText = textContent.value.replace(/\r\n/g, '\n');
 
-             docRange = document.selection.createRange();
 
-             startRange = textContent.createTextRange();
 
-             endRange = startRange.duplicate();
 
-             endRange.collapse(false);
 
-             startRange.moveToBookmark(docRange.getBookmark());
 
-             if (startRange.compareEndPoints('StartToEnd', endRange) > -1) {
 
-                 start = end = textContentLength;
 
-             } else {
 
-                 start = -startRange.moveStart('character', -textContentLength);
 
-                 if (newline) {
 
-                     start += normalizedText.slice(0, start).split('\n').length - 1;
 
-                 }
 
-                 if (startRange.compareEndPoints('EndToEnd', endRange) > -1) {
 
-                     end = textContentLength;
 
-                 } else {
 
-                     end = -startRange.moveEnd('character', -textContentLength);
 
-                     if (newline) {
 
-                         end += normalizedText.slice(0, end).split('\n').length - 1;
 
-                     }
 
-                 }
 
-             }
 
-         }
 
-         return { startPos: start, endPos: end };
 
-     },
 
-     removeEmptyBogusTag: function (content) {
 
-         if (/^<(p|div)([^>]+?)?>( |\s+?)<\/(p|div)>$/g.test(this.trimSpace(content))) {
 
-             return '';
 
-         }
 
-         if (/^<br([^>]+?)?>$/g.test(content)) {
 
-             return '';
 
-         }
 
-         return content;
 
-     },
 
-     setTextContentSelection: function (startPos, endPos, content) {
 
-         var textContent = this.cheditor.textContent, range, top;
 
-         content = this.removeEmptyBogusTag(content);
 
-         if (!content) {
 
-             textContent.focus();
 
-             return;
 
-         }
 
-         if (startPos === 0 && endPos === 0) {
 
-             textContent.value = content;
 
-             textContent.focus();
 
-             return;
 
-         }
 
-         textContent.select();
 
-         if (typeof textContent.setSelectionRange === 'function') {
 
-             textContent.value = content;
 
-             textContent.setSelectionRange(startPos, startPos);
 
-             textContent.focus();
 
-             if (this.browser.msie || this.browser.edge) {
 
-                 setTimeout(function () {
 
-                     top = textContent.scrollTop;
 
-                     if (top > 0) {
 
-                         textContent.scrollTop = top + textContent.clientHeight / 2;
 
-                     }
 
-                     textContent.selectionEnd = endPos;
 
-                 }, 0);
 
-             } else {
 
-                 textContent.selectionEnd = endPos;
 
-             }
 
-         } else {
 
-             range = document.selection.createRange();
 
-             textContent.value = content;
 
-             range.moveEnd('character', endPos - content.length);
 
-             range.moveStart('character', startPos);
 
-             range.select();
 
-             top = textContent.scrollTop;
 
-             if (top > 0) {
 
-                 textContent.scrollTop = top + textContent.clientHeight / 2;
 
-             }
 
-         }
 
-     },
 
-     richMode: function () {
 
-         var char, collapsed, cursor, endNode, endPos, endRange, outputHTML = null, pNode, pos, range,
 
-             scrollTop, selection, startNode, startPos, startRange, textContent = null, textContentLength;
 
-         if (this.cheditor.mode === 'code' && typeof this.resizeTextContent !== 'undefined') {
 
-             this.cheditor.textContent.focus();
 
-             textContent = this.makeHtmlContent();
 
-             textContentLength = textContent.length;
 
-             pos = this.getTextContentSelectionPos(true);
 
-             startPos = pos.startPos;
 
-             endPos = pos.endPos;
 
-             collapsed = startPos === endPos;
 
-             cursor = startPos;
 
-             if (textContent.charAt(startPos) === '>') {
 
-                 startPos++;
 
-                 collapsed = true;
 
-             } else {
 
-                 while (cursor > -1) {
 
-                     char = textContent.charAt(cursor);
 
-                     if (char === '&'
 
-                         && textContent.charAt(cursor + 1) === 'n' && textContent.charAt(cursor + 2) === 'b'
 
-                         && textContent.charAt(cursor + 3) === 's' && textContent.charAt(cursor + 4) === 'p'
 
-                         && textContent.charAt(cursor + 5) === ';') {
 
-                         startPos = cursor;
 
-                         collapsed = endPos < (startPos + 6);
 
-                         break;
 
-                     }
 
-                     if (char === '>') {
 
-                         break;
 
-                     }
 
-                     if (char === '<') {
 
-                         startPos = cursor;
 
-                         collapsed = true;
 
-                         break;
 
-                     }
 
-                     cursor--;
 
-                 }
 
-             }
 
-             if (!collapsed) {
 
-                 cursor = endPos;
 
-                 if (textContent.charAt(endPos - 1) === '<' ||
 
-                     (textContent.charAt(endPos) === '\n' && cursor === textContentLength - 1)) {
 
-                     endPos = startPos;
 
-                 } else {
 
-                     while (cursor < textContentLength) {
 
-                         char = textContent.charAt(cursor);
 
-                         if (char === '<') {
 
-                             break;
 
-                         }
 
-                         if (char === '>') {
 
-                             endPos = startPos;
 
-                             break;
 
-                         }
 
-                         cursor++;
 
-                     }
 
-                 }
 
-             } else {
 
-                 endPos = startPos;
 
-             }
 
-             if (startPos > 0 && endPos < textContentLength - 1) {
 
-                 outputHTML = textContent.substring(0, startPos);
 
-                 outputHTML += '<span id="startBogusNode"></span>';
 
-                 outputHTML += textContent.substring(startPos, endPos);
 
-                 outputHTML += '<span id="endBogusNode"></span>';
 
-                 outputHTML += textContent.substring(endPos, textContent.length);
 
-                 textContent = outputHTML;
 
-             }
 
-             this.cheditor.textContent.value = '';
 
-             this.removeEvent(window, 'resize', this.resizeTextContent);
 
-             this.putContents(this.convertContentsSpacer(textContent));
 
-         }
 
-         this.range = null;
 
-         this.cheditor.textContent.blur();
 
-         this.cheditor.textContent.removeAttribute('start-pos');
 
-         this.cheditor.textContent.removeAttribute('end-pos');
 
-         this.cheditor.textContent.style.display = 'none';
 
-         this.cheditor.toolbarWrapper.style.display = '';
 
-         this.cheditor.toolbarWrapper.className = 'cheditor-tb-wrapper';
 
-         this.cheditor.editArea.style.visibility = 'hidden';
 
-         if (!this.setFullScreenMode) {
 
-             this.cheditor.editArea.style.height = this.config.editorHeight;
 
-         }
 
-         this.cheditor.editArea.style.display = 'block';
 
-         this.cheditor.editArea.style.visibility = 'visible';
 
-         this.setDesignMode(true);
 
-         this.editAreaFocus();
 
-         if (outputHTML) {
 
-             startNode = this.doc.getElementById('startBogusNode');
 
-             endNode = this.doc.getElementById('endBogusNode');
 
-             if (startNode && endNode) {
 
-                 scrollTop = 0;
 
-                 pNode = startNode;
 
-                 if (pNode) {
 
-                     while (pNode.offsetParent) {
 
-                         scrollTop += pNode.offsetTop;
 
-                         pNode = pNode.offsetParent;
 
-                     }
 
-                     scrollTop -= this.getWindowSize(this.doc).height / 2;
 
-                 }
 
-                 if (this.doc.compatMode === 'CSS1Compat') {
 
-                     this.doc.documentElement.scrollTop = scrollTop;
 
-                 } else {
 
-                     this.doc.body.scrollTop = scrollTop;
 
-                 }
 
-                 if (this.W3CRange) {
 
-                     selection = this.clearSelection();
 
-                     range = this.createRange();
 
-                     range.setStartAfter(startNode);
 
-                     range.setEndBefore(endNode);
 
-                     try {
 
-                         selection.addRange(range);
 
-                     } catch (ignore) {
 
-                         // display: none?
 
-                     }
 
-                 } else {
 
-                     startRange = this.createRange();
 
-                     endRange = startRange.duplicate();
 
-                     startRange.moveToElementText(startNode);
 
-                     endRange.moveToElementText(endNode);
 
-                     startRange.setEndPoint('StartToEnd', startRange);
 
-                     startRange.setEndPoint('EndToEnd', endRange);
 
-                     startRange.select();
 
-                 }
 
-                 pNode = startNode.parentNode;
 
-                 pNode.removeChild(startNode);
 
-                 pNode = endNode.parentNode;
 
-                 pNode.removeChild(endNode);
 
-             }
 
-         }
 
-         this.setImageEvent(true);
 
-         this.toolbarUpdate();
 
-     },
 
-     editMode: function () {
 
-         var self = this,
 
-             editorWidth, scrollBarWidth, scrollBarHeight, resize, content = null, borderWidth = 1, borderHeight = 1,
 
-             startPos, endPos, startNode, endNode, startEndNode,
 
-             editorHeight = this.cheditor.editWrapper.offsetHeight,
 
-             textContent = this.cheditor.textContent,
 
-             startNodeValue = 'startBogusNode', endNodeValue = 'endBogusNode',
 
-             startNodeCommentTag = '<!--' + startNodeValue + '-->', endNodeCommentTag = '<!--' + endNodeValue + '-->',
 
-             range = this.restoreRange();
 
-         if (this.cheditor.mode === 'preview') {
 
-             if (textContent.getAttribute('start-pos')) {
 
-                 startPos = parseInt(textContent.getAttribute('start-pos'), 10);
 
-                 textContent.removeAttribute('start-pos');
 
-                 if (textContent.getAttribute('end-pos')) {
 
-                     endPos = parseInt(textContent.getAttribute('end-pos'), 10);
 
-                     textContent.removeAttribute('end-pos');
 
-                 } else {
 
-                     endPos = startPos;
 
-                 }
 
-                 content = textContent.value.replace(/\r\n/g, '\n');
 
-             } else {
 
-                 this.placeCaretAt(this.doc.body.firstChild || this.doc.body, true);
 
-                 range = this.getRange();
 
-             }
 
-         }
 
-         if (!content) {
 
-             startEndNode = this.insertStartEndNode(range);
 
-             startNode = this.doc.createComment(startNodeValue);
 
-             endNode = this.doc.createComment(endNodeValue);
 
-             startEndNode.startNode.parentNode.replaceChild(startNode, startEndNode.startNode);
 
-             startEndNode.endNode.parentNode.replaceChild(endNode, startEndNode.endNode);
 
-             startEndNode.startNode = startNode;
 
-             startEndNode.endNode = endNode;
 
-             content = this.getContents(startEndNode);
 
-             startPos = content.search(startNodeCommentTag);
 
-             endPos = content.search(endNodeCommentTag);
 
-             endPos -= endNodeCommentTag.length + 2;
 
-             content = content.replace(startNodeCommentTag, '').replace(endNodeCommentTag, '');
 
-         }
 
-         this.resetDocumentBody();
 
-         this.cheditor.editArea.style.display = 'none';
 
-         this.cheditor.toolbarWrapper.className = 'cheditor-tb-wrapper-code';
 
-         this.cheditor.editBlock.style.display = 'none';
 
-         textContent.value = '';
 
-         textContent.style.lineHeight = '17px';
 
-         textContent.style.width = '100px';
 
-         textContent.style.height = '100px';
 
-         textContent.style.display = 'block';
 
-         scrollBarWidth = textContent.offsetWidth - 100;
 
-         scrollBarHeight = textContent.offsetHeight - 100;
 
-         if (this.browser.msie && this.browser.version < 8) {
 
-             scrollBarHeight += 2;
 
-         }
 
-         textContent.setAttribute('xbar-height', scrollBarHeight.toString());
 
-         textContent.setAttribute('ybar-width', scrollBarWidth.toString());
 
-         resize = textContent.offsetHeight + (editorHeight - textContent.offsetHeight) - scrollBarHeight - borderHeight;
 
-         textContent.style.height = resize + 'px';
 
-         this.resizeTextContent = function () {
 
-             editorWidth = self.cheditor.editWrapper.offsetWidth;
 
-             resize = textContent.offsetWidth + (editorWidth - textContent.offsetWidth) - scrollBarWidth - borderWidth;
 
-             self.cheditor.textContent.style.width = resize + 'px';
 
-         };
 
-         (function () {
 
-             self.addEvent(window, 'resize', self.resizeTextContent);
 
-             self.resizeTextContent();
 
-         })();
 
-         this.setTextContentSelection(startPos, endPos, content);
 
-         this.setDesignMode(false);
 
-     },
 
-     makeHtmlContent: function () {
 
-         var content = this.trimSpace(this.cheditor.textContent.value);
 
-         content = this.trimZeroSpace(content);
 
-         return content || '<p> </p>';
 
-     },
 
-     resetStatusBar: function () {
 
-         if (this.config.showTagPath) {
 
-             this.cheditor.tagPath.innerHTML = '<html> <body> ';
 
-         }
 
-     },
 
-     previewMode: function () {
 
-         var content, oSheet, pos = this.getTextContentSelectionPos(false);
 
-         if (this.cheditor.mode === 'code' && typeof this.resizeTextContent !== 'undefined') {
 
-             this.cheditor.textContent.setAttribute('start-pos', pos.startPos.toString());
 
-             this.cheditor.textContent.setAttribute('end-pos', pos.endPos.toString());
 
-             content = this.makeHtmlContent();
 
-             this.cheditor.textContent.blur();
 
-             this.cheditor.textContent.style.display = 'none';
 
-             this.removeEvent(window, 'resize', this.resizeTextContent);
 
-             this.putContents(content);
 
-         }
 
-         this.clearSelection();
 
-         this.cheditor.editBlock.style.display = 'none';
 
-         this.cheditor.toolbarWrapper.className = 'cheditor-tb-wrapper-preview';
 
-         if (!this.setFullScreenMode) {
 
-             this.cheditor.editArea.style.height = this.config.editorHeight;
 
-         }
 
-         this.cheditor.editArea.style.display = 'block';
 
-         if (GB.browser.msie && parseInt(GB.browser.version, 10) === 8) {
 
-             try {
 
-                 oSheet = this.doc.styleSheets[0];
 
-                 oSheet.addRule('p:before', 'content:"\u200b"');
 
-             } catch (ignore) {
 
-                 // ignore
 
-             }
 
-         }
 
-         this.setImageEvent(false);
 
-         this.setDesignMode(false);
 
-     },
 
-     convertContentsSpacer: function (content) {
 
-         var self = this, bogusBr = true,
 
-             excepted = '<span id="startBogusNode"><\/span><span id="endBogusNode"><\/span>',
 
-             reSpacer = new RegExp('<([^>]+)>(' + excepted + ')?(?: |\s+?|\u00a0)(' + excepted + ')?<\/([^>]+)>', 'g');
 
-         if (GB.browser.msie && GB.browser.msie_bogus === false) {
 
-             bogusBr = false;
 
-         }
 
-         content = content.replace(/\s{2,}|[\r\n\t]+?/gm, '');
 
-         content = content.replace(reSpacer,
 
-             function (all, open, excepted_a, excepted_b, close) {
 
-                 var tagName = self.trimSpace(open.split(' ')[0]).toLowerCase(), rdata = null;
 
-                 if (GB.lineHeightBlockTags[tagName] || GB.textFormatTags[tagName]) {
 
-                     rdata = '<' + open + '>' + (excepted_a || '');
 
-                     rdata += bogusBr ? '<br class="' + self.cheditor.bogusSpacerName + '" />' :
 
-                         '<!--' + self.cheditor.bogusSpacerName + '-->';
 
-                     rdata += (excepted_b || '') + '</' + close + '>';
 
-                 }
 
-                 return rdata || all;
 
-             }
 
-         );
 
-         return content;
 
-     },
 
-     putContents: function (content) {
 
-         if (this.config.fullHTMLSource) {
 
-             content = content.substr(content.search(/<html/ig) + 1);
 
-             content = content.substr(content.indexOf('>') + 1);
 
-             content = '<html>' + content;
 
-             this.doc.open();
 
-             this.doc.write('<body>' + content + '</body>');
 
-             this.doc.close();
 
-         } else {
 
-             content = '<span>remove_this</span>' + content;
 
-             this.doc.body.innerHTML = content;
 
-             this.doc.body.removeChild(this.doc.body.firstChild);
 
-         }
 
-     },
 
-     getImages: function () {
 
-         var img = this.doc.body.getElementsByTagName('img'),
 
-             imgLength = this.images.length,
 
-             imgs = [], i, imgId, j;
 
-         for (i = 0; i < img.length; i++) {
 
-             if (img[i].src) {
 
-                 imgId = img[i].src;
 
-                 imgId = imgId.slice(imgId.lastIndexOf('/') + 1);
 
-                 for (j = 0; j < imgLength; j++) {
 
-                     if (this.images[j].fileName === imgId) {
 
-                         imgs.push(this.images[j]);
 
-                         break;
 
-                     }
 
-                 }
 
-             }
 
-         }
 
-         return imgs.length > 0 ? imgs : null;
 
-     },
 
-     getElementStyle: function (elem) {
 
-         return (window.getComputedStyle) ? this.doc.defaultView.getComputedStyle(elem, null) : elem.currentStyle;
 
-     },
 
-     getElementDefaultDisplay: function (elem) {
 
-         return (window.getComputedStyle ? this.doc.defaultView.getComputedStyle(elem, null) : elem.currentStyle).display;
 
-     },
 
-     tabRepeat: function (count) {
 
-         var i = 0, tab = '';
 
-         if (count < 1) {
 
-             return tab;
 
-         }
 
-         for (; i < count; i++) {
 
-             tab += this.cheditor.tabSpaces;
 
-         }
 
-         return tab;
 
-     },
 
-     htmlEncode: function (text) {
 
-         //text = text.replace(/\n{2,}$/g, '\n');
 
-         //text = text.replace(/&/g, '&');
 
-         text = text.replace(/</g, '<');
 
-         text = text.replace(/>/g, '>');
 
-         text = text.replace(/\u00a0/g, ' ');
 
-         //text = text.replace(/<font ([^>]+)> <\/font>/mgi, '');
 
-         //text = text.replace(/\x22/g, '"');
 
-         return text;
 
-     },
 
-     checkDocLinks: function () {
 
-         var links = this.doc.links,
 
-             len = links.length,
 
-             host = location.host,
 
-             i, href;
 
-         this.cheditor.links = [];
 
-         for (i = 0; i < len; i++) {
 
-             if (!this.config.includeHostname) {
 
-                 href = links[i].href;
 
-                 if (href.indexOf(host) !== -1) {
 
-                     links[i].setAttribute('href', href.substring(href.indexOf(host) + host.length));
 
-                 }
 
-             }
 
-             if (this.config.linkTarget !== '' && this.config.linkTarget !== null) {
 
-                 if (!(links[i].getAttribute('target'))) {
 
-                     links[i].setAttribute('target', this.config.linkTarget);
 
-                 }
 
-             }
 
-             if (GB.browser.msie) {
 
-                 this.cheditor.links.push(links[i]);
 
-             }
 
-         }
 
-     },
 
-     checkDocImages: function () {
 
-         var img = this.doc.images,
 
-             len = img.length,
 
-             host = location.host,
 
-             i = 0, imgUrl;
 
-         for (; i < len; i++) {
 
-             if (!this.config.includeHostname) {
 
-                 imgUrl = img[i].src;
 
-                 if (imgUrl) {
 
-                     if (imgUrl.indexOf(host) !== -1) {
 
-                         img[i].src = imgUrl.substring(imgUrl.indexOf(host) + host.length);
 
-                     }
 
-                 }
 
-             }
 
-             if (img[i].style.width) {
 
-                 img[i].removeAttribute('width');
 
-             }
 
-             if (img[i].style.height) {
 
-                 img[i].removeAttribute('height');
 
-             }
 
-         }
 
-     },
 
-     createNbspTextNode: function () {
 
-         return this.doc.createTextNode('\u00a0');
 
-     },
 
-     getNodeTree: function (pNode, callback) {
 
-         function Node(node) {
 
-             this.node = node;
 
-             this.name = node.nodeName.toLowerCase();
 
-             this.type = node.nodeType;
 
-             this.parent = node.parentNode;
 
-             this.indent = 0;
 
-         }
 
-         (function recurse(cNode, indent) {
 
-             var i, child,
 
-                 node = new Node(cNode),
 
-                 children = cNode.childNodes,
 
-                 len = children.length;
 
-             node.indent = indent;
 
-             for (i = 0; i < len; i++) {
 
-                 child = children[i];
 
-                 if (child) {
 
-                     recurse(child, indent + 1);
 
-                 }
 
-             }
 
-             if (node.name !== 'body') {
 
-                 callback(node);
 
-             }
 
-         })(pNode, -1);
 
-     },
 
-     getContents: function (startEndNode) {
 
-         var self = this,
 
-             mydoc, indentNodes = [], i, node, msie_c = typeof this.browser.msie_c !== 'undefined',
 
-             allowedIndent = this.getContents.caller !== this.getBodyContents,
 
-             insertTabSpace = function (indent) {
 
-                 return msie_c ? self.doc.createComment('Tab Size:' + indent) :
 
-                     self.doc.createTextNode('\n' + self.tabRepeat(indent));
 
-             };
 
-         function checkChildNodes(child) {
 
-             if (!child) {
 
-                 return null;
 
-             }
 
-             if (!startEndNode) {
 
-                 return child;
 
-             }
 
-             do {
 
-                 if (child !== startEndNode.startNode && child !== startEndNode.endNode) {
 
-                     break;
 
-                 }
 
-                 child = child.nextSibling;
 
-             } while (child);
 
-             return child;
 
-         }
 
-         this.checkDocLinks();
 
-         this.checkDocImages();
 
-         this.getNodeTree(this.doc.body, function (node) {
 
-             if (!node.node) {
 
-                 return;
 
-             }
 
-             if (self.config.exceptedElements[node.name]) {
 
-                 node.parent.replaceChild(self.doc.createTextNode(''), node.node);
 
-                 return;
 
-             }
 
-             switch (node.type) {
 
-                 case GB.node.text:
 
-                     if (!self.isTextVisible(node.node.nodeValue)) {
 
-                         node.parent.replaceChild(self.doc.createTextNode(''), node.node);
 
-                     }
 
-                     break;
 
-                 case GB.node.element:
 
-                     if (node.node.className === self.cheditor.bogusSpacerName) {
 
-                         if (node.node.firstChild === null) {
 
-                             if (node.name === 'br') {
 
-                                 node.parent.removeChild(node.node);
 
-                                 if (!checkChildNodes(node.parent.firstChild)) {
 
-                                     node.parent.appendChild(self.createNbspTextNode());
 
-                                 }
 
-                             } else {
 
-                                 node.node.appendChild(self.createNbspTextNode());
 
-                             }
 
-                         } else if (!checkChildNodes(node.node.firstChild)) {
 
-                             node.node.appendChild(self.createNbspTextNode());
 
-                         }
 
-                         node.node.className = '';
 
-                     }
 
-                     if ((node.name === 'p' || node.name === 'div') && !checkChildNodes(node.node.firstChild)) {
 
-                         node.node.appendChild(self.createNbspTextNode());
 
-                     }
 
-                     if (GB.newLineBeforeTags[node.name] && allowedIndent) {
 
-                         if (node.node.firstChild && (node.node.firstChild.nodeType === GB.node.element)) {
 
-                             node.node.insertBefore(insertTabSpace(node.indent + 1), node.node.firstChild);
 
-                             node.node.appendChild(insertTabSpace(node.indent));
 
-                         }
 
-                         indentNodes.push(node);
 
-                     }
 
-                     if (GB.selfClosingTags[node.name]) {
 
-                         node.node.setAttribute('self-close-tag', '1');
 
-                     }
 
-                     break;
 
-                 case GB.node.comment:
 
-                     if (node.node.nodeValue === self.cheditor.bogusSpacerName) {
 
-                         node.parent.removeChild(node.node);
 
-                         if (!checkChildNodes(node.parent.firstChild)) {
 
-                             node.parent.appendChild(self.createNbspTextNode());
 
-                         } else if (node.parent.firstChild.nodeName.toLowerCase() === 'br') {
 
-                             node.parent.replaceChild(self.createNbspTextNode(), node.node.firstChild);
 
-                         }
 
-                     }
 
-             }
 
-         });
 
-         for (i in indentNodes) {
 
-             if (indentNodes.hasOwnProperty(i)) {
 
-                 node = indentNodes[i];
 
-                 node.parent.insertBefore(insertTabSpace(node.indent), node.node);
 
-                 if (node.node.nextSibling) {
 
-                     node.node.nextSibling.parentNode.insertBefore(insertTabSpace(node.indent), node.node.nextSibling);
 
-                 } else {
 
-                     node.parent.appendChild(insertTabSpace(node.indent));
 
-                 }
 
-             }
 
-         }
 
-         indentNodes = [];
 
-         mydoc = this.doc.body.innerHTML;
 
-         mydoc = mydoc.replace(/^\s*[\r\n]/gm, '').replace(/\u200b/g, '');
 
-         if (msie_c) {
 
-             mydoc = mydoc.replace(/<!--Tab Size:(\d+)-->(?:[\r\n]*)/g,
 
-                 function (a, b) {
 
-                     return '\n' + self.tabRepeat(b);
 
-                 }).replace(/<(\/?)([A-Za-z]+)([^>]*)>/g,
 
-                 function (a, close, tag, attr) {
 
-                     attr = attr.replace(/\s(\w+)=([^'"\s>]+)/g,
 
-                         function (a, k, v) {
 
-                             return ' ' + k.toLowerCase() + '="' + v + '"';
 
-                         }).replace(/([A-Za-z\-]+)(?:\s*):\s+?/g,
 
-                         function (a, k) {
 
-                             return k.toLowerCase() + ': ';
 
-                         });
 
-                     return '<' + close + tag.toLowerCase() + attr + '>';
 
-                 }
 
-             );
 
-         }
 
-         mydoc = mydoc.replace(/<[^>]+>/gm, function (match) {
 
-             match = match.replace(/\sself-close-tag="1"([^>]+)?/g, '$1 /');
 
-             if (self.config.allowedOnEvent !== true) {
 
-                 match = match.replace(/\s+on([A-Za-z]+)=("[^"]*"|'[^']*'|[^\s>]*)/g, '');
 
-             }
 
-             if (self.config.colorToHex) {
 
-                 match = match.replace(/(background-color|color)\s*([:=])\s*(rgba?)\(\s*(\d+)\s*,\s*(\d+),\s*(\d+)\)/ig,
 
-                     function (all, p, s, rgb, r, g, b) {
 
-                         return p + s + ' ' + self.colorConvert(rgb + '(' + r + ',' + g + ',' + b + ')', 'hex');
 
-                     });
 
-             } else {
 
-                 match = match.replace(/(background-color|color)\s*([:=])\s*(#[A-Fa-f0-9]{3,6})/ig,
 
-                     function (all, p, s, hex) {
 
-                         return p + s + ' ' + self.colorConvert(hex, 'rgb');
 
-                     });
 
-             }
 
-             return match;
 
-         });
 
-         return mydoc;
 
-     },
 
-     returnContents: function (mydoc) {
 
-         mydoc = this.removeEmptyBogusTag(mydoc);
 
-         this.setDesignMode(true);
 
-         this.cheditor.textarea.value = mydoc;
 
-         return mydoc;
 
-     },
 
-     makeAmpTag: function (str) {
 
-         return str.replace(/</g, '&lt;').replace(/>/g, '&gt;');
 
-     },
 
-     removeAmpTag: function (str) {
 
-         if (this.config.removeIndent) {
 
-             str = str.replace(/^[\t]+/gm, '');
 
-         }
 
-         return str.replace(/&lt;/g, '<').replace(/&gt;/g, '>');
 
-     },
 
-     getOutputContents: function () {
 
-         this.resetViewHTML();
 
-         return this.removeAmpTag(this.getContents(null));
 
-     },
 
-     outputHTML: function () {
 
-         return '<!DOCTYPE html>\n' +
 
-             '<html>\n' +
 
-             '  <head>\n' +
 
-             '    <title>' + this.config.docTitle + '</title>\n' +
 
-             '  </head>\n' +
 
-             '  <body>\n' +
 
-             this.returnContents(this.getOutputContents()) +
 
-             '  </body>\n' +
 
-             '</html>';
 
-     },
 
-     getBodyContents: function () {
 
-         return (this.cheditor.mode === 'code') ? this.makeHtmlContent() : this.getContents(null);
 
-     },
 
-     outputBodyHTML: function () {
 
-         return this.returnContents(this.getOutputContents());
 
-     },
 
-     outputBodyText: function () {
 
-         return this.returnContents(this.getBodyText());
 
-     },
 
-     getBodyText: function () {
 
-         this.resetViewHTML();
 
-         return this.trimSpace(String(GB.browser.msie ? this.doc.body.innerText : this.doc.body.textContent));
 
-     },
 
-     returnFalse: function () {
 
-         var img = this.doc.images, i;
 
-         this.editAreaFocus();
 
-         for (i = 0; i < img.length; i++) {
 
-             if (img[i].src) {
 
-                 if (img[i].getAttribute('onload')) {
 
-                     img[i].onload = 'true';
 
-                 }
 
-             } else {
 
-                 img[i].removeAttribute('onload');
 
-                 img[i].removeAttribute('className');
 
-             }
 
-         }
 
-         return false;
 
-     },
 
-     trimZeroSpace: function (str) {
 
-         return str ? str.replace(/[\ufeff\u200b\xa0\u3000]+/gm, '') : '';
 
-     },
 
-     trimSpace: function (str) {
 
-         return str ? str.replace(/^[\s\ufeff\u200b\xa0\u3000]+|[\s\ufeff\u200b\xa0\u3000]+$/g, '') : '';
 
-     },
 
-     makeRandomString: function () {
 
-         var chars = '_-$@!#0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz',
 
-             len = 32,
 
-             clen = chars.length,
 
-             rData = '', i, rnum;
 
-         for (i = 0; i < len; i++) {
 
-             rnum = Math.floor(Math.random() * clen);
 
-             rData += chars.substring(rnum, rnum + 1);
 
-         }
 
-         return rData;
 
-     },
 
-     strLength: function (str) {
 
-         var len = str.length, mbytes = 0, i, c;
 
-         for (i = 0; i < len; i++) {
 
-             c = str.charCodeAt(i);
 
-             if (c > 128) {
 
-                 mbytes++;
 
-             }
 
-         }
 
-         return (len - mbytes) + (mbytes * 2);
 
-     },
 
-     resetViewHTML: function () {
 
-         if (this.cheditor.mode === 'code') {
 
-             this.switchEditorMode('rich');
 
-         }
 
-     },
 
-     contentsLengthAll: function () {
 
-         return this.strLength(this.outputHTML());
 
-     },
 
-     contentsLength: function () {
 
-         var content = String(this.trimSpace(this.outputBodyHTML()));
 
-         if (!content) {
 
-             return 0;
 
-         }
 
-         return this.strLength(content);
 
-     },
 
-     inputLength: function () {
 
-         var content = this.getBodyText();
 
-         if (content === '') {
 
-             return 0;
 
-         }
 
-         return this.strLength(content);
 
-     },
 
-     displayWindow: function (pNode, id) {
 
-         var pullDown = this.pulldown[id];
 
-         this.editAreaFocus();
 
-         this.backupRange();
 
-         this.boxHideAll(id);
 
-         pullDown.style.visibility = 'visible';
 
-         pullDown.style.zIndex = 10002;
 
-         pullDown.focus();
 
-     },
 
-     pulldownMouseOver: function (el) {
 
-         if (el.className === 'cheditor-pulldown-selected') {
 
-             return;
 
-         }
 
-         el.className = 'cheditor-pulldown-mouseover';
 
-     },
 
-     pulldownMouseOut: function (el) {
 
-         if (el.className === 'cheditor-pulldown-selected') {
 
-             return;
 
-         }
 
-         el.className = 'cheditor-pulldown-mouseout';
 
-     },
 
-     windowPos: function (pNode, id) {
 
-         var left = pNode.offsetLeft, box = this.pulldown[id];
 
-         if (this.toolbar[id].type === 'combobox') {
 
-             left -= parseInt(this.toolbar[this.toolbar[id].node].width, 10);
 
-         }
 
-         if (this.toolbar[id].prev && !this.toolbar[id].next) {
 
-             left -= 1;
 
-         }
 
-         box.style.left = left + 'px';
 
-         box.style.top = pNode.offsetTop + parseInt(pNode.style.height, 10) + 'px';
 
-     },
 
-     boxHideAll: function (showId) {
 
-         var menu, box, ishide;
 
-         for (menu in this.pulldown) {
 
-             if (this.pulldown.hasOwnProperty(menu)) {
 
-                 box = this.pulldown[menu];
 
-                 if (box) {
 
-                     box.style.visibility = 'hidden';
 
-                     ishide = this.undefined(showId) ? true : (menu !== showId);
 
-                     if (ishide && this.toolbar[menu].checked) {
 
-                         this.toolbar[menu].checked = false;
 
-                         this.toolbarButtonUnchecked(this.toolbar[menu]);
 
-                     }
 
-                 }
 
-             }
 
-         }
 
-         this.editAreaFocus();
 
-     },
 
-     createWindow: function (width, elem) {
 
-         elem.className = 'cheditor-pulldown-container';
 
-         elem.style.width = width + 'px';
 
-     },
 
-     setColorTable: function (menu) {
 
-         var self = this,
 
-             pulldown = document.createElement('div'),
 
-             len = GB.colors.length,
 
-             container = document.createElement('div'),
 
-             selected = document.createElement('input'),
 
-             selectedValue = document.createElement('input'),
 
-             cellWrapper = document.createElement('div'),
 
-             br = document.createElement('div'),
 
-             reset = document.createElement('span'),
 
-             pickerSwitch = document.createElement('span'),
 
-             button = document.createElement('img'),
 
-             showTooltip = '더 많은 색 보기',
 
-             hideTooltip = '감추기',
 
-             i, cell, color = 0, colorPicker, cellBorder,
 
-             onMouseOverEventHandler = function () {
 
-                 colorPicker.fromString(this.id);
 
-                 this.parentNode.className = 'cheditor-pulldown-color-cell-over';
 
-             },
 
-             onMouseOutEventHandler = function () {
 
-                 this.parentNode.className = 'cheditor-pulldown-color-cell';
 
-             },
 
-             onClickEventHandler = function () {
 
-                 self.doCmdPopup(menu, this.id);
 
-             },
 
-             onResetEventHandler = function () {
 
-                 colorPicker.fromString(self.colorConvert(selectedValue.style.backgroundColor, 'hex'));
 
-             },
 
-             onPickerEventHandler = function () {
 
-                 if (self.toolbar[menu].colorNode.showPicker) {
 
-                     colorPicker.hidePicker();
 
-                     self.toolbar[menu].colorNode.showPicker = false;
 
-                     pickerSwitch.setAttribute('title', showTooltip);
 
-                 } else {
 
-                     colorPicker.showPicker();
 
-                     self.toolbar[menu].colorNode.showPicker = true;
 
-                     pickerSwitch.setAttribute('title', hideTooltip);
 
-                 }
 
-             },
 
-             onSubmitEventHandler = function () {
 
-                 self.doCmdPopup(menu, selected.value);
 
-             };
 
-         selected.setAttribute('type', 'text');
 
-         selected.setAttribute('maxlength', '7');
 
-         selected.className = 'cheditor-pulldown-color-selected';
 
-         selectedValue.setAttribute('type', 'text');
 
-         selectedValue.onfocus = function () {
 
-             selected.focus();
 
-         };
 
-         selectedValue.style.cursor = 'default';
 
-         selectedValue.className = 'cheditor-pulldown-color-selected';
 
-         selected.style.marginLeft = '-1px';
 
-         selected.style.borderLeft = 'none';
 
-         selected.spellcheck = false;
 
-         cellWrapper.style.margin = '2px';
 
-         cellWrapper.style.position = 'relative';
 
-         container.style.position = 'relative';
 
-         br.style.clear = 'both';
 
-         br.style.height = '0px';
 
-         colorPicker = new GB.colorDropper(selected, { 'iconDir': this.config.iconPath });
 
-         for (i = 0; i < len; i++) {
 
-             if (i % 13 === 0) {
 
-                 cellWrapper.appendChild(br.cloneNode(true));
 
-                 if (i === 26) {
 
-                     cellWrapper.lastChild.style.height = '4px';
 
-                 }
 
-                 len++;
 
-                 continue;
 
-             }
 
-             cellBorder = document.createElement('span');
 
-             cellBorder.className = 'cheditor-pulldown-color-cell';
 
-             cell = document.createElement('span');
 
-             cell.id = GB.colors[color];
 
-             cell.style.backgroundColor = GB.colors[color++];
 
-             cell.appendChild(document.createTextNode('\u00a0'));
 
-             cellBorder.appendChild(cell);
 
-             cellWrapper.appendChild(cellBorder);
 
-             (function () {
 
-                 cell.onclick = onClickEventHandler;
 
-                 cell.onmouseover = onMouseOverEventHandler;
 
-                 cell.onmouseout = onMouseOutEventHandler;
 
-             })();
 
-         }
 
-         cellWrapper.appendChild(br);
 
-         cellWrapper.appendChild(selectedValue);
 
-         cellWrapper.appendChild(selected);
 
-         reset.appendChild(document.createTextNode('\u00a0'));
 
-         reset.className = 'cheditor-pulldown-color-reset';
 
-         reset.onclick = onResetEventHandler;
 
-         cellWrapper.appendChild(reset);
 
-         pickerSwitch.appendChild(document.createTextNode('\u00a0'));
 
-         pickerSwitch.className = 'cheditor-pulldown-color-show-picker';
 
-         pickerSwitch.setAttribute('title', showTooltip);
 
-         pickerSwitch.onclick = onPickerEventHandler;
 
-         cellWrapper.appendChild(pickerSwitch);
 
-         button.className = 'cheditor-pulldown-color-submit';
 
-         button.src = this.config.iconPath + 'button/input_color.gif';
 
-         button.onclick = onSubmitEventHandler;
 
-         cellWrapper.appendChild(button);
 
-         container.appendChild(cellWrapper);
 
-         self.toolbar[menu].colorNode.selectedValue = selectedValue;
 
-         self.toolbar[menu].colorNode.colorPicker = colorPicker;
 
-         pulldown.appendChild(container);
 
-         return pulldown;
 
-     },
 
-     onKeyPressToolbarUpdate: function () {
 
-         var self = this;
 
-         if (this.tempTimer) {
 
-             clearTimeout(this.tempTimer);
 
-         }
 
-         this.tempTimer = setTimeout(function () {
 
-             if (self.config.showTagPath) {
 
-                 self.doEditorEvent();
 
-             } else {
 
-                 self.toolbarUpdate();
 
-             }
 
-             self.tempTimer = null;
 
-         }, 50);
 
-     },
 
-     doOnKeyDown: function (evt) {
 
-         switch (evt.keyCode) {
 
-             case 37: case 38: case 39: case 40: case 46: case 8:
 
-                 this.onKeyPressToolbarUpdate(evt);
 
-         }
 
-     },
 
-     doOnKeyUp: function (evt) {
 
-         var caretRange, css, enterNode, i, keyCode = evt.keyCode, node, self = this, storedNode, storedRange,
 
-             clearBackgroundColor = function (cNode) {
 
-                 if (cNode.nodeType !== GB.node.element || cNode.hasChildNodes() || !cNode.getAttribute('style')) {
 
-                     return cNode;
 
-                 }
 
-                 if (GB.textFormatTags[cNode.nodeName.toLowerCase()]) {
 
-                     css = self.checkCssValue(cNode, 'background-color');
 
-                     if (css) {
 
-                         css = self.clearCss(cNode, 'background-color');
 
-                         if (cNode.nodeName.toLowerCase() === 'span' && !css) {
 
-                             node = cNode.parentNode;
 
-                             node.removeChild(cNode);
 
-                             return node;
 
-                         }
 
-                     }
 
-                 }
 
-                 return cNode;
 
-             };
 
-         if (keyCode !== 13 || this.cheditor.mode !== 'rich') {
 
-             return;
 
-         }
 
-         if (typeof GB.browser.msie_c !== 'undefined') {
 
-             node = this.storedSelections[0];
 
-             if (!node) {
 
-                 return;
 
-             }
 
-             if (node.className === this.cheditor.bogusSpacerName) {
 
-                 node.className = '';
 
-             }
 
-             while (node.firstChild) {
 
-                 node = node.firstChild;
 
-             }
 
-             if (node.nodeType === GB.node.element && node.canHaveChildren) {
 
-                 node.className = this.cheditor.bogusSpacerName;
 
-             }
 
-             return;
 
-         }
 
-         caretRange = this.getRange();
 
-         enterNode = caretRange.commonAncestorContainer;
 
-         if (GB.browser.msie || GB.browser.edge) {
 
-             this.backupRange(caretRange);
 
-             if (enterNode.nodeType === GB.node.element) {
 
-                 enterNode = clearBackgroundColor(enterNode);
 
-                 enterNode.className = this.cheditor.bogusSpacerName;
 
-             }
 
-             for (i = 0; i < this.keyPressStoredSelections.length; i++) {
 
-                 storedRange = this.keyPressStoredSelections[i];
 
-                 storedNode = storedRange.commonAncestorContainer;
 
-                 if (storedNode && storedNode.nodeType === GB.node.element) {
 
-                     node = storedNode.childNodes[storedRange.startOffset];
 
-                     if (!node) {
 
-                         break;
 
-                     }
 
-                     while (node.firstChild) {
 
-                         node = node.firstChild;
 
-                     }
 
-                     node = clearBackgroundColor(node);
 
-                     node.className = this.cheditor.bogusSpacerName;
 
-                 }
 
-             }
 
-             this.restoreRange();
 
-             this.keyPressStoredSelections = [];
 
-         } else {
 
-             this.applyBogusClassName(caretRange);
 
-         }
 
-     },
 
-     doOnKeyPress: function (evt) {
 
-         var keyCode = evt.keyCode, caretRange;
 
-         if (keyCode && keyCode === 13 && this.cheditor.mode === 'rich') {
 
-             caretRange = this.getRange();
 
-             if (typeof this.browser.msie_c !== 'undefined') {
 
-                 try {
 
-                     this.storedSelections[0] = caretRange.parentElement();
 
-                 } catch (e) {
 
-                     this.keyPressBackupRange();
 
-                 }
 
-             } else if (GB.browser.msie || GB.browser.edge) {
 
-                 this.keyPressBackupRange();
 
-             } else {
 
-                 this.applyBogusClassName(caretRange);
 
-             }
 
-         }
 
-     },
 
-     applyBogusClassName: function (range) {
 
-         var node = range.commonAncestorContainer;
 
-         if (range.startOffset < 1 && (!node.lastChild || node.lastChild.nodeName.toLowerCase() !== 'br')) {
 
-             do {
 
-                 if (node.parentNode.nodeName.toLowerCase() === 'body') {
 
-                     break;
 
-                 }
 
-                 node = node.parentNode;
 
-             } while (GB.textFormatTags[node.nodeName.toLowerCase()]);
 
-             node = node.previousSibling;
 
-             if (node) {
 
-                 while (node.firstChild) {
 
-                     node = node.firstChild;
 
-                 }
 
-                 if (node.nodeType === GB.node.element && node.nodeName.toLowerCase() === 'br') {
 
-                     node.className = this.cheditor.bogusSpacerName;
 
-                 }
 
-             }
 
-         } else {
 
-             if (!node || node.nodeType !== GB.node.element) {
 
-                 return;
 
-             }
 
-             if (node.lastChild
 
-                 && node.lastChild.nodeName.toLowerCase() === 'br'
 
-                 && node.lastChild.className !== this.cheditor.bogusSpacerName) {
 
-                 node.lastChild.className = this.cheditor.bogusSpacerName;
 
-             }
 
-         }
 
-     },
 
-     setWinPosition: function (oWin, popupAttr, windowSize) {
 
-         oWin.style.width = popupAttr.width + 'px';
 
-         oWin.style.left = Math.round(((this.cheditor.editArea.clientWidth - popupAttr.width) / 2) +
 
-                 windowSize.offsetLeft) + 'px';
 
-         oWin.style.top = Math.round(windowSize.offsetTop) + 'px';
 
-     },
 
-     getWindowSize: function (doc) {
 
-         var mydoc = doc || document,
 
-             docMode = mydoc.compatMode === 'CSS1Compat',
 
-             docBody = mydoc.body,
 
-             docElem = mydoc.documentElement,
 
-             factor, rect, physicalWidth, logicalWidth,
 
-             editAreaRect,
 
-             rData = {
 
-                 width: docMode ? docElem.clientWidth : docBody.clientWidth,
 
-                 height: docMode ? docElem.clientHeight : docBody.clientHeight,
 
-                 scrollHeight: docMode ? docElem.scrollHeight : docBody.scrollHeight,
 
-                 scrollWidth: docMode ? docElem.scrollWidth : docBody.scrollWidth
 
-             };
 
-         if (this.undefined(window.pageXOffset)) {
 
-             factor = 1;
 
-             if (docBody.getBoundingClientRect) {
 
-                 rect = docBody.getBoundingClientRect();
 
-                 physicalWidth = rect.right - rect.left;
 
-                 logicalWidth = mydoc.body.offsetWidth;
 
-                 factor = Math.round((physicalWidth / logicalWidth) * 100) / 100;
 
-             }
 
-             rData.scrollY = Math.round(docElem.scrollTop / factor);
 
-             rData.scrollX = Math.round(docElem.scrollLeft / factor);
 
-         } else {
 
-             rData.scrollY = window.pageYOffset;
 
-             rData.scrollX = window.pageXOffset;
 
-         }
 
-         editAreaRect = this.cheditor.editArea.getBoundingClientRect();
 
-         rData.clientTop = docElem.clientTop || docBody.clientTop || 0;
 
-         rData.clientLeft = docElem.clientLeft || docBody.clientLeft || 0;
 
-         rData.offsetTop = rData.scrollY + (rData.height / 2);
 
-         rData.offsetLeft = editAreaRect.left + rData.scrollX - rData.clientLeft;
 
-         return rData;
 
-     },
 
-     popupWinLoad: function (popupAttr) {
 
-         var self = this,
 
-             windowSize = self.getWindowSize(),
 
-             iframe = document.createElement('iframe'),
 
-             body = document.getElementsByTagName('body')[0],
 
-             done = false,
 
-             popWinResizeHeight = function (evt) {
 
-                 iframe.contentWindow.focus();
 
-                 iframe.contentWindow.init.call(self, iframe, popupAttr.argv || null);
 
-                 if (self.cheditor.popupElem.style.visibility !== 'visible') {
 
-                     self.cheditor.popupElem.style.top = Math.ceil(parseInt(self.cheditor.popupElem.style.top, 10) -
 
-                             Math.ceil(self.cheditor.popupElem.clientHeight / 2)) + 'px';
 
-                     self.cheditor.popupElem.style.visibility = 'visible';
 
-                 }
 
-                 self.stopEvent(evt);
 
-             },
 
-             modalResize = function () {
 
-                 self.cheditor.modalBackground.style.height = (windowSize.scrollHeight > windowSize.height) ?
 
-                     windowSize.scrollHeight : windowSize.height + 'px';
 
-                 if (window.scrollWidth > window.width) {
 
-                     self.cheditor.modalBackground.style.width = windowSize.width +
 
-                         (windowSize.scrollWidth - windowSize.width) + 'px';
 
-                 } else {
 
-                     self.cheditor.modalBackground.style.width = windowSize.width + 'px';
 
-                 }
 
-                 self.cheditor.modalBackground.style.left = windowSize.scrollX + 'px';
 
-             },
 
-             onReadyStateChangeEventHandler = function (evt) {
 
-                 if (!done && (!this.readyState || this.readyState === 'complete' || this.readyState === 'loaded')) {
 
-                     popWinResizeHeight(evt);
 
-                     done = true;
 
-                 }
 
-             };
 
-         if (self.cheditor.popupTitle.hasChildNodes()) {
 
-             self.cheditor.popupTitle.removeChild(self.cheditor.popupTitle.firstChild);
 
-         }
 
-         if (self.cheditor.popupFrameWrapper.hasChildNodes()) {
 
-             self.cheditor.popupFrameWrapper.removeChild(self.cheditor.popupFrameWrapper.firstChild);
 
-         }
 
-         self.cheditor.popupTitle.appendChild(document.createTextNode(popupAttr.title));
 
-         self.cheditor.popupElem.style.zIndex = self.modalElementZIndex + 100;
 
-         self.setWinPosition(self.cheditor.popupElem, popupAttr, windowSize);
 
-         iframe.setAttribute('frameBorder', '0');
 
-         iframe.setAttribute('height', '0');
 
-         iframe.setAttribute('width', String(popupAttr.width - 22));
 
-         iframe.setAttribute('name', popupAttr.tmpl);
 
-         iframe.setAttribute('src', self.config.popupPath + popupAttr.tmpl);
 
-         iframe.id = popupAttr.tmpl;
 
-         self.cheditor.modalBackground.style.zIndex = self.modalElementZIndex;
 
-         body.insertBefore(self.cheditor.modalBackground, body.firstChild);
 
-         body.insertBefore(self.cheditor.popupElem, body.firstChild);
 
-         self.cheditor.popupFrameWrapper.appendChild(iframe);
 
-         self.cheditor.popupElem.style.visibility = 'hidden';
 
-         self.cheditor.popupElem.style.display = 'block';
 
-         self.cheditor.modalBackground.style.display = 'block';
 
-         GB.dragWindow.init(self.cheditor.dragHandle, self.cheditor.popupElem);
 
-         (function () {
 
-             if (GB.browser.msie && !(self.undefined(iframe.onreadystatechange))) {
 
-                 iframe.onreadystatechange = onReadyStateChangeEventHandler;
 
-             } else {
 
-                 iframe.onload = popWinResizeHeight;
 
-             }
 
-             if (GB.browser.msie && GB.browser.version < 9) {
 
-                 window.onresize = function () {
 
-                     windowSize = self.getWindowSize();
 
-                     modalResize();
 
-                 };
 
-                 modalResize();
 
-                 self.cheditor.modalBackground.style.filter = 'alpha(opacity=50)';
 
-                 self.cheditor.modalBackground.style.opacity = 0.5;
 
-             } else {
 
-                 self.cheditor.modalBackground.style.opacity = 0.5;
 
-             }
 
-             self.cheditor.modalBackground.focus();
 
-         })();
 
-     },
 
-     popupWinCancel: function () {
 
-         this.restoreRange();
 
-         this.popupWinClose();
 
-     },
 
-     popupWinClose: function () {
 
-         if (!this.cheditor.popupElem) {
 
-             return;
 
-         }
 
-         this.cheditor.popupElem.style.display = 'none';
 
-         this.cheditor.popupElem.style.zIndex = -1;
 
-         this.cheditor.popupFrameWrapper.src = '';
 
-         if (this.cheditor.popupFrameWrapper.hasChildNodes()) {
 
-             this.cheditor.popupFrameWrapper.removeChild(this.cheditor.popupFrameWrapper.firstChild);
 
-         }
 
-         this.cheditor.modalBackground.style.display = 'none';
 
-         this.cheditor.modalBackground.style.zIndex = -1;
 
-         if (this.modalReSize !== null) {
 
-             if (GB.browser.opera) {
 
-                 window.removeEventListener('resize', this.modaReSize, false);
 
-             }
 
-             this.modalReSize = null;
 
-         }
 
-         this.editAreaFocus();
 
-     },
 
-     clearStoredSelections: function () {
 
-         this.storedSelections.splice(0, this.storedSelections.length);
 
-     },
 
-     restoreRange: function () {
 
-         var range = null, selection = null;
 
-         if (this.storedSelections[0]) {
 
-             if (this.W3CRange) {
 
-                 selection = this.getSelection();
 
-                 if (selection.rangeCount > 0) {
 
-                     selection.removeAllRanges();
 
-                 }
 
-                 selection.addRange(this.storedSelections[0]);
 
-                 range = selection.getRangeAt(0);
 
-             } else {
 
-                 range = this.createRange();
 
-                 if (this.storedSelections[0]) {
 
-                     if (typeof this.storedSelections[0] === 'string') {
 
-                         range.moveToBookmark(this.storedSelections[0]);
 
-                     } else {
 
-                         range = this.storedSelections[0];
 
-                     }
 
-                 }
 
-                 range.select();
 
-             }
 
-         }
 
-         return range;
 
-     },
 
-     keyPressBackupRange: function (range) {
 
-         var selection = null, i;
 
-         if (this.W3CRange) {
 
-             selection = this.getSelection();
 
-             if (selection) {
 
-                 for (i = 0; i < selection.rangeCount; i++) {
 
-                     this.keyPressStoredSelections.push(selection.getRangeAt(i));
 
-                 }
 
-             }
 
-         } else {
 
-             range = range || this.getRange();
 
-             switch (this.getSelectionType()) {
 
-                 case GB.selection.none:
 
-                 case GB.selection.text:
 
-                     this.storedSelections[0] = range.getBookmark();
 
-                     break;
 
-                 case GB.selection.element:
 
-                     this.storedSelections[0] = range;
 
-                     break;
 
-                 default:
 
-                     this.storedSelections[0] = null;
 
-             }
 
-         }
 
-     },
 
-     backupRange: function (range) {
 
-         var selection = null;
 
-         if (this.W3CRange) {
 
-             selection = this.getSelection();
 
-             if (selection && selection.rangeCount > 0) {
 
-                 this.storedSelections[0] = selection.getRangeAt(0);
 
-             }
 
-         } else {
 
-             range = range || this.getRange();
 
-             switch (this.getSelectionType()) {
 
-                 case GB.selection.none:
 
-                 case GB.selection.text:
 
-                     this.storedSelections[0] = range.getBookmark();
 
-                     break;
 
-                 case GB.selection.element:
 
-                     this.storedSelections[0] = range;
 
-                     break;
 
-                 default:
 
-                     this.storedSelections[0] = null;
 
-             }
 
-         }
 
-     },
 
-     getSelection: function () {
 
-         return this.W3CRange ? this.editArea.getSelection() : this.doc.selection;
 
-     },
 
-     clearSelection: function () {
 
-         var sel = this.getSelection();
 
-         if (!sel) {
 
-             return;
 
-         }
 
-         if (this.W3CRange) {
 
-             sel.removeAllRanges();
 
-         } else {
 
-             sel.empty();
 
-         }
 
-         return sel;
 
-     },
 
-     getRange: function () {
 
-         var selection = this.getSelection(), range = null;
 
-         if (this.W3CRange) {
 
-             if (selection.getRangeAt) {
 
-                 range = selection.rangeCount ? selection.getRangeAt(0) : this.doc.createRange();
 
-             } else {
 
-                 range = this.doc.createRange();
 
-                 range.setStart(selection.anchorNode, selection.anchorOffset);
 
-                 range.setEnd(selection.focusNode, selection.focusOffset);
 
-                 if (range.collapsed !== selection.isCollapsed) {
 
-                     range.setStart(selection.focusNode, selection.focusOffset);
 
-                     range.setEnd(selection.anchorNode, selection.anchorOffset);
 
-                 }
 
-             }
 
-         } else {
 
-             range = selection.createRange ? selection.createRange() : this.doc.createRange();
 
-             if (!range) {
 
-                 range = this.doc.body.createTextRange();
 
-             }
 
-         }
 
-         this.range = range;
 
-         return range;
 
-     },
 
-     createRange: function () {
 
-         return this.W3CRange ? this.doc.createRange() : this.doc.body.createTextRange();
 
-     },
 
-     rangeCollapsed: function (range) {
 
-         return this.W3CRange ?
 
-             range.collapsed :
 
-                 (!this.undefined(range.text) && range.text.length === 0 && range.boundingWidth === 0);
 
-     },
 
-     getRangeElement: function (range) {
 
-         return this.W3CRange ? this.getW3CRangeElement(range) : this.getIeRangeElement(range);
 
-     },
 
-     getIeRangeElement: function (range) {
 
-         var sType = this.getSelectionType(),
 
-             node;
 
-         if (!range) {
 
-             range = this.createRange();
 
-         }
 
-         switch (sType) {
 
-             case GB.selection.text:
 
-                 node = range.parentElement();
 
-                 break;
 
-             case GB.selection.element:
 
-                 node = range.item(0);
 
-                 break;
 
-             case GB.selection.none:
 
-                 if (!this.undefined(range.parentElement)) {
 
-                     node = range.parentElement();
 
-                 } else {
 
-                     node = range.item(0);
 
-                 }
 
-         }
 
-         return node;
 
-     },
 
-     getW3CRangeElement: function (range) {
 
-         var ancestorContainer = range.commonAncestorContainer,
 
-             startContainer = range.startContainer,
 
-             startOffset = range.startOffset,
 
-             endContainer = range.endContainer,
 
-             endOffset = range.endOffset,
 
-             docFragment = null, node = startContainer;
 
-         if (GB.browser.msie || GB.browser.edge) {
 
-             if (!range.collapsed && ancestorContainer.nodeType === GB.node.element) {
 
-                 if (ancestorContainer === endContainer) {
 
-                     node = ancestorContainer.childNodes[endOffset - 1];
 
-                 } else if (ancestorContainer === startContainer) {
 
-                     node = ancestorContainer.childNodes[startOffset];
 
-                 } else {
 
-                     docFragment = range.cloneContents();
 
-                     node = (docFragment.childNodes.length === 1) ? startContainer.nextSibling : ancestorContainer;
 
-                 }
 
-             }
 
-         } else {
 
-             if (!range.collapsed
 
-                 && startContainer.nodeType === GB.node.element
 
-                 && startContainer === endContainer
 
-                 && endOffset - startOffset === 1
 
-                 && startContainer.hasChildNodes()) {
 
-                 node = startContainer.childNodes[startOffset];
 
-             }
 
-         }
 
-         if (node.nodeType === GB.node.text) {
 
-             node = node.parentNode;
 
-         }
 
-         return node;
 
-     },
 
-     getSelectionType: function () {
 
-         var selection = this.getSelection(), type;
 
-         if (this.W3CRange) {
 
-             if (!selection) {
 
-                 type = GB.selection.none;
 
-             } else if (selection.rangeCount && !selection.isCollapsed && !selection.toString()) {
 
-                 type = GB.selection.element;
 
-             } else {
 
-                 type = GB.selection.text;
 
-             }
 
-         } else {
 
-             switch (selection.type) {
 
-                 case 'Text': type = GB.selection.text; break;
 
-                 case 'Control': type = GB.selection.element; break;
 
-                 default: type = GB.selection.none;
 
-             }
 
-             if (selection.createRange().parentElement) {
 
-                 type = GB.selection.text;
 
-             }
 
-         }
 
-         return type;
 
-     },
 
-     windowOpen: function (popupName) {
 
-         this.editAreaFocus();
 
-         this.boxHideAll();
 
-         this.backupRange();
 
-         if (!(this.undefined(GB.popupWindow[popupName]))) {
 
-             var popup = GB.popupWindow[popupName];
 
-             if (popupName === 'ImageUpload' && window.File && window.FileReader && window.FileList && window.Blob) {
 
-                 popup.tmpl = 'image.html5.html';
 
-             }
 
-             this.popupWinLoad(popup);
 
-         } else {
 
-             alert('사용할 수 없는 명령입니다.');
 
-         }
 
-     },
 
-     doCmd: function (cmd, opt) {
 
-         var self = this, range = this.range,
 
-             i, keyboard = '', command = '', pNode, node, tmpframe, tmpdoc, html, content,
 
-             hr, newHr, para, next = null, nNode, tagName, style, id, hRule, nodeType, css, found = false,
 
-             isEmpty = false, selectionType, selection, nodeRange,
 
-             cleanPaste = function () {
 
-                 self.editAreaFocus();
 
-                 var tmpDoc = self.cheditor.tmpdoc;
 
-                 tmpDoc.execCommand('SelectAll');
 
-                 tmpDoc.execCommand('Paste');
 
-                 return self.cleanFromWord(tmpDoc);
 
-             },
 
-             isTextVisible = function (elem) {
 
-                 return (!(elem.firstChild.nodeType === GB.node.text && elem.firstChild === elem.lastChild &&
 
-                     elem.firstChild.nodeValue === ''));
 
-             };
 
-         this.editAreaFocus();
 
-         this.boxHideAll();
 
-         if (!range) {
 
-             return;
 
-         }
 
-         if (cmd === 'NewDocument' && opt == null) {
 
-             if (confirm('글 내용이 모두 사라집니다. 계속하시겠습니까?')) {
 
-                 this.doc.body.innerHTML = '';
 
-             }
 
-             this.images = [];
 
-             this.editImages = {};
 
-             this.editAreaFocus();
 
-             this.toolbarUpdate();
 
-             this.initDefaultParagraphSeparator();
 
-             return;
 
-         }
 
-         if (cmd === 'ClearTag' && opt == null) {
 
-             if (confirm('모든 HTML 태그를 삭제합니다. 계속하시겠습니까?\n(P, DIV, BR 태그와 텍스트는 삭제하지 않습니다.)')) {
 
-                 content = this.doc.body.innerHTML;
 
-                 this.doc.body.innerHTML = content.replace(/<(\/?)([^>]*)>/g,
 
-                         function (a, b, c) {
 
-                             var el = c.toLowerCase().split(/ /)[0];
 
-                             if (el !== 'p' && el !== 'div' && el !== 'br') {
 
-                                 return '';
 
-                             }
 
-                             return '<' + b + el + '>';
 
-                         });
 
-             }
 
-             this.editAreaFocus();
 
-             this.toolbarUpdate();
 
-             return;
 
-         }
 
-         if (cmd === 'NewDocument' && opt == '1') {
 
-             this.doc.body.innerHTML = '';
 
-             this.images = [];
 
-             this.editImages = {};
 
-             this.editAreaFocus();
 
-             this.toolbarUpdate();
 
-             this.initDefaultParagraphSeparator();
 
-             return;
 
-         }
 
-         if (cmd === 'Print') {
 
-             this.editArea.print();
 
-             return;
 
-         }
 
-         if (cmd === 'PageBreak') {
 
-             this.printPageBreak();
 
-             this.editAreaFocus();
 
-             return;
 
-         }
 
-         selectionType = this.getSelectionType();
 
-         if (this.W3CRange || selectionType === GB.selection.none) {
 
-             range = this.doc;
 
-         }
 
-         if (!GB.browser.msie && (cmd === 'Cut' || cmd === 'Copy' || cmd === 'Paste')) {
 
-             if ((range.execCommand(cmd, false, opt)) !== true) {
 
-                 switch (cmd) {
 
-                     case 'Cut': keyboard = 'x'; command = '자르기'; break;
 
-                     case 'Copy': keyboard = 'c'; command = '복사'; break;
 
-                     case 'Paste': keyboard = 'v'; command = '붙이기'; break;
 
-                 }
 
-                 alert('사용하고 계신 브라우저는 보안 상의 이유로 \'' + command + '\' 명령을 사용하실 수 없습니다. \n\n' +
 
-                 '키보드 단축키를 이용하여 주십시오.\n단축키: Windows: Ctrl+' + keyboard + ', Mac OS X: Command+' + keyboard);
 
-                 this.editAreaFocus();
 
-             }
 
-             return;
 
-         }
 
-         try {
 
-             if (cmd === 'PasteFromWord') {
 
-                 if (this.undefined(this.cheditor.tmpdoc)) {
 
-                     tmpframe = this.doc.createElement('iframe');
 
-                     tmpframe.setAttribute('contentEditable', 'true');
 
-                     tmpframe.style.visibility = 'hidden';
 
-                     tmpframe.style.height = tmpframe.style.width = '0px';
 
-                     tmpframe.setAttribute('frameBorder', '0');
 
-                     this.cheditor.editWrapper.appendChild(tmpframe);
 
-                     tmpdoc = tmpframe.contentWindow.document;
 
-                     tmpdoc.designMode = 'On';
 
-                     tmpdoc.open();
 
-                     tmpdoc.close();
 
-                     this.cheditor.tmpdoc = tmpdoc;
 
-                 }
 
-                 if (this.W3CRange) {
 
-                     html = cleanPaste();
 
-                     // range = this.restoreRange();
 
-                     this.insertNodeAtSelection(html);
 
-                 } else {
 
-                     range = this.getRange();
 
-                     range.pasteHTML(cleanPaste());
 
-                     range.select();
 
-                 }
 
-             } else if (cmd === 'Paste') {
 
-                 this.cheditor.paste = 'text';
 
-                 this.handlePaste(null);
 
-                 this.cheditor.paste = 'html';
 
-             } else if (cmd === 'InsertHorizontalRule') {
 
-                 hr = this.doc.createElement('hr');
 
-                 hr.style.height = '1px';
 
-                 hr.style.backgroundColor = '#999';
 
-                 hr.style.border = 'none';
 
-                 this.unselectionElement(hr);
 
-                 range = this.getRange();
 
-                 if (this.W3CRange) {
 
-                     range.insertNode(hr);
 
-                 } else {
 
-                     nodeType = this.getSelectionType();
 
-                     id = this.makeRandomString();
 
-                     range.execCommand('InsertHorizontalRule', false, id);
 
-                     switch (nodeType) {
 
-                         case GB.selection.none:
 
-                         case GB.selection.text:
 
-                             node = range.parentElement();
 
-                             break;
 
-                         case GB.selection.element:
 
-                             node = range.item(0);
 
-                             break;
 
-                         default:
 
-                             return;
 
-                     }
 
-                     newHr = this.$(id);
 
-                     newHr.parentNode.replaceChild(hr, newHr);
 
-                 }
 
-                 hRule = hr;
 
-                 pNode = hRule.parentNode;
 
-                 para = this.makeSpacerElement();
 
-                 while (pNode && GB.textFormatTags[pNode.nodeName.toLowerCase()]) {
 
-                     pNode = pNode.parentNode;
 
-                 }
 
-                 tagName = pNode.tagName.toLowerCase();
 
-                 if (GB.textFormatBlockTags[tagName]) {
 
-                     if (hr.nextSibling) {
 
-                         next = this.doc.createElement(tagName);
 
-                         pNode.parentNode.insertBefore(next, pNode.nextSibling);
 
-                         while (hr.nextSibling) {
 
-                             if (hr.nextSibling.nodeType === GB.node.text && hr.nextSibling.nodeValue === '') {
 
-                                 hr = hr.nextSibling;
 
-                                 continue;
 
-                             }
 
-                             if (hr.nextSibling.parentNode !== pNode) {
 
-                                 node = hr.nextSibling.parentNode;
 
-                                 while (node !== pNode && GB.textFormatTags[node.nodeName.toLowerCase()]) {
 
-                                     nNode = this.doc.createElement(node.nodeName);
 
-                                     style = this.getCssValue(node);
 
-                                     if (style) {
 
-                                         for (i = 0; i < style.length; i++) {
 
-                                             nNode.style[style[i].name] = style[i].value;
 
-                                         }
 
-                                     }
 
-                                     if (next.hasChildNodes() === false) {
 
-                                         next.appendChild(nNode);
 
-                                         while (hr.nextSibling) {
 
-                                             nNode.appendChild(hr.nextSibling);
 
-                                         }
 
-                                     } else {
 
-                                         next.appendChild(nNode);
 
-                                         nNode.appendChild(next.firstChild);
 
-                                     }
 
-                                     node = node.parentNode;
 
-                                 }
 
-                             } else {
 
-                                 next.appendChild(hr.nextSibling);
 
-                             }
 
-                         }
 
-                     }
 
-                     node = hr.parentNode;
 
-                     pNode.parentNode.insertBefore(hRule, pNode.nextSibling);
 
-                     while (node && node !== pNode) {
 
-                         if (node.hasChildNodes() === false || (isTextVisible(node)) === false) {
 
-                             nNode = node.parentNode;
 
-                             node.parentNode.removeChild(node);
 
-                             node = nNode;
 
-                             continue;
 
-                         }
 
-                         node = node.parentNode;
 
-                     }
 
-                     if (pNode.hasChildNodes() === false || (isTextVisible(pNode)) === false) {
 
-                         pNode.parentNode.replaceChild(para.cloneNode(true), pNode);
 
-                     }
 
-                     if (next === null || next.hasChildNodes() === false) {
 
-                         hRule.parentNode.insertBefore(para.cloneNode(true), hRule.nextSibling);
 
-                     }
 
-                     node = hRule.nextSibling;
 
-                     while (node.firstChild) {
 
-                         node = node.firstChild;
 
-                     }
 
-                     if (node && node.nodeType !== GB.node.text) {
 
-                         node = node.parentNode;
 
-                     }
 
-                     this.placeCaretAt(this.W3CRange ? node : hRule.nextSibling, true);
 
-                 } else {
 
-                     if (!hRule.previousSibling) {
 
-                         hRule.parentNode.insertBefore(para.cloneNode(true), hRule);
 
-                     }
 
-                     if (!hRule.nextSibling) {
 
-                         hRule.parentNode.insertBefore(para.cloneNode(true), hRule.nextSibling);
 
-                     }
 
-                     this.placeCaretAt(hRule.nextSibling, hRule.nextSibling.nodeType === GB.node.text);
 
-                 }
 
-             } else {
 
-                 switch (cmd) {
 
-                     case 'JustifyLeft':
 
-                     case 'JustifyCenter':
 
-                     case 'JustifyRight':
 
-                     case 'JustifyFull':
 
-                         pNode = this.getRangeElement(this.range);
 
-                         node = null;
 
-                         if (GB.offElementTags[pNode.nodeName.toLowerCase()]) {
 
-                             nodeRange = this.createRange();
 
-                             selection = this.clearSelection();
 
-                             if (this.W3CRange) {
 
-                                 nodeRange.selectNode(pNode);
 
-                                 selection.addRange(nodeRange);
 
-                             } else {
 
-                                 nodeRange.moveToElementText(pNode);
 
-                                 nodeRange.select();
 
-                                 range = nodeRange;
 
-                             }
 
-                         }
 
-                         // Caption
 
-                         if (pNode.nodeName.toLowerCase() === 'img') {
 
-                             if (pNode.parentNode.nodeName.toLowerCase() === 'figure') {
 
-                                 node = pNode.parentNode;
 
-                                 if (node.parentNode.nodeName.toLowerCase() === 'div') {
 
-                                     node = node.parentNode;
 
-                                     node.style.textAlign = GB.textAlign[cmd];
 
-                                     break;
 
-                                 }
 
-                             }
 
-                         } else if (pNode.nodeName.toLowerCase() === 'figure') {
 
-                             node = pNode.parentNode;
 
-                             if (node.nodeName.toLowerCase() === 'div') {
 
-                                 node.style.textAlign = GB.textAlign[cmd];
 
-                                 break;
 
-                             }
 
-                         }
 
-                         do {
 
-                             if (pNode.nodeName.toLowerCase() === 'li') {
 
-                                 node = pNode;
 
-                                 break;
 
-                             }
 
-                             pNode = pNode.parentNode;
 
-                         } while (pNode && pNode.nodeName.toLowerCase() !== 'body');
 
-                         if (node) {
 
-                             node.style.textAlign = GB.textAlign[cmd];
 
-                             break;
 
-                         }
 
-                         range.execCommand(cmd, false, opt);
 
-                         pNode = this.getRangeElement(this.W3CRange ? this.getRange() : range);
 
-                         while (pNode && pNode.nodeName.toLowerCase() !== 'body') {
 
-                             if (typeof pNode.getAttribute !== 'undefined' && pNode.getAttribute('align')) {
 
-                                 node = pNode;
 
-                                 break;
 
-                             } else {
 
-                                 css = this.getCssValue(pNode);
 
-                                 if (css) {
 
-                                     for (i = 0; i < css.length; i++) {
 
-                                         if (css[i].name === 'text-align') {
 
-                                             node = pNode;
 
-                                             break;
 
-                                         }
 
-                                     }
 
-                                 }
 
-                             }
 
-                             pNode = pNode.parentNode;
 
-                         }
 
-                         if (node) {
 
-                             pNode.style.textAlign = GB.textAlign[cmd];
 
-                             pNode.removeAttribute('align');
 
-                             break;
 
-                         }
 
-                         break;
 
-                     case 'InsertOrderedList':
 
-                     case 'InsertUnOrderedList':
 
-                         range.execCommand(cmd, false, opt);
 
-                         if (this.W3CRange) {
 
-                             range = this.getRange();
 
-                             node = range.commonAncestorContainer;
 
-                             if (node.nodeType === GB.node.element && node.lastChild &&
 
-                                     node.lastChild.nodeName.toLowerCase() === 'br') {
 
-                                 node.lastChild.className = this.cheditor.bogusSpacerName;
 
-                                 isEmpty = true;
 
-                             }
 
-                             found = false;
 
-                             while (node) {
 
-                                 if (node.nodeName.toLowerCase() === 'ul' || node.nodeName.toLowerCase() === 'ol') {
 
-                                     found = true;
 
-                                     break;
 
-                                 }
 
-                                 node = node.parentNode;
 
-                             }
 
-                             if (found) {
 
-                                 node.style.listStyleType = '';
 
-                                 if (!GB.browser.msie) {
 
-                                     if (node.parentNode.nodeName.toLowerCase() === 'p' ||
 
-                                             node.parentNode.nodeName.toLowerCase() === 'div') {
 
-                                         pNode = node.parentNode;
 
-                                         if (pNode.lastChild && pNode.lastChild.nodeName.toLowerCase() === 'br') {
 
-                                             pNode.removeChild(pNode.lastChild);
 
-                                         }
 
-                                         if (pNode.firstChild === node && pNode.lastChild === node) {
 
-                                             pNode.parentNode.insertBefore(node, pNode);
 
-                                             pNode.parentNode.removeChild(pNode);
 
-                                             this.placeCaretAt(node.lastChild, isEmpty);
 
-                                         }
 
-                                     }
 
-                                 }
 
-                             }
 
-                         }
 
-                         break;
 
-                     default:
 
-                         if (range.queryCommandSupported(cmd)) {
 
-                             range.execCommand(cmd, false, opt);
 
-                         }
 
-                 }
 
-             }
 
-         } catch (e) {
 
-             alert(cmd + ': 지원되지 않는 명령입니다. ' + e.toString());
 
-         }
 
-         this.toolbarUpdate();
 
-     },
 
-     cleanFromWord: function (tmpDoc) {
 
-         var doc = tmpDoc.body.innerHTML;
 
-         doc = doc.replace(/MsoNormal/g, ''); doc = doc.replace(/<\\?\?xml[^>]*>/g, ''); doc = doc.replace(/<\/?o:p[^>]*>/g, '');
 
-         doc = doc.replace(/<\/?v:[^>]*>/g, ''); doc = doc.replace(/<\/?o:[^>]*>/g, ''); doc = doc.replace(/<\/?st1:[^>]*>/g, '');
 
-         doc = doc.replace(/<!--(.*)-->/g, ''); doc = doc.replace(/<!--(.*)>/g, ''); doc = doc.replace(/<!(.*)-->/g, '');
 
-         doc = doc.replace(/<\\?\?xml[^>]*>/g, ''); doc = doc.replace(/<\/?o:p[^>]*>/g, ''); doc = doc.replace(/<\/?v:[^>]*>/g, '');
 
-         doc = doc.replace(/<\/?o:[^>]*>/g, ''); doc = doc.replace(/<\/?st1:[^>]*>/g, '');   //doc = doc.replace(/lang=.?[^' >]*/ig, '');
 
-         doc = doc.replace(/type=.?[^' >]*/g, ''); doc = doc.replace(/href='#[^']*'/g, ''); doc = doc.replace(/href='#[^']*'/g, '');
 
-         doc = doc.replace(/name=.?[^' >]*/g, ''); doc = doc.replace(/ clear='all'/g, ''); doc = doc.replace(/id='[^']*'/g, '');
 
-         doc = doc.replace(/title='[^']*'/g, ''); doc = doc.replace(/\n/g, ''); doc = doc.replace(/\r/g, '');
 
-         doc = doc.replace(/mso\-[^'>;]*/g, ''); doc = doc.replace(/<p[^>]*/ig, '<p'); doc = doc.replace(/windowtext/ig, '#000000');
 
-         doc = doc.replace(/class=table/ig, ''); doc = doc.replace(/<span[^>]*<\/span>/ig, '');
 
-         return doc;
 
-     },
 
-     printPageBreak: function () {
 
-         var hr = document.createElement('hr'),
 
-             div = this.doc.createElement('div');
 
-         hr.style.pageBreakAfter = 'always';
 
-         hr.style.border = '1px #999 dotted';
 
-         this.insertHTML(hr);
 
-         div.appendChild(this.doc.createTextNode('\u00a0'));
 
-         this.insertHTML(div);
 
-     },
 
-     doCmdPaste: function (html) {
 
-         var range = null;
 
-         this.editAreaFocus();
 
-         if (!this.W3CRange) {
 
-             if (this.range.item) {
 
-                 range = this.doc.body.createTextRange();
 
-                 if (range) {
 
-                     range.moveToElementText(this.range.item(0));
 
-                     range.select();
 
-                     this.range.item(0).outerHTML = html;
 
-                 }
 
-                 this.toolbarUpdate();
 
-             } else {
 
-                 this.range.pasteHTML(html);
 
-                 this.range.select();
 
-             }
 
-         } else {
 
-             this.insertNodeAtSelection(html);
 
-         }
 
-     },
 
-     getPreviousLeaf: function (node) {
 
-         var leaf;
 
-         while (!node.previousSibling) {
 
-             node = node.parentNode;
 
-             if (!node) {
 
-                 return node;
 
-             }
 
-         }
 
-         leaf = node.previousSibling;
 
-         while (leaf.lastChild) {
 
-             leaf = leaf.lastChild;
 
-         }
 
-         return leaf;
 
-     },
 
-     getNextLeaf: function (node, breakNode) {
 
-         var leaf;
 
-         while (!node.nextSibling) {
 
-             node = node.parentNode;
 
-             if ((breakNode && breakNode === node) || !node) {
 
-                 return node;
 
-             }
 
-         }
 
-         leaf = node.nextSibling;
 
-         if (breakNode && leaf === breakNode) {
 
-             return node;
 
-         }
 
-         while (leaf.firstChild) {
 
-             leaf = leaf.firstChild;
 
-         }
 
-         return leaf;
 
-     },
 
-     isTextVisible: function (text) {
 
-         var i, found = false, len = text.length;
 
-         for (i = 0; i < len; i++) {
 
-             if (text.charAt(i) !== ' ' && text.charAt(i) !== '\t' && text.charAt(i) !== '\r' && text.charAt(i) !== '\n') {
 
-                 found = true;
 
-                 break;
 
-             }
 
-         }
 
-         return found;
 
-     },
 
-     checkCssValue: function (elem, prop) {
 
-         var css = this.getCssValue(elem), i;
 
-         if (!css) {
 
-             return null;
 
-         }
 
-         for (i = 0; i < css.length; i++) {
 
-             if (css[i].name === prop) {
 
-                 return css[i];
 
-             }
 
-         }
 
-         return null;
 
-     },
 
-     getCssValue: function (elem) {
 
-         var i, q, style = [], len, css;
 
-         css = elem.getAttribute('style');
 
-         if (!css) {
 
-             return null;
 
-         }
 
-         if (typeof css === 'object') {
 
-             css = css.cssText;
 
-         }
 
-         if (this.trimSpace(css) === '') {
 
-             return null;
 
-         }
 
-         css = css.replace(/;$/, '').split(';');
 
-         len = css.length;
 
-         for (i = 0; i < len; i++) {
 
-             q = css[i].split(':');
 
-             style.push({ 'name': this.trimSpace(q[0]).toLowerCase(), 'value': this.trimSpace(q[1]).toLowerCase() });
 
-         }
 
-         return style;
 
-     },
 
-     makeFontCss: function (cmd, opt, elem) {
 
-         switch (cmd) {
 
-             case 'font-size': elem.style.fontSize = opt; break;
 
-             case 'font-family': elem.style.fontFamily = opt; break;
 
-             case 'color': elem.style.color = opt; break;
 
-             case 'background-color': elem.style.backgroundColor = opt; break;
 
-         }
 
-     },
 
-     insertStartEndNode: function (range) {
 
-         var startNode = this.doc.createElement('span'),
 
-             startRange, endRange, endNode, collapsed, node = null;
 
-         startNode.id = 'startNode';
 
-         if (!this.W3CRange) {
 
-             startNode.appendChild(this.doc.createTextNode('\u200b'));
 
-             try {
 
-                 endRange = range.duplicate();
 
-                 startRange = range.duplicate();
 
-                 endRange.collapse(false);
 
-                 startRange.collapse(true);
 
-             } catch (e) {
 
-                 node = this.getRangeElement(range);
 
-                 if (node.nodeType === GB.node.element) {
 
-                 } else {
 
-                     return null;
 
-                 }
 
-             }
 
-             endNode = startNode.cloneNode(true);
 
-             endNode.id = 'endNode';
 
-             if (node) {
 
-                 node.parentNode.insertBefore(startNode, node);
 
-                 node.parentNode.insertBefore(endNode, node.nextSibling);
 
-                 collapsed = false;
 
-             } else {
 
-                 collapsed = startRange.isEqual(endRange);
 
-                 endRange.pasteHTML(endNode.outerHTML);
 
-                 endRange.moveStart('character', -1);
 
-                 endNode = endRange.parentElement();
 
-                 if (collapsed || range.text.length === 0) {
 
-                     endNode.parentNode.insertBefore(startNode, endNode);
 
-                 } else {
 
-                     startNode = endNode.cloneNode(true);
 
-                     startNode.id = 'startNode';
 
-                     startRange.pasteHTML(startNode.outerHTML);
 
-                     startRange.moveStart('character', -1);
 
-                     startNode = startRange.parentElement();
 
-                 }
 
-             }
 
-             endRange = null;
 
-             startRange = null;
 
-         } else {
 
-             endRange = range.cloneRange();
 
-             startRange = range.cloneRange();
 
-             startRange.collapse(true);
 
-             endRange.collapse(false);
 
-             endNode = startNode.cloneNode(false);
 
-             endNode.id = 'endNode';
 
-             collapsed = range.collapsed;
 
-             if (collapsed) {
 
-                 endRange.insertNode(endNode);
 
-                 endNode.parentNode.insertBefore(startNode, endNode);
 
-             } else {
 
-                 endRange.insertNode(endNode);
 
-                 startRange.insertNode(startNode);
 
-             }
 
-             if (startNode.previousSibling && startNode.previousSibling.nodeType === GB.node.text &&
 
-                 startNode.previousSibling.nodeValue === '') {
 
-                 startNode.previousSibling.parentNode.removeChild(startNode.previousSibling);
 
-             }
 
-             if (endNode.nextSibling && endNode.nextSibling.nodeType === GB.node.text &&
 
-                 endNode.nextSibling.nodeValue === '') {
 
-                 endNode.nextSibling.parentNode.removeChild(endNode.nextSibling);
 
-             }
 
-             startRange.detach(); endRange.detach();
 
-             endRange = null; startRange = null;
 
-         }
 
-         return { startNode: startNode, endNode: endNode, collapsed: collapsed };
 
-     },
 
-     removeStartEndNode: function (nodes) {
 
-         if (nodes.startNode) {
 
-             nodes.startNode.parentNode.removeChild(nodes.startNode);
 
-         }
 
-         if (nodes.endNode) {
 
-             nodes.endNode.parentNode.removeChild(nodes.endNode);
 
-         }
 
-     },
 
-     clearCss: function (node, name) {
 
-         var i, css, styles = [];
 
-         if (!node || node.nodeType !== GB.node.element) {
 
-             return null;
 
-         }
 
-         css = this.getCssValue(node);
 
-         if (!css) {
 
-             return null;
 
-         }
 
-         node.removeAttribute('style');
 
-         for (i = 0; i < css.length; i++) {
 
-             if (css[i].name !== name) {
 
-                 node.style[css[i].name] = css[i].value;
 
-                 styles.push(css[i]);
 
-             }
 
-         }
 
-         return styles.length ? styles : null;
 
-     },
 
-     doCmdPopup: function (cmd, opt, checked) {
 
-         var self = this,
 
-             range, cursor, selectionType, pNode, node, found, isEmpty, span, endNode, startNode, i, endNodeAncestorRange,
 
-             startNodeRange, endNodeRange, compare, tNode, len, selection, child, css, tempNodes, endNodeAncestor,
 
-             backupRange, removeNodes = [], spanNodes = [], applyTextNodes = [], tailNodes = [], headNodes = [], rootNode = null,
 
-             zeroWidth = this.doc.createTextNode('\u200b'), inRange,
 
-             makeSpanText = function (elem, ancestor) {
 
-                 if (self.undefined(ancestor)) {
 
-                     ancestor = elem.parentNode;
 
-                 }
 
-                 span = self.doc.createElement('span');
 
-                 self.makeFontCss(cmd, opt, span);
 
-                 ancestor.insertBefore(span, elem);
 
-                 span.appendChild(elem);
 
-                 spanNodes.push(span);
 
-                 return span;
 
-             },
 
-             searchTextNode = function (node, match) {
 
-                 var i = 0, len = node.childNodes.length;
 
-                 for (; i < len; i++) {
 
-                     child = node.childNodes[i];
 
-                     match = searchTextNode(child, match);
 
-                     if (child === startNode) {
 
-                         break;
 
-                     }
 
-                     if (child.nodeType === GB.node.text) {
 
-                         match = true;
 
-                         break;
 
-                     }
 
-                     if (child.nodeType === GB.node.element && child.hasChildNodes() === false &&
 
-                         GB.textFormatTags[child.nodeName.toLowerCase()]) {
 
-                         removeNodes.push(child);
 
-                     }
 
-                 }
 
-                 return match;
 
-             },
 
-             compareBoundaryPoints = function (range, type, source) {
 
-                 var values = {
 
-                     'StartToStart': 0,  //Range.START_TO_START,
 
-                     'StartToEnd': 1,    //Range.START_TO_END,
 
-                     'EndToEnd': 2,      //Range.END_TO_END,
 
-                     'EndToStart': 3     //Range.END_TO_START
 
-                 };
 
-                 if (self.W3CRange) {
 
-                     return range.compareBoundaryPoints(values[type], source);
 
-                 }
 
-                 type = type === 'StartToEnd' ? 'EndToStart' : (type === 'EndToStart' ? 'StartToEnd' : type);
 
-                 return range.compareEndPoints(type, source);
 
-             },
 
-             rangeSelectNode = function (range, node) {
 
-                 if (self.W3CRange) {
 
-                     range.selectNode(node);
 
-                 } else {
 
-                     if (node.nodeType === GB.node.text) {
 
-                         node = node.parentNode;
 
-                     }
 
-                     range.moveToElementText(node);
 
-                 }
 
-             },
 
-             clearPreviousLeaf = function (node) {
 
-                 var leaf, css = [];
 
-                 while (!node.previousSibling) {
 
-                     node = node.parentNode;
 
-                     if (!node || node.nodeName.toLowerCase() === 'body') {
 
-                         return null;
 
-                     }
 
-                 }
 
-                 leaf = node.previousSibling;
 
-                 while (leaf.lastChild && leaf.nodeType === GB.node.element && leaf !== startNode) {
 
-                     rangeSelectNode(cursor, leaf);
 
-                     compare = compareBoundaryPoints(cursor, 'StartToStart', startNodeRange);
 
-                     if (compare === 1) {
 
-                         css = self.clearCss(leaf, cmd);
 
-                         if (!css && (leaf.nodeName.toLowerCase() === 'span' || leaf.nodeName.toLowerCase() === 'font')) {
 
-                             while (leaf.firstChild) {
 
-                                 leaf.parentNode.insertBefore(leaf.firstChild, leaf);
 
-                             }
 
-                             removeNodes.push(leaf);
 
-                             break;
 
-                         }
 
-                     } else if (compare === 0) {
 
-                         self.clearCss(leaf, cmd);
 
-                         if (!rootNode && leaf.nodeName.toLowerCase() === 'span') {
 
-                             rootNode = leaf;
 
-                         }
 
-                     } else { // -1
 
-                         node = startNode;
 
-                         found = false;
 
-                         while (node) {
 
-                             if (node.nodeType === GB.node.text) {
 
-                                 found = true;
 
-                                 break;
 
-                             }
 
-                             node = checkPreviousLeaf(node, leaf);
 
-                         }
 
-                         if (!found) {
 
-                             self.clearCss(leaf, cmd);
 
-                             if (!rootNode && leaf.nodeName.toLowerCase() === 'span') {
 
-                                 rootNode = leaf;
 
-                             }
 
-                         }
 
-                     }
 
-                     leaf = leaf.lastChild;
 
-                 }
 
-                 if (leaf.nodeType === GB.node.text && self.isTextVisible(leaf.nodeValue)) {
 
-                     applyTextNodes.push(leaf);
 
-                 }
 
-                 return leaf;
 
-             },
 
-             checkPreviousLeaf = function (node, breakNode) {
 
-                 var leaf;
 
-                 while (!node.previousSibling) {
 
-                     node = node.parentNode;
 
-                     if (node === breakNode || node.nodeName.toLowerCase() === 'body') {
 
-                         return null;
 
-                     }
 
-                 }
 
-                 leaf = node.previousSibling;
 
-                 while (leaf.lastChild) {
 
-                     leaf = leaf.lastChild;
 
-                 }
 
-                 return leaf;
 
-             },
 
-             checkInRange = function (range, source) {
 
-                 return (typeof range.inRange !== 'undefined') ? range.inRange(source) :
 
-                     (compareBoundaryPoints(range, 'StartToStart', source) < 1
 
-                         && compareBoundaryPoints(range, 'EndToEnd', source) > -1);
 
-             },
 
-             checkNextLeaf = function (node) {
 
-                 var leaf, inRange;
 
-                 while (!node.nextSibling) {
 
-                     node = node.parentNode;
 
-                     if (!node || node.nodeName.toLowerCase() === 'body') {
 
-                         return null;
 
-                     }
 
-                     rangeSelectNode(cursor, node);
 
-                     inRange = checkInRange(cursor, endNodeRange);
 
-                     if (inRange) {
 
-                         inRange = checkInRange(cursor, startNodeRange);
 
-                         if (!inRange) {
 
-                             tailNodes.push(node);
 
-                         } else {
 
-                             headNodes.push(node);
 
-                         }
 
-                     }
 
-                     if (node === endNodeAncestor) {
 
-                         return null;
 
-                     }
 
-                 }
 
-                 leaf = node.nextSibling;
 
-                 if (leaf.nodeType === GB.node.text || !endNodeAncestor) {
 
-                     return null;
 
-                 }
 
-                 rangeSelectNode(cursor, leaf);
 
-                 inRange = checkInRange(endNodeAncestorRange, cursor);
 
-                 if (!inRange) {
 
-                     return null;
 
-                 }
 
-                 while (leaf.firstChild) {
 
-                     leaf = leaf.firstChild;
 
-                 }
 
-                 if (leaf.nodeType === GB.node.text) {
 
-                     tailNodes = [];
 
-                     return null;
 
-                 }
 
-                 return leaf;
 
-             },
 
-             checkParentSpan = function (node) {
 
-                 var len = spanNodes.length, i = 0;
 
-                 for (; i < len; i++) {
 
-                     if (spanNodes[i] === node) {
 
-                         return true;
 
-                     }
 
-                 }
 
-                 return false;
 
-             };
 
-         this.editAreaFocus();
 
-         backupRange = this.restoreRange();
 
-         selectionType = this.getSelectionType();
 
-         if (this.W3CRange) {
 
-             range = this.doc;
 
-         } else {
 
-             range = (selectionType === GB.selection.none) ? this.doc : backupRange;
 
-         }
 
-         try {
 
-             if (cmd === 'LineHeight') {
 
-                 this.applyLineHeight(opt);
 
-             } else {
 
-                 if (cmd === 'InsertOrderedList' || cmd === 'InsertUnOrderedList') {
 
-                     if (checked !== true) {
 
-                         range.execCommand(cmd, false, opt);
 
-                         if (!GB.browser.msie) {
 
-                             range = this.getRange();
 
-                             node = range.commonAncestorContainer;
 
-                             found = isEmpty = false;
 
-                             if (node.nodeType === GB.node.element && node.lastChild &&
 
-                                     node.lastChild.nodeName.toLowerCase() === 'br') {
 
-                                 node.lastChild.className = this.cheditor.bogusSpacerName;
 
-                                 isEmpty = true;
 
-                             }
 
-                             while (node) {
 
-                                 if (node.nodeName.toLowerCase() === 'ul' || node.nodeName.toLowerCase() === 'ol') {
 
-                                     found = true;
 
-                                     break;
 
-                                 }
 
-                                 node = node.parentNode;
 
-                             }
 
-                             if (found) {
 
-                                 if (node.parentNode.nodeName.toLowerCase() === 'p' ||
 
-                                         node.parentNode.nodeName.toLowerCase() === 'div') {
 
-                                     pNode = node.parentNode;
 
-                                     if (pNode.lastChild && pNode.lastChild.nodeName.toLowerCase() === 'br') {
 
-                                         pNode.removeChild(pNode.lastChild);
 
-                                     }
 
-                                     if (pNode.firstChild === node && pNode.lastChild === node) {
 
-                                         pNode.parentNode.insertBefore(node, pNode);
 
-                                         pNode.parentNode.removeChild(pNode);
 
-                                         this.placeCaretAt(node.lastChild, isEmpty);
 
-                                     }
 
-                                 }
 
-                             }
 
-                         }
 
-                     }
 
-                     cursor = this.getRange();
 
-                     pNode = this.W3CRange ? cursor.commonAncestorContainer : cursor.parentElement();
 
-                     if (pNode.nodeType === GB.node.text) {
 
-                         pNode = pNode.parentNode;
 
-                     }
 
-                     while (pNode) {
 
-                         if (pNode.nodeName.toLowerCase() === 'ol' || pNode.nodeName.toLowerCase() === 'ul') {
 
-                             if (opt === 'desc' || opt === 'decimal') {
 
-                                 opt = '';
 
-                             }
 
-                             pNode.style.listStyleType = opt;
 
-                             break;
 
-                         }
 
-                         pNode = pNode.parentNode;
 
-                     }
 
-                 } else if (cmd === 'FontSize' || cmd === 'FontName' || cmd === 'ForeColor' || cmd === 'BackColor') {
 
-                     if (cmd === 'ForeColor' || cmd === 'BackColor') {
 
-                         opt = this.colorConvert(opt, 'hex');
 
-                     } else if (cmd === 'FontName' && opt === '맑은 고딕') {
 
-                         opt += ', "Malgun Gothic"';
 
-                     }
 
-                     cmd = GB.fontStyle[cmd];
 
-                     range = this.getRange();
 
-                     tempNodes = this.insertStartEndNode(range);
 
-                     startNode = tempNodes.startNode;
 
-                     endNode = tempNodes.endNode;
 
-                     cursor = this.createRange();
 
-                     startNodeRange = this.createRange();
 
-                     rangeSelectNode(startNodeRange, startNode);
 
-                     endNodeRange = this.createRange();
 
-                     endNodeAncestorRange = this.createRange();
 
-                     if (!tempNodes.collapsed) {
 
-                         tailNodes = [];
 
-                         endNodeAncestor = null;
 
-                         rangeSelectNode(endNodeRange, endNode);
 
-                         node = endNode.parentNode;
 
-                         while (node && node.nodeName.toLowerCase() !== 'body') {
 
-                             endNodeAncestor = node;
 
-                             node = node.parentNode;
 
-                         }
 
-                         if (endNodeAncestor) {
 
-                             rangeSelectNode(endNodeAncestorRange, endNodeAncestor);
 
-                         }
 
-                         node = endNode;
 
-                         while (node) {
 
-                             node = checkNextLeaf(node);
 
-                         }
 
-                         for (i = 0; i < tailNodes.length; i++) {
 
-                             this.clearCss(tailNodes[i], cmd);
 
-                         }
 
-                         node = endNode;
 
-                         while (node && node !== startNode) {
 
-                             node = clearPreviousLeaf(node);
 
-                         }
 
-                         if (headNodes.length) {
 
-                             found = false;
 
-                             node = startNode;
 
-                             while (node) {
 
-                                 if (node.nodeType === GB.node.text) {
 
-                                     found = true;
 
-                                     break;
 
-                                 }
 
-                                 node = checkPreviousLeaf(node, endNodeAncestor);
 
-                             }
 
-                             if (!found) {
 
-                                 for (i = 0; i < headNodes.length; i++) {
 
-                                     self.clearCss(headNodes[i], cmd);
 
-                                     css = self.getCssValue(headNodes[i]);
 
-                                     if (!css && headNodes[i].nodeName.toLowerCase() === 'span') {
 
-                                         child = headNodes[i];
 
-                                         while (child.firstChild) {
 
-                                             child.parentNode.insertBefore(child.firstChild, child);
 
-                                         }
 
-                                         child.parentNode.removeChild(child);
 
-                                         headNodes.splice(i);
 
-                                     }
 
-                                 }
 
-                             }
 
-                         }
 
-                         for (i = 0; i < removeNodes.length; i++) {
 
-                             removeNodes[i].parentNode.removeChild(removeNodes[i]);
 
-                         }
 
-                         removeNodes = [];
 
-                         len = applyTextNodes.length;
 
-                         if (rootNode) {
 
-                             rangeSelectNode(startNodeRange, rootNode);
 
-                         }
 
-                         for (i = 0; i < len; i++) {
 
-                             tNode = applyTextNodes[i];
 
-                             if (tNode.previousSibling && tNode.previousSibling.nodeType === GB.node.text) {
 
-                                 if (applyTextNodes[i + 1] && tNode.previousSibling === applyTextNodes[i + 1]) {
 
-                                     applyTextNodes[i + 1].nodeValue += tNode.nodeValue;
 
-                                     tNode.parentNode.removeChild(tNode);
 
-                                 } else {
 
-                                     tNode.nodeValue = tNode.previousSibling.nodeValue + tNode.nodeValue;
 
-                                     tNode.previousSibling.parentNode.removeChild(tNode.previousSibling);
 
-                                     i--;
 
-                                 }
 
-                                 continue;
 
-                             }
 
-                             pNode = tNode.parentNode;
 
-                             if (rootNode) {
 
-                                 rangeSelectNode(cursor, pNode);
 
-                                 inRange = checkInRange(startNodeRange, cursor);
 
-                                 if (inRange) {
 
-                                     self.makeFontCss(cmd, '', pNode);
 
-                                     self.makeFontCss(cmd, opt, rootNode);
 
-                                     continue;
 
-                                 }
 
-                             }
 
-                             if (pNode.nodeName.toLowerCase() === 'span'
 
-                                 && (pNode.firstChild === tNode || pNode.firstChild === startNode)
 
-                                 && (pNode.lastChild === tNode || pNode.lastChild === endNode)) {
 
-                                 self.makeFontCss(cmd, opt, pNode);
 
-                                 spanNodes.push(pNode);
 
-                                 continue;
 
-                             }
 
-                             makeSpanText(tNode);
 
-                         }
 
-                         len = spanNodes.length;
 
-                         for (i = 0; i < len; i++) {
 
-                             child = spanNodes[i];
 
-                             pNode = child.parentNode;
 
-                             if (pNode.nodeName.toLowerCase() === 'span') {
 
-                                 if (checkParentSpan(pNode)) {
 
-                                     self.makeFontCss(cmd, '', child);
 
-                                     css = self.getCssValue(child);
 
-                                     if (!css) {
 
-                                         while (child.firstChild) {
 
-                                             pNode.insertBefore(child.firstChild, child);
 
-                                         }
 
-                                         pNode.removeChild(child);
 
-                                         continue;
 
-                                     }
 
-                                 }
 
-                                 while (pNode && pNode.nodeName.toLowerCase() === 'span') {
 
-                                     if (pNode.firstChild === child && pNode.lastChild === child) {
 
-                                         css = self.getCssValue(pNode);
 
-                                         if (css) {
 
-                                             self.makeFontCss(cmd, '', pNode);
 
-                                             css = self.getCssValue(pNode);
 
-                                             if (!css) {
 
-                                                 pNode.parentNode.insertBefore(child, pNode);
 
-                                                 pNode.parentNode.removeChild(pNode);
 
-                                                 pNode = child;
 
-                                                 continue;
 
-                                             }
 
-                                         }
 
-                                     }
 
-                                     pNode = pNode.parentNode;
 
-                                 }
 
-                             }
 
-                         }
 
-                         if (this.W3CRange) {
 
-                             selection = this.getSelection();
 
-                             if (selection.rangeCount > 0) {
 
-                                 selection.removeAllRanges();
 
-                             }
 
-                             range = this.createRange();
 
-                             range.setStartAfter(startNode);
 
-                             range.setEndBefore(endNode);
 
-                             selection.addRange(range);
 
-                         } else {
 
-                             startNodeRange = this.createRange();
 
-                             endNodeRange = startNodeRange.duplicate();
 
-                             startNodeRange.moveToElementText(startNode);
 
-                             endNodeRange.moveToElementText(endNode);
 
-                             startNodeRange.setEndPoint('StartToEnd', startNodeRange);
 
-                             startNodeRange.setEndPoint('EndToStart', endNodeRange);
 
-                             startNodeRange.select();
 
-                         }
 
-                     } else {
 
-                         pNode = startNode.parentNode;
 
-                         found = false;
 
-                         while (pNode && pNode.nodeName.toLowerCase() === 'span' && !found) {
 
-                             css = self.getCssValue(pNode);
 
-                             if (css) {
 
-                                 len = css.length;
 
-                                 for (i = 0; i < len; i++) {
 
-                                     if (css[i].name === cmd && css[i].value === opt) {
 
-                                         found = true;
 
-                                         break;
 
-                                     }
 
-                                 }
 
-                             }
 
-                             pNode = pNode.parentNode;
 
-                         }
 
-                         if (!found) {
 
-                             span = this.doc.createElement('span');
 
-                             this.makeFontCss(cmd, opt, span);
 
-                             span.appendChild(zeroWidth);
 
-                             endNode.parentNode.insertBefore(span, endNode);
 
-                             if (this.W3CRange) {
 
-                                 selection = this.getSelection();
 
-                                 selection.collapse(zeroWidth, 1);
 
-                             } else {
 
-                                 range = this.getRange();
 
-                                 range.moveToElementText(span);
 
-                                 range.collapse(false);
 
-                                 range.select();
 
-                             }
 
-                         }
 
-                     }
 
-                     this.removeStartEndNode(tempNodes);
 
-                 } else {
 
-                     range.execCommand(cmd, false, opt);
 
-                 }
 
-             }
 
-         } catch (e) {
 
-             alert(e.toString());
 
-         }
 
-         this.toolbarUpdate();
 
-         this.boxHideAll();
 
-     },
 
-     modifyImage: function (img) {
 
-         var self = this,
 
-             idx, div, ico, inputCaption, wrapTextSpan, wrapTextCheckBox, wrapTextIcon, wrapTextChecked,
 
-             width = 0, height = 0, wrapElem, currentCaption = '', caption = null, inputAlt, inputTitle, cssFloat,
 
-             wrapperClassName = 'cheditor-caption-wrapper',
 
-             figureClassName = 'cheditor-caption',
 
-             figCaptionClassName = 'cheditor-caption-text',
 
-             imageWidthOpt = {
 
-                 orig: { size: 'normal', desc: '원본 크기' },
 
-                 fitpage: { size: '100%', desc: '페이지 크기에 맞춤' },
 
-                 px160: { size: 160, desc: '썸네일, 160 픽셀' },
 
-                 px320: { size: 320, desc: '작은 크기, 320 픽셀' },
 
-                 px640: { size: 640, desc: '중간 크기, 640 픽셀' },
 
-                 px1024: { size: 1024, desc: '크게, 1024 픽셀' },
 
-                 px1600: { size: 1600, desc: '아주 크게, 1600 픽셀' }
 
-             },
 
-             captionAlignOpt = { left: '왼쪽', center: '가운데', right: '오른쪽' },
 
-             imageFloatOpt = {
 
-                 left: {
 
-                     value: '왼쪽',
 
-                     input: null
 
-                 },
 
-                 right: {
 
-                     value: '오른쪽',
 
-                     input: null
 
-                 }
 
-             },
 
-             fmSelectWidth = document.createElement('select'),
 
-             fmSelectCaptionAlign = document.createElement('select'),
 
-             onChangeEventHandler = function () {
 
-                 if (self.editImages[img.src] && self.editImages[img.src].width) {
 
-                     width = self.editImages[img.src].width;
 
-                     if (self.editImages[img.src] && self.editImages[img.src].height) {
 
-                         height = self.editImages[img.src].height;
 
-                     } else {
 
-                         height = img.height;
 
-                     }
 
-                 } else if (img.width) {
 
-                     width = img.width;
 
-                 } else {
 
-                     return;
 
-                 }
 
-                 switch (this.value) {
 
-                     case 'orig':
 
-                         width = width + 'px';
 
-                         height = (height || img.height) + 'px';
 
-                         break;
 
-                     case 'fitpage':
 
-                         width = '100%';
 
-                         height = 'auto';
 
-                         break;
 
-                     default:
 
-                         width = imageWidthOpt[this.value].size;
 
-                         if (img.height) {
 
-                             height = Math.round((img.height * width) / img.width) + 'px';
 
-                         }
 
-                         width += 'px';
 
-                 }
 
-                 if (width) {
 
-                     img.style.width = width;
 
-                     if (caption && caption.figure) {
 
-                         caption.figure.style.width = width;
 
-                     }
 
-                 }
 
-                 if (height) {
 
-                     img.style.height = height;
 
-                 }
 
-             },
 
-             setCssFloat = function (elem, css) {
 
-                 if (typeof elem.style.styleFloat === 'undefined') {
 
-                     elem.style.cssFloat = css;
 
-                 } else {
 
-                     elem.style.styleFloat = css;
 
-                 }
 
-             },
 
-             getCssFloat = function (elem) {
 
-                 return (typeof elem.style.styleFloat === 'undefined') ? elem.style.cssFloat : elem.style.styleFloat;
 
-             },
 
-             clearCssFloat = function (elem) {
 
-                 setCssFloat(elem, '');
 
-                 elem.style.marginLeft = '';
 
-                 elem.style.marginRight = '';
 
-             },
 
-             createInputForm = function (type, name, value, classname) {
 
-                 var input = document.createElement('input');
 
-                 input.setAttribute('type', type);
 
-                 input.setAttribute('name', name);
 
-                 input.setAttribute('value', value);
 
-                 input.className = classname;
 
-                 return input;
 
-             },
 
-             applyWrapText = function (elem) {
 
-                 if (!elem) {
 
-                     return;
 
-                 }
 
-                 wrapElem = (caption && caption.wrapper) ? caption.wrapper : img;
 
-                 if (elem.checked) {
 
-                     imageFloatOpt[(elem.name === 'left' ? 'right' : 'left')].input.checked = false;
 
-                     setCssFloat(wrapElem, elem.name);
 
-                     if (elem.name === 'left') {
 
-                         wrapElem.style.marginRight = '1em';
 
-                         wrapElem.style.marginLeft = '';
 
-                     } else {
 
-                         wrapElem.style.marginLeft = '1em';
 
-                         wrapElem.style.marginRight = '';
 
-                     }
 
-                     if (caption && caption.wrapper) {
 
-                         clearCssFloat(img);
 
-                     }
 
-                 } else {
 
-                     clearCssFloat(wrapElem);
 
-                 }
 
-             },
 
-             getCaptionNodes = function (img) {
 
-                 var nodes = { figure: null, figCaption: [], captionText: '', img: null, wrapper: null },
 
-                     pNode, node;
 
-                 pNode = img.parentNode;
 
-                 if (!pNode || pNode.nodeName.toLowerCase() !== 'figure') {
 
-                     return null;
 
-                 }
 
-                 nodes.figure = pNode;
 
-                 nodes.figCaption = pNode.getElementsByTagName('figcaption');
 
-                 for (idx = 0; idx < nodes.figCaption.length; idx++) {
 
-                     node = nodes.figCaption[idx].firstChild;
 
-                     while (node) {
 
-                         if (node.nodeType === GB.node.text) {
 
-                             nodes.captionText += self.trimSpace(node.nodeValue);
 
-                         }
 
-                         node = node.nextSibling;
 
-                     }
 
-                 }
 
-                 if (pNode.parentNode.nodeName.toLowerCase() === 'div' && pNode.parentNode.className === wrapperClassName) {
 
-                     nodes.wrapper = pNode.parentNode;
 
-                 }
 
-                 nodes.img = img;
 
-                 return nodes;
 
-             },
 
-             applyAlt = function () {
 
-                 var alt = self.trimSpace(inputAlt.value);
 
-                 if (alt !== '') {
 
-                     img.setAttribute('alt', alt);
 
-                 }
 
-                 self.removeEvent(inputAlt, 'blur', applyAlt);
 
-                 self.cheditor.modifyState = false;
 
-             },
 
-             applyTitle = function () {
 
-                 var title = self.trimSpace(inputTitle.value);
 
-                 if (title !== '') {
 
-                     img.setAttribute('title', title);
 
-                 }
 
-                 self.removeEvent(inputTitle, 'blur', applyTitle);
 
-                 self.cheditor.modifyState = false;
 
-             },
 
-             applyCaption = function () {
 
-                 var figure = self.doc.createElement('figure'),
 
-                     figCaption = self.doc.createElement('figcaption'),
 
-                     wrapper = self.doc.createElement('div'),
 
-                     pNode = img.parentNode, i, para = self.doc.createElement('p');
 
-                 self.removeEvent(inputCaption, 'blur', applyCaption);
 
-                 wrapper.className = wrapperClassName;
 
-                 figure.className = figureClassName;
 
-                 figCaption.className = figCaptionClassName;
 
-                 this.value = self.trimSpace(inputCaption.value);
 
-                 if (!self.isTextVisible(this.value) && caption) {
 
-                     caption.wrapper.parentNode.insertBefore(para, caption.wrapper);
 
-                     para.appendChild(caption.img);
 
-                     cssFloat = getCssFloat(caption.wrapper);
 
-                     caption.wrapper.parentNode.removeChild(caption.wrapper);
 
-                     caption = getCaptionNodes(img);
 
-                     if (cssFloat && (cssFloat === 'left' || cssFloat === 'right')) {
 
-                         applyWrapText(imageFloatOpt[cssFloat].input);
 
-                     }
 
-                     self.cheditor.modifyState = false;
 
-                     return;
 
-                 }
 
-                 if (currentCaption === this.value) {
 
-                     self.cheditor.modifyState = false;
 
-                     return;
 
-                 }
 
-                 if (caption && caption.figure) {
 
-                     for (i = 0; i < caption.figCaption.length; i++) {
 
-                         caption.figure.removeChild(caption.figCaption[i]);
 
-                     }
 
-                     figure = caption.figure;
 
-                 } else {
 
-                     if (pNode.nodeName.toLowerCase() !== 'body') {
 
-                         pNode.parentNode.insertBefore(wrapper, pNode.nextSibling);
 
-                     } else {
 
-                         pNode.insertBefore(wrapper, img);
 
-                     }
 
-                     if (self.config.imgCaptionWrapper !== '') {
 
-                         wrapper.setAttribute('style', self.config.imgCaptionWrapper);
 
-                     }
 
-                     wrapper.appendChild(figure);
 
-                     figure.setAttribute('style', self.config.imgCaptionFigure);
 
-                     figure.style.display = 'inline-block';
 
-                     figure.style.width = img.width;
 
-                     figure.appendChild(img);
 
-                     para.appendChild(self.createNbspTextNode());
 
-                     wrapper.parentNode.insertBefore(para, wrapper.nextSibling);
 
-                 }
 
-                 figure.appendChild(figCaption);
 
-                 figCaption.setAttribute('style', self.config.imgCaptionText);
 
-                 figCaption.appendChild(self.doc.createTextNode(this.value));
 
-                 if (!pNode.hasChildNodes()) {
 
-                     pNode.parentNode.removeChild(pNode);
 
-                 }
 
-                 caption = getCaptionNodes(img);
 
-                 cssFloat = getCssFloat(img);
 
-                 if (cssFloat && (cssFloat === 'left' || cssFloat === 'right')) {
 
-                     applyWrapText(imageFloatOpt[cssFloat].input);
 
-                 }
 
-                 self.cheditor.modifyState = false;
 
-             };
 
-         for (idx in imageWidthOpt) {
 
-             if (imageWidthOpt.hasOwnProperty(idx)) {
 
-                 fmSelectWidth.options[fmSelectWidth.options.length] = new Option(imageWidthOpt[idx].desc, idx);
 
-             }
 
-         }
 
-         fmSelectWidth.onchange = onChangeEventHandler;
 
-         caption = getCaptionNodes(img);
 
-         div = document.createElement('div');
 
-         div.style.textAlign = 'left';
 
-         ico = new Image();
 
-         ico.src = this.config.iconPath + 'image_resize.png';
 
-         ico.className = 'cheditor-ico';
 
-         div.appendChild(ico);
 
-         div.appendChild(fmSelectWidth);
 
-         wrapTextChecked = getCssFloat((caption && caption.wrapper) ? caption.wrapper : img);
 
-         for (idx in imageFloatOpt) {
 
-             if (imageFloatOpt.hasOwnProperty(idx)) {
 
-                 wrapTextCheckBox = createInputForm('checkbox', idx, '1', 'wrap-checked');
 
-                 wrapTextCheckBox.setAttribute('id', 'idWrapText-' + idx);
 
-                 wrapTextCheckBox.onclick = function () {
 
-                     applyWrapText(this);
 
-                 };
 
-                 imageFloatOpt[idx].input = wrapTextCheckBox;
 
-                 wrapTextSpan = document.createElement('span');
 
-                 wrapTextIcon = new Image();
 
-                 wrapTextSpan.className = 'wrap-text-desc';
 
-                 if (idx === 'left') {
 
-                     wrapTextSpan.style.marginLeft = '20px';
 
-                 }
 
-                 if (wrapTextChecked === idx) {
 
-                     wrapTextCheckBox.checked = 'checked';
 
-                 }
 
-                 wrapTextSpan.appendChild(wrapTextCheckBox);
 
-                 wrapTextIcon.className = 'cheditor-ico';
 
-                 wrapTextIcon.src = this.config.iconPath + 'image_align_' + idx + '_wt.png';
 
-                 wrapTextSpan.appendChild(wrapTextIcon);
 
-                 div.appendChild(wrapTextSpan);
 
-             }
 
-         }
 
-         if (self.undefined(self.editImages[img.src])) {
 
-             self.editImages[img.src] = { width: img.width, height: img.height };
 
-         }
 
-         div.appendChild(document.createTextNode('\u00a0\u00a0Alt:'));
 
-         inputAlt = createInputForm('text', 'inputAlt', '', 'user-input-alt');
 
-         inputAlt.onfocus = function () {
 
-             self.cheditor.modifyState = true;
 
-             self.addEvent(inputAlt, 'blur', applyAlt);
 
-         };
 
-         div.appendChild(inputAlt);
 
-         if (img.getAttribute('alt')) {
 
-             inputAlt.value = img.getAttribute('alt');
 
-         }
 
-         div.appendChild(document.createTextNode('타이틀:'));
 
-         inputTitle = createInputForm('text', 'inputTitle', '', 'user-input-alt');
 
-         inputTitle.onfocus = function () {
 
-             self.cheditor.modifyState = true;
 
-             self.addEvent(inputTitle, 'blur', applyTitle);
 
-         };
 
-         div.appendChild(inputTitle);
 
-         if (img.getAttribute('title')) {
 
-             inputTitle.value = img.getAttribute('title');
 
-         }
 
-         div.appendChild(document.createElement('br'));
 
-         div.appendChild(document.createTextNode('사진 캡션:'));
 
-         inputCaption = createInputForm('text', 'inputCaption', '', 'user-input-caption');
 
-         inputCaption.onfocus = function () {
 
-             caption = getCaptionNodes(img);
 
-             self.cheditor.modifyState = true;
 
-             self.addEvent(inputCaption, 'blur', applyCaption);
 
-         };
 
-         div.appendChild(inputCaption);
 
-         div.appendChild(document.createTextNode('캡션 텍스트 정렬:'));
 
-         for (idx in captionAlignOpt) {
 
-             if (captionAlignOpt.hasOwnProperty(idx)) {
 
-                 fmSelectCaptionAlign.options[fmSelectCaptionAlign.options.length] = new Option(captionAlignOpt[idx], idx);
 
-                 if (caption && caption.figCaption[0] && caption.figCaption[0].style.textAlign) {
 
-                     if (idx === caption.figCaption[0].style.textAlign) {
 
-                         fmSelectCaptionAlign.options[fmSelectCaptionAlign.options.length - 1].selected = true;
 
-                     }
 
-                 }
 
-             }
 
-         }
 
-         fmSelectCaptionAlign.className = 'caption-align';
 
-         fmSelectCaptionAlign.onchange = function () {
 
-             caption = getCaptionNodes(img);
 
-             if (!caption) {
 
-                 return;
 
-             }
 
-             for (idx = 0; idx < caption.figCaption.length; idx++) {
 
-                 caption.figCaption[idx].style.textAlign = this.value;
 
-             }
 
-         };
 
-         div.appendChild(fmSelectCaptionAlign);
 
-         if (caption && caption.captionText) {
 
-             currentCaption = self.trimSpace(caption.captionText);
 
-             inputCaption.value = currentCaption;
 
-         }
 
-         while (self.cheditor.editBlock.firstChild) {
 
-             self.cheditor.editBlock.removeChild(self.cheditor.editBlock.firstChild);
 
-         }
 
-         self.cheditor.editBlock.appendChild(div);
 
-     },
 
-     modifyCell: function (ctd) {
 
-         var self = this,
 
-             ctb = ctd,
 
-             ctr = ctb,
 
-             tm = [], i, jr, j, jh, jv, rowIndex = 0, realIndex = 0, newc, newr, nc, tempr, rows, span, icon,
 
-             div = document.createElement('div'),
 
-             getCellMatrix = function () {
 
-                 rows = (ctb.rows && ctb.rows.length > 0) ? ctb.rows : ctb.getElementsByTagName('tr');
 
-                 for (i = 0; i < rows.length; i++) {
 
-                     tm[i] = [];
 
-                 }
 
-                 for (i = 0; i < rows.length; i++) {
 
-                     jr = 0;
 
-                     for (j = 0; j < rows[i].cells.length; j++) {
 
-                         while (!(self.undefined(tm[i][jr]))) {
 
-                             jr++;
 
-                         }
 
-                         for (jh = jr; jh < jr + (rows[i].cells[j].colSpan || 1) ; jh++) {
 
-                             for (jv = i; jv < i + (rows[i].cells[j].rowSpan || 1) ; jv++) {
 
-                                 tm[jv][jh] = (jv === i) ? rows[i].cells[j].cellIndex : -1;
 
-                             }
 
-                         }
 
-                     }
 
-                 }
 
-                 return tm;
 
-             },
 
-             insertColumn = function () {
 
-                 tm = getCellMatrix();
 
-                 rows = (ctb.rows && ctb.rows.length > 0) ? ctb.rows : ctb.getElementsByTagName('tr');
 
-                 if (ctr.rowIndex >= 0) {
 
-                     rowIndex = ctr.rowIndex;
 
-                 } else {
 
-                     for (i = 0; i < rows.length; i++) {
 
-                         if (rows[i] === ctr) {
 
-                             rowIndex = i;
 
-                             break;
 
-                         }
 
-                     }
 
-                 }
 
-                 for (j = 0; j < tm[rowIndex].length; j++) {
 
-                     if (tm[rowIndex][j] === ctd.cellIndex) {
 
-                         realIndex = j;
 
-                         break;
 
-                     }
 
-                 }
 
-                 for (i = 0; i < rows.length; i++) {
 
-                     if (tm[i][realIndex] !== -1) {
 
-                         if (rows[i].cells[tm[i][realIndex]].colSpan > 1) {
 
-                             rows[i].cells[tm[i][realIndex]].colSpan++;
 
-                         } else {
 
-                             newc = rows[i].insertCell(tm[i][realIndex] + 1);
 
-                             nc = rows[i].cells[tm[i][realIndex]].cloneNode(false);
 
-                             nc.innerHTML = ' ';
 
-                             rows[i].replaceChild(nc, newc);
 
-                         }
 
-                     }
 
-                 }
 
-             },
 
-             insertRow = function (idx) {
 
-                 newr = ctb.insertRow(ctr.rowIndex + 1);
 
-                 for (i = 0; i < ctr.cells.length; i++) {
 
-                     if (ctr.cells[i].rowSpan > 1) {
 
-                         ctr.cells[i].rowSpan++;
 
-                     } else {
 
-                         newc = ctr.cells[i].cloneNode(false);
 
-                         newc.innerHTML = ' ';
 
-                         newr.appendChild(newc);
 
-                     }
 
-                 }
 
-                 for (i = 0; i < ctr.rowIndex; i++) {
 
-                     if (ctb.rows && ctb.rows.length > 0) {
 
-                         tempr = ctb.rows[i];
 
-                     } else {
 
-                         tempr = ctb.getElementsByTagName('tr')[i];
 
-                     }
 
-                     for (j = 0; j < tempr.cells.length; j++) {
 
-                         if (tempr.cells[j].rowSpan > (ctr.rowIndex - i)) {
 
-                             tempr.cells[j].rowSpan++;
 
-                         }
 
-                     }
 
-                 }
 
-             },
 
-             deleteColumn = function () {
 
-                 tm = getCellMatrix(ctb);
 
-                 rows = (ctb.rows && ctb.rows.length > 0) ? ctb.rows : ctb.getElementsByTagName('tr');
 
-                 rowIndex = 0; realIndex = 0;
 
-                 if (ctr.rowIndex >= 0) {
 
-                     rowIndex = ctr.rowIndex;
 
-                 } else {
 
-                     for (i = 0; i < rows.length; i++) {
 
-                         if (rows[i] === ctr) {
 
-                             rowIndex = i;
 
-                             break;
 
-                         }
 
-                     }
 
-                 }
 
-                 if (tm[0].length <= 1) {
 
-                     ctb.parentNode.removeChild(ctb);
 
-                 } else {
 
-                     for (j = 0; j < tm[rowIndex].length; j++) {
 
-                         if (tm[rowIndex][j] === ctd.cellIndex) {
 
-                             realIndex = j;
 
-                             break;
 
-                         }
 
-                     }
 
-                     for (i = 0; i < rows.length; i++) {
 
-                         if (tm[i][realIndex] !== -1) {
 
-                             if (rows[i].cells[tm[i][realIndex]].colSpan > 1) {
 
-                                 rows[i].cells[tm[i][realIndex]].colSpan--;
 
-                             } else {
 
-                                 rows[i].deleteCell(tm[i][realIndex]);
 
-                             }
 
-                         }
 
-                     }
 
-                 }
 
-             },
 
-             deleteRow = function () {
 
-                 var curCI = -1, prevCI, ni, nrCI, cs, nj;
 
-                 tm = getCellMatrix(ctb);
 
-                 rows = (ctb.rows && ctb.rows.length > 0) ? ctb.rows : ctb.getElementsByTagName('TR');
 
-                 rowIndex = 0;
 
-                 if (ctr.rowIndex >= 0) {
 
-                     rowIndex = ctr.rowIndex;
 
-                 } else {
 
-                     for (i = 0; i < rows.length; i++) {
 
-                         if (rows[i] === ctr) {
 
-                             rowIndex = i;
 
-                             break;
 
-                         }
 
-                     }
 
-                 }
 
-                 if (rows.length <= 1) {
 
-                     ctb.parentNode.removeChild(ctb);
 
-                 } else {
 
-                     for (i = 0; i < rowIndex; i++) {
 
-                         tempr = rows[i];
 
-                         for (j = 0; j < tempr.cells.length; j++) {
 
-                             if (tempr.cells[j].rowSpan > (rowIndex - i)) {
 
-                                 tempr.cells[j].rowSpan--;
 
-                             }
 
-                         }
 
-                     }
 
-                     for (i = 0; i < tm[rowIndex].length; i++) {
 
-                         prevCI = curCI;
 
-                         curCI = tm[rowIndex][i];
 
-                         if (curCI !== -1 && curCI !== prevCI && ctr.cells[curCI].rowSpan > 1 && (rowIndex + 1) < rows.length) {
 
-                             ni = i;
 
-                             nrCI = tm[rowIndex + 1][ni];
 
-                             while (nrCI === -1) {
 
-                                 ni++;
 
-                                 nrCI = (ni < rows[rowIndex + 1].cells.length) ? tm[rowIndex + 1][ni] : rows[rowIndex + 1].cells.length;
 
-                             }
 
-                             newc = rows[rowIndex + 1].insertCell(nrCI);
 
-                             rows[rowIndex].cells[curCI].rowSpan--;
 
-                             nc = rows[rowIndex].cells[curCI].cloneNode(false);
 
-                             rows[rowIndex + 1].replaceChild(nc, newc);
 
-                             cs = (ctr.cells[curCI].colSpan > 1) ? ctr.cells[curCI].colSpan : 1;
 
-                             nj = 0;
 
-                             for (j = i; j < (i + cs) ; j++) {
 
-                                 tm[rowIndex + 1][j] = nrCI;
 
-                                 nj = j;
 
-                             }
 
-                             for (j = nj; j < tm[rowIndex + 1].length; j++) {
 
-                                 if (tm[rowIndex + 1][j] !== -1) {
 
-                                     tm[rowIndex + 1][j]++;
 
-                                 }
 
-                             }
 
-                         }
 
-                     }
 
-                     if (ctb.rows && ctb.rows.length > 0) {
 
-                         ctb.deleteRow(rowIndex);
 
-                     } else {
 
-                         ctb.removeChild(rows[rowIndex]);
 
-                     }
 
-                 }
 
-             },
 
-             mergeCellRight = function () {
 
-                 tm = getCellMatrix(ctb);
 
-                 rows = (ctb.rows && ctb.rows.length > 0) ? ctb.rows : ctb.getElementsByTagName('tr');
 
-                 rowIndex = 0; realIndex = 0;
 
-                 if (ctr.rowIndex >= 0) {
 
-                     rowIndex = ctr.rowIndex;
 
-                 } else {
 
-                     for (i = 0; i < rows.length; i++) {
 
-                         if (rows[i] === ctr) {
 
-                             rowIndex = i;
 
-                             break;
 
-                         }
 
-                     }
 
-                 }
 
-                 for (j = 0; j < tm[rowIndex].length; j++) {
 
-                     if (tm[rowIndex][j] === ctd.cellIndex) {
 
-                         realIndex = j;
 
-                         break;
 
-                     }
 
-                 }
 
-                 if (ctd.cellIndex + 1 < ctr.cells.length) {
 
-                     var ccrs = ctd.rowSpan || 1,
 
-                         cccs = ctd.colSpan || 1,
 
-                         ncrs = ctr.cells[ctd.cellIndex + 1].rowSpan || 1,
 
-                         nccs = ctr.cells[ctd.cellIndex + 1].colSpan || 1,
 
-                         html;
 
-                     j = realIndex;
 
-                     while (tm[rowIndex][j] === ctd.cellIndex) {
 
-                         j++;
 
-                     }
 
-                     if (tm[rowIndex][j] === ctd.cellIndex + 1) {
 
-                         if (ccrs === ncrs) {
 
-                             if (rows.length > 1) {
 
-                                 ctd.colSpan = cccs + nccs;
 
-                             }
 
-                             html = self.trimSpace(ctr.cells[ctd.cellIndex + 1].innerHTML);
 
-                             html = html.replace(/^ /, '');
 
-                             ctd.innerHTML += html;
 
-                             ctr.deleteCell(ctd.cellIndex + 1);
 
-                         }
 
-                     }
 
-                 }
 
-             },
 
-             mergeCellDown = function () {
 
-                 var crealIndex = 0,
 
-                     ccrs = ctd.rowSpan || 1,
 
-                     cccs = ctd.colSpan || 1,
 
-                     ncellIndex, html, ncrs, nccs;
 
-                 tm = getCellMatrix(ctb);
 
-                 rows = (ctb.rows && ctb.rows.length > 0) ? ctb.rows : ctb.getElementsByTagName('tr');
 
-                 rowIndex = 0;
 
-                 if (ctr.rowIndex >= 0) {
 
-                     rowIndex = ctr.rowIndex;
 
-                 } else {
 
-                     for (i = 0; i < rows.length; i++) {
 
-                         if (rows[i] === ctr) {
 
-                             rowIndex = i;
 
-                             break;
 
-                         }
 
-                     }
 
-                 }
 
-                 for (i = 0; i < tm[rowIndex].length; i++) {
 
-                     if (tm[rowIndex][i] === ctd.cellIndex) {
 
-                         crealIndex = i;
 
-                         break;
 
-                     }
 
-                 }
 
-                 if (rowIndex + ccrs < rows.length) {
 
-                     ncellIndex = tm[rowIndex + ccrs][crealIndex];
 
-                     if (ncellIndex !== -1 &&
 
-                         (crealIndex === 0 || (crealIndex > 0 &&
 
-                         (tm[rowIndex + ccrs][crealIndex - 1] !== tm[rowIndex + ccrs][crealIndex])))) {
 
-                         ncrs = rows[rowIndex + ccrs].cells[ncellIndex].rowSpan || 1;
 
-                         nccs = rows[rowIndex + ccrs].cells[ncellIndex].colSpan || 1;
 
-                         if (cccs === nccs) {
 
-                             html = self.trimSpace(rows[rowIndex + ccrs].cells[ncellIndex].innerHTML);
 
-                             html = html.replace(/^ /, '');
 
-                             ctd.innerHTML += html;
 
-                             rows[rowIndex + ccrs].deleteCell(ncellIndex);
 
-                             ctd.rowSpan = ccrs + ncrs;
 
-                         }
 
-                     }
 
-                 }
 
-             },
 
-             splitCellVertical = function () {
 
-                 var ri, cs;
 
-                 tm = getCellMatrix();
 
-                 rowIndex = 0; realIndex = 0;
 
-                 rows = (ctb.rows && ctb.rows.length > 0) ? ctb.rows : ctb.getElementsByTagName('TR');
 
-                 if (ctr.rowIndex >= 0) {
 
-                     rowIndex = ctr.rowIndex;
 
-                 } else {
 
-                     for (ri = 0; ri < rows.length; ri++) {
 
-                         if (rows[ri] === ctr) {
 
-                             rowIndex = ri;
 
-                             break;
 
-                         }
 
-                     }
 
-                 }
 
-                 for (j = 0; j < tm[rowIndex].length; j++) {
 
-                     if (tm[rowIndex][j] === ctd.cellIndex) {
 
-                         realIndex = j;
 
-                         break;
 
-                     }
 
-                 }
 
-                 if (ctd.colSpan > 1) {
 
-                     newc = rows[rowIndex].insertCell(ctd.cellIndex + 1);
 
-                     ctd.colSpan--;
 
-                     nc = ctd.cloneNode(false);
 
-                     nc.innerHTML = ' ';
 
-                     rows[rowIndex].replaceChild(nc, newc);
 
-                     ctd.colSpan = 1;
 
-                     ctd.removeAttribute('colSpan');
 
-                 } else {
 
-                     newc = rows[rowIndex].insertCell(ctd.cellIndex + 1);
 
-                     nc = ctd.cloneNode(false);
 
-                     nc.innerHTML = ' ';
 
-                     rows[rowIndex].replaceChild(nc, newc);
 
-                     for (i = 0; i < tm.length; i++) {
 
-                         if (i !== rowIndex && tm[i][realIndex] !== -1) {
 
-                             cs = (rows[i].cells[tm[i][realIndex]].colSpan > 1) ? rows[i].cells[tm[i][realIndex]].colSpan : 1;
 
-                             rows[i].cells[tm[i][realIndex]].colSpan = cs + 1;
 
-                         }
 
-                     }
 
-                 }
 
-             },
 
-             splitCellHorizontal = function () {
 
-                 var ni, rs;
 
-                 tm = getCellMatrix();
 
-                 rowIndex = 0; realIndex = 0;
 
-                 rows = (ctb.rows && ctb.rows.length > 0) ? ctb.rows : ctb.getElementsByTagName('TR');
 
-                 if (ctr.rowIndex >= 0) {
 
-                     rowIndex = ctr.rowIndex;
 
-                 } else {
 
-                     for (i = 0; i < rows.length; i++) {
 
-                         if (rows[i] === ctr) {
 
-                             rowIndex = i;
 
-                             break;
 
-                         }
 
-                     }
 
-                 }
 
-                 for (j = 0; j < tm[rowIndex].length; j++) {
 
-                     if (tm[rowIndex][j] === ctd.cellIndex) {
 
-                         realIndex = j;
 
-                         break;
 
-                     }
 
-                 }
 
-                 if (ctd.rowSpan > 1) {
 
-                     i = realIndex;
 
-                     while (tm[rowIndex + 1][i] === -1) {
 
-                         i++;
 
-                     }
 
-                     ni = (i === tm[rowIndex + 1].length) ? rows[rowIndex + 1].cells.length : tm[rowIndex + 1][i];
 
-                     newc = rows[rowIndex + 1].insertCell(ni);
 
-                     ctd.rowSpan--;
 
-                     nc = ctd.cloneNode(false);
 
-                     nc.innerHTML = ' ';
 
-                     rows[rowIndex + 1].replaceChild(nc, newc);
 
-                     ctd.rowSpan = 1;
 
-                 } else {
 
-                     if (ctb.rows && ctb.rows.length > 0) {
 
-                         ctb.insertRow(rowIndex + 1);
 
-                     } else {
 
-                         if (rowIndex < (rows.length - 1)) {
 
-                             ctb.insertBefore(document.createElement('TR'), rows[rowIndex + 1]);
 
-                         } else {
 
-                             ctb.appendChild(document.createElement('TR'));
 
-                         }
 
-                     }
 
-                     for (i = 0; i < ctr.cells.length; i++) {
 
-                         if (i !== ctd.cellIndex) {
 
-                             rs = ctr.cells[i].rowSpan > 1 ? ctr.cells[i].rowSpan : 1;
 
-                             ctr.cells[i].rowSpan = rs + 1;
 
-                         }
 
-                     }
 
-                     for (i = 0; i < rowIndex; i++) {
 
-                         tempr = rows[i];
 
-                         for (j = 0; j < tempr.cells.length; j++) {
 
-                             if (tempr.cells[j].rowSpan > (rowIndex - i)) {
 
-                                 tempr.cells[j].rowSpan++;
 
-                             }
 
-                         }
 
-                     }
 
-                     newc = rows[rowIndex + 1].insertCell(0);
 
-                     nc = ctd.cloneNode(false);
 
-                     nc.innerHTML = ' ';
 
-                     rows[rowIndex + 1].replaceChild(nc, newc);
 
-                 }
 
-             },
 
-             tblReflash = function () {
 
-                 self.editAreaFocus(); self.doEditorEvent();
 
-             },
 
-             colorPickerEventHandler = function () {
 
-                 GB.popupWindow.ColorPicker.argv = {
 
-                     func: function (color) {
 
-                         ctd.setAttribute('bgColor', color);
 
-                         document.getElementById('fm_cell_bgcolor').value = color;
 
-                     },
 
-                     selectedCell: ctd
 
-                 };
 
-                 self.windowOpen('ColorPicker');
 
-             },
 
-             editSubmitEventHandler = function () {
 
-                 var width = self.trimSpace(document.getElementById('fm_cell_width').value),
 
-                     height = self.trimSpace(document.getElementById('fm_cell_height').value),
 
-                     bgcolor = self.trimSpace(document.getElementById('fm_cell_bgcolor').value);
 
-                 if (width) {
 
-                     ctd.setAttribute('width', width);
 
-                 }
 
-                 if (height) {
 
-                     ctd.setAttribute('height', height);
 
-                 }
 
-                 if (bgcolor) {
 
-                     ctd.setAttribute('bgcolor', bgcolor);
 
-                 }
 
-             },
 
-             deleteSubmitEventHandler = function () {
 
-                 ctb.parentNode.removeChild(ctb);
 
-                 self.doEditorEvent();
 
-             },
 
-             funcs = {
 
-                 add_cols_after: {
 
-                     icon: 'table_insert_column.png', title: '열 삽입',
 
-                     func: function () {
 
-                         insertColumn(ctd.cellIndex); tblReflash();
 
-                     }
 
-                 },
 
-                 add_rows_after: {
 
-                     icon: 'table_insert_row.png', title: '행 삽입',
 
-                     func: function () {
 
-                         insertRow(ctr.rowIndex); tblReflash();
 
-                     }
 
-                 },
 
-                 remove_cols: {
 
-                     icon: 'table_delete_column.png', title: '열 삭제',
 
-                     func: function () {
 
-                         deleteColumn(ctd.cellIndex); tblReflash();
 
-                     }
 
-                 },
 
-                 remove_rows: {
 
-                     icon: 'table_delete_row.png', title: '행 삭제',
 
-                     func: function () {
 
-                         deleteRow(); tblReflash();
 
-                     }
 
-                 },
 
-                 sp1: { icon: 'dot.gif' },
 
-                 merge_cell_right: {
 
-                     icon: 'table_join_row.png', title: '오른쪽 셀과 병합',
 
-                     func: function () {
 
-                         mergeCellRight(); tblReflash();
 
-                     }
 
-                 },
 
-                 merge_cell_down: {
 
-                     icon: 'table_join_column.png', title: '아래 셀과 병합',
 
-                     func: function () {
 
-                         mergeCellDown(); tblReflash();
 
-                     }
 
-                 },
 
-                 split_cell_v: {
 
-                     icon: 'table_split_row.png', title: '셀 열로 나누기',
 
-                     func: function () {
 
-                         splitCellVertical(); tblReflash();
 
-                     }
 
-                 },
 
-                 split_cell_h: {
 
-                     icon: 'table_split_column.png', title: '셀 행으로 나누기',
 
-                     func: function () {
 
-                         splitCellHorizontal(); tblReflash();
 
-                     }
 
-                 }
 
-             },
 
-             attrFuncs = {
 
-                 setWidth: {
 
-                     txt: '가로폭',
 
-                     id: 'fm_cell_width',
 
-                     marginRight: '10px',
 
-                     value: ctd.getAttribute('width')
 
-                 },
 
-                 setHeight: {
 
-                     txt: '세로폭',
 
-                     id: 'fm_cell_height',
 
-                     marginRight: '10px',
 
-                     value: ctd.getAttribute('height')
 
-                 },
 
-                 setBgcolor: {
 
-                     txt: '배경색',
 
-                     id: 'fm_cell_bgcolor',
 
-                     marginRight: '2px',
 
-                     value: ctd.getAttribute('bgcolor')
 
-                 }
 
-             },
 
-             deleteSubmit = new Image(),
 
-             spliter = document.createElement('div'), txt, input,
 
-             colorPicker = new Image(),
 
-             editSubmit = new Image();
 
-         while (ctb && ctb.tagName.toLowerCase() !== 'table') {
 
-             ctb = ctb.parentNode;
 
-         }
 
-         while (ctr && ctr.tagName.toLowerCase() !== 'tr') {
 
-             ctr = ctr.parentNode;
 
-         }
 
-         self.cheditor.editBlock.innerHTML = '';
 
-         div.style.padding = '6px';
 
-         for (i in funcs) {
 
-             if (!funcs.hasOwnProperty(i)) {
 
-                 continue;
 
-             }
 
-             span = document.createElement('span');
 
-             icon = document.createElement('img');
 
-             icon.src = self.config.iconPath + funcs[i].icon;
 
-             if (i === 'sp1' || i === 'sp2') {
 
-                 icon.className = 'edit-table-ico';
 
-             } else {
 
-                 icon.setAttribute('title', funcs[i].title);
 
-                 icon.className = 'edit-table-ico';
 
-                 icon.setAttribute('alt', '');
 
-                 icon.onclick = funcs[i].func;
 
-             }
 
-             div.appendChild(span.appendChild(icon));
 
-         }
 
-         deleteSubmit.src = this.config.iconPath + 'delete_table.png';
 
-         deleteSubmit.style.marginLeft = '22px';
 
-         deleteSubmit.className = 'edit-table-ico';
 
-         deleteSubmit.setAttribute('title', '테이블 삭제');
 
-         deleteSubmit.onclick = deleteSubmitEventHandler;
 
-         div.appendChild(deleteSubmit);
 
-         spliter.style.padding = '10px 0px 0px 0px';
 
-         spliter.style.marginTop = '5px';
 
-         spliter.style.borderTop = '1px solid #ccc';
 
-         spliter.style.textAlign = 'center';
 
-         for (i in attrFuncs) {
 
-             if (!attrFuncs.hasOwnProperty(i)) {
 
-                 continue;
 
-             }
 
-             txt = document.createTextNode(attrFuncs[i].txt + ' ');
 
-             spliter.appendChild(txt);
 
-             input = document.createElement('input');
 
-             input.style.marginRight = attrFuncs[i].marginRight;
 
-             input.setAttribute('type', 'text');
 
-             input.setAttribute('name', i);
 
-             input.setAttribute('id', attrFuncs[i].id);
 
-             input.setAttribute('size', 7);
 
-             input.setAttribute('value', attrFuncs[i].value || '');
 
-             spliter.appendChild(input);
 
-         }
 
-         colorPicker.src = this.config.iconPath + 'button/color_picker.gif';
 
-         colorPicker.className = 'color-picker';
 
-         colorPicker.onclick = colorPickerEventHandler;
 
-         spliter.appendChild(colorPicker);
 
-         editSubmit.src = this.config.iconPath + 'button/edit_cell.gif';
 
-         editSubmit.className = 'input-submit';
 
-         editSubmit.style.verticalAlign = 'top';
 
-         editSubmit.onclick = editSubmitEventHandler;
 
-         spliter.appendChild(editSubmit);
 
-         div.appendChild(spliter);
 
-         self.cheditor.editBlock.appendChild(div);
 
-     },
 
-     doEditorEvent: function (evt) {
 
-         var self = this,
 
-             cmd = null, ancestors = [], node, el, pNode, range, sType, links, span, tag, remove, bText,
 
-             srcElement = evt.target || evt.srcElement,
 
-             block = self.cheditor.editBlock,
 
-             status = self.cheditor.tagPath,
 
-             linkOnClickEventHandler = function () {
 
-                 if (bText) {
 
-                     document.getElementById('removeSelected').style.display = 'inline';
 
-                     self.tagSelector(this.el);
 
-                 }
 
-             },
 
-             removeOnClickEventHandler = function () {
 
-                 self.doc.execCommand('RemoveFormat', false, null);
 
-                 remove.style.display = 'none';
 
-                 self.editAreaFocus();
 
-                 self.doEditorEvent();
 
-             };
 
-         if (!this.undefined(srcElement) && srcElement.nodeType === GB.node.element) {
 
-             pNode = srcElement;
 
-         } else {
 
-             range = self.getRange();
 
-             sType = self.getSelectionType();
 
-             bText = sType === GB.selection.text;
 
-             if (!self.W3CRange) {
 
-                 switch (sType) {
 
-                     case GB.selection.none:
 
-                     case GB.selection.text:
 
-                         pNode = range.parentElement();
 
-                         break;
 
-                     case GB.selection.element:
 
-                         pNode = range.item(0);
 
-                         break;
 
-                     default:
 
-                         pNode = self.editArea.document.body;
 
-                 }
 
-             } else {
 
-                 pNode = range.commonAncestorContainer;
 
-                 if (!range.collapsed &&
 
-                     range.startContainer === range.endContainer &&
 
-                     range.startOffset - range.endOffset < 2 &&
 
-                     range.startContainer.hasChildNodes()) {
 
-                     pNode = range.startContainer.childNodes[range.startOffset];
 
-                 }
 
-                 while (pNode.nodeType === GB.node.text) {
 
-                     pNode = pNode.parentNode;
 
-                 }
 
-             }
 
-         }
 
-         node = pNode;
 
-         while (pNode && pNode.nodeType === GB.node.element) {
 
-             if (pNode.tagName.toLowerCase() === 'body') {
 
-                 break;
 
-             }
 
-             if (pNode.tagName.toLowerCase() === 'img') {
 
-                 cmd = 'img'; break;
 
-             }
 
-             if (pNode.tagName.toLowerCase() === 'td' || pNode.tagName.toLowerCase() === 'th') {
 
-                 cmd = 'cell'; break;
 
-             }
 
-             pNode = pNode.parentNode;
 
-         }
 
-         if (!cmd) {
 
-             block.style.display = 'none';
 
-             block.innerHTML = '';
 
-         } else {
 
-             if (cmd === 'cell') {
 
-                 block.style.display = 'block';
 
-                 self.modifyCell(pNode);
 
-             }
 
-         }
 
-         if (self.config.showTagPath) {
 
-             while (node && node.nodeType === GB.node.element) {
 
-                 ancestors.push(node);
 
-                 if (node.tagName.toLowerCase() === 'body') {
 
-                     break;
 
-                 }
 
-                 node = node.parentNode;
 
-             }
 
-             status.innerHTML = '';
 
-             status.appendChild(document.createTextNode('<html> '));
 
-             el = ancestors.pop();
 
-             while (el) {
 
-                 status.appendChild(document.createTextNode('<'));
 
-                 tag = el.nodeName.toLowerCase();
 
-                 links = document.createElement('a');
 
-                 links.el = el;
 
-                 links.href = 'javascript:void%200';
 
-                 links.className = 'cheditor-tag-path-elem';
 
-                 links.title = el.style.cssText;
 
-                 (function () {
 
-                     links.onclick = linkOnClickEventHandler;
 
-                 })();
 
-                 links.appendChild(document.createTextNode(tag));
 
-                 status.appendChild(links);
 
-                 status.appendChild(document.createTextNode('> '));
 
-                 el = ancestors.pop();
 
-             }
 
-             if (bText) {
 
-                 remove = document.createElement('a');
 
-                 remove.href = 'javascript:void%200';
 
-                 remove.id = 'removeSelected';
 
-                 remove.style.display = 'none';
 
-                 remove.className = 'cheditor-tag-path-elem';
 
-                 remove.style.color = '#cc3300';
 
-                 remove.appendChild(document.createTextNode('<remove format>'));
 
-                 (function () {
 
-                     remove.onclick = removeOnClickEventHandler;
 
-                 })();
 
-                 span = document.createElement('span');
 
-                 span.style.marginTop = '2px';
 
-                 span.appendChild(remove);
 
-                 self.cheditor.tagPath.appendChild(span);
 
-             }
 
-         }
 
-         self.toolbarUpdate(srcElement);
 
-     },
 
-     tagSelector: function (node) {
 
-         var rng, selection;
 
-         this.editAreaFocus();
 
-         if (this.W3CRange) {
 
-             selection = this.editArea.getSelection();
 
-             if (this.undefined(selection)) {
 
-                 return;
 
-             }
 
-             try {
 
-                 rng = selection.getRangeAt(0);
 
-             } catch (e) {
 
-                 return;
 
-             }
 
-             rng.selectNodeContents(node);
 
-             selection.removeAllRanges();
 
-             selection.addRange(rng);
 
-         } else {
 
-             rng = this.doc.body.createTextRange();
 
-             if (rng) {
 
-                 rng.moveToElementText(node);
 
-                 rng.select();
 
-             }
 
-         }
 
-     },
 
-     getBrowser: function () {
 
-         return GB.browser;
 
-     },
 
-     $: function (id) {
 
-         return this.doc.getElementById(id);
 
-     }
 
- };
 
- (function () {
 
-     var dragWindow = {
 
-         obj: null,
 
-         init: function (o, oRoot, minX, maxX, minY, maxY) {
 
-             o.style.curser = 'default';
 
-             o.onmousedown = dragWindow.start;
 
-             o.onmouseover = function () {
 
-                 this.style.cursor = 'move';
 
-             };
 
-             o.hmode = true;
 
-             o.vmode = true;
 
-             o.root = (oRoot && oRoot !== null) ? oRoot : o;
 
-             o.transId = oRoot.id + '_Trans';
 
-             if (o.hmode && isNaN(parseInt(o.root.style.left, 10))) {
 
-                 o.root.style.left = '0px';
 
-             }
 
-             if (o.vmode && isNaN(parseInt(o.root.style.top, 10))) {
 
-                 o.root.style.top = '0px';
 
-             }
 
-             if (!o.hmode && isNaN(parseInt(o.root.style.right, 10))) {
 
-                 o.root.style.right = '0px';
 
-             }
 
-             if (!o.vmode && isNaN(parseInt(o.root.style.bottom, 10))) {
 
-                 o.root.style.bottom = '0px';
 
-             }
 
-             o.minX = minX !== undefined ? minX : null;
 
-             o.minY = minY !== undefined ? minY : null;
 
-             o.maxX = maxX !== undefined ? maxX : null;
 
-             o.maxY = maxY !== undefined ? maxY : null;
 
-             o.root.onDragStart = new Function();
 
-             o.root.onDragEnd = new Function();
 
-             o.root.onDrag = new Function();
 
-         },
 
-         start: function (e) {
 
-             var o = dragWindow.obj = this,
 
-                 dragTransBg = document.createElement('div'),
 
-                 y = parseInt(o.vmode ? o.root.style.top : o.root.style.bottom, 10),
 
-                 x = parseInt(o.hmode ? o.root.style.left : o.root.style.right, 10);
 
-             e = dragWindow.fixEv(e);
 
-             o.root.onDragStart(x, y);
 
-             o.lastMouseX = e.clientX;
 
-             o.lastMouseY = e.clientY;
 
-             document.onmousemove = dragWindow.drag;
 
-             document.onmouseup = dragWindow.end;
 
-             if (o.root.lastChild.id === o.transId) {
 
-                 return false;
 
-             }
 
-             dragTransBg.className = 'cheditor-dragWindowTransparent';
 
-             if (GB.browser.msie && GB.browser.version < 10) {
 
-                 dragTransBg.style.filter = 'alpha(opacity=0)';
 
-             } else {
 
-                 dragTransBg.style.opacity = 0;
 
-             }
 
-             dragTransBg.id = o.transId;
 
-             dragTransBg.style.width = o.root.lastChild.firstChild.style.width;
 
-             dragTransBg.style.height = o.root.lastChild.firstChild.style.height;
 
-             o.root.appendChild(dragTransBg);
 
-             return false;
 
-         },
 
-         drag: function (e) {
 
-             e = dragWindow.fixEv(e);
 
-             var o = dragWindow.obj,
 
-                 ey = e.clientY,
 
-                 ex = e.clientX,
 
-                 y = parseInt(o.vmode ? o.root.style.top : o.root.style.bottom, 10),
 
-                 x = parseInt(o.hmode ? o.root.style.left : o.root.style.right, 10),
 
-                 nx, ny;
 
-             nx = x + ((ex - o.lastMouseX) * (o.hmode ? 1 : -1));
 
-             ny = y + ((ey - o.lastMouseY) * (o.vmode ? 1 : -1));
 
-             dragWindow.obj.root.style.left = nx + 'px';
 
-             dragWindow.obj.root.style.top = ny + 'px';
 
-             dragWindow.obj.lastMouseX = ex;
 
-             dragWindow.obj.lastMouseY = ey;
 
-             dragWindow.obj.root.onDrag(nx, ny);
 
-             return false;
 
-         },
 
-         end: function () {
 
-             document.onmousemove = null;
 
-             document.onmouseup = null;
 
-             dragWindow.obj.root.onDragEnd(parseInt(dragWindow.obj.root.style[dragWindow.obj.hmode ? 'left' : 'right'], 10),
 
-                     parseInt(dragWindow.obj.root.style[dragWindow.obj.vmode ? 'top' : 'bottom'], 10));
 
-             if (dragWindow.obj.root.lastChild.id === dragWindow.obj.transId) {
 
-                 dragWindow.obj.root.removeChild(dragWindow.obj.root.lastChild);
 
-             }
 
-             dragWindow.obj = null;
 
-         },
 
-         fixEv: function (e) {
 
-             if (e === undefined) {
 
-                 e = window.event;
 
-             }
 
-             if (e.layerX === undefined) {
 
-                 e.layerX = e.offsetX;
 
-             }
 
-             if (e.layerY === undefined) {
 
-                 e.layerY = e.offsetY;
 
-             }
 
-             return e;
 
-         }
 
-     };
 
-     GB.dragWindow = dragWindow;
 
- })();
 
- // --------------------------------------------------------------------------
 
- // W3C DOM Range
 
- //
 
- // --------------------------------------------------------------------------
 
- // Table
 
- //
 
- // --------------------------------------------------------------------------
 
- // Color Picker
 
- //
 
- (function () {
 
-     var colorDropper = {
 
-         images: { pad: [181, 101], sld: [16, 101], cross: [15, 15], arrow: [7, 11] },
 
-         fetchElement: function (mixed) {
 
-             return typeof mixed === 'string' ? document.getElementById(mixed) : mixed;
 
-         },
 
-         addEvent: function (el, evnt, func) {
 
-             if (el.addEventListener) {
 
-                 el.addEventListener(evnt, func, false);
 
-             } else if (el.attachEvent) {
 
-                 el.attachEvent('on' + evnt, func);
 
-             }
 
-         },
 
-         fireEvent: function (el, evnt) {
 
-             if (!el) {
 
-                 return;
 
-             }
 
-             var ev;
 
-             if (document.createEvent) {
 
-                 ev = document.createEvent('HTMLEvents');
 
-                 ev.initEvent(evnt, true, true);
 
-                 el.dispatchEvent(ev);
 
-             } else if (document.createEventObject) {
 
-                 ev = document.createEventObject();
 
-                 el.fireEvent('on' + evnt, ev);
 
-             } else if (el['on' + evnt]) {
 
-                 el['on' + evnt]();
 
-             }
 
-         },
 
-         getElementPos: function (e) {
 
-             var e1 = e, e2 = e, x = 0, y = 0;
 
-             if (e1.offsetParent) {
 
-                 do {
 
-                     x += e1.offsetLeft;
 
-                     y += e1.offsetTop;
 
-                     e1 = e1.offsetParent;
 
-                 } while (e1);
 
-             }
 
-             while (e2 && e2.nodeName.toLowerCase() !== 'body') {
 
-                 x -= e2.scrollLeft;
 
-                 y -= e2.scrollTop;
 
-                 e2 = e2.parentNode;
 
-             }
 
-             return [x, y];
 
-         },
 
-         getElementSize: function (e) {
 
-             return [e.offsetWidth, e.offsetHeight];
 
-         },
 
-         getRelMousePos: function (e) {
 
-             var x = 0, y = 0;
 
-             if (!e) {
 
-                 e = window.event;
 
-             }
 
-             if (typeof e.offsetX === 'number') {
 
-                 x = e.offsetX;
 
-                 y = e.offsetY;
 
-             } else if (typeof e.layerX === 'number') {
 
-                 x = e.layerX;
 
-                 y = e.layerY;
 
-             }
 
-             return { x: x, y: y };
 
-         },
 
-         color: function (target, prop) {
 
-             this.required = true;
 
-             this.adjust = true;
 
-             this.hash = true;
 
-             this.caps = false;
 
-             this.valueElement = target;
 
-             this.styleElement = target;
 
-             this.onImmediateChange = null;
 
-             this.hsv = [0, 0, 1];
 
-             this.rgb = [1, 1, 1];
 
-             this.minH = 0;
 
-             this.maxH = 6;
 
-             this.minS = 0;
 
-             this.maxS = 1;
 
-             this.minV = 0;
 
-             this.maxV = 1;
 
-             this.pickerOnfocus = true;
 
-             this.pickerMode = 'HSV';
 
-             this.pickerFace = 3;
 
-             this.pickerFaceColor = '#fff';
 
-             this.pickerInset = 1;
 
-             this.pickerInsetColor = '#999';
 
-             this.pickerZIndex = 10003;
 
-             var p,
 
-                 self = this,
 
-                 modeID = this.pickerMode.toLowerCase() === 'hvs' ? 1 : 0,
 
-                 abortBlur = false,
 
-                 valueElement = colorDropper.fetchElement(this.valueElement), styleElement = colorDropper.fetchElement(this.styleElement),
 
-                 holdPad = false, holdSld = false, touchOffset = {},
 
-                 leaveValue = 1 << 0, leaveStyle = 1 << 1, leavePad = 1 << 2, leaveSld = 1 << 3,
 
-                 updateFieldEventHandler = function () {
 
-                     self.fromString(valueElement.value, leaveValue);
 
-                     dispatchImmediateChange();
 
-                 };
 
-             colorDropper.addEvent(target, 'blur', function () {
 
-                 if (!abortBlur) {
 
-                     window.setTimeout(function () {
 
-                         abortBlur || blurTarget();
 
-                         abortBlur = false;
 
-                     }, 0);
 
-                 } else {
 
-                     abortBlur = false;
 
-                 }
 
-             });
 
-             for (p in prop) {
 
-                 if (prop.hasOwnProperty(p)) {
 
-                     this[p] = prop[p];
 
-                 }
 
-             }
 
-             this.hidePicker = function () {
 
-                 if (isPickerOwner()) {
 
-                     removePicker();
 
-                 }
 
-             };
 
-             this.showPicker = function () {
 
-                 if (!isPickerOwner()) {
 
-                     drawPicker();
 
-                 }
 
-             };
 
-             this.importColor = function () {
 
-                 if (!valueElement) {
 
-                     this.exportColor();
 
-                 } else {
 
-                     if (!this.adjust) {
 
-                         if (!this.fromString(valueElement.value, leaveValue)) {
 
-                             styleElement.style.backgroundImage = styleElement.jscStyle.backgroundImage;
 
-                             styleElement.style.backgroundColor = styleElement.jscStyle.backgroundColor;
 
-                             styleElement.style.color = styleElement.jscStyle.color;
 
-                             this.exportColor(leaveValue | leaveStyle);
 
-                         }
 
-                     } else if (!this.required && /^\s*$/.test(valueElement.value)) {
 
-                         valueElement.value = '';
 
-                         styleElement.style.backgroundImage = styleElement.jscStyle.backgroundImage;
 
-                         styleElement.style.backgroundColor = styleElement.jscStyle.backgroundColor;
 
-                         styleElement.style.color = styleElement.jscStyle.color;
 
-                         this.exportColor(leaveValue | leaveStyle);
 
-                     } else if (this.fromString(valueElement.value)) {
 
-                         // ignore
 
-                     } else {
 
-                         this.exportColor();
 
-                     }
 
-                 }
 
-             };
 
-             this.exportColor = function (flags) {
 
-                 if (!(flags & leaveValue) && valueElement) {
 
-                     var value = this.toString();
 
-                     if (this.caps) {
 
-                         value = value.toUpperCase();
 
-                     }
 
-                     if (this.hash) {
 
-                         value = '#' + value;
 
-                     }
 
-                     valueElement.value = value;
 
-                 }
 
-                 if (!(flags & leaveStyle) && styleElement) {
 
-                     styleElement.style.backgroundImage = 'none';
 
-                     styleElement.style.backgroundColor = '#' + this.toString();
 
-                     styleElement.style.color = 0.213 * this.rgb[0] + 0.715 * this.rgb[1] + 0.072 * this.rgb[2] < 0.5 ? '#FFF' : '#000';
 
-                 }
 
-                 if (!(flags & leavePad) && isPickerOwner()) {
 
-                     redrawPad();
 
-                 }
 
-                 if (!(flags & leaveSld) && isPickerOwner()) {
 
-                     redrawSld();
 
-                 }
 
-             };
 
-             this.fromHSV = function (h, s, v, flags) {
 
-                 if (h) {
 
-                     h = Math.max(0.0, this.minH, Math.min(6.0, this.maxH, h));
 
-                 }
 
-                 if (s) {
 
-                     s = Math.max(0.0, this.minS, Math.min(1.0, this.maxS, s));
 
-                 }
 
-                 if (v) {
 
-                     v = Math.max(0.0, this.minV, Math.min(1.0, this.maxV, v));
 
-                 }
 
-                 this.rgb = this.HSV_RGB(
 
-                     h === null ? this.hsv[0] : (this.hsv[0] = h),
 
-                     s === null ? this.hsv[1] : (this.hsv[1] = s),
 
-                     v === null ? this.hsv[2] : (this.hsv[2] = v)
 
-                 );
 
-                 this.exportColor(flags);
 
-             };
 
-             this.fromRGB = function (r, g, b, flags) {
 
-                 if (r) {
 
-                     r = Math.max(0.0, Math.min(1.0, r));
 
-                 }
 
-                 if (g) {
 
-                     g = Math.max(0.0, Math.min(1.0, g));
 
-                 }
 
-                 if (b) {
 
-                     b = Math.max(0.0, Math.min(1.0, b));
 
-                 }
 
-                 var hsv = this.RGB_HSV(
 
-                     r === null ? this.rgb[0] : r,
 
-                     g === null ? this.rgb[1] : g,
 
-                     b === null ? this.rgb[2] : b
 
-                 );
 
-                 if (hsv[0] !== null) {
 
-                     this.hsv[0] = Math.max(0.0, this.minH, Math.min(6.0, this.maxH, hsv[0]));
 
-                 }
 
-                 if (hsv[2] !== 0) {
 
-                     this.hsv[1] = hsv[1] === null ? null : Math.max(0.0, this.minS, Math.min(1.0, this.maxS, hsv[1]));
 
-                 }
 
-                 this.hsv[2] = hsv[2] === null ? null : Math.max(0.0, this.minV, Math.min(1.0, this.maxV, hsv[2]));
 
-                 var rgb = this.HSV_RGB(this.hsv[0], this.hsv[1], this.hsv[2]);
 
-                 this.rgb[0] = rgb[0];
 
-                 this.rgb[1] = rgb[1];
 
-                 this.rgb[2] = rgb[2];
 
-                 this.exportColor(flags);
 
-             };
 
-             this.fromString = function (hex, flags) {
 
-                 var m = hex.match(/^\W*([0-9A-F]{3}([0-9A-F]{3})?)\W*$/i);
 
-                 if (!m) {
 
-                     return false;
 
-                 }
 
-                 if (m[1].length === 6) {
 
-                     this.fromRGB(
 
-                         parseInt(m[1].substr(0, 2), 16) / 255,
 
-                         parseInt(m[1].substr(2, 2), 16) / 255,
 
-                         parseInt(m[1].substr(4, 2), 16) / 255,
 
-                         flags
 
-                     );
 
-                 } else {
 
-                     this.fromRGB(
 
-                         parseInt(m[1].charAt(0) + m[1].charAt(0), 16) / 255,
 
-                         parseInt(m[1].charAt(1) + m[1].charAt(1), 16) / 255,
 
-                         parseInt(m[1].charAt(2) + m[1].charAt(2), 16) / 255,
 
-                         flags
 
-                     );
 
-                 }
 
-                 return true;
 
-             };
 
-             this.toString = function () {
 
-                 return (
 
-                     (0x100 | Math.round(255 * this.rgb[0])).toString(16).substr(1) +
 
-                     (0x100 | Math.round(255 * this.rgb[1])).toString(16).substr(1) +
 
-                     (0x100 | Math.round(255 * this.rgb[2])).toString(16).substr(1)
 
-                 );
 
-             };
 
-             this.RGB_HSV = function (r, g, b) {
 
-                 var n = Math.min(Math.min(r, g), b),
 
-                     v = Math.max(Math.max(r, g), b),
 
-                     m = v - n, h;
 
-                 if (m === 0) {
 
-                     return [null, 0, v];
 
-                 }
 
-                 h = r === n ? 3 + (b - g) / m : (g === n ? 5 + (r - b) / m : 1 + (g - r) / m);
 
-                 return [h === 6 ? 0 : h, m / v, v];
 
-             };
 
-             this.HSV_RGB = function (h, s, v) {
 
-                 if (h === null) {
 
-                     return [v, v, v];
 
-                 }
 
-                 var i = Math.floor(h),
 
-                     f = i % 2 ? h - i : 1 - (h - i),
 
-                     m = v * (1 - s),
 
-                     n = v * (1 - s * f);
 
-                 switch (i) {
 
-                     case 6:
 
-                     case 0:
 
-                         return [v, n, m];
 
-                     case 1:
 
-                         return [n, v, m];
 
-                     case 2:
 
-                         return [m, v, n];
 
-                     case 3:
 
-                         return [m, n, v];
 
-                     case 4:
 
-                         return [n, m, v];
 
-                     case 5:
 
-                         return [v, m, n];
 
-                 }
 
-             };
 
-             function removePicker() {
 
-                 delete colorDropper.picker.owner;
 
-                 colorDropper.picker.boxB.parentNode.removeChild(colorDropper.picker.boxB);
 
-             }
 
-             function drawPicker() {
 
-                 var touchMoveEventHandler = function (e) {
 
-                     var event = {
 
-                         'offsetX': e.touches[0].pageX - touchOffset.X,
 
-                         'offsetY': e.touches[0].pageY - touchOffset.Y
 
-                     };
 
-                     if (holdPad || holdSld) {
 
-                         holdPad && setPad(event);
 
-                         holdSld && setSld(event);
 
-                         dispatchImmediateChange();
 
-                     }
 
-                     e.stopPropagation();
 
-                     e.preventDefault();
 
-                 },
 
-                     dims = getPickerDims(self),
 
-                     padImg = modeID ? 'color_picker_hv.png' : 'color_picker_hs.png',
 
-                     i, seg, segSize;
 
-                 if (!colorDropper.picker) {
 
-                     colorDropper.picker = {
 
-                         box: document.createElement('div'),
 
-                         boxB: document.createElement('div'),
 
-                         pad: document.createElement('div'),
 
-                         padB: document.createElement('div'),
 
-                         padM: document.createElement('div'),
 
-                         sld: document.createElement('div'),
 
-                         sldB: document.createElement('div'),
 
-                         sldM: document.createElement('div')
 
-                     };
 
-                     for (i = 0, segSize = 2; i < colorDropper.images.sld[1]; i += segSize) {
 
-                         seg = document.createElement('div');
 
-                         seg.style.height = segSize + 'px';
 
-                         seg.style.fontSize = '1px';
 
-                         seg.style.lineHeight = '0px';
 
-                         colorDropper.picker.sld.appendChild(seg);
 
-                     }
 
-                     colorDropper.picker.sldB.appendChild(colorDropper.picker.sld);
 
-                     colorDropper.picker.box.appendChild(colorDropper.picker.sldB);
 
-                     colorDropper.picker.box.appendChild(colorDropper.picker.sldM);
 
-                     colorDropper.picker.padB.appendChild(colorDropper.picker.pad);
 
-                     colorDropper.picker.box.appendChild(colorDropper.picker.padB);
 
-                     colorDropper.picker.box.appendChild(colorDropper.picker.padM);
 
-                     colorDropper.picker.boxB.appendChild(colorDropper.picker.box);
 
-                 }
 
-                 p = colorDropper.picker;
 
-                 p.box.onmouseup = p.box.onmouseout = function () {
 
-                     target.focus();
 
-                 };
 
-                 p.box.onmousedown = function () {
 
-                     abortBlur = true;
 
-                 };
 
-                 p.box.onmousemove = function (e) {
 
-                     if (holdPad || holdSld) {
 
-                         holdPad && setPad(e);
 
-                         holdSld && setSld(e);
 
-                         if (document.selection) {
 
-                             document.selection.empty();
 
-                         } else if (window.getSelection) {
 
-                             window.getSelection().removeAllRanges();
 
-                         }
 
-                         dispatchImmediateChange();
 
-                     }
 
-                 };
 
-                 if ('ontouchstart' in window) {
 
-                     p.box.removeEventListener('touchmove', touchMoveEventHandler, false);
 
-                     p.box.addEventListener('touchmove', touchMoveEventHandler, false);
 
-                 }
 
-                 p.padM.onmouseup = p.padM.onmouseout = function () {
 
-                     if (holdPad) {
 
-                         holdPad = false;
 
-                         colorDropper.fireEvent(valueElement, 'change');
 
-                     }
 
-                 };
 
-                 p.padM.onmousedown = function (e) {
 
-                     switch (modeID) {
 
-                         case 0:
 
-                             if (self.hsv[2] === 0) {
 
-                                 self.fromHSV(null, null, 1.0);
 
-                             }
 
-                             break;
 
-                         case 1:
 
-                             if (self.hsv[1] === 0) {
 
-                                 self.fromHSV(null, 1.0, null);
 
-                             }
 
-                             break;
 
-                     }
 
-                     holdSld = false;
 
-                     holdPad = true;
 
-                     setPad(e);
 
-                     dispatchImmediateChange();
 
-                 };
 
-                 if ('ontouchstart' in window) {
 
-                     p.padM.addEventListener('touchstart', function (e) {
 
-                         touchOffset = { 'X': getOffsetParent(e.target).Left, 'Y': getOffsetParent(e.target).Top };
 
-                         this.onmousedown({
 
-                             'offsetX': e.touches[0].pageX - touchOffset.X,
 
-                             'offsetY': e.touches[0].pageY - touchOffset.Y
 
-                         });
 
-                     });
 
-                 }
 
-                 p.sldM.onmouseup = p.sldM.onmouseout = function () {
 
-                     if (holdSld) {
 
-                         holdSld = false;
 
-                         colorDropper.fireEvent(valueElement, 'change');
 
-                     }
 
-                 };
 
-                 p.sldM.onmousedown = function (e) {
 
-                     holdPad = false;
 
-                     holdSld = true;
 
-                     setSld(e);
 
-                     dispatchImmediateChange();
 
-                 };
 
-                 if ('ontouchstart' in window) {
 
-                     p.sldM.addEventListener('touchstart', function (e) {
 
-                         touchOffset = { 'X': getOffsetParent(e.target).Left, 'Y': getOffsetParent(e.target).Top };
 
-                         this.onmousedown({
 
-                             'offsetX': e.touches[0].pageX - touchOffset.X,
 
-                             'offsetY': e.touches[0].pageY - touchOffset.Y
 
-                         });
 
-                     });
 
-                 }
 
-                 p.box.style.width = dims[0] + 'px';
 
-                 p.box.style.height = dims[1] + 'px';
 
-                 p.boxB.style.position = 'relative';
 
-                 p.boxB.style.clear = 'both';
 
-                 p.boxB.style.border = 'none';
 
-                 p.boxB.style.background = self.pickerFaceColor;
 
-                 p.pad.style.width = colorDropper.images.pad[0] + 'px';
 
-                 p.pad.style.height = colorDropper.images.pad[1] + 'px';
 
-                 p.padB.style.position = 'absolute';
 
-                 p.padB.style.left = self.pickerFace + 'px';
 
-                 p.padB.style.top = self.pickerFace + 'px';
 
-                 p.padB.style.border = self.pickerInset + 'px solid';
 
-                 p.padB.style.borderColor = self.pickerInsetColor;
 
-                 p.padM.style.position = 'absolute';
 
-                 p.padM.style.left = '0';
 
-                 p.padM.style.top = '0';
 
-                 p.padM.style.width = self.pickerFace + 2 * self.pickerInset + colorDropper.images.pad[0] + colorDropper.images.arrow[0] + 'px';
 
-                 p.padM.style.height = p.box.style.height;
 
-                 p.padM.style.cursor = 'crosshair';
 
-                 p.sld.style.overflow = 'hidden';
 
-                 p.sld.style.width = '13px';
 
-                 p.sld.style.height = colorDropper.images.sld[1] + 'px';
 
-                 p.sldB.style.position = 'absolute';
 
-                 p.sldB.style.right = self.pickerFace + 'px';
 
-                 p.sldB.style.top = self.pickerFace + 'px';
 
-                 p.sldB.style.border = self.pickerInset + 'px solid';
 
-                 p.sldB.style.borderColor = self.pickerInsetColor;
 
-                 p.sldM.style.position = 'absolute';
 
-                 p.sldM.style.right = '0';
 
-                 p.sldM.style.top = '0';
 
-                 p.sldM.style.width = 14 + colorDropper.images.arrow[0] + self.pickerFace + 2 * self.pickerInset + 'px';
 
-                 p.sldM.style.height = p.box.style.height;
 
-                 try {
 
-                     p.sldM.style.cursor = 'pointer';
 
-                 } catch (e) {
 
-                     p.sldM.style.cursor = 'hand';
 
-                 }
 
-                 p.padM.style.backgroundImage = 'url("' + self.iconDir + '/color_picker_cross.gif")';
 
-                 p.padM.style.backgroundRepeat = 'no-repeat';
 
-                 p.sldM.style.backgroundImage = 'url("' + self.iconDir + '/color_picker_arrow.gif")';
 
-                 p.sldM.style.backgroundRepeat = 'no-repeat';
 
-                 p.pad.style.backgroundImage = 'url("' + self.iconDir + '/' + padImg + '")';
 
-                 p.pad.style.backgroundRepeat = 'no-repeat';
 
-                 p.pad.style.backgroundPosition = '0 0';
 
-                 redrawPad();
 
-                 redrawSld();
 
-                 colorDropper.picker.owner = self;
 
-                 target.parentNode.parentNode.appendChild(p.boxB);
 
-             }
 
-             function getPickerDims(o) {
 
-                 return [2 * o.pickerInset + 2 * o.pickerFace + colorDropper.images.pad[0] +
 
-                 2 * o.pickerInset + 2 * colorDropper.images.arrow[0] + colorDropper.images.sld[0],
 
-                     2 * o.pickerInset + 2 * o.pickerFace + colorDropper.images.pad[1]];
 
-             }
 
-             function redrawPad() {
 
-                 var yComponent, x, y, i = 0, rgb, s, c, f,
 
-                     seg = colorDropper.picker.sld.childNodes;
 
-                 switch (modeID) {
 
-                     case 0:
 
-                         yComponent = 1;
 
-                         break;
 
-                     case 1:
 
-                         yComponent = 2;
 
-                         break;
 
-                 }
 
-                 x = Math.round((self.hsv[0] / 6) * (colorDropper.images.pad[0] - 1));
 
-                 y = Math.round((1 - self.hsv[yComponent]) * (colorDropper.images.pad[1] - 1));
 
-                 colorDropper.picker.padM.style.backgroundPosition =
 
-                     (self.pickerFace + self.pickerInset + x - Math.floor(colorDropper.images.cross[0] / 2)) + 'px ' +
 
-                     (self.pickerFace + self.pickerInset + y - Math.floor(colorDropper.images.cross[1] / 2)) + 'px';
 
-                 switch (modeID) {
 
-                     case 0:
 
-                         rgb = self.HSV_RGB(self.hsv[0], self.hsv[1], 1);
 
-                         if (window.File && window.FileReader) {
 
-                             colorDropper.picker.sld.style.background = 'linear-gradient(rgb(' +
 
-                                 (rgb[0] * (1 - i / seg.length) * 100) + '%,' +
 
-                                 (rgb[1] * (1 - i / seg.length) * 100) + '%,' +
 
-                                 (rgb[2] * (1 - i / seg.length) * 100) + '%), black)';
 
-                         } else {
 
-                             for (i = 0; i < seg.length; i += 1) {
 
-                                 seg[i].style.backgroundColor = 'rgb(' +
 
-                                     (rgb[0] * (1 - i / seg.length) * 100) + '%,' +
 
-                                     (rgb[1] * (1 - i / seg.length) * 100) + '%,' +
 
-                                     (rgb[2] * (1 - i / seg.length) * 100) + '%)';
 
-                             }
 
-                         }
 
-                         break;
 
-                     case 1:
 
-                         c = [self.hsv[2], 0, 0];
 
-                         i = Math.floor(self.hsv[0]);
 
-                         f = i % 2 ? self.hsv[0] - i : 1 - (self.hsv[0] - i);
 
-                         switch (i) {
 
-                             case 6:
 
-                             case 0:
 
-                                 rgb = [0, 1, 2];
 
-                                 break;
 
-                             case 1:
 
-                                 rgb = [1, 0, 2];
 
-                                 break;
 
-                             case 2:
 
-                                 rgb = [2, 0, 1];
 
-                                 break;
 
-                             case 3:
 
-                                 rgb = [2, 1, 0];
 
-                                 break;
 
-                             case 4:
 
-                                 rgb = [1, 2, 0];
 
-                                 break;
 
-                             case 5:
 
-                                 rgb = [0, 2, 1];
 
-                                 break;
 
-                         }
 
-                         for (i = 0; i < seg.length; i += 1) {
 
-                             s = 1 - 1 / (seg.length - 1) * i;
 
-                             c[1] = c[0] * (1 - s * f);
 
-                             c[2] = c[0] * (1 - s);
 
-                             seg[i].style.backgroundColor = 'rgb(' +
 
-                                 (c[rgb[0]] * 100) + '%,' +
 
-                                 (c[rgb[1]] * 100) + '%,' +
 
-                                 (c[rgb[2]] * 100) + '%)';
 
-                         }
 
-                         break;
 
-                 }
 
-             }
 
-             function getOffsetParent(el) {
 
-                 var parent = el.offsetParent, top = 0, left = 0;
 
-                 while (parent) {
 
-                     top += parent.offsetTop;
 
-                     left += parent.offsetLeft;
 
-                     parent = parent.offsetParent;
 
-                 }
 
-                 return { Left: left, Top: top };
 
-             }
 
-             function redrawSld() {
 
-                 var yComponent, y;
 
-                 switch (modeID) {
 
-                     case 0:
 
-                         yComponent = 2;
 
-                         break;
 
-                     case 1:
 
-                         yComponent = 1;
 
-                         break;
 
-                 }
 
-                 y = Math.round((1 - self.hsv[yComponent]) * (colorDropper.images.sld[1] - 1));
 
-                 colorDropper.picker.sldM.style.backgroundPosition =
 
-                     '0 ' + (self.pickerFace + self.pickerInset + y - Math.floor(colorDropper.images.arrow[1] / 2)) + 'px';
 
-             }
 
-             function isPickerOwner() {
 
-                 return colorDropper.picker && colorDropper.picker.owner === self;
 
-             }
 
-             function blurTarget() {
 
-                 if (valueElement === target) {
 
-                     self.importColor();
 
-                 }
 
-             }
 
-             function blurValue() {
 
-                 if (valueElement !== target) {
 
-                     self.importColor();
 
-                 }
 
-             }
 
-             function setPad(e) {
 
-                 var mpos = colorDropper.getRelMousePos(e),
 
-                     x = mpos.x - self.pickerFace - self.pickerInset,
 
-                     y = mpos.y - self.pickerFace - self.pickerInset;
 
-                 switch (modeID) {
 
-                     case 0:
 
-                         self.fromHSV(x * (6 / (colorDropper.images.pad[0] - 1)), 1 - y / (colorDropper.images.pad[1] - 1), null, leaveSld);
 
-                         break;
 
-                     case 1:
 
-                         self.fromHSV(x * (6 / (colorDropper.images.pad[0] - 1)), null, 1 - y / (colorDropper.images.pad[1] - 1), leaveSld);
 
-                         break;
 
-                 }
 
-             }
 
-             function setSld(e) {
 
-                 var mpos = colorDropper.getRelMousePos(e),
 
-                     y = mpos.y - self.pickerFace - self.pickerInset;
 
-                 switch (modeID) {
 
-                     case 0:
 
-                         self.fromHSV(null, null, 1 - y / (colorDropper.images.sld[1] - 1), leavePad);
 
-                         break;
 
-                     case 1:
 
-                         self.fromHSV(null, 1 - y / (colorDropper.images.sld[1] - 1), null, leavePad);
 
-                         break;
 
-                 }
 
-             }
 
-             function dispatchImmediateChange() {
 
-                 if (self.onImmediateChange) {
 
-                     var callback;
 
-                     if (typeof self.onImmediateChange === 'string') {
 
-                         callback = new Function(self.onImmediateChange);
 
-                     } else {
 
-                         callback = self.onImmediateChange;
 
-                     }
 
-                     callback.call(self);
 
-                 }
 
-             }
 
-             if (valueElement) {
 
-                 colorDropper.addEvent(valueElement, 'keyup', updateFieldEventHandler);
 
-                 colorDropper.addEvent(valueElement, 'input', updateFieldEventHandler);
 
-                 colorDropper.addEvent(valueElement, 'blur', blurValue);
 
-                 valueElement.setAttribute('autocomplete', 'off');
 
-             }
 
-             this.importColor();
 
-         }
 
-     };
 
-     GB.colorDropper = colorDropper.color;
 
- })();
 
 
  |