$A = function(iterable, start, length){ if (Browser.Engine.trident && $type(iterable) == 'collection'){ start = start || 0; if (start < 0) start = iterable.length + start; length = length || (iterable.length - start); var array = []; for (var i = 0; i < length; i++) array[i] = iterable[start++]; return array; } start = (start || 0) + ((start < 0) ? iterable.length : 0); var end = ((!$chk(length)) ? iterable.length : length) + start; return Array.prototype.slice.call(iterable, start, end); }; (function(){ var natives = [Array, Function, String, RegExp, Number]; for (var i = 0, l = natives.length; i < l; i++) natives[i].extend = natives[i].implement; })(); window.extend = document.extend = function(properties){ for (var property in properties) this[property] = properties[property]; }; window[Browser.Engine.name] = window[Browser.Engine.name + Browser.Engine.version] = true; window.ie = window.trident; window.ie6 = window.trident4; window.ie7 = window.trident5; Class.empty = $empty; Class.prototype.extend = function(properties){ properties.Extends = this; return new Class(properties); }; Array.implement({ copy: function(start, length){ return $A(this, start, length); } }); Array.alias({erase: 'remove', combine: 'merge'}); Function.extend({ bindAsEventListener: function(bind, args){ return this.create({'bind': bind, 'event': true, 'arguments': args}); } }); Function.empty = $empty; Hash.alias({getKeys: 'keys', getValues: 'values', has: 'hasKey', combine: 'merge'}); var Abstract = Hash; Element.extend = Element.implement; Elements.extend = Elements.implement; Element.implement({ getFormElements: function(){ return this.getElements('input, textarea, select'); }, replaceWith: function(el){ el = $(el); this.parentNode.replaceChild(el, this); return el; }, removeElements: function(){ return this.dispose(); } }); Element.alias({'dispose': 'remove', 'getLast': 'getLastChild'}); Element.implement({ getText: function(){ return this.get('text'); }, setText: function(text){ return this.set('text', text); }, setHTML: function(){ return this.set('html', arguments); }, getHTML: function(){ return this.get('html'); }, getHTML: function(){ return this.get('html'); }, getTag: function(){ return this.get('tag'); } }); Event.keys = Event.Keys; Element.implement({ setOpacity: function(op){ return this.set('opacity', op); } }); Object.toQueryString = Hash.toQueryString; var XHR = new Class({ Extends: Request, options: { update: false }, initialize: function(url, options){ this.parent(options); this.url = url; }, request: function(data){ return this.send(this.url, data || this.options.data); }, send: function(url, data){ if (!this.check(arguments.callee, url, data)) return this; return this.parent({url: url, data: data}); }, success: function(text, xml){ text = this.processScripts(text); if (this.options.update) $(this.options.update).empty().set('html', text); this.onSuccess(text, xml); }, failure: function(){ this.fireEvent('failure', this.xhr); } }); var Ajax = XHR; JSON.Remote = new Class({ options: { key: 'json' }, Extends: Request.JSON, initialize: function(url, options){ this.parent(options); this.onComplete = $empty; this.url = url; }, send: function(data){ if (!this.check(arguments.callee, data)) return this; return this.parent({url: this.url, data: {json: Json.encode(data)}}); }, failure: function(){ this.fireEvent('failure', this.xhr); } }); Fx.implement({ custom: function(from, to){ return this.start(from, to); }, clearTimer: function(){ return this.cancel(); }, stop: function(){ return this.cancel(); } }); Fx.Base = Fx; Fx.Style = function(element, property, options){ return new Fx.Tween(element, $extend({property: property}, options)); }; Element.implement({ effect: function(property, options){ return new Fx.Tween(this, $extend({property: property}, options)); } }); Fx.Styles = Fx.Morph; Element.implement({ effects: function(options){ return new Fx.Morph(this, options); } }); Native.implement([Element, Document], { getElementsByClassName: function(className){ return this.getElements('.' + className); }, getElementsBySelector: function(selector){ return this.getElements(selector); } }); Elements.implement({ filterByTag: function(tag){ return this.filter(tag); }, filterByClass: function(className){ return this.filter('.' + className); }, filterById: function(id){ return this.filter('#' + id); }, filterByAttribute: function(name, operator, value){ return this.filter('[' + name + (operator || '') + (value || '') + ']'); } }); var $E = function(selector, filter){ return ($(filter) || document).getElement(selector); }; var $ES = function(selector, filter){ return ($(filter) || document).getElements(selector); }; var Json = JSON; JSON.toString = JSON.encode; JSON.evaluate = JSON.decode; Cookie.set = function(key, value, options){ return new Cookie(key, options).write(value); }; Cookie.get = function(key){ return new Cookie(key).read(); }; Cookie.remove = function(key, options){ return new Cookie(key, options).dispose(); }; var PNG = new Class({ initialize: function(container) { this.arVersion = navigator.appVersion.split("MSIE"); if (this.arVersion.length > 1) { this.version = parseFloat(this.arVersion[1]); if (container) this.fix(container); } }, fix: function(container,show) { if ((this.version >= 5.5) && (document.body.filters)) { var fiximgs = $(container).getElements('img'); fiximgs.each(function(img,i){ var imgName = img.src.toUpperCase() if (imgName.substring(imgName.length-3, imgName.length) == "PNG") { var tmp = new Element('div').cloneEvents(img); var imgID = (img.id) ? "id='" + img.id + "' " : "" var imgClass = (img.className) ? "class=\"pngfix " + img.className + "\" " : "class=\"pngfix\" " var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' " var imgStyle = "display:inline-block;" + img.style.cssText if (img.align == "left") imgStyle = "float:left;" + imgStyle if (img.align == "right") imgStyle = "float:right;" + imgStyle if (img.getParent() && img.getParent().href) imgStyle = "cursor:hand;" + imgStyle var strNewHTML = "" img.outerHTML = strNewHTML; var availableSpans = container.getElements('span.pngfix'); if (tmp && tmp.$events) availableSpans[i].cloneEvents(tmp); } }); } } }); var pngFix; window.addEvent('domready',function(){ pngFix = new PNG(window.document); }); function highlight(element, callback){ $(element).style.backgroundColor = "#FFFF00"; var highlighter = new Fx.Style(element, 'backgroundColor', {duration: 2000, onComplete: function() { callback(); } }); highlighter.start('#FFFFFF'); } function removeProfileItem(actionUrl, id, oldDiv, showingDiv){ if (confirm("Are you sure you want to remove this?")){ new Request({ url: actionUrl, method: "post", data: {id: id}, onComplete: function(response){ var parent = $(oldDiv).getParent(); $(oldDiv).remove(); if (response != ""){ parent.innerHTML = parent.innerHTML.replace(/\s*<\/div>/g, ""); parent.innerHTML += response + '
'; //decNums(showingDiv, false); }else{ //decNums(showingDiv, true); } } }).send(); } } function removeItem(actionUrl, id, oldDiv, showingDiv){ if (confirm("Are you sure you want to remove this?")){ new Request({ url: actionUrl, method: "post", data: {id: id}, onComplete: function(response){ var parent = $(oldDiv).getParent(); $(oldDiv).remove(); decNums(showingDiv, true); } }).send(); } } var speedDial={t:-1,m:null}; function showSpeedDial(s){if($('sdSize').value==0)return;if(speedDial.m==null){speedDial.m=new Fx.Styles("speedDialMenu",{duration:200});}speedDial.m.start({opacity:(s?1.0:0.0)});} function clearSpeedTimeout(){if(speedDial.t!=-1){clearTimeout(speedDial.t);speedDial.t=-1;}} function setSpeedTimeout(){if(speedDial.t!=-1)clearTimeout(speedDial.t);speedDial.t=setTimeout("showSpeedDial(false)",500);} function decNums(e,b){if(b==null)b=false;var r = /(Showing\s)([0-9]+)(\sof\s)([0-9]+)(.*)/.exec($(e).innerHTML);$(e).innerHTML=""+r[1]+(b?r[2]-1:r[2])+r[3]+(r[4]-1)+r[5];} function incNums(e,b) { if (b == null) b=false; var r = /(Showing\s)([0-9]+)(\sof\s)([0-9]+)(.*)/.exec($(e).innerHTML); $(e).innerHTML = "" + r[1] + (b?r[2]-0+1:r[2])+r[3]+(r[4]-0+1)+r[5]; } function showMoreLess(id, more_text, less_text) { if ($(id + "_link").innerHTML == more_text) { $(id).setStyles({visibility: 'visible', display: 'inline'}); $(id + "_link").innerHTML = less_text; } else { $(id).setStyles({visibility: 'hidden', display: 'none'}); $(id + "_link").innerHTML = more_text; } } var DragNDrop = new Class({ initialize: function(options){ this.indexes = options.indexes; this.page = 1; this.pages_url = options.pages_url; this.image_base = options.image_base; this.loadDraggables(); this.loadDroppables(); }, loadDraggables: function(){ $$("#draggables div.draggable").each (function (drag){ drag.orig_x = drag.style.left; drag.orig_y = drag.style.top; var span = drag.getElementsByTagName("span")[0]; drag.friend_id = span.innerHTML; drag.addEvent("mousedown", function(e){ e = new Event(e).stop(); var clone = this.clone() .setStyles(this.getCoordinates()) .setStyles({"opacity": 0.8, "position": "absolute"}) .addEvent("emptydrop", function(){ this.remove(); }) .inject(document.body); clone.makeDraggable({droppables: $$('#droppables div.droppable')}).start(e); clone.friend_id = drag.friend_id; clone.real = drag; }); }); }, loadDroppables: function(){ var me = this; $$("#droppables div.droppable").each (function (drop, index){ drop.dropPos = index; drop.friend_id = me.indexes[index]; drop.addEvents({ "over": function (el, obj){ this.setStyle("background-color", "#333"); }, "leave": function (el, obj){ this.setStyle("background-color", "#111"); }, "drop": function (el, obj){ this.setStyle("background-color", "#111"); var used = -1; for (var i = 0; i < me.indexes.length; i++){ if (i != this.dropPos && me.indexes[i] == el.friend_id){ used = i; break; } } var old = this.innerHTML; if (used < 0){ this.innerHTML = el.real.innerHTML; this.friend_id = el.friend_id; me.indexes[this.dropPos] = this.friend_id; }else{ var otherDrop = $("droppable" + used); this.innerHTML = otherDrop.innerHTML; otherDrop.innerHTML = old; var old_id = this.friend_id; this.friend_id = me.indexes[otherDrop.dropPos]; otherDrop.friend_id = old_id; me.indexes[otherDrop.dropPos] = old_id; me.indexes[this.dropPos] = this.friend_id; } el.remove(); } }); }); }, getPage: function(page){ var me = this; $("draggables").innerHTML = "\"Loading...\""; new Request({ url: this.pages_url, method: "get", data: {page: page}, onComplete: function(response){ $("draggables").innerHTML = response; me.page = page; me.loadDraggables(); } }).send(); }, submit: function(){ var str = "
"; this.indexes.each( function(item, index){ str += ""; }); str += "
"; $("draggables").innerHTML = str; $("submit_form").submit(); }, removeSpot: function(i){ var drop = $("droppable" + i); drop.friend_id = 0; drop.innerHTML = ""; this.indexes[i] = 0; } }); function addTagToTarget(tag, target) { var current_value = target.value; if (current_value.indexOf(tag) == -1) target.value += " " + tag; } var Rater = new Class({ initialize: function(options){ this.id = options.id; this.type = options.type; this.submit_url = options.submit_url; this.rating = options.rating; this.num_ratings = options.num_ratings; this.feedback_box = options.feedback_box; this.object_name = options.object_name; this.locked = false; if (options.post_ajax) this.post_ajax = options.post_ajax; else this.post_ajax = function(){} }, mouseOver: function(num){ if (!this.locked){ if (num == 0) this.feedback_box.innerHTML = "Lame"; else if (num == 1) this.feedback_box.innerHTML = "Bleh"; else if (num == 2) this.feedback_box.innerHTML = "Alright"; else if (num == 3) this.feedback_box.innerHTML = "Good"; else if (num == 4) this.feedback_box.innerHTML = "Awesome"; for (var i = 0; i <= num; i++) $(this.object_name + "_rating_star_" + i).className = "star star_full"; for (var i = num + 1; i < 5; i++) $(this.object_name + "_rating_star_" + i).className = "star star_empty"; } }, rate: function(num){ if (!this.locked){ this.locked = true; var me = this; new Request({ url: this.submit_url, method: "post", data: {id: this.id, value: num + 1}, onComplete: function(response){ me.feedback_box.innerHTML = response + "
"; me.post_ajax(); } }).send(); } }, reset: function(){ if (!this.locked){ for(var i = 0; i < 5; i++){ if (this.rating <= i + 0.1) $(this.object_name + "_rating_star_" + i).className = "star star_empty"; else if (this.rating < i + 0.5) $(this.object_name + "_rating_star_" + i).className = "star star_half"; else $(this.object_name + "_rating_star_" + i).className = "star star_full"; } this.feedback_box.innerHTML = this.num_ratings + " Ratings"; } } }); var Share = new Class({ initialize: function(options){ this.object_id = options.object_id; this.submit_url = options.submit_url; this.button = options.button; this.feedback_box = options.feedback_box; this.object_name = options.object_name; this.on_complete = options.on_complete; this.share_to = options.share_to; this.share_name = options.share_name; this.share_message = options.share_message; }, send: function(){ var me = this; this.button.disabled = 'disabled'; this.feedback_box.innerHTML = '
Sending...
'; new Request({ url: this.submit_url, method: "post", data: {id: this.object_id, to: me.share_to.value, name: me.share_name.value, message: me.share_message.value}, onComplete: function() { me.feedback_box.innerHTML = '
Sent Successfully
'; setTimeout(me.object_name + ".feedback_box.innerHTML = ''; " + me.object_name + ".button.disabled = '';", 3000); me.on_complete(); } }).send(); } }); var Flagger = new Class({ initialize: function(options){ this.object_id = options.object_id; this.submit_url = options.submit_url; this.num_types = options.num_types; this.button = options.button; this.feedback_box = options.feedback_box; this.object_name = options.object_name; this.on_complete = options.on_complete; }, send: function(){ var me = this; var selected = 0; for (var i = 1; i <= this.num_types; i++){ if ($("flag_" + i).checked){ selected = i; break; } } if (selected == 0) this.feedback_box.innerHTML = '
Please select a reason
'; else { this.button.disabled = 'disabled'; this.feedback_box.innerHTML = '
Posting...
'; new Request({ url: this.submit_url, method: "post", data: {id: this.object_id, reason: $("flag_reason").value, checked: selected}, onComplete: function() { me.feedback_box.innerHTML = '
Flagged Successfully
'; setTimeout(me.object_name + ".feedback_box.innerHTML = ''; " + me.object_name + ".button.disabled = '';", 3000); me.on_complete(); } }).send(); } } }); var CommentController = new Class( { initialize: function(options) { this.item_id = options.item_id; this.item_owner_id = options.item_owner_id; this.item_type = options.item_type; this.writer_id = options.writer_id; this.message_box = options.message_box; this.feedback_box = options.feedback_box; this.char_left_box = options.char_left_box; this.comment_box_prefix = options.comment_box_prefix; this.report_spam_box_prefix = options.report_spam_box_prefix; this.new_comment_box = options.new_comment_box; this.paging = options.paging; this.action = options.action; this.js_object = options.js_object; this.unique = options.unique; this.get_page_url = options.get_page_url; this.anchor = options.anchor; this.video_attacher = options.video_attacher; this.postponed_link = options.postponed_link; this.postponed_div = options.postponed_div; this.i = 1; this.page = 1; }, show_chars_left: function() { var chars_left = 1000 - $(this.message_box).value.length; if (chars_left < 0) chars_left = 0; $(this.char_left_box).innerHTML = chars_left + " characters left."; }, postComment: function(url_base) { if ($(this.message_box).value.length > 1000) { $(this.feedback_box).innerHTML = '
You have more than the allowed characters
'; return; } if ($(this.message_box).value.match(/^\s*$/)) { $(this.feedback_box).innerHTML = '
You have to type a message
'; return; } $(this.feedback_box).innerHTML = '
Posting...
'; $("comment_submit_" + this.unique).disabled = true; var video_id = (this.video_attacher == null ? 0 : eval(this.video_attacher + ".getVideo()")); var rnd_id = Math.floor(Math.random() * 100000000 + 1); var me = this; var postBody = {item_id: this.item_id, writer_id: this.writer_id, item_owner_id: this.item_owner_id, item_type: this.item_type, comment: $(this.message_box).value, i: this.i, js_object: this.js_object, unique: this.unique, video_id: video_id, rnd_id: rnd_id}; $(this.message_box).readOnly = true; new Request({ url: url_base, method: 'post', data: postBody, onComplete: function (html) { $(me.message_box).readOnly = false; $("comment_submit_" + me.unique).disabled = false; if (me.video_attacher != null){ eval(me.video_attacher + ".showPanel(false)"); } if(html.indexOf('time_limit_spam') != -1) { $(me.feedback_box).innerHTML = '
Please do not spam
'; } else if(html.indexOf('spam_filter_spam') != -1) { $(me.feedback_box).innerHTML = '
Message posting failed
'; } else { if (me.page == 1) { if ($("no_comments_yet")) $("no_comments_yet").style.display = "none"; $(me.new_comment_box).innerHTML = html; me.new_comment_box = 'new_comment_box_' + me.unique + "_" + me.i; me.i++; } else { me.getPage(1); } $(me.feedback_box).innerHTML = '
Message Posted Successfully
'; $(me.message_box).value = ""; } if (video_id != 0) eval(me.video_attacher + ".setToNull()"); setTimeout(me.js_object + ".clearFeedbackBox()", 3000); } }).send(); }, getPostponed: function() { var me = this; var postBody = {id: this.item_id, type: this.item_type, page: 1, url: this.action, unique: this.unique}; $(me.postponed_link).innerHTML = '
Loading...
'; $(me.postponed_link).innerHTML = '
Loading...
'; $(me.postponed_div).setStyle('display','block'); new Request({ url: this.get_page_url, method: 'post', data: postBody, onComplete: function (html) { $(me.paging).innerHTML = html; $(me.postponed_link).innerHTML = ''; } }).send(); }, deleteComment: function(id, url_base) { var me = this; $(me.comment_box_prefix + "_" + id).innerHTML = '
Deleting...
'; new Request({ url: url_base + "&id=" + id + "&type=" + this.item_type + "&item_id=" + this.item_id, method: 'post', data: {}, onComplete: function (html) { setTimeout(me.js_object + ".deleteCommentDiv(" + id + ")", 3000); decNums("numMessages_" + me.unique, true); } }).send(); }, deleteCommentDiv: function(comment_id) { $(this.comment_box_prefix + "_" + comment_id).remove(); }, clearFeedbackBox: function() { $(this.feedback_box).innerHTML = ""; }, reportSpam: function(id, owner_id, url_base) { var me = this; new Request({ url: url_base + "&id=" + id + "&type=" + this.item_type + "&owner_id=" + owner_id, method: 'post', data: {}, onComplete: function (html) { $(me.report_spam_box_prefix + id).innerHTML = "Marked as spam"; } }).send(); }, blockUser: function(id, url_base, user_to_block_id, block_or_unblock) { if(block_or_unblock) if (!confirm("Are you sure you want to block this user?")) return false; var me = this; var postBody = {id: user_to_block_id, block: block_or_unblock}; new Request({ url: url_base, method: 'post', data: postBody, onComplete: function (html) { window.location.href = me.action; } }).send(); }, getPage: function(page, url_base) { var me = this; this.page = page; var postBody = {id: this.item_id, type: this.item_type, page: page, url: this.action, unique: this.unique}; $(me.paging).innerHTML = '
Loading...
'; new Request({ url: this.get_page_url, method: 'post', data: postBody, onComplete: function (html) { $(me.paging).innerHTML = html; } }).send(); } }); var DropDown = new Class({ initialize: function(options){ this.selectedItem = -1; this.unique = options.unique; this.tags_box = options.tags_box; this.target_url = options.target_url; var dd = $("dropdown_" + this.unique), cb = $("chooser_box_" + this.unique); dd.setStyle("left", cb.getPosition().x); dd.setStyle("top", cb.getPosition().y + 20); }, checkItem: function(event){ var text = $("chooser_box_" + this.unique).value; var key = (event.which ? event.which : event.keyCode); if (key == 40 && this.selectedItem < 9) this.selectedItem++; else if (key == 38 && this.selectedItem > -1) this.selectedItem--; var me = this; if (text.length > 2){ new Request({ url: this.target_url, method: "get", data: {text: text, selectedItem: this.selectedItem}, onComplete: function(response){ $("dropdown_" + me.unique).innerHTML = response; $("dropdown_" + me.unique).style.display = "block"; } }).send(); }else{ $("dropdown_" + this.unique).style.display = "none"; } }, selectItem: function(){ this.tags_box.innerHTML += " " + (this.selectedItem == -1 ? $("chooser_box_" + this.unique).value : $("selectedItem_" + this.unique).innerHTML); $("dropdown_" + this.unique).style.display = "none"; $("chooser_box_" + this.unique).value = ''; this.selectedItem = -1; }, highlightItem: function(i){ this.selectedItem = i; var me = this; new Request({ url: this.target_url, method: "get", data: {text: $("chooser_box_" + this.unique).value, selectedItem: this.selectedItem, unique: this.unique}, onComplete: function(response){ $("dropdown_" + me.unique).innerHTML = response; $("dropdown_" + me.unique).style.display = "block"; } }).send(); } }); var ThumbCropper = new Class({ initialize: function(options) { this.left = 10; this.top = 10; this.ratio = options.thumb_height / options.thumb_width; this.min_left = 0; this.max_right = options.max_right; this.min_top = 0; this.max_bottom = options.max_bottom; this.min_width = options.min_width; this.min_height = options.min_height; this.image_filter = (options.image_filter == null ? "" : options.image_filter); this.action = options.action; this.thumb_width = options.thumb_width; this.thumb_height = options.thumb_height; this.in_pic = options.in_pic; this.out_pic = options.out_pic; this.dark_pic = options.dark_pic; this.pre_ajax = (options.pre_ajax == null ? function(){} : options.pre_ajax); this.post_ajax = (options.post_ajax == null ? function(){} : options.post_ajax); this.resizing = false; this.moving = false; this.container = $('cropper-container'); this.resizer = $('cropper-resizer'); this.mover = $('cropper-mover'); var pos = this.container.getPosition(); var size = this.mover.getSize(); this.container_left = pos.x; this.container_top = pos.y; this.mover_width = size.x; this.mover_height = size.y; var pos = this.mover.getPosition(); this.mover_left = pos.x - this.container_left; this.mover_top = pos.y - this.container_top; $('cropper-container-border').addEvent("mouseenter", this.enter.bind(this)); $('cropper-container-border').addEvent("mouseout", this.out.bind(this)); document.addEvent("mouseup", this.mouseUp.bind(this)); document.addEvent("mousemove", this.move.bind(this)); this.resizer.addEvent("mousedown", this.resizeMouseDown.bind(this)); this.mover.addEvent("mousedown", this.moveMouseDown.bind(this)); this.x_offset = 0; this.y_offset = 0; }, enter: function(event) { event = new Event(event); }, out: function(event) { event = new Event(event); }, mouseUp: function(event) { event = new Event(event); if (this.resizing) { this.resizing = false; } if (this.moving) { this.moving = false; } }, move: function(event) { event = new Event(event); var difference = 0; if (this.moving) { var mouse_x = event.page.x - this.container_left; var mouse_y = event.page.y - this.container_top; if (mouse_x - this.x_offset + this.mover_width > this.max_right) this.mover_left = this.max_right - this.mover_width; else if (mouse_x - this.x_offset < this.min_left) this.mover_left = this.min_left; else this.mover_left = mouse_x - this.x_offset; if (mouse_y - this.y_offset + this.mover_height > this.max_bottom) this.mover_top = this.max_bottom - this.mover_height; else if (mouse_y - this.y_offset < this.min_top) this.mover_top = this.min_top; else this.mover_top = mouse_y - this.y_offset; this.x_offset = mouse_x - this.mover_left; this.y_offset = mouse_y - this.mover_top; this.mover.setStyle("top",this.mover_top); this.mover.setStyle("left",this.mover_left); this.mover.style.backgroundPosition = "-" + (this.mover_left + 1) + "px -" + (this.mover_top + 1) + "px"; this.resizer.setStyle("top",this.mover_top + this.mover_height); this.resizer.setStyle("left",this.mover_left + this.mover_width); } else if (this.resizing) { difference = event.page.x - this.container_left - this.mover_left - this.mover_width; var do_resize = false; if (this.mover_left + this.mover_width + difference <= this.max_right && this.mover_width + difference > this.min_width && parseInt(this.mover_top + this.mover_height + (difference * this.ratio)) <= this.max_bottom && parseInt(this.mover_height + (difference * this.ratio)) > this.min_height) { this.mover_width += difference; this.mover_height = parseInt(this.mover_width * this.ratio); this.mover.setStyle("width",this.mover_width - 2); //-2 for border this.mover.setStyle("height",this.mover_height - 2); //-2 for border this.resizer.setStyle("top",this.mover_top + this.mover_height); this.resizer.setStyle("left",this.mover_left + this.mover_width); } } }, resizeMouseDown: function(event) { event = new Event(event); this.resizing = true; this.moving = false; }, moveMouseDown: function(event) { event = new Event(event); this.moving = true; this.resizing = false; this.x_offset = event.page.x - this.mover_left - this.container_left; this.y_offset = event.page.y - this.mover_top - this.container_top; }, crop: function() { this.pre_ajax(); $("cropper_msg").innerHTML = "Cropping..."; var postBody = {in_pic: this.in_pic, out_pic: this.out_pic, left: this.mover_left, top: this.mover_top, width: this.mover_width, height: this.mover_height, thumb_width: this.thumb_width, thumb_height: this.thumb_height, image_filter: this.image_filter}; var out_pic = this.out_pic; var me = this; new Request({ url: this.action, method: 'post', data: postBody, onComplete: function(response){ $("cropper_msg").innerHTML = "Done!"; setTimeout("$('cropper_msg').innerHTML = '';", 3000); me.post_ajax(response); } }).send(); }, recrop: function() { $('cropper').setStyle("display", "block"); $('cropper').setStyle("visibility", "visible"); $('thumb_preview').setStyle("display", "none"); $('thumb_preview').setStyle("visibility", "hidden"); }, cancel: function() { $('thumb_preview').setStyle("display", "block"); $('thumb_preview').setStyle("visibility", "visible"); $('cropper').setStyle("display", "none"); $('cropper').setStyle("visibility", "hidden"); } }); var FeedbackPoll = new Class({ initialize: function(options){ this.message_box = options.message_box; this.button = options.button; this.feedback_box = options.feedback_box; this.object_name = options.object_name; this.submit_url = options.submit_url; this.num_options = options.num_options; this.on_complete = options.on_complete; this.referral_url = options.referral_url; this.feedback_id = options.feedback_id; this.user_id = options.user_id; this.browsing_info = options.browsing_info; }, send: function(){ var me = this; var selected = 0; for (var i = 1; i <= this.num_options; i++){ if ($(this.object_name + '_' + i).checked){ selected = $(this.object_name + '_' + i).value; break; } } if (selected == 0) this.feedback_box.innerHTML = '
Please select a reason
'; else if (selected == 'other' && this.message_box.value == "") this.feedback_box.innerHTML = '
You have to type a message
'; else { this.button.disabled = 'disabled'; this.feedback_box.innerHTML = '
Posting...
'; new Request({ url: this.submit_url, method: "post", data: { message: me.message_box.value + me.browsing_info, option_id: selected, referral_url: me.referral_url, feedback_id: me.feedback_id, user_id: me.user_id}, onComplete: function(html) { if (html == "spam") { me.feedback_box.innerHTML = '
Slow down
'; me.button.disabled = ''; } else { me.message_box.value = ''; me.feedback_box.innerHTML = html; setTimeout(me.object_name + ".feedback_box.innerHTML = ''; " + me.object_name + ".button.disabled = '';", 3000); me.on_complete(); } } }).send(); } } }); var SideScroller = new Class({ initialize: function(options){ this.divHeight = options.divHeight; this.divWidth = options.divWidth; this.numItems = options.numItems; this.itemWidth = options.itemWidth; this.scrollingDiv = options.scrollingDiv; this.scrollPos = 0; this.increments = 5; this.timer = 0; var sl = options.scrollLeft; var sr = options.scrollRight; var stop = function() { scroller.stopScroll(); return false; }; var me = this; sl.addEvent("mouseup", function(){ me.scrollingDiv.scrollLeft = me.scrollPos = 0; }); sl.addEvent("mouseover", function(){ scroller.scrollLeft(); return false; }); sl.addEvent("mouseout", stop); sl.style.cursor = "pointer"; sr.addEvent("mouseup", function(){ me.scrollPos = me.numItems * me.itemWidth - me.divWidth; me.scrollingDiv.scrollLeft = me.scrollPos; }); sr.addEvent("mouseover", function(){ scroller.scrollRight(); return false; }); sr.addEvent("mouseout", stop); sr.style.cursor = "pointer"; }, scrollLeft: function(){ if (this.timer) clearTimeout(this.timer); this.scrollPos = Math.max(this.scrollPos - this.increments, 0); this.scrollingDiv.scrollLeft = this.scrollPos; this.timer = setTimeout("scroller.scrollLeft()", 15); }, scrollRight: function(){ if (this.timer) clearTimeout(this.timer); this.scrollPos = Math.min(this.scrollPos + this.increments, this.numItems * this.itemWidth - this.divWidth); this.scrollingDiv.scrollLeft = this.scrollPos; this.timer = setTimeout("scroller.scrollRight()", 15); }, stopScroll: function(){ clearTimeout(this.timer); this.timer = 0; } }); var VideoAttacher = new Class({ initialize: function(options){ this.selected_id = options.selected_id; this.image_base = options.image_base; this.page_url = options.page_url; }, showPanel: function(show){ $("video_attacher_panel").style.display = (show ? "block" : "none"); }, getPage: function(page, type){ this.selected_id = 0; $("video_attacher_content").innerHTML = "\"\""; new Request({ url: this.page_url, method: "get", data: {page: page, type: type, selected_id: this.selected_id}, onComplete: function(response){ $("video_attacher_content").innerHTML = response; } }).send(); }, clickVideo: function(id){ if (this.selected_id) $("video_box_" + this.selected_id).style.border = "1px solid #000"; $("video_box_" + id).style.border = "1px dashed #F98E00"; this.selected_id = id; }, attachVideo: function(){ if (this.selected_id != $("attached_video_id").value) { $("attached_video_id").value = this.selected_id; this.selected_id = 0; } }, getVideo: function(){ return this.selected_id; }, setToNull: function(){ this.selected_id = 0; } }); document.mboxThumbScripts = new Array(); function moveBoxRotator(basePath, elementName, duration) { this.basePath = basePath; this.elementName = elementName; this.duration = duration; this.stepLength = 3; this.element; this.counter = 2; this.step = 40; this.speed = 600; this.timeoutId; this.exec; this.orginalSource; this.start = function() { this.originalSource = this.getElement().src; this.exec = 'document.mboxThumbScripts[' + this.elementName +'].rotate()'; this.timeoutId = setInterval(this.exec, this.speed); } this.rotate = function() { if(this.counter > (this.duration / this.stepLength)) { this.reset(); } else { var filename = String(this.counter + ".jpg"); for(x = filename.length; x < 8; x++) { filename = String("0" + filename); } this.setImage(this.basePath + filename); this.counter = this.counter + this.step; } } this.reset = function() { this.counter = 2; this.rotate(); } this.stop = function() { clearInterval(this.timeoutId); this.getElement().src = this.originalSource; } this.getElement = function() { if(!this.element) { this.element = document.getElementById(this.elementName); } return this.element; } this.setImage = function(path) { this.getElement().src = path; } } var FlashDetect=new function(){var self=this;self.installed=false;self.raw="";self.major=-1;self.minor=-1;self.revision=-1;self.revisionStr="";var activeXDetectRules=[{"name":"ShockwaveFlash.ShockwaveFlash.7","version":function(obj){return getActiveXVersion(obj);}},{"name":"ShockwaveFlash.ShockwaveFlash.6","version":function(obj){var version="6,0,21";try{obj.AllowScriptAccess="always";version=getActiveXVersion(obj);}catch(err){} return version;}},{"name":"ShockwaveFlash.ShockwaveFlash","version":function(obj){return getActiveXVersion(obj);}}];var getActiveXVersion=function(activeXObj){var version=-1;try{version=activeXObj.GetVariable("$version");}catch(err){} return version;};var getActiveXObject=function(name){var obj=-1;try{obj=new ActiveXObject(name);}catch(err){obj={activeXError:true};} return obj;};var parseActiveXVersion=function(str){var versionArray=str.split(",");return{"raw":str,"major":parseInt(versionArray[0].split(" ")[1],10),"minor":parseInt(versionArray[1],10),"revision":parseInt(versionArray[2],10),"revisionStr":versionArray[2]};};var parseStandardVersion=function(str){var descParts=str.split(/ +/);var majorMinor=descParts[2].split(/\./);var revisionStr=descParts[3];return{"raw":str,"major":parseInt(majorMinor[0],10),"minor":parseInt(majorMinor[1],10),"revisionStr":revisionStr,"revision":parseRevisionStrToInt(revisionStr)};};var parseRevisionStrToInt=function(str){return parseInt(str.replace(/[a-zA-Z]/g,""),10)||self.revision;};self.majorAtLeast=function(version){return self.major>=version;};self.minorAtLeast=function(version){return self.minor>=version;};self.revisionAtLeast=function(version){return self.revision>=version;};self.versionAtLeast=function(major){var properties=[self.major,self.minor,self.revision];var len=Math.min(properties.length,arguments.length);for(i=0;i=arguments[i]){if(i+10){var type='application/x-shockwave-flash';var mimeTypes=navigator.mimeTypes;if(mimeTypes&&mimeTypes[type]&&mimeTypes[type].enabledPlugin&&mimeTypes[type].enabledPlugin.description){var version=mimeTypes[type].enabledPlugin.description;var versionObj=parseStandardVersion(version);self.raw=versionObj.raw;self.major=versionObj.major;self.minor=versionObj.minor;self.revisionStr=versionObj.revisionStr;self.revision=versionObj.revision;self.installed=true;}}else if(navigator.appVersion.indexOf("Mac")==-1&&window.execScript){var version=-1;for(var i=0;i0?h+'px':'auto') } $j.ajax({ type: "POST", dataType: "html", url: route, success: function(data,status) { $j('div.lightbox_content').html(data); $j('div.lightbox_content').css( lightboxCSS ); resizeWindow(); $j('div.lightbox_background').show(); $j('div.lightbox_content').show(); } }); }, hide: function() { $j('div.lightbox_content').hide(); $j('div.lightbox_background').hide(); } } function recalcLightbox(e) { if( $j('div.lightbox_content')[0] ) { $j('div.lightbox_content').css( { 'top': (180/*+$j(document).scrollTop()*/)+'px', 'left': ( ($j(document).width()-$j('div.lightbox_content').width())/2) +'px' }); } } $j(document).ready( function(e) { if( $j('div.lightbox_content')[0] ) { $j('div.lightbox_background').css('opacity',0.5); $j('div.lightbox_background').click(lightbox.hide); $j(window).resize(recalcLightbox); $j(window).scroll(recalcLightbox); } });