var sfolder = ''; var extravote_text=Array('Ваш браузер не поддерживает AJAX','Загрузка...','Благодарим за оценку','Вы должны выполнить вход','Вы уже голосовали','',''); (function(e,t){function i(t,n){var r,i,o,u=t.nodeName.toLowerCase();return"area"===u?(r=t.parentNode,i=r.name,!t.href||!i||r.nodeName.toLowerCase()!=="map"?!1:(o=e("img[usemap=#"+i+"]")[0],!!o&&s(o))):(/input|select|textarea|button|object/.test(u)?!t.disabled:"a"===u?t.href||n:n)&&s(t)}function s(t){return!e(t).parents().andSelf().filter(function(){return e.css(this,"visibility")==="hidden"||e.expr.filters.hidden(this)}).length}var n=0,r=/^ui-id-\d+$/;e.ui=e.ui||{};if(e.ui.version)return;e.extend(e.ui,{version:"1.9.0",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),e.fn.extend({_focus:e.fn.focus,focus:function(t,n){return typeof t=="number"?this.each(function(){var r=this;setTimeout(function(){e(r).focus(),n&&n.call(r)},t)}):this._focus.apply(this,arguments)},scrollParent:function(){var t;return e.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?t=this.parents().filter(function(){return/(relative|absolute|fixed)/.test(e.css(this,"position"))&&/(auto|scroll)/.test(e.css(this,"overflow")+e.css(this,"overflow-y")+e.css(this,"overflow-x"))}).eq(0):t=this.parents().filter(function(){return/(auto|scroll)/.test(e.css(this,"overflow")+e.css(this,"overflow-y")+e.css(this,"overflow-x"))}).eq(0),/fixed/.test(this.css("position"))||!t.length?e(document):t},zIndex:function(n){if(n!==t)return this.css("zIndex",n);if(this.length){var r=e(this[0]),i,s;while(r.length&&r[0]!==document){i=r.css("position");if(i==="absolute"||i==="relative"||i==="fixed"){s=parseInt(r.css("zIndex"),10);if(!isNaN(s)&&s!==0)return s}r=r.parent()}}return 0},uniqueId:function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++n)})},removeUniqueId:function(){return this.each(function(){r.test(this.id)&&e(this).removeAttr("id")})}}),e("").outerWidth(1).jquery||e.each(["Width","Height"],function(n,r){function u(t,n,r,s){return e.each(i,function(){n-=parseFloat(e.css(t,"padding"+this))||0,r&&(n-=parseFloat(e.css(t,"border"+this+"Width"))||0),s&&(n-=parseFloat(e.css(t,"margin"+this))||0)}),n}var i=r==="Width"?["Left","Right"]:["Top","Bottom"],s=r.toLowerCase(),o={innerWidth:e.fn.innerWidth,innerHeight:e.fn.innerHeight,outerWidth:e.fn.outerWidth,outerHeight:e.fn.outerHeight};e.fn["inner"+r]=function(n){return n===t?o["inner"+r].call(this):this.each(function(){e(this).css(s,u(this,n)+"px")})},e.fn["outer"+r]=function(t,n){return typeof t!="number"?o["outer"+r].call(this,t):this.each(function(){e(this).css(s,u(this,t,!0,n)+"px")})}}),e.extend(e.expr[":"],{data:e.expr.createPseudo?e.expr.createPseudo(function(t){return function(n){return!!e.data(n,t)}}):function(t,n,r){return!!e.data(t,r[3])},focusable:function(t){return i(t,!isNaN(e.attr(t,"tabindex")))},tabbable:function(t){var n=e.attr(t,"tabindex"),r=isNaN(n);return(r||n>=0)&&i(t,!r)}}),e(function(){var t=document.body,n=t.appendChild(n=document.createElement("div"));n.offsetHeight,e.extend(n.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0}),e.support.minHeight=n.offsetHeight===100,e.support.selectstart="onselectstart"in n,t.removeChild(n).style.display="none"}),e.fn.extend({disableSelection:function(){return this.bind((e.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(e){e.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),e.extend(e.ui,{plugin:{add:function(t,n,r){var i,s=e.ui[t].prototype;for(i in r)s.plugins[i]=s.plugins[i]||[],s.plugins[i].push([n,r[i]])},call:function(e,t,n){var r,i=e.plugins[t];if(!i||!e.element[0].parentNode||e.element[0].parentNode.nodeType===11)return;for(r=0;r0?!0:(t[r]=1,i=t[r]>0,t[r]=0,i)},isOverAxis:function(e,t,n){return e>t&&e",options:{disabled:!1,create:null},_createWidget:function(t,r){r=e(r||this.defaultElement||this)[0],this.element=e(r),this.uuid=n++,this.eventNamespace="."+this.widgetName+this.uuid,this.options=e.widget.extend({},this.options,this._getCreateOptions(),t),this.bindings=e(),this.hoverable=e(),this.focusable=e(),r!==this&&(e.data(r,this.widgetName,this),e.data(r,this.widgetFullName,this),this._on({remove:"destroy"}),this.document=e(r.style?r.ownerDocument:r.document||r),this.window=e(this.document[0].defaultView||this.document[0].parentWindow)),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:e.noop,_getCreateEventData:e.noop,_create:e.noop,_init:e.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetName).removeData(this.widgetFullName).removeData(e.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled "+"ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:e.noop,widget:function(){return this.element},option:function(n,r){var i=n,s,o,u;if(arguments.length===0)return e.widget.extend({},this.options);if(typeof n=="string"){i={},s=n.split("."),n=s.shift();if(s.length){o=i[n]=e.widget.extend({},this.options[n]);for(u=0;u=9||!!t.button?this._mouseStarted?(this._mouseDrag(t),t.preventDefault()):(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,t)!==!1,this._mouseStarted?this._mouseDrag(t):this._mouseUp(t)),!this._mouseStarted):this._mouseUp(t)},_mouseUp:function(t){return e(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,t.target===this._mouseDownEvent.target&&e.data(t.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(t)),!1},_mouseDistanceMet:function(e){return Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance},_mouseDelayMet:function(e){return this.mouseDelayMet},_mouseStart:function(e){},_mouseDrag:function(e){},_mouseStop:function(e){},_mouseCapture:function(e){return!0}})})(jQuery);(function(e,t){e.widget("ui.draggable",e.ui.mouse,{version:"1.9.0",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1},_create:function(){this.options.helper=="original"&&!/^(?:r|a|f)/.test(this.element.css("position"))&&(this.element[0].style.position="relative"),this.options.addClasses&&this.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._mouseInit()},_destroy:function(){this.element.removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._mouseDestroy()},_mouseCapture:function(t){var n=this.options;return this.helper||n.disabled||e(t.target).is(".ui-resizable-handle")?!1:(this.handle=this._getHandle(t),this.handle?(e(n.iframeFix===!0?"iframe":n.iframeFix).each(function(){e('
').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1e3}).css(e(this).offset()).appendTo("body")}),!0):!1)},_mouseStart:function(t){var n=this.options;return this.helper=this._createHelper(t),this.helper.addClass("ui-draggable-dragging"),this._cacheHelperProportions(),e.ui.ddmanager&&(e.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(),this.offset=this.positionAbs=this.element.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},e.extend(this.offset,{click:{left:t.pageX-this.offset.left,top:t.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.originalPosition=this.position=this._generatePosition(t),this.originalPageX=t.pageX,this.originalPageY=t.pageY,n.cursorAt&&this._adjustOffsetFromHelper(n.cursorAt),n.containment&&this._setContainment(),this._trigger("start",t)===!1?(this._clear(),!1):(this._cacheHelperProportions(),e.ui.ddmanager&&!n.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this._mouseDrag(t,!0),e.ui.ddmanager&&e.ui.ddmanager.dragStart(this,t),!0)},_mouseDrag:function(t,n){this.position=this._generatePosition(t),this.positionAbs=this._convertPositionTo("absolute");if(!n){var r=this._uiHash();if(this._trigger("drag",t,r)===!1)return this._mouseUp({}),!1;this.position=r.position}if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+"px";if(!this.options.axis||this.options.axis!="x")this.helper[0].style.top=this.position.top+"px";return e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),!1},_mouseStop:function(t){var n=!1;e.ui.ddmanager&&!this.options.dropBehaviour&&(n=e.ui.ddmanager.drop(this,t)),this.dropped&&(n=this.dropped,this.dropped=!1);var r=this.element[0],i=!1;while(r&&(r=r.parentNode))r==document&&(i=!0);if(!i&&this.options.helper==="original")return!1;if(this.options.revert=="invalid"&&!n||this.options.revert=="valid"&&n||this.options.revert===!0||e.isFunction(this.options.revert)&&this.options.revert.call(this.element,n)){var s=this;e(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){s._trigger("stop",t)!==!1&&s._clear()})}else this._trigger("stop",t)!==!1&&this._clear();return!1},_mouseUp:function(t){return e("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)}),e.ui.ddmanager&&e.ui.ddmanager.dragStop(this,t),e.ui.mouse.prototype._mouseUp.call(this,t)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear(),this},_getHandle:function(t){var n=!this.options.handle||!e(this.options.handle,this.element).length?!0:!1;return e(this.options.handle,this.element).find("*").andSelf().each(function(){this==t.target&&(n=!0)}),n},_createHelper:function(t){var n=this.options,r=e.isFunction(n.helper)?e(n.helper.apply(this.element[0],[t])):n.helper=="clone"?this.element.clone().removeAttr("id"):this.element;return r.parents("body").length||r.appendTo(n.appendTo=="parent"?this.element[0].parentNode:n.appendTo),r[0]!=this.element[0]&&!/(fixed|absolute)/.test(r.css("position"))&&r.css("position","absolute"),r},_adjustOffsetFromHelper:function(t){typeof t=="string"&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var t=this.offsetParent.offset();this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop());if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&e.browser.msie)t={top:0,left:0};return{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var e=this.element.position();return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:e.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t=this.options;t.containment=="parent"&&(t.containment=this.helper[0].parentNode);if(t.containment=="document"||t.containment=="window")this.containment=[t.containment=="document"?0:e(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,t.containment=="document"?0:e(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,(t.containment=="document"?0:e(window).scrollLeft())+e(t.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(t.containment=="document"?0:e(window).scrollTop())+(e(t.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(t.containment)&&t.containment.constructor!=Array){var n=e(t.containment),r=n[0];if(!r)return;var i=n.offset(),s=e(r).css("overflow")!="hidden";this.containment=[(parseInt(e(r).css("borderLeftWidth"),10)||0)+(parseInt(e(r).css("paddingLeft"),10)||0),(parseInt(e(r).css("borderTopWidth"),10)||0)+(parseInt(e(r).css("paddingTop"),10)||0),(s?Math.max(r.scrollWidth,r.offsetWidth):r.offsetWidth)-(parseInt(e(r).css("borderLeftWidth"),10)||0)-(parseInt(e(r).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(s?Math.max(r.scrollHeight,r.offsetHeight):r.offsetHeight)-(parseInt(e(r).css("borderTopWidth"),10)||0)-(parseInt(e(r).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relative_container=n}else t.containment.constructor==Array&&(this.containment=t.containment)},_convertPositionTo:function(t,n){n||(n=this.position);var r=t=="absolute"?1:-1,i=this.options,s=this.cssPosition!="absolute"||this.scrollParent[0]!=document&&!!e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,o=/(html|body)/i.test(s[0].tagName);return{top:n.top+this.offset.relative.top*r+this.offset.parent.top*r-(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():o?0:s.scrollTop())*r,left:n.left+this.offset.relative.left*r+this.offset.parent.left*r-(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():o?0:s.scrollLeft())*r}},_generatePosition:function(t){var n=this.options,r=this.cssPosition!="absolute"||this.scrollParent[0]!=document&&!!e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,i=/(html|body)/i.test(r[0].tagName),s=t.pageX,o=t.pageY;if(this.originalPosition){var u;if(this.containment){if(this.relative_container){var a=this.relative_container.offset();u=[this.containment[0]+a.left,this.containment[1]+a.top,this.containment[2]+a.left,this.containment[3]+a.top]}else u=this.containment;t.pageX-this.offset.click.leftu[2]&&(s=u[2]+this.offset.click.left),t.pageY-this.offset.click.top>u[3]&&(o=u[3]+this.offset.click.top)}if(n.grid){var f=n.grid[1]?this.originalPageY+Math.round((o-this.originalPageY)/n.grid[1])*n.grid[1]:this.originalPageY;o=u?f-this.offset.click.topu[3]?f-this.offset.click.topu[2]?l-this.offset.click.left=0;l--){var c=r.snapElements[l].left,h=c+r.snapElements[l].width,p=r.snapElements[l].top,d=p+r.snapElements[l].height;if(!(c-s'; try { lsXmlHttp=new XMLHttpRequest(); } catch (e) { try { lsXmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { lsXmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { alert(extravote_text[0]); return false; } } } lsXmlHttp.onreadystatechange=function() { var response; if(lsXmlHttp.readyState==4){ setTimeout(function(){ response = lsXmlHttp.responseText; if(response=='thanks') div.innerHTML=''+extravote_text[2]+''; if(response=='login') div.innerHTML=''+extravote_text[3]+''; if(response=='voted') div.innerHTML=''+extravote_text[4]+''; },500); setTimeout(function(){ if(response=='thanks'){ var newtotal = total_count+1; var percentage = ((total + i)/(newtotal)); document.getElementById('rating_'+id+'_'+xid).style.width=parseInt(percentage*20)+'%'; } if(counter!=0){ if(response=='thanks'){ var newvotes=extravote_text[5]+newtotal; div.innerHTML=''+newvotes+''; } else { if(total_count!=0 || counter!=-1) { var votes=extravote_text[5]+total_count; div.innerHTML=''+votes+''; } else { div.innerHTML=''; } } } else { div.innerHTML=''; } },2000); } } lsXmlHttp.open("GET",live_site+"/plugins/content/extravote/ajax.php?task=vote&user_rating="+i+"&cid="+id+"&xid="+xid,true); lsXmlHttp.send(null); } function JCommentsEvents(){} function JCommentsInput(){} function JCommentsIndicator(){this.init();} function JCommentsForm(id,editor){this.init(id,editor);} function JCommentsEditor(textarea,resizable){this.init(textarea,resizable);} function JComments(oi,og,r){this.init(oi,og,r);} JCommentsEvents.prototype = { add: function(o,e,f){if(o.addEventListener){o.addEventListener(e,f,false);return true;}else if(o.attachEvent){return o.attachEvent("on"+e,f);}else{return false;}}, remove: function(o,e,f){if(o.removeEventListener){o.removeEventListener(e,f,false);}else if(o.detachEvent){o.detachEvent( "on"+e,o[e+f] );o[e+f]=null;o["e"+e+f]=null;}}, cancel: function(e){if(e.stopPropagation){e.cancelBubble=true;e.preventDefault();e.stopPropagation();}e.returnValue=false;return false;}, target: function(e){var t;if(!e)e=window.event;if(e.target)t=e.target;else if(e.srcElement)t=e.srcElement;if(t.nodeType==3)t=t.parentNode;return t;} }; JCommentsInput.prototype = { register: function(el){if(el){var th=this,events=new JCommentsEvents();events.add(el,'focus',function(e){return th.onFocus(e);});events.add(el,'blur',function(e){return th.onBlur(e);});}}, unregister: function(el){if(el){var th=this,events=new JCommentsEvents();events.remove(el,'focus',function(e){return th.onFocus(e);});events.remove(el,'blur',function(e){return th.onBlur(e);});}}, onFocus: function(e){var t=JCommentsEvents.prototype.target(e);if(t!=null){t.className=t.className.replace('error','')+' selected';}}, onBlur: function(e){var t=JCommentsEvents.prototype.target(e);if(t!=null){var c=t.className.replace('error','');c=c.replace('error','');c=c.replace('selected','');t.className=c.replace(/^\s+/g,"");}} }; JCommentsEditor.prototype = { ta: null, l10n: {}, tags: {}, smiles: {}, events: null, counter: null, focused: false, resizable: true, init: function(textareaID, r) { this.ta=JComments.prototype.$(textareaID); this.l10n={counterPre:'',counterPost:' symbols left'}; this.resizable=r; this.events=new JCommentsEvents(); this.defaultHeight=this.ta.clientHeight; this.defaultRows=this.ta.rows; if(this.resizable){this.addGrippie();} this.isWebkit=/webkit/.test(navigator.userAgent.toLowerCase()); var th = this; this.events.add(document,!window.opera&&document.all?'keydown':'keypress',function(e){return th.onKeyPress(e);}); this.events.add(this.ta,'click',function(e){th.closeSmiles();return th.storeCaret(this.ta);}); this.events.add(this.ta,'select',function(e){return th.storeCaret(this.ta);}); this.events.add(this.ta,'change',function(e){th.onChange(); return th.storeCaret(this.ta);}); this.events.add(this.ta,'keyup',function(e){return th.onChange();}); this.events.add(this.ta,'focus',function(e){th.closeSmiles(); return th.focused=true;}); this.events.add(this.ta,'blur',function(e){return th.focused=false;}); }, onKeyPress: function(e) { if (!this.focused){return;} var k=String.fromCharCode(e.keyCode?e.keyCode:e.charCode),t; for(var id in this.tags){ t=this.tags[id]; if(!t.key||k.toUpperCase()!=t.key.toUpperCase())continue; if(t.ctrl&&!e[t.ctrl+"Key"])continue; this.insertTag(id); return this.events.cancel(e); } return e.returnValue; }, defined: function(v){return (typeof(v)!="undefined");}, clear: function(){this.ta.value='';if(this.defaultHeight){this.ta.style.height=this.defaultHeight+'px';}this.updateCounter();}, focus: function(){this.ta.focus();}, storeCaret: function(){var ta=this.ta;if(ta.createTextRange)ta.caretPos=document.selection.createRange().duplicate();}, getElementPos: function(e){var p={left:0,top:0,right:0,bottom:0};while(e!=null){p.left+=e.offsetLeft;p.top+=e.offsetTop;e=e.offsetParent;}p.right+=p.left;p.bottom+=p.top;return p;}, getSelection: function(){var ta=this.ta,s='';if(document.selection&&document.selection.createRange){s=document.selection.createRange().text;}else{s=ta.value.substr(ta.selectionStart,ta.selectionEnd-ta.selectionStart);}return s;}, insertText: function(text) { var ta=this.ta; if(this.defined(ta.caretPos)&&ta.createTextRange){ta.focus();var sel=document.selection.createRange();sel.text=sel.text+text;ta.focus();} else if(this.defined(ta.selectionStart)){ var ss=ta.value.substr(0, ta.selectionStart); var se=ta.value.substr(ta.selectionEnd),sp=ta.scrollTop; ta.value=ss+text+se; if(ta.setSelectionRange){ta.focus();ta.setSelectionRange(ss.length+text.length,ss.length+text.length);} ta.scrollTop=sp; } else {ta.value+=text;ta.focus(ta.value.length-1);} }, surroundText: function(t1,t2) { var ta=this.ta; if (this.defined(ta.caretPos) && ta.createTextRange){ var cp=ta.caretPos,tl=cp.text.length; cp.text=cp.text.charAt(cp.text.length-1)==' '?t1+cp.text+t2+' ':t1+cp.text+t2; if(tl==0){cp.moveStart("character",-t2.length);cp.moveEnd("character",-t2.length);cp.select();} else{ta.focus(cp);} }else if(this.defined(ta.selectionStart)){ var ss=ta.value.substr(0,ta.selectionStart),se=ta.value.substr(ta.selectionEnd); var sl=ta.value.substr(ta.selectionStart,ta.selectionEnd-ta.selectionStart); var nc=ta.selectionStart,sp=ta.scrollTop; ta.value=ss+t1+sl+t2+se; if(ta.setSelectionRange){ if(sl.length==0){ta.setSelectionRange(nc+t1.length,nc+t1.length);} else{ta.setSelectionRange(nc,nc+t1.length+sl.length+t2.length);} ta.focus(); } ta.scrollTop=sp; }else{ta.value+=t1+t2;ta.focus(ta.value.length-1);} }, insertTag: function(id) {var tag=this.tags[id];if(!tag)return;var s=this.getSelection();if(s.length>0){this.surroundText(tag.open,tag.close);}}, initTags: function(){ if (this.bbc==null||this.bbc.length==0){ this.bbc={}; this.bbc['b']={id:'bbcode-b',open:'[b]',close:'[/b]',key:'B',ctrl:'ctrl',hint:'Bold'}; this.bbc['i']={id:'bbcode-i',open:'[i]',close:'[/i]',key:'I',ctrl:'ctrl',hint:'Italic'}; this.bbc['u']={id:'bbcode-u',open:'[u]',close:'[/u]',key:'U',ctrl:'ctrl',hint:'Underline'}; this.bbc['s']={id:'bbcode-s',open:'[s]',close:'[/s]',key:null,ctrl:null,hint:'Strikeout'}; this.bbc['img']={id:'bbcode-img',open:'[img]',close:'[/img]',key:null,ctrl:null,hint:'Image'}; this.bbc['url']={id:'bbcode-url',open:'[url]',close:'[/url]',key:null,ctrl:null,hint:'Link'}; this.bbc['hide']={id:'bbcode-hide',open:'[hide]',close:'[/hide]',key:null,ctrl:null,hint:'Hidden'}; this.bbc['quote']={id:'bbcode-quote',open:'[quote]',close:'[/quote]',key:null,ctrl:null,hint:'Quote'}; this.bbc['list']={id:'bbcode-list',open:'[list][*]',close:'[/list]',key:null,ctrl:null,hint:'List'}; } }, createButton: function(i,t,c,f,img){ var e;if(img==null||img==""){e=document.createElement('a');e.style.display='block';e.setAttribute('href','#');} else{e=document.createElement('img');if(t){e.setAttribute('alt',t);}e.setAttribute('src',img);if(!c){c='custombbcode';}} if(i){e.setAttribute('id',i);}if(t){e.setAttribute('title',t);}if(c){e.className=c;} var ee=e;e.onclick=(f!=null?function(){f(ee); return false;}:function(){return false;}); return e; }, addButton: function(id,h,p,ot,ct,css,img) { if(this.ta){ this.initTags(); var tag=this.bbc[id],th=this; if(!tag){ if(ot&&ct) { this.bbc[id]={id:id,open:ot,close:ct,key:null,ctrl:null,hint:h}; tag=this.bbc[id]; } else { return; } } if(this.bbcPanel==null){ this.bbcPanel=document.createElement('span'); this.bbcPanel.className='bbcode'; this.bbcPanel.style.display='block'; this.ta.parentNode.insertBefore(this.bbcPanel,this.ta); } var f=function(){var s=th.getSelection();if(s.length>0){th.surroundText(tag.open,tag.close);}else{var v=prompt(p,'');if(null!=v && ''!=v){th.insertText(tag.open+v+tag.close);}}return false;}; tag.e=this.createButton(tag.id,(h!=null?h:tag.hint),(css?css:tag.id),f,img); this.bbcPanel.appendChild(tag.e); this.tags[tag.id]=tag; } }, initSmiles: function(p){this.smilesPath=p; if(this.ta){ this.smilesPanel=document.createElement('div'); if(this.bbcPanel){ document.body.appendChild(this.smilesPanel); this.smilesPanel.id='comments-form-smilespanel'; this.smilesPanel.setAttribute('style','display:none;top:0;left:0;position:absolute;'); this.smilesPanel.onclick=function(){this.style.display='none';}; var jc=this,f=function(e){ var sp=jc.smilesPanel,p=jc.getElementPos(e); if(sp){var sps=sp.style;sps.display=(sps.display=='none'||sps.display==''?'block':'none');sps.left=p.left+"px";sps.top=p.bottom+e.offsetHeight+"px";sps.zIndex=99;} return false; }; this.bbcPanel.appendChild(this.createButton(null,null,'bbcode-smile',f)); } else { this.smilesPanel.className='smiles';this.ta.parentNode.insertBefore(this.smilesPanel, this.ta); } } }, closeSmiles: function(){if(this.smilesPanel&&this.bbcPanel){this.smilesPanel.style.display='none';}}, addSmile: function(code,image){ if(this.ta){ if(!this.smilesPath||!this.smilesPanel){return;} var th=this,e=document.createElement('img'); e.setAttribute('src',this.smilesPath+'/'+image); e.setAttribute('alt',code); e.className='smile'; e.onclick=function(){th.insertText(' '+code+' ');}; this.smilesPanel.appendChild(e); } }, addCounter: function(m,pre,post,className){ if(this.ta){ if(pre!=null){this.l10n.counterPre=pre;}if(post!=null){this.l10n.counterPost=post;} var ch=document.createElement('span');ch.className=className!=null?className:''; var t1=document.createTextNode(this.l10n.counterPre+' '),t2=document.createTextNode(' '+this.l10n.counterPost); var c=document.createElement('span');ch.appendChild(t1);ch.appendChild(c);ch.appendChild(t2); if(this.resizable){if(this.grippie!=null){this.grippie.appendChild(ch);}} else{var d=document.createElement('div');d.className='counterpanel';this.ta.parentNode.insertBefore(d,this.ta.nextSibling);d.appendChild(ch);} this.counter={e:c,max:m}; this.updateCounter(); } }, addGrippie: function() { this.offset=null;this.dragging=false; this.grippie=document.createElement('div');this.grippie.className='grippie'; this.ta.parentNode.insertBefore(this.grippie,this.ta.nextSibling); var th=this;this.events.add(this.grippie,'mousedown',function(e){return th.onMouseDown(e);}); }, updateCounter: function(){if(this.counter!=null){var ta=this.ta,e=this.counter.e;try{var n=document.createElement(e.tagName),v=this.counter.max;if(ta.value.length>0){v=v-ta.value.length;var ln=ta.value.match(/[^\r]\n/g);if(ln){v=v-ln.length;}}n.innerHTML=(v>=0)?v:0;e.parentNode.replaceChild(n,e);this.counter.e=n;}catch(ex){}}}, mousePosition: function(e){var px=0,py=0;if(!e){e=window.event;}if(e.pageX||e.pageY){px=e.pageX;py=e.pageY;}else if(e.clientX||e.clientY){px=e.clientX+document.body.scrollLeft+document.documentElement.scrollLeft;py=e.clientY+document.body.scrollTop+document.documentElement.scrollTop;}return {x:px,y:py};}, onChange: function(){this.updateCounter();if(this.ta&&!this.isWebkit){var l=this.ta.value.split('\n');this.ta.rows=(l.lengthe){for(var i=s;i>=e;i--){setTimeout("JComments.prototype.setOpacity('"+id+"',"+i+")",(timer*speed));timer++;}var o=JComments.prototype.$(id);if(o){setTimeout(function(){o.style.display='none';},((s-e)*speed));}}else if(s