
/* mootools-1.11-addons.js */

/* 1   */ Element.implement({
/* 2   */ 	getRelativePosition: function(){
/* 3   */ 		return this.getPosition(this.getOffsetParent());
/* 4   */ 	}
/* 5   */ });
/* 6   */ 
/* 7   */ //var groupname = '$$';
/* 8   */ //console.group("message group : %s " , groupname);
/* 9   */ /*
/* 10  *| Window.implement({
/* 11  *| 	$$: function(selector){
/* 12  *| 		if (arguments.length == 1 && typeof selector == 'string'){
/* 13  *| 			if(window.console && window.console.time) console.time('$$ - '+selector);
/* 14  *| 			var ret = this.document.getElements(selector);
/* 15  *| 			if(window.console && window.console.time) console.timeEnd('$$ - '+selector);
/* 16  *| 			return ret;
/* 17  *| 		}else{
/* 18  *| 			var args = Array.flatten(arguments);
/* 19  *| 			var aj = args.join(';');
/* 20  *| 			if(window.console && window.console.time) console.time('$$ - multi - '+aj);
/* 21  *| 			var elements = [];
/* 22  *| 			
/* 23  *| 			for (var i = 0, l = args.length; i < l; i++){
/* 24  *| 				var item = args[i];
/* 25  *| 				switch ($type(item)){
/* 26  *| 					case 'element': elements.push(item); break;
/* 27  *| 					case 'string': elements.extend(this.document.getElements(item, true));
/* 28  *| 				}
/* 29  *| 			}
/* 30  *| 			var ret = new Elements(elements);
/* 31  *| 			if(window.console && window.console.time) console.timeEnd('$$ - multi - '+aj);
/* 32  *| 			return ret;
/* 33  *| 		}
/* 34  *| 	}
/* 35  *| });*/
/* 36  */ /*
/* 37  *| Native.implement([Element, Window, Document], {
/* 38  *| 
/* 39  *| 	addEvent: function(type, fn){
/* 40  *| 		if(window.console && window.console.time){
/* 41  *| 			if(this.id){
/* 42  *| 				if(this.className){
/* 43  *| 					console.time('addEvent - #'+this.id+' .'+this.className+' '+type);
/* 44  *| 				}else{
/* 45  *| 					console.time('addEvent - #'+this.id+' '+type);
/* 46  *| 				}
/* 47  *| 			}else if(this.className){
/* 48  *| 				console.time('addEvent - .'+this.className+' '+type);
/* 49  *| 			}
/* 50  *| 		}

/* mootools-1.11-addons.js */

/* 51  *| 		var events = this.retrieve('events', {});
/* 52  *| 		events[type] = events[type] || {'keys': [], 'values': []};
/* 53  *| 		if (events[type].keys.contains(fn)) return this;
/* 54  *| 		events[type].keys.push(fn);
/* 55  *| 		var realType = type, custom = Element.Events.get(type), condition = fn, self = this;
/* 56  *| 		if (custom){
/* 57  *| 			if (custom.onAdd) custom.onAdd.call(this, fn);
/* 58  *| 			if (custom.condition){
/* 59  *| 				condition = function(event){
/* 60  *| 					if (custom.condition.call(this, event)) return fn.call(this, event);
/* 61  *| 					return true;
/* 62  *| 				};
/* 63  *| 			}
/* 64  *| 			realType = custom.base || realType;
/* 65  *| 		}
/* 66  *| 		var defn = function(){
/* 67  *| 			return fn.call(self);
/* 68  *| 		};
/* 69  *| 		var nativeEvent = Element.NativeEvents[realType];
/* 70  *| 		if (nativeEvent){
/* 71  *| 			if (nativeEvent == 2){
/* 72  *| 				defn = function(event){
/* 73  *| 					event = new Event(event, self.getWindow());
/* 74  *| 					if (condition.call(self, event) === false) event.stop();
/* 75  *| 				};
/* 76  *| 			}
/* 77  *| 			this.addListener(realType, defn);
/* 78  *| 		}
/* 79  *| 		events[type].values.push(defn);
/* 80  *| 		if(window.console && window.console.time){
/* 81  *| 			if(this.id){
/* 82  *| 				if(this.className){
/* 83  *| 					console.timeEnd('addEvent - #'+this.id+' .'+this.className+' '+type);
/* 84  *| 				}else{
/* 85  *| 					console.timeEnd('addEvent - #'+this.id+' '+type);
/* 86  *| 				}
/* 87  *| 			}else if(this.className){
/* 88  *| 				console.timeEnd('addEvent - .'+this.className+' '+type);
/* 89  *| 			}
/* 90  *| 		}
/* 91  *| 		return this;
/* 92  *| 	},
/* 93  *| 
/* 94  *| 	addEvents: function(events){
/* 95  *| 		for (var event in events) this.addEvent(event, events[event]);
/* 96  *| 		return this;
/* 97  *| 	}
/* 98  *| 
/* 99  *| });
/* 100 *| */

/* mootools-1.11-addons.js */

/* 101 */ 
/* 102 */ Drag.Move.Custom = new Class({
/* 103 */ 	Extends: Drag.Move,
/* 104 */ 	top_offsets: [],
/* 105 */ 	id_coords: [],
/* 106 */ 	
/* 107 */ 	checkAgainst: function(el, i){
/* 108 */ 		var el_orig = el;
/* 109 */ 		var chk_use_id = (el_orig.id && (el_orig.id=='drag-available' || el_orig.id=='drag-featured'))?el_orig.id:0;
/* 110 */ 		
/* 111 */ 		if(chk_use_id){
/* 112 */ 			if(typeof this.id_coords[chk_use_id] != 'undefined'){
/* 113 */ 				el = this.id_coords[chk_use_id];
/* 114 */ 			}else{
/* 115 */ 				el = el.getCoordinates();
/* 116 */ 				this.id_coords[chk_use_id] = el;
/* 117 */ 			}
/* 118 */ 		}else{
/* 119 */ 			el = (this.positions) ? this.positions[i] : el.getCoordinates();
/* 120 */ 		}
/* 121 */ 		
/* 122 */ 		
/* 123 */ 		var top = 0;
/* 124 */ 		if(chk_use_id){
/* 125 */ 			if(typeof this.top_offsets != 'undefined' && typeof this.top_offsets[chk_use_id] != 'undefined'){
/* 126 */ 				top = this.top_offsets[chk_use_id];
/* 127 */ 			}else{
/* 128 */ 				top = el_orig.getStyle('top').toInt()||0;
/* 129 */ 				if(top<0) top = Math.abs(top);
/* 130 */ 				this.top_offsets[chk_use_id] = top;
/* 131 */ 			}
/* 132 */ 		}
/* 133 */ 		var use_top = el.top + top;
/* 134 */ 		var use_bottom = el.bottom + top;
/* 135 */ 		
/* 136 */ 		var now = this.mouse.now;
/* 137 */ 		var ret = (
/* 138 */ 			now.x > el.left && 
/* 139 */ 			now.x < el.right && 
/* 140 */ 			now.y < use_bottom && 
/* 141 */ 			now.y > use_top
/* 142 */ 		);
/* 143 */ 		//if(el_orig.id) poptent_helpers.logger.log(el_orig.id+' '+i+' '+((ret)?'true':'false')+' '+el.top+' '+el.bottom);
/* 144 */ 		return ret;
/* 145 */ 	},
/* 146 */ 	
/* 147 */ 	checkDroppables: function(){
/* 148 */ 		var overed = this.droppables.filter(this.checkAgainst, this).getLast();
/* 149 */ 		var is_ok = true;
/* 150 */ 		if(typeof this.el_parent_id == 'undefined') this.el_parent_id = (this.element.hasClass('featured'))?'drag-featured':'drag-available';

/* mootools-1.11-addons.js */

/* 151 */ 		if(overed){
/* 152 */ 			var otag = overed.get('tag');
/* 153 */ 			var droppable;
/* 154 */ 			if(otag){
/* 155 */ 				switch(otag){
/* 156 */ 					case 'li': droppable = overed.getParent(); break;
/* 157 */ 					case 'ul': droppable = overed; break;
/* 158 */ 				}
/* 159 */ 				if(droppable){
/* 160 */ 					var droppable_id = droppable.id;
/* 161 */ 					if(droppable_id){
/* 162 */ 						var cl_swap;
/* 163 */ 						if(typeof this.drag_featured == 'undefined') this.drag_featured = document.id('drag-featured');
/* 164 */ 						if(typeof this.drag_available == 'undefined') this.drag_available = document.id('drag-available');
/* 165 */ 						switch(droppable_id){
/* 166 */ 							case 'drag-featured': 
/* 167 */ 								cl_swap = [droppable,this.drag_available]; 
/* 168 */ 								if(droppable.getChildren().length>=8 && droppable_id != this.el_parent_id) is_ok = false;
/* 169 */ 								break;
/* 170 */ 							case 'drag-available': cl_swap = [droppable,this.drag_featured]; break;
/* 171 */ 						}
/* 172 */ 						if(cl_swap){
/* 173 */ 							if(droppable_id != this.el_parent_id && cl_swap[0].className.indexOf('over', 0) === -1) cl_swap[0].addClass('over').addClass((is_ok)?'can_drop':'no_drop').removeClass((is_ok)?'no_drop':'can_drop');
/* 174 */ 							if(cl_swap[1].className.indexOf('over', 0) !== -1) cl_swap[1].removeClass('over').removeClass('can_drop').removeClass('no_drop');
/* 175 */ 						}
/* 176 */ 					}
/* 177 */ 				}
/* 178 */ 			}
/* 179 */ 		}
/* 180 */ 		
/* 181 */ 		if (this.overed != overed){
/* 182 */ 			if(is_ok){
/* 183 */ 				if (this.overed) this.fireEvent('leave', [this.element, this.overed]);
/* 184 */ 				if (overed) this.fireEvent('enter', [this.element, overed]);
/* 185 */ 			}
/* 186 */ 			this.overed = overed;
/* 187 */ 		}
/* 188 */ 	}
/* 189 */ });
/* 190 */ 
/* 191 */ Sortables.Custom = new Class({
/* 192 */ 	Extends: Sortables,
/* 193 */ 	z: 20,
/* 194 */ 	start: function(event, element){
/* 195 */ 		if (!this.idle) return;
/* 196 */ 		this.idle = false;
/* 197 */ 		this.element = element;
/* 198 */ 		this.opacity = element.get('opacity');
/* 199 */ 		this.list = element.getParent();
/* 200 */ 		this.clone = this.getClone(event, element);

/* mootools-1.11-addons.js */

/* 201 */ 		
/* 202 */ 		var opts = {
/* 203 */ 			snap: this.options.snap,
/* 204 */ 			container: this.options.constrain && this.element.getParent(),
/* 205 */ 			droppables: this.getDroppables(),
/* 206 */ 			onSnap: function(){
/* 207 */ 				event.stop();
/* 208 */ 				this.clone.setStyle('visibility', 'visible');
/* 209 */ 				this.element.set('opacity', this.options.opacity || 0);
/* 210 */ 				this.fireEvent('start', [this.element, this.clone]);
/* 211 */ 			}.bind(this),
/* 212 */ 			onEnter: this.insert.bind(this),
/* 213 */ 			onCancel: this.reset.bind(this),
/* 214 */ 			onComplete: this.end.bind(this)
/* 215 */ 		};
/* 216 */ 		
/* 217 */ 		if(this.options.drag_onDrop) opts = $merge(opts,{onDrop: this.options.drag_onDrop});
/* 218 */ 		
/* 219 */ 		this.drag = new Drag.Move.Custom(this.clone, opts);
/* 220 */ 	
/* 221 */ 		this.clone.inject(this.element.getParent().getParent().getParent().getParent());
/* 222 */ 		this.drag.start(event);
/* 223 */ 	},
/* 224 */ 	getClone: function(event, element){
/* 225 */ 		if (!this.options.clone) return new Element('div').inject(document.body);
/* 226 */ 		var lpar = this.list.getParent().getParent();
/* 227 */ 		
/* 228 */ 		var el_parent = element.getParent();
/* 229 */ 		var el_class = (el_parent.id=='drag-featured')?'featured':'available';
/* 230 */ 		
/* 231 */ 		return element.clone(true).setStyles({
/* 232 */ 			margin: '0px',
/* 233 */ 			position: 'absolute',
/* 234 */ 			visibility: 'hidden',
/* 235 */ 			opacity: 0.7,
/* 236 */ 			'z-index': this.z++,
/* 237 */ 			'width': element.getStyle('width')
/* 238 */ 		}).addClass(el_class).inject(lpar).setPosition(element.getPosition(element.getOffsetParent().getOffsetParent().getOffsetParent().getOffsetParent()));
/* 239 */ 	}
/* 240 */ });
/* 241 */ 
/* 242 */ /* SELECTOR OPTIMIZATIONS */
/* 243 */ 
/* 244 */ (function(){
/* 245 */ 
/* 246 */ var getByClass = (function(){
/* 247 */ 	var testee = document.createElement('div');
/* 248 */ 	testee.innerHTML = '<a name="' + $time() + '" class="Ã¢â€šÂ¬ b"></a>';
/* 249 */ 	testee.appendChild(document.createComment(''));
/* 250 */ 

/* mootools-1.11-addons.js */

/* 251 */ 	if (!testee.getElementsByClassName || !testee.getElementsByClassName('b').length) return false;
/* 252 */ 	testee.firstChild.className = 'c';
/* 253 */ 	return (testee.getElementsByClassName('c').length == 1);
/* 254 */ })();
/* 255 */ 
/* 256 */ Selectors.Utils.search = function(self, expression, local){
/* 257 */ 	var splitters = [];
/* 258 */ 
/* 259 */ 	var selectors = expression.trim().replace(Selectors.RegExps.splitter, function(m0, m1, m2){
/* 260 */ 		splitters.push(m1);
/* 261 */ 		return ':)' + m2;
/* 262 */ 	}).split(':)');
/* 263 */ 
/* 264 */ 	var items, filtered, item;
/* 265 */ 
/* 266 */ 	for (var i = 0, l = selectors.length; i < l; i++){
/* 267 */ 
/* 268 */ 		var selector = selectors[i];
/* 269 */ 
/* 270 */ 		// CUSTOM
/* 271 */ 		if (i == 0 && self.querySelectorAll && (/^(?:\w+|\*)?(?:#|\.)?(?:\w+|\*)$/).test(selector)){
/* 272 */ 			try { items = $A(self.querySelectorAll(selector)); } catch (e){}
/* 273 */ 			if (items) continue;
/* 274 */ 		}
/* 275 */ 
/* 276 */ 		if (i == 0 && getByClass && (/^\.(?:\w+|\*)$/).test(selector)){
/* 277 */ 			items = $A(self.getElementsByClassName(selector.substr(1)));
/* 278 */ 			continue;
/* 279 */ 		}
/* 280 */ 		// END CUSTOM
/* 281 */ 
/* 282 */ 		if (i == 0 && Selectors.RegExps.quick.test(selector)){
/* 283 */ 			items = self.getElementsByTagName(selector);
/* 284 */ 			continue;
/* 285 */ 		}
/* 286 */ 
/* 287 */ 		var splitter = splitters[i - 1];
/* 288 */ 
/* 289 */ 		var tagid = Selectors.Utils.parseTagAndID(selector);
/* 290 */ 		var tag = tagid[0], id = tagid[1];
/* 291 */ 
/* 292 */ 		if (i == 0){
/* 293 */ 			items = Selectors.Utils.getByTagAndID(self, tag, id);
/* 294 */ 		} else {
/* 295 */ 			var uniques = {}, found = [];
/* 296 */ 			for (var j = 0, k = items.length; j < k; j++) found = Selectors.Getters[splitter](found, items[j], tag, id, uniques);
/* 297 */ 			items = found;
/* 298 */ 		}
/* 299 */ 
/* 300 */ 		var parsed = Selectors.Utils.parseSelector(selector);

/* mootools-1.11-addons.js */

/* 301 */ 
/* 302 */ 		if (parsed){
/* 303 */ 			filtered = [];
/* 304 */ 			for (var m = 0, n = items.length; m < n; m++){
/* 305 */ 				item = items[m];
/* 306 */ 				if (Selectors.Utils.filter(item, parsed, local)) filtered.push(item);
/* 307 */ 			}
/* 308 */ 			items = filtered;
/* 309 */ 		}
/* 310 */ 
/* 311 */ 	}
/* 312 */ 
/* 313 */ 	return items;
/* 314 */ 
/* 315 */ };
/* 316 */ 
/* 317 */ })();
/* 318 */ 
/* 319 */ var Tips2 = new Class({
/* 320 */ 	Implements: [Events, Options],
/* 321 */ 	options: {
/* 322 */ 		onShow: function(){
/* 323 */ 			this.toolTip.setStyle('visibility', 'visible');
/* 324 */ 		},
/* 325 */ 		onHide: function(){
/* 326 */ 			this.toolTip.setStyle('visibility', 'hidden');
/* 327 */ 		},
/* 328 */ 		maxTitleChars: 30,
/* 329 */ 		showDelay: 100,
/* 330 */ 		hideDelay: 100,
/* 331 */ 		className: 'tool',
/* 332 */ 		offsets: {'x': 16, 'y': 16},
/* 333 */ 		fixed: false
/* 334 */ 	},
/* 335 */ 
/* 336 */ 	initialize: function(elements, options){
/* 337 */ 		this.setOptions(options);
/* 338 */ 		this.toolTip = new Element('div', {
/* 339 */ 			'class': this.options.className + '-tip',
/* 340 */ 			'styles': {
/* 341 */ 				'position': 'absolute',
/* 342 */ 				'top': '0',
/* 343 */ 				'left': '0',
/* 344 */ 				'visibility': 'hidden'
/* 345 */ 			}
/* 346 */ 		}).inject(document.body);
/* 347 */ 		this.wrapper = new Element('div').inject(this.toolTip);
/* 348 */ 		$$(elements).each(this.build, this);
/* 349 */ 		if (this.options.initialize) this.options.initialize.call(this);
/* 350 */ 	},

/* mootools-1.11-addons.js */

/* 351 */ 
/* 352 */ 	build: function(el){
/* 353 */ 		el.$tmp.myTitle = (el.href && el.getTag() == 'a') ? el.href.replace('http://', '') : (el.rel || false);
/* 354 */ 		if (el.title){
/* 355 */ 			var dual = el.title.split('::');
/* 356 */ 			if (dual.length > 1){
/* 357 */ 				el.$tmp.myTitle = dual[0].trim();
/* 358 */ 				el.$tmp.myText = dual[1].trim();
/* 359 */ 			} else {
/* 360 */ 				el.$tmp.myText = el.title;
/* 361 */ 			}
/* 362 */ 			el.removeAttribute('title');
/* 363 */ 		} else {
/* 364 */ 			el.$tmp.myText = false;
/* 365 */ 		}
/* 366 */ 		if (el.$tmp.myTitle && el.$tmp.myTitle.length > this.options.maxTitleChars) el.$tmp.myTitle = el.$tmp.myTitle.substr(0, this.options.maxTitleChars - 1) + "&hellip;";
/* 367 */ 		el.addEvent('mouseenter', function(event){
/* 368 */ 			this.start(el);
/* 369 */ 			if (!this.options.fixed) this.locate(event);
/* 370 */ 			else this.position(el);
/* 371 */ 		}.bind(this));
/* 372 */ 		if (!this.options.fixed) el.addEvent('mousemove', this.locate.bindWithEvent(this));
/* 373 */ 		var end = this.end.bind(this);
/* 374 */ 		el.addEvent('mouseleave', end);
/* 375 */ 		el.addEvent('trash', end);
/* 376 */ 	},
/* 377 */ 
/* 378 */ 	start: function(el){
/* 379 */ 		this.wrapper.empty();
/* 380 */ 		if (el.$tmp.myTitle){
/* 381 */ 			this.title = new Element('span').inject(new Element('div', {'class': this.options.className + '-title'}).inject(this.wrapper)).set('html',el.$tmp.myTitle);
/* 382 */ 		}
/* 383 */ 		if (el.$tmp.myText){
/* 384 */ 			this.text = new Element('span').inject(new Element('div', {'class': this.options.className + '-text'}).inject(this.wrapper)).set('html',el.$tmp.myText);
/* 385 */ 		}
/* 386 */ 		$clear(this.timer);
/* 387 */ 		this.timer = this.show.delay(this.options.showDelay, this);
/* 388 */ 	},
/* 389 */ 
/* 390 */ 	end: function(event){
/* 391 */ 		$clear(this.timer);
/* 392 */ 		this.timer = this.hide.delay(this.options.hideDelay, this);
/* 393 */ 	},
/* 394 */ 
/* 395 */ 	position: function(element){
/* 396 */ 		if(element){
/* 397 */ 			var pos;
/* 398 */ 			if(element.page.x && element.page.y){
/* 399 */ 				pos = element.page;
/* 400 */ 			}else{

/* mootools-1.11-addons.js */

/* 401 */ 				if(element.target || element.srcElement) element = (element.target || element.srcElement);
/* 402 */ 				pos = element.getPosition();
/* 403 */ 			}
/* 404 */ 			if(pos){
/* 405 */ 				this.toolTip.setStyles({
/* 406 */ 					'left': pos.x + this.options.offsets.x,
/* 407 */ 					'top': pos.y + this.options.offsets.y
/* 408 */ 				});
/* 409 */ 			}
/* 410 */ 		}
/* 411 */ 	},
/* 412 */ 
/* 413 */ 	locate: function(event){
/* 414 */ 		var win = {'x': window.getWidth(), 'y': window.getHeight()};
/* 415 */ 		var scroll = {'x': window.getScrollLeft(), 'y': window.getScrollTop()};
/* 416 */ 		var tip = {'x': this.toolTip.offsetWidth, 'y': this.toolTip.offsetHeight};
/* 417 */ 		var prop = {'x': 'left', 'y': 'top'};
/* 418 */ 		for (var z in prop){
/* 419 */ 			var pos = event.page[z] + this.options.offsets[z];
/* 420 */ 			if ((pos + tip[z] - scroll[z]) > win[z]) pos = event.page[z] - this.options.offsets[z] - tip[z];
/* 421 */ 			this.toolTip.setStyle(prop[z], pos);
/* 422 */ 		};
/* 423 */ 	},
/* 424 */ 
/* 425 */ 	show: function(){
/* 426 */ 		if (this.options.timeout) this.timer = this.hide.delay(this.options.timeout, this);
/* 427 */ 		this.fireEvent('onShow');
/* 428 */ 	},
/* 429 */ 
/* 430 */ 	hide: function(){
/* 431 */ 		this.fireEvent('onHide');
/* 432 */ 	}
/* 433 */ 	
/* 434 */ });
/* 435 */ 
/* 436 */ Tips2.implement({
/* 437 */ 	options: {
/* 438 */ 		maxTitleChars: 37,
/* 439 */ 		showDelay: 100,
/* 440 */ 		hideDelay: 100,
/* 441 */ 		className: 'tool',
/* 442 */ 		offset: {'x': 16, 'y': 16},
/* 443 */ 		fixed: false,
/* 444 */ 		tipText: false
/* 445 */ 	},
/* 446 */ 	
/* 447 */ 	isMouseOver: 0,
/* 448 */ 	
/* 449 */ 	build: function(el){
/* 450 */ 		var el = ($type(el) == "string" ? document.id(el) : el);

/* mootools-1.11-addons.js */

/* 451 */ 		if(!el) return false;
/* 452 */ 		el.store('myTitle',(el.href && el.get('tag') == 'a') ? el.href.replace('http://', '') : (el.rel || false));
/* 453 */ 		if(this.options.tipText){
/* 454 */ 			var dual = this.options.tipText.split('::');
/* 455 */ 			if (dual.length > 1){
/* 456 */ 				el.store('myTitle',dual[0].trim());
/* 457 */ 				el.store('myText',dual[1].trim());
/* 458 */ 			} else {
/* 459 */ 				el.store('myText',el.title);
/* 460 */ 			}
/* 461 */ 		}else{
/* 462 */ 			if (el.title){
/* 463 */ 				var dual = el.title.split('::');
/* 464 */ 				if (dual.length > 1){
/* 465 */ 					el.store('myTitle',dual[0].trim());
/* 466 */ 					el.store('myText',dual[1].trim());
/* 467 */ 				} else {
/* 468 */ 					el.store('myText',el.title);
/* 469 */ 				}
/* 470 */ 				el.removeAttribute('title');
/* 471 */ 			} else {
/* 472 */ 				el.store('myText',false);
/* 473 */ 			}
/* 474 */ 		}
/* 475 */ 		if (el.retrieve('myTitle') && el.retrieve('myTitle').length > this.options.maxTitleChars) elstore('myTitle', el.retrieve('myTitle').substr(0, this.options.maxTitleChars - 1) + "&hellip;");
/* 476 */ 		el.addEvent('mouseenter', function(event){
/* 477 */ 			this.isMouseOver = 1;
/* 478 */ 			this.start(el);
/* 479 */ 			if (!this.options.fixed) this.locate(event);
/* 480 */ 			else this.position(el);
/* 481 */ 		}.bind(this));
/* 482 */ 		
/* 483 */ 		if (!this.options.fixed) el.addEvent('mousemove', this.locate.bindWithEvent(this));
/* 484 */ 		var end = this.end.bind(this);
/* 485 */ 		if(!el.hasClass('hasTips')) el.addClass('hasTips');
/* 486 */ 		el.addEvent('mouseleave', end);
/* 487 */ 		el.addEvent('trash', end);
/* 488 */ 	},
/* 489 */ 	
/* 490 */ 	start: function(el){
/* 491 */ 		this.wrapper.empty();
/* 492 */ 		if (el.retrieve('myTitle')) this.title = new Element('span').inject(new Element('div', {'class': this.options.className + '-title'}).inject(this.wrapper)).set('html', poptent_helpers.html_entity_decode(el.retrieve('myTitle')));
/* 493 */ 		this.text = new Element('span').inject(new Element('div', {'class': this.options.className + '-text'}).inject(this.wrapper)).set('html', poptent_helpers.html_entity_decode(((el.retrieve('myText'))?el.retrieve('myText'):'&nbsp;')));
/* 494 */ 		$clear(this.timer);
/* 495 */ 		this.timer = this.show.delay(this.options.showDelay, this);
/* 496 */ 	},
/* 497 */ 	
/* 498 */ 	end: function(event){
/* 499 */ 		this.isMouseOver = 0;
/* 500 */ 		$clear(this.timer);

/* mootools-1.11-addons.js */

/* 501 */ 		this.timer = this.hide.delay(this.options.hideDelay, this);
/* 502 */ 	},
/* 503 */ 	
/* 504 */ 	locate: function(event){
/* 505 */ 		var win = {'x': window.getWidth(), 'y': window.getHeight()};
/* 506 */ 		var scroll = {'x': window.getScrollLeft(), 'y': window.getScrollTop()};
/* 507 */ 		var tip = {'x': this.toolTip.offsetWidth, 'y': this.toolTip.offsetHeight};
/* 508 */ 		var prop = {'x': 'left', 'y': 'top'};
/* 509 */ 		var isBottom = 0;
/* 510 */ 		var isRight = 0;
/* 511 */ 		for (var z in prop){
/* 512 */ 			if($defined(event.page)){
/* 513 */ 				var pos = event.page[z] + this.options.offset[z];
/* 514 */ 				if ((pos + tip[z] - scroll[z]) > win[z]) {
/* 515 */ 					if(prop[z]=='top') isBottom = 1;
/* 516 */ 					if(prop[z]=='left') isRight = 1;
/* 517 */ 					pos = event.page[z] - this.options.offset[z] - tip[z];
/* 518 */ 				}
/* 519 */ 			}
/* 520 */ 			this.toolTip.setStyle(prop[z], pos);
/* 521 */ 		};
/* 522 */ 		if(isBottom == 0 && isRight == 0){
/* 523 */ 			this.toolTip.removeClass('right');
/* 524 */ 			this.toolTip.removeClass('bottom');
/* 525 */ 		}else if(isBottom == 1 && isRight == 0){
/* 526 */ 			this.toolTip.removeClass('right');
/* 527 */ 			if(!this.toolTip.hasClass('bottom')) this.toolTip.addClass('bottom');
/* 528 */ 		}else if(isBottom == 0 && isRight == 1){
/* 529 */ 			if(!this.toolTip.hasClass('right')) this.toolTip.addClass('right');
/* 530 */ 			this.toolTip.removeClass('bottom');
/* 531 */ 		}else if(isBottom == 1 && isRight == 1){
/* 532 */ 			if(!this.toolTip.hasClass('right')) this.toolTip.addClass('right');
/* 533 */ 			if(!this.toolTip.hasClass('bottom')) this.toolTip.addClass('bottom');
/* 534 */ 		}
/* 535 */ 		
/* 536 */ 	},
/* 537 */ 	
/* 538 */ 	remove: function() { 
/* 539 */ 		Garbage.collect(this.wrapper); 
/* 540 */ 		Garbage.collect(this.toolTip); 
/* 541 */ 		this.wrapper.dispose(); 
/* 542 */ 		this.toolTip.dispose(); 
/* 543 */ 	}
/* 544 */ });
/* 545 */ 
/* 546 */ /*
/* 547 *|  * extending Browser
/* 548 *|  */
/* 549 */ if (Browser.Engine.webkit){
/* 550 */ 	//needed on windows only

/* mootools-1.11-addons.js */

/* 551 */ 	Browser.Engine.chrome = !!((navigator.userAgent.toLowerCase().indexOf('chrome') > -1) && !Browser.Platform.mac);
/* 552 */ 	Browser.Engine.safari4 = !!(navigator.userAgent.toLowerCase().test(/version\/4/) && Browser.Platform.win);
/* 553 */ }else if (Browser.Engine.gecko){ 
/* 554 */ 	try{
/* 555 */ 		if(navigator.oscpu && navigator.userAgent.match("rv:1\.9")) Browser.Engine.ff3 = true;
/* 556 */ 	}catch(er){}
/* 557 */ }
/* 558 */ 
/* 559 */ 

;
/* gears.js */

/* 1  */ (function() {
/* 2  */ 	// We are already defined. Hooray!
/* 3  */ 	if (window.google && google.gears) return;
/* 4  */ 	var factory = null;
/* 5  */ 
/* 6  */ 	// Firefox
/* 7  */ 	if (typeof GearsFactory != 'undefined') {
/* 8  */ 		factory = new GearsFactory();
/* 9  */ 	} else {
/* 10 */ 		// IE
/* 11 */ 		try {
/* 12 */ 			factory = new ActiveXObject('Gears.Factory');
/* 13 */ 			if (factory.getBuildInfo().indexOf('ie_mobile') != -1) factory.privateSetGlobalObject(this);
/* 14 */ 		} catch (e) {
/* 15 */ 			// Safari
/* 16 */ 			if ((typeof navigator.mimeTypes != 'undefined') && navigator.mimeTypes["application/x-googlegears"]) {
/* 17 */ 				factory = document.createElement("object");
/* 18 */ 				factory.style.display = "none";
/* 19 */ 				factory.width = 0;
/* 20 */ 				factory.height = 0;
/* 21 */ 				factory.type = "application/x-googlegears";
/* 22 */ 				document.documentElement.appendChild(factory);
/* 23 */ 			}
/* 24 */ 		}
/* 25 */ 	}
/* 26 */ 	if (!factory) return;
/* 27 */ 	if (!window.google) google = {};
/* 28 */ 	if (!google.gears) google.gears = { factory : factory };
/* 29 */ })();
/* 30 */ 

;
/* fixpng.js */

/* 1  */ function fixPNG(el) {
/* 2  */ 	try {
/* 3  */ 		el = document.id(el);
/* 4  */ 		if (!el) return el;
/* 5  */ 		if (el.get('tag') == "img" && el.getProperty('src').test(".png")) {
/* 6  */ 			//alert('start processing '+el.getProperty('src'));
/* 7  */ 			var vis = el.isVisible();
/* 8  */ 			//alert('test');
/* 9  */ 			try { //safari sometimes crashes here, so catch it
/* 10 */ 				dim = el.getSize();
/* 11 */ 			}catch(er){}
/* 12 */ 			if(!vis){
/* 13 */ 				//alert(el.getProperty('src')+' apparently not visible');
/* 14 */ 				var before = {};
/* 15 */ 				//use this method instead of getStyles 
/* 16 */ 				['visibility', 'display', 'position'].each(function(style){
/* 17 */ 					before[style] = this.style[style]||'';
/* 18 */ 				}, this);
/* 19 */ 				//this.getStyles('visibility', 'display', 'position');
/* 20 */ 				this.setStyles({
/* 21 */ 					visibility: 'hidden',
/* 22 */ 					display: 'block',
/* 23 */ 					position:'absolute'
/* 24 */ 				});
/* 25 */ 				dim = el.getSize(); //works now, because the display isn't none
/* 26 */ 				this.setStyles(before); //put it back where it was
/* 27 */ 				el.hide();
/* 28 */ 			}
/* 29 */ 			//alert('create replacement for '+el.getProperty('src'))
/* 30 */ 			var imgSrc = el.src;
/* 31 */ 			imgSrc = (imgSrc || '').replace(/\(/g, '%28').replace(/\)/g, '%29');
/* 32 */ 			var replacement = new Element('span', {
/* 33 */ 				id:(el.id)?el.id:'',
/* 34 */ 				'class':(el.className)?el.className:'',
/* 35 */ 				title:(el.title)?el.title:(el.alt)?el.alt:'',
/* 36 */ 				styles: {
/* 37 */ 					display: vis?'inline-block':'none',
/* 38 */ 					width: dim.x+'px',
/* 39 */ 					height: dim.y+'px',
/* 40 */ 					filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader (src='" 
/* 41 */ 						+ imgSrc + "', sizingMethod='scale');"
/* 42 */ 				},
/* 43 */ 				src: el.src
/* 44 */ 			});
/* 45 */ 			if(el.style.cssText) {
/* 46 */ 				try {
/* 47 */ 					var styles = {};
/* 48 */ 					var s = el.style.cssText.split(';');
/* 49 */ 					s.each(function(style){
/* 50 */ 						var n = style.split(':');

/* fixpng.js */

/* 51 */ 						styles[n[0]] = n[1];
/* 52 */ 					});
/* 53 */ 					replacement.setStyle(styles);
/* 54 */ 				} catch(er){ }
/* 55 */ 			}
/* 56 */ 			if(replacement.cloneEvents){ replacement.cloneEvents(el);};
/* 57 */ 			replacement.replaces(el);
/* 58 */ 			//alert('fix foreground image '+el.src);
/* 59 */ 		} else if (el.get('tag') != "img") {
/* 60 */ 		 	var imgURL = el.getStyle('background-image');
/* 61 */ 		 	if (imgURL.test(/\((.+)\)/) && imgURL.test(".png")){
/* 62 */ 		 		var sM = (el.getStyle('background-repeat') == 'no-repeat') ? 'crop' : 'scale';
/* 63 */ 				el.setStyles({
/* 64 */ 		 			'background': "transparent url('"+poptent_helpers.add_image_base("trans.gif")+"') repeat top left",
/* 65 */ 		 			'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled='true', sizingMethod='"+sM+"', src='" + imgURL.match(/\((.+)\)/)[1] + "')"
/* 66 */ 		 		});
/* 67 */ 				delete sM;
/* 68 */ 				//alert('fixed');
/* 69 */ 		 	};
/* 70 */ 		};
/* 71 */ 	} catch(er) {}
/* 72 */ 	return;
/* 73 */ };
/* 74 */ if(Browser.Engine.trident4){ 
/* 75 */ 	window.addEvent(poptent_vars.load_event, function(){
/* 76 */ 		//$$('img','div','li').each(fixPNG);
/* 77 */ 		$$('.fixpng').each(fixPNG);
/* 78 */ 	});
/* 79 */ }
/* 80 */ 
/* 81 */ 
/* 82 */ 

;
/* observer.js */

/* 1  */ /**
/* 2  *|  * Observer - Observe formelements for changes
/* 3  *|  *
/* 4  *|  * @version		1.0rc1
/* 5  *|  *
/* 6  *|  * @license		MIT-style license
/* 7  *|  * @author		Harald Kirschner <mail [at] digitarald.de>
/* 8  *|  * @copyright	Author
/* 9  *|  */
/* 10 */ var Observer = new Class({
/* 11 */ 	Implements: [Options, Events],
/* 12 */ 	options: {
/* 13 */ 		periodical: false,
/* 14 */ 		delay: 1000,
/* 15 */ 		skipValue: ''
/* 16 */ 	},
/* 17 */ 
/* 18 */ 	initialize: function(el, onFired, options){
/* 19 */ 		if(!$defined(this.did)){
/* 20 */ 			this.did = poptent_vars.debug_id;
/* 21 */ 			poptent_vars.debug_id++;
/* 22 */ 		}
/* 23 */ 		this.setOptions(options);
/* 24 */ 		this.addEvent('onFired', onFired);
/* 25 */ 		this.element = el;
/* 26 */ 		this.listener = this.fired.bind(this);
/* 27 */ 		this.value = document.id(this.element).get('value');
/* 28 */ 		if (this.options.periodical) this.timer = this.listener.periodical(this.options.periodical);
/* 29 */ 		else document.id(this.element).addEvent('keydown', this.listener);
/* 30 */ 	},
/* 31 */ 
/* 32 */ 	fired: function() {
/* 33 */ 		var value = document.id(this.element).get('value');
/* 34 */ 		if(value==this.options.skipValue) return;
/* 35 */ 		if (this.value == value) return;
/* 36 */ 		this.clear();
/* 37 */ 		this.value = value;
/* 38 */ 		this.timeout = this.fireEvent.delay(this.options.delay, this, ['onFired', [value]]);
/* 39 */ 	},
/* 40 */ 
/* 41 */ 	clear: function() {
/* 42 */ 		$clear(this.timeout);
/* 43 */ 		return this;
/* 44 */ 	}
/* 45 */ });

;
/* autocompleter.js */

/* 1   */ /**
/* 2   *|  * Autocompleter
/* 3   *|  *
/* 4   *|  * @version		1.0rc4
/* 5   *|  *
/* 6   *|  * @license		MIT-style license
/* 7   *|  * @author		Harald Kirschner <mail [at] digitarald.de>
/* 8   *|  * @copyright	Author
/* 9   *|  */
/* 10  */ 
/* 11  */ 
/* 12  */ 
/* 13  */ 
/* 14  */ var Autocompleter = {};
/* 15  */ 
/* 16  */ Autocompleter.Base = new Class({
/* 17  */ 	Implements: [Options, Events],
/* 18  */ 	
/* 19  */ 	options: {
/* 20  */ 		minLength: 1,
/* 21  */ 		useSelection: true,
/* 22  */ 		markQuery: true,
/* 23  */ 		inheritWidth: true,
/* 24  */ 		maxChoices: 10,
/* 25  */ 		injectChoice: null,
/* 26  */ 		onSelect: $empty,
/* 27  */ 		onShow: $empty,
/* 28  */ 		onHide: $empty,
/* 29  */ 		customTarget: null,
/* 30  */ 		className: 'autocompleter-choices',
/* 31  */ 		zIndex: 42,
/* 32  */ 		observerOptions: {},
/* 33  */ 		fxOptions: {},
/* 34  */ 		overflown: [],
/* 35  */ 		container: null
/* 36  */ 	},
/* 37  */ 	currentValue: '',
/* 38  */ 	initialize: function (el, options) {
/* 39  */ 		if (!$defined(this.did)){
/* 40  */ 			this.did = poptent_vars.debug_id;
/* 41  */ 			poptent_vars.debug_id++;
/* 42  */ 		}
/* 43  */ 		this.setOptions(options);
/* 44  */ 		this.element = el;
/* 45  */ 		document.id(this.element).getRelativePosition();
/* 46  */ 		this.build();
/* 47  */ 		this.observer = new Observer(document.id(this.element), this.prefetch.bind(this), $merge({
/* 48  */ 			delay: 400
/* 49  */ 		}, this.options.observerOptions));
/* 50  */ 		this.value = this.observer.value = document.id(this.element).value;

/* autocompleter.js */

/* 51  */ 		this.queryValue = this.value;
/* 52  */ 	},
/* 53  */ 
/* 54  */ 	/**
/* 55  *| 	 * build - Initialize DOM
/* 56  *| 	 *
/* 57  *| 	 * Builds the html structure for choices and appends the events to the element.
/* 58  *| 	 * Override this function to modify the html generation.
/* 59  *| 	 */
/* 60  */ 	build: function () {
/* 61  */ 		if (document.id(this.options.customTarget)) this.choices = this.options.customTarget;
/* 62  */ 		else {
/* 63  */ 			this.choices = new Element('ul', {
/* 64  */ 				'class': this.options.className,
/* 65  */ 				styles: {zIndex: this.options.zIndex}
/* 66  */ 			}).injectInside(this.options.container ? document.id(this.options.container).getElement('.autocompleter-wrapper') : document.body);
/* 67  */ 			this.fix = new OverlayFix(this.choices);
/* 68  */ 		}
/* 69  */ 		this.fx = new Fx.Tween(this.choices,$merge({
/* 70  */ 			property:'opacity',
/* 71  */ 			wait: false,
/* 72  */ 			duration: 200
/* 73  */ 		}, this.options.fxOptions)).addEvent('onStart', function () {
/* 74  */ 				if (this.fx.now) return;
/* 75  */ 				this.choices.setStyle('display', 'block');
/* 76  */ 				this.fix.show();
/* 77  */ 			}.bind(this))
/* 78  */ 			.addEvent('onComplete', function () {
/* 79  */ 				if (this.fx.now) return;
/* 80  */ 				this.fix.hide();
/* 81  */ 			}.bind(this)).set(0);
/* 82  */ 		document.id(this.element).setProperty('autocomplete', 'off')
/* 83  */ 			.addEvent(Browser.Engine.trident ? 'keydown' : 'keypress', this.onCommand.bindWithEvent(this))
/* 84  */ 			.addEvent('mousedown', this.onCommand.bindWithEvent(this, [true]))
/* 85  */ 			.addEvent('focus', this.toggleFocus.bind(this, [true]))
/* 86  */ 			.addEvent('blur', this.toggleFocus.bind(this, [false]))
/* 87  */ 			.addEvent('trash', this.destroy.bind(this));
/* 88  */ 	},
/* 89  */ 
/* 90  */ 	destroy: function () {
/* 91  */ 		this.choices.destroy();
/* 92  */ 	},
/* 93  */ 
/* 94  */ 	toggleFocus: function (state) {
/* 95  */ 		this.focussed = state;
/* 96  */ 		if (this.focussed) {
/* 97  */ 			document.id(this.element).addClass('selected');
/* 98  */ 			this.currentValue = document.id(this.element).value;
/* 99  */ 			if (document.id(this.element).value == document.id(this.element).getProperty('defaultMsg')) { 
/* 100 */ 				document.id(this.element).value = '';

/* autocompleter.js */

/* 101 */ 				document.id(this.element).removeClass('defaultText');
/* 102 */ 			}
/* 103 */ 		}else{
/* 104 */ 			document.id(this.element).removeClass('selected');
/* 105 */ 			if (document.id(this.element).value == '' && document.id(this.element).getProperty('defaultMsg')) { 
/* 106 */ 				document.id(this.element).addClass('defaultText');
/* 107 */ 				document.id(this.element).value = document.id(this.element).getProperty('defaultMsg');
/* 108 */ 			}
/* 109 */ 		}
/* 110 */ 		if (!state) this.hideChoices();
/* 111 */ 	},
/* 112 */ 
/* 113 */ 	onCommand: function (e, mouse) {
/* 114 */ 		if (mouse && this.focussed) this.prefetch();
/* 115 */ 		if (e.key && !e.shift) switch (e.key) {
/* 116 */ 			case 'enter':
/* 117 */ 				if (this.selected && this.visible) {
/* 118 */ 					this.choiceSelect(this.selected);
/* 119 */ 					e.stop();
/* 120 */ 				} return;
/* 121 */ 			case 'up': case 'down': 
/* 122 */ 				if(!this.selected) { this.choiceOver(this.choices.getFirst()); return; }
/* 123 */ 				if (this.observer.value != (this.value || this.queryValue)) this.prefetch();
/* 124 */ 				else if (this.queryValue === null) break;
/* 125 */ 				else if (!this.visible) this.showChoices();
/* 126 */ 				else {
/* 127 */ 					this.choiceOver((e.key == 'up')
/* 128 */ 						? this.selected.getPrevious() || this.choices.getLast()
/* 129 */ 						: this.selected.getNext() || this.choices.getFirst() );
/* 130 */ 					this.setSelection();
/* 131 */ 				}
/* 132 */ 				e.stop(); return;
/* 133 */ 			case 'esc': this.hideChoices(); return;
/* 134 */ 		}
/* 135 */ 		this.value = false;
/* 136 */ 	},
/* 137 */ 
/* 138 */ 	setSelection: function () {
/* 139 */ 		if (!this.options.useSelection) return;
/* 140 */ 		var startLength = this.queryValue.length;
/* 141 */ 		if (document.id(this.element).value.indexOf(this.queryValue) != 0) return;
/* 142 */ 		var insert = this.selected.inputValue.substr(startLength);
/* 143 */ 		if (document.getSelection) {
/* 144 */ 			document.id(this.element).value = this.queryValue + insert;
/* 145 */ 			document.id(this.element).selectionStart = startLength;
/* 146 */ 			document.id(this.element).selectionEnd = document.id(this.element).value.length;
/* 147 */ 		} else if (document.selection) {
/* 148 */ 			var sel = document.selection.createRange();
/* 149 */ 			sel.text = insert;
/* 150 */ 			sel.move("character", - insert.length);

/* autocompleter.js */

/* 151 */ 			sel.findText(insert);
/* 152 */ 			sel.select();
/* 153 */ 		}
/* 154 */ 		this.value = this.observer.value = document.id(this.element).value;
/* 155 */ 	},
/* 156 */ 
/* 157 */ 	hideChoices: function () {
/* 158 */ 		if (!this.visible) return;
/* 159 */ 		this.visible = this.value = false;
/* 160 */ 		this.observer.clear();
/* 161 */ 		this.fx.start(0).chain(function(){ this.choices.setStyle('display', 'none'); }.bind(this));
/* 162 */ 		this.choices.setStyle('display', 'none');
/* 163 */ 		this.fireEvent('onHide', [document.id(this.element), this.choices]);
/* 164 */ 	},
/* 165 */ 
/* 166 */ 	showChoices: function () {
/* 167 */ 		if (this.visible || !this.choices.getFirst()) return;
/* 168 */ 		this.visible = true;
/* 169 */ 		var pos = document.id(this.element).getCoordinates(this.options.overflown);
/* 170 */ 		this.choices.setStyles({
/* 171 */ 			left: pos.left,
/* 172 */ 			top: pos.bottom
/* 173 */ 		});
/* 174 */ 		if (this.options.inheritWidth) this.choices.setStyle('width', pos.width);
/* 175 */ 		this.choices.setStyle('display', 'block');
/* 176 */ 		this.fx.start(0.9);
/* 177 */ 		this.choiceOver(this.choices.getFirst());
/* 178 */ 		this.fireEvent('onShow', [document.id(this.element), this.choices]);
/* 179 */ 	},
/* 180 */ 
/* 181 */ 	prefetch: function () {
/* 182 */ 		if (document.id(this.element).value.length < this.options.minLength){
/* 183 */ 			this.hideChoices();
/* 184 */ 		}else if (document.id(this.element).value == this.queryValue){ 
/* 185 */ 			this.showChoices();
/* 186 */ 		}else{ 
/* 187 */ 			this.query();
/* 188 */ 		}
/* 189 */ 	},
/* 190 */ 
/* 191 */ 	updateChoices: function (choices) {
/* 192 */ 		this.choices.empty();
/* 193 */ 		this.selected = null;
/* 194 */ 		if (!choices || !choices.length) return;
/* 195 */ 		if (this.options.maxChoices < choices.length) choices.length = this.options.maxChoices;
/* 196 */ 		choices.each(this.options.injectChoice || function (choice, i){
/* 197 */ 			var el = new Element('li', {'html': poptent_helpers.html_entity_decode(this.markQueryValue(choice))});
/* 198 */ 			el.inputValue = choice;
/* 199 */ 			this.addChoiceEvents(el).injectInside(this.choices);
/* 200 */ 		}, this);

/* autocompleter.js */

/* 201 */ 		this.showChoices();
/* 202 */ 	},
/* 203 */ 
/* 204 */ 	choiceOver: function (el) {
/* 205 */ 		if (this.selected){ this.selected.removeClass('autocompleter-selected');}
/* 206 */ 		this.selected = el.addClass('autocompleter-selected');
/* 207 */ 	},
/* 208 */ 
/* 209 */ 	choiceSelect: function (el) {
/* 210 */ 		this.observer.value = document.id(this.element).value = el.inputValue;
/* 211 */ 		this.hideChoices();
/* 212 */ 		this.fireEvent('onSelect', [document.id(this.element)], 20);
/* 213 */ 	},
/* 214 */ 	
/* 215 */ 	clickOutside: function (evt){
/* 216 */ 		var cSize = this.completer.getSize();
/* 217 */ 		var cPos = this.completer.getPosition();
/* 218 */ 		var s_left = window.getScrollLeft();
/* 219 */ 		var s_top = window.getScrollTop();
/* 220 */ 		if ( 
/* 221 */ 			(
/* 222 */ 				evt.client.x + s_left < cPos.x || 
/* 223 */ 				evt.client.x + s_left > cPos.x + cSize.x || 
/* 224 */ 				evt.client.y + s_top < cPos.y || 
/* 225 */ 				evt.client.y + s_top > cPos.y + cSize.y
/* 226 */ 			) &&
/* 227 */ 			!this.inputFocussed
/* 228 */ 		){
/* 229 */ 			//alert(cPos.x+'|'+cSize.x);
/* 230 */ 			//this.completer.setStyle('display','none');
/* 231 */ 			this.toggleFocus(false);
/* 232 */ 			window.removeEvents('click');
/* 233 */ 		}
/* 234 */ 	},
/* 235 */ 
/* 236 */ 	/**
/* 237 *| 	 * markQueryValue
/* 238 *| 	 *
/* 239 *| 	 * Marks the queried word in the given string with <span class="autocompleter-queried">*</span>
/* 240 *| 	 * Call this i.e. from your custom parseChoices, same for addChoiceEvents
/* 241 *| 	 *
/* 242 *| 	 * @param		{String} Text
/* 243 *| 	 * @return		{String} Text
/* 244 *| 	 */
/* 245 */ 	markQueryValue: function (txt) {
/* 246 */ 		return txt;
/* 247 */ 	},
/* 248 */ 
/* 249 */ 	/**
/* 250 *| 	 * addChoiceEvents

/* autocompleter.js */

/* 251 *| 	 *
/* 252 *| 	 * Appends the needed event handlers for a choice-entry to the given element.
/* 253 *| 	 *
/* 254 *| 	 * @param		{Element} Choice entry
/* 255 *| 	 * @return		{Element} Choice entry
/* 256 *| 	 */
/* 257 */ 	addChoiceEvents: function (el) {
/* 258 */ 		return el.addEvents({
/* 259 */ 			mouseover: this.choiceOver.bind(this, [el]),
/* 260 */ 			mousedown: this.choiceSelect.bind(this, [el])
/* 261 */ 		});
/* 262 */ 	}
/* 263 */ });
/* 264 */ 
/* 265 */ Autocompleter.Local = new Class({
/* 266 */ 	
/* 267 */ 	Extends: Autocompleter.Base,
/* 268 */ 	Implements: [Options, Events],
/* 269 */ 	
/* 270 */ 	options: {
/* 271 */ 		minLength: 0,
/* 272 */ 		filterTokens : null
/* 273 */ 	},
/* 274 */ 
/* 275 */ 	initialize: function (el, tokens, options) {
/* 276 */ 		if (!$defined(this.did)){
/* 277 */ 			this.did = poptent_vars.debug_id;
/* 278 */ 			poptent_vars.debug_id++;
/* 279 */ 		}
/* 280 */ 		this.parent(el, options);
/* 281 */ 		this.tokens = tokens;
/* 282 */ 		if (this.options.filterTokens) this.filterTokens = this.options.filterTokens.bind(this);
/* 283 */ 	},
/* 284 */ 
/* 285 */ 	query: function () {
/* 286 */ 		this.hideChoices();
/* 287 */ 		this.queryValue = document.id(this.element).value;
/* 288 */ 		this.updateChoices(this.filterTokens());
/* 289 */ 	},
/* 290 */ 
/* 291 */ 	filterTokens: function (token) {
/* 292 */ 		var regex = new RegExp('^' + this.queryValue.escapeRegExp(), 'i');
/* 293 */ 		return this.tokens.filter(function (token) {
/* 294 */ 			return regex.test(token);
/* 295 */ 		});
/* 296 */ 	}
/* 297 */ 
/* 298 */ });
/* 299 */ 
/* 300 */ Autocompleter.Ajax = {};

/* autocompleter.js */

/* 301 */ 
/* 302 */ Autocompleter.Ajax.Base = new Class({
/* 303 */ 	
/* 304 */ 	Extends: Autocompleter.Base,
/* 305 */ 	Implements: [Options, Events],
/* 306 */ 	
/* 307 */ 	options: {
/* 308 */ 		postVar: 'value',
/* 309 */ 		postData: {},
/* 310 */ 		ajaxOptions: {},
/* 311 */ 		onRequest: $empty,
/* 312 */ 		onComplete: $empty
/* 313 */ 	},
/* 314 */ 
/* 315 */ 	initialize: function (el, url, options) {
/* 316 */ 		if (!$defined(this.did)){
/* 317 */ 			this.did = poptent_vars.debug_id;
/* 318 */ 			poptent_vars.debug_id++;
/* 319 */ 		}
/* 320 */ 		this.parent(el, options);
/* 321 */ 		this.ajax = new Request($merge({
/* 322 */ 			'url': url,
/* 323 */ 			link: 'cancel'
/* 324 */ 		}, this.options.ajaxOptions));
/* 325 */ 		this.ajax.addEvent('onComplete', this.queryResponse.bind(this));
/* 326 */ 		this.ajax.addEvent('onFailure', this.queryResponse.bind(this, [false]));
/* 327 */ 	},
/* 328 */ 
/* 329 */ 	query: function (){
/* 330 */ 		var data = new Hash({}).extend(this.options.postData);
/* 331 */ 		data.set(this.options.postVar, document.id(this.element).value);
/* 332 */ 		this.fireEvent('onRequest', [document.id(this.element), this.ajax]);
/* 333 */ 		this.ajax.send(data.toQueryString());
/* 334 */ 	},
/* 335 */ 
/* 336 */ 	/**
/* 337 *| 	 * queryResponse - abstract
/* 338 *| 	 *
/* 339 *| 	 * Inherated classes have to extend this function and use this.parent(resp)
/* 340 *| 	 *
/* 341 *| 	 * @param		{String} Response
/* 342 *| 	 */
/* 343 */ 	queryResponse: function (resp) {
/* 344 */ 		this.value = this.queryValue = document.id(this.element).value;
/* 345 */ 		this.selected = false;
/* 346 */ 		this.hideChoices();
/* 347 */ 		this.fireEvent(resp ? 'onComplete' : 'onFailure', [document.id(this.element), this.ajax], 20);
/* 348 */ 	}
/* 349 */ 
/* 350 */ });

/* autocompleter.js */

/* 351 */ 
/* 352 */ Autocompleter.Ajax.Json = new Class({
/* 353 */ 	
/* 354 */ 	Extends: Autocompleter.Ajax.Base,
/* 355 */ 	Implements: [Options, Events],
/* 356 */ 	
/* 357 */ 	queryResponse: function (resp) {
/* 358 */ 	this.parent(resp);
/* 359 */ 		var choices = JSON.decode(resp || false);
/* 360 */ 		if (!choices || !choices.length) return;
/* 361 */ 		this.updateChoices(choices);
/* 362 */ 	}
/* 363 */ 
/* 364 */ });
/* 365 */ 
/* 366 */ 
/* 367 */ var OverlayFix = new Class({
/* 368 */ 
/* 369 */ 	initialize: function (el) {
/* 370 */ 		if (!$defined(this.did)){
/* 371 */ 			this.did = poptent_vars.debug_id;
/* 372 */ 			poptent_vars.debug_id++;
/* 373 */ 		}
/* 374 */ 		this.element = el;
/* 375 */ 		if (Browser.Engine.trident){
/* 376 */ 			document.id(this.element).addEvent('trash', this.destroy.bind(this));
/* 377 */ 			this.fix = new Element('iframe', {
/* 378 */ 				properties: {
/* 379 */ 					frameborder: '0',
/* 380 */ 					scrolling: 'no',
/* 381 */ 					src: 'javascript:false;'
/* 382 */ 				},
/* 383 */ 				styles: {
/* 384 */ 					position: 'absolute',
/* 385 */ 					border: 'none',
/* 386 */ 					display: 'none',
/* 387 */ 					filter: 'progid:DXImageTransform.Microsoft.Alpha(opacity=0)'
/* 388 */ 				}
/* 389 */ 			}).injectAfter(document.id(this.element));
/* 390 */ 		}
/* 391 */ 	},
/* 392 */ 
/* 393 */ 	show: function () {
/* 394 */ 		if (this.fix) this.fix.setStyles($extend(
/* 395 */ 			document.id(this.element).getCoordinates(), {
/* 396 */ 				display: '',
/* 397 */ 				zIndex: (document.id(this.element).getStyle('zIndex') || 1) - 1
/* 398 */ 			}));
/* 399 */ 		return this;
/* 400 */ 	},

/* autocompleter.js */

/* 401 */ 
/* 402 */ 	hide: function () {
/* 403 */ 		if (this.fix) this.fix.setStyle('display', 'none');
/* 404 */ 		return this;
/* 405 */ 	},
/* 406 */ 
/* 407 */ 	destroy: function () {
/* 408 */ 		this.fix.destroy();
/* 409 */ 	}
/* 410 */ 
/* 411 */ });

;
/* autocompleterCredits.js */

/* 1   */ /*
/* 2   *|  * Autocompleter (CREDITS COMPLETER)
/* 3   *|  *
/* 4   *|  * @version		1.0rc4
/* 5   *|  *
/* 6   *|  * @license		MIT-style license
/* 7   *|  * @author		Harald Kirschner <mail [at] digitarald.de>
/* 8   *|  * @copyright	Author
/* 9   *|  */
/* 10  */ var AutocompleterCredits = {};
/* 11  */ 
/* 12  */ AutocompleterCredits.Base = new Class({
/* 13  */ 	Implements: [Options, Events],
/* 14  */ 	options: {
/* 15  */ 		minLength: 0,
/* 16  */ 		useSelection: true,
/* 17  */ 		markQuery: true,
/* 18  */ 		inheritWidth: true,
/* 19  */ 		injectChoice: null,
/* 20  */ 		onSelect: $empty,
/* 21  */ 		onShow: $empty,
/* 22  */ 		onHide: $empty,
/* 23  */ 		customTarget: null,
/* 24  */ 		className: 'autocompleterCredits-choices',
/* 25  */ 		barClassName: 'autocompleterCreditsBottomBar',
/* 26  */ 		divClass: 'autocompleterCredits-choices-div',
/* 27  */ 		zIndex: 1000003,
/* 28  */ 		observerOptions: {},
/* 29  */ 		fxOptions: {},
/* 30  */ 		overflown: [],
/* 31  */ 		closeEls: null,
/* 32  */ 		container: null,
/* 33  */ 		perpage: 0,
/* 34  */ 		assoc: 0,
/* 35  */ 		forceFetch: false,
/* 36  */ 		offset_left: null	//hack to align autocompleter in ie
/* 37  */ 	},
/* 38  */ 	pos: null,
/* 39  */ 	itemInfo: null,
/* 40  */ 	currvalue: null,
/* 41  */ 	pagedown: null,
/* 42  */ 	pageup: null,
/* 43  */ 	filter: 0,
/* 44  */ 	page: 1,
/* 45  */ 	total: 0,
/* 46  */ 	perpage: 10,
/* 47  */ 	lastvalue: '',
/* 48  */ 	resultscache: null,
/* 49  */ 	initialize: function(el, options) {
/* 50  */ 		this.setOptions(options);

/* autocompleterCredits.js */

/* 51  */ 		this.resetcache();
/* 52  */ 		//this.element = ($type(el) == "string" ? document.id(el) : el);
/* 53  */ 		this.element = el;
/* 54  */ 		this.pos = document.id(this.element).getPosition(this.element);
/* 55  */ 		this.defaultValue = document.id(this.element).get('value');
/* 56  */ 		this.prebuild();
/* 57  */ 		this.observer = new Observer(document.id(this.element), this.prefetch.bind(this), $merge({
/* 58  */ 			delay: 400,
/* 59  */ 			skipValue: this.defaultValue
/* 60  */ 		}, this.options.observerOptions));
/* 61  */ 		this.value = this.observer.value;
/* 62  */ 		this.queryValue = null;
/* 63  */ 		this.inputHasFocus();
/* 64  */ 		this.removeDefaultMsg();
/* 65  */ 		if(this.options.closeEls) this.addBoxCloseEvent(this.options.closeEls);
/* 66  */ 		if(this.options.perpage>0) this.perpage = this.options.perpage;
/* 67  */ 	},
/* 68  */ 	
/* 69  */ 	resetcache: function(){
/* 70  */ 		this.resultscache = null;
/* 71  */ 		this.resultscache = new Hash();
/* 72  */ 	},
/* 73  */ 	
/* 74  */ 	prebuild: function(){
/* 75  */ 		if(!this.pos) this.pos = document.id(this.element).getPosition(this.element);
/* 76  */ 		if (document.id(this.options.customTarget)){
/* 77  */ 			this.choices = this.options.customTarget;
/* 78  */ 		} else {
/* 79  */ 			this.addControls();
/* 80  */ 			this.choices = new Element('ul', {'class': this.options.className});
/* 81  */ 			this.completer = new Element('div', {
/* 82  */ 				'class': this.options.divClass,
/* 83  */ 				'styles': {
/* 84  */ 					'zIndex': this.options.zIndex,
/* 85  */ 					'top': this.pos.y.toInt()+6+'px',
/* 86  */ 					'left': this.pos.x.toInt()+6+'px',
/* 87  */ 					'position': 'absolute',
/* 88  */ 					'margin-top': -1
/* 89  */ 				}
/* 90  */ 			});
/* 91  */ 			this.build();
/* 92  */ 			this.fix = new OverlayFix(this.completer);
/* 93  */ 			/*
/* 94  *| 			 * Added to reposition completer when window is resized
/* 95  *| 			 */
/* 96  */ 			window.addEvent('resize', this.reposition.bind(this));
/* 97  */ 		}
/* 98  */ 		this.addFX();
/* 99  */ 	},
/* 100 */ 	

/* autocompleterCredits.js */

/* 101 */ 	reposition: function() {
/* 102 */ 		var pos = document.id(this.element).getCoordinates(this.options.overflown);
/* 103 */ 		this.completer.setStyles({
/* 104 */ 			'left': pos.left,
/* 105 */ 			'top': pos.bottom
/* 106 */ 		});
/* 107 */ 	},
/* 108 */ 	
/* 109 */ 	build: function() {
/* 110 */ 		this.bottom = new Element('div', {'class': this.options.barClassName+' ie_layout', 'html': 'Didn\'t find who you were looking for? '}).adopt(
/* 111 */ 			new Element('a', {'href': '#', 'html': 'click here to add a new person.', 'events': {
/* 112 */ 				'click': function(e){
/* 113 */ 					try{ new Event(e).stop(); }catch(er){};
/* 114 */ 					this.itemInfo = {}; this.itemType = 'new'; this.invite = null;
/* 115 */ 					this.fireEvent('onSelect', [this.itemInfo,this.itemType], 20);
/* 116 */ 				}.bind(this)
/* 117 */ 			}})
/* 118 */ 		);
/* 119 */ 		this.controls.adopt(this.paginate);
/* 120 */ 		this.completer.adopt(this.controls, this.choices, this.bottom).injectInside(this.options.container ? document.id(this.options.container).getElement('.autocompleter-wrapper') : document.body);		
/* 121 */ 	},
/* 122 */ 	
/* 123 */ 	addControls: function(){
/* 124 */ 		this.controls =  new Element('div', {'class': 'autocompleter-controls ie_layout'});
/* 125 */ 		if(Browser.Engine.trident6) this.controls.setStyle('visibility', 'hidden');
/* 126 */ 		this.paginate =  new Element('div', {'class': 'autocompleter-pages'});
/* 127 */ 		var headWrap = new Element('span', {'class': 'head', 'html': 'Search:'}).injectInside(this.controls);
/* 128 */ 		var contcontain = new Element('div', {'class': 'searchSort', 'styles': {'margin-top': 0, 'margin-bottom': '5px'}});
/* 129 */ 		var contul = new Element('ul').injectInside(contcontain);
/* 130 */ 		
/* 131 */ 		this.pagedown = new Element('div', {'class': 'pudWrap', 'events': {
/* 132 */ 			'click': function(e){
/* 133 */ 				try{ new Event(e).stop(); }catch(er){};
/* 134 */ 				if(!this.pagedown.hasClass('selected')){
/* 135 */ 					if((this.page+1)*this.perpage > (Math.ceil((this.total/this.perpage))*this.perpage)) return false;
/* 136 */ 					this.page = this.page+1;
/* 137 */ 					this.urlext = this.url+this.page+'/'+this.filter;
/* 138 */ 					this.query();
/* 139 */ 				}
/* 140 */ 			}.bind(this)
/* 141 */ 		}}).adopt(new Element('div', {'class': 'pud ptd'})).injectInside(this.paginate);
/* 142 */ 		this.pageup = new Element('div', {'class': 'pudWrap', 'events': {
/* 143 */ 			'click': function(e){
/* 144 */ 				try{ new Event(e).stop(); }catch(er){};
/* 145 */ 				if(!this.pageup.hasClass('selected')){
/* 146 */ 					if(this.page==1) return false;
/* 147 */ 					this.page = this.page-1;
/* 148 */ 					this.query();
/* 149 */ 				}
/* 150 */ 			}.bind(this)

/* autocompleterCredits.js */

/* 151 */ 		}}).adopt(new Element('div', {'class': 'pud ptu'})).injectInside(this.paginate);
/* 152 */ 		
/* 153 */ 		var everyoneWrap = new Element('li', {'class': 'selected'}).adopt(new Element('a', {'href': '#', 'html': 'Everyone', 'events': {
/* 154 */ 			'click': function(e){
/* 155 */ 				try{ new Event(e).stop(); }catch(er){};
/* 156 */ 				if(!everyoneWrap.hasClass('selected')){
/* 157 */ 					everyoneWrap.addClass('selected');
/* 158 */ 					ifollWrap.removeClass('selected');
/* 159 */ 					follmeWrap.removeClass('selected');
/* 160 */ 					friendsWrap.removeClass('selected');
/* 161 */ 					this.filter = 0;
/* 162 */ 					this.page = 1;
/* 163 */ 					this.query();
/* 164 */ 				}
/* 165 */ 			}.bind(this)
/* 166 */ 		}})).injectInside(contul);
/* 167 */ 		var friendsWrap = new Element('li').adopt(new Element('a', {'href': '#', 'html': 'Friends', 'events': {
/* 168 */ 			'click': function(e){
/* 169 */ 				try{ new Event(e).stop(); }catch(er){};
/* 170 */ 				if(!friendsWrap.hasClass('selected')){
/* 171 */ 					friendsWrap.addClass('selected');
/* 172 */ 					follmeWrap.removeClass('selected');
/* 173 */ 					ifollWrap.removeClass('selected');
/* 174 */ 					everyoneWrap.removeClass('selected');
/* 175 */ 					this.filter = 1;
/* 176 */ 					this.page = 1;
/* 177 */ 					this.query();
/* 178 */ 				}
/* 179 */ 			}.bind(this)
/* 180 */ 		}})).injectInside(contul);
/* 181 */ 		var follmeWrap = new Element('li').adopt(new Element('a', {'href': '#', 'html': 'Following Me', 'events': {
/* 182 */ 			'click': function(e){
/* 183 */ 				try{ new Event(e).stop(); }catch(er){};
/* 184 */ 				if(!follmeWrap.hasClass('selected')){
/* 185 */ 					follmeWrap.addClass('selected');
/* 186 */ 					ifollWrap.removeClass('selected');
/* 187 */ 					everyoneWrap.removeClass('selected');
/* 188 */ 					friendsWrap.removeClass('selected');
/* 189 */ 					this.filter = 2;
/* 190 */ 					this.page = 1;
/* 191 */ 					this.query();
/* 192 */ 				}
/* 193 */ 			}.bind(this)
/* 194 */ 		}})).injectInside(contul);
/* 195 */ 		var ifollWrap = new Element('li').adopt(new Element('a', {'href': '#', 'html': 'I Follow', 'events': {
/* 196 */ 			'click': function(e){
/* 197 */ 				try{ new Event(e).stop(); }catch(er){};
/* 198 */ 				if(!ifollWrap.hasClass('selected')){
/* 199 */ 					ifollWrap.addClass('selected');
/* 200 */ 					follmeWrap.removeClass('selected');

/* autocompleterCredits.js */

/* 201 */ 					everyoneWrap.removeClass('selected');
/* 202 */ 					friendsWrap.removeClass('selected');
/* 203 */ 					this.filter = 3;
/* 204 */ 					this.page = 1;
/* 205 */ 					this.query();
/* 206 */ 				}
/* 207 */ 			}.bind(this)
/* 208 */ 		}})).injectInside(contul);
/* 209 */ 		new Element('div', {'class': 'clear'}).injectInside(contcontain);
/* 210 */ 		contcontain.injectInside(this.controls);
/* 211 */ 	},
/* 212 */ 	
/* 213 */ 	addFX: function(){
/* 214 */ 		this.fx = new Fx.Tween(this.completer, $merge({property:'opacity','wait': false,'duration': 100}, this.options.fxOptions))
/* 215 */ 			.addEvent('onStart', function() {
/* 216 */ 				if (this.fx.now) return;
/* 217 */ 				this.completer.setStyle('display', 'block');
/* 218 */ 				if(!this.options.container) this.fix.show();
/* 219 */ 			}.bind(this))
/* 220 */ 			.addEvent('onComplete', function() {
/* 221 */ 				if (this.fx.now) return;
/* 222 */ 				if(!this.options.container) this.fix.hide();
/* 223 */ 			}.bind(this)).set(0);
/* 224 */ 			document.id(this.element).setProperty('autocomplete', 'off')
/* 225 */ 			.addEvent(Browser.Engine.trident ? 'keydown' : 'keypress', this.onCommand.bindWithEvent(this))
/* 226 */ 			.addEvent('click', this.onCommand.bindWithEvent(this))
/* 227 */ 			.addEvent('mousedown', this.onCommand.bindWithEvent(this, [true]))
/* 228 */ 			//.addEvent('focus', this.toggleFocus.bind(this, [true]))
/* 229 */ 			//.addEvent('focus', this.prefetch.bind(this))
/* 230 */ 			.addEvent('focus', function(){
/* 231 */ 				this.toggleFocus(true);
/* 232 */ 				this.prefetch();
/* 233 */ 			}.bind(this))
/* 234 */ 			.addEvent('trash', this.destroy.bind(this));
/* 235 */ 	},
/* 236 */ 	
/* 237 */ 	defaultFocus: function(){
/* 238 */ 		document.id(this.element).removeClass('defaultText');
/* 239 */ 		if(document.id(this.element).getProperty('value') == this.defaultValue) document.id(this.element).setProperty('value','');
/* 240 */ 	},
/* 241 */ 	
/* 242 */ 	defaultBlur: function(){
/* 243 */ 		if(document.id(this.element).getProperty('value') == this.defaultValue || document.id(this.element).getProperty('value') == '') {
/* 244 */ 			document.id(this.element).setProperty('value',this.defaultValue).addClass('defaultText');
/* 245 */ 		}
/* 246 */ 	},
/* 247 */ 	
/* 248 */ 	removeDefaultMsg: function(){
/* 249 */ 		(this.inputFocussed)?this.defaultFocus():this.defaultBlur();
/* 250 */ 	},

/* autocompleterCredits.js */

/* 251 */ 	
/* 252 */ 	clickOutside: function(evt){
/* 253 */ 		var cSize = this.completer.getSize();
/* 254 */ 		var cPos = this.completer.getPosition();
/* 255 */ 		var s_left = window.getScrollLeft();
/* 256 */ 		var s_top = window.getScrollTop();
/* 257 */ 		if( 
/* 258 */ 			(
/* 259 */ 				evt.client.x + s_left < cPos.x || 
/* 260 */ 				evt.client.x + s_left > cPos.x + cSize.x + 102 || 
/* 261 */ 				evt.client.y + s_top < cPos.y || 
/* 262 */ 				evt.client.y + s_top > cPos.y + cSize.y
/* 263 */ 			) &&
/* 264 */ 			!this.inputFocussed
/* 265 */ 		){
/* 266 */ 			this.toggleFocus(false);
/* 267 */ 			document.id(document.body).removeEvents('mouseup');
/* 268 */ 		}
/* 269 */ 	},
/* 270 */ 	
/* 271 */ 	addBoxCloseEvent: function(els){
/* 272 */ 		$$(els).addEvent('click', this.hideChoices.bind(this));
/* 273 */ 	},
/* 274 */ 	
/* 275 */ 	inputHasFocus: function(){
/* 276 */ 		document.id(this.element).addEvents({
/* 277 */ 			'focus': function(){
/* 278 */ 				this.inputFocussed = true; 
/* 279 */ 				document.id(this.element).addClass('inputActive');
/* 280 */ 				this.showChoices();
/* 281 */ 				this.defaultFocus();
/* 282 */ 			}.bind(this),
/* 283 */ 			'blur': function(){ 
/* 284 */ 				this.inputFocussed = false; 
/* 285 */ 				this.defaultBlur();
/* 286 */ 			}.bind(this)
/* 287 */ 		});
/* 288 */ 	},
/* 289 */ 
/* 290 */ 	destroy: function() {
/* 291 */ 		this.completer.dispose();
/* 292 */ 	},
/* 293 */ 
/* 294 */ 	toggleFocus: function(state) {
/* 295 */ 		this.focussed = state;
/* 296 */ 		if (!state) this.hideChoices();
/* 297 */ 	},
/* 298 */ 
/* 299 */ 	onCommand: function(e, mouse) {
/* 300 */ 		if (mouse && this.focussed) this.prefetch();

/* autocompleterCredits.js */

/* 301 */ 		if (e.key && !e.shift) switch (e.key) {
/* 302 */ 			case 'enter':
/* 303 */ 				if (this.selected && this.visible) {
/* 304 */ 					this.choiceSelect(this.selected);
/* 305 */ 					e.stop();
/* 306 */ 				} return;
/* 307 */ 			case 'up': case 'down':
/* 308 */ 				if (this.observer.value != (this.value || this.queryValue)) this.prefetch();
/* 309 */ 				else if (this.queryValue === null) break;
/* 310 */ 				else if (!this.visible) this.showChoices();
/* 311 */ 				else {
/* 312 */ 					this.choiceOver((e.key == 'up')
/* 313 */ 						? this.selected.getPrevious() || this.choices.getLast()
/* 314 */ 						: this.selected.getNext() || this.choices.getFirst() );
/* 315 */ 					this.setSelection();
/* 316 */ 				}
/* 317 */ 				e.stop(); return;
/* 318 */ 			case 'esc': this.hideChoices(); return;
/* 319 */ 		}
/* 320 */ 		this.value = false;
/* 321 */ 	},
/* 322 */ 
/* 323 */ 	setSelection: function() {
/* 324 */ 		if (!this.options.useSelection) return;
/* 325 */ 		var startLength = this.queryValue.length;
/* 326 */ 		if (document.id(this.element).value.indexOf(this.queryValue) != 0) return;
/* 327 */ 		try{ var insert = this.selected.inputValue.substr(startLength); }catch(er){ var insert = ''; }
/* 328 */ 		if (document.getSelection) {
/* 329 */ 			document.id(this.element).value = this.queryValue + insert;
/* 330 */ 			document.id(this.element).selectionStart = startLength;
/* 331 */ 			document.id(this.element).selectionEnd = document.id(this.element).value.length;
/* 332 */ 		} else if (document.selection) {
/* 333 */ 			var sel = document.selection.createRange();
/* 334 */ 			sel.text = insert;
/* 335 */ 			sel.move("character", - insert.length);
/* 336 */ 			sel.findText(insert);
/* 337 */ 			sel.select();
/* 338 */ 		}
/* 339 */ 		this.value = this.observer.value = document.id(this.element).value;
/* 340 */ 	},
/* 341 */ 
/* 342 */ 	hideChoices: function() {
/* 343 */ 		document.id(document.body).removeEvents('mouseup'); 
/* 344 */ 		if(document.id(this.element) && document.id(this.element).hasClass('inputActive')) document.id(this.element).removeClass('inputActive');
/* 345 */ 		if (!this.visible) return;
/* 346 */ 		this.visible = this.value = false;
/* 347 */ 		this.observer.clear();
/* 348 */ 		this.fx.start(0).chain(function(){ this.completer.setStyle('display', 'none'); }.bind(this));
/* 349 */ 		this.completer.setStyle('display', 'none');
/* 350 */ 		this.fireEvent('onHide');

/* autocompleterCredits.js */

/* 351 */ 		if(Browser.Engine.trident6) this.controls.setStyle('visibility', 'hidden'); //tmp fix for IE8
/* 352 */ 	},
/* 353 */ 	
/* 354 */ 	updateBottom: function() {
/* 355 */ 		this.bottom.empty();
/* 356 */ 		if(document.id(this.element).value.contains('@') && this.isValidEmail(document.id(this.element).value)){
/* 357 */ 			if(this.isEmpty){
/* 358 */ 				this.bottom.set('html', 'To invite ' + document.id(this.element).value + ' click').adopt(
/* 359 */ 					new Element('a', {'href': '#', 'html': 'here', 'events': {
/* 360 */ 						'click': function(e){
/* 361 */ 							try{ new Event(e).stop(); }catch(er){};
/* 362 */ 							this.itemInfo = {}; this.itemType = 'new'; this.invite = 1;
/* 363 */ 							this.hideChoices();
/* 364 */ 							this.fireEvent('onSelect', [this.itemInfo,this.itemType,this.invite], 20);
/* 365 */ 						}.bindWithEvent(this)
/* 366 */ 					}})
/* 367 */ 				);
/* 368 */ 			}else{
/* 369 */ 				this.bottom.set('html', 'Didn\'t find who you were looking for? ').adopt(
/* 370 */ 					new Element('a', {'href': '#', 'html': 'click here to add a new person.', 'events': {
/* 371 */ 						'click': function(e){
/* 372 */ 							try{ new Event(e).stop(); }catch(er){};
/* 373 */ 							this.itemInfo = {}; this.itemType = 'new'; this.invite = null;
/* 374 */ 							this.hideChoices();
/* 375 */ 							this.fireEvent('onSelect', [this.itemInfo,this.itemType], 20);
/* 376 */ 						}.bindWithEvent(this)
/* 377 */ 					}})
/* 378 */ 				);
/* 379 */ 			}
/* 380 */ 		}else{
/* 381 */ 			this.bottom.set('html', 'Didn\'t find who you were looking for? ').adopt(
/* 382 */ 				new Element('a', {'href': '#', 'html': 'click here to add a new person.', 'events': {
/* 383 */ 					'click': function(e){
/* 384 */ 						try{ new Event(e).stop(); }catch(er){};
/* 385 */ 						this.itemInfo = {}; this.itemType = 'new'; this.invite = null;
/* 386 */ 						this.hideChoices();
/* 387 */ 						this.fireEvent('onSelect', [this.itemInfo,this.itemType], 20);
/* 388 */ 					}.bindWithEvent(this)
/* 389 */ 				}})
/* 390 */ 			);
/* 391 */ 		}
/* 392 */ 	},
/* 393 */ 
/* 394 */ 	showChoices: function() {
/* 395 */ 		if(!this.pos) this.pos = document.id(this.element).getPosition(this.element);
/* 396 */ 		document.id(document.body).addEvent('mouseup',this.clickOutside.bind(this));
/* 397 */ 		document.id(this.element).addClass('inputActive');
/* 398 */ 		this.updateBottom();				
/* 399 */ 		if (!this.visible) {
/* 400 */ 			this.visible = true;

/* autocompleterCredits.js */

/* 401 */ 			var pos = document.id(this.element).getCoordinates(this.options.overflown);
/* 402 */ 			if(this.options.offset_left) pos.left -= this.options.offset_left;
/* 403 */ 			this.completer.setStyles({
/* 404 */ 				'left': this.options.container ? 0 : pos.left,
/* 405 */ 				'top': this.options.container ? 0 : pos.bottom
/* 406 */ 			});
/* 407 */ 			
/* 408 */ 			if (this.options.inheritWidth){
/* 409 */ 				this.completer.setStyle('width', pos.width);
/* 410 */ 				this.choices.setStyle('width', pos.width);
/* 411 */ 			}
/* 412 */ 			this.fx.start(0.9);
/* 413 */ 			if(Browser.Engine.trident6) this.controls.setStyle('visibility', 'visible');
/* 414 */ 			if($defined(this.choices.getFirst())) {
/* 415 */ 				this.choiceOver(this.choices.getFirst());
/* 416 */ 				this.completer.getFirst().setStyle('display', 'block');
/* 417 */ 			}
/* 418 */ 		}
/* 419 */ 	},
/* 420 */ 	
/* 421 */ 	isValidEmail: function(str){
/* 422 */ 		var re = /^[_a-z0-9-]+([_a-z0-9-.+]*)@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/i;
/* 423 */ 		return re.test(str);
/* 424 */ 	},
/* 425 */ 
/* 426 */ 	prefetch: function() {
/* 427 */ 		if(document.id(this.element).value.contains('@') && !this.isValidEmail(document.id(this.element).value)){
/* 428 */ 			this.hideChoices();
/* 429 */ 		}else{
/* 430 */ 			if (
/* 431 */ 				(
/* 432 */ 					document.id(this.element).value == this.queryValue || 
/* 433 */ 					document.id(this.element).value == this.defaultValue
/* 434 */ 				) && 
/* 435 */ 				!this.options.forceFetch
/* 436 */ 			){
/* 437 */ 				this.showChoices();
/* 438 */ 			}else{
/* 439 */ 				this.page = 1;
/* 440 */ 				this.query();
/* 441 */ 			}
/* 442 */ 		}
/* 443 */ 		this.lastvalue = (document.id(this.element).value != this.defaultValue)?document.id(this.element).value:'';
/* 444 */ 	},
/* 445 */ 
/* 446 */ 	updateChoices: function(result) {
/* 447 */ 		var choices = result.users;
/* 448 */ 		this.total = result.total;
/* 449 */ 		this.choices.empty(); this.isEmpty = false;
/* 450 */ 		this.selected = null;

/* autocompleterCredits.js */

/* 451 */ 		if (!choices || !choices.length) { 
/* 452 */ 			this.isEmpty = true;
/* 453 */ 			if(this.pageup && this.pageup.hasClass('active')) this.pageup.removeClass('active');
/* 454 */ 			if(this.pagedown && this.pagedown.hasClass('active')) this.pagedown.removeClass('active');
/* 455 */ 		}else{
/* 456 */ 			if(this.pageup){
/* 457 */ 				if(this.page==1){
/* 458 */ 					this.pageup.removeClass('active');
/* 459 */ 				}else{
/* 460 */ 					this.pageup.addClass('active');
/* 461 */ 				}
/* 462 */ 			}
/* 463 */ 			if(this.pagedown){
/* 464 */ 				if(((this.page+1)*this.perpage > (Math.ceil((this.total/this.perpage))*this.perpage)) || this.perpage > this.total){
/* 465 */ 					this.pagedown.removeClass('active');
/* 466 */ 				}else{
/* 467 */ 					this.pagedown.addClass('active');
/* 468 */ 				}
/* 469 */ 			}
/* 470 */ 			choices.each(this.options.injectChoice || function(choice, i){
/* 471 */ 				var nameHTML = this.markQueryValue(choice.u);
/* 472 */ 				var nHtml = nameHTML;
/* 473 */ 				var imgId = 'atips-users-'+choice.i+'-showImage_1-'+$random(1000,9999);
/* 474 */ 				var img = new Element('img', {'border': 0, 'src': choice.pi, 'id': imgId});
/* 475 */ 
/* 476 */ 				nHtml=nHtml.replace(new RegExp( "("+this.currvalue+")", "gi" ),function($0){return '<em class="highlight">'+$0+'</em>';});
/* 477 */ 				
/* 478 */ 				var div1 = new Element('div', {'html': '<div class="uname">' + nHtml + '</div>'});				
/* 479 */ 				var div3 = new Element('div', {'class': 'udesc', 'html': choice.d});
/* 480 */ 				var clear = new Element('div', {'class': 'justClear'});
/* 481 */ 				
/* 482 */ 				if(choice.c){
/* 483 */ 					var check = new Element('span', {'class': 'check'});
/* 484 */ 					div1.adopt(check).setStyle('position', 'relative');
/* 485 */ 				}
/* 486 */ 				
/* 487 */ 				var div = new Element('div', {'styles': {/*'height': '90'*/}}).adopt(div1,div3,clear);
/* 488 */ 				var el = new Element('li').adopt(img,div,clear);
/* 489 */ 				el.user = nameHTML;
/* 490 */ 				el.id = choice.i;
/* 491 */ 				el.inputValue = choice;
/* 492 */ 				this.addChoiceEvents(el).injectInside(this.choices);
/* 493 */ 			}, this);
/* 494 */ 		}
/* 495 */ 		this.showChoices();
/* 496 */ 	},
/* 497 */ 
/* 498 */ 	choiceOver: function(el) {
/* 499 */ 		if(!this.isEmpty){
/* 500 */ 			this.selectedInfo = el;

/* autocompleterCredits.js */

/* 501 */ 			if (this.selected) this.selected.removeClass('autocompleterCredits-selected');
/* 502 */ 			if (el) this.selected = el.addClass('autocompleterCredits-selected');
/* 503 */ 		}
/* 504 */ 	},
/* 505 */ 
/* 506 */ 	choiceSelect: function(el) {
/* 507 */ 		this.observer.value = document.id(this.element).value = '';
/* 508 */ 		this.itemInfo = el;
/* 509 */ 		this.itemType = '';
/* 510 */ 		this.hideChoices();
/* 511 */ 		this.resetcache();
/* 512 */ 		this.fireEvent('onSelect', [this.itemInfo,this.itemType,document.id(this.element)], 20);
/* 513 */ 	},
/* 514 */ 
/* 515 */ 	markQueryValue: function(txt) {
/* 516 */ 		return txt;
/* 517 */ 	},
/* 518 */ 
/* 519 */ 	addChoiceEvents: function(el) {
/* 520 */ 		return el.addEvents({
/* 521 */ 			'mouseover': this.choiceOver.bind(this, [el]),
/* 522 */ 			'mousedown': this.choiceSelect.bind(this, [el])
/* 523 */ 		});
/* 524 */ 	}
/* 525 */ });
/* 526 */ 
/* 527 */ AutocompleterCredits.Local = new Class({
/* 528 */ 	
/* 529 */ 	Extends: AutocompleterCredits.Base,
/* 530 */ 	Implements: [Options, Events],
/* 531 */ 	
/* 532 */ 	options: {
/* 533 */ 		minLength: 0,
/* 534 */ 		filterTokens : null
/* 535 */ 	},
/* 536 */ 
/* 537 */ 	initialize: function(el, tokens, options) {
/* 538 */ 		this.parent(el, options);
/* 539 */ 		this.tokens = tokens;
/* 540 */ 		if (this.options.filterTokens) this.filterTokens = this.options.filterTokens.bind(this);
/* 541 */ 	},
/* 542 */ 
/* 543 */ 	query: function() {
/* 544 */ 		this.hideChoices();
/* 545 */ 		this.queryValue = document.id(this.element).value;
/* 546 */ 		this.updateChoices(this.filterTokens());
/* 547 */ 	},
/* 548 */ 
/* 549 */ 	filterTokens: function(token) {
/* 550 */ 		var regex = new RegExp('^' + this.queryValue.escapeRegExp(), 'i');

/* autocompleterCredits.js */

/* 551 */ 		return this.tokens.filter(function(token) {
/* 552 */ 			return regex.test(token);
/* 553 */ 		});
/* 554 */ 	}
/* 555 */ 
/* 556 */ });
/* 557 */ 
/* 558 */ AutocompleterCredits.Ajax = {};
/* 559 */ 
/* 560 */ AutocompleterCredits.Ajax.Base = new Class({
/* 561 */ 	
/* 562 */ 	Extends: AutocompleterCredits.Base,
/* 563 */ 	Implements: [Options, Events],
/* 564 */ 	
/* 565 */ 	options: {
/* 566 */ 		postVar: 'value',
/* 567 */ 		postData: {},
/* 568 */ 		ajaxOptions: {},
/* 569 */ 		onRequest: $empty,
/* 570 */ 		onComplete: $empty,
/* 571 */ 		noHideOnNoResult: 0
/* 572 */ 	},
/* 573 */ 	ajax: null,
/* 574 */ 	url: null,
/* 575 */ 	urlext: null,
/* 576 */ 	initialize: function(el, url, options) {
/* 577 */ 		if(!/\/$/.test(url)) url = url+'/';
/* 578 */ 		this.url = url;
/* 579 */ 		this.parent(el, options);
/* 580 */ 		
/* 581 */ 	},
/* 582 */ 
/* 583 */ 	query: function(){
/* 584 */ 		var data = new Hash({}).extend(this.options.postData);
/* 585 */ 		data.set(this.options.postVar, (document.id(this.element).value != this.defaultValue) ? document.id(this.element).value : '');
/* 586 */ 		this.currvalue = document.id(this.element).value;
/* 587 */ 		if(this.ajax){
/* 588 */ 			try{ this.ajax.cancel(); }catch(er){}
/* 589 */ 			this.ajax = null;
/* 590 */ 		}
/* 591 */ 		this.urlext = this.url+this.page+'/'+this.filter+'/'+this.perpage+'/'+this.options.assoc+'/';
/* 592 */ 		//if(this.resultscache.has(this.currvalue+'/'+this.page+'/'+this.filter)){
/* 593 */ 		//	this.queryResponse(this.resultscache.get(this.currvalue+'/'+this.page+'/'+this.filter),1);
/* 594 */ 		//}else{
/* 595 */ 			this.ajax = new Request($merge({
/* 596 */ 				url: ((this.urlext)?this.urlext:this.url), 
/* 597 */ 				link: 'cancel'
/* 598 */ 			}, this.options.ajaxOptions));
/* 599 */ 			this.ajax.addEvents({
/* 600 */ 				'onComplete': this.queryResponse.bind(this),

/* autocompleterCredits.js */

/* 601 */ 				'onFailure': this.queryResponse.bind(this, [false])
/* 602 */ 			});
/* 603 */ 			this.fireEvent('onRequest', [document.id(this.element), this.ajax]);
/* 604 */ 			this.ajax.send(data.toQueryString());
/* 605 */ 		//}
/* 606 */ 	},
/* 607 */ 
/* 608 */ 	/**
/* 609 *| 	 * queryResponse - abstract
/* 610 *| 	 *
/* 611 *| 	 * Inherated classes have to extend this function and use this.parent(resp)
/* 612 *| 	 *
/* 613 *| 	 * @param		{String} Response
/* 614 *| 	 */
/* 615 */ 	queryResponse: function(resp,isCached) {
/* 616 */ 		this.value = this.queryValue = document.id(this.element).value;
/* 617 */ 		this.selected = false;
/* 618 */ 		if(!this.options.noHideOnNoResult==1) this.hideChoices();
/* 619 */ 		if(resp && !isCached) this.resultscache.set(this.currvalue+'/'+this.page+'/'+this.filter,resp);
/* 620 */ 		this.fireEvent(resp ? 'onComplete' : 'onFailure', [document.id(this.element), this.ajax], 20);
/* 621 */ 	}
/* 622 */ 
/* 623 */ });
/* 624 */ 
/* 625 */ AutocompleterCredits.Ajax.Json = new Class({
/* 626 */ 	Extends: AutocompleterCredits.Ajax.Base,
/* 627 */ 	Implements: [Options, Events],
/* 628 */ 	queryResponse: function(resp) {
/* 629 */ 		this.parent(resp);
/* 630 */ 		var choices = JSON.decode(resp || false);
/* 631 */ 		this.updateChoices(choices);
/* 632 */ 	}
/* 633 */ 
/* 634 */ });
/* 635 */ 
/* 636 */ 
/* 637 */ var OverlayFix = new Class({
/* 638 */ 
/* 639 */ 	initialize: function(el) {
/* 640 */ 		//this.element = document.id(el);
/* 641 */ 		this.element = el;
/* 642 */ 		if (Browser.Engine.trident){
/* 643 */ 			document.id(this.element).addEvent('trash', this.destroy.bind(this));
/* 644 */ 			this.fix = new Element('iframe', {
/* 645 */ 				properties: {
/* 646 */ 					frameborder: '0',
/* 647 */ 					scrolling: 'no',
/* 648 */ 					//src: 'javascript:false;'
/* 649 */ 					src: 'javascript:;'
/* 650 */ 				},

/* autocompleterCredits.js */

/* 651 */ 				styles: {
/* 652 */ 					'position': 'absolute',
/* 653 */ 					'border': 'none',
/* 654 */ 					'display': 'none',
/* 655 */ 					'filter': 'progid:DXImageTransform.Microsoft.Alpha(opacity=0)'
/* 656 */ 				}
/* 657 */ 			}).injectAfter(document.id(this.element));
/* 658 */ 		}
/* 659 */ 	},
/* 660 */ 
/* 661 */ 	show: function() {
/* 662 */ 		if (this.fix) this.fix.setStyles($extend(
/* 663 */ 			document.id(this.element).getCoordinates(), {
/* 664 */ 				'display': '',
/* 665 */ 				'zIndex': (document.id(this.element).getStyle('zIndex') || 1) - 1
/* 666 */ 			}));
/* 667 */ 		return this;
/* 668 */ 	},
/* 669 */ 
/* 670 */ 	hide: function() {
/* 671 */ 		if (this.fix) this.fix.setStyle('display', 'none');
/* 672 */ 		return this;
/* 673 */ 	},
/* 674 */ 
/* 675 */ 	destroy: function() {
/* 676 */ 		this.fix.dispose();
/* 677 */ 	}
/* 678 */ 
/* 679 */ });

;
/* helpers.js */

/* 1   */ var poptent_helpers = {
/* 2   */ 	html_entity_decode: function(str){
/* 3   */ 		if(str=='') return str;
/* 4   */ 		if(!str) return false;
/* 5   */ 		var ta=document.createElement("textarea");
/* 6   */ 		ta.innerHTML=str.replace(/</g,"&lt;").replace(/>/g,"&gt;");
/* 7   */ 		var ret = ta.value;
/* 8   */ 		ta = null;
/* 9   */ 		return ret;
/* 10  */ 	},
/* 11  */ 	urlGetParam: function(param){
/* 12  */ 		param = param.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
/* 13  */ 		var regex = new RegExp( "[\\?&]"+param+"=([^&#]*)" );
/* 14  */ 		var results = regex.exec( window.location.href );
/* 15  */ 		return ( results == null ) ? false : results[1];
/* 16  */ 	},
/* 17  */ 	simulateEvent: function(eventType, targetElement) {
/* 18  */ 		var event;
/* 19  */ 		targetElement = document.id(targetElement);
/* 20  */ 		
/* 21  */ 		if (targetElement) {
/* 22  */ 			// check for IE
/* 23  */ 			if (window.ActiveXObject) {
/* 24  */ 				event = document.createEventObject();
/* 25  */ 				targetElement.fireEvent(eventType,event);
/* 26  */ 			} else {
/* 27  */ 				switch (eventType) {
/* 28  */ 					case "abort":
/* 29  */ 					case "blur":
/* 30  */ 					case "change":
/* 31  */ 					case "error":
/* 32  */ 					case "focus":
/* 33  */ 					case "load":
/* 34  */ 					case "reset":
/* 35  */ 					case "resize":
/* 36  */ 					case "scroll":
/* 37  */ 					case "select":
/* 38  */ 					case "submit":
/* 39  */ 					case "unload":
/* 40  */ 						event = document.createEvent("HTMLEvents");
/* 41  */ 						event.initEvent(eventType, "true", "true");
/* 42  */ 						break;
/* 43  */ 					case "click":
/* 44  */ 					case "mousedown":
/* 45  */ 					case "mousemove":
/* 46  */ 					case "mouseout":
/* 47  */ 					case "mouseover":
/* 48  */ 					case "mouseup":
/* 49  */ 						event = document.createEvent("MouseEvents");
/* 50  */ 						event.initMouseEvent(eventType, true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 0, null);

/* helpers.js */

/* 51  */ 						break;
/* 52  */ 				}
/* 53  */ 				targetElement.dispatchEvent(event);
/* 54  */ 			}
/* 55  */ 		}
/* 56  */ 	},
/* 57  */ 	striphtml: function(html) {
/* 58  */ 		var tmp = document.createElement("DIV");
/* 59  */ 		tmp.innerHTML = html;
/* 60  */ 		var ret = tmp.textContent||tmp.innerText;
/* 61  */ 		tmp = null;
/* 62  */ 		return ret;
/* 63  */ 	},
/* 64  */ 	bin2dec: function(bin) {  
/* 65  */ 		var result = ''; 
/* 66  */ 		var placeholder = 1;
/* 67  */ 		for(var i=0; i <=  bin.length-1; i++) { 
/* 68  */ 			if( bin.charAt(i) != "0" &&  bin.charAt(i) != "1") { 
/* 69  */ 				return ''; 
/* 70  */ 			}else if(i != 0){
/* 71  */ 				placeholder=placeholder*2;
/* 72  */ 			}
/* 73  */ 		}
/* 74  */ 		result = eval(bin.charAt(0))*placeholder; 
/* 75  */ 		for (i = 1; i <= bin.length-1; i++) { 
/* 76  */ 			placeholder=placeholder/2; 
/* 77  */ 			result = result + (eval( bin.charAt(i))*placeholder); 
/* 78  */ 		}       
/* 79  */ 		return (isNaN(result))?'':result; 
/* 80  */ 	},
/* 81  */ 	base62: function(c){
/* 82  */ 		return(
/* 83  */ 				c<62?
/* 84  */ 					'':
/* 85  */ 					poptent_helpers.base62(parseInt(c/62)))+((c=c%62)>35?
/* 86  */ 						String.fromCharCode(c+29):
/* 87  */ 						c.toString(36)
/* 88  */ 		);
/* 89  */ 	},
/* 90  */ 	truncate: function(text, length, ending, exact) {
/* 91  */ 		if(typeof ending == 'undefined') ending = '...';
/* 92  */ 		if(typeof exact == 'undefined') exact = true;
/* 93  */ 		if (text.length <= length) return text;
/* 94  */ 		var truncate = text.substr(0, length - ending.length);
/* 95  */ 		if (!exact) {
/* 96  */ 			var spacepos = truncate.lastIndexOf(' ');
/* 97  */ 			if (spacepos != -1) return truncate.substr(0, spacepos) + ending;
/* 98  */ 		}
/* 99  */ 		return truncate + ending;
/* 100 */ 	},

/* helpers.js */

/* 101 */ 	array_exec_chunks: function(array, process, delay, perrun, context){
/* 102 */ 	    if(typeof delay  == undefined) delay  = 100;
/* 103 */ 	    if(typeof perrun == undefined) perrun = 1;
/* 104 */ 	    var items = array.concat();
/* 105 */ 	    if(delay===0){
/* 106 */ 	    	setZeroTimeout(function(){
/* 107 */ 		    	for (var i=0;i<perrun; i++) {
/* 108 */ 		    		var item = items.shift();
/* 109 */ 			    	process.call(context, item);
/* 110 */ 		    	}
/* 111 */ 		        if (items.length > 0) setZeroTimeout(arguments.callee);
/* 112 */ 		    });
/* 113 */ 	    }else{
/* 114 */ 		    setTimeout(function(){
/* 115 */ 		    	for (var i=0;i<perrun; i++) {
/* 116 */ 		    		var item = items.shift();
/* 117 */ 			    	process.call(context, item);
/* 118 */ 		    	}
/* 119 */ 		        if (items.length > 0) setTimeout(arguments.callee, delay);
/* 120 */ 		    }, delay);
/* 121 */ 	    }
/* 122 */ 	},
/* 123 */ 	add_image_base: function(img){
/* 124 */ 		if(img.indexOf("/img") === 0) img = img.substr(4);
/* 125 */ 		if(img.indexOf('/') === 0) img = img.substr(1);
/* 126 */ 		var cdn = img.length % 10;
/* 127 */ 		var path = window.location.href.test("dev")?'http://devimages'+cdn+'.poptent.net/':'http://images'+((cdn==0)?'':cdn)+'.poptent.net/';
/* 128 */ 		return path+img;
/* 129 */ 	},
/* 130 */ 	apply_validation_error_state: function(elementId) {
/* 131 */ 		var this_element = ($type(elementId) == "string" ? document.id(elementId) : elementId);
/* 132 */ 		//special handle for select boxes
/* 133 */ 		if(this_element.nodeName.toLowerCase()=='select' && this_element.getStyle('border-left-color')!="red"){
/* 134 */ 			var elsize = this_element.getSize().x;
/* 135 */ 			this_element.setStyles({
/* 136 */ 				width: elsize+3
/* 137 */ 			});
/* 138 */ 		}else if(this_element.type=='checkbox' || this_element.type=='radio'){
/* 139 */ 			return;
/* 140 */ 		}
/* 141 */ 		
/* 142 */ 		this_element.setStyles({
/* 143 */ 			borderLeft:'red solid 4px', 
/* 144 */ 			marginLeft:'0px'
/* 145 */ 		});
/* 146 */ 		
/* 147 */ 		this_element.addEvent('blur', function(){
/* 148 */ 			if (this.getStyle('border-left-color')=="red"){
/* 149 */ 				this.setStyles({
/* 150 */ 					borderLeft:'#E1E1E1 solid 1px', 

/* helpers.js */

/* 151 */ 					marginLeft:'3px'
/* 152 */ 				});
/* 153 */ 				//special handle for select boxes
/* 154 */ 				if(this.nodeName.toLowerCase()=='select'){
/* 155 */ 					var elsize = this.getSize().x;
/* 156 */ 					this.setStyles({
/* 157 */ 						width: elsize-3
/* 158 */ 					});
/* 159 */ 				}
/* 160 */ 			}
/* 161 */ 		});
/* 162 */ 		this_element = null;
/* 163 */ 	},
/* 164 */ 	mock_id: function(){
/* 165 */ 		return 'noid_'+rand();
/* 166 */ 	},
/* 167 */ 	add_input_onclick: function(el){
/* 168 */ 		return false;
/* 169 */ 		var element = ($type(el) == "string" ? document.id(el) : el);
/* 170 */ 		if(element){
/* 171 */ 			element.addEvent('focus', function(e){
/* 172 */ 				try{ new Event(e).preventDefault(); }catch(er){};
/* 173 */ 				this.addClass('inputActive');
/* 174 */ 			}).addEvent('blur', function(e){
/* 175 */ 				try{ new Event(e).preventDefault(); }catch(er){};
/* 176 */ 				this.removeClass('inputActive');
/* 177 */ 			});
/* 178 */ 		}
/* 179 */ 		element = null;
/* 180 */ 	},
/* 181 */ 	string_create_urls: function(input,maxChars){
/* 182 */ 		if (typeof maxChars == 'undefined' ) maxChars = 0;
/* 183 */ 		return input
/* 184 */ 			.replace(/<br>|<br \/>|<br\/>/gim, '\n')
/* 185 */ 			.replace(/(ftp|http|https|file):\/\/[\S]+(\b|$)/gim,'[ <a href="$&" class="comment_userlink" target="_blank">external link</a> ]')
/* 186 */ 			.replace(/([^\/])(www[\S]+(\b|$))/gim,'$1[ <a href="http://$2" class="comment_userlink" target="_blank">external link</a> ]')
/* 187 */ 			.replace(/\n/gim, '<br\/>');
/* 188 */ 	},
/* 189 */ 	xy_ago: function(dateFrom, dateTo) {
/* 190 */ 		if (dateTo == -1) dateTo = time();
/* 191 */ 		
/* 192 */ 		var difference = dateTo - dateFrom;
/* 193 */ 		var interval;
/* 194 */ 		var result = "never";
/* 195 */ 
/* 196 */ 		if (difference < 60){ 
/* 197 */ 			interval = "s";
/* 198 */ 		}else if (difference >= 60 && difference < 60 * 60){ 
/* 199 */ 			// 60 - 3599
/* 200 */ 			interval = "n";

/* helpers.js */

/* 201 */ 		}else if (difference >= 60*60 && difference < 60*60*24){ 
/* 202 */ 			// 3600 - 86399
/* 203 */ 			interval = "h";
/* 204 */ 		}else if (difference >= 60*60*24 && difference < 60*60*24*7){ 
/* 205 */ 			// 86400 - 604799
/* 206 */ 			interval = "d";
/* 207 */ 		}else if (difference >= 60*60*24*7 && difference < 60*60*24*30){ 
/* 208 */ 			// 604800 - 2591999
/* 209 */ 			interval = "w"
/* 210 */ 		}else if (difference >= 60*60*24*30 && difference < 60*60*24*30*365){ 
/* 211 */ 			// 2592000 - 946079999
/* 212 */ 			interval = "m";
/* 213 */ 		}else if (difference >= 60*60*24*30*365){ 
/* 214 */ 			// 946080000 <
/* 215 */ 			interval = "y";
/* 216 */ 		}
/* 217 */ 		
/* 218 */ 		var datediff;
/* 219 */ 		
/* 220 */ 		switch(interval) {
/* 221 */ 			case "m":
/* 222 */ 			   datediff = Math.floor(difference / 60 / 60 / 24 / 29);
/* 223 */ 		       result = datediff+" month"+((datediff!=1)?'s':'')+" ago";
/* 224 */ 		       break;
/* 225 */ 			case "y": 
/* 226 */ 			   datediff = Math.floor(difference / 60 / 60 / 24 / 365);
/* 227 */ 		       result = datediff+" year"+((datediff!=1)?'s':'')+" ago";
/* 228 */ 		       break;
/* 229 */ 			case "d": 
/* 230 */ 			   datediff = Math.floor(difference / 60 / 60 / 24);
/* 231 */ 		       result = datediff+" day"+((datediff!=1)?'s':'')+" ago";			
/* 232 */ 		       break;
/* 233 */ 			case "w": 
/* 234 */ 			   datediff = Math.floor(difference / 60 / 60 / 24 / 7);
/* 235 */ 		       result = datediff+" week"+((datediff!=1)?'s':'')+" ago";			
/* 236 */ 		       break;
/* 237 */ 			case "h": 
/* 238 */ 			   datediff = Math.floor(difference / 60 / 60);
/* 239 */ 		       result = datediff+" hour"+((datediff!=1)?'s':'')+" ago";			
/* 240 */ 		       break;
/* 241 */ 			case "n": 
/* 242 */ 			   datediff = Math.floor(difference / 60);
/* 243 */ 		       result = datediff+" minute"+((datediff!=1)?'s':'')+" ago";			
/* 244 */ 		       break;
/* 245 */ 			case "s": 
/* 246 */ 			   datediff = difference;
/* 247 */ 		       result = datediff+" second"+((datediff!=1)?'s':'')+" ago";			
/* 248 */ 		       break;													
/* 249 */ 		}
/* 250 */ 		return(result);	

/* helpers.js */

/* 251 */ 	},
/* 252 */ 	get_image_type: function(type){
/* 253 */ 		var types = {"1":"image","2":"video","3":"document","4":"audio","6":"font","7":"archive",'8':'brush'};
/* 254 */ 		return types[type];
/* 255 */ 	},
/* 256 */ 	init_tips: function(){
/* 257 */ 		var rtips = $$('div#main .tips');
/* 258 */ 		if(rtips){
/* 259 */ 			var nTips = [];
/* 260 */ 			var l = rtips.length;
/* 261 */ 			for (var i=0;i<l; i++) {
/* 262 */ 				var el = rtips[i];
/* 263 */ 				if(!el.getProperty('id')) el.setProperty('id',poptent_helpers.mock_id());
/* 264 */ 				if(!el.hasClass('hasTips')){
/* 265 */ 					var tId = el.getProperty('id');
/* 266 */ 					if(tId) nTips.push(tId);
/* 267 */ 				}
/* 268 */ 			}
/* 269 */ 			if(nTips.length>0){
/* 270 */ 				var baseTips = new infoTips(nTips, {
/* 271 */ 					offsets: {'x': -10, 'y': 26},
/* 272 */ 					showDelay: 500,
/* 273 */ 					hideDelay: 0,
/* 274 */ 					maxTitleChars: 320,
/* 275 */ 					timeOut: 2000,
/* 276 */ 					tipText: false
/* 277 */ 				});
/* 278 */ 			}
/* 279 */ 		}
/* 280 */ 		rtips = null;
/* 281 */ 	},
/* 282 */ 	size_to_kb: function(size) {
/* 283 */ 		var unit = 'B';
/* 284 */ 		if ((size / 1048576) > 1) {
/* 285 */ 			unit = 'MB';
/* 286 */ 			size /= 1048576;
/* 287 */ 		} else if ((size / 1024) > 1) {
/* 288 */ 			unit = 'kB';
/* 289 */ 			size /= 1024;
/* 290 */ 		}
/* 291 */ 		return size.round(1) + ' ' + unit;
/* 292 */ 	},
/* 293 */ 	logger: new Log,
/* 294 */ 	get_win_center_offset: function(){
/* 295 */ 		return window.getHeight()/2;
/* 296 */ 	},
/* 297 */ 	show_notification_roar: false,
/* 298 */ 	show_notification_last_message: false,
/* 299 */ 	show_notification_dedup: function(msg_comp){
/* 300 */ 		if(msg_comp == poptent_helpers.show_notification_last_message) poptent_helpers.show_notification_last_message = false;

/* helpers.js */

/* 301 */ 	},
/* 302 */ 	show_notification: function(msg, type, timer) {
/* 303 */ 		if(typeof type === 'undefined') type = 'success';
/* 304 */ 		if(typeof Roar == 'undefined'){
/* 305 */ 			(function(){
/* 306 */ 				poptent_helpers.show_notification(msg, type, timer);
/* 307 */ 			}).delay(100);
/* 308 */ 		}else{
/* 309 */ 			if(!poptent_helpers.show_notification_roar) poptent_helpers.show_notification_roar = new Roar();
/* 310 */ 			var options = {type:type};
/* 311 */ 			if(typeof timer == 'number') options.timer = timer;
/* 312 */ 			var msg_comp = type+'_'+msg;
/* 313 */ 			if(msg_comp != poptent_helpers.show_notification_last_message){
/* 314 */ 				poptent_helpers.show_notification_last_message = msg_comp;
/* 315 */ 				poptent_helpers.show_notification_roar.alert(type.capitalize(), msg, options);
/* 316 */ 				(function(){poptent_helpers.show_notification_dedup(msg_comp);}).delay(3000);
/* 317 */ 			}
/* 318 */ 			return;
/* 319 */ 		}
/* 320 */ 	},
/* 321 */ 	get_flash_version_cache: false,
/* 322 */ 	get_flash_version: function(){ 
/* 323 */ 		if(poptent_helpers.get_flash_version_cache) return poptent_helpers.get_flash_version_cache;
/* 324 */ 		// ie 
/* 325 */ 		try { 
/* 326 */ 			try {
/* 327 */ 				var axo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash.6'); 
/* 328 */ 				try { axo.AllowScriptAccess = 'always'; } catch(e) { return '6.0.0'; } 
/* 329 */ 			} catch(e) {} 
/* 330 */ 			poptent_helpers.get_flash_version_cache = new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version').replace(/\D+/g, ',').match(/^,?(.+),?$/)[1].replace(/\,/g,'.');
/* 331 */ 			return poptent_helpers.get_flash_version_cache; 
/* 332 */ 		// other browsers 
/* 333 */ 		} catch(e) { 
/* 334 */ 			try { 
/* 335 */ 				if(navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin){ 
/* 336 */ 					poptent_helpers.get_flash_version_cache = (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]).description.replace(/\D+/g, ",").match(/^,?(.+),?$/)[1].replace(/\,/g,'.');
/* 337 */ 					return poptent_helpers.get_flash_version_cache; 
/* 338 */ 				} 
/* 339 */ 			} catch(e) {} 
/* 340 */ 		} 
/* 341 */ 		return '0.0.0'; 
/* 342 */ 	}
/* 343 */ };
/* 344 */ 
/* 345 */ 
/* 346 */ 
/* 347 */ function rand( min, max ) {
/* 348 */     var argc = arguments.length;
/* 349 */     if (argc == 0) {
/* 350 */         min = 0;

/* helpers.js */

/* 351 */         max = 2147483647;
/* 352 */     } else if (argc == 1) {
/* 353 */     	max = 2147483647;
/* 354 */     }
/* 355 */     return Math.floor(Math.random() * (max - min + 1)) + min;
/* 356 */ };
/* 357 */ 
/* 358 */ function replaceHtml(el, html) {
/* 359 */ 	var oldEl = typeof el === "string" ? document.getElementById(el) : el;
/* 360 */ 	/*@cc_on // Pure innerHTML is slightly faster in IE
/* 361 *| 		oldEl.innerHTML = html;
/* 362 *| 		return oldEl;
/* 363 *| 	@*/
/* 364 */ 	var newEl = oldEl.cloneNode(false);
/* 365 */ 	newEl.innerHTML = html;
/* 366 */ 	oldEl.parentNode.replaceChild(newEl, oldEl);
/* 367 */ 	/* Since we just removed the old element from the DOM, return a reference
/* 368 *| 	to the new element, which can be used to restore variable references. */
/* 369 */ 	return newEl;
/* 370 */ };
/* 371 */ 
/* 372 */ 
/* 373 */ function getTime() {
/* 374 */ 	var date = new Date();
/* 375 */ 	var dateStr = date.getTime();
/* 376 */ 	date = null;
/* 377 */ 	return dateStr;
/* 378 */ };
/* 379 */ 
/* 380 */ function isInteger (s){
/* 381 */ 	var i;
/* 382 */ 	
/* 383 */ 	if (isEmpty(s)){
/* 384 */ 		if (isInteger.arguments.length == 1){ return 0;};
/* 385 */ 	}else{ 
/* 386 */ 		return (isInteger.arguments[1] == true);
/* 387 */ 	};
/* 388 */ 	
/* 389 */ 	for (i = 0; i < s.length; i++){
/* 390 */ 		var c = s.charAt(i);
/* 391 */ 		if (!isDigit(c)){ return false;};
/* 392 */ 	}
/* 393 */ 	return true;
/* 394 */ };
/* 395 */ 
/* 396 */ function isEmpty(s){
/* 397 */ 	return ((s == null) || (s.length == 0));
/* 398 */ };
/* 399 */ 
/* 400 */ function isDigit (c){

/* helpers.js */

/* 401 */ 	return ((c >= "0") && (c <= "9"));
/* 402 */ };
/* 403 */ 
/* 404 */ function replaceAll (streng, soeg, erstat){ 
/* 405 */ 	var st = streng;
/* 406 */ 	if (soeg.length == 0){return st;};
/* 407 */ 	var idx = st.indexOf(soeg);
/* 408 */ 	while (idx >= 0){
/* 409 */ 		st = st.substring(0,idx) + erstat + st.substr(idx+soeg.length);
/* 410 */ 		idx = st.indexOf(soeg);
/* 411 */ 	};
/* 412 */ 	return st;
/* 413 */ };
/* 414 */ 
/* 415 */ function trim (str) {
/* 416 */ 	str = this != window? this : str;
/* 417 */     return str.replace(/^\s+|\s+$/g,"");
/* 418 */ };
/* 419 */ 
/* 420 */ function dump(arr,level) {
/* 421 */ 	var dumped_text = "";
/* 422 */ 	if(!level) level = 0;
/* 423 */ 	
/* 424 */ 	//The padding given at the beginning of the line.
/* 425 */ 	var level_padding = "";
/* 426 */ 	for(var j=0;j<level+1;j++) level_padding += "    ";
/* 427 */ 	
/* 428 */ 	if(typeof(arr) == 'object') { //Array/Hashes/Objects
/* 429 */ 		for(var item in arr) {
/* 430 */ 			var value = arr[item];
/* 431 */ 			if(typeof(value) == 'object') { //If it is an array,
/* 432 */ 				dumped_text += level_padding + "'" + item + "' ...\n";
/* 433 */ 				dumped_text += dump(value,level+1);
/* 434 */ 			} else {
/* 435 */ 				dumped_text += level_padding + "'" + item + "' => \"" + value + "\"\n";
/* 436 */ 			}
/* 437 */ 		}
/* 438 */ 	} else { //Stings/Chars/Numbers etc.
/* 439 */ 		dumped_text = "===>"+arr+"<===("+typeof(arr)+")";
/* 440 */ 	}
/* 441 */ 	return dumped_text;
/* 442 */ };
/* 443 */ 
/* 444 */ function flashlog(msg){
/* 445 */ 	setTimeout(function(){poptent_helpers.logger.log(msg);},1);
/* 446 */ };
/* 447 */ 
/* 448 */ 
/* 449 */ String.prototype.toProperCase = function(){
/* 450 */ 	return this.toLowerCase().replace(/\w+/g,function(s){

/* helpers.js */

/* 451 */         if(
/* 452 */         	s != 'as' &&
/* 453 */         	s != 'to' &&
/* 454 */         	s != 'of'
/* 455 */         ){ 
/* 456 */         	return s.charAt(0).toUpperCase() + s.substr(1);
/* 457 */         }else{
/* 458 */         	return s;
/* 459 */         };
/* 460 */     })
/* 461 */ };
/* 462 */ 
/* 463 */ String.prototype.wordCount = function () {return this.split(/\b[\s,\.-:;]*/).length};
/* 464 */ 

;
/* utility.js */

/* 1   */ /** utility helper functions **/
/* 2   */ var utility_helper = {
/* 3   */ 	check_username_availability: function(e){
/* 4   */ 		var val = this.value.trim();
/* 5   */ 		//update url
/* 6   */ 		document.id('name-link').set('text', val);
/* 7   */ 		
/* 8   */ 		//check availability					
/* 9   */ 		if(val!=''){
/* 10  */ 			var req = new Request({
/* 11  */ 				url: '/api/check/username/',
/* 12  */ 				method: 'post',
/* 13  */ 				onRequest: function() {
/* 14  */ 					this.getNext().setStyle('display', 'block');
/* 15  */ 				}.bind(this),
/* 16  */ 				onComplete: function(jsonObj) {
/* 17  */ 					jsonObj = JSON.decode(jsonObj);
/* 18  */ 					this.getNext().setStyle('display', 'none');
/* 19  */ 					var status = jsonObj.status.toInt();
/* 20  */ 					var avail = document.id('name-availability');
/* 21  */ 					avail.getParent().setStyle('display', 'block');
/* 22  */ 					if(avail){
/* 23  */ 						switch(status){
/* 24  */ 							case 0: avail.empty().set('text', 'available').removeClass('spn-gray').removeClass('spn-red').addClass('spn-green'); break;
/* 25  */ 							case 1: avail.empty().set('text', 'invalid').removeClass('spn-gray').removeClass('spn-green').addClass('spn-red'); break;
/* 26  */ 							case 3: avail.empty().set('text', 'not available').removeClass('spn-gray').removeClass('spn-green').addClass('spn-red'); break;
/* 27  */ 							case 4:
/* 28  */ 							case 5: avail.empty().set('text', 'too '+(status==4?'short':'long')).removeClass('spn-green').addClass('spn-gray'); break;
/* 29  */ 						}
/* 30  */ 						if(this.value.trim()=='') avail.getParent().setStyle('display', 'none');
/* 31  */ 					}
/* 32  */ 				}.bind(this),
/* 33  */ 				onFailure: function() {
/* 34  */ 					this.getNext().setStyle('display', 'none');
/* 35  */ 				}.bind(this)
/* 36  */ 			}).send('username='+encodeURIComponent(val));
/* 37  */ 		}else{
/* 38  */ 			document.id('name-availability').getParent().setStyle('display', 'none');
/* 39  */ 		}
/* 40  */ 	},
/* 41  */ 	
/* 42  */ 	check_email_availability: function(e){
/* 43  */ 		try{ new Event(e).stop(); }catch(er){};
/* 44  */ 		var val = this.value.trim();
/* 45  */ 		var re = /^[_a-z0-9-]+([_a-z0-9-.+]*)@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/i;
/* 46  */ 		if(re.test(val)) {
/* 47  */ 			var req = new Request({
/* 48  */ 				url: '/api/check/email/',
/* 49  */ 				method: 'post',
/* 50  */ 				onRequest: function() {

/* utility.js */

/* 51  */ 					this.getNext().setStyle('display', 'block');
/* 52  */ 				}.bind(this),
/* 53  */ 				onSuccess: function(jsonObj) {
/* 54  */ 					jsonObj = JSON.decode(jsonObj);
/* 55  */ 					this.getNext().setStyle('display', 'none');
/* 56  */ 					var status = jsonObj.status.toInt();
/* 57  */ 					var avail = document.id('email-availability');
/* 58  */ 					if(avail) avail.setStyle('display', ((status==2)?'block':'none'));
/* 59  */ 				}.bind(this),
/* 60  */ 				onFailure: function() {
/* 61  */ 					this.getNext().setStyle('display', 'none');
/* 62  */ 				}.bind(this)
/* 63  */ 			}).send('email='+encodeURIComponent(val));
/* 64  */ 		}
/* 65  */ 	},
/* 66  */ 	
/* 67  */ 	check_password_strength: function(e){
/* 68  */ 		var val = this.value.trim();
/* 69  */ 		var pwdStrength = 'pwd-strength';
/* 70  */ 		if(val.length >= 6){	
/* 71  */ 			var str = 'password='+encodeURIComponent(val);
/* 72  */ 			var userName = document.id('userName').value.trim();
/* 73  */ 			var email = document.id('email').value.trim();
/* 74  */ 			if(userName!='') str += '&username='+userName;
/* 75  */ 			if(email!='') str += '&email='+email;		
/* 76  */ 			var req = new Request({
/* 77  */ 				url: '/api/check/password/',
/* 78  */ 				method: 'post',
/* 79  */ 				onRequest: function() {
/* 80  */ 					this.getNext().setStyle('display', 'block');
/* 81  */ 				}.bind(this),
/* 82  */ 				onComplete: function(resp) {
/* 83  */ 					this.getNext().setStyle('display', 'none');
/* 84  */ 					resp = resp.toInt();
/* 85  */ 					if(resp>=1 && resp<=3){
/* 86  */ 						document.id('pwd-strength').set('text', 'weak');
/* 87  */ 					}else if(resp>3 && resp<=5){
/* 88  */ 						document.id('pwd-strength').set('text', 'fair');
/* 89  */ 					}else if(resp>5 && resp<=7){
/* 90  */ 						document.id('pwd-strength').set('text', 'reasonable');
/* 91  */ 					}else if(resp>=7){
/* 92  */ 						document.id('pwd-strength').set('text', 'strong');
/* 93  */ 					}else{
/* 94  */ 						document.id('pwd-strength').set('text', 'too short');
/* 95  */ 					}
/* 96  */ 				}.bind(this),
/* 97  */ 				onFailure: function() {
/* 98  */ 					this.getNext().setStyle('display', 'none');
/* 99  */ 				}.bind(this)
/* 100 */ 			}).send(str);

/* utility.js */

/* 101 */ 		}else{
/* 102 */ 			(val!='') ? document.id('pwd-strength').set('text', 'too short'): document.id('pwd-strength').empty();
/* 103 */ 		}
/* 104 */ 	},
/* 105 */ 	
/* 106 */ 	change_topbar_tologgedin: function(user){
/* 107 */ 		if(!document.id('topbar-new')) return;
/* 108 */ 		document.id('topbar-userlink').set('href', document.id('topbar-userlink').get('href')+user.username);
/* 109 */ 		new Request({
/* 110 */ 			url: '/api/check/info/disccount/',
/* 111 */             method: 'get',
/* 112 */             onComplete: function(json) {
/* 113 */ 				json = JSON.decode(json);
/* 114 */ 				if(json){
/* 115 */ 					document.id('topbar-username').set('text', user.username.capitalize());
/* 116 */ 					document.id('topbar-dcount').set('text', json.disc_count);
/* 117 */ 					document.id('topbar-myact').set('href', '/user/'+user.username+'/activity/');
/* 118 */ 					document.id('topbar-mynact').set('href', '/user/'+user.username+'/network/activity/');
/* 119 */ 					document.id('topbar-myaact').set('href', '/user/'+user.username+'/assignment/activity/');
/* 120 */ 					$$('.topbarholi').addClass('nodisplay');
/* 121 */ 					$$('.topbarsoli').removeClass('nodisplay');
/* 122 */ 				}
/* 123 */             }
/* 124 */         }).send();
/* 125 */ 	},
/* 126 */ 	
/* 127 */ 	remove_events: function(container){
/* 128 */ 		if($type(container) == "string") container = (container.charAt(0)=='.' || container.charAt(0)=='#') ? $$(container) : document.id(container);
/* 129 */ 		if(container){
/* 130 */ 			container.removeEvents();
/* 131 */ 			container.getElements('.e').each(function(el){ el.removeEvents(); });
/* 132 */ 		}
/* 133 */ 	},
/* 134 */ 	
/* 135 */ 	is_valid_email: function(str){
/* 136 */ 		var re = /^[_a-z0-9-]+([_a-z0-9-.+]*)@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/i;
/* 137 */ 		return re.test(str);
/* 138 */ 	},
/* 139 */ 	
/* 140 */ 	validate_form: function(fm,spc) {
/* 141 */ 		var isError = false;
/* 142 */ 		if($type(fm) == "string") fm = document.id(fm);
/* 143 */ 		fm.getElements('input[type!=hidden], textarea').each(function(el){
/* 144 */ 			var val = el.value.trim();
/* 145 */ 		   	if(
/* 146 */ 		   		(
/* 147 */ 		   			val=='' || 
/* 148 */ 		   			(el.id=='email' && !this.is_valid_email(val)) || 
/* 149 */ 		   			el.getProperty('defaultmsg')==el.value || 
/* 150 */ 		   			el.retrieve('defaultvalue')==el.value || 

/* utility.js */

/* 151 */ 		   			(spc && (el.type=='radio' || el.type=='checkbox') && !el.checked)
/* 152 */ 		   		) && 
/* 153 */ 		   		!el.hasClass('optional')
/* 154 */ 		   	){
/* 155 */ 		   		isError = true;
/* 156 */ 		   		if(
/* 157 */ 		   			(el.getProperty('defaultmsg')!=el.value || el.retrieve('defaultvalue')==el.value) && 
/* 158 */ 		   			!(el.type=='radio' || el.type=='checkbox')
/* 159 */ 		   		){
/* 160 */ 		   			el.value = '';
/* 161 */ 		   		}
/* 162 */ 		   		poptent_helpers.apply_validation_error_state(el);
/* 163 */ 			}
/* 164 */ 		}, this);
/* 165 */ 		if(spc){ //special checks for selects
/* 166 */ 			fm.getElements('select').each(function(el){
/* 167 */ 				var val = el.value.trim();
/* 168 */ 				if((val=='' || val==0) && !el.hasClass('optional')){
/* 169 */ 					isError = true;
/* 170 */ 			   		poptent_helpers.apply_validation_error_state(el);
/* 171 */ 				}
/* 172 */ 			});
/* 173 */ 		}
/* 174 */ 		return isError;
/* 175 */ 	},
/* 176 */ 	
/* 177 */ 	create_account: function(options) {
/* 178 */ 		// Validation
/* 179 */ 		if(!this.validate_form(options.formid)){
/* 180 */ 			document.id(options.formid).set('send', {
/* 181 */ 				link: 'cancel',
/* 182 */ 				onRequest: options.loader.show,
/* 183 */ 				onComplete: function(json) {			
/* 184 */ 					options.loader.hide();
/* 185 */ 					json = JSON.decode(json);
/* 186 */ 					var status = json.status;
/* 187 */ 					if(status==0){
/* 188 */ 						poptent_helpers.show_notification('your account was created successfully','success');
/* 189 */ 						if(typeof json.reload != 'undefined' && json.reload==1){
/* 190 */ 							window.location.reload();
/* 191 */ 						}else{
/* 192 */ 							options.success(json);
/* 193 */ 						}
/* 194 */ 					}else if(status==1){
/* 195 */ 						//at least 1 required field is blank
/* 196 */ 						validateForm(form);
/* 197 */ 					}else if(status==2){
/* 198 */ 						//username is invalid
/* 199 */ 						poptent_helpers.show_notification('Please fill in username correctly','error');
/* 200 */ 						if(document.id('userName')) poptent_helpers.apply_validation_error_state('userName');

/* utility.js */

/* 201 */ 					}else if(status==3){
/* 202 */ 						//username already taken
/* 203 */ 						poptent_helpers.show_notification('Sorry, that username is unavailable','error');
/* 204 */ 						if(document.id('userName')) poptent_helpers.apply_validation_error_state('userName');
/* 205 */ 					}else if(status==10){
/* 206 */ 						//username not between 3 - 20 chars
/* 207 */ 						poptent_helpers.show_notification('Your username should have 3 to 20 characters','error');
/* 208 */ 						if(document.id('userName')) poptent_helpers.apply_validation_error_state('userName');
/* 209 */ 					}else if(status==7){
/* 210 */ 						//email is invalid
/* 211 */ 						poptent_helpers.show_notification('Please enter a valid email','error');
/* 212 */ 						if(document.id('email')) poptent_helpers.apply_validation_error_state('email');
/* 213 */ 					}else if(status==8){
/* 214 */ 						//email has already been taken
/* 215 */ 						poptent_helpers.show_notification('That email is already taken','error');
/* 216 */ 						if(document.id('email')) poptent_helpers.apply_validation_error_state('email');
/* 217 */ 					}else if(status==9){
/* 218 */ 						//internal error
/* 219 */ 						poptent_helpers.show_notification('Please try again','error');
/* 220 */ 					}else if(status==12){
/* 221 */ 						//password error
/* 222 */ 						poptent_helpers.show_notification('Please enter a password with more than 6 characters','error');
/* 223 */ 						if(document.id('password')) poptent_helpers.apply_validation_error_state('password');
/* 224 */ 					}else if(status==13){
/* 225 */ 						//password error
/* 226 */ 						poptent_helpers.show_notification('That username is invalid, blank spaces are not allowed','error');
/* 227 */ 						if(document.id('password')) poptent_helpers.apply_validation_error_state('password');
/* 228 */ 					}
/* 229 */ 				},
/* 230 */ 				onFailure: function() {
/* 231 */ 					options.loader.hide();
/* 232 */ 					poptent_helpers.show_notification('Please try again','error');
/* 233 */ 				}
/* 234 */ 			}).send();
/* 235 */ 		}else{
/* 236 */ 			poptent_helpers.show_notification('Please fill in the required fields','error');
/* 237 */ 		}
/* 238 */ 	},
/* 239 */ 	
/* 240 */ 	verify_account_resend: function(options){
/* 241 */ 		var redir = (options.redir) ? options.redir : '';
/* 242 */ 		new Request({
/* 243 */ 			url: '/join/resendactivation/'+redir,
/* 244 */ 			link: 'cancel',
/* 245 */ 			method: 'post',
/* 246 */ 			onComplete: function(json) {
/* 247 */ 				json = JSON.decode(json);
/* 248 */ 				switch(json.status){
/* 249 */ 					case 0: poptent_helpers.show_notification('Email resent successfully', 'success'); break;
/* 250 */ 					case 1: poptent_helpers.show_notification('Action not permitted', 'error'); break;

/* utility.js */

/* 251 */ 					case 2: poptent_helpers.show_notification('No user found!', 'error'); break;
/* 252 */ 					case 3:
/* 253 */ 						poptent_helpers.show_notification('your account is already verified', 'success');
/* 254 */ 						options.onsuccess(this.rel);
/* 255 */ 						break;
/* 256 */ 					case 4:
/* 257 */ 						poptent_helpers.show_notification('Please try again', 'error');
/* 258 */ 						break;
/* 259 */ 				}
/* 260 */ 			}.bind(this),
/* 261 */ 			onFailure: function() {
/* 262 */ 				poptent_helpers.show_notification('Please try again', 'error');
/* 263 */ 			}.bind(this)
/* 264 */ 		}).send('userId='+options.userid);
/* 265 */ 	},
/* 266 */ 	
/* 267 */ 	verify_account: function(options){
/* 268 */ 		if(document.id('verificationCode').value.trim() == '' || document.id('verificationCode').value.trim() == options.defaultvalue){
/* 269 */ 			poptent_helpers.apply_validation_error_state(document.id('verificationCode'));
/* 270 */ 		}else{
/* 271 */ 			new Request({
/* 272 */ 				url: document.id('account-verification-form').getProperty('action'),
/* 273 */ 				method: 'post',
/* 274 */ 				link: 'cancel',
/* 275 */ 				onRequest: options.loader.show,
/* 276 */ 				onComplete: function(json) {
/* 277 */ 					options.loader.hide();
/* 278 */ 					json = JSON.decode(json);
/* 279 */ 					switch(json.status){
/* 280 */ 						case 0:
/* 281 */ 						case 4: 
/* 282 */ 							poptent_helpers.show_notification((json.status==4 ? 'your account is already verified' : 'your account was verified successfully'), 'success');
/* 283 */ 							options.onsuccess(json);
/* 284 */ 							break;
/* 285 */ 						case 1: poptent_helpers.show_notification('Please enter the verification code', 'error'); break;
/* 286 */ 						case 2: poptent_helpers.show_notification('That verification code is invalid', 'error'); break;
/* 287 */ 						case 3: poptent_helpers.show_notification('Please try again', 'error'); break;
/* 288 */ 					}
/* 289 */ 				},
/* 290 */ 				onFailure: function() {
/* 291 */ 					options.loader.hide();
/* 292 */ 					poptent_helpers.show_notification('Please try again', 'error');
/* 293 */ 				}
/* 294 */ 			}).send(document.id('account-verification-form'));
/* 295 */ 		}
/* 296 */ 	},
/* 297 */ 	
/* 298 */ 	add_remove_el_effect: function(options){
/* 299 */ 		/*
/* 300 *| 		 * actions

/* utility.js */

/* 301 *| 		 * 	0 - add: color - [#BFE0B7 - #FFFFFF]
/* 302 *| 		 * 	1 - delete: color - [#BF0000 - #FFFFFF]
/* 303 *| 		 */
/* 304 */ 		if(options.action==0){
/* 305 */ 			//add item
/* 306 */ 			new Fx.Morph(document.id(options.elid),{
/* 307 */ 				duration: 2000, 
/* 308 */ 				transition: Fx.Transitions.linear
/* 309 */ 			}).start({
/* 310 */ 				'background-color': '#fff'
/* 311 */ 			}).chain(function(){
/* 312 */ 				if(options.oncomplete) options.oncomplete();
/* 313 */ 			});
/* 314 */ 		}else if(options.action==1){
/* 315 */ 			//remove item
/* 316 */ 			var transitions = options.nored != 1 ? {
/* 317 */ 				start: { 'background-color': '#BF0000' },
/* 318 */ 				end: { 'opacity': 0, 'background-color': '#FFFFFF' }
/* 319 */ 			} : {
/* 320 */ 				start: {},
/* 321 */ 				end: { 'opacity': 0 }
/* 322 */ 			};
/* 323 */ 			new Fx.Morph(document.id(options.elid), {
/* 324 */ 				duration: 300, 
/* 325 */ 				transition: Fx.Transitions.linear
/* 326 */ 			}).start(transitions.start).chain(function(){
/* 327 */ 				this.start(transitions.end);
/* 328 */ 			}).chain(function(){
/* 329 */ 				document.id(options.elid).destroy();
/* 330 */ 				if(options.oncomplete) options.oncomplete();
/* 331 */ 			});
/* 332 */ 		}
/* 333 */ 	},
/* 334 */ 	
/* 335 */ 	addIPE: function(els) {
/* 336 */ 		/*	IPE	wannabe	 */
/* 337 */ 		$$(els).each(function(el){
/* 338 */ 			if(!el.hasClass('e')){
/* 339 */ 				el.addClass('e').addEvent('click', function(e){
/* 340 */ 					try{ new Event(e).stop(); }catch(er){};
/* 341 */ 					this.addClass('hidden');
/* 342 */ 					var ipeContainer = this.getNext().removeClass('ipe-hidden');
/* 343 */ 					ipeContainer.getElement('input').focus();
/* 344 */ 				});
/* 345 */ 			}
/* 346 */ 		});
/* 347 */ 	},
/* 348 */ 	
/* 349 */ 	close_all_overlays: function(cid){//TODO: find a better way to do this
/* 350 */ 		$$('.overlay-box').each(function(el){

/* utility.js */

/* 351 */ 			if(el.getStyle('display')=='block' && el.id!=cid){
/* 352 */ 				var ext = el.id.split('-').getLast();
/* 353 */ 				if(ext=='assignment'){
/* 354 */ 					assignment_controller.overlay.close();
/* 355 */ 				}else if(ext=='login'){
/* 356 */ 					login_controller.overlay.close();
/* 357 */ 				}
/* 358 */ 			}
/* 359 */ 		});
/* 360 */ 	},
/* 361 */ 	
/* 362 */ 	close_notifier: function(url,retry){
/* 363 */ 		retry = retry || 3;
/* 364 */ 		var ajax = new Request({
/* 365 */ 			url: url,
/* 366 */ 			method: 'get', 
/* 367 */ 			onComplete: function(resp) {
/* 368 */ 				--retry;
/* 369 */ 				if(resp!=1 && retry>0) func();
/* 370 */ 			},
/* 371 */ 			onFailure: function(){
/* 372 */ 				--retry;
/* 373 */ 				if(retry>0) func();
/* 374 */ 			}
/* 375 */ 		});
/* 376 */ 		var func = function(){ ajax.send(); };
/* 377 */ 		func();
/* 378 */ 	},
/* 379 */ 	
/* 380 */ 	remove_default_msg: function(el,defaultvalue,e){
/* 381 */ 		el = ($type(el) == "string" ? document.id(el) : el);
/* 382 */ 		if(!el) return
/* 383 */ 		if (typeof Modernizr == 'undefined' || !Modernizr.input.placeholder) {
/* 384 */ 			if(el.value==''){
/* 385 */ 				el.value = defaultvalue;
/* 386 */ 				el.addClass('defaultText');
/* 387 */ 			}
/* 388 */ 			el.store('defaultvalue', defaultvalue);
/* 389 */ 			el.addEvents({
/* 390 */ 				'focus': function(){
/* 391 */ 					this.removeClass('defaultText');
/* 392 */ 					if(this.value==this.retrieve('defaultvalue') || this.value=='') this.value = '';
/* 393 */ 				},
/* 394 */ 				'blur': function(){
/* 395 */ 					var defaultvalue = this.retrieve('defaultvalue');
/* 396 */ 					if(this.value==defaultvalue || this.value==''){
/* 397 */ 						this.value = defaultvalue; 
/* 398 */ 						this.addClass('defaultText');
/* 399 */ 						try { this.blur(); } catch(e) {};
/* 400 */ 					}

/* utility.js */

/* 401 */ 				}
/* 402 */ 			});
/* 403 */ 			el.fireEvent('blur');
/* 404 */ 			if(e) el.addClass('e');
/* 405 */ 		}else{
/* 406 */ 			var cpl = el.getProperty('placeholder');
/* 407 */ 			if(!cpl || cpl != defaultvalue) el.setProperty('placeholder',defaultvalue);
/* 408 */ 			if(el.getProperty('value') == defaultvalue) el.setProperty('value','');
/* 409 */ 		}
/* 410 */ 		
/* 411 */ 	},
/* 412 */ 	
/* 413 */ 	remove_default_msg_pass: function(el, defaultvalue){
/* 414 */ 		el = ($type(el) == "string" ? document.id(el) : el);
/* 415 */ 		if(!el) return
/* 416 */ 		if(el.value==''){
/* 417 */ 			el.value = defaultvalue;
/* 418 */ 			el.addClass('defaultText');
/* 419 */ 		}
/* 420 */ 		el.addEvent('focus', function(){
/* 421 */ 			this.addClass('hidden');
/* 422 */ 			document.id(this.id+'-actual').removeClass('hidden').focus();
/* 423 */ 		});
/* 424 */ 		
/* 425 */ 		var actual = document.id(el.id+'-actual');
/* 426 */ 		actual.store('defaultvalue', defaultvalue);
/* 427 */ 		actual.addEvent('blur', function(){
/* 428 */ 			var defaultvalue = this.retrieve('defaultvalue');
/* 429 */ 			if(this.value==defaultvalue || this.value==''){
/* 430 */ 				this.value = ''; 
/* 431 */ 				this.addClass('hidden');
/* 432 */ 				document.id(this.id.replace('-actual','')).removeClass('hidden');
/* 433 */ 			}
/* 434 */ 		});
/* 435 */ 	},
/* 436 */ 	
/* 437 */ 	click_outside: function(e,options){
/* 438 */ 		options = options || {};
/* 439 */ 		var cs = this.getSize();
/* 440 */ 		var cp = this.getPosition();
/* 441 */ 		var exl = e.client.x + window.getScrollLeft();
/* 442 */ 		var ext = e.client.y + window.getScrollTop();
/* 443 */ 		if( 
/* 444 */ 			exl < cp.x || exl > cp.x + cs.x || 
/* 445 */ 			ext < cp.y || ext > cp.y + cs.y
/* 446 */ 		){
/* 447 */ 			if(options.oncomplete) options.oncomplete();
/* 448 */ 			document.id(document.body).removeEvents('mouseup');
/* 449 */ 		}
/* 450 */ 	}

/* utility.js */

/* 451 */ };

;
/* site.js */

/* 1   */ /*
/* 2   *|  * site.js
/* 3   *|  * 
/* 4   *|  * site-wide js vars & functions
/* 5   *| */
/* 6   */ var roar;
/* 7   */ var thisComments;
/* 8   */ function get_session_val(){
/* 9   */ 	return Cookie.read(session_key);
/* 10  */ };
/* 11  */ 
/* 12  */ var mysettingsbox;
/* 13  */ 
/* 14  */ var tips_regex = new RegExp("^(a?tips)-([^\-]*)\-([\\d]+)([a-zA-Z0-9_-]*)");
/* 15  */ 
/* 16  */ var tips_locate_handler = function(event,tipref){
/* 17  */ 	var offsets = {'x': -10, 'y': 26};
/* 18  */ 	var win = {'x': window.getWidth(), 'y': window.getHeight()};
/* 19  */ 	var scroll;
/* 20  */ 	if (Browser.Engine.trident) {
/* 21  */ 		scroll = {'x': window.scrollLeft, 'y': window.scrollTop};
/* 22  */ 	}else{
/* 23  */ 		scroll = {'x': window.getScrollLeft(), 'y': window.getScrollTop()};
/* 24  */ 	}
/* 25  */ 	var tip = {'x': tipref.offsetWidth, 'y': tipref.offsetHeight};
/* 26  */ 	var prop = {'x': 'left', 'y': 'top'};
/* 27  */ 	var isBottom = false;
/* 28  */ 	var isRight = false;
/* 29  */ 	if($defined(event.page)) for (var z in prop){
/* 30  */ 		var pos = event.page[z] + offsets[z];
/* 31  */ 		var chk = pos + tip[z] - scroll[z];
/* 32  */ 		if (
/* 33  */ 			chk > win[z]
/* 34  */ 		) {
/* 35  */ 			if(prop[z]=='top')  isBottom = true;
/* 36  */ 			if(prop[z]=='left') isRight = true;
/* 37  */ 			pos = event.page[z] - offsets[z] - tip[z];
/* 38  */ 		}
/* 39  */ 		tipref.setStyle(prop[z], pos);
/* 40  */ 	}
/* 41  */ 	
/* 42  */ 	var hasright  = !!(tipref.className.indexOf('right',0) !== -1);
/* 43  */ 	var hasbottom = !!(tipref.className.indexOf('bottom',0) !== -1);
/* 44  */ 	
/* 45  */ 	if(!isBottom && !isRight){
/* 46  */ 		if(hasright)   tipref.removeClass('right');
/* 47  */ 		if(hasbottom)  tipref.removeClass('bottom');
/* 48  */ 	}else if(isBottom && !isRight){
/* 49  */ 		if(hasright)   tipref.removeClass('right');
/* 50  */ 		if(!hasbottom) tipref.addClass('bottom');

/* site.js */

/* 51  */ 	}else if(!isBottom && isRight){
/* 52  */ 		if(!hasright)  tipref.addClass('right');
/* 53  */ 		if(hasbottom)  tipref.removeClass('bottom');
/* 54  */ 	}else if(isBottom && isRight){
/* 55  */ 		if(!hasright)  tipref.addClass('right');
/* 56  */ 		if(!hasbottom) tipref.addClass('bottom');
/* 57  */ 	}
/* 58  */ };
/* 59  */ 
/* 60  */ var tips_chk = function(tid,ttip){
/* 61  */ 	var this_tip = document.id(ttip);
/* 62  */ 	if(!document.id(tid)){
/* 63  */ 		this_tip.style.display = 'none';
/* 64  */ 		this_tip = null;
/* 65  */ 		return true;
/* 66  */ 	}else if(this_tip.style.display=='none'){
/* 67  */ 		this_tip = null;
/* 68  */ 		return true;
/* 69  */ 	}else{
/* 70  */ 		this_tip = null;
/* 71  */ 		setTimeout(function(){tips_chk(tid,ttip)},1000);
/* 72  */ 	}
/* 73  */ }
/* 74  */ 
/* 75  */ var window_events_delegate = function(evt){
/* 76  */ 	var e = evt || window.event;
/* 77  */ 	var target;
/* 78  */ 	var is_in = false;
/* 79  */ 	if(typeof e == "undefined"){
/* 80  */ 		return true;
/* 81  */ 	}else if(typeof e.type == "undefined" || !e.type){
/* 82  */ 		return true;
/* 83  */ 	}
/* 84  */ 	switch(e.type){
/* 85  */ 		case 'click':
/* 86  */ 			target = document.id((e.target || e.srcElement));
/* 87  */ 			var tclass = target.className;
/* 88  */ 			if (tclass && tclass.indexOf('queue-add', 0) !== -1) {
/* 89  */ 				if (typeof queue_controller != 'undefined') queue_controller.delegate(e, target);
/* 90  */ 			}
/* 91  */ 			break;
/* 92  */ 		case 'mousemove':
/* 93  */ 			if (Browser.Engine.trident) {
/* 94  */ 				poptent_vars.mouse.x = window.scrollLeft+e.client.x;
/* 95  */ 				poptent_vars.mouse.y = window.scrollTop+e.client.y;
/* 96  */ 			} else {
/* 97  */ 				poptent_vars.mouse.x = e.page.x;
/* 98  */ 				poptent_vars.mouse.y = e.page.y;
/* 99  */ 			}
/* 100 */ 			return true;

/* site.js */

/* 101 */ 			break;
/* 102 */ 		case 'focus':
/* 103 */ 		case 'onfocusin':
/* 104 */ 		case 'focusin':
/* 105 */ 			is_in = true;
/* 106 */ 		case 'blur':
/* 107 */ 		case 'onfocusout':
/* 108 */ 		case 'focusout':
/* 109 */ 			target = e.target || e.srcElement;
/* 110 */ 			var tag = target.nodeName.toUpperCase();
/* 111 */ 			if(tag=='OBJECT'||tag=='EMBED') return true;
/* 112 */ 			var tclass = target.className;
/* 113 */ 			var is_mat = false;
/* 114 */ 			if (tclass && tclass.indexOf('f_textarea', 0) !== -1) is_mat = true;
/* 115 */ 			
/* 116 */ 			if(is_mat||tag=='INPUT'||tag=='TEXTAREA'){
/* 117 */ 				target = document.id(target);
/* 118 */ 				if(target.hasClass('input_focus_border')){
/* 119 */ 					if(is_in){
/* 120 */ 						target.addClass('inputActive');
/* 121 */ 					}else{
/* 122 */ 						target.removeClass('inputActive');
/* 123 */ 					}
/* 124 */ 				}
/* 125 */ 			}
/* 126 */ 			return true;
/* 127 */ 			break;
/* 128 */ 		case 'mouseenter':
/* 129 */ 		case 'mouseover':
/* 130 */ 			is_in = true;
/* 131 */ 		case 'mouseout':
/* 132 */ 		case 'mouseleave':
/* 133 */ 			new Event(e).stopPropagation();
/* 134 */ 			if (Browser.Engine.trident) {
/* 135 */ 				poptent_vars.mouse.x = window.getScrollLeft()+e.client.x;
/* 136 */ 				poptent_vars.mouse.y = window.getScrollTop()+e.client.y;
/* 137 */ 			} else {
/* 138 */ 				poptent_vars.mouse.x = e.page.x;
/* 139 */ 				poptent_vars.mouse.y = e.page.y;
/* 140 */ 			}
/* 141 */ 			if(!target) target = e.target || e.srcElement;
/* 142 */ 			var tag = target.nodeName.toUpperCase();
/* 143 */ 			if(tag=='OBJECT'||tag=='EMBED') return true;
/* 144 */ 			var tid = target.id;
/* 145 */ 			if(!tid){
/* 146 */ 				target = target.parentNode;
/* 147 */ 				if(target) tid = target.id;
/* 148 */ 			}
/* 149 */ 			var tclass = target.className;
/* 150 */ 			if(tid && tid.indexOf){

/* site.js */

/* 151 */ 				if(poptent_vars.modules.tips.enabled==1){
/* 152 */ 					if((tid.indexOf('tips', 0) !== -1 || (tclass && tclass.indexOf('tips', 0) !== -1)) && tid.indexOf('tooltipref', 0) === -1){
/* 153 */ 						var res = tips_regex.exec(tid);
/* 154 */ 						if(!(res && res[1] && res[2] && res[3]) && tclass){
/* 155 */ 							if(tclass.indexOf(' ',0) !== -1){
/* 156 */ 								var class_array = tclass.split(' ');
/* 157 */ 								var l = class_array.length;
/* 158 */ 								for (var i=0;i<l; i++){
/* 159 */ 									var current = class_array[i];
/* 160 */ 									if(current.indexOf('tips', 0) !== -1){
/* 161 */ 										res = tips_regex.exec(current);
/* 162 */ 										if(res && res[1] && res[2] && res[3]) break;
/* 163 */ 									}
/* 164 */ 								}
/* 165 */ 							}else{
/* 166 */ 								res = tips_regex.exec(tclass);
/* 167 */ 							}
/* 168 */ 						}
/* 169 */ 						if (res && res[1] && res[2] && res[3]) {
/* 170 */ 							var tooltip_type = res[1];
/* 171 */ 							var tooltip_cat = res[2];
/* 172 */ 							var tooltip_id = res[3];
/* 173 */ 							var tooltip_url = '/tooltips/'+res[2]+'/'+res[3]+'/';
/* 174 */ 							var tooltip_data = [];
/* 175 */ 							var tooltip_ref = 'tooltipref-'+res[1]+'-'+res[2]+((tooltip_type=='atips')?'-'+res[3]:'');
/* 176 */ 							var res2 = (!res[4])?false:(res[4].split('-'));
/* 177 */ 							var res2_off = 1;
/* 178 */ 							
/* 179 */ 							while(res2 && res2[res2_off] && res2[res2_off].indexOf('_', 0) !== -1){
/* 180 */ 								var tt_data = res2[res2_off].replace(/__/gi,' ').split('_');
/* 181 */ 								tooltip_data.push(tt_data[0]+'='+tt_data[1]);
/* 182 */ 								tooltip_ref += '-'+tt_data[0].replace(/ /gi,'__')+'_'+tt_data[1].replace(/ /gi,'__');
/* 183 */ 								res2_off++;
/* 184 */ 							}
/* 185 */ 							
/* 186 */ 							
/* 187 */ 							var ttip = document.id(tooltip_ref);
/* 188 */ 							
/* 189 */ 							if(!ttip){
/* 190 */ 								var ttip_styles = {
/* 191 */ 									'position': 'absolute',
/* 192 */ 									'top': '0',
/* 193 */ 									'left': '0',
/* 194 */ 									'display': 'none'
/* 195 */ 								};
/* 196 */ 								if (Browser.Engine.trident) ttip_styles['width'] = '60px';
/* 197 */ 								ttip = new Element('div', {
/* 198 */ 									'class': 'newToolTip',
/* 199 */ 									'id': tooltip_ref,
/* 200 */ 									'styles': ttip_styles,

/* site.js */

/* 201 */ 									'html': '<div class="tt-tl" id="ttsub1-'+tooltip_ref+'-tl"></div>'+
/* 202 */ 									'<div class="tt-tr" id="ttsub1-'+tooltip_ref+'-tr"></div>'+
/* 203 */ 									'<div class="tt-tm" id="ttsub1-'+tooltip_ref+'-tm"></div>'+
/* 204 */ 										'<div class="tooltip-content" id="ttsub1-'+tooltip_ref+'-content">'+
/* 205 */ 											'<div class="tooltip-loading" style="display: block;"></div>'+
/* 206 */ 											'<div class="tc"></div>'+
/* 207 */ 											'<div class="clear"></div>'+
/* 208 */ 										'</div>'+
/* 209 */ 									'<div class="tt-bm" id="ttsub1-'+tooltip_ref+'-bm"></div>'+
/* 210 */ 									'<div class="tt-bl" id="ttsub1-'+tooltip_ref+'-bl"></div>'+
/* 211 */ 									'<div class="tt-br" id="ttsub1-'+tooltip_ref+'-br"></div>'
/* 212 */ 								}).inject(document.body);
/* 213 */ 							}
/* 214 */ 							
/* 215 */ 							if(is_in){
/* 216 */ 								if(!ttip.retrieve('is_visible')) ttip.setStyle('display','block');
/* 217 */ 								ttip.store('is_visible',1);
/* 218 */ 								
/* 219 */ 								var tlc = tips_locate_handler;
/* 220 */ 								tlc({'page': {'x': poptent_vars.mouse.x,'y': poptent_vars.mouse.y}},ttip);
/* 221 */ 								target = document.id(target);
/* 222 */ 								if(!target.retrieve('tip_move_event')){
/* 223 */ 									target.addEvent('mousemove', tlc.bindWithEvent(target,ttip));
/* 224 */ 									target.store('tip_move_event',1);
/* 225 */ 								}
/* 226 */ 								
/* 227 */ 								setTimeout(function(){tips_chk(tid,tooltip_ref)},1000);
/* 228 */ 								
/* 229 */ 								ttip.store('is_visible',1);
/* 230 */ 								if(!ttip.retrieve('hascontent')){
/* 231 */ 									if(tooltip_type=='atips'){
/* 232 */ 										ttip.requestTooltip = new Request({
/* 233 */ 											url: tooltip_url,
/* 234 */ 											method: 'post',
/* 235 */ 											link: 'cancel',
/* 236 */ 											onComplete: function(result){
/* 237 */ 												var tooltipId = 'aTooltip-'+res[2]+'-'+res[3];
/* 238 */ 												($$('#'+tooltip_ref+' div.tc')[0]).set('html','<div id="'+tooltipId+'" class="tw">'+result+'</div>').setStyle('display', 'block');							
/* 239 */ 												($$('#'+tooltip_ref+' div.tooltip-loading')[0]).setStyle('display', 'none');
/* 240 */ 												if (Browser.Engine.trident) { 
/* 241 */ 													ttip.setStyle('width', 'auto'); 
/* 242 */ 													ttip.setStyle('width', (ttip.getElement('.tooltip-content').getSize().x+10)+'px'); 
/* 243 */ 												}
/* 244 */ 												ttip.store('hascontent',1);
/* 245 */ 												tlc({'page': {'x': poptent_vars.mouse.x,'y': poptent_vars.mouse.y}},ttip);
/* 246 */ 											}
/* 247 */ 										}).send(tooltip_data.join('&'));
/* 248 */ 									}else if(tooltip_type=='tips'){
/* 249 */ 										if(
/* 250 */ 											typeof tip_defs !== 'undefined' && 

/* site.js */

/* 251 */ 											tip_defs[tooltip_cat]
/* 252 */ 										){
/* 253 */ 											var tooltipId = 'aTooltip-'+res[2]+'-'+res[3];
/* 254 */ 											($$('#'+tooltip_ref+' div.tc')[0]).set(
/* 255 */ 												'html',
/* 256 */ 												'<div id="'+tooltipId+'" style="font-weight: bold;"><span>'+tip_defs[tooltip_cat].title+'</span></div>'+
/* 257 */ 												((tip_defs[tooltip_cat].content)?'<div><span>'+tip_defs[tooltip_cat].content+'</span></div>':'')
/* 258 */ 											).setStyle('display', 'block');							
/* 259 */ 											($$('#'+tooltip_ref+' div.tooltip-loading')[0]).setStyle('display', 'none');
/* 260 */ 											if (Browser.Engine.trident) { 
/* 261 */ 												ttip.setStyle('width', 'auto'); 
/* 262 */ 												ttip.setStyle('width', (ttip.getElement('.tooltip-content').getSize().x+10)+'px'); 
/* 263 */ 											}
/* 264 */ 											ttip.store('hascontent',1);
/* 265 */ 											tlc({'page': {'x': poptent_vars.mouse.x,'y': poptent_vars.mouse.y}},ttip);
/* 266 */ 										}
/* 267 */ 									}
/* 268 */ 								}
/* 269 */ 								
/* 270 */ 							}else{
/* 271 */ 								ttip.store('is_visible',0);
/* 272 */ 								ttip.setStyle('display','none');
/* 273 */ 								//target.removeEvents('mousemove');
/* 274 */ 								if(tooltip_type=='atips' && ttip.requestTooltip) ttip.requestTooltip.cancel();
/* 275 */ 							}
/* 276 */ 						}
/* 277 */ 					}else if(tid.indexOf('tooltipref', 0) !== -1){
/* 278 */ 						var ttip;
/* 279 */ 						if(tid.indexOf('ttsub1', 0) !== -1){
/* 280 */ 							ttip = document.id(tid).getParent();
/* 281 */ 						}else if(tid.indexOf('ttsub2', 0) !== -1){
/* 282 */ 							ttip = document.id(tid).getParent().getParent();
/* 283 */ 						}
/* 284 */ 						if(ttip) tips_locate_handler({'page': {'x': poptent_vars.mouse.x,'y': poptent_vars.mouse.y}},ttip);
/* 285 */ 						
/* 286 */ 					}else if(tid.indexOf('aTooltip', 0) !== -1){
/* 287 */ 						var ttip = document.id(tid).getParent().getParent().getParent();
/* 288 */ 						tips_locate_handler({'page': {'x': poptent_vars.mouse.x,'y': poptent_vars.mouse.y}},ttip);
/* 289 */ 					}
/* 290 */ 				}
/* 291 */ 			}
/* 292 */ 			break;
/* 293 */ 		default:
/* 294 */ 			return true;
/* 295 */ 		
/* 296 */ 	}
/* 297 */ };
/* 298 */ 
/* 299 */ window.addEvent(poptent_vars.load_event, function(){
/* 300 */ 	if(Browser.Engine.trident) $$('div#main button').addEvent('click', function(e){ new Event(e).preventDefault(); });

/* site.js */

/* 301 */ 	if(typeof roar == 'undefined') roar = new Roar();
/* 302 */ 	
/* 303 */ 	if(document.id('searchFormId') && document.id('searchTypeId')){
/* 304 */ 		var stid = document.id('searchTypeId');
/* 305 */ 		poptent_vars.modules.search.type = stid.options[stid.selectedIndex].value;
/* 306 */ 		stid.addEvent('change', function(e){
/* 307 */ 			document.id('searchFormId').setProperty('action','/search/'+poptent_vars.modules.search.type+'/'+((typeof poptent_vars.modules.search.per_page != 'undefined')?'1/'+poptent_vars.modules.search.per_page+'/':''));
/* 308 */ 		});
/* 309 */ 		stid = null;
/* 310 */ 		document.id('searchFormId').addEvent('submit',function(e){
/* 311 */ 			if(document.id('searchTypeId').options[document.id('searchTypeId').selectedIndex].value != poptent_vars.modules.search.type){
/* 312 */ 				try{ new Event(e).stop(); }catch(er){};
/* 313 */ 				poptent_vars.modules.search.type = document.id('searchTypeId').options[document.id('searchTypeId').selectedIndex].value;
/* 314 */ 				this.setProperty('action','/search/'+poptent_vars.modules.search.type+'/'+((typeof poptent_vars.modules.search.per_page != 'undefined')?'1/'+poptent_vars.modules.search.per_page+'/':''));
/* 315 */ 				this.submit();
/* 316 */ 			}
/* 317 */ 		});
/* 318 */ 		if (Browser.Engine.trident) {
/* 319 */ 			document.id('searchSubmit').addEvent('click', function(){
/* 320 */ 				document.id('searchFormId').fireEvent('submit');
/* 321 */ 			});
/* 322 */ 		}
/* 323 */ 	}
/* 324 */ 	
/* 325 */ 	
/* 326 */ 	setZeroTimeout(function(){
/* 327 */ 		if(document.body){
/* 328 */ 			//replaced document.body with $$('body') - throwing error in IE8
/* 329 */ 			$$('body')[0].addEvents({
/* 330 */ 				'mouseover':  window_events_delegate,
/* 331 */ 				'mouseout':   window_events_delegate,
/* 332 */ 				'mouseenter': window_events_delegate,
/* 333 */ 				'mouseleave': window_events_delegate,
/* 334 */ 				'mousemove':  window_events_delegate,
/* 335 */ 				'click':  	  window_events_delegate/*,
/* 336 *| 				'focus':      window_events_delegate,
/* 337 *| 				'blur':       window_events_delegate*/
/* 338 */ 			});
/* 339 */ 			if(Browser.Engine.trident){
/* 340 */ 				document.body.onfocusin = window_events_delegate;
/* 341 */ 				document.body.onfocusout = window_events_delegate;
/* 342 */ 			}else{
/* 343 */ 				document.body.addEventListener('focus',window_events_delegate,true);
/* 344 */ 				document.body.addEventListener('blur',window_events_delegate,true);
/* 345 */ 			}
/* 346 */ 		}
/* 347 */ 	});
/* 348 */ 	try{ $$('form').each(function(el){ el.reset(); }); }catch(er){};
/* 349 */ 	
/* 350 */ 	setZeroTimeout(function(){

/* site.js */

/* 351 */ 		poptent_helpers.init_tips();
/* 352 */ 		var allinputs = $$('input','textarea');
/* 353 */ 		if(allinputs) allinputs.each(function(el){
/* 354 */ 			var elt = el.getProperty('type');
/* 355 */ 			if((elt=='text'||elt=='password'||elt=='textarea')) el.addClass('input_focus_border');
/* 356 */ 		});
/* 357 */ 		allinputs = null;
/* 358 */ 	});
/* 359 */ 	
/* 360 */ 	
/* 361 */ 	
/* 362 */ 	if(document.id('uploadForm') && document.id('fileUploadFormId')){
/* 363 */ 		var uploadForm = document.id('uploadForm');
/* 364 */ 		uploadForm.getElements('input[type=text]').each(function(el){ if(el.value != 'Author') el.value=''; });
/* 365 */ 		uploadForm.getElements('input[type=hidden]','textarea').each(function(el){ el.value=''; });
/* 366 */ 		document.id('fileUploadFormId').reset();
/* 367 */ 		document.id('assetPermissions').addEvent('change', function(){
/* 368 */ 			document.id('sourceAccessBlock').setStyle('display',((this.options[this.selectedIndex].value!=0)?'block':'none'));			
/* 369 */ 		});	
/* 370 */ 		document.id('AssetDesc').addClass('input_focus_border');
/* 371 */ 		new tbresizer('AssetDesc');
/* 372 */ 		if(document.id('uploadPageButton')) document.id('uploadPageButton').addEvent('click',function(){ document.id('fileUploadFormId').submit(); });
/* 373 */ 	}
/* 374 */ 	
/* 375 */ 	if(document.id('profile')){
/* 376 */ 		/* asset profile pages */
/* 377 */ 		if(document.id('profile').hasClass('mediaProfile')){
/* 378 */ 			if (document.id('assetSend') && document.id('shareFrom')) utility_helper.remove_default_msg('shareFrom', document.id('shareFrom').get('value'));
/* 379 */ 			if(document.id('comments')){
/* 380 */ 				acommentsInit();
/* 381 */ 				
/* 382 */ 				if(document.id('0-replylink')){
/* 383 */ 					document.id('0-replylink').addEvent('click', function(e){
/* 384 */ 						try{ new Event(e).stop(); }catch(er){};
/* 385 */ 						thisComments.buildCommentBox('0',0,false);
/* 386 */ 						//setTimeout(function(){thisComments.newcomments_addevents_all('0')},0);
/* 387 */ 						this.setStyle('display','none');
/* 388 */ 					}.bindWithEvent(document.id('0-replylink')));
/* 389 */ 				}
/* 390 */ 				if(document.id('permaup')) document.id('permaup').addEvent('click',function(e){
/* 391 */ 					try{ new Event(e).stop(); }catch(er){};
/* 392 */ 					if (typeof thisComments != 'undefined' && thisComments.history){
/* 393 */ 						thisComments.history.setValue(0, thisComments.pageNum+'/0/'+thisComments.baseId);
/* 394 */ 						thisComments.histChange(thisComments.pageNum+'/0/'+thisComments.baseId);
/* 395 */ 					}else{
/* 396 */ 						window.location = '#c='+thisComments.pageNum+'/0/'+thisComments.baseId;
/* 397 */ 					}
/* 398 */ 				});
/* 399 */ 			}
/* 400 */ 		}

/* site.js */

/* 401 */ 	}
/* 402 */ 	
/* 403 */ 	/*
/* 404 *| 	 * TODO: this should not initialize this way, call on user profile page instead of using id detection as profile-new also exists on 
/* 405 *| 	 * the assignment page :)
/* 406 *| 	 */
/* 407 */ 	
/* 408 */ 	if(document.id('profile-new') && !document.id('profile-new').hasClass('assignment-profile')){
/* 409 */ 		if(document.id('comments')){
/* 410 */ 			ucommentsInit();
/* 411 */ 			if(document.id('0-replylink')){
/* 412 */ 				document.id('0-replylink').addEvent('click', function(e){
/* 413 */ 					try{ new Event(e).stop(); }catch(er){};
/* 414 */ 					thisComments.buildCommentBox('0',0,false);
/* 415 */ 					//setTimeout(function(){thisComments.newcomments_addevents_all('0')},0);
/* 416 */ 					this.setStyle('display','none');
/* 417 */ 				}.bindWithEvent(document.id('0-replylink')));
/* 418 */ 			}
/* 419 */ 			if(document.id('permaup')) document.id('permaup').addEvent('click',function(e){
/* 420 */ 				try{ new Event(e).stop(); }catch(er){};
/* 421 */ 				if (typeof thisComments != 'undefined' && thisComments.history){
/* 422 */ 					thisComments.history.setValue(0, thisComments.pageNum+'/0/'+thisComments.baseId);
/* 423 */ 					thisComments.histChange(thisComments.pageNum+'/0/'+thisComments.baseId);
/* 424 */ 				}else{
/* 425 */ 					window.location = '#c='+thisComments.pageNum+'/0/'+thisComments.baseId;
/* 426 */ 				}
/* 427 */ 			});
/* 428 */ 		}
/* 429 */ 	}
/* 430 */ 	if(document.id('comments-panel')){
/* 431 */ 		if(document.id('comments')){
/* 432 */ 			album_commentsInit();
/* 433 */ 			if(document.id('0-replylink')){
/* 434 */ 				document.id('0-replylink').addEvent('click', function(e){
/* 435 */ 					try{ new Event(e).stop(); }catch(er){};
/* 436 */ 					thisComments.buildCommentBox('0',0,false);
/* 437 */ 					//setTimeout(function(){thisComments.newcomments_addevents_all('0')},0);
/* 438 */ 					this.setStyle('display','none');
/* 439 */ 				}.bindWithEvent(document.id('0-replylink')));
/* 440 */ 			}
/* 441 */ 			if(document.id('permaup')) document.id('permaup').addEvent('click',function(e){
/* 442 */ 				try{ new Event(e).stop(); }catch(er){};
/* 443 */ 				if (typeof thisComments != 'undefined' && thisComments.history){
/* 444 */ 					thisComments.history.setValue(0, thisComments.pageNum+'/0/'+thisComments.baseId);
/* 445 */ 					thisComments.histChange(thisComments.pageNum+'/0/'+thisComments.baseId);
/* 446 */ 				}else{
/* 447 */ 					window.location = '#c='+thisComments.pageNum+'/0/'+thisComments.baseId;
/* 448 */ 				}
/* 449 */ 			});
/* 450 */ 		}

/* site.js */

/* 451 */ 	}
/* 452 */ });
/* 453 */ 
/* 454 */ function initNotify(notificationText,isError){
/* 455 */ };
/* 456 */ 
/* 457 */ 
/* 458 */ 
/* 459 */ function reInitTips(){
/* 460 */ 	$$('div#main .tips').each(function(el){
/* 461 */ 		if(!el.hasClass('hasTips')){
/* 462 */ 			if(!el.getProperty('id')) el.setProperty('id',poptent_helpers.mock_id());
/* 463 */ 			var tId = el.getProperty('id');
/* 464 */ 			addTip(tId);
/* 465 */ 		};
/* 466 */ 	});
/* 467 */ };
/* 468 */ 
/* 469 */ function addTip(el,tooltipText){
/* 470 */ 	if(!$defined(tooltipText)) tooltipText = false;
/* 471 */ 	new infoTips(el, {
/* 472 */ 		offsets: {'x': -10, 'y': 26},
/* 473 */ 		showDelay: 51,
/* 474 */ 		hideDelay: 50,
/* 475 */ 		maxTitleChars: 320,
/* 476 */ 		timeOut: 2000,
/* 477 */ 		tipText: tooltipText
/* 478 */ 	});
/* 479 */ };
/* 480 */ 
/* 481 */ var customTips = new Class({
/* 482 */ 	Extends: Tips2,
/* 483 */ 	Implements: [Options, Events],
/* 484 */ 	initialize: function(elements, options){
/* 485 */ 		if(!$defined(this.did)){
/* 486 */ 			this.did = poptent_vars.debug_id;
/* 487 */ 			poptent_vars.debug_id++;
/* 488 */ 		}
/* 489 */ 		this.setOptions(options);
/* 490 */ 		this.parent(elements);
/* 491 */ 	},
/* 492 */ 	
/* 493 */ 	build: function(el){
/* 494 */ 		//el.$tmp.myTitle = (el.href && el.get('tag') == 'a') ? el.href.replace('http://', '') : (el.rel || false);
/* 495 */ 		if((el.href && el.get('tag') == 'a')) el.title = el.getFirst().getProperty('title');
/* 496 */ 		if (el.title){
/* 497 */ 			var dual = el.title.split('::');
/* 498 */ 			if (dual.length > 1){
/* 499 */ 				
/* 500 */ 				if (dual.length == 4) el.store('myFlag',dual[3].trim());					

/* site.js */

/* 501 */ 				el.store('myTitle1',dual[0].trim());
/* 502 */ 				el.store('myTitle2',dual[1].trim());
/* 503 */ 				el.store('myText',dual[2].trim());
/* 504 */ 			} else {
/* 505 */ 				el.store('myText',el.title);
/* 506 */ 			};
/* 507 */ 			if((el.href && el.get('tag') == 'a')){ el.getFirst().removeAttribute('title'); el.removeAttribute('title'); }
/* 508 */ 			else{ el.removeAttribute('title');};
/* 509 */ 		} else {
/* 510 */ 			el.store('myText',false);
/* 511 */ 		}
/* 512 */ 		el.addEvent('mouseenter', function(event){
/* 513 */ 			this.start(el);
/* 514 */ 			if (!this.options.fixed) this.locate(event);
/* 515 */ 			else this.position(el);
/* 516 */ 		}.bind(this));
/* 517 */ 		if (!this.options.fixed){ el.addEvent('mousemove', this.locate.bindWithEvent(this));};
/* 518 */ 		var end = this.end.bind(this);
/* 519 */ 		if(!el.hasClass('hasTips')){ el.addClass('hasTips');};
/* 520 */ 		el.addEvent('mouseleave', end);
/* 521 */ 		el.addEvent('trash', end);
/* 522 */ 	},
/* 523 */ 	
/* 524 */ 	start: function(el){
/* 525 */ 		this.wrapper.empty();
/* 526 */ 		
/* 527 */ 		if (el.retrieve('myTitle1')){
/* 528 */ 			if (el.retrieve('myTitle2')){
/* 529 */ 				var title = ((el.retrieve('myFlag'))?'<img src="'+el.retrieve('myFlag')+'" alt="" class="flagInsideToolTip" />':'') + '<em >'+el.retrieve('myTitle1')+'</em>, '+el.retrieve('myTitle2');
/* 530 */ 			}else{
/* 531 */ 				var title = '<em >'+el.retrieve('myTitle1')+'</em>';
/* 532 */ 			}
/* 533 */ 			this.title = new Element('span').inject(new Element('div', {'class': this.options.className + '-title'}).inject(this.wrapper)).set('html', title);
/* 534 */ 		}
/* 535 */ 		this.text = new Element('span').inject(new Element('div', {'class': this.options.className + '-text'}).inject(this.wrapper)).set('html', ((el.retrieve('myText'))?el.retrieve('myText'):'&nbsp;'));
/* 536 */ 		$clear(this.timer);
/* 537 */ 		this.timer = this.show.delay(this.options.showDelay, this);
/* 538 */ 	}
/* 539 */ });
/* 540 */ 
/* 541 */ /*
/* 542 *|  * flash player functions
/* 543 *|  */
/* 544 */ 
/* 545 */ function sendEvent(swf,typ,prm) {
/* 546 */ 	thisMovie(swf).sendEvent(typ,prm); 
/* 547 */ };
/* 548 */ 
/* 549 */ function getUpdate(typ,pr1,pr2,swf) { };
/* 550 */ 

/* site.js */

/* 551 */ function thisMovie(swf) {
/* 552 */ 	return (navigator.appName.indexOf("Microsoft") != -1)?window[swf]:document[swf];
/* 553 */ };
/* 554 */ 
/* 555 */ function loadFile(swf,obj) { 
/* 556 */ 	thisMovie(swf).loadFile(obj); 
/* 557 */ };
/* 558 */ 
/* 559 */ var player;
/* 560 */ 
/* 561 */ function playerReady(obj) {
/* 562 */ 	player = document.getElementById(obj['id']);
/* 563 */ };
/* 564 */ 
/* 565 */ 
/* 566 */ /*
/* 567 *|  * search functions
/* 568 *|  * 
/* 569 *|  */
/* 570 */ 
/* 571 */ function updatePagination(total, pageIndex, firstParent, parent, isFirstLoad) {
/* 572 */ 	var parent1 = ($type(parent) == "string" ? document.id(parent) : parent);
/* 573 */ 	var firstParent1 = ($type(firstParent) == "string" ? document.id(firstParent) : firstParent);
/* 574 */ 	if (!$defined(isFirstLoad)) isFirstLoad = false;
/* 575 */ 	if (total/9 > 1) {
/* 576 */ 		var adjacents = 1;
/* 577 */ 		var pageNum = pageIndex.toInt();
/* 578 */ 		var numPages = Math.ceil(total.toInt()/9);
/* 579 */ 		var html = '';
/* 580 */ 		function buildPaginationLink(pageNum) {
/* 581 */ 			html += '<a '+((pageNum==pageIndex)?'class="selected"':'')+'href="#" rel="'+pageNum+'">'+pageNum+'</a>';
/* 582 */ 		}
/* 583 */ 		
/* 584 */ 		if(numPages > 1){
/* 585 */ 			if (numPages < 7 + (adjacents * 2)){
/* 586 */ 				for(var i=1;i<=numPages;i++) buildPaginationLink(i);
/* 587 */ 			}else{
/* 588 */ 				if(pageNum < (1 + (adjacents * 3))){
/* 589 */ 					for(var i=1;i < (4 + (adjacents * 2));i++) buildPaginationLink(i);
/* 590 */ 					html += '<span style="float: left; margin: 0 2px;">...</span>';
/* 591 */ 					buildPaginationLink(numPages-1);
/* 592 */ 					buildPaginationLink(numPages);
/* 593 */ 				}else if((numPages - (adjacents * 2) > pageNum) && (pageNum > (adjacents * 2))){
/* 594 */ 					buildPaginationLink(1);
/* 595 */ 					buildPaginationLink(2);
/* 596 */ 					html += '<span style="float: left; margin: 0 2px;">...</span>';
/* 597 */ 					for(var i=(pageNum-adjacents);i<=(pageNum+adjacents);i++) buildPaginationLink(i);
/* 598 */ 					html += '<span style="float: left; margin: 0 2px;">...</span>';
/* 599 */ 					buildPaginationLink(numPages-1);
/* 600 */ 					buildPaginationLink(numPages);

/* site.js */

/* 601 */ 				}else{
/* 602 */ 					buildPaginationLink(1);
/* 603 */ 					buildPaginationLink(2);
/* 604 */ 					html += '<span style="float: left; margin: 0 2px;">...</span>';
/* 605 */ 					for(var i=(numPages - (1 + (adjacents * 3)));i<=numPages;i++) buildPaginationLink(i);
/* 606 */ 				}
/* 607 */ 			}
/* 608 */ 			/* Injecting the Links */
/* 609 */ 			var el = (pageIndex==1 && isFirstLoad)?(firstParent1.getNext().getElement('div.cloudPages')):firstParent1;
/* 610 */ 			el.set('html', html).setStyle('display', 'block');
/* 611 */ 			
/* 612 */ 			/* Injecting arrows if necessary */
/* 613 */ 			if(pageNum>1){
/* 614 */ 				new Element('img').setProperties({
/* 615 */ 					src: poptent_helpers.add_image_base('module/pageLeft-gray.gif')
/* 616 */ 				}).injectInside(new Element('a').setProperties({'href': '#', 'rel': pageNum-1}).addClass('pagelr').injectTop(el));
/* 617 */ 			}
/* 618 */ 			if(pageNum<numPages){
/* 619 */ 				new Element('img').setProperties({
/* 620 */ 					src: poptent_helpers.add_image_base('module/pageRight-gray.gif')
/* 621 */ 				}).injectInside(new Element('a').setProperties({'href': '#', 'rel': pageNum+1}).addClass('pagelr').injectInside(el));
/* 622 */ 			};
/* 623 */ 			
/* 624 */ 			this.add_cloud_pages_event(el.getElements('a'));
/* 625 */ 			if (Browser.Engine.webkit) el.getElements('a').setStyle('font-size', '11px');
/* 626 */ 		}
/* 627 */ 	}
/* 628 */ };
/* 629 */ 
/* 630 */ 
/* 631 */ 
/* 632 */ function getPlayer(gid) {
/* 633 */ 	return (navigator.appName.indexOf("Microsoft") != -1)?window[gid]:document[gid];
/* 634 */ };
/* 635 */ 
/* 636 */ // Only add setZeroTimeout to the window object, and hide everything
/* 637 */ // else in a closure.
/* 638 */ (function() {
/* 639 */     var timeouts = [];
/* 640 */     var messageName = "zero-timeout-message";
/* 641 */ 
/* 642 */     // Like setTimeout, but only takes a function argument.  There's
/* 643 */     // no time argument (always zero) and no arguments (you have to
/* 644 */     // use a closure).
/* 645 */     function setZeroTimeout(fn) {
/* 646 */         /*if(window.postMessage){
/* 647 *| 	    	timeouts.push(fn);
/* 648 *| 	        window.postMessage(messageName, "*");
/* 649 *|         }else{*/
/* 650 */         	setTimeout(fn,0);

/* site.js */

/* 651 */         //}
/* 652 */     }
/* 653 */ 
/* 654 */     function handleMessage(event) {
/* 655 */         if (event.source == window && event.data == messageName) {
/* 656 */             if(event.stopPropagation) event.stopPropagation();
/* 657 */             else event.cancelBubble = true;
/* 658 */             if (timeouts.length> 0) {
/* 659 */                 var fn = timeouts.shift();
/* 660 */                 if(fn) fn();
/* 661 */             }
/* 662 */         }
/* 663 */     }
/* 664 */ 
/* 665 */     if(Browser.Engine.trident){ 
/* 666 */     	window.attachEvent("onmessage", handleMessage);
/* 667 */     }else{
/* 668 */     	window.addEventListener("message", handleMessage, true);
/* 669 */     }
/* 670 */ 
/* 671 */     // Add the one thing we want added to the window object.
/* 672 */     window.setZeroTimeout = setZeroTimeout;
/* 673 */ })();
/* 674 */ 
/* 675 */ 
/* 676 */ 
/* 677 */ 

;
/* hash.persistent.js */

/* 1   */ /*
/* 2   *| Script: Hash.Persistent.js
/* 3   *| 	A Hash that stays in the client for long periods of time
/* 4   *| 
/* 5   *| 	License:
/* 6   *| 		MIT-style license.
/* 7   *| 
/* 8   *| 	Authors:
/* 9   *| 		Guillermo Rauch
/* 10  *|  */
/* 11  */ 
/* 12  */ var providersSQLInit = false;
/* 13  */ 
/* 14  */ var gearsDB = false;
/* 15  */ 
/* 16  */ Hash.Persistent = new Class({
/* 17  */ 	
/* 18  */ 	Extends: Hash,
/* 19  */ 	Implements: [Options, Events],
/* 20  */ 	
/* 21  */ 	options: {
/* 22  */ 		provider: ['html5','gears'],
/* 23  */ 		check: null,
/* 24  */ 		expires: false
/* 25  */ 	},
/* 26  */ 	
/* 27  */ 	using: null,
/* 28  */ 	
/* 29  */ 	initialize: function(name, options, context){
/* 30  */ 		//alert('init');
/* 31  */ 		
/* 32  */ 		this.name = (typeof poptent_vars.env !== "undefined")?(poptent_vars.env+'_'+name):name;
/* 33  */ 		this.setOptions(options);
/* 34  */ 		this.context = context || document;
/* 35  */ 		if(!providersSQLInit){
/* 36  */ 			providersSQLInit = true;
/* 37  */ 			Hash.Persistent.ProvidersSQL = new Hash(Hash.Persistent.ProvidersSQL);
/* 38  */ 		}
/* 39  */ 		this.load();
/* 40  */ 		window.addEvent('beforeunload', this.save.bind(this), true);
/* 41  */ 	},
/* 42  */ 	
/* 43  */ 	save: function(){
/* 44  */ 		if(this.provider) this.provider.store(this.name, JSON.encode([$time(), this.obj]));
/* 45  */ 	},
/* 46  */ 	
/* 47  */ 	load: function(){
/* 48  */ 		if(this.options.provider && $type(this.options.provider)=='array'){
/* 49  */ 			this.options.provider.each(function(t){
/* 50  */ 				if(!this.provider){

/* hash.persistent.js */

/* 51  */ 					var tmpProvider = Hash.Persistent.Providers[t];
/* 52  */ 					if(tmpProvider){
/* 53  */ 						if(tmpProvider.init(this.context)){
/* 54  */ 							this.provider = tmpProvider;
/* 55  */ 							this.using = t;
/* 56  */ 							var data = false;
/* 57  */ 							var retrieveddata = this.provider.retrieve(this.name);
/* 58  */ 							if(retrieveddata){
/* 59  */ 								retrieveddata = retrieveddata.toString();
/* 60  */ 								data = JSON.decode(retrieveddata);
/* 61  */ 							}
/* 62  */ 							
/* 63  */ 							this.obj = (data)?data[1]:{};
/* 64  */ 						}else{
/* 65  */ 							this.provider = false;
/* 66  */ 						}
/* 67  */ 					}else{
/* 68  */ 						this.provider = false;
/* 69  */ 					}
/* 70  */ 				}
/* 71  */ 			}.bind(this));
/* 72  */ 		}else{
/* 73  */ 			this.provider = this.options.provider ? Hash.Persistent.Providers[this.options.provider] : Hash.Persistent.Provider;
/* 74  */ 			if (this.provider){
/* 75  */ 				if(this.provider.init(this.context)){
/* 76  */ 					this.using = this.options.provider;
/* 77  */ 					var retrieveddata = this.provider.retrieve(this.name);
/* 78  */ 					var data = JSON.decode(retrieveddata);
/* 79  */ 					this.obj = (data)?data[1]:{};
/* 80  */ 				}else{
/* 81  */ 					this.provider = false;
/* 82  */ 				}
/* 83  */ 			}
/* 84  */ 		}
/* 85  */ 		if(!this.provider){
/* 86  */ 			this.using = 'hash';
/* 87  */ 			this.obj = {};
/* 88  */ 		}
/* 89  */ 		//this.setLength();
/* 90  */ 	},
/* 91  */ 	
/* 92  */ 	timed_get: function(key){
/* 93  */ 		var currTime = new Date().getTime();
/* 94  */ 		var result = this.get(key);
/* 95  */ 		if(!result) return false;
/* 96  */ 		
/* 97  */ 		var setTime = result[0];
/* 98  */ 		var ret = result[1];
/* 99  */ 		var expires = result[2];
/* 100 */ 		

/* hash.persistent.js */

/* 101 */ 		if(!setTime||!ret||!expires){
/* 102 */ 			this.erase(key);
/* 103 */ 			return false;
/* 104 */ 		}
/* 105 */ 		
/* 106 */ 		var diff = currTime-setTime;
/* 107 */ 		
/* 108 */ 		if(diff>(expires*1000)){
/* 109 */ 			this.erase(key);
/* 110 */ 			return false;
/* 111 */ 		}else{
/* 112 */ 			return ret;
/* 113 */ 		}
/* 114 */ 		
/* 115 */ 	},
/* 116 */ 	
/* 117 */ 	timed_set: function(key,value,expires){
/* 118 */ 		var currTime = new Date().getTime();
/* 119 */ 		return this.set(key,[currTime,value,expires]);
/* 120 */ 	}
/* 121 */ 
/* 122 */ });
/* 123 */ 
/* 124 */ Hash.Persistent.Providers = {};
/* 125 */ Hash.Persistent.ProvidersSQL = {
/* 126 */ 
/* 127 */ 	'create':   "CREATE TABLE IF NOT EXISTS hash (k VARCHAR(150) UNIQUE NOT NULL PRIMARY KEY, v TEXT NOT NULL)",
/* 128 */ 	'select':   "SELECT v FROM hash WHERE k = ?",
/* 129 */ 	'insert':   "INSERT INTO hash(k, v) VALUES (?, ?)",
/* 130 */ 	'delete':   "DELETE FROM hash WHERE k = ?",
/* 131 */ 	'flush':    "DELETE FROM hash where 1=1"
/* 132 */ 
/* 133 */ };
/* 134 */ 
/* 135 */ Hash.Persistent.Providers.ie = {
/* 136 */ 
/* 137 */ 	check: function(){
/* 138 */ 		try{ return Browser.Engine.trident; }catch(er){};
/* 139 */ 		return false;
/* 140 */ 	},
/* 141 */ 	
/* 142 */ 	init: function(context){		
/* 143 */ 		this.body = context.getDocument().body;		
/* 144 */ 	},
/* 145 */ 	
/* 146 */ 	element: function(id){
/* 147 */ 		if(document.id('hash_persistent-' + id)) return document.id('hash_persistent-' + id);
/* 148 */ 		var el = new Element('div', { 'id': 'hash_persistent-' + id }).inject(this.body);
/* 149 */ 		el.addBehavior('#default#userData');
/* 150 */ 		return el;

/* hash.persistent.js */

/* 151 */ 	},
/* 152 */ 	
/* 153 */ 	retrieve: function(key){    
/* 154 */ 		return this.element(key).getAttribute('data');
/* 155 */ 	},
/* 156 */ 	
/* 157 */ 	store: function(key, value){    
/* 158 */ 		this.element(key).setAttribute('data', value);
/* 159 */ 	},
/* 160 */ 	
/* 161 */ 	eliminate: function(hash){
/* 162 */ 		this.element(key).removeAttribute('data');
/* 163 */ 	}
/* 164 */ 
/* 165 */ };
/* 166 */ 
/* 167 */ Hash.Persistent.Providers.html5 = {
/* 168 */ 	
/* 169 */ 	check: function(context){
/* 170 */ 		try{ 
/* 171 */ 			if($defined(window.localStorage)){
/* 172 */ 				return true;
/* 173 */ 			}else if(!(typeof(localStorage) == 'undefined')){
/* 174 */ 				return true;
/* 175 */ 			}else if($defined(window.globalStorage) && window.globalStorage[window.location.hostname]){
/* 176 */ 				return true;
/* 177 */ 			}
/* 178 */ 		}catch(er){};
/* 179 */ 		return false;
/* 180 */ 	},
/* 181 */ 	
/* 182 */ 	init: function(context){
/* 183 */ 		if(this.check()){
/* 184 */ 			try{
/* 185 */ 				if($defined(window.localStorage)){
/* 186 */ 					this.storage = window.localStorage;
/* 187 */ 					return true;
/* 188 */ 				}else if(!(typeof(localStorage) == 'undefined')){
/* 189 */ 					this.storage = localStorage;
/* 190 */ 					return true;
/* 191 */ 				}else if($defined(window.globalStorage) && window.globalStorage[window.location.hostname]){
/* 192 */ 					this.storage = window.globalStorage[window.location.hostname];
/* 193 */ 					return true;
/* 194 */ 				}
/* 195 */ 				return false;
/* 196 */ 			}catch(er){};
/* 197 */ 		}
/* 198 */ 		return false;
/* 199 */ 	},
/* 200 */ 	

/* hash.persistent.js */

/* 201 */ 	retrieve: function(key){
/* 202 */ 		return this.storage[key]; 
/* 203 */ 	},
/* 204 */ 	
/* 205 */ 	store: function(key, value){
/* 206 */ 		this.storage[key] = value;
/* 207 */ 	},
/* 208 */ 	
/* 209 */ 	eliminate: function(hash){ 
/* 210 */ 		delete this.storage[key];
/* 211 */ 	}
/* 212 */ 
/* 213 */ };
/* 214 */ 
/* 215 */ Hash.Persistent.Providers.whatwg_db = {
/* 216 */ 
/* 217 */ 	check: function(context){
/* 218 */ 		try{
/* 219 */ 			if(window.openDatabase){
/* 220 */ 				this.db = window.openDatabase('hash-persistent', '1.0', 'Hash.Persistent storage', 1024 * 1024);
/* 221 */ 				return !! this.db;
/* 222 */ 			}
/* 223 */ 		}catch(er){};
/* 224 */ 		return false;
/* 225 */ 	},
/* 226 */ 	
/* 227 */ 	execute: function(){
/* 228 */ 		var a = arguments;
/* 229 */ 		this.db.transaction(function(tx) { tx.executeSql.run(a); });
/* 230 */ 	},
/* 231 */ 	
/* 232 */ 	init: function(){
/* 233 */ 		this.execute(Hash.Persistent.ProvidersSQL.get('create'));
/* 234 */ 	},
/* 235 */ 	
/* 236 */ 	retrieve: function(key){
/* 237 */ 		var r = null;
/* 238 */ 		this.execute(Hash.Persistent.ProvidersSQL.get('select'), key, function(tx, result) {
/* 239 */ 			if(result.rows.item(0)) r = result.rows.item(0)['v'];
/* 240 */ 		});
/* 241 */ 		return r;
/* 242 */ 	},
/* 243 */ 	
/* 244 */ 	store: function(key, value){
/* 245 */ 		this.eliminate(key);
/* 246 */ 		this.execute(Hash.Persistent.ProvidersSQL.get('insert'), [key, value]);
/* 247 */ 	},
/* 248 */ 	
/* 249 */ 	eliminate: function(key){
/* 250 */ 		this.db.execute(Hash.Persistent.ProvidersSQL.get('delete'), key);

/* hash.persistent.js */

/* 251 */ 	}
/* 252 */ 
/* 253 */ };
/* 254 */ 
/* 255 */ Hash.Persistent.Providers.gears = {
/* 256 */ 	
/* 257 */ 	check: function(context){
/* 258 */ 		try{ return (window.google && google.gears); }catch(er){};
/* 259 */ 		return false;
/* 260 */ 	},
/* 261 */ 	
/* 262 */ 	init: function(){
/* 263 */ 		if(Cookie.read("nogears")) return false;
/* 264 */ 		if(this.check()){
/* 265 */ 			try{
/* 266 */ 				if(!gearsDB){
/* 267 */ 					this.db = google.gears.factory.create('beta.database');
/* 268 */ 					this.db.open('poptent');
/* 269 */ 					this.db.execute(Hash.Persistent.ProvidersSQL.get('create'));
/* 270 */ 					gearsDB = this.db;
/* 271 */ 				}else{
/* 272 */ 					this.db = gearsDB;
/* 273 */ 				}
/* 274 */ 				Cookie.dispose("nogears",{'path': '/', 'duration': 1});
/* 275 */ 				return true;
/* 276 */ 			}catch(er){
/* 277 */ 				Cookie.write('nogears', 1,{'path': '/', 'duration': 1});
/* 278 */ 				return false;
/* 279 */ 			}
/* 280 */ 		}else{
/* 281 */ 			return false;
/* 282 */ 		}
/* 283 */ 	},
/* 284 */ 	
/* 285 */ 	retrieve: function(key){
/* 286 */ 		var rs = this.db.execute(Hash.Persistent.ProvidersSQL.get('select'), [key]);
/* 287 */ 		return rs.isValidRow() ? rs.field(0) : false;
/* 288 */ 	},
/* 289 */ 	
/* 290 */ 	store: function(key, value){
/* 291 */ 		this.eliminate(key);
/* 292 */ 		this.db.execute(Hash.Persistent.ProvidersSQL.get('insert'), [key, value]);
/* 293 */ 	},
/* 294 */ 	
/* 295 */ 	eliminate: function(key){
/* 296 */ 		this.db.execute(Hash.Persistent.ProvidersSQL.get('delete'), [key]);
/* 297 */ 	}
/* 298 */ 
/* 299 */ };
/* 300 */ 

/* hash.persistent.js */

/* 301 */ Hash.Persistent.Providers.swiff = {
/* 302 */ 
/* 303 */ 	check: function(){
/* 304 */ 		try{ return Browser.Plugins.Flash.version; }catch(er){};
/* 305 */ 		return false;
/* 306 */ 	},
/* 307 */ 	
/* 308 */ 	init: function(context){
/* 309 */ 		this.el = document.id(new Swiff('hash.persistent.swf')).inject(document.body);
/* 310 */ 	},
/* 311 */ 	
/* 312 */ 	retrieve: function(key){
/* 313 */ 		return this.el.get(key);
/* 314 */ 	},
/* 315 */ 	
/* 316 */ 	store: function(key, value){    
/* 317 */ 		this.el.set(key, value);
/* 318 */ 	},
/* 319 */ 	
/* 320 */ 	eliminate: function(key){
/* 321 */ 		this.el.erase(key);
/* 322 */ 	}
/* 323 */ };

;
/* siteAutocompleters.js */

/* 1   */ /*
/* 2   *|  * siteAutocompleter.js
/* 3   *|  * 
/* 4   *|  * extended autocompleters used throughout site
/* 5   *| */
/* 6   */ 
/* 7   */ function selectCredit(el,type,inv){
/* 8   */ 	if(type == 'new'){
/* 9   */ 		creditBoxModule.appendEditList([el,type,inv]);
/* 10  */ 	}else{
/* 11  */ 		creditBoxModule.jsonFetch(3,'',[el,'member']);
/* 12  */ 	};
/* 13  */ };
/* 14  */ 
/* 15  */ function selectMemberGroups(el,type,inv){
/* 16  */ 	if(type == 'new'){
/* 17  */ 		membersBoxModule.appendEditList([el,type,inv]);
/* 18  */ 	}else{
/* 19  */ 		membersBoxModule.jsonFetch(3,'',[el,'member']);
/* 20  */ 	};
/* 21  */ };
/* 22  */ 
/* 23  */ var AutocompleterAssetControls = new Class({
/* 24  */ 	Extends: AutocompleterCredits.Ajax.Json,
/* 25  */ 	Implements: [Options, Events],
/* 26  */ 	build: function() {
/* 27  */ 		this.bottom = new Element('div').addClass(this.options.barClassName).addClass('ie_layout').set('html', 'Didn\'t find who you were looking for? Enter an email.');
/* 28  */ 		this.completer.adopt(this.controls.adopt(this.paginate)).adopt(this.choices).adopt(this.bottom).injectInside(document.body);
/* 29  */ 	},
/* 30  */ 	updateBottom: function() {
/* 31  */ 		if(document.id(this.element).value.contains('@') && this.isValidEmail(document.id(this.element).value)){
/* 32  */ 			this.bottom.empty();
/* 33  */ 			if(this.isEmpty){
/* 34  */ 				this.bottom.set('html', 'To share with ' + document.id(this.element).value + ' click send');
/* 35  */ 			}
/* 36  */ 		}else{
/* 37  */ 			this.bottom.empty();
/* 38  */ 			this.bottom.set('html', 'Didn\'t find who you were looking for? Enter an email.');
/* 39  */ 		}
/* 40  */ 	}
/* 41  */ });
/* 42  */ 
/* 43  */ function selectAssetControls(info,type,el){
/* 44  */ 	if(type == 'ext'){//external
/* 45  */ 		alert('EXT: '+info.user);
/* 46  */ 	}else{//internal
/* 47  */ 		//split on aka
/* 48  */ 		document.id(el).value = info.user.contains('aka') ? info.user.split('aka')[0].trim() : info.user;
/* 49  */ 		document.id('shareWithId').value = info.id; //alert(info.user +' - '+ info.id);
/* 50  */ 	}

/* siteAutocompleters.js */

/* 51  */ };
/* 52  */ 
/* 53  */ function selectMemberDiscussions(el,type,inv){
/* 54  */ 	if(type == 'new'){
/* 55  */ 		threadMembersBoxModule.appendEditList([el,type,inv]);
/* 56  */ 	}else{
/* 57  */ 		threadMembersBoxModule.jsonFetch(3,'',[el,'member']);
/* 58  */ 	};
/* 59  */ };
/* 60  */ 
/* 61  */ //Members completer
/* 62  */ var AutocompleterMembers = new Class({
/* 63  */ 	Extends: AutocompleterCredits.Ajax.Json,
/* 64  */ 	Implements: [Options, Events],
/* 65  */ 	build: function() {
/* 66  */ 		this.bottom = new Element('div', {'class': this.options.barClassName}).addClass('ie_layout').set('html', 'Didn\'t find who you were looking for? Enter an email to invite.');
/* 67  */ 		this.completer.adopt(
/* 68  */ 			this.controls.adopt(this.paginate),
/* 69  */ 			this.choices,
/* 70  */ 			this.bottom
/* 71  */ 		).injectInside(this.options.container ? document.id(this.options.container).getElement('.autocompleter-wrapper') : document.body);
/* 72  */ 	},
/* 73  */ 	
/* 74  */ 	showChoices: function() {
/* 75  */ 		if(!this.pos) this.pos = document.id(this.element).getRelativePosition();
/* 76  */ 		document.id(document.body).addEvent('click',this.clickOutside.bind(this));
/* 77  */ 		document.id(this.element).addClass('inputActive');
/* 78  */ 		this.updateBottom();				
/* 79  */ 		if (!this.visible) {
/* 80  */ 			this.visible = true;
/* 81  */ 			var pos = document.id(this.element).getCoordinates(this.options.overflown);
/* 82  */ 			this.completer.setStyles({
/* 83  */ 				'left': this.options.container ? 0 : pos.left,
/* 84  */ 				'top': this.options.container ? 0 : pos.bottom
/* 85  */ 			});
/* 86  */ 			
/* 87  */ 			if (this.options.inheritWidth){
/* 88  */ 				this.completer.setStyle('width', pos.width);
/* 89  */ 				this.choices.setStyle('width', pos.width);
/* 90  */ 			}
/* 91  */ 			this.fx.start(0.9);
/* 92  */ 			if(Browser.Engine.trident6) this.controls.setStyle('visibility', 'visible');
/* 93  */ 			if($defined(this.choices.getFirst())) {
/* 94  */ 				this.choiceOver(this.choices.getFirst());
/* 95  */ 				this.completer.getFirst().setStyle('display', 'block');
/* 96  */ 			}
/* 97  */ 		}
/* 98  */ 	},
/* 99  */ 	
/* 100 */ 	updateBottom: function() {

/* siteAutocompleters.js */

/* 101 */ 		//this.bottom.empty();
/* 102 */ 		if(document.id(this.element).value.contains('@') && this.isValidEmail(document.id(this.element).value)){
/* 103 */ 			this.bottom.set('html', 'To invite '+document.id(this.element).value+' ').adopt(
/* 104 */ 				new Element('a', {'href': '#'}).set('html', 'click here.')
/* 105 */ 				.addEvent('click', function(e){
/* 106 */ 					try{ new Event(e).stop(); }catch(er){};
/* 107 */ 					this.itemInfo = {}; this.itemType = 'new'; this.invite = null;
/* 108 */ 					this.hideChoices();
/* 109 */ 					this.fireEvent('onSelect', [this.itemInfo,this.itemType], 20);
/* 110 */ 				}.bindWithEvent(this))
/* 111 */ 			);
/* 112 */ 		}
/* 113 */ 	}
/* 114 */ });

;
/* mooRainbow.js */

/* 1   */ /***
/* 2   *|  * MooRainbow
/* 3   *|  *
/* 4   *|  * @version		1.11
/* 5   *|  * @license		MIT-style license
/* 6   *|  * @author		w00fz - < w00fzIT [at] gmail.com >
/* 7   *|  * @infos		http://moorainbow.woolly-sheep.net
/* 8   *|  * @copyright	Author
/* 9   *|  * 
/* 10  *|  *
/* 11  *|  */
/* 12  */  
/* 13  */ var MooRainbow = new Class({
/* 14  */ 	Implements: [Options, Events],
/* 15  */ 	options: {
/* 16  */ 		id: 'mooRainbow',
/* 17  */ 		prefix: 'moor-',
/* 18  */ 		imgPath: poptent_helpers.add_image_base('mooRainbow/'),
/* 19  */ 		startColor: [255, 0, 0],
/* 20  */ 		wheel: false,
/* 21  */ 		onComplete: $empty,
/* 22  */ 		onChange: $empty,
/* 23  */ 		onReleaseNoChanges: $empty
/* 24  */ 	},
/* 25  */ 	
/* 26  */ 	initialize: function(el, options) {
/* 27  */ 		if(!$defined(this.did)){
/* 28  */ 			this.did = poptent_vars.debug_id;
/* 29  */ 			poptent_vars.debug_id++;
/* 30  */ 		}
/* 31  */ 		this.element = document.id(el); if (!this.element) return;
/* 32  */ 		this.setOptions(options);
/* 33  */ 		
/* 34  */ 		this.sliderPos = 0;
/* 35  */ 		this.pickerPos = {x: 0, y: 0};
/* 36  */ 		this.backupColor = this.options.startColor;
/* 37  */ 		this.currentColor = this.options.startColor;
/* 38  */ 		this.sets = {
/* 39  */ 			rgb: [],
/* 40  */ 			hsb: [],
/* 41  */ 			hex: []	
/* 42  */ 		};
/* 43  */ 		this.pickerClick = this.sliderClick  = false;
/* 44  */ 		if (!this.layout) this.doLayout();
/* 45  */ 		this.OverlayEvents();
/* 46  */ 		this.sliderEvents();
/* 47  */ 		this.backupEvent();
/* 48  */ 		if (this.options.wheel) this.wheelEvents();
/* 49  */ 		this.element.addEvent('click', function(e) { this.toggle(e); }.bind(this));
/* 50  */ 				

/* mooRainbow.js */

/* 51  */ 		this.layout.overlay.setStyle('background-color', this.options.startColor.rgbToHex());
/* 52  */ 		this.layout.backup.setStyle('background-color', this.backupColor.rgbToHex());
/* 53  */ 
/* 54  */ 		this.pickerPos.x = this.snippet('curPos').l + this.snippet('curSize', 'int').w;
/* 55  */ 		this.pickerPos.y = this.snippet('curPos').t + this.snippet('curSize', 'int').h;
/* 56  */ 		
/* 57  */ 		this.manualSet(this.options.startColor);
/* 58  */ 		
/* 59  */ 		this.pickerPos.x = this.snippet('curPos').l + this.snippet('curSize', 'int').w;
/* 60  */ 		this.pickerPos.y = this.snippet('curPos').t + this.snippet('curSize', 'int').h;
/* 61  */ 		this.sliderPos = this.snippet('arrPos') - this.snippet('arrSize', 'int');
/* 62  */ 
/* 63  */ 		if (window.khtml) this.hide();
/* 64  */ 	},
/* 65  */ 	
/* 66  */ 	toggle: function() {
/* 67  */ 		this[this.visible ? 'hide' : 'show']()
/* 68  */ 	},
/* 69  */ 	
/* 70  */ 	show: function() {
/* 71  */ 		this.rePosition();
/* 72  */ 		this.layout.setStyle('display', 'block');
/* 73  */ 		this.visible = true;
/* 74  */ 	},
/* 75  */ 	
/* 76  */ 	hide: function() {
/* 77  */ 		this.layout.setStyles({'display': 'none'});
/* 78  */ 		this.visible = false;
/* 79  */ 	},
/* 80  */ 	
/* 81  */ 	manualSet: function(color, type) {
/* 82  */ 		if (!type || (type != 'hsb' && type != 'hex')) type = 'rgb';
/* 83  */ 		var rgb, hsb, hex;
/* 84  */ 
/* 85  */ 		if (type == 'rgb') { rgb = color; hsb = color.rgbToHsb(); hex = color.rgbToHex(); } 
/* 86  */ 		else if (type == 'hsb') { hsb = color; rgb = color.hsbToRgb(); hex = rgb.rgbToHex(); }
/* 87  */ 		else { hex = color; rgb = color.hexToRgb(true); hsb = rgb.rgbToHsb(); }
/* 88  */ 		
/* 89  */ 		this.setMooRainbow(rgb);
/* 90  */ 		this.autoSet(hsb);
/* 91  */ 	},
/* 92  */ 	
/* 93  */ 	autoSet: function(hsb) {
/* 94  */ 		var curH = this.snippet('curSize', 'int').h;
/* 95  */ 		var curW = this.snippet('curSize', 'int').w;
/* 96  */ 		var oveH = this.layout.overlay.height;
/* 97  */ 		var oveW = this.layout.overlay.width;
/* 98  */ 		var sliH = this.layout.slider.height;
/* 99  */ 		var arwH = this.snippet('arrSize', 'int');
/* 100 */ 		var hue;

/* mooRainbow.js */

/* 101 */ 		
/* 102 */ 		var posx = Math.round(((oveW * hsb[1]) / 100) - curW);
/* 103 */ 		var posy = Math.round(- ((oveH * hsb[2]) / 100) + oveH - curH);
/* 104 */ 
/* 105 */ 		var c = Math.round(((sliH * hsb[0]) / 360)); c = (c == 360) ? 0 : c;
/* 106 */ 		var position = sliH - c + this.snippet('slider') - arwH;
/* 107 */ 		hue = [this.sets.hsb[0], 100, 100].hsbToRgb().rgbToHex();
/* 108 */ 		
/* 109 */ 		this.layout.cursor.setStyles({'top': posy, 'left': posx});
/* 110 */ 		this.layout.arrows.setStyle('top', position);
/* 111 */ 		this.layout.overlay.setStyle('background-color', hue);
/* 112 */ 		this.sliderPos = this.snippet('arrPos') - arwH;
/* 113 */ 		this.pickerPos.x = this.snippet('curPos').l + curW;
/* 114 */ 		this.pickerPos.y = this.snippet('curPos').t + curH;
/* 115 */ 	},
/* 116 */ 	
/* 117 */ 	setMooRainbow: function(color, type) {
/* 118 */ 		if (!type || (type != 'hsb' && type != 'hex')) type = 'rgb';
/* 119 */ 		var rgb, hsb, hex;
/* 120 */ 
/* 121 */ 		if (type == 'rgb') { rgb = color; hsb = color.rgbToHsb(); hex = color.rgbToHex(); } 
/* 122 */ 		else if (type == 'hsb') { hsb = color; rgb = color.hsbToRgb(); hex = rgb.rgbToHex(); }
/* 123 */ 		else { hex = color; rgb = color.hexToRgb(); hsb = rgb.rgbToHsb(); }
/* 124 */ 
/* 125 */ 		this.sets = {
/* 126 */ 			rgb: rgb,
/* 127 */ 			hsb: hsb,
/* 128 */ 			hex: hex
/* 129 */ 		};
/* 130 */ 
/* 131 */ 		if (!$chk(this.pickerPos.x))
/* 132 */ 			this.autoSet(hsb);		
/* 133 */ 
/* 134 */ 		this.RedInput.value = rgb[0];
/* 135 */ 		this.GreenInput.value = rgb[1];
/* 136 */ 		this.BlueInput.value = rgb[2];
/* 137 */ 		this.HueInput.value = hsb[0];
/* 138 */ 		this.SatuInput.value =  hsb[1];
/* 139 */ 		this.BrighInput.value = hsb[2];
/* 140 */ 		this.hexInput.value = hex;
/* 141 */ 		
/* 142 */ 		this.currentColor = rgb;
/* 143 */ 
/* 144 */ 		this.chooseColor.setStyle('background-color', rgb.rgbToHex());
/* 145 */ 	},
/* 146 */ 	
/* 147 */ 	parseColors: function(x, y, z) {
/* 148 */ 		var s = Math.round((x * 100) / this.layout.overlay.width);
/* 149 */ 		var b = 100 - Math.round((y * 100) / this.layout.overlay.height);
/* 150 */ 		var h = 360 - Math.round((z * 360) / this.layout.slider.height) + this.snippet('slider') - this.snippet('arrSize', 'int');

/* mooRainbow.js */

/* 151 */ 		h -= this.snippet('arrSize', 'int');
/* 152 */ 		h = (h >= 360) ? 0 : (h < 0) ? 0 : h;
/* 153 */ 		s = (s > 100) ? 100 : (s < 0) ? 0 : s;
/* 154 */ 		b = (b > 100) ? 100 : (b < 0) ? 0 : b;
/* 155 */ 
/* 156 */ 		return [h, s, b];
/* 157 */ 	},
/* 158 */ 	
/* 159 */ 	OverlayEvents: function() {
/* 160 */ 		var lim, curH, curW, inputs;
/* 161 */ 		curH = this.snippet('curSize', 'int').h;
/* 162 */ 		curW = this.snippet('curSize', 'int').w;
/* 163 */ 		inputs = $A(this.arrRGB).concat(this.arrHSB, this.hexInput);
/* 164 */ 
/* 165 */ 		document.id(document.body).addEvent('click', function() { 
/* 166 */ 			if(this.visible) { 
/* 167 */ 				this.hide(this.layout);
/* 168 */ 				this.fireEvent('onReleaseNoChanges', [this.backupColor.rgbToHex(), this]);
/* 169 */ 			}
/* 170 */ 		}.bind(this));
/* 171 */ 
/* 172 */ 		inputs.each(function(el) {
/* 173 */ 			el.addEvent('keydown', this.eventKeydown.bindWithEvent(this, el));
/* 174 */ 			el.addEvent('keyup', this.eventKeyup.bindWithEvent(this, el));
/* 175 */ 		}, this);
/* 176 */ 		[this.element, this.layout].each(function(el) {
/* 177 */ 			el.addEvents({
/* 178 */ 				'click': function(e) { try{ new Event(e).stop(); }catch(er){}; },
/* 179 */ 				'keyup': function(e) {
/* 180 */ 					e = new Event(e);
/* 181 */ 					if(e.key == 'esc' && this.visible) this.hide(this.layout);
/* 182 */ 				}.bind(this)
/* 183 */ 			}, this);
/* 184 */ 		}, this);
/* 185 */ 		
/* 186 */ 		lim = {
/* 187 */ 			x: [0 - curW, (this.layout.overlay.width - curW)],
/* 188 */ 			y: [0 - curH, (this.layout.overlay.height - curH)]
/* 189 */ 		};
/* 190 */ 
/* 191 */ 		this.layout.drag = new Drag(this.layout.cursor, {
/* 192 */ 			limit: lim,
/* 193 */ 			onStart: this.overlayDrag.bind(this),
/* 194 */ 			onDrag: this.overlayDrag.bind(this),
/* 195 */ 			snap: 0
/* 196 */ 		});	
/* 197 */ 		
/* 198 */ 		this.layout.overlay2.addEvent('mousedown', function(e){
/* 199 */ 			e = new Event(e);
/* 200 */ 			this.layout.cursor.setStyles({

/* mooRainbow.js */

/* 201 */ 				'top': e.page.y - this.layout.overlay.getTop() - curH,
/* 202 */ 				'left': e.page.x - this.layout.overlay.getLeft() - curW
/* 203 */ 			});
/* 204 */ 			this.layout.drag.start(e);
/* 205 */ 		}.bind(this));
/* 206 */ 		
/* 207 */ 		this.okButton.addEvent('click', function() {
/* 208 */ 			if(this.currentColor == this.options.startColor) {
/* 209 */ 				this.hide();
/* 210 */ 				this.fireEvent('onComplete', [this.sets, this]);
/* 211 */ 			}
/* 212 */ 			else {
/* 213 */ 				this.backupColor = this.currentColor;
/* 214 */ 				this.layout.backup.setStyle('background-color', this.backupColor.rgbToHex());
/* 215 */ 				this.hide();
/* 216 */ 				this.fireEvent('onComplete', [this.sets, this]);
/* 217 */ 			}
/* 218 */ 		}.bind(this));
/* 219 */ 	},
/* 220 */ 	
/* 221 */ 	overlayDrag: function() {
/* 222 */ 		var curH = this.snippet('curSize', 'int').h;
/* 223 */ 		var curW = this.snippet('curSize', 'int').w;
/* 224 */ 		this.pickerPos.x = this.snippet('curPos').l + curW;
/* 225 */ 		this.pickerPos.y = this.snippet('curPos').t + curH;
/* 226 */ 		
/* 227 */ 		this.setMooRainbow(this.parseColors(this.pickerPos.x, this.pickerPos.y, this.sliderPos), 'hsb');
/* 228 */ 		this.fireEvent('onChange', [this.sets, this]);
/* 229 */ 	},
/* 230 */ 	
/* 231 */ 	sliderEvents: function() {
/* 232 */ 		var arwH = this.snippet('arrSize', 'int'), lim;
/* 233 */ 
/* 234 */ 		lim = [0 + this.snippet('slider') - arwH, this.layout.slider.height - arwH + this.snippet('slider')];
/* 235 */ 		this.layout.sliderDrag = new Drag(this.layout.arrows, {
/* 236 */ 			limit: {y: lim},
/* 237 */ 			modifiers: {x: false},
/* 238 */ 			onStart: this.sliderDrag.bind(this),
/* 239 */ 			onDrag: this.sliderDrag.bind(this),
/* 240 */ 			snap: 0
/* 241 */ 		});	
/* 242 */ 	
/* 243 */ 		this.layout.slider.addEvent('mousedown', function(e){
/* 244 */ 			e = new Event(e);
/* 245 */ 
/* 246 */ 			this.layout.arrows.setStyle(
/* 247 */ 				'top', e.page.y - this.layout.slider.getTop() + this.snippet('slider') - arwH
/* 248 */ 			);
/* 249 */ 			this.layout.sliderDrag.start(e);
/* 250 */ 		}.bind(this));

/* mooRainbow.js */

/* 251 */ 	},
/* 252 */ 
/* 253 */ 	sliderDrag: function() {
/* 254 */ 		var arwH = this.snippet('arrSize', 'int'), hue;
/* 255 */ 		
/* 256 */ 		this.sliderPos = this.snippet('arrPos') - arwH;
/* 257 */ 		this.setMooRainbow(this.parseColors(this.pickerPos.x, this.pickerPos.y, this.sliderPos), 'hsb');
/* 258 */ 		hue = [this.sets.hsb[0], 100, 100].hsbToRgb().rgbToHex();
/* 259 */ 		this.layout.overlay.setStyle('background-color', hue);
/* 260 */ 		this.fireEvent('onChange', [this.sets, this]);
/* 261 */ 	},
/* 262 */ 	
/* 263 */ 	backupEvent: function() {
/* 264 */ 		this.layout.backup.addEvent('click', function() {
/* 265 */ 			this.manualSet(this.backupColor);
/* 266 */ 			this.fireEvent('onChange', [this.sets, this]);
/* 267 */ 		}.bind(this));
/* 268 */ 	},
/* 269 */ 	
/* 270 */ 	wheelEvents: function() {
/* 271 */ 		var arrColors = $A(this.arrRGB).extend(this.arrHSB);
/* 272 */ 
/* 273 */ 		arrColors.each(function(el) {
/* 274 */ 			el.addEvents({
/* 275 */ 				'mousewheel': this.eventKeys.bindWithEvent(this, el),
/* 276 */ 				'keydown': this.eventKeys.bindWithEvent(this, el)
/* 277 */ 			});
/* 278 */ 		}, this);
/* 279 */ 		
/* 280 */ 		[this.layout.arrows, this.layout.slider].each(function(el) {
/* 281 */ 			el.addEvents({
/* 282 */ 				'mousewheel': this.eventKeys.bindWithEvent(this, [this.arrHSB[0], 'slider']),
/* 283 */ 				'keydown': this.eventKeys.bindWithEvent(this, [this.arrHSB[0], 'slider'])
/* 284 */ 			});
/* 285 */ 		}, this);
/* 286 */ 	},
/* 287 */ 	
/* 288 */ 	eventKeys: function(e, el, id) {
/* 289 */ 		var wheel, type;		
/* 290 */ 		id = (!id) ? el.id : this.arrHSB[0];
/* 291 */ 
/* 292 */ 		if (e.type == 'keydown') {
/* 293 */ 			if (e.key == 'up') wheel = 1;
/* 294 */ 			else if (e.key == 'down') wheel = -1;
/* 295 */ 			else return;
/* 296 */ 		} else if (e.type == Element.Events.mousewheel.type) wheel = (e.wheel > 0) ? 1 : -1;
/* 297 */ 
/* 298 */ 		if (this.arrRGB.contains(el)) type = 'rgb';
/* 299 */ 		else if (this.arrHSB.contains(el)) type = 'hsb';
/* 300 */ 		else type = 'hsb';

/* mooRainbow.js */

/* 301 */ 
/* 302 */ 		if (type == 'rgb') {
/* 303 */ 			var rgb = this.sets.rgb, hsb = this.sets.hsb, prefix = this.options.prefix, pass;
/* 304 */ 			var value = el.value.toInt() + wheel;
/* 305 */ 			value = (value > 255) ? 255 : (value < 0) ? 0 : value;
/* 306 */ 
/* 307 */ 			switch(el.className) {
/* 308 */ 				case prefix + 'rInput': pass = [value, rgb[1], rgb[2]];	break;
/* 309 */ 				case prefix + 'gInput': pass = [rgb[0], value, rgb[2]];	break;
/* 310 */ 				case prefix + 'bInput':	pass = [rgb[0], rgb[1], value];	break;
/* 311 */ 				default : pass = rgb;
/* 312 */ 			}
/* 313 */ 			this.manualSet(pass);
/* 314 */ 			this.fireEvent('onChange', [this.sets, this]);
/* 315 */ 		} else {
/* 316 */ 			var rgb = this.sets.rgb, hsb = this.sets.hsb, prefix = this.options.prefix, pass;
/* 317 */ 			var value = el.value.toInt() + wheel;
/* 318 */ 
/* 319 */ 			if (el.className.test(/(HueInput)/)) value = (value > 359) ? 0 : (value < 0) ? 0 : value;
/* 320 */ 			else value = (value > 100) ? 100 : (value < 0) ? 0 : value;
/* 321 */ 
/* 322 */ 			switch(el.className) {
/* 323 */ 				case prefix + 'HueInput': pass = [value, hsb[1], hsb[2]]; break;
/* 324 */ 				case prefix + 'SatuInput': pass = [hsb[0], value, hsb[2]]; break;
/* 325 */ 				case prefix + 'BrighInput':	pass = [hsb[0], hsb[1], value]; break;
/* 326 */ 				default : pass = hsb;
/* 327 */ 			}
/* 328 */ 			this.manualSet(pass, 'hsb');
/* 329 */ 			this.fireEvent('onChange', [this.sets, this]);
/* 330 */ 		}
/* 331 */ 		e.stop();
/* 332 */ 	},
/* 333 */ 	
/* 334 */ 	eventKeydown: function(e, el) {
/* 335 */ 		var n = e.code, k = e.key;
/* 336 */ 
/* 337 */ 		if 	((!el.className.test(/hexInput/) && !(n >= 48 && n <= 57)) &&
/* 338 */ 			(k!='backspace' && k!='tab' && k !='delete' && k!='left' && k!='right'))
/* 339 */ 		e.stop();
/* 340 */ 	},
/* 341 */ 	
/* 342 */ 	eventKeyup: function(e, el) {
/* 343 */ 		var n = e.code, k = e.key, pass, prefix, chr = el.value.charAt(0);
/* 344 */ 
/* 345 */ 		if (!$chk(el.value)) return;
/* 346 */ 		if (el.className.test(/hexInput/)) {
/* 347 */ 			if (chr != "#" && el.value.length != 6) return;
/* 348 */ 			if (chr == '#' && el.value.length != 7) return;
/* 349 */ 		} else {
/* 350 */ 			if (!(n >= 48 && n <= 57) && (!['backspace', 'tab', 'delete', 'left', 'right'].contains(k)) && el.value.length > 3) return;

/* mooRainbow.js */

/* 351 */ 		}
/* 352 */ 		
/* 353 */ 		prefix = this.options.prefix;
/* 354 */ 
/* 355 */ 		if (el.className.test(/(rInput|gInput|bInput)/)) {
/* 356 */ 			if (el.value  < 0 || el.value > 255) return;
/* 357 */ 			switch(el.className){
/* 358 */ 				case prefix + 'rInput': pass = [el.value, this.sets.rgb[1], this.sets.rgb[2]]; break;
/* 359 */ 				case prefix + 'gInput': pass = [this.sets.rgb[0], el.value, this.sets.rgb[2]]; break;
/* 360 */ 				case prefix + 'bInput': pass = [this.sets.rgb[0], this.sets.rgb[1], el.value]; break;
/* 361 */ 				default : pass = this.sets.rgb;
/* 362 */ 			}
/* 363 */ 			this.manualSet(pass);
/* 364 */ 			this.fireEvent('onChange', [this.sets, this]);
/* 365 */ 		}
/* 366 */ 		else if (!el.className.test(/hexInput/)) {
/* 367 */ 			if (el.className.test(/HueInput/) && el.value  < 0 || el.value > 360) return;
/* 368 */ 			else if (el.className.test(/HueInput/) && el.value == 360) el.value = 0;
/* 369 */ 			else if (el.className.test(/(SatuInput|BrighInput)/) && el.value  < 0 || el.value > 100) return;
/* 370 */ 			switch(el.className){
/* 371 */ 				case prefix + 'HueInput': pass = [el.value, this.sets.hsb[1], this.sets.hsb[2]]; break;
/* 372 */ 				case prefix + 'SatuInput': pass = [this.sets.hsb[0], el.value, this.sets.hsb[2]]; break;
/* 373 */ 				case prefix + 'BrighInput': pass = [this.sets.hsb[0], this.sets.hsb[1], el.value]; break;
/* 374 */ 				default : pass = this.sets.hsb;
/* 375 */ 			}
/* 376 */ 			this.manualSet(pass, 'hsb');
/* 377 */ 			this.fireEvent('onChange', [this.sets, this]);
/* 378 */ 		} else {
/* 379 */ 			pass = el.value.hexToRgb(true);
/* 380 */ 			if (isNaN(pass[0])||isNaN(pass[1])||isNaN(pass[2])) return;
/* 381 */ 
/* 382 */ 			if ($chk(pass)) {
/* 383 */ 				this.manualSet(pass);
/* 384 */ 				this.fireEvent('onChange', [this.sets, this]);
/* 385 */ 			}
/* 386 */ 		}
/* 387 */ 			
/* 388 */ 	},
/* 389 */ 			
/* 390 */ 	doLayout: function() {
/* 391 */ 		var id = this.options.id, prefix = this.options.prefix;
/* 392 */ 		var idPrefix = id + ' .' + prefix;
/* 393 */ 
/* 394 */ 		this.layout = new Element('div', {
/* 395 */ 			'styles': {'display': 'block', 'position': 'absolute'},
/* 396 */ 			'class': 'mooRainbow',
/* 397 */ 			'id': id
/* 398 */ 		});
/* 399 */ 		
/* 400 */ 		// <div class="'+prefix+'box" style="position: relative;"></div>

/* mooRainbow.js */

/* 401 */ 		var box = new Element('div', {
/* 402 */ 			'styles':  {'position': 'relative'},
/* 403 */ 			'class': prefix + 'box'
/* 404 */ 		}).inject(this.layout);
/* 405 */ 		
/* 406 */ 		// <div class="'+prefix+'overlayBox" style="position: absolute; overflow: hidden;"></div>
/* 407 */ 		var div = new Element('div', {
/* 408 */ 			'styles': {'position': 'absolute', 'overflow': 'hidden'},
/* 409 */ 			'class': prefix + 'overlayBox'
/* 410 */ 		}).inject(box);
/* 411 */ 		
/* 412 */ 		// <div class="'+prefix+'arrows" style="position: absolute; z-index: 1;"></div>
/* 413 */ 		var ar = new Element('div', {
/* 414 */ 			'styles': {'position': 'absolute', 'zIndex': 1},
/* 415 */ 			'class': prefix + 'arrows'
/* 416 */ 		}).inject(box);
/* 417 */ 		
/* 418 */ 		this.layout.inject(document.body);
/* 419 */ 		
/* 420 */ 		ar.width = ar.getStyle('width').toInt();
/* 421 */ 		ar.height = ar.getStyle('height').toInt();
/* 422 */ 		
/* 423 */ 		// <img src="'+this.options.imgPath+'moor_woverlay.png" class="'+prefix+'overlay" style="background-color: #fff; position: relative; z-index: 2;"/>
/* 424 */ 		var ov = new Element('img', {
/* 425 */ 			'styles': {'background-color': '#fff', 'position': 'relative', 'zIndex': 2},
/* 426 */ 			'src': this.options.imgPath + 'moor_woverlay.png',
/* 427 */ 			'class': prefix + 'overlay'
/* 428 */ 		}).inject(div);
/* 429 */ 		
/* 430 */ 		// <img src="'+this.options.imgPath+'moor_boverlay.png" class="'+prefix+'overlay" style="position: absolute; top: 0; left: 0; z-index: 2;"/>
/* 431 */ 		var ov2 = new Element('img', {
/* 432 */ 			'styles': {'position': 'absolute', 'top': 0, 'left': 0, 'zIndex': 2},
/* 433 */ 			'src': this.options.imgPath + 'moor_boverlay.png',
/* 434 */ 			'class': prefix + 'overlay'
/* 435 */ 		}).inject(div);
/* 436 */ 		
/* 437 */ 		if (Browser.Engine.trident4) {
/* 438 */ 			div.setStyle('overflow', '');
/* 439 */ 			var src = ov.src;
/* 440 */ 			ov.src = this.options.imgPath + 'blank.gif';
/* 441 */ 			ov.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='scale')";
/* 442 */ 			src = ov2.src;
/* 443 */ 			ov2.src = this.options.imgPath + 'blank.gif';
/* 444 */ 			ov2.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='scale')";
/* 445 */ 		}
/* 446 */ 		ov.width = ov2.width = div.getStyle('width').toInt();
/* 447 */ 		ov.height = ov2.height = div.getStyle('height').toInt();
/* 448 */ 		
/* 449 */ 		// <div class="'+prefix+'cursor" style="position: absolute; z-index: 2; overflow: hidden;"></div>
/* 450 */ 		var cr = new Element('div', {

/* mooRainbow.js */

/* 451 */ 			'styles': {'overflow': 'hidden', 'position': 'absolute', 'zIndex': 2},
/* 452 */ 			'class': prefix + 'cursor'	
/* 453 */ 		}).inject(div);
/* 454 */ 		cr.width = cr.getStyle('width').toInt();
/* 455 */ 		cr.height = cr.getStyle('height').toInt();
/* 456 */ 		
/* 457 */ 		var sl = new Element('img', {
/* 458 */ 			'styles': {'position': 'absolute', 'z-index': 2},
/* 459 */ 			'src': this.options.imgPath + 'moor_slider.png',
/* 460 */ 			'class': prefix + 'slider'
/* 461 */ 		}).inject(box);
/* 462 */ 		this.layout.slider = document.getElement('#' + idPrefix + 'slider');
/* 463 */ 		sl.width = sl.getStyle('width').toInt();
/* 464 */ 		sl.height = sl.getStyle('height').toInt();
/* 465 */ 		
/* 466 */ 		// <div class="'+prefix+'colorBox" style="position: absolute;"></div>
/* 467 */ 		new Element('div', {
/* 468 */ 			'styles': {'position': 'absolute'},
/* 469 */ 			'class': prefix + 'colorBox'
/* 470 */ 		}).inject(box);
/* 471 */ 		
/* 472 */ 		// <div class="'+prefix+'chooseColor" style="z-index: 2; position: absolute;"></div>
/* 473 */ 		new Element('div', {
/* 474 */ 			'styles': {'zIndex': 2, 'position': 'absolute'},
/* 475 */ 			'class': prefix + 'chooseColor'
/* 476 */ 		}).inject(box);
/* 477 */ 		
/* 478 */ 		
/* 479 */ 		this.layout.backup = new Element('div', {
/* 480 */ 			'styles': {'zIndex': 2, 'position': 'absolute', 'cursor': 'pointer'},
/* 481 */ 			'class': prefix + 'currentColor'
/* 482 */ 		}).inject(box);
/* 483 */ 		
/* 484 */ 		var R = new Element('label').inject(box).setStyle('position', 'absolute');
/* 485 */ 		var G = R.clone().inject(box).addClass(prefix + 'gLabel').appendText('G: ');
/* 486 */ 		var B = R.clone().inject(box).addClass(prefix + 'bLabel').appendText('B: ');
/* 487 */ 		R.appendText('R: ').addClass(prefix + 'rLabel');
/* 488 */ 		
/* 489 */ 		var inputR = new Element('input');
/* 490 */ 		var inputG = inputR.clone().inject(G).addClass(prefix + 'gInput');
/* 491 */ 		var inputB = inputR.clone().inject(B).addClass(prefix + 'bInput');
/* 492 */ 		inputR.inject(R).addClass(prefix + 'rInput');
/* 493 */ 		
/* 494 */ 		var HU = new Element('label').inject(box).setStyle('position', 'absolute');
/* 495 */ 		var SA = HU.clone().inject(box).addClass(prefix + 'SatuLabel').appendText('S: ');
/* 496 */ 		var BR = HU.clone().inject(box).addClass(prefix + 'BrighLabel').appendText('B: ');
/* 497 */ 		HU.appendText('H: ').addClass(prefix + 'HueLabel');
/* 498 */ 
/* 499 */ 		var inputHU = new Element('input');
/* 500 */ 		var inputSA = inputHU.clone().inject(SA).addClass(prefix + 'SatuInput');

/* mooRainbow.js */

/* 501 */ 		var inputBR = inputHU.clone().inject(BR).addClass(prefix + 'BrighInput');
/* 502 */ 		inputHU.inject(HU).addClass(prefix + 'HueInput');
/* 503 */ 		SA.appendText(' %'); BR.appendText(' %');
/* 504 */ 		new Element('span', {'styles': {'position': 'absolute'}, 'class': prefix + 'ballino'}).set('html', " &deg;").injectAfter(HU);
/* 505 */ 
/* 506 */ 		var hex = new Element('label').inject(box).setStyle('position', 'absolute').addClass(prefix + 'hexLabel').appendText('#hex: ').adopt(new Element('input').addClass(prefix + 'hexInput'));
/* 507 */ 		
/* 508 */ 		// <input type="button" value="save" style="position: absolute;" class="'+prefix+'okButton"/>
/* 509 */ 		var ok = new Element('input', {
/* 510 */ 			'styles': {'position': 'absolute'},
/* 511 */ 			'type': 'button',
/* 512 */ 			'value': 'apply',
/* 513 */ 			'class': prefix + 'okButton'
/* 514 */ 		}).inject(box);
/* 515 */ 		
/* 516 */ 		this.rePosition();
/* 517 */ 
/* 518 */ 		var overlays = $$('#' + idPrefix + 'overlay');
/* 519 */ 		this.layout.overlay = overlays[0];
/* 520 */ 		this.layout.overlay2 = overlays[1];
/* 521 */ 		this.layout.cursor = document.getElement('#' + idPrefix + 'cursor');
/* 522 */ 		this.layout.arrows = document.getElement('#' + idPrefix + 'arrows');
/* 523 */ 		this.chooseColor = document.getElement('#' + idPrefix + 'chooseColor');
/* 524 */ 		this.layout.backup = document.getElement('#' + idPrefix + 'currentColor');
/* 525 */ 		this.RedInput = document.getElement('#' + idPrefix + 'rInput');
/* 526 */ 		this.GreenInput = document.getElement('#' + idPrefix + 'gInput');
/* 527 */ 		this.BlueInput = document.getElement('#' + idPrefix + 'bInput');
/* 528 */ 		this.HueInput = document.getElement('#' + idPrefix + 'HueInput');
/* 529 */ 		this.SatuInput = document.getElement('#' + idPrefix + 'SatuInput');
/* 530 */ 		this.BrighInput = document.getElement('#' + idPrefix + 'BrighInput');
/* 531 */ 		this.hexInput = document.getElement('#' + idPrefix + 'hexInput');
/* 532 */ 
/* 533 */ 		this.arrRGB = [this.RedInput, this.GreenInput, this.BlueInput];
/* 534 */ 		this.arrHSB = [this.HueInput, this.SatuInput, this.BrighInput];
/* 535 */ 		this.okButton = document.getElement('#' + idPrefix + 'okButton');
/* 536 */ 		
/* 537 */ 		if (!window.khtml) this.hide();
/* 538 */ 	},
/* 539 */ 	rePosition: function() {
/* 540 */ 		var coords = this.element.getCoordinates();
/* 541 */ 		this.layout.setStyles({
/* 542 */ 			'left': coords.left,
/* 543 */ 			'top': coords.top + coords.height + 1
/* 544 */ 		});
/* 545 */ 	},
/* 546 */ 	
/* 547 */ 	snippet: function(mode, type) {
/* 548 */ 		var size; type = (type) ? type : 'none';
/* 549 */ 
/* 550 */ 		switch(mode) {

/* mooRainbow.js */

/* 551 */ 			case 'arrPos':
/* 552 */ 				var t = this.layout.arrows.getStyle('top').toInt();
/* 553 */ 				size = t;
/* 554 */ 				break;
/* 555 */ 			case 'arrSize': 
/* 556 */ 				var h = this.layout.arrows.height;
/* 557 */ 				h = (type == 'int') ? (h/2).toInt() : h;
/* 558 */ 				size = h;
/* 559 */ 				break;		
/* 560 */ 			case 'curPos':
/* 561 */ 				var l = this.layout.cursor.getStyle('left').toInt();
/* 562 */ 				var t = this.layout.cursor.getStyle('top').toInt();
/* 563 */ 				size = {'l': l, 't': t};
/* 564 */ 				break;
/* 565 */ 			case 'slider':
/* 566 */ 				var t = this.layout.slider.getStyle('marginTop').toInt();
/* 567 */ 				size = t;
/* 568 */ 				break;
/* 569 */ 			default :
/* 570 */ 				var h = this.layout.cursor.height;
/* 571 */ 				var w = this.layout.cursor.width;
/* 572 */ 				h = (type == 'int') ? (h/2).toInt() : h;
/* 573 */ 				w = (type == 'int') ? (w/2).toInt() : w;
/* 574 */ 				size = {w: w, h: h};
/* 575 */ 		};
/* 576 */ 		return size;
/* 577 */ 	}
/* 578 */ });

;
/* tooltip.js */

/* 1   */ /* INFO TIPS */
/* 2   */ var infoTips = new Class({
/* 3   */ 	Extends: Tips2,
/* 4   */ 	Implements: [Options, Events],
/* 5   */ 	options: {
/* 6   */ 		showDelay: 0
/* 7   */ 	},
/* 8   */ 	initialize: function(elements, options){
/* 9   */ 		initializeNewTooltip(this, elements, options);
/* 10  */ 	},
/* 11  */ 	start: function(el){
/* 12  */ 		var el = ($type(el) == "string" ? document.id(el) : el);
/* 13  */ 		document.id(this.loader).setStyle('display', 'none');
/* 14  */ 		document.id(this.wrapper).setStyle('display', 'block');
/* 15  */ 		document.id(this.wrapper).empty();
/* 16  */ 		
/* 17  */ 		if (el.retrieve('myTitle')) this.title = new Element('span').inject(new Element('div').setStyle('font-weight', 'bold').inject(this.wrapper)).set('html', poptent_helpers.html_entity_decode(el.retrieve('myTitle')));
/* 18  */ 		this.text = new Element('span').inject(new Element('div').inject(this.wrapper)).set('html', poptent_helpers.html_entity_decode(((el.retrieve('myText'))?el.retrieve('myText'):'&nbsp;')));
/* 19  */ 		if (Browser.Engine.trident) { 
/* 20  */ 			var ttcont = document.id('ttcontainer');
/* 21  */ 			ttcont.setStyle('width', 'auto'); 
/* 22  */ 			ttcont.setStyle('width', (ttcont.getElement('.tooltip-content').getSize().x+10)+'px'); 
/* 23  */ 			ttcont = null;
/* 24  */ 		}
/* 25  */ 		$clear(this.timer);
/* 26  */ 		this.timer = this.show.delay(this.options.showDelay, this);
/* 27  */ 		el = null;
/* 28  */ 	}
/* 29  */ });
/* 30  */ 
/* 31  */ var tipBase = false;
/* 32  */ var tipBucket = false;
/* 33  */ 
/* 34  */ /* General functions */
/* 35  */ function initializeNewTooltip(e, elements, options) {
/* 36  */ 	e.setOptions(options);
/* 37  */ 	if(document.id('ttcontainer')){
/* 38  */ 		e.toolTip = document.id('ttcontainer');
/* 39  */ 	}else{
/* 40  */ 		var foundTips = document.id('ttcontainer');
/* 41  */ 		if (!foundTips) {
/* 42  */ 			e.toolTip = new Element('div', {
/* 43  */ 				'class': 'newToolTip',
/* 44  */ 				'id': 'ttcontainer',
/* 45  */ 				'styles': {
/* 46  */ 					'position': 'absolute',
/* 47  */ 					'top': '0',
/* 48  */ 					'left': '0',
/* 49  */ 					'visibility': 'hidden'
/* 50  */ 				},

/* tooltip.js */

/* 51  */ 				'html': '<div class="tt-tl"></div>'+
/* 52  */ 					'<div class="tt-tr"></div>'+
/* 53  */ 					'<div class="tt-tm"></div>'+
/* 54  */ 						'<div class="tooltip-content">'+
/* 55  */ 							'<div class="tooltip-loading"></div>'+
/* 56  */ 							'<div class="tc"></div>'+
/* 57  */ 							'<div class="clear"></div>'+
/* 58  */ 						'</div>'+
/* 59  */ 					'<div class="tt-bm"></div>'+
/* 60  */ 					'<div class="tt-bl"></div>'+
/* 61  */ 					'<div class="tt-br"></div>'
/* 62  */ 			}).inject(document.body);
/* 63  */ 			
/* 64  */ 			new Element('div', {
/* 65  */ 				'class': 'toolTipBucket',
/* 66  */ 				'styles': {
/* 67  */ 					'display': 'none'
/* 68  */ 				}
/* 69  */ 			}).inject(document.body);
/* 70  */ 		} else {
/* 71  */ 			e.toolTip = tipBase = foundTips[0];
/* 72  */ 		}
/* 73  */ 	}
/* 74  */ 	var tttwrap = e.toolTip.getElement('div.tc');
/* 75  */ 	var wrapperId = tttwrap.getProperty('id');
/* 76  */ 	if(!wrapperId){
/* 77  */ 		wrapperId = poptent_helpers.mock_id();
/* 78  */ 		tttwrap.setProperty('id',wrapperId);
/* 79  */ 	}
/* 80  */ 	e.wrapper = wrapperId;
/* 81  */ 	tttwrap = null;
/* 82  */ 	var tload = e.toolTip.getElement('div.tooltip-loading');
/* 83  */ 	var loaderId = tload.getProperty('id');
/* 84  */ 	if(!loaderId){
/* 85  */ 		loaderId = poptent_helpers.mock_id();
/* 86  */ 		tload.setProperty('id',loaderId);
/* 87  */ 	}
/* 88  */ 	e.loader = loaderId;
/* 89  */ 	e.requestTooltip = '';
/* 90  */ 	tload = null;
/* 91  */ 	
/* 92  */ 	//e.debugWrapper = new Element('div').addClass('toolDebug').inject(e.toolTip);
/* 93  */ 	var ctype = $type(elements);
/* 94  */ 	if(ctype == "string" || ctype=='element'){
/* 95  */ 		e.build(elements);
/* 96  */ 	}else if(ctype=='collection'){
/* 97  */ 		elements.each(e.build, e);
/* 98  */ 	}else if(ctype == 'array'){
/* 99  */ 		var l = elements.length;
/* 100 */ 		if(l>0) for (var i=0;i<l; i++) {

/* tooltip.js */

/* 101 */ 			var curr = elements[i];
/* 102 */ 			e.build(curr);
/* 103 */ 		}
/* 104 */ 	}else{
/* 105 */ 		$$(elements).each(e.build, e);
/* 106 */ 	}
/* 107 */ 	
/* 108 */ 	if (e.options.initialize) e.options.initialize.call(e);
/* 109 */ }

;
/* tbresizer.js */

/* 1  */ 
/* 2  */ var tbresizer = new Class({
/* 3  */ 	Implements: [Options, Events],
/* 4  */ 	options: {
/* 5  */ 		onComplete: $empty,
/* 6  */ 		onFailure: $empty,
/* 7  */ 		onInit: $empty,
/* 8  */ 		isIPE: false
/* 9  */ 	},
/* 10 */ 	textBox: null,
/* 11 */ 	tmpDiv: null,
/* 12 */ 	interval: null,
/* 13 */ 	counter: 1,
/* 14 */ 	resizefx: null,
/* 15 */ 	
/* 16 */ 	initialize: function(textBox, options) {
/* 17 */ 		this.textBox = ($type(textBox) == "string" ? document.id(textBox) : textBox);
/* 18 */ 		if(!this.textBox) return false;
/* 19 */ 		this.resizefx = new Fx.Morph(this.textBox, {duration:150, wait:false});
/* 20 */ 		this.textBox.setStyles({'overflow-x':'hidden', 'overflow-y':'hidden', 'overflow':'hidden'});
/* 21 */ 		this.line_height = this.textBox.getStyle('line-height').toInt();
/* 22 */ 		this.min_height = this.textBox.getSize().y.toInt();
/* 23 */ 		this.textBox.addEvents({
/* 24 */ 			'focus': function(){ 
/* 25 */ 				this.startExpand();
/* 26 */ 			}.bind(this),
/* 27 */ 			'blur': function(){
/* 28 */ 				this.stopExpand();
/* 29 */ 			}.bind(this),
/* 30 */ 			'keyup': function(){
/* 31 */ 				this.checkResize();
/* 32 */ 			}.bind(this)
/* 33 */ 		});
/* 34 */ 	},
/* 35 */ 	
/* 36 */ 	reset: function(){
/* 37 */ 		this.textBox.setStyle('height',this.min_height);
/* 38 */ 	},
/* 39 */ 	
/* 40 */ 	checkResize: function(){
/* 41 */ 		var html = this.textBox.value.replace(/[^0-9\s\n]/g, '#');
/* 42 */ 		var html = html.replace(/\n/g, '<br>new');
/* 43 */ 		if(this.tmpDiv.innerHTML != html){
/* 44 */ 			this.tmpDiv.set('html', html);
/* 45 */ 			if(this.textBox.getStyle('height').toInt()+this.line_height != this.tmpDiv.getStyle('height').toInt()){
/* 46 */ 				if ((this.tmpDiv.getStyle('height').toInt()+this.line_height) > this.min_height) {
/* 47 */ 					this.resizefx.start({ 'height': this.tmpDiv.getStyle('height').toInt()+this.line_height+'px' });
/* 48 */ 				}else{
/* 49 */ 					if (this.isIPE) this.tmpDiv.setStyle('height', this.min_height+'px');
/* 50 */ 				}

/* tbresizer.js */

/* 51 */ 			}
/* 52 */ 		}
/* 53 */ 	},
/* 54 */ 	
/* 55 */ 	createTmpDiv: function () {
/* 56 */ 		if(!this.tmpDiv){
/* 57 */ 			this.tmpDiv = new Element('div');
/* 58 */ 			this.tmpDiv.setStyles({
/* 59 */ 				'font-size': 	this.textBox.getStyle('font-size'),
/* 60 */ 				'font-family': 	this.textBox.getStyle('font-family'),
/* 61 */ 				'width': 		this.textBox.getSize().x+'px',
/* 62 */ 				'padding': 		this.textBox.getStyle('padding'),
/* 63 */ 				'line-height':  this.textBox.getStyle('line-height'),
/* 64 */ 				'overflow-x':   'hidden',
/* 65 */ 				'position':     'absolute',
/* 66 */ 				'top':			0,
/* 67 */ 				'left':			'-9999px'
/* 68 */ 			}).injectTop(document.body);
/* 69 */ 		}
/* 70 */ 	},
/* 71 */ 	
/* 72 */ 	startExpand: function(){
/* 73 */ 		this.createTmpDiv();
/* 74 */ 		this.checkResize();
/* 75 */ 		$clear(this.interval);
/* 76 */ 		this.interval = this.checkResize.periodical(100,this);
/* 77 */ 	},
/* 78 */ 	
/* 79 */ 	stopExpand: function(){
/* 80 */ 		if (this.isIPE && trim(this.textBox.value) == '' || trim(this.textBox.value) == this.textBox.getProperty('defaultMsg')) { this.textBox.setStyle('height', this.min_height); }
/* 81 */ 		if (this.tmpDiv) this.tmpDiv.dispose();
/* 82 */ 		this.tmpDiv = null;
/* 83 */ 		$clear(this.interval);
/* 84 */ 	},
/* 85 */ 	
/* 86 */ 	destroy: function() {
/* 87 */ 		this.textBox.removeEvents();
/* 88 */ 		if (this.tmpDiv) this.tmpDiv.dispose();
/* 89 */ 		if (this.interval) $clear(this.interval);
/* 90 */ 	}
/* 91 */ });
/* 92 */ 

;
/* HistoryManager.js */

/* 1   */ /**
/* 2   *|  * HistoryManager
/* 3   *|  * 
/* 4   *|  * Observes back/forward button usage and saves states
/* 5   *|  * for registered modules into the hash. This allows to
/* 6   *|  * bookmark specific states for an application.
/* 7   *|  * 
/* 8   *|  * @version		1.0rc2
/* 9   *|  * 
/* 10  *|  * @see			Events, Options
/* 11  *|  * 
/* 12  *|  * @license		MIT License
/* 13  *|  * @author		Harald Kirschner <mail [at] digitarald.de>
/* 14  *|  * @copyright	2007 Author
/* 15  *|  */
/* 16  */ var HistoryManagerX = new Class({
/* 17  */ 	Implements: [Options, Events],
/* 18  */ 	/**
/* 19  *| 	 * Default options - Can be overridden with setOptions
/* 20  *| 	 * 
/* 21  *| 	 * observeDelay: Duration for checking the state, default 100ms
/* 22  *| 	 * stateSeparator: Seperator for module-state join, default ';'
/* 23  *| 	 * iframeSrc: Scr for IE6/7 iframe, must exist on server!
/* 24  *| 	 * onStart: Fires on start
/* 25  *| 	 * onRegister: Fires on register
/* 26  *| 	 * onUnregister: Fires on unregister
/* 27  *| 	 * onUpdate: Fires when state changes from ...
/* 28  *| 	 * onStateChange: ... module changes
/* 29  *| 	 * onObserverChange: ... history change
/* 30  *| 	 */
/* 31  */ 	options: {
/* 32  */ 		observeDelay: 100,
/* 33  */ 		stateSeparator: ';',
/* 34  */ 		iframeSrc: 'blank.html',
/* 35  */ 		onStart: $empty,
/* 36  */ 		onRegister: $empty,
/* 37  */ 		onUnregister: $empty,
/* 38  */ 		onStart: $empty,
/* 39  */ 		onUpdate: $empty,
/* 40  */ 		onStateChange: $empty,
/* 41  */ 		onObserverChange: $empty
/* 42  */ 	},
/* 43  */ 
/* 44  */ 	/**
/* 45  *| 	 * Default options for register
/* 46  *| 	 * 
/* 47  *| 	 * defaults: Default values array, initially empty.
/* 48  *| 	 * regexpParams: When regexp is a String, this is the second argument for new RegExp.
/* 49  *| 	 * skipDefaultMatch: default true; When true onGenerate is not called when current values are similar to the default values.
/* 50  *| 	 */

/* HistoryManager.js */

/* 51  */ 	dataOptions: {
/* 52  */ 		skipDefaultMatch: true,
/* 53  */ 		defaults: [],
/* 54  */ 		regexpParams: ''
/* 55  */ 	},
/* 56  */ 
/* 57  */ 	/**
/* 58  *| 	 * Constructur - Class.initialize
/* 59  *| 	 * 
/* 60  *| 	 * Options:
/* 61  *| 	 *  - observeDelay: duration in ms, default 100 - BackBuddy observe the hash for changes periodical
/* 62  *| 	 *  - stateSeparator: char, default ';' - Separator for multiple module-states in the hash
/* 63  *| 	 *  - iframeSrc: string, default 'blank.html' - File for the iframe (IE6/7), must exist on the server!
/* 64  *| 	 *  - Events: onStart, onRegister, onStart, onUpdate, onStateChange, onObserverChange
/* 65  *| 	 * 
/* 66  *| 	 * @return	this
/* 67  *| 	 * 
/* 68  *| 	 * @param	{Object} options
/* 69  *| 	 */
/* 70  */ 	initialize: function(options) {
/* 71  */ 		if (this.modules) return this;
/* 72  */ 		this.setOptions(options);
/* 73  */ 		this.modules = $H({});
/* 74  */ 		this.count = history.length;
/* 75  */ 		this.states = [];
/* 76  */ 		this.states[this.count] = this.getHash();
/* 77  */ 		this.state = null;
/* 78  */ 		return this;
/* 79  */ 	},
/* 80  */ 
/* 81  */ 	/**
/* 82  *| 	 * Start - Check hash and start observer
/* 83  *| 	 * 
/* 84  *| 	 * Call start after registering ALL modules. This start the observer,
/* 85  *| 	 * reads the state from the hash and calls onMatch for effected modules.
/* 86  *| 	 * 
/* 87  *| 	 * @return	this
/* 88  *| 	 * 
/* 89  *| 	 */
/* 90  */ 	start: function() {
/* 91  */ 		if(this.started) return this;
/* 92  */ 		this.observe.periodical(this.options.observeDelay, this);
/* 93  */ 		this.started = true;
/* 94  */ 		this.observe();
/* 95  */ 		this.update();
/* 96  */ 		this.fireEvent('onStart', [this.state]);
/* 97  */ 		return this;
/* 98  */ 	},
/* 99  */ 
/* 100 */ 	/**

/* HistoryManager.js */

/* 101 *| 	 * Registers a module
/* 102 *| 	 * 
/* 103 *| 	 * @return	{Object} Object with shortcuts for setValues, setValue, generate and unregister
/* 104 *| 	 * 
/* 105 *| 	 * @param	{String} Module key
/* 106 *| 	 * @param	{RegExp}/{String} Regular expression that matches the string updated from onGenerate
/* 107 *| 	 * @param	{Function} Will be called when the regexp matches, with the new values as argument.
/* 108 *| 	 * @param	{Function} Should return the string for the state string, values are first argument
/* 109 *| 	 * @param	{Array} default values, the input values given to onMatch and onGenerate will be complemented with these
/* 110 *| 	 * @param	{Object} (optional) options
/* 111 *| 	 */
/* 112 */ 	register: function(key, defaults, onMatch, onGenerate, regexp, options) {
/* 113 */ 		if (!this.modules) this.initialize();
/* 114 */ 		var data = $merge(this.dataOptions, options || {}, {
/* 115 */ 			defaults: defaults,
/* 116 */ 			onMatch: onMatch,
/* 117 */ 			onGenerate: onGenerate,
/* 118 */ 			regexp: regexp
/* 119 */ 		});
/* 120 */ 		data.regexp = data.regexp || key + '-([\\w_-]*)';
/* 121 */ 		if (typeof data.regexp == 'string') data.regexp = new RegExp(data.regexp, data.regexpParams);
/* 122 */ 		data.onGenerate = data.onGenerate || function(values) { return key + '-' + values[0]; };
/* 123 */ 
/* 124 */ 		data.values = $A(data.defaults);
/* 125 */ 		this.modules.set(key, data);
/* 126 */ 		this.fireEvent('onUnregister', [key, data]);
/* 127 */ 		return {
/* 128 */ 			setValues: function(values) {
/* 129 */ 				return this.setValues(key, values);
/* 130 */ 			}.bind(this),
/* 131 */ 			setValue: function(index, value) {
/* 132 */ 				return this.setValue(key, index, value);
/* 133 */ 			}.bind(this),
/* 134 */ 			generate: function(values) {
/* 135 */ 				return this.generate(key, values);
/* 136 */ 			}.bind(this),
/* 137 */ 			unregister: function() {
/* 138 */ 				return this.unregister(key);
/* 139 */ 			}.bind(this)
/* 140 */ 		};
/* 141 */ 	},
/* 142 */ 
/* 143 */ 	/**
/* 144 *| 	 * unregister - Removes an module from the
/* 145 *| 	 * 
/* 146 *| 	 * @param	{String} Module key
/* 147 *| 	 */
/* 148 */ 	unregister: function(key) {
/* 149 */ 		this.fireEvent('onRegister', [key]);
/* 150 */ 		this.modules.erase(key);

/* HistoryManager.js */

/* 151 */ 	},
/* 152 */ 
/* 153 */ 	/**
/* 154 *| 	 * setValues - Set all values new, updates new state
/* 155 *| 	 * 
/* 156 *| 	 * @param	{String} Module key
/* 157 *| 	 * @param	{Object} Complete values
/* 158 *| 	 */
/* 159 */ 	setValues: function(key, values) {
/* 160 */ 		var data = this.modules.get(key);
/* 161 */ 		
/* 162 */ 		if (!data || (data.values.toString() == values.toString())){
/* 163 */ 			return this;
/* 164 */ 		}
/* 165 */ 		data.values = values;
/* 166 */ 		this.update();
/* 167 */ 		return this;
/* 168 */ 	},
/* 169 */ 
/* 170 */ 	/**
/* 171 *| 	 * setValue - Set one value, updates new state
/* 172 *| 	 * 
/* 173 *| 	 * @param	{String} Module key
/* 174 *| 	 * @param	{Number} Value index
/* 175 *| 	 * @param	{Object} Value
/* 176 *| 	 */
/* 177 */ 	setValue: function(key, index, value) {
/* 178 */ 		var data = this.modules.get(key);
/* 179 */ 		if (!data || data.values[index] == value) return this;
/* 180 */ 		data.values[index] = value;
/* 181 */ 		this.update();
/* 182 */ 		return this;
/* 183 */ 	},
/* 184 */ 
/* 185 */ 	/**
/* 186 *| 	 * generate - Generates a hash from the given
/* 187 *| 	 * 
/* 188 *| 	 * @param	{String} Module key
/* 189 *| 	 * @param	{Number} Value index
/* 190 *| 	 * @param	{Object} Value
/* 191 *| 	 */
/* 192 */ 	generate: function(key, values) {
/* 193 */ 		var data = this.modules.get(key);
/* 194 */ 		var current = $A(data.values);
/* 195 */ 		data.values = values;
/* 196 */ 		var state = this.generateState();
/* 197 */ 		data.values = current;
/* 198 */ 		return '#' + state;
/* 199 */ 	},
/* 200 */ 

/* HistoryManager.js */

/* 201 */ 	observe: function() {
/* 202 */ 		if (this.timeout) return;
/* 203 */ 		var state = this.getState();
/* 204 */ 		if(typeof state === 'undefined') return;
/* 205 */ 		if (this.state == state) return;
/* 206 */ 		if ((Browser.Engine.trident || Browser.Engine.webkit419) && (this.state !== null)) this.setState(state, true);
/* 207 */ 		else this.state = state;
/* 208 */ 		if (!this.modules) return;
/* 209 */ 		this.modules.each(function(data, key) {
/* 210 */ 			var bits = state.match(data.regexp);
/* 211 */ 			if (bits) {
/* 212 */ 				bits.splice(0, 1);
/* 213 */ 				bits.complement(data.defaults);
/* 214 */ 				//if (!(bits.toString() == data.defaults.toString()) || !data.skipDefaultMatch) 
/* 215 */ 				data.values = bits;
/* 216 */ 			} else data.values = $A(data.defaults);
/* 217 */ 			data.onMatch(data.values, data.defaults);
/* 218 */ 		});
/* 219 */ 		this.fireEvent('onStateChange', [state]).fireEvent('onObserverChange', [state]);
/* 220 */ 	},
/* 221 */ 
/* 222 */ 	generateState: function() {
/* 223 */ 		var state = [];
/* 224 */ 		if (!this.modules) return;
/* 225 */ 		this.modules.each(function(data, key) {
/* 226 */ 			if (data.skipDefaultMatch && (data.values.toString() == data.defaults.toString())) return;
/* 227 */ 			state.push(data.onGenerate(data.values));
/* 228 */ 		});
/* 229 */ 		return state.join(this.options.stateSeparator);
/* 230 */ 	},
/* 231 */ 
/* 232 */ 	update: function() {
/* 233 */ 		if (!this.started) return this;
/* 234 */ 		var state = this.generateState();
/* 235 */ 		if ((!this.state && !state) || (this.state == state)) return this;
/* 236 */ 		this.setState(state);
/* 237 */ 		this.fireEvent('onStateChange', [state]).fireEvent('onUpdate', [state]);
/* 238 */ 		return this;
/* 239 */ 	},
/* 240 */ 
/* 241 */ 	observeTimeout: function() {
/* 242 */ 		if (this.timeout) this.timeout = $clear(this.timeout);
/* 243 */ 		else this.timeout = this.observeTimeout.delay(200, this);
/* 244 */ 	},
/* 245 */ 
/* 246 */ 	getHash: function() {
/* 247 */ 		var href = top.location.href;
/* 248 */ 		var pos = href.indexOf('#') + 1;
/* 249 */ 		
/* 250 */ 		var substr = (pos) ? href.substr(pos) : '';

/* HistoryManager.js */

/* 251 */ 		//alert('getHash:'+substr);
/* 252 */ 		return substr;
/* 253 */ 	},
/* 254 */ 
/* 255 */ 	getState: function() {
/* 256 */ 		var state = this.getHash();
/* 257 */ 		if (this.iframe) {
/* 258 */ 			var doc = this.iframe.contentWindow.document;
/* 259 */ 			if (doc && doc.body.id == 'state') {
/* 260 */ 				var istate = doc.body.innerText;
/* 261 */ 				if (this.state == state) return istate;
/* 262 */ 				this.istateOld = true;
/* 263 */ 			} else return this.istate;
/* 264 */ 		}
/* 265 */ 		if (Browser.Engine.webkit419 && history.length != this.count) {
/* 266 */ 			this.count = history.length;
/* 267 */ 			return $pick(this.states[this.count - 1], state);
/* 268 */ 		}
/* 269 */ 		return state;
/* 270 */ 	},
/* 271 */ 
/* 272 */ 	setState: function(state, fix) {
/* 273 */ 		state = (state !== 'undefined')?$pick(state, ''):'';
/* 274 */ 		if (Browser.Engine.webkit419) {
/* 275 */ 			if (!this.form) this.form = new Element('form', {method: 'get'}).injectInside(document.body);
/* 276 */ 			this.count = history.length;
/* 277 */ 			this.states[this.count] = state;
/* 278 */ 			this.observeTimeout();
/* 279 */ 			this.form.setProperty('action', '#' + state).submit();
/* 280 */ 		} else {
/* 281 */ 			// MAJOR performance drag ie7 (2 sec / click)
/* 282 */ 			top.location.hash = state || '#';
/* 283 */ 		}
/* 284 */ 		if (Browser.Engine.trident && (!fix || this.istateOld)) {
/* 285 */ 			if (!this.iframe) {
/* 286 */ 				this.iframe = new IFrame({
/* 287 */ 				    src: this.options.iframeSrc,
/* 288 */ 				    styles: {
/* 289 */ 				        visibility: 'hidden',
/* 290 */ 				        display: 'none'
/* 291 */ 				    }
/* 292 */ 				}).injectInside(document.body);
/* 293 */ 				this.istate = this.state;
/* 294 */ 			}
/* 295 */ 			try {
/* 296 */ 				var doc = this.iframe.contentWindow.document;
/* 297 */ 				doc.open();
/* 298 */ 				doc.write('<html><body id="state">' + state + '</body></html>');
/* 299 */ 				doc.close();
/* 300 */ 				this.istateOld = false;

/* HistoryManager.js */

/* 301 */ 			} catch(er) {};
/* 302 */ 		}
/* 303 */ 		this.state = state;
/* 304 */ 	},
/* 305 */ 
/* 306 */ 	extend: $extend
/* 307 */ });
/* 308 */ 
/* 309 */ 
/* 310 */ 
/* 311 */ /**
/* 312 *|  * Extends Array with 2 helpers: isSimilar(array) and complement(array)
/* 313 *|  * 
/* 314 *|  */
/* 315 */ Array.implement({
/* 316 */ 
/* 317 */ 	/**
/* 318 *| 	 * isSimilar - Returns true for similar arrays, type-insensitive
/* 319 *| 	 * 
/* 320 *| 	 * @example
/* 321 *| 	 *  [1].isSimilar(['1']) == true
/* 322 *| 	 *  [1, 2].isSimilar([1, false]) == false
/* 323 *| 	 *  
/* 324 *| 	 * @return	{Boolean}
/* 325 *| 	 * @param	{Object} Array
/* 326 *| 	 */
/* 327 */ 	isSimilar: function(array) {
/* 328 */ 		//alert(this.toString()+' == '+array.toString());
/* 329 */ 		return (this.toString() == array.toString());
/* 330 */ 	},
/* 331 */ 
/* 332 */ 	/**
/* 333 *| 	 * complement - Fills up empty array values from another array, length is the same
/* 334 *| 	 * 
/* 335 *| 	 * @example
/* 336 *| 	 *  [1, null].complement([3, 4]) == [1, 4]
/* 337 *| 	 *	[undefined, '1'].complement([2, 3, 4]) == [2, '1']
/* 338 *| 
/* 339 *| 	 * @return	{Array} this
/* 340 *| 	 * @param	{Object} Array
/* 341 *| 	 */
/* 342 */ 	complement: function(array) {
/* 343 */ 		for (var i = 0, j = this.length; i < j; i++) this[i] = $pick(this[i], array[i] || null);
/* 344 */ 		return this;
/* 345 */ 	}
/* 346 */ });
/* 347 */ 
/* 348 */ var HistoryManager = new HistoryManagerX();

;
/* roar.js */

/* 1   */ /**
/* 2   *|  * Roar - Notifications
/* 3   *|  *
/* 4   *|  * Inspired by Growl
/* 5   *|  *
/* 6   *|  * @version		1.0.1
/* 7   *|  *
/* 8   *|  * @license		MIT-style license
/* 9   *|  * @author		Harald Kirschner <mail [at] digitarald.de>
/* 10  *|  * @copyright	Author
/* 11  *|  * 
/* 12  *|  * >>ported to mootools 1.11
/* 13  *|  * >>extended
/* 14  *|  */
/* 15  */ 
/* 16  */ var Roar = new Class({
/* 17  */ 	Implements: [Options, Events, Chain],
/* 18  */ 	options: {
/* 19  */ 		duration: false,
/* 20  */ 		position: 'lowerRight',
/* 21  */ 		fixedRight: true,
/* 22  */ 		container: null,
/* 23  */ 		type: 'error',
/* 24  */ 		bodyFx: null,
/* 25  */ 		itemFx: null,
/* 26  */ 		margin: {x: 10, y: 10},
/* 27  */ 		offset: 10,
/* 28  */ 		className: 'roar',
/* 29  */ 		classWidth: 500, //temp fix
/* 30  */ 		messageWidth: 350,
/* 31  */ 		onShow: $empty,
/* 32  */ 		onHide: $empty,
/* 33  */ 		onRender: $empty,
/* 34  */ 		preloadImages: true,
/* 35  */ 		timer: 300,
/* 36  */ 		notify_url: null
/* 37  */ 	},
/* 38  */ 
/* 39  */ 	initialize: function(options) {
/* 40  */ 		this.setOptions(options);
/* 41  */ 		this.items = [];
/* 42  */ 		this.storeOffset = [];
/* 43  */ 		this.container = document.id(this.options.container) || document;
/* 44  */ 		this.timers = [];
/* 45  */ 		this.timerId = 0;
/* 46  */ 		
/* 47  */ 		//start poll if logged in
/* 48  */ 		if((
/* 49  */ 			(typeof poptent_vars.current_page.user.id != 'undefined' && poptent_vars.current_page.user.id) || 
/* 50  */ 			(typeof poptent_vars.current_user.id != 'undefined' && poptent_vars.current_user.id)

/* roar.js */

/* 51  */ 		) && poptent_vars.current_user.is_signed_in==1){
/* 52  */ 			window.addEvent((Browser.Engine.trident?'load':'domready'), this.poll.bind(this));
/* 53  */ 		}
/* 54  */ 		if(this.options.preloadImages) this.preloadImages();
/* 55  */ 	},
/* 56  */ 	
/* 57  */ 	preloadImages: function() {
/* 58  */ 		/** preload images **/
/* 59  */ 		var imgs = [
/* 60  */ 		 	[poptent_helpers.add_image_base('base/notifications/success/face.gif')],
/* 61  */ 		 	[poptent_helpers.add_image_base('base/notifications/error/face.gif')],
/* 62  */ 		 	[poptent_helpers.add_image_base('base/notifications/close.png')],
/* 63  */ 		 	[poptent_helpers.add_image_base('base/notifications/activity/background.png')],
/* 64  */ 		 	[poptent_helpers.add_image_base('base/notifications/activity/sprite2.png')],
/* 65  */ 		 	[poptent_helpers.add_image_base('base/notifications/activity/corners.png')],
/* 66  */ 		 	[poptent_helpers.add_image_base('base/notifications/bulletin/close2.png')],
/* 67  */ 		 	[poptent_helpers.add_image_base('base/notifications/bulletin/paperclip4.png')],
/* 68  */ 		 	[poptent_helpers.add_image_base('base/notifications/stopwatch.png')]
/* 69  */ 		];
/* 70  */ 		if(Browser.Engine.trident) imgs = imgs.combine([
/* 71  */ 			[poptent_helpers.add_image_base('base/notifications/success/corners.png')],
/* 72  */ 			[poptent_helpers.add_image_base('base/notifications/error/corners.png')]
/* 73  */ 		]);
/* 74  */ 		setTimeout(function(){
/* 75  */ 			new Asset.images(imgs);
/* 76  */ 		},100);
/* 77  */ 	},
/* 78  */ 
/* 79  */ 	alert: function(title, message, options, meta) {
/* 80  */ 		options = options || {};
/* 81  */ 		meta = meta || {};
/* 82  */ 		if(title=='' || message=='') return;
/* 83  */ 		this.options = $merge(this.options, options);
/* 84  */ 		this.options.type = $pick(options.type, 'error');  //reset default type if none is set
/* 85  */ 		return this.insert(title, message, meta);
/* 86  */ 	},
/* 87  */ 	
/* 88  */ 	insert: function(title, message, meta) {
/* 89  */ 		/**
/* 90  *| 		 * meta
/* 91  *| 		 * + date (bulletin)
/* 92  *| 		 * + notifyId (bulletin)
/* 93  *| 		 * + type (activity)
/* 94  *| 		 * + thumb_url (activity)
/* 95  *| 		 * + thumb_path activity)
/* 96  *| 		 * + persistent
/* 97  *| 		 */
/* 98  */ 		if(this.options.type.test(/success|error/)){
/* 99  */ 			/** Error / Success */
/* 100 */ 			//main content area

/* roar.js */

/* 101 */ 			var messageBox = new Element('div', {
/* 102 */ 				'class': 'message'
/* 103 */ 			}).set('html', message);
/* 104 */ 			if(title.trim() != '') 
/* 105 */ 				new Element('h3')
/* 106 */ 					.set('html', title)
/* 107 */ 					.injectTop(messageBox);
/* 108 */ 			
/* 109 */ 			//controls
/* 110 */ 			var controls = new Element('div', {
/* 111 */ 				'class': 'controls'
/* 112 */ 			}).set('html', 
/* 113 */ 				'<span class="stopwatch' + ((meta.persistent)?' hidden':'') + '"><img src="'+poptent_helpers.add_image_base('base/notifications/stopwatch.png')+'" width="100px" height="9px" /></span>' +
/* 114 */ 				'<a href="#" class="close-button"><span></span></a>'
/* 115 */ 			);
/* 116 */ 			
/* 117 */ 			var roarbg = new Element('div', {
/* 118 */ 				'class': 'roar-bg',
/* 119 */ 				'opacity': 1
/* 120 */ 			});
/* 121 */ 			
/* 122 */ 			if(Browser.Engine.trident){
/* 123 */ 				roarbg.set('html', 
/* 124 */ 					'<div class="corner" style="top: 1px;"><div class="ct"><div> </div></div></div>' + 
/* 125 */ 					'<div class="middle"></div>' + 
/* 126 */ 					'<div class="corner"><div class="cb"><div> </div></div></div>' 
/* 127 */ 				).addClass('ie');
/* 128 */ 			}
/* 129 */ 			
/* 130 */ 			var roarBox = new Element('div', {
/* 131 */ 				'class': this.options.className + ' ' + this.options.type + ((meta.persistent)?' persistent':''),
/* 132 */ 				'id': 'timer-' + (this.timerId++),
/* 133 */ 				'opacity': 0
/* 134 */ 			}).adopt(
/* 135 */ 				[
/* 136 */ 		           roarbg,
/* 137 */ 					new Element('div', {
/* 138 */ 						'class': 'content-box'
/* 139 */ 					}).adopt(
/* 140 */ 						controls,
/* 141 */ 						messageBox
/* 142 */ 					)
/* 143 */ 				]
/* 144 */ 			);
/* 145 */ 			
/* 146 */ 		}else if(this.options.type=='bulletin'){
/* 147 */ 			/**Bulletins */
/* 148 */ 			//main content area
/* 149 */ 			var messageBox = new Element('div', {
/* 150 */ 				'class': 'message'

/* roar.js */

/* 151 */ 			}).set('html', poptent_helpers.html_entity_decode(message));
/* 152 */ 			if(title.trim() != '') {
/* 153 */ 				var titleBox = new Element('div')
/* 154 */ 					.set('html', '<div class="heading">'+poptent_helpers.html_entity_decode(title)+'</div>')
/* 155 */ 					.injectTop( messageBox );
/* 156 */ 				if(Browser.Engine.trident) titleBox.setStyle('margin-bottom', '2px');
/* 157 */ 				titleBox.adopt(new Element('div', {'class': 'clear'}));
/* 158 */ 			}
/* 159 */ 			
/* 160 */ 			/** controls */
/* 161 */ 			//close
/* 162 */ 			var controls = new Element('div', {
/* 163 */ 				'class': 'controls'
/* 164 */ 			}).set('html', '<a href="#" rel="'+meta.notifyId+'" class="close-button"><span></span></a>');
/* 165 */ 			
/* 166 */ 			var contentBox = new Element('div', {
/* 167 */ 				'class': 'content-box'
/* 168 */ 			}).adopt(controls, messageBox);
/* 169 */ 			if(Browser.Engine.trident){
/* 170 */ 				var content = [
/* 171 */ 		           	new Element('div', {
/* 172 */ 						'class': 'corner',
/* 173 */ 						'styles': 'top: 1px;'
/* 174 */ 					}).set('html', '<div class="ct"><div> </div></div>'),
/* 175 */ 					contentBox.addClass('middle').addClass('ie'),
/* 176 */ 					new Element('div', {
/* 177 */ 						'class': 'corner'
/* 178 */ 					}).set('html', '<div class="cb"><div> </div></div>'),
/* 179 */ 					new Element('div', {
/* 180 */ 						'class': 'paperclip'
/* 181 */ 					})
/* 182 */ 				];
/* 183 */ 			}else{
/* 184 */ 				var content = [
/* 185 */ 		           	new Element('div', {
/* 186 */ 						'class': 'roar-bg',
/* 187 */ 						'opacity': 1
/* 188 */ 					}),
/* 189 */ 					contentBox,
/* 190 */ 					new Element('div', {
/* 191 */ 						'class': 'paperclip'
/* 192 */ 					})
/* 193 */ 				];
/* 194 */ 			}
/* 195 */ 				
/* 196 */ 			var roarBox = new Element('div', {
/* 197 */ 				'class': this.options.className + ' ' + this.options.type + ' persistent',
/* 198 */ 				'opacity': 0
/* 199 */ 			}).adopt(content);
/* 200 */ 			

/* roar.js */

/* 201 */ 		}else if(this.options.type=='activity'){
/* 202 */ 			//main content area
/* 203 */ 			var messageBox = new Element('div', {
/* 204 */ 				'class': 'message'
/* 205 */ 			}).set('html', '<span class="view-link">' + message + '</span>');
/* 206 */ 			if(title.trim() != '') 
/* 207 */ 				new Element('h3')
/* 208 */ 					.set('html', title)
/* 209 */ 					.injectTop( messageBox);
/* 210 */ 			
/* 211 */ 			//controls
/* 212 */ 			var controls = new Element('div', {
/* 213 */ 				'class': 'controls'
/* 214 */ 			}).set('html', 
/* 215 */ 				'<span class="stopwatch"><img src="'+poptent_helpers.add_image_base('base/notifications/stopwatch.png')+'" width="100px" height="9px" /></span>' +
/* 216 */ 				'<a href="#" class="close-button"><span></span></a>'
/* 217 */ 			);
/* 218 */ 			
/* 219 */ 			var roarBox = new Element('div', {
/* 220 */ 				'class': this.options.className + ' ' + this.options.type + ((meta.persistent)?' persistent':''),
/* 221 */ 				'id': 'timer-' + (this.timerId++),
/* 222 */ 				'opacity': 0
/* 223 */ 			}).adopt(
/* 224 */ 				[
/* 225 */ 		           new Element('div', {
/* 226 */ 						'class': 'roar-bg',
/* 227 */ 						'opacity': 1
/* 228 */ 					}).set('html', 
/* 229 */ 						'<div class="corner" style="top: 1px;"><div class="ct"><div> </div></div></div>' + 
/* 230 */ 						'<div class="middle"></div>' + 
/* 231 */ 						'<div class="corner"><div class="cb"><div> </div></div></div>' 
/* 232 */ 					),
/* 233 */ 					new Element('div', {
/* 234 */ 						'class': 'content-box'
/* 235 */ 					}).adopt(
/* 236 */ 						controls,
/* 237 */ 						messageBox
/* 238 */ 					)
/* 239 */ 				]
/* 240 */ 			);
/* 241 */ 			
/* 242 */ 			//meta
/* 243 */ 			if(meta) {
/* 244 */ 				//activity types
/* 245 */ 				var types = {};
/* 246 */ 				types[8] = types[11] = types[12] = types[20] = 'group';
/* 247 */ 				types[1] = 'follow'; types[5] = types[52] = 'comment'; 
/* 248 */ 				types[7] = 'download'; types[2] = 'like'; types[22] = 'tag'; 
/* 249 */ 				types[75] = 'credit'; types[89] = 'share'; 
/* 250 */ 				

/* roar.js */

/* 251 */ 				roarBox.adopt(
/* 252 */ 					new Element('div', {
/* 253 */ 						'class': 'meta'
/* 254 */ 					}).set('html', 
/* 255 */ 						'<a href="'+meta.thumb_url+'"><img src="'+meta.thumb_path+'" /><div class="activity"></div><div class="clear"></div>'
/* 256 */ 					)
/* 257 */ 				).addClass(types[meta.type]);
/* 258 */ 			}
/* 259 */ 		}
/* 260 */ 		
/* 261 */ 		//add offsets to autoexpand box, if necessary
/* 262 */ 		if(!this.options.type.test(/activity|bulletin/) && !this.options.fixedRight) this.setBoxOffsets(roarBox, message);
/* 263 */ 			
/* 264 */ 		if(Browser.Engine.trident) roarBox.setStyle('z-index', 9999);
/* 265 */ 		return this.inject(roarBox);
/* 266 */ 	},
/* 267 */ 	
/* 268 */ 	getBoxWidth: function(message) {
/* 269 */ 		//off screen div calculate left offset
/* 270 */ 		if(!document.id('roarTestDiv')){
/* 271 */ 			var testDiv = new Element('p', {
/* 272 */ 				'styles': {
/* 273 */ 					'display': 'block',
/* 274 */ 					'line-height': '1.3em',
/* 275 */ 					'font-size': '14px'
/* 276 */ 				}
/* 277 */ 			}).injectInside(
/* 278 */ 				new Element('div', {
/* 279 */ 					'id': 'roarTestDiv',
/* 280 */ 					'styles': {
/* 281 */ 						'position': 'absolute',
/* 282 */ 						'left': '-2000px',
/* 283 */ 						'top': '0',
/* 284 */ 						'display': 'block'
/* 285 */ 					}
/* 286 */ 				}).injectInside(document.body)
/* 287 */ 			);
/* 288 */ 		}else{
/* 289 */ 			var testDiv = document.id('roarTestDiv').getElement('p');
/* 290 */ 		}
/* 291 */ 		return testDiv.set('html', message).getSize().x + 15; //add 10px for cushion
/* 292 */ 	},
/* 293 */ 	
/* 294 */ 	setBoxOffsets: function(item, message){
/* 295 */ 		//adjust left position
/* 296 */ 		item.setStyle('left', (this.options.messageWidth-this.getBoxWidth(message))+'px');
/* 297 */ 	},
/* 298 */ 	
/* 299 */ 	inject: function(item) {
/* 300 */ 		if (!document.id(this.body)) this.render();

/* roar.js */

/* 301 */ 		//options = options || {};
/* 302 */ 		
/* 303 */ 		this.options.fixedRight ? document.id(this.body).addClass('fixed-right') : document.id(this.body).removeClass('fixed-right');
/* 304 */ 
/* 305 */ 		var offset = [-this.options.offset, 0];
/* 306 */ 		var last = this.items.getLast();
/* 307 */ 		if (last) {
/* 308 */ 			offset[0] = this.storeOffset.getLast() || 0;
/* 309 */ 			offset[1] = offset[0] + last.offsetHeight + this.options.offset;
/* 310 */ 		}
/* 311 */ 		var to = {'opacity': 1};
/* 312 */ 		to[this.align.y] = offset;
/* 313 */ 		
/* 314 */ 		var remove = this.remove.create({
/* 315 */ 			bind: this,
/* 316 */ 			arguments: [item],
/* 317 */ 			delay: 10
/* 318 */ 		});
/* 319 */ 		
/* 320 */ 		item.getElement('.close-button')
/* 321 */ 			.addEvent('click', remove)
/* 322 */ 			.addEvent('click', function(e){try{ new Event(e).stop(); }catch(er){};});
/* 323 */ 		
/* 324 */ 		this.items.push(item);
/* 325 */ 		this.storeOffset.push(offset[1]);
/* 326 */ 
/* 327 */ 		if (this.options.duration) {
/* 328 */ 			var over = false;
/* 329 */ 			var trigger = (function() {
/* 330 */ 				trigger = null;
/* 331 */ 				if (!over) remove();
/* 332 */ 			}).delay(this.options.duration);
/* 333 */ 			item.addEvents({
/* 334 */ 				mouseover: function() {
/* 335 */ 					over = true;
/* 336 */ 				},
/* 337 */ 				mouseout: function() {
/* 338 */ 					over = false;
/* 339 */ 					if (!trigger) remove();
/* 340 */ 				}
/* 341 */ 			});
/* 342 */ 		}
/* 343 */ 		item.injectInside(document.id(this.body));
/* 344 */ 		new Fx.Morph(item,{duration: 150, transition: Fx.Transitions.Back.easeOut}).start(to);
/* 345 */ 		if(!item.hasClass('persistent')) this.setTimer(item);
/* 346 */ 		return this.fireEvent('onShow', [item, this.items.length]);
/* 347 */ 	},
/* 348 */ 	
/* 349 */ 	adjust: function() {
/* 350 */ 		if(this.items.length>0){

/* roar.js */

/* 351 */ 			var last, offset, items = [], tos = {};
/* 352 */ 			this.items.each(function(item, i){
/* 353 */ 				//just move the persistent types
/* 354 */ 				if(item.hasClass('persistent')){
/* 355 */ 					if(this.storeOffset[i]>0){
/* 356 */ 						items.push(item);
/* 357 */ 						offset = 0;
/* 358 */ 						if(last) offset = this.storeOffset[i-1] + last.offsetHeight + this.options.offset;
/* 359 */ 						var to = {};
/* 360 */ 						to[this.align.y] = offset;
/* 361 */ 						tos[items.length-1] = to;
/* 362 */ 						
/* 363 */ 						//update offset
/* 364 */ 						roar.storeOffset[i] = offset;
/* 365 */ 					}
/* 366 */ 				}
/* 367 */ 				last = item;
/* 368 */ 			}, this);
/* 369 */ 			
/* 370 */ 			if(items.length>0){ //apply effects
/* 371 */ 			    items = new Fx.Elements(items, {
/* 372 */ 			    	duration: 150, 
/* 373 */ 			    	transition: Fx.Transitions.Back.easeOut
/* 374 */ 			    }).start(tos);
/* 375 */ 			}
/* 376 */ 		}
/* 377 */ 	},
/* 378 */ 	
/* 379 */ 	setTimer: function(item) {
/* 380 */ 		var index = item.id.split('-')[1];
/* 381 */ 		var timer = this.hideStopWatch.periodical(this.options.timer, this, [item, index]);
/* 382 */ 		this.timers[index] = {counter: 0, timer: timer};
/* 383 */ 	},
/* 384 */ 	
/* 385 */ 	clearTimer: function(index) {
/* 386 */ 		try{
/* 387 */ 			$clear(this.timers[index].timer);
/* 388 */ 			delete(this.timers[index]);
/* 389 */ 		}catch(er){}
/* 390 */ 	},
/* 391 */ 	
/* 392 */ 	hideStopWatch: function(item, index) {
/* 393 */ 		var stopwatch = item.getElement('img');
/* 394 */ 		try{
/* 395 */ 			if (this.timers[index].counter<9) {
/* 396 */ 				stopwatch.setStyle('margin-left', stopwatch.getStyle('margin-left').toInt()+13);
/* 397 */ 				this.timers[index].counter++;
/* 398 */ 			} else if (this.timers[index].counter==9) {
/* 399 */ 				this.remove(item);
/* 400 */ 			}

/* roar.js */

/* 401 */ 		}catch(er){ this.remove(item); }
/* 402 */ 	},
/* 403 */ 
/* 404 */ 	remove: function(item) {
/* 405 */ 		if(Browser.Engine.trident) item.setStyle('z-index', 9998);
/* 406 */ 		var index = this.items.indexOf(item);
/* 407 */ 		if (index == -1) return this;
/* 408 */ 		this.items.splice(index, 1);
/* 409 */ 		this.storeOffset.splice(index, 1);
/* 410 */ 		item.removeEvents();
/* 411 */ 		var to = {opacity: 0};
/* 412 */ 		to[this.align.y] = item.getStyle(this.align.y).toInt() - item.offsetHeight - this.options.offset;
/* 413 */ 		new Fx.Morph(item,$merge({
/* 414 */ 			unit: 'px', 
/* 415 */ 			duration: 1000, 
/* 416 */ 			transition: Fx.Transitions.Back.easeOut, 
/* 417 */ 			onStart: Chain.prototype.clearChain
/* 418 */ 		}, this.options.itemFx)).start(to).chain(function(item){
/* 419 */ 			if(!item.hasClass('persistent')){
/* 420 */ 				this.clearTimer(item.id.split('-')[1]);
/* 421 */ 			}else{
/* 422 */ 				//callback
/* 423 */ 				this.notify(item.getElement('.close-button').rel);
/* 424 */ 			}
/* 425 */ 			item.destroy();
/* 426 */ 		}.bind(this, [item]));
/* 427 */ 		//this.adjust.bind(this).delay(3000); //to auto adjust persistent types and remove between excess spacing
/* 428 */ 		return this.fireEvent('onHide', [item, this.items.length]).callChain(item);
/* 429 */ 	},
/* 430 */ 	
/* 431 */ 	notify: function(id) {
/* 432 */ 		var retry = 3;
/* 433 */ 		var url = this.options.notify_url ? this.options.notify_url : '/messages/bulletin/'+id;
/* 434 */ 		var ajax = new Request({
/* 435 */ 			url: url,
/* 436 */ 			method: 'get', 
/* 437 */ 			onComplete: function(resp) {
/* 438 */ 				--retry;
/* 439 */ 				if(resp.toInt()!=1 && retry>0) func();
/* 440 */ 			},
/* 441 */ 			onFailure: function(){
/* 442 */ 				--retry;
/* 443 */ 				if(retry>0) func();
/* 444 */ 			}
/* 445 */ 		});
/* 446 */ 		var func = function(){
/* 447 */ 			ajax.send();
/* 448 */ 		}.bind(this);
/* 449 */ 		func();
/* 450 */ 	},

/* roar.js */

/* 451 */ 	
/* 452 */ 	poll: function() {
/* 453 */ 		var maxFails = 5;
/* 454 */ 		this.pollAtt = 0;
/* 455 */ 		this.poller;
/* 456 */ 		var ajax = new Request.JSON({
/* 457 */ 			url: '/users/getnotifies/',
/* 458 */ 			method: 'get', 
/* 459 */ 			link: 'cancel',
/* 460 */ 			noCache: true,
/* 461 */ 			onSuccess: function(jsonObj) {
/* 462 */ 				if(jsonObj){
/* 463 */ 					setTimeout(function(){
/* 464 */ 						this.pollAtt = 0;
/* 465 */ 						var l = jsonObj.notify.length;
/* 466 */ 						if(l>0) for (var i=0;i<l; i++) {
/* 467 */ 							var item = jsonObj.notify[i];
/* 468 */ 							if(item.title) this.alert(item.title, item.text, {type: 'activity', timer: 600}, {
/* 469 */ 								type: item.type,
/* 470 */ 								thumb_path: item.thumb_path,
/* 471 */ 								thumb_url: item.thumb_url
/* 472 */ 							});
/* 473 */ 						}
/* 474 */ 					}.bind(this),50);
/* 475 */ 				}
/* 476 */ 			}.bind(this), 
/* 477 */ 			onFailure: function() {
/* 478 */ 				++this.pollAtt;
/* 479 */ 				if(this.pollAtt>maxFails) $clear(this.poller);
/* 480 */ 			}.bind(this)
/* 481 */ 		});
/* 482 */ 		setTimeout(function(){
/* 483 */ 			ajax.send();
/* 484 */ 			this.poller = (function(){ajax.send();}).periodical(20000, this);
/* 485 */ 		}.bind(this),1000);
/* 486 */ 		
/* 487 */ 		window.addEvent('beforeunload', function(e,ajax){
/* 488 */ 			try{
/* 489 */ 				ajax.cancel(); 
/* 490 */ 				$clear(this.poller);
/* 491 */ 			}catch(er){};
/* 492 */ 		}.bindWithEvent(this,[ajax]));
/* 493 */ 		
/* 494 */ 		
/* 495 */ 	},
/* 496 */ 
/* 497 */ 	empty: function() {
/* 498 */ 		while (this.items.length) this.remove(this.items[0]);
/* 499 */ 		return this;
/* 500 */ 	},

/* roar.js */

/* 501 */ 
/* 502 */ 	render: function() {
/* 503 */ 		this.position = this.options.position;
/* 504 */ 		if ($type(this.position) == 'string') {
/* 505 */ 			var position = {x: 'center', y: 'center'};
/* 506 */ 			this.align = {x: 'left', y: 'top'};
/* 507 */ 			if ((/left|west/i).test(this.position)) position.x = 'left';
/* 508 */ 			else if ((/right|east/i).test(this.position)) this.align.x = position.x = 'right';
/* 509 */ 			if ((/upper|top|north/i).test(this.position)) position.y = 'top';
/* 510 */ 			else if ((/bottom|lower|south/i).test(this.position)) this.align.y = position.y = 'bottom';
/* 511 */ 			this.position = position;
/* 512 */ 		}
/* 513 */ 		//this.body = new Element('div', {'class': 'roar-body'}).injectInside(document.body);
/* 514 */ 		this.body = 'roar-body';
/* 515 */ 		new Element('div', {'class': 'roar-body', 'id': 'roar-body'}).injectInside(document.body);
/* 516 */ 		
/* 517 */ 		this.moveTo = document.id(this.body).setStyles.bind(document.id(this.body));
/* 518 */ 		this.reposition();
/* 519 */ 		if (this.options.bodyFx) {
/* 520 */ 			var morph = new Fx.Morph(document.id(this.body), $merge({
/* 521 */ 				unit: 'px',
/* 522 */ 				transition: Fx.Transitions.Circ.easeOut
/* 523 */ 			}, this.options.bodyFx));
/* 524 */ 			this.moveTo = morph.start.bind(morph);
/* 525 */ 		}
/* 526 */ 		var repos = this.reposition.bind(this);
/* 527 */ 		window.addEvents({
/* 528 */ 			scroll: repos,
/* 529 */ 			resize: repos
/* 530 */ 		});
/* 531 */ 		this.fireEvent('onRender', document.id(this.body));
/* 532 */ 	},
/* 533 */ 
/* 534 */ 	reposition: function() {
/* 535 */ 		var max = window.getSize(), scroll = window.getScroll(), margin = this.options.margin;
/* 536 */ 		max.left = max.x + scroll.x;
/* 537 */ 		max.right = max.x + scroll.x;
/* 538 */ 		max.top = max.y + scroll.y;
/* 539 */ 		max.bottom = max.y + scroll.y;
/* 540 */ 		var rel = ($type(this.container) == 'element') ? this.container.getCoordinates() : max;
/* 541 */ 		
/* 542 */ 		var pos = {
/* 543 */ 				top: (this.position.y == 'bottom')
/* 544 */ 				? (Math.min(rel.bottom, max.bottom) - margin.y)
/* 545 */ 				: (Math.max(rel.top, max.top) + margin.y)
/* 546 */ 		};
/* 547 */ 		if(!this.options.fixedRight){
/* 548 */ 			$merge(pos, {
/* 549 */ 				left: (this.position.x == 'right')
/* 550 */ 					? (Browser.Engine.webkit) ? (Math.min(rel.right, max.right) - margin.x)-10-this.options.classWidth : (Math.min(rel.right, max.right) - margin.x-this.options.classWidth)

/* roar.js */

/* 551 */ 					: (Math.max(rel.left, max.left) + margin.x)
/* 552 */ 				}
/* 553 */ 			);
/* 554 */ 		}
/* 555 */ 		this.moveTo(pos);
/* 556 */ 	}
/* 557 */ 
/* 558 */ });

;
/* moofacebox.js */

/* 1   */ /*
/* 2   *|  * mooFacebox
/* 3   *|  * version: 0.1 (03/10/2008)
/* 4   *|  * @requires MooTools v1.2 or later
/* 5   *|  *
/* 6   *|  * Facebox is a port to mootools of the original 
/* 7   *|  * Facebox (http://famspam.com/facebox) written by Chris Wanstrath with some 
/* 8   *|  * added features like drag support and titles.
/* 9   *|  *
/* 10  *|  * Licensed under the MIT:
/* 11  *|  *
/* 12  *|  *   http://www.opensource.org/licenses/mit-license.php
/* 13  *|  *
/* 14  *|  * Copyright 2007, 2008 Chris Wanstrath [ chris@ozmm.org ]
/* 15  *|  * Copyright 2008 Augusto Becciu [ augusto@becciu.org ]
/* 16  *|  *
/* 17  *|  * Usage:
/* 18  *|  *  
/* 19  *|  *  window.addEvent('domready', function() {
/* 20  *|  *      var myFacebox = new mooFacebox();
/* 21  *|  *  });
/* 22  *|  *
/* 23  *|  *
/* 24  *|  *  <a href="#terms" rel="facebox">Terms</a>
/* 25  *|  *    Loads the #terms div in the box
/* 26  *|  *
/* 27  *|  *  <a href="terms.html" rel="facebox">Terms</a>
/* 28  *|  *    Loads the terms.html page in the box
/* 29  *|  *
/* 30  *|  *  <a href="terms.png" rel="facebox">Terms</a>
/* 31  *|  *    Loads the terms.png image in the box
/* 32  *|  *
/* 33  *|  *	**extended considerably
/* 34  *|  *
/* 35  *|  */
/* 36  */ 
/* 37  */ 
/* 38  */ var mooFacebox = new Class({
/* 39  */ 	Implements: [Options, Events],
/* 40  */     options: {
/* 41  */ 		debug: true,
/* 42  */ 		//controls
/* 43  */         draggable	  : false, //Drag permanently permanently until, it taking over all events is fixed
/* 44  */         fadeFrame	  : true,
/* 45  */         elementsSelector: '.moobox',
/* 46  */         loading_image : '/js/moofacebox/loader.gif',
/* 47  */         loader_class  : 'overlay-loader',
/* 48  */         image_types   : [ 'png', 'jpg', 'jpeg', 'gif' ],
/* 49  */         target_url	  : null,
/* 50  */         width	  	  : 400,

/* moofacebox.js */

/* 51  */         height		  : 180,
/* 52  */         onBeforeReveal: $empty,
/* 53  */         onReveal	  : $empty,
/* 54  */         onClose		  : $empty,
/* 55  */         onBeforeClose : $empty,
/* 56  */         onClick		  : $empty,
/* 57  */         onInit		  : $empty,
/* 58  */         durations	  : {
/* 59  */ 			fadein  : 0,
/* 60  */ 			fadeout : 0,
/* 61  */ 			framein : 0,
/* 62  */ 			frameout: 0,
/* 63  */ 			scroll	: 0
/* 64  */ 		},
/* 65  */ 		//custom edits
/* 66  */ 		showOnInit	  : false,
/* 67  */ 		initHtml	  : null,
/* 68  */ 		closeFlag 	  : null,
/* 69  */ 		hideClose	  : false,
/* 70  */ 		//wrapper
/* 71  */ 		boxType		  : 0,
/* 72  */ 		boxClass	  : null,
/* 73  */ 		bodyClass	  : null,
/* 74  */ 		data_formatter: null,
/* 75  */ 		box_id		  : '',
/* 76  */ 		top_offset	  : null,
/* 77  */ 		evalScripts  : false
/* 78  */     },
/* 79  */     open: false,
/* 80  */     
/* 81  */     setWrapper: function() {
/* 82  */     	var containers = [
/* 83  */ 			'<div class="drag"></div> '+
/* 84  */ 			'<div class="corner"> '+
/* 85  */ 				'<div class="ct"><div> </div></div> '+
/* 86  */ 			'</div> '+
/* 87  */ 			'<div class="popup"> '+
/* 88  */ 			  '<div class="close" title="close"></div> '+
/* 89  */ 			  '<table> '+
/* 90  */ 			    '<tbody> '+
/* 91  */ 			      '<tr> '+
/* 92  */ 			        '<td class="dialog-content"> '+
/* 93  */ 			          '<div class="body"> '+
/* 94  */ 			            '<div class="content"></div> '+
/* 95  */ 			          '</div> '+
/* 96  */ 			        '</td> '+
/* 97  */ 			      '</tr> '+
/* 98  */ 			    '</tbody> '+
/* 99  */ 			  '</table> '+
/* 100 */ 			 '</div> '+

/* moofacebox.js */

/* 101 */ 			 '<div class="corner"> '+
/* 102 */ 				'<div class="cb"><div> </div></div> '+
/* 103 */ 			'</div>',
/* 104 */ 			'<div class="popup"> '+
/* 105 */ 		      '<table> '+
/* 106 */ 		        '<tbody> '+
/* 107 */ 		          '<tr> '+
/* 108 */ 		            '<td class="tl"/><td class="b"/><td class="tr"/> '+
/* 109 */ 		          '</tr> '+
/* 110 */ 		          '<tr> '+
/* 111 */ 		            '<td class="b"/> '+
/* 112 */ 		            '<td class="dialog-content"> '+
/* 113 */ 		              '<div class="body"> '+
/* 114 */ 		                '<div class="content"></div> '+
/* 115 */ 		                '<div class="footer"> '+
/* 116 */ 		                	'<div class="close" title="close"></div> '+
/* 117 */ 		                '</div> '+
/* 118 */ 		              '</div> '+
/* 119 */ 		            '</td> '+
/* 120 */ 		            '<td class="b"/> '+
/* 121 */ 		          '</tr> '+
/* 122 */ 		          '<tr> '+
/* 123 */ 		            '<td class="bl"/><td class="b"/><td class="br"/> '+
/* 124 */ 		          '</tr> '+
/* 125 */ 		        '</tbody> '+
/* 126 */ 		      '</table> '+
/* 127 */ 		    '</div>'
/* 128 */     	];
/* 129 */     	
/* 130 */     	this.wrapper = containers[this.options.boxType];
/* 131 */     },
/* 132 */ 
/* 133 */     loading: function() {
/* 134 */         if (this.faceboxEl.getElement('.loading')) return true;
/* 135 */ 
/* 136 */         this.faceboxEl.getElement('.content').empty();
/* 137 */ 
/* 138 */         var bodyEl = this.faceboxEl.getElement('.body');
/* 139 */         bodyEl.getChildren().setStyle('display', 'none');
/* 140 */         
/* 141 */         if(this.options.fadeFrame) this.fadeFrame();
/* 142 */         
/* 143 */         //build loader
/* 144 */         var loadingEl = new Element('div', {
/* 145 */         	'class': 'loading',
/* 146 */         	'styles': {
/* 147 */         		'margin-top': ((this.options.boxType==0) ? (this.options.height/2 - 15) : 5) + 'px'
/* 148 */         	}
/* 149 */         }).adopt(
/* 150 */         	(this.options.loader_class ? new Element('span', {'class': this.options.loader_class}) : new Element('img', {'src': this.options.loading_image}))

/* moofacebox.js */

/* 151 */         );
/* 152 */ 
/* 153 */         bodyEl.adopt(loadingEl);
/* 154 */         
/* 155 */         this.faceboxEl.setStyles({
/* 156 */         	left: (window.getScrollLeft() + (window.getWidth() - this.options.width)/2) + 'px', 
/* 157 */         	top: (window.getScrollTop() + ((window.getHeight() - this.options.height)/2) - (this.options.top_offset ? this.options.top_offset : 0)) + 'px'
/* 158 */         });
/* 159 */ 
/* 160 */         document.id(document).addEvent('keydown', this.keydownHdlr);
/* 161 */         
/* 162 */         this.fadeIn(this.faceboxEl);
/* 163 */     },
/* 164 */     
/* 165 */     empty: function(){
/* 166 */     	this.faceboxEl.getElement('.loading').destroy();
/* 167 */     },
/* 168 */ 
/* 169 */     reveal: function(data, klass) {    		
/* 170 */         if (klass) this.faceboxEl.getElement('.content').addClass(klass);
/* 171 */         
/* 172 */         if(this.options.data_formatter){
/* 173 */         	data = this.options.data_formatter(data);
/* 174 */         }
/* 175 */         if ($type(data) == 'string'){
/* 176 */             this.faceboxEl.getElement('.content').set('html', data);
/* 177 */         }else{
/* 178 */             this.faceboxEl.getElement('.content').adopt(data); 
/* 179 */         }
/* 180 */         
/* 181 */         this.fireEvent('onBeforeReveal', data);
/* 182 */         if(this.cancel){
/* 183 */     		this.cancel = 0;
/* 184 */     		return;
/* 185 */     	}
/* 186 */         
/* 187 */         if(this.faceboxEl.getElement('.loading')) this.faceboxEl.getElement('.loading').destroy();
/* 188 */         this.faceboxEl.getElement('.body').getChildren().each(this.fadeIn.bind(this));
/* 189 */         this.fadeIn(this.faceboxEl);
/* 190 */         window.addEvent('scroll', this.scrollEffect.bind(this));
/* 191 */         this.reposition();
/* 192 */         this.open = true;
/* 193 */         this.fireEvent('onReveal');
/* 194 */     },
/* 195 */     
/* 196 */     fadeFrame: function() {
/* 197 */ 		new Element('div', {
/* 198 */ 			'id': 'overlay-box-fade', 
/* 199 */ 			'styles': {
/* 200 */ 				'opacity': 0

/* moofacebox.js */

/* 201 */ 			}, 'events': {
/* 202 */ 				'click': function(e){
/* 203 */ 					try{ new Event(e).stop(); }catch(er){};
/* 204 */ 					this.close();
/* 205 */ 				}.bind(this)
/* 206 */ 			}
/* 207 */ 		}).injectInside(document.body);
/* 208 */ 		this.overlaySize();
/* 209 */ 		new Fx.Tween('overlay-box-fade', {
/* 210 */ 			property: 'opacity',
/* 211 */ 			duration: this.options.durations.framein, 
/* 212 */ 			transition: Fx.Transitions.sineInOut
/* 213 */ 		}).start(0, 0.6).chain(function(){
/* 214 */ 			//added to resolve stupid IE8 not supporting opacity
/* 215 */ 			if(Browser.Engine.trident6) document.id('overlay-box-fade').setStyles({
/* 216 */ 				'background-image': 'url('+poptent_helpers.add_image_base('overlay-box/overlay-bg.png')+')', 
/* 217 */ 				'background-color': 'transparent',
/* 218 */ 				'display': 'block'
/* 219 */ 			});
/* 220 */     	});
/* 221 */     },
/* 222 */     
/* 223 */     overlaySize: function(){
/* 224 */     	// we have to set this to 0px before so we can reduce the size / width of the overflow onresize 
/* 225 */     	if(document.id('overlay-box-fade')){
/* 226 */ 	    	document.id('overlay-box-fade').setStyles({'height': '0px', 'width': '0px'});
/* 227 */ 	    	document.id('overlay-box-fade').setStyles({'height': window.getScrollHeight() + 'px', 'width': '100%'});
/* 228 */     	}
/* 229 */     },
/* 230 */     
/* 231 */     scrollEffect: function(){
/* 232 */     	var box = this.faceboxEl.getCoordinates();
/* 233 */     	new Fx.Morph(this.faceboxEl, {
/* 234 */     		duration: this.options.durations.scroll, 
/* 235 */     		transition: Fx.Transitions.sineInOut
/* 236 */     	}).start({
/* 237 */         	top: (window.getScrollTop() + ((window.getHeight() - box.height)/2) - (this.options.top_offset ? this.options.top_offset : 0)) + 'px'
/* 238 */     	});
/* 239 */     },
/* 240 */ 
/* 241 */     fadeIn: function(el) {
/* 242 */         new Fx.Morph(el, {
/* 243 */         	duration: this.options.durations.fadein,
/* 244 */         	onStart: function() {
/* 245 */                 el.setStyle('display', 'block');
/* 246 */             }
/* 247 */         }).start({'opacity': [0,1]});
/* 248 */     },
/* 249 */ 
/* 250 */     fadeOut: function(el) {

/* moofacebox.js */

/* 251 */     	new Fx.Morph(el, {
/* 252 */         	duration: this.options.durations.fadeout,
/* 253 */         	onComplete: function() {
/* 254 */                 el.setStyle('display', 'none');
/* 255 */             }
/* 256 */         }).start({'opacity': [1,0]});
/* 257 */     },
/* 258 */ 
/* 259 */     close: function() {
/* 260 */     	if(this.options.closeFlag!=null && !this.options.closeFlag) return;
/* 261 */     	this.fireEvent('onBeforeClose');
/* 262 */     	
/* 263 */         document.id(document).removeEvent('keydown', this.keydownHdlr);
/* 264 */         this.fadeOut(this.faceboxEl);
/* 265 */         var contentEl = this.faceboxEl.getElement('.content');
/* 266 */         contentEl.setStyle('class', '');
/* 267 */         contentEl.addClass('content');
/* 268 */         
/* 269 */         if(this.options.fadeFrame) {
/* 270 */         	new Fx.Tween('overlay-box-fade', {
/* 271 */         		property: 'opacity',
/* 272 */         		duration: this.options.durations.frameout, 
/* 273 */         		transition: Fx.Transitions.sineInOut, 
/* 274 */         		onComplete: function() {
/* 275 */         			if(document.id('overlay-box-fade')) document.id('overlay-box-fade').dispose();
/* 276 */         		}
/* 277 */         	}).start(0.6,0).chain(function(){
/* 278 */     			//added to resolve stupid IE8 not supporting opacity
/* 279 */         		if(document.id('overlay-box-fade')){
/* 280 */ 	    			if(Browser.Engine.trident6) document.id('overlay-box-fade').setStyles({
/* 281 */ 	    				'display': 'none'
/* 282 */ 	    			});
/* 283 */         		}
/* 284 */         	});
/* 285 */         }
/* 286 */         //remove scroll effect
/* 287 */         window.removeEvent('scroll', this.scrollEffect.bind(this));
/* 288 */         this.fireEvent('onClose');
/* 289 */         this.open = false;
/* 290 */         return false;
/* 291 */     },
/* 292 */ 
/* 293 */     setTitle: function(title) {
/* 294 */         var titleEl = this.faceboxEl.getElement('.title');
/* 295 */         if(!titleEl) return;
/* 296 */         titleEl.setStyle('display', ((title == "")?'none':'block'));
/* 297 */         titleEl.getElement('span').set('text', title);
/* 298 */     },
/* 299 */     
/* 300 */     remove: function(selector){

/* moofacebox.js */

/* 301 */     	$$(selector).removeEvents();
/* 302 */     },
/* 303 */ 
/* 304 */     initialize: function(options) {
/* 305 */         this.setOptions(options);
/* 306 */         
/* 307 */         this.setWrapper();
/* 308 */         this.faceboxEl = new Element('div', {
/* 309 */         	id: this.options.box_id ? this.options.box_id : 'overlay-box',
/* 310 */         	'class': 'overlay-box box_'+this.options.boxType
/* 311 */         });
/* 312 */         this.faceboxEl.setStyle('opacity', 0);
/* 313 */         this.faceboxEl.set('html', this.wrapper);
/* 314 */         if(this.options.boxClass) this.faceboxEl.addClass(this.options.boxClass);
/* 315 */         if(this.options.bodyClass) this.faceboxEl.getElement('.body').addClass(this.options.bodyClass);
/* 316 */ 
/* 317 */         document.id(document.body).adopt(this.faceboxEl);
/* 318 */         
/* 319 */         // set width/ height
/* 320 */         this.faceboxEl.getElement('.popup').setStyles({
/* 321 */     		width: this.options.width + 'px',
/* 322 */     		height: (this.options.boxType==0) ? this.options.height + 'px' : 'auto'
/* 323 */     	});
/* 324 */ 
/* 325 */         /** preload images **/
/* 326 */         setTimeout(function(){
/* 327 */         new Asset.images(
/* 328 */     		[
/* 329 */     		 	[poptent_helpers.add_image_base('overlay-box/br.png')],
/* 330 */     		 	[poptent_helpers.add_image_base('overlay-box/bl.png')],
/* 331 */     		 	[poptent_helpers.add_image_base('overlay-box/tr.png')],
/* 332 */     		 	[poptent_helpers.add_image_base('overlay-box/tl.png')],
/* 333 */     		 	[poptent_helpers.add_image_base('overlay-box/b.png')],
/* 334 */     		 	[poptent_helpers.add_image_base('overlay-box/close-button.gif')],
/* 335 */     		 	[poptent_helpers.add_image_base('overlay-box/corners.png')]
/* 336 */     		]
/* 337 */     	);
/* 338 */         },100);
/* 339 */         
/* 340 */         if(this.options.hideClose){
/* 341 */         	this.faceboxEl.getElement('.close').setStyle('display', 'none');
/* 342 */         }else{
/* 343 */         	this.faceboxEl.getElement('.close')
/* 344 */         		.addEvent('click', this.close.bind(this))
/* 345 */         		.addEvent('click', function(e){try{ new Event(e).stop(); }catch(er){};});
/* 346 */         }
/* 347 */         if (this.options.draggable == true) {
/* 348 */             var dcontentEl = this.faceboxEl.getElement('.drag');
/* 349 */             this.drag = this.faceboxEl.makeDraggable({handle: dcontentEl});
/* 350 */             this.faceboxEl.setStyle('cursor', 'move');

/* moofacebox.js */

/* 351 */         }
/* 352 */ 
/* 353 */         this.keydownHdlr = function(e) {
/* 354 */             e = new Event(e);
/* 355 */             if (e.code == 27) {
/* 356 */             	e.stop();
/* 357 */             	this.close();
/* 358 */             }
/* 359 */         }.bind(this);
/* 360 */ 
/* 361 */         var image_types = this.options.image_types.join('|');
/* 362 */         image_types = new RegExp('\.' + image_types + '$', 'i');
/* 363 */ 
/* 364 */         var elements = $$(this.options.elementsSelector);
/* 365 */         
/* 366 */         var self = this;
/* 367 */         
/* 368 */         if(this.options.showOnInit) {
/* 369 */         	 self.loading();
/* 370 */         	 this.reveal(this.options.initHtml);
/* 371 */         }else{
/* 372 */ 	        elements.addEvent('click', function(e) {
/* 373 */ 	        	try{ e = new Event(e).stop(); }catch(er){};
/* 374 */ 	        	
/* 375 */ 	            if(self.open) return;
/* 376 */ 	            
/* 377 */ 	            var doajax = true;
/* 378 */ 	            self.loading();
/* 379 */ 	            
/* 380 */ 	            // custom event to handle setups on click to reveal
/* 381 */ 	            self.fireEvent('onClick', this);
/* 382 */ 	            
/* 383 */ 	            if(this.get('tag')=='button'){
/* 384 */ 	            	var target = this.value.split('#')[1];
/* 385 */ 	            	if(target){
/* 386 */ 		                self.reveal(document.id(target).clone().setStyle('display','block'), target);
/* 387 */ 		                doajax = false;
/* 388 */ 	            	}
/* 389 */ 	            }else{
/* 390 */ 	            	if(Browser.Engine.trident) var etarget = (this.get('tag')=='img') ? this.getParent() : this;
/* 391 */ 	            	else{
/* 392 */ 	            		if(e.target.get('tag')=='img') var etarget = e.target.getParent(); //img within a link
/* 393 */ 	            		else if(e.target.get('tag')=='a') var etarget = this; //a just use this
/* 394 */ 	            		//var etarget = (e.target.get('tag')=='img') ? e.target.getParent() : this.target;
/* 395 */ 	            	}
/* 396 */ 	            	
/* 397 */ 		            if(etarget){
/* 398 */ 			            self.setTitle(etarget.getProperty('title'));
/* 399 */ 			
/* 400 */ 			            // support for rel="moobox[.inline_popup]" syntax, to add a class

/* moofacebox.js */

/* 401 */ 			            var klass = etarget.rel.match(/moobox\[\.(\w+)\]/);
/* 402 */ 			            if (klass) klass = klass[1];
/* 403 */ 			            
/* 404 */ 			            // div
/* 405 */ 			            if (etarget.getProperty('href').match(/#/)) {
/* 406 */ 			            	var target = etarget.getProperty('href').split('#')[1];
/* 407 */ 			            	if(target != ''){
/* 408 */ 				                self.reveal(document.id(target).clone().setStyle('display','block'), klass);
/* 409 */ 				                doajax = false;
/* 410 */ 			            	}
/* 411 */ 			            // image
/* 412 */ 			            } else if (etarget.getProperty('href').match(image_types)) {
/* 413 */ 			                var image = new Asset.image(etarget.href, {
/* 414 */ 			                    onload: function() {
/* 415 */ 			                        this.reveal('<div class="image"><img src="' + image.src + '" /></div>', klass);
/* 416 */ 			                    }.bind(self)
/* 417 */ 			                });
/* 418 */ 			                doajax = false;
/* 419 */ 			            }
/* 420 */ 		            }
/* 421 */ 	            }
/* 422 */ 	
/* 423 */ 	            if(doajax) {
/* 424 */ 	            	// ajax
/* 425 */ 	            	// TODO: verify the need for this.target.href below, don't remember why its needed? if at all
/* 426 */ 	            	new Request({
/* 427 */ 	                    url: self.options.target_url || e.target.href || this.target.href, 
/* 428 */ 	            		method: 'get',
/* 429 */ 	            		link: 'cancel',
/* 430 */ 	            		evalScripts: self.options.evalScripts,
/* 431 */ 	                    onSuccess: function(responseText) {
/* 432 */ 	                        this.reveal(responseText, klass);
/* 433 */ 	                    }.bind(self)
/* 434 */ 	                }).send();
/* 435 */ 	            }
/* 436 */ 	            
/* 437 */ 	            return false;
/* 438 */ 	        });
/* 439 */     	}
/* 440 */         
/* 441 */         this.fireEvent('onInit');
/* 442 */     },
/* 443 */ 
/* 444 */     getPageScroll: function() {
/* 445 */         var xScroll, yScroll;
/* 446 */         if (self.pageYOffset) {
/* 447 */             yScroll = self.pageYOffset;
/* 448 */             xScroll = self.pageXOffset;
/* 449 */         } else if (document.documentElement && document.documentElement.scrollTop) { // Explorer 6 Strict
/* 450 */             yScroll = document.documentElement.scrollTop;

/* moofacebox.js */

/* 451 */             xScroll = document.documentElement.scrollLeft;
/* 452 */         } else if (document.body) {// all other Explorers
/* 453 */             yScroll = document.body.scrollTop;
/* 454 */             xScroll = document.body.scrollLeft;	
/* 455 */         }
/* 456 */ 
/* 457 */         return new Array(xScroll,yScroll);
/* 458 */     },
/* 459 */ 
/* 460 */     getPageHeight: function() {
/* 461 */         var windowHeight;
/* 462 */         if (self.innerHeight) {	// all except Explorer
/* 463 */             windowHeight = self.innerHeight;
/* 464 */         } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
/* 465 */             windowHeight = document.documentElement.clientHeight;
/* 466 */         } else if (document.body) { // other Explorers
/* 467 */             windowHeight = document.body.clientHeight;
/* 468 */         };
/* 469 */ 
/* 470 */         return windowHeight;
/* 471 */     },
/* 472 */     
/* 473 */     reposition: function() {
/* 474 */     	var box = this.faceboxEl.getCoordinates();
/* 475 */     	this.faceboxEl.set('styles', {'top': (window.getScrollTop() + ((window.getHeight() - box.height)/2)) + 'px'});
/* 476 */     },
/* 477 */     
/* 478 */     log: function(val){
/* 479 */ 		if (window.console && window.console.log && this.options.debug) console.log(val);
/* 480 */ 	}
/* 481 */ 
/* 482 */ });
/* 483 */ 

;
/* uvbox.js */

/* 1   */ /*
/* 2   *| <div class="uvbox-wrapper">
/* 3   *| 	<div class="uvbox-content">
/* 4   *| 		<div class="uvbox-databox"></div>
/* 5   *| 		<div class="uvbox-closebox">
/* 6   *| 			<a href="#" class="uvbox-close">
/* 7   *| 				<span></span>
/* 8   *| 			</a>
/* 9   *| 		</div>
/* 10  *| 	</div>
/* 11  *| </div>
/* 12  *| */
/* 13  */ var uvbox = new Class({
/* 14  */ 	Implements: [Options, Events],
/* 15  */ 	
/* 16  */     options: {
/* 17  */ 		debug: true,
/* 18  */         draggable: false, 			//allow entire box to be draggable
/* 19  */         fade : false, 				//enable background fading when box pops up
/* 20  */         
/* 21  */         selectors: '.uvbox',
/* 22  */ 		box: '<div class="uvbox-content"><div class="uvbox-databox"></div><div class="uvbox-close"><a href="#"></a></div></div>',
/* 23  */         target_url: null,
/* 24  */         preload: null,				//array of images to preload
/* 25  */         
/* 26  */         width: null,				//default: auto
/* 27  */         
/* 28  */         onBeforeShow: $empty,
/* 29  */         onBeforeClose: $empty,
/* 30  */         onShow: $empty,
/* 31  */         onClose: $empty,
/* 32  */         onClick: $empty,
/* 33  */         onInit: $empty,
/* 34  */         
/* 35  */         durations: {
/* 36  */ 			fadein: 0,
/* 37  */ 			fadeout: 0,
/* 38  */ 			framein: 0,
/* 39  */ 			frameout: 0,
/* 40  */ 			scroll: 0
/* 41  */ 		},
/* 42  */ 		
/* 43  */ 		box_id: null,
/* 44  */ 		type: null,
/* 45  */ 		scroll: false,
/* 46  */ 		data_formatter: null
/* 47  */     },
/* 48  */     
/* 49  */     loading: false,
/* 50  */     open: false,

/* uvbox.js */

/* 51  */     events: false,
/* 52  */     
/* 53  */     loader: null,
/* 54  */     box: null,
/* 55  */     content: null,
/* 56  */     databox: null,
/* 57  */     closebox: null,
/* 58  */     fadeframe: null,
/* 59  */     
/* 60  */     initialize: function(options) {
/* 61  */         this.setOptions(options);
/* 62  */         this.setup();
/* 63  */     },
/* 64  */     
/* 65  */     setup: function() {
/* 66  */     	this.log('uvbox: setup');
/* 67  */     	
/* 68  */     	this.box = new Element('div', { 
/* 69  */     		'class': 'uvbox-wrapper',
/* 70  */     		'html': this.options.box,
/* 71  */     		'styles': {
/* 72  */     			'opacity': 0,
/* 73  */     			'display': 'none'
/* 74  */     		}
/* 75  */     	});
/* 76  */     	
/* 77  */     	this.content = this.box.getElement('.uvbox-content');
/* 78  */     	this.content.addClass((this.options.type) ? this.options.type : 'facebox');
/* 79  */     	
/* 80  */     	this.databox = this.content.getElement('.uvbox-databox');
/* 81  */     	if (this.options.box_id) this.databox.set('id', this.options.box_id);
/* 82  */     	
/* 83  */     	this.closebox = this.content.getElement('.uvbox-close');
/* 84  */     	
/* 85  */     	this.box.inject(document.body);
/* 86  */     	if (this.options.width) {
/* 87  */ 	    	this.content.setStyles({
/* 88  */ 	    		'width': this.options.width + 'px'
/* 89  */ 	    	});
/* 90  */     	}
/* 91  */     	
/* 92  */     	if (this.options.init_data) {
/* 93  */ 			this.show(this.options.init_data);
/* 94  */     	} else {
/* 95  */     		var self = this;
/* 96  */     		
/* 97  */     		$$(this.options.selectors).addEvent('click', function (e) {
/* 98  */     			e.stop();
/* 99  */     			if (self.open) return;
/* 100 */     			

/* uvbox.js */

/* 101 */     			var target = null;
/* 102 */     			var klass = this.rel || null;
/* 103 */     			
/* 104 */     			//self.load(klass);
/* 105 */     			self.fireEvent('onClick', this);
/* 106 */     			
/* 107 */     			if (!self.options.target_url) {
/* 108 */     				/*
/* 109 *| 	    			 * expect structures
/* 110 *| 	    			 * - links & buttons only:
/* 111 *| 	    			 *   - normal: href of page to load
/* 112 *| 	    			 *   - inline: href with #element following hash
/* 113 *| 	    			 *   - image: href of image of type gif|jpg|jpeg|png
/* 114 *| 	    			 */
/* 115 */ 		            switch (this.nodeName.toLowerCase()) {
/* 116 */ 		            	case 'a': target = this.href; break;
/* 117 */ 		            	case 'button': target = this.value; break;
/* 118 */ 		            	default: return false; break;
/* 119 */ 		            }
/* 120 */ 		            
/* 121 */ 	    			if (target.contains('#')) {
/* 122 */ 		            	target = target.split('#')[1];
/* 123 */ 		            	$try(function() { 
/* 124 */ 		            		self.show($(target).clone().setStyle('display','block')); 
/* 125 */ 		            	});
/* 126 */ 		                return false;
/* 127 */ 		            } else if (target.match(/gif|jpg|jpeg|png$/i)) {
/* 128 */ 		                var image = new Asset.image(target, {
/* 129 */ 		                    onload: function() {
/* 130 */ 		                        self.show('<div class="image"><img src="' + image.src + '" /></div>');
/* 131 */ 		                    }
/* 132 */ 		                });
/* 133 */ 		                return false;
/* 134 */ 		            }
/* 135 */     			} else {
/* 136 */     				target = self.options.target_url;
/* 137 */     			}
/* 138 */     			
/* 139 */     			if (target) {
/* 140 */ 	    			new Request({
/* 141 */ 	                    url: target, 
/* 142 */ 	            		method: 'get',
/* 143 */ 	            		link: 'cancel',
/* 144 */ 	                    onSuccess: function (resp) {
/* 145 */ 	                        self.show(resp);
/* 146 */ 	                    }
/* 147 */ 	                }).send();
/* 148 */     			}
/* 149 */     			return false;
/* 150 */     		});

/* uvbox.js */

/* 151 */     	}
/* 152 */     	
/* 153 */     	if (this.options.draggable) {
/* 154 */     		var handle = this.box.getElement('.drag');
/* 155 */     		if (handle) {
/* 156 */ 	            this.drag = this.box.makeDraggable({
/* 157 */ 	            	handle: handle.setStyle('cursor', 'move')
/* 158 */ 	            });
/* 159 */     		}
/* 160 */         }
/* 161 */     	
/* 162 */     	if (this.options.preload) this.preload();
/* 163 */     	this.fireEvent('onInit');
/* 164 */     },
/* 165 */     
/* 166 */     delegate: function(e) {
/* 167 */     	this.log('uvbox: delegate');
/* 168 */     	
/* 169 */     	if (!this.open) return true;
/* 170 */ 	    var target = document.id((e.target || e.srcElement));
/* 171 */ 		id = target.className;
/* 172 */ 		if (!id) {
/* 173 */ 			target = target.getParent();
/* 174 */ 			id = target.className;
/* 175 */ 		}
/* 176 */ 		var handler = false;
/* 177 */ 		
/* 178 */ 		if (id) {
/* 179 */ 			switch(e.type) {
/* 180 */ 				case 'click':
/* 181 */ 					switch(id) {
/* 182 */ 						case 'uvbox-close':
/* 183 */ 						case 'uvbox-wrapper':
/* 184 */ 							e.stop();
/* 185 */ 							this.close();
/* 186 */ 							break;
/* 187 */ 						case '':
/* 188 */ 							handler = handler.meta;
/* 189 */ 							break;
/* 190 */ 					}
/* 191 */ 					break;
/* 192 */ 				case 'keydown':
/* 193 */ 					e = new Event(e);
/* 194 */ 		            if (e.code==27) {
/* 195 */ 		            	e.stop();
/* 196 */ 		            	this.close();
/* 197 */ 		            }
/* 198 */ 					break;
/* 199 */ 			}
/* 200 */ 			if (handler) return handler(e,target);

/* uvbox.js */

/* 201 */ 		}
/* 202 */ 	},
/* 203 */ 
/* 204 */     load: function(klass) {
/* 205 */ 		this.log('uvbox: load');
/* 206 */ 		
/* 207 */         if (this.loading) return true;
/* 208 */         this.databox.empty();
/* 209 */         if (this.options.fade) this.fade();
/* 210 */         
/* 211 */         if (!this.loader) this.loader = new Element('div', { 'class': 'uvbox-loader', 'html': '<span></span>' });
/* 212 */         
/* 213 */         this.content.addClass('loading');
/* 214 */         if (klass) this.content.addClass(klass);
/* 215 */         this.databox.adopt(this.loader);
/* 216 */         this.reposition();
/* 217 */         
/* 218 */         if (!this.events) { //events added once here on first load
/* 219 */         	this.closebox.addEvent('click', this.delegate.bindWithEvent(this));
/* 220 */         	
/* 221 */         	//keydown: this.delegate.bindWithEvent(this) - event not currently supported
/* 222 */         	if (this.options.scroll) {
/* 223 */ 		        window.addEvents({
/* 224 */ 		        	scroll: function() {
/* 225 */ 		        		if (!this.open) return true;
/* 226 */ 		        		this.scroll();
/* 227 */ 		        	}.bind(this)
/* 228 */ 		        });
/* 229 */         	}
/* 230 */ 	        this.events = true;
/* 231 */         }
/* 232 */         
/* 233 */         this.fade('in');
/* 234 */         this.loading = true;
/* 235 */     },
/* 236 */     
/* 237 */     show: function(data) {
/* 238 */     	this.log('uvbox: show');
/* 239 */     	if (!this.loading) this.load();
/* 240 */     	
/* 241 */     	if (this.options.data_formatter) data = this.options.data_formatter(data);
/* 242 */     	
/* 243 */     	this.fireEvent('onBeforeShow', data);
/* 244 */     	
/* 245 */     	this.content.removeClass('loading');
/* 246 */         ($type(data)=='string') ? this.databox.set('html', data) : this.databox.adopt(data);
/* 247 */         if (this.loading) this.loader.dispose();
/* 248 */         
/* 249 */         this.reposition();
/* 250 */         this.fade('in');

/* uvbox.js */

/* 251 */         
/* 252 */         this.open = true;
/* 253 */         this.loading = false;
/* 254 */         
/* 255 */         this.fireEvent('onShow');
/* 256 */     },
/* 257 */ 
/* 258 */     close: function(e) {
/* 259 */     	this.log('uvbox: close');
/* 260 */     	if (e) e.stop();
/* 261 */     	this.fireEvent('onBeforeClose');
/* 262 */     	
/* 263 */         this.fade('out');
/* 264 */         if (this.options.fade) this.fade('frameout');
/* 265 */         
/* 266 */         this.open = false;
/* 267 */         this.loading = false;
/* 268 */         this.fireEvent('onClose');
/* 269 */         return false;
/* 270 */     },
/* 271 */     
/* 272 */     fade: function(type) {
/* 273 */     	this.log('uvbox: fade ('+(type?type:'default')+')');
/* 274 */     	switch(type) {
/* 275 */     		case 'in':
/* 276 */     			new Fx.Morph(this.box, {
/* 277 */     	        	duration: this.options.durations.fadein,
/* 278 */     	        	onStart: function() {
/* 279 */     	                this.box.setStyle('display', 'block');
/* 280 */     	            }.bind(this)
/* 281 */     	        }).start({'opacity': [0,1]});
/* 282 */     			break;
/* 283 */     		case 'out':
/* 284 */     			new Fx.Morph(this.box, {
/* 285 */     	        	duration: this.options.durations.fadeout,
/* 286 */     	        	onComplete: function() {
/* 287 */     	                this.box.setStyle('display', 'none');
/* 288 */     	            }.bind(this)
/* 289 */     	        }).start({'opacity': [1,0]});
/* 290 */     			break;
/* 291 */     		case 'frameout':
/* 292 */     			if (this.fadeframe) {
/* 293 */ 	    			new Fx.Tween(this.fadeframe, {
/* 294 */ 	            		property: 'opacity',
/* 295 */ 	            		duration: this.options.durations.frameout, 
/* 296 */ 	            		transition: Fx.Transitions.sineInOut, 
/* 297 */ 	            		onComplete: function() {
/* 298 */ 	            			this.fadeframe.dispose();
/* 299 */ 	            		}.bind(this)
/* 300 */ 	            	}).start(0.6, 0);

/* uvbox.js */

/* 301 */     			}
/* 302 */     			break;
/* 303 */     		case 'framein':
/* 304 */     		default: //frame in
/* 305 */     			if (!this.fadeframe) {
/* 306 */ 	    			this.fadeframe = new Element('div', {
/* 307 */ 	    				'class': 'uvbox-fade', 
/* 308 */ 	    				'styles': {
/* 309 */ 	    					'opacity': 0
/* 310 */ 	    				},
/* 311 */ 	    				'events': {
/* 312 */ 	    					'click': function(e) {
/* 313 */ 	    						e.stop();
/* 314 */ 	    						this.close();
/* 315 */ 	    					}.bind(this)
/* 316 */ 	    				}
/* 317 */ 	    			})
/* 318 */     			}
/* 319 */     			
/* 320 */ 	    		this.fadeframe.setStyles({'height': '0px', 'width': '0px'}).inject(document.body);
/* 321 */ 	    		this.fadeframe.setStyles({'height': window.getScrollHeight() + 'px', 'width': '100%'});
/* 322 */ 	        	
/* 323 */     			new Fx.Tween(this.fadeframe, {
/* 324 */     				property: 'opacity',
/* 325 */     				duration: this.options.durations.framein, 
/* 326 */     				transition: Fx.Transitions.sineInOut
/* 327 */     			}).start(0, 0.6);
/* 328 */     			break;
/* 329 */     	};
/* 330 */     },
/* 331 */     
/* 332 */     scroll: function() {
/* 333 */     	this.log('uvbox: scroll');
/* 334 */     	var box = this.box.getCoordinates();
/* 335 */     	new Fx.Morph(this.box, {
/* 336 */     		duration: this.options.durations.scroll, 
/* 337 */     		transition: Fx.Transitions.sineInOut
/* 338 */     	}).start({
/* 339 */         	top: (window.getScrollTop() + ((window.getHeight() - box.height)/2)) + 'px'
/* 340 */     	});
/* 341 */     },
/* 342 */     
/* 343 */     reposition: function() {
/* 344 */     	this.log('uvbox: reposition');
/* 345 */     	
/* 346 */     	var box = this.box.getCoordinates();
/* 347 */     	
/* 348 */     	var styles = {};
/* 349 */     	if (this.options.scroll) {
/* 350 */ 	    	styles.top = (window.getScrollTop() + ((window.getHeight() - box.height)/2)) + 'px';

/* uvbox.js */

/* 351 */ 	    	if (!this.options.fade) {
/* 352 */ 	    		styles.left = (window.getScrollLeft() + (window.getWidth() - box.width)/2) + 'px';
/* 353 */ 	    		styles.width = 'auto';
/* 354 */ 	    	}
/* 355 */     	} else {
/* 356 */     		styles.top = ((window.getHeight() - box.height)/2) + 'px';
/* 357 */     		styles.left = (window.getScrollLeft() + (window.getWidth() - box.width)/2) + 'px';
/* 358 */     		styles.width = 'auto';
/* 359 */     		styles.position = 'fixed';
/* 360 */     	}
/* 361 */     	
/* 362 */     	this.box.setStyles(styles);
/* 363 */     },
/* 364 */     
/* 365 */     preload: function() {
/* 366 */     	this.log('uvbox: preload');
/* 367 */     	
/* 368 */     	setTimeout(function() { new Asset.images(this.options.preload); }, 100);
/* 369 */     },
/* 370 */     
/* 371 */     log: function(val) {
/* 372 */ 		if (window.console && this.options.debug) console.log(val);
/* 373 */ 	}
/* 374 */ 
/* 375 */ });
/* 376 */ 

;
/* discussions.js */

/* 1    */ var chDiscussion = function(item,callerObj){
/* 2    */ 	alert('chdsc called');
/* 3    */ 	var itemId = item;
/* 4    */ 	var newThreadId = itemId.split('_')[1];
/* 5    */ 	if(poptent_vars.modules.comments.id==newThreadId) return false;
/* 6    */ 	if (!typeof thisComments == 'undefined' ){
/* 7    */ 		thisComments.options.threadId = newThreadId;
/* 8    */ 		thisComments.getContainer(newThreadId);
/* 9    */ 		if (thisComments.history){
/* 10   */ 			thisComments.history.setValue(0, newThreadId+'/1/0/0');
/* 11   */ 			thisComments.histChange(newThreadId+'/1/0/0');
/* 12   */ 		}else{
/* 13   */ 			window.location = '#c='+newThreadId+'/1/0/0';
/* 14   */ 		}
/* 15   */ 	}else{
/* 16   */ 		window.location = '#c='+newThreadId+'/1/0/0';
/* 17   */ 	}		
/* 18   */ };
/* 19   */ 
/* 20   */ var discussion_request = new Request.JSON({
/* 21   */ 	url: '', 
/* 22   */ 	method: 'get',
/* 23   */ 	noCache: true,
/* 24   */ 	onComplete: function(jsonObj){
/* 25   */ 		poptent_vars.modules.discussions.attempts = 0;
/* 26   */ 		//alert('disc request complete');
/* 27   */ 		if($defined(jsonObj.error) && jsonObj.error != 0){
/* 28   */ 			location.href='/discussion/'+((!jsonObj.goto || jsonObj.goto == 0 || jsonObj.goto == '')?'new/':'#c='+jsonObj.goto+'/1/0/0');
/* 29   */ 		}else{
/* 30   */ 			var currTime = new Date().getTime();
/* 31   */ 			
/* 32   */ 			if(poptent_vars.modules.comments.id && (typeof poptent_vars.modules.discussions.cache !== 'undefined')) poptent_vars.modules.discussions.cache.timed_set(poptent_vars.modules.comments.id,jsonObj,120);
/* 33   */ 			setDiscussionInfo(jsonObj);
/* 34   */ 			if (!(typeof membersInit == 'undefined') ){
/* 35   */ 				membersInit.options.moduleBoxId = poptent_vars.modules.comments.id;
/* 36   */ 				membersInit.moduleAdmin.options.id = poptent_vars.modules.comments.id;
/* 37   */ 				membersInit.refresh();
/* 38   */ 			}
/* 39   */ 			if (!(typeof labelsInit == 'undefined') ){
/* 40   */ 				labelsInit.moduleAdmin.options.id = poptent_vars.modules.comments.id;
/* 41   */ 				labelsInit.refresh();
/* 42   */ 			}
/* 43   */ 		}
/* 44   */ 	},
/* 45   */ 	onFailure: function(conn,jsonObj){
/* 46   */ 		if(poptent_vars.modules.discussions.attempts==3){
/* 47   */ 			if(location.href.match(/message|forum|discussion/)) location.href='/discussion/new/';
/* 48   */ 		}else{
/* 49   */ 			poptent_vars.modules.discussions.attempts++;
/* 50   */ 			(function(){getDiscussionInfo();}).delay(1500);

/* discussions.js */

/* 51   */ 		}
/* 52   */ 		
/* 53   */ 	}
/* 54   */ });
/* 55   */ 
/* 56   */ var getDiscussionInfo = function(){
/* 57   */ 	var currDiscInfo;
/* 58   */ 	//alert('disc request started');
/* 59   */ 	var result = false;
/* 60   */ 	if(poptent_vars.modules.comments.id && (typeof poptent_vars.modules.discussions.cache !== 'undefined')) result = poptent_vars.modules.discussions.cache.timed_get(poptent_vars.modules.comments.id);
/* 61   */ 	
/* 62   */ 	if(result){
/* 63   */ 		setDiscussionInfo(result);
/* 64   */ 		if (!(typeof membersInit == 'undefined') ){
/* 65   */ 			membersInit.moduleAdmin.options.id = poptent_vars.modules.comments.id;
/* 66   */ 			membersInit.options.moduleBoxId = poptent_vars.modules.comments.id;
/* 67   */ 			membersInit.refresh();
/* 68   */ 		}
/* 69   */ 	}else{
/* 70   */ 		discussion_request.options.url = '/messages/getthreadinfo/'+poptent_vars.modules.comments.id+'/';
/* 71   */ 		discussion_request.send();
/* 72   */ 	}
/* 73   */ };
/* 74   */ 
/* 75   */ var setDiscussionInfo = function(discObj){
/* 76   */ 	if(location.href.match(/message|forum|discussion/)) document.title = 'Poptent :: Discussion #'+discObj.id+' - '+discObj.titlePrefix+discObj.title;
/* 77   */ 	poptent_vars.current_page.user.id = discObj.ownerInfo.id;
/* 78   */ 	poptent_vars.modules.discussions.invite_id = discObj.inviteId;
/* 79   */ 	if(document.id('newMsg')) document.id('newMsg').setProperty('action','/comments/add/type:1/assoc_parent:'+discObj.id);
/* 80   */ 	if(document.id('dynMsgTotalComments')) document.id('dynMsgTotalComments').set('html', discObj.total);
/* 81   */ 	if(document.id('railTotalComments')) document.id('railTotalComments').set('html', discObj.total);
/* 82   */ 	var label_html = ['<span id="messageLabels">'];
/* 83   */ 	discObj.labels.each(function(label){
/* 84   */ 		label_html.push('<a href="/search/discussions/?q=label:%22' + label.dn + '%22" class="message_label messagelabel_' + label.id + '" style="background-color: #' + poptent_vars.modules.label.colors[label.cc] + ';">');
/* 85   */ 			label_html.push('<span class="label-tip '+((discObj.msgType==6)?'yellow':'white')+'"></span>');
/* 86   */ 			label_html.push('<span class="label">' + label.dn + '</span>');
/* 87   */ 			label_html.push('<span class="inline-delete" id="inline-label-' + label.id + '">[X]</span>');
/* 88   */ 		label_html.push('</a>');
/* 89   */ 	});
/* 90   */ 	label_html.push('</span>');
/* 91   */ 	label_html = label_html.join('');
/* 92   */ 	document.id('dynMsgTitle').set('html', '<span class="is_public fl" id="dynMsgPublicX" style="display:none; margin-right: 5px;">Public</span><span class=" fl mtt mtt_'+discObj.msgType+'">'+discObj.titlePrefix+'</span> '+((discObj.msgType==5 || discObj.msgType==11)?'<a  class="fl" href="/assignment/'+discObj.assoc_id+'">'+discObj.titleLinks+'</a>':'<span class="fl" id="dynMsgStarterTitle">'+discObj.titleLinks+'</span>')+ label_html +'<span class="clear block"></span>');
/* 93   */ 	if (!(typeof labelsInitAdmin == 'undefined') ) labelsInitAdmin.inlineDeleteEvent();
/* 94   */ 	document.id('dynMsgStarterComment').set('html', discObj.starterComment);
/* 95   */ 	if(discObj.editable>1){
/* 96   */ 		document.id('dynMsgStarterComment').addClass('editable');
/* 97   */ 		if(disObj.editable==999) document.id('dynMsgStarterComment').addClass('editmode');
/* 98   */ 		new Element('div', {id: 'dynMsgStarterCommentHidden', 'class': 'nodisplay', 'html': discObj.starterEditText}).injectAfter(document.id('dynMsgStarterComment'));
/* 99   */ 		document.id('dynMsgStarterTimer').set('html', 
/* 100  */ 			'<span id="commentTimer_'+discObj.starterCommentId+'" class="commentEditTimer active">' +

/* discussions.js */

/* 101  */ 				'Click comment to edit: <span id="editTimer_'+discObj.starterCommentId+'" class="editTimer"><span>'+discObj.editable+'</span></span>' +
/* 102  */ 			'</span>'
/* 103  */ 		).removeClass('nodisplay');
/* 104  */ 		thread_editstarter_associate(); //init edit starter for dynamic load
/* 105  */ 	}
/* 106  */ 	document.id('dynMsgDate').set('html', discObj.created);
/* 107  */ 	if(discObj.editedByAdmin != ''){
/* 108  */ 		new Element('span').set('html', '<br/><span style="font-style: italic; font-size: 10px;">( edited by '+discObj.editedByAdmin+' )</span>').injectAfter(document.id('dynMsgDate'));
/* 109  */ 	}
/* 110  */ 	document.id('dynMsgRSSPath').setProperty('href','/rss/discussion/'+discObj.id+'/'+discObj.authHash);
/* 111  */ 	
/* 112  */ 	
/* 113  */ 	
/* 114  */ 	if(discObj.isInvite==1){
/* 115  */ 		document.id('dynMsgInvite').setStyle('display','block');
/* 116  */ 		document.id('dynMsgInviteButtonsWrap').setStyle('display','block');
/* 117  */ 		var activeInviteWrapper = ((discObj.isInviteTarget==1)?document.id('dynMsgIsInviteTarget'):document.id('dynMsgNotInviteTarget'));
/* 118  */ 		document.id('dynMsgIsInviteTarget').setStyle('display',((discObj.isInviteTarget==1)?'inline':'none'));
/* 119  */ 		document.id('dynMsgNotInviteTarget').setStyle('display',((discObj.isInviteTarget==1)?'none':'inline'));
/* 120  */ 		document.id('dynMsgInviteButtonsWrap').setStyle('display',((discObj.isInviteTarget==1)?((discObj.inviteStatus==0)?'block':'none'):'none'));
/* 121  */ 		document.id('dynMsgInvite').addClass('textColumn');
/* 122  */ 		
/* 123  */ 		activeInviteWrapper.getElements('.waiting, .accepted, .declined').setStyle('display','none');
/* 124  */ 		var activeInviteStatus = false;
/* 125  */ 		switch(discObj.inviteStatus.toInt()){
/* 126  */ 			case 0: activeInviteStatus = activeInviteWrapper.getElement('.waiting'); break;
/* 127  */ 			case 1: activeInviteStatus = activeInviteWrapper.getElement('.accepted'); break;
/* 128  */ 			case 2: activeInviteStatus = activeInviteWrapper.getElement('.declined'); break;
/* 129  */ 		}
/* 130  */ 		if(activeInviteStatus) activeInviteStatus.setStyle('display','inline');
/* 131  */ 	}else{
/* 132  */ 		document.id('dynMsgInvite').setStyle('display','none');
/* 133  */ 		document.id('dynMsgInviteButtonsWrap').setStyle('display','none');
/* 134  */ 	}
/* 135  */ 	if(discObj.isLocked.toInt()>0){
/* 136  */ 		if(document.id('mainCommentBox')) document.id('mainCommentBox').setStyles({
/* 137  */ 			'height':'1px',
/* 138  */ 			'overflow':'hidden',
/* 139  */ 			'visibility':'hidden'
/* 140  */ 		});
/* 141  */ 		thisComments.options.canreply = 0;
/* 142  */ 	}else{
/* 143  */ 		if(document.id('mainCommentBox')) document.id('mainCommentBox').setStyles({
/* 144  */ 			'height':'auto',
/* 145  */ 			'overflow':'auto',
/* 146  */ 			'visibility':'visible'
/* 147  */ 		});
/* 148  */ 		thisComments.options.canreply = 1;
/* 149  */ 	}
/* 150  */ 	if(document.id('threadArchive_on')){

/* discussions.js */

/* 151  */ 		if(discObj.isArchived==1){
/* 152  */ 			document.id('threadArchive_off').removeClass('active');
/* 153  */ 			document.id('threadArchive_on').addClass('active');
/* 154  */ 		}else{
/* 155  */ 			document.id('threadArchive_on').removeClass('active');
/* 156  */ 			document.id('threadArchive_off').addClass('active');
/* 157  */ 		}
/* 158  */ 	}
/* 159  */ 	/*
/* 160  *| 	if(document.id('threadNotify_on')){
/* 161  *| 		if(discObj.isNotify==1){
/* 162  *| 			document.id('threadNotify_off').removeClass('active');
/* 163  *| 			document.id('threadNotify_on').addClass('active');
/* 164  *| 		}else{
/* 165  *| 			document.id('threadNotify_on').removeClass('active');
/* 166  *| 			document.id('threadNotify_off').addClass('active');
/* 167  *| 		}
/* 168  *| 	}
/* 169  *| 	*/
/* 170  */ 	
/* 171  */ 	
/* 172  */ 	if(discObj.msgType==6){
/* 173  */ 		if (!(typeof labelsInit == 'undefined') ) labelsInit.moduleAdmin.options.msgType = discObj.msgType;
/* 174  */ 		
/* 175  */ 		if(discObj.isOwner==1){
/* 176  */ 			if(document.id('threadForceExpire')){
/* 177  */ 				document.id('threadForceExpire').setStyle('display', 'block');
/* 178  */ 				if(discObj.forceExpired==1){
/* 179  */ 					document.id('threadForceExpire_off').removeClass('active');
/* 180  */ 					document.id('threadForceExpire_on').addClass('active');
/* 181  */ 				}else{
/* 182  */ 					document.id('threadForceExpire_on').removeClass('active');
/* 183  */ 					document.id('threadForceExpire_off').addClass('active');
/* 184  */ 				}
/* 185  */ 				document.id('threadForceExpire').addClass('last');
/* 186  */ 			}
/* 187  */ 			if(document.id('threadArchive')) document.id('threadArchive').removeClass('last');
/* 188  */ 		}else{
/* 189  */ 			if(document.id('threadForceExpire')) document.id('threadForceExpire').setStyle('display', 'none');
/* 190  */ 			if(document.id('threadArchive')) document.id('threadArchive').addClass('last');
/* 191  */ 		}
/* 192  */ 		$$('#threadArchive .arcName').set('text', 'Bulletin');
/* 193  */ 		$$('#threadMembersBox'/*, '#threadNotify'*/).setStyle('display', 'none');
/* 194  */ 		$$('#dynMsgRSSPath', '#threadExpand_on').getParent().setStyle('display', 'none');
/* 195  */ 	}else{
/* 196  */ 		if(discObj.isOwner==1 && document.id('threadForceExpire')) document.id('threadForceExpire').setStyle('display', 'none');
/* 197  */ 		$$('#threadForceExpire', '#threadArchive').removeClass('last');
/* 198  */ 		$$('#threadArchive .arcName').set('text', 'Discussion');
/* 199  */ 		$$('#threadMembersBox'/*, '#threadNotify'*/).setStyle('display', 'block');
/* 200  */ 		$$('#dynMsgRSSPath', '#threadExpand_on').getParent().setStyle('display', 'block');

/* discussions.js */

/* 201  */ 	}
/* 202  */ 	
/* 203  */ 	var messageClass = discObj.msgClass;
/* 204  */ 	var msgAction = 'started';
/* 205  */ 	
/* 206  */ 	document.id('dynMsgOwnerAction').set('html', msgAction+' '+((discObj.msgType == 1 && discObj.isInviteTarget!=1)?'to':'by'));
/* 207  */ 	
/* 208  */ 	var targetUserInfo = (discObj.msgType == 1 && discObj.isInviteTarget!=1)?discObj.inviteUserInfo:discObj.ownerInfo;
/* 209  */ 	
/* 210  */ 	($$('#dynMsgExtraInfo img.dynMsgOwnerImage')[0]).setProperty('src',targetUserInfo.avatar).setProperty('id','atips-'+((targetUserInfo.isBrand==1)?'brands':'users')+'-'+targetUserInfo.id+'-'+$random(1000,9999));
/* 211  */ 	($$('#dynMsgExtraInfo a.dynMsgOwnerImageLink')[0]).setProperty('href','/user/'+targetUserInfo.username).setProperty('id','atips-'+((targetUserInfo.isBrand==1)?'brands':'users')+'-'+targetUserInfo.id+'-'+$random(1000,9999));
/* 212  */ 	($$('#dynMsgExtraInfo a.dynMsgOwnerLink')[0]).set({
/* 213  */ 		'href': '/user/'+targetUserInfo.username, 
/* 214  */ 		'id': 'atips-'+((targetUserInfo.isBrand==1)?'brands':'users')+'-'+targetUserInfo.id+'-'+$random(1000,9999),
/* 215  */ 		'html': ((targetUserInfo.fullname != '')?targetUserInfo.fullname:targetUserInfo.username)
/* 216  */ 	});
/* 217  */ 	document.id('dynMsgOwnerIsOnline').setStyle('display',(targetUserInfo.is_online==1)?'inline':'none');
/* 218  */ 	document.id('dynMsgOwnerIsBrand').setStyle('display',(targetUserInfo.isBrand==1)?'inline':'none');
/* 219  */ 	document.id('dynMsgOwnerIsStaff').setStyle('display',(targetUserInfo.isStaff==1)?'inline':'none');
/* 220  */ 	
/* 221  */ 	document.id('dynMsgContainer').setProperty('class','messageInfo').addClass(messageClass);
/* 222  */ 	if(document.id('dynThread').getStyle('display') == 'none') document.id('dynThread').setStyle('display','block');
/* 223  */ 	if(document.id('dynMsgExtraInfo').getStyle('display') == 'none') document.id('dynMsgExtraInfo').setStyle('display','block');
/* 224  */ 	document.id('dynThread').removeClass('fade');
/* 225  */ 	
/* 226  */ 	if(document.id('newMsgLoader')) document.id('newMsgLoader').setProperty('src',poptent_helpers.add_image_base('base/asset-comments/ajax-loader-blue-on-'+((discObj.isOwner==1)?'yellow':'blue')+'-bg.gif'));
/* 227  */ 	
/* 228  */ 	if($defined(discObj.starterCommentFile[0])){
/* 229  */ 		document.id('dynMsgFileWrapper').setStyles({
/* 230  */ 			'display':'block',
/* 231  */ 			'visibility':'visible'
/* 232  */ 		});
/* 233  */ 		document.id('dynMsgFile').set('html', '<strong>'+discObj.starterCommentFile[0].name+'</stromg>').setProperty('href',discObj.starterCommentFile[0].path);
/* 234  */ 	}else{
/* 235  */ 		document.id('dynMsgFileWrapper').setStyles({
/* 236  */ 			'display':'none',
/* 237  */ 			'visibility':'hidden'
/* 238  */ 		});
/* 239  */ 	}
/* 240  */ 	
/* 241  */ 	if(document.id('dynMsgIndicatorPublic')) document.id('dynMsgIndicatorPublic').setStyle('display',((discObj.isPublic==1)?'block':'none'));
/* 242  */ 	if(document.id('dynMsgPublicX')) document.id('dynMsgPublicX').setStyle('display',((discObj.isPublic==1)?'block':'none'));
/* 243  */ 	if(document.id('dynMsgIndicatorLocked')) document.id('dynMsgIndicatorLocked').setStyle('display',((discObj.isLocked.toInt()>0)?'block':'none'));
/* 244  */ 	if(discObj.msgType.toInt()!=6){
/* 245  */ 		if(discObj.isOwner==1){
/* 246  */ 			if(document.id('threadPublic')) document.id('threadPublic').setStyle('display','block');
/* 247  */ 			if(document.id('threadLocked')) document.id('threadLocked').setStyle('display','block');
/* 248  */ 			if(document.id('threadPublic')) document.id(((discObj.isPublic==1)?'threadPublic_off':'threadPublic_on')).removeClass('active');
/* 249  */ 			if(document.id('threadPublic')) document.id(((discObj.isPublic==1)?'threadPublic_on':'threadPublic_off')).addClass('active');
/* 250  */ 			document.id(((discObj.isLocked.toInt()>0)?'threadLocked_off':'threadLocked_on')).removeClass('active');

/* discussions.js */

/* 251  */ 			document.id(((discObj.isLocked.toInt()>0)?'threadLocked_on':'threadLocked_off')).addClass('active');
/* 252  */ 		}else{
/* 253  */ 			if(document.id('threadPublic')) document.id('threadPublic').setStyle('display','none');
/* 254  */ 			if(document.id('threadLocked')) document.id('threadLocked').setStyle('display','none');
/* 255  */ 			if(document.id('dynMsgIsOwnerComment') && document.id('dynMsgIsOwnerComment').hasClass('ownerComment')) document.id('dynMsgIsOwnerComment').removeClass('ownerComment');
/* 256  */ 		}
/* 257  */ 	}else{
/* 258  */ 		if(document.id('threadLocked')) document.id('threadLocked').setStyle('display','none');
/* 259  */ 	}
/* 260  */ 	if(document.id('flushcachelink')) document.id('flushcachelink').setProperty('href','/memcache/refreshMessage/'+discObj.id);
/* 261  */ 	if(document.id('editmodelink')) document.id('editmodelink').setProperty('href', '/discussion/'+discObj.id+ ((document.id('editmodelink').get('text').trim()=='enable') ? '?editMode=1' : ''));
/* 262  */ };
/* 263  */ 
/* 264  */ 
/* 265  */ var thread_controls_delegate = function(e){
/* 266  */ 	var target = document.id((e.target || e.srcElement));
/* 267  */ 	var tid = target.id;
/* 268  */ 	if(!tid){
/* 269  */ 		target = target.getParent();
/* 270  */ 		tid = target.id;
/* 271  */ 	}
/* 272  */ 	
/* 273  */ 	var handler_func = false;
/* 274  */ 	
/* 275  */ 	if(tid){
/* 276  */ 		if(e.type=='click'){
/* 277  */ 			switch(tid){
/* 278  */ 				case 'threadNotify_on':
/* 279  */ 				case 'threadNotify_off':
/* 280  */ 					handler_func = thread_handlers.notify;
/* 281  */ 					break;
/* 282  */ 				case 'threadArchive_on':
/* 283  */ 				case 'threadArchive_off':
/* 284  */ 					handler_func = thread_handlers.archive;
/* 285  */ 					break;
/* 286  */ 				case 'threadLockedButton':
/* 287  */ 				case 'threadLocked_on':
/* 288  */ 				case 'threadLocked_off':
/* 289  */ 					handler_func = thread_handlers.lock;
/* 290  */ 					break;
/* 291  */ 				case 'dynMsgRSSPath':
/* 292  */ 					handler_func = $lambda;
/* 293  */ 					break;
/* 294  */ 				case 'threadForceExpire_on':
/* 295  */ 				case 'threadForceExpire_off':
/* 296  */ 					handler_func = thread_handlers.expire;
/* 297  */ 					break;
/* 298  */ 				case 'threadExpand_on':
/* 299  */ 				case 'threadExpand_off':
/* 300  */ 					handler_func = thread_handlers.expand;

/* discussions.js */

/* 301  */ 					break;
/* 302  */ 				case 'threadPublic_on':
/* 303  */ 				case 'threadPublic_off':
/* 304  */ 					handler_func = thread_handlers.pubpriv;
/* 305  */ 					break;
/* 306  */ 				case 'threadDeleteButton':
/* 307  */ 				case 'threadDelete_on':
/* 308  */ 				case 'threadDelete_off':
/* 309  */ 					handler_func = thread_handlers.del;
/* 310  */ 					break;
/* 311  */ 				case 'joinDiscButton':
/* 312  */ 				case 'threadJoin_on':
/* 313  */ 				case 'threadJoin_off':
/* 314  */ 					handler_func = thread_handlers.join;
/* 315  */ 					break;
/* 316  */ 			}
/* 317  */ 		}else if(e.type=='change'){
/* 318  */ 			if(tid=='threadChangeTypeId'){
/* 319  */ 				handler_func = thread_handlers.change_type;
/* 320  */ 			}
/* 321  */ 		}
/* 322  */ 		if(handler_func){
/* 323  */ 			if(target.hasClass('disabled') || target.getParent().hasClass('disabled')){
/* 324  */ 				try{ new Event(e).stop(); }catch(er){};
/* 325  */ 				return false;
/* 326  */ 			}
/* 327  */ 			return handler_func(e,target);
/* 328  */ 		}
/* 329  */ 	}
/* 330  */ };
/* 331  */ 
/* 332  */ var thread_controls_associate = function(){
/* 333  */ 	var controls_block = ($$('div#messaging div.searchSideBar div.mOptions','div#album-comments div.searchSideBar div.mOptions')[0]);
/* 334  */ 	if(controls_block)					 controls_block.addEvents({'click': thread_controls_delegate, 'change': thread_controls_delegate});
/* 335  */ 	
/* 336  */ 	//buttons
/* 337  */ 	if(document.id('threadLockedButton'))document.id('threadLockedButton').addEvent('click',thread_controls_delegate);
/* 338  */ 	if(document.id('joinDiscButton'))    document.id('joinDiscButton').addEvent('click',thread_controls_delegate);
/* 339  */ 	if(document.id('threadDeleteButton'))document.id('threadDeleteButton').addEvent('click',thread_controls_delegate);
/* 340  */ 	
/* 341  */ 	//editable starter
/* 342  */ 	if(document.id('dynMsgStarterComment') && document.id('dynMsgStarterComment').hasClass('editable')) thread_editstarter_associate();
/* 343  */ };
/* 344  */ 
/* 345  */ var perm_up_associate = function(e){
/* 346  */ 	try{ new Event(e).stop(); }catch(er){};
/* 347  */ 	if (typeof thisComments != 'undefined' && thisComments.history){
/* 348  */ 		thisComments.history.setValue(0, thisComments.options.threadId+'/'+thisComments.pageNum+'/0/'+thisComments.baseId);
/* 349  */ 		thisComments.histChange(thisComments.options.threadId+'/'+thisComments.pageNum+'/0/'+thisComments.baseId);
/* 350  */ 	}else{

/* discussions.js */

/* 351  */ 		window.location = '#c='+thisComments.options.threadId+'/'+thisComments.pageNum+'/0/'+thisComments.baseId;
/* 352  */ 	}
/* 353  */ };
/* 354  */ 
/* 355  */ var new_msg_submit_associate = function(e){
/* 356  */ 	try{ new Event(e).stop(); }catch(er){};
/* 357  */ 	if(document.id('messagetext') && document.id('messagetext').value.trim() !='' && document.id('messagetext').value.trim() != 'Click here to add a message'){
/* 358  */ 		try{
/* 359  */ 			try{
/* 360  */ 				var files_queued = poptent_vars.modules.upload.instances.fileUpload.getStats().files_queued;
/* 361  */ 			}catch(e){
/* 362  */ 				var files_queued = false;
/* 363  */ 			};
/* 364  */ 			
/* 365  */ 			if(files_queued!==false && files_queued > 0){
/* 366  */ 				new Request.JSON({
/* 367  */ 					url: '/messages/getrandid/', 
/* 368  */ 					onComplete: function(jsonObj){
/* 369  */ 						setRandId(jsonObj);
/* 370  */ 					}
/* 371  */ 				}).send();
/* 372  */ 			}else{
/* 373  */ 				submitForm();
/* 374  */ 			}
/* 375  */ 		}catch(er){
/* 376  */ 			submitForm();
/* 377  */ 		}
/* 378  */ 	}else if(document.id('messagetext')){
/* 379  */ 		poptent_helpers.apply_validation_error_state('messagetext');
/* 380  */ 		poptent_helpers.show_notification('Please enter a message', 'error');
/* 381  */ 	}
/* 382  */ };
/* 383  */ 
/* 384  */ var group_accept_associate = function(e){
/* 385  */ 	try{ new Event(e).stop(); }catch(er){};
/* 386  */ 	$$('.rightColumn-e .loader').setStyle('display', 'block');
/* 387  */ 	new Request({
/* 388  */ 		url: '/messages/invite/'+poptent_vars.modules.discussions.invite_id+'/accept/', 
/* 389  */ 		method: 'get',
/* 390  */ 		onComplete: function(){
/* 391  */ 			initNotify('You have accepted the invitation.');
/* 392  */ 			$$('.rightColumn-e .loader').setStyle('display', 'none');
/* 393  */ 			$$('.rightColumn-e').addClass('textColumn');
/* 394  */ 			$$('.rightColumn-e div.buttons')[0].set('html', '<span class=\"accepted\">You have <strong>accepted</strong> this invite.</span>');
/* 395  */ 		},
/* 396  */ 		onFailure: function(){
/* 397  */ 			initNotify('Unable to accept the invitation, please verify that you are still logged in.',1);
/* 398  */ 			$$('.rightColumn-e .loader').setStyle('display', 'none');
/* 399  */ 		}
/* 400  */ 	}).send();

/* discussions.js */

/* 401  */ };
/* 402  */ 
/* 403  */ var group_decline_associate = function(e){
/* 404  */ 	try{ new Event(e).stop(); }catch(er){};
/* 405  */ 	$$('.rightColumn-e .loader').setStyle('display', 'block');
/* 406  */ 	new Request({
/* 407  */ 		url: '/messages/invite/'+poptent_vars.modules.discussions.invite_id+'/decline/', 
/* 408  */ 		method: 'get',
/* 409  */ 		onComplete: function(){
/* 410  */ 			initNotify('You have declined the invitation.');
/* 411  */ 			$$('.rightColumn-e div.buttons')[0].set('html', '<span class=\"declined\">You have <strong>declined</strong> this invite.</span>');
/* 412  */ 			$$('.rightColumn-e').addClass('textColumn');
/* 413  */ 			$$('.rightColumn-e .loader').setStyle('display', 'none');
/* 414  */ 		},
/* 415  */ 		onFailure: function(){
/* 416  */ 			initNotify('Unable to decline the invitation, please verify that you are still logged in.',1);
/* 417  */ 			$$('.rightColumn-e .loader').setStyle('display', 'none');
/* 418  */ 		}
/* 419  */ 	}).send();
/* 420  */ };
/* 421  */ 
/* 422  */ function thread_editstarter_associate(){
/* 423  */ 	var ttId = 'dynMsgStarterComment';
/* 424  */ 	var itId = 'dynMsgStarterTitle';
/* 425  */ 	var timerId = 'dynMsgStarterTimer';
/* 426  */ 	var httId = 'dynMsgStarterCommentHidden';
/* 427  */ 	var isSaving = false;
/* 428  */ 	var textContent, originalContentTB;
/* 429  */ 	var inputContent, originalContentIB;
/* 430  */ 	try{ var commentId = document.id(timerId).getFirst().id.split('_')[1]; }catch(er){ return; };
/* 431  */ 	var editMode = poptent_helpers.urlGetParam('editMode') ? '?editMode=1' : '';
/* 432  */ 	var inEM = document.id(ttId).hasClass('editmode') ? true : false;
/* 433  */ 	var ajax = new Request({
/* 434  */ 		url: '', 
/* 435  */ 		method: 'get',
/* 436  */ 		link: 'cancel',
/* 437  */ 		onComplete: function(json) {
/* 438  */ 			json = JSON.decode(json);
/* 439  */ 			if(json.s==0){
/* 440  */ 				timer.reset(json.t);
/* 441  */ 			}else{
/* 442  */ 				remove_edit_box(1);
/* 443  */ 				poptent_helpers.show_notification('You are no longer able to edit this comment','error');
/* 444  */ 			}							
/* 445  */ 		},
/* 446  */ 		onFailure: function(){
/* 447  */ 			poptent_helpers.show_notification('You are not able to edit this comment','error');
/* 448  */ 			remove_edit_box(1);
/* 449  */ 		}
/* 450  */ 	});

/* discussions.js */

/* 451  */ 	
/* 452  */ 	//auxilliary functions
/* 453  */ 	var remove_edit_box = function(perm){
/* 454  */ 		perm = perm || 0;
/* 455  */ 		if(perm==1){
/* 456  */ 			try{
/* 457  */ 				inputBox.removeEvents().destroy();
/* 458  */ 				textBox.removeEvents().destroy();
/* 459  */ 				formBox.removeEvents().destroy();
/* 460  */ 				saveButton.removeEvents().destroy();
/* 461  */ 				cancelButton.removeEvents().destroy();
/* 462  */ 				loader.destroy();
/* 463  */ 			}catch(er){}
/* 464  */ 			inputBox = textBox = formBox = null;
/* 465  */ 			saveButton = cancelButton = loader = null;
/* 466  */ 			$$('#'+ttId, '#'+itId).removeEvents();
/* 467  */ 			timer.hide();
/* 468  */ 		}else{
/* 469  */ 			//remove ipe els
/* 470  */ 			inputBox.dispose();
/* 471  */ 			formBox.dispose();
/* 472  */ 			timer.start();
/* 473  */ 			timer.show();
/* 474  */ 		}
/* 475  */ 		$$('#dynMsgPrefix', '#messageLabels', '#'+itId, '#'+ttId).removeClass('nodisplay');
/* 476  */ 	};
/* 477  */ 	
/* 478  */ 	var get_line_breaks = function(text){
/* 479  */ 		text = text.trim();
/* 480  */ 		text = text.replace(new RegExp("<br/>", "gi"), "\n");
/* 481  */ 		text = text.replace(new RegExp("<br />", "gi"), "\n");
/* 482  */ 		return text.replace(new RegExp("<br>", "gi"), "\n");
/* 483  */ 	};
/* 484  */ 	
/* 485  */ 	var enter_edit_mode = function(){
/* 486  */ 		ajax.options.url = '/comments/edit/1/0/'+poptent_vars.modules.comments.id+'/'+commentId+'/1/'+editMode;
/* 487  */ 		ajax.send();
/* 488  */ 		timer.stop();
/* 489  */ 		timer.hide();
/* 490  */ 	};
/* 491  */ 	
/* 492  */ 	var exit_edit_mode = function(save){
/* 493  */ 		save = save || 0;
/* 494  */ 		if(save==1){
/* 495  */ 			if(textContent != textBox.value || inputContent != inputBox.value){
/* 496  */ 				var url = '/comments/edit/1/1/'+poptent_vars.modules.comments.id+'/'+commentId+'/1/'+editMode;
/* 497  */ 				new Request({
/* 498  */ 					'url': url, 
/* 499  */ 					method: 'post',
/* 500  */ 					onRequest: function(){ loader.setStyle('visibility', 'visible'); },

/* discussions.js */

/* 501  */ 					onComplete: function(json) {
/* 502  */ 						json = JSON.decode(json);
/* 503  */ 						//update html
/* 504  */ 						if(json.s==0){
/* 505  */ 							document.id(ttId).set('html', json.ct);
/* 506  */ 							document.id(itId).set('html', inputBox.value);
/* 507  */ 							hiddenValue = json.et;
/* 508  */ 							timer.reset(json.t);
/* 509  */ 							isSaving = false;
/* 510  */ 							remove_edit_box();
/* 511  */ 							poptent_helpers.show_notification('This discussion has been updated', 'success', 300);
/* 512  */ 						}else if(json.s==2){
/* 513  */ 							remove_edit_box(1);
/* 514  */ 							poptent_helpers.show_notification('You are no longer able to edit this discussion','error');
/* 515  */ 						}else if(json.s==3){
/* 516  */ 							isSaving = false;
/* 517  */ 							poptent_helpers.show_notification('A title and comment must be filled in!', 'error', 300);
/* 518  */ 						}
/* 519  */ 						loader.setStyle('visibility', 'hidden');
/* 520  */ 					},
/* 521  */ 					onFailure: function(){
/* 522  */ 						loader.setStyle('visibility', 'hidden');
/* 523  */ 						poptent_helpers.show_notification('There was an error with your request', 'error');
/* 524  */ 						remove_edit_box();
/* 525  */ 					},
/* 526  */ 					data: "value=" + encodeURIComponent(textBox.value) + "&title=" + encodeURIComponent(inputBox.value)
/* 527  */ 				}).send();
/* 528  */ 			}else{
/* 529  */ 				isSaving = false;
/* 530  */ 				remove_edit_box();
/* 531  */ 			}
/* 532  */ 		}else{
/* 533  */ 			timer.reset();
/* 534  */ 			remove_edit_box();
/* 535  */ 		}
/* 536  */ 	};
/* 537  */ 	
/* 538  */ 	//timer functions
/* 539  */ 	var timer = {
/* 540  */ 		timer: null,
/* 541  */ 		update: 1000,
/* 542  */ 		start: function(){ 
/* 543  */ 			if(inEM) return;
/* 544  */ 			this.timer = this.run.periodical(this.update, this); 
/* 545  */ 			(function(){ document.id(timerId).setStyle('visibility', 'visible'); }).delay(1000);
/* 546  */ 		},
/* 547  */ 		stop: function(){ if(inEM) return; $clear(this.timer); },
/* 548  */ 		show: function(){ if(inEM) return; document.id(timerId).removeClass('nodisplay'); },
/* 549  */ 		hide: function(){ if(inEM) return; document.id(timerId).addClass('nodisplay'); },
/* 550  */ 		reset: function(updateTime){

/* discussions.js */

/* 551  */ 			if(inEM) return;
/* 552  */ 			updateTime = updateTime || 300;
/* 553  */ 			var min = Math.floor(updateTime/60);
/* 554  */ 			var sec = Math.round(((updateTime%60))*100)/100;
/* 555  */ 			if(sec<10) sec = '0'+sec;
/* 556  */ 			var et = document.id('editTimer_' + commentId);
/* 557  */ 			if(et) et.set('html', min+':'+sec+'<span>'+updateTime+'</span>');
/* 558  */ 			et = null;
/* 559  */ 		},
/* 560  */ 		run: function(){
/* 561  */ 			if(inEM) return;
/* 562  */ 			var et = document.id('editTimer_' + commentId);
/* 563  */ 			if(!et) return;
/* 564  */ 			var updateTime = et.getElement('span').get('text').toInt();
/* 565  */ 			if(updateTime<=0 || isNaN(updateTime)){
/* 566  */ 				remove_edit_box(1);
/* 567  */ 				this.stop();
/* 568  */ 			}else{		
/* 569  */ 				var min = Math.floor(updateTime/60);
/* 570  */ 				var sec = Math.round(((updateTime%60))*100)/100;
/* 571  */ 				if(sec<10) sec = '0'+sec;
/* 572  */ 				updateTime = updateTime - this.update/1000;
/* 573  */ 				et.set('html', min+':'+sec+'<span>'+updateTime+'</span>');
/* 574  */ 			}
/* 575  */ 			et = null;
/* 576  */ 		}
/* 577  */ 	};
/* 578  */ 	
/* 579  */ 	
/* 580  */ 	//init form els
/* 581  */ 	var formBox = new Element('form', {
/* 582  */ 		'name': 'starter-edit-form',
/* 583  */ 		'accept-charset': 'utf-8',
/* 584  */ 		'events': { 'submit': function(e) { e.preventDefault(); } }
/* 585  */ 	}).set('html', '<div class="clear"></div>');
/* 586  */ 	
/* 587  */ 	var saveButton = new Element('button', {'type': 'button','name': 'save', 'value': 'save', 'id': 'starter-save', 'href': '#', 'tabindex': 561})
/* 588  */ 		.set('html', '<span'+((Browser.Engine.chrome || Browser.Engine.safari4)?' style="top: -1px;"':'')+'>save</span>')
/* 589  */ 		.addClass('blue')
/* 590  */ 		.addClass('cancel')
/* 591  */ 		.addClass('fr')
/* 592  */ 		.addEvent('click', function(e){
/* 593  */ 			try{ new Event(e).stop(); }catch(er){};
/* 594  */ 			if(!isSaving){
/* 595  */ 				isSaving = true;
/* 596  */ 				exit_edit_mode(1);
/* 597  */ 			}
/* 598  */ 		});
/* 599  */ 	var cancelButton = new Element('button', {'type': 'button','name': 'cancel', 'value': 'cancel', 'id': 'starter-cancel', 'href': '#', 'tabindex': 562})
/* 600  */ 		.set('html', '<span'+((Browser.Engine.chrome || Browser.Engine.safari4)?' style="top: -1px;"':'')+'>cancel</span>')

/* discussions.js */

/* 601  */ 		.addClass('blue')
/* 602  */ 		.addClass('cancel')
/* 603  */ 		.addClass('fr')
/* 604  */ 		.addEvent('click', function(e){
/* 605  */ 			try{ new Event(e).stop(); }catch(er){};
/* 606  */ 			exit_edit_mode();
/* 607  */ 		});
/* 608  */ 	var loader = new Element('img', {
/* 609  */ 		'alt': 'loading...',
/* 610  */ 		'class': 'ipe-loader',
/* 611  */ 		'src': poptent_helpers.add_image_base('loaders/ajax-loader-blue-on-white.gif'),
/* 612  */ 		'width': 16,
/* 613  */ 		'height': 16,
/* 614  */ 		'styles': 'top: 4px'
/* 615  */ 	});
/* 616  */ 	new Element('div', {
/* 617  */ 		'class': 'controls-container',
/* 618  */ 		'styles': 'clear: both; margin-right: 6px;'
/* 619  */ 	}).adopt(
/* 620  */ 			cancelButton,
/* 621  */ 			saveButton,
/* 622  */ 			loader,
/* 623  */ 			new Element('div', {'class': 'clear'})
/* 624  */ 		).injectTop(formBox);
/* 625  */ 		
/* 626  */ 	var inputBox = new Element('input', {
/* 627  */ 		name: 'title',
/* 628  */ 		type: 'text',
/* 629  */ 		'class': 'inputbox-ipe',
/* 630  */ 		id: 'starter-input-ipe'
/* 631  */ 	});
/* 632  */ 	var textBox = new Element('textarea', {
/* 633  */ 		name: 'value',
/* 634  */ 		'class': 'textbox-ipe',
/* 635  */ 		id: 'starter-text-ipe'
/* 636  */ 	}).injectTop(formBox);
/* 637  */ 	
/* 638  */ 	var hiddenValue = get_line_breaks(document.id(httId).innerHTML);
/* 639  */ 	document.id(httId).destroy();
/* 640  */ 	
/* 641  */ 	//set over to indicate is editable
/* 642  */ 	var show_edit_box = function(e){
/* 643  */ 		try{ new Event(e).stop(); }catch(er){};
/* 644  */ 		
/* 645  */ 		enter_edit_mode();
/* 646  */ 		
/* 647  */ 		//grab original content
/* 648  */ 		originalContentTB = hiddenValue; //document.id(ttId).innerHTML;
/* 649  */ 		originalContentIB = document.id(itId).innerHTML;
/* 650  */ 		

/* discussions.js */

/* 651  */ 		//format content for form els
/* 652  */ 		textContent = poptent_helpers.html_entity_decode(get_line_breaks(replaceAll(originalContentTB,String.fromCharCode(8203),'')));
/* 653  */ 		inputContent = originalContentIB;
/* 654  */ 		
/* 655  */ 		//insert formatted content
/* 656  */ 		textBox.value = textContent;
/* 657  */ 		inputBox.value = inputContent;
/* 658  */ 		
/* 659  */ 		//inject ipe boxes
/* 660  */ 		$$('#dynMsgPrefix', '#messageLabels', '#'+itId, '#'+ttId).addClass('nodisplay');
/* 661  */ 		inputBox.injectAfter(document.id(itId));
/* 662  */ 		formBox.injectAfter(document.id(ttId));
/* 663  */ 		document.id('starter-input-ipe').addClass('input_focus_border');
/* 664  */ 		document.id('starter-text-ipe').addClass('input_focus_border');
/* 665  */ 	};
/* 666  */ 	
/* 667  */ 	//start all init args
/* 668  */ 	//add ipe events
/* 669  */ 	$$('#'+ttId, '#'+itId).addEvents({
/* 670  */ 		mouseover: function(){ this.addClass('over'); },
/* 671  */ 		mouseout: function(){ this.removeClass('over'); },
/* 672  */ 		click: show_edit_box
/* 673  */ 	});
/* 674  */ 	
/* 675  */ 	//init starter edit timer
/* 676  */ 	timer.start();
/* 677  */ };
/* 678  */ 
/* 679  */ function submitForm(){
/* 680  */ 	var form_action = '/comments/add/type:1/assoc_parent:'+poptent_vars.modules.comments.id+'/';
/* 681  */ 	var flver = poptent_helpers.get_flash_version();
/* 682  */ 	if(flver != '') form_action += '?flver='+flver;
/* 683  */ 	document.id('newMsg').setProperty('action',form_action);
/* 684  */ 	document.id('newMsg').set('send',{
/* 685  */ 		onRequest: function(){document.id('newMsgLoader').setStyle('visibility','visible');},
/* 686  */ 		onComplete: function() {
/* 687  */ 			clearMessage();
/* 688  */ 			document.id('newMsgLoader').setStyle('visibility','hidden');
/* 689  */ 			messageTextResizer.reset();
/* 690  */ 		},
/* 691  */ 		onFailure: function(){
/* 692  */ 			alert('Sorry, this thread has been recently locked and is not accepting new comments');
/* 693  */ 			document.id('newMsgLoader').setStyle('visibility','hidden');
/* 694  */ 		}
/* 695  */ 	});
/* 696  */ 	document.id('newMsg').send();
/* 697  */ };
/* 698  */ 
/* 699  */ function setRandId(info){
/* 700  */ 	newUploadUrl = '/uploadr/comment_file/id:'+poptent_vars.modules.comments.id+'/assoc_rand:'+info.randId+'?'+session_key+'='+get_session_val();

/* discussions.js */

/* 701  */ 	poptent_vars.modules.upload.instances.fileUpload.setUploadURL(newUploadUrl);
/* 702  */ 	document.id('uploadRand').value=info.randId;
/* 703  */ 	poptent_vars.modules.upload.instances.fileUpload.startUpload();
/* 704  */ };
/* 705  */ 
/* 706  */ function clearMessage(){
/* 707  */ 	try { poptent_vars.modules.upload.instances.fileUpload.cancelQueue(); } catch (e) {};
/* 708  */ 	if(document.id('messagetext')){
/* 709  */ 		document.id('messagetext').set('value','');
/* 710  */ 		utility_helper.remove_default_msg('0-inputField', 'Click here to add a message');
/* 711  */ 		//document.id('messagetext').addClass('defaultText');
/* 712  */ 	}
/* 713  */ 	document.id('uploadRand').value='';
/* 714  */ 	if(thisComments.pageNum != 1){
/* 715  */ 		thisComments.pageNum=1;
/* 716  */ 		thisComments.clearComments();
/* 717  */ 	}
/* 718  */ 	thisComments.checkNewComments();
/* 719  */ };
/* 720  */ 
/* 721  */ 
/* 722  */ var thread_handlers = {
/* 723  */ 	'lock': function(e,target){
/* 724  */ 		var cItem;
/* 725  */ 		var cVar;
/* 726  */ 		if(target.id=='threadLocked_off'){
/* 727  */ 			cItem = document.id('threadLocked_on');
/* 728  */ 			cVar = 1;
/* 729  */ 		}else{
/* 730  */ 			cItem = document.id('threadLocked_off');
/* 731  */ 			cVar = 0;
/* 732  */ 		}
/* 733  */ 		try{ new Event(e).preventDefault(); }catch(er){};
/* 734  */ 		if(cItem.getParent() && cItem.getParent().getElement('.list-loader')) cItem.getParent().getElement('.list-loader').setStyle('display', 'block');
/* 735  */ 		new Request({
/* 736  */ 			url: '/messages/settings/'+poptent_vars.modules.comments.id+'/1/'+cVar, 
/* 737  */ 			method: 'get',
/* 738  */ 			onComplete: function(){
/* 739  */ 				$$('.commentMsgArea').addClass('nodisplay');
/* 740  */ 				if(cVar==0){
/* 741  */ 					$$('.replylink-container','#newMsgWrapper').removeClass('nodisplay');
/* 742  */ 					if(document.id('commentStatusBlock')) document.id('commentStatusBlock').addClass('nodisplay');
/* 743  */ 					poptent_helpers.show_notification('Comments have been enabled in this discussion', 'success', 300);
/* 744  */ 				}else{
/* 745  */ 					$$('.replylink-container','#newMsgWrapper').addClass('nodisplay');
/* 746  */ 					if(document.id('commentStatusBlock')) document.id('commentStatusBlock').removeClass('nodisplay');
/* 747  */ 					poptent_helpers.show_notification('Comments have been disabled in this discussion', 'success', 300);
/* 748  */ 				}
/* 749  */ 				if(target.id=='threadLockedButton'){
/* 750  */ 					document.id('threadLocked_on').removeClass('active');

/* discussions.js */

/* 751  */ 				}else{
/* 752  */ 					target.removeClass('active');
/* 753  */ 				}
/* 754  */ 				target.removeClass('active');
/* 755  */ 				cItem.addClass('active');
/* 756  */ 				cItem.getParent().getElement('.list-loader').setStyle('display', 'none');
/* 757  */ 			}
/* 758  */ 		}).send();
/* 759  */ 	},
/* 760  */ 	'archive': function(e,target){
/* 761  */ 		var cItem;
/* 762  */ 		var cVar;
/* 763  */ 		if(target.id=='threadArchive_on'){
/* 764  */ 			cItem = document.id('threadArchive_off');
/* 765  */ 			cVar = 0;
/* 766  */ 		}else{
/* 767  */ 			cItem = document.id('threadArchive_on');
/* 768  */ 			cVar = 1;
/* 769  */ 		}
/* 770  */ 		try{ new Event(e).preventDefault(); }catch(er){};
/* 771  */ 		if(cItem.getParent() && cItem.getParent().getElement('.list-loader')) cItem.getParent().getElement('.list-loader').setStyle('display', 'block');
/* 772  */ 		new Request({
/* 773  */ 			url: '/messages/mysettings/'+poptent_vars.modules.comments.id+'/1/'+cVar, 
/* 774  */ 			method: 'get',
/* 775  */ 			onComplete: function(){
/* 776  */ 				if(
/* 777  */ 					typeof poptent_vars.modules.discussions.cache !== 'undefined' && 
/* 778  */ 					poptent_vars.modules.discussions.cache.timed_get && 
/* 779  */ 					poptent_vars.modules.comments.id
/* 780  */ 				){
/* 781  */ 					var oldkey = poptent_vars.modules.discussions.cache.timed_get(poptent_vars.modules.comments.id);
/* 782  */ 					var newkey = oldkey[1];
/* 783  */ 					if(!newkey) newkey = {};
/* 784  */ 					newkey.isArchived = cVar;
/* 785  */ 					poptent_vars.modules.discussions.cache.timed_set(poptent_vars.modules.comments.id,newkey,120);
/* 786  */ 				}
/* 787  */ 				
/* 788  */ 				if(cVar==1){
/* 789  */ 					poptent_helpers.show_notification('This discussion has been archived', 'success', 300);
/* 790  */ 					(function(){
/* 791  */ 						var searchperpagevalue = Cookie.read('searchperpagevalue');
/* 792  */ 						var to_loc = (searchperpagevalue) ? '/search/discussions/1/'+searchperpagevalue+'?mstatus=1' : '/search/discussions/?mstatus=1';
/* 793  */ 						if(poptent_vars.referrer != '' && poptent_vars.referrer.indexOf('poptent.net/search/discussions/', 0) !== -1) to_loc = poptent_vars.referrer;
/* 794  */ 						window.location = to_loc;
/* 795  */ 					}).delay(4000);
/* 796  */ 				}else{
/* 797  */ 					target.removeClass('active');
/* 798  */ 					cItem.addClass('active');
/* 799  */ 					poptent_helpers.show_notification('This discussion has been un-archived', 'success', 300);
/* 800  */ 					cItem.getParent().getElement('.list-loader').setStyle('display', 'none');

/* discussions.js */

/* 801  */ 				}
/* 802  */ 			}
/* 803  */ 		}).send();
/* 804  */ 	},
/* 805  */ 	'notify': function(e,target){
/* 806  */ 		var cItem;
/* 807  */ 		var cVar;
/* 808  */ 		if(target.id=='threadNotify_on'){
/* 809  */ 			cItem = document.id('threadNotify_off');
/* 810  */ 			cVar = 0;
/* 811  */ 		}else{
/* 812  */ 			cItem = document.id('threadNotify_on');
/* 813  */ 			cVar = 1;
/* 814  */ 		}
/* 815  */ 		try{ new Event(e).preventDefault(); }catch(er){};
/* 816  */ 		if(cItem.getParent() && cItem.getParent().getElement('.list-loader')) cItem.getParent().getElement('.list-loader').setStyle('display', 'block');
/* 817  */ 		new Request({
/* 818  */ 			url: '/messages/mysettings/'+poptent_vars.modules.comments.id+'/2/'+cVar, 
/* 819  */ 			method: 'get',
/* 820  */ 			onComplete: function(){
/* 821  */ 				target.removeClass('active');
/* 822  */ 				cItem.addClass('active');
/* 823  */ 				var discussionItem;
/* 824  */ 				if(
/* 825  */ 					typeof poptent_vars.modules.discussions.cache !== 'undefined' && 
/* 826  */ 					poptent_vars.modules.discussions.cache.timed_get && 
/* 827  */ 					poptent_vars.modules.comments.id
/* 828  */ 				){
/* 829  */ 					var oldkey = poptent_vars.modules.discussions.cache.timed_get(poptent_vars.modules.comments.id);
/* 830  */ 					var newkey = oldkey[1];
/* 831  */ 					if(!newkey) newkey = {};
/* 832  */ 					newkey.isNotify = cVar;
/* 833  */ 					poptent_vars.modules.discussions.cache.timed_set(poptent_vars.modules.comments.id,newkey,120);
/* 834  */ 				}
/* 835  */ 				poptent_helpers.show_notification('Email notifications have been '+((cVar==0)?'disabled':'enabled')+' for this discussion.', 'success', 300);
/* 836  */ 				cItem.getParent().getElement('.list-loader').setStyle('display', 'none');
/* 837  */ 			}
/* 838  */ 		}).send();
/* 839  */ 	},
/* 840  */ 	'expire': function(e,target){
/* 841  */ 		var cItem;
/* 842  */ 		var cVar;
/* 843  */ 		if(target.id=='threadForceExpire_on'){
/* 844  */ 			cItem = document.id('threadForceExpire_off');
/* 845  */ 			cVar = 0;
/* 846  */ 		}else{
/* 847  */ 			cItem = document.id('threadForceExpire_on');
/* 848  */ 			cVar = 1;
/* 849  */ 		}
/* 850  */ 		try{ new Event(e).preventDefault(); }catch(er){};

/* discussions.js */

/* 851  */ 		if(cItem.getParent() && cItem.getParent().getElement('.list-loader')) cItem.getParent().getElement('.list-loader').setStyle('display', 'block');
/* 852  */ 		new Request({
/* 853  */ 			url: '/messages/bulletin/'+poptent_vars.modules.comments.id+'/1/'+cVar, 
/* 854  */ 			method: 'get',
/* 855  */ 			onComplete: function(){
/* 856  */ 				target.removeClass('active');
/* 857  */ 				cItem.addClass('active');
/* 858  */ 				cItem.getParent().getElement('.list-loader').setStyle('display', 'none');
/* 859  */ 				window.location.reload();
/* 860  */ 			}
/* 861  */ 		}).send();
/* 862  */ 	},
/* 863  */ 	'expand': function(e,target){
/* 864  */ 		var cItem;
/* 865  */ 		var cVar;
/* 866  */ 		if(target.id=='threadExpand_on'){
/* 867  */ 			cItem = document.id('threadExpand_off');
/* 868  */ 			cVar = 0;
/* 869  */ 		}else{
/* 870  */ 			cItem = document.id('threadExpand_on');
/* 871  */ 			cVar = 1;
/* 872  */ 		}
/* 873  */ 		try{ new Event(e).preventDefault(); }catch(er){};
/* 874  */ 		if(cVar){
/* 875  */ 			$$('div#comments .hideRepliesLink').each(function(el){
/* 876  */ 			  	if(!el.getProperty('id')) el.setProperty('id',poptent_helpers.mock_id());
/* 877  */ 				var tId = el.getProperty('id');  
/* 878  */ 				poptent_helpers.simulateEvent('click', tId);
/* 879  */ 			});
/* 880  */ 			thisComments.collapseAllComments();
/* 881  */ 		}else{
/* 882  */ 			thisComments.expandAllComments();
/* 883  */ 		}
/* 884  */ 		target.removeClass('active');
/* 885  */ 		cItem.addClass('active');
/* 886  */ 	},
/* 887  */ 	'pubpriv': function(e,target){
/* 888  */ 		var cItem;
/* 889  */ 		var cVar;
/* 890  */ 		var cIcon = document.id('dynMsgPublicX');
/* 891  */ 		if(target.id=='threadPublic_on'){
/* 892  */ 			cItem = document.id('threadPublic_off');
/* 893  */ 			cVar = 0;
/* 894  */ 		}else{
/* 895  */ 			cItem = document.id('threadPublic_on');
/* 896  */ 			cVar = 1;
/* 897  */ 		}
/* 898  */ 		try{ new Event(e).preventDefault(); }catch(er){};
/* 899  */ 		if(cItem.getParent() && cItem.getParent().getElement('.list-loader')) cItem.getParent().getElement('.list-loader').setStyle('display', 'block');
/* 900  */ 		new Request({

/* discussions.js */

/* 901  */ 			url: '/messages/settings/'+poptent_vars.modules.comments.id+'/2/'+cVar, 
/* 902  */ 			method: 'get',
/* 903  */ 			onComplete: function(){
/* 904  */ 				target.removeClass('active');
/* 905  */ 				cItem.addClass('active');
/* 906  */ 				if(cIcon) cIcon.setStyle('display',((cVar==1)?'block':'none'));
/* 907  */ 				poptent_helpers.show_notification('This discussion is now '+((cVar==1)?'public. So anyone can join!':'private.'), 'success', 300);
/* 908  */ 				cItem.getParent().getElement('.list-loader').setStyle('display', 'none');
/* 909  */ 			}
/* 910  */ 		}).send();
/* 911  */ 	},
/* 912  */ 	'del': function(e,target){
/* 913  */ 		var cItem;
/* 914  */ 		var cVar;
/* 915  */ 		var cIcon = document.id('dynMsgPublicX');
/* 916  */ 		if(target.id=='threadDelete_off'){
/* 917  */ 			cItem = document.id('threadDelete_on');
/* 918  */ 			cVar = 1;
/* 919  */ 		}else{
/* 920  */ 			cItem = document.id('threadDelete_off');
/* 921  */ 			cVar = 0;
/* 922  */ 		}
/* 923  */ 		try{ new Event(e).preventDefault(); }catch(er){};
/* 924  */ 		if(cVar==1){
/* 925  */ 			var answer = confirm('Are you sure you want to delete this discussion?');
/* 926  */ 			if(!answer) return;
/* 927  */ 		}
/* 928  */ 		if(cItem.getParent() && cItem.getParent().getElement('.list-loader')) cItem.getParent().getElement('.list-loader').setStyle('display', 'block');
/* 929  */ 		new Request({
/* 930  */ 			url: '/messages/settings/'+poptent_vars.modules.comments.id+'/3/'+cVar, 
/* 931  */ 			method: 'get',
/* 932  */ 			onComplete: function(resp){
/* 933  */ 				$$('.commentMsgArea').addClass('nodisplay');
/* 934  */ 				if(cVar==0){
/* 935  */ 					$$('#newMsgWrapper', '#commentsWrap-'+poptent_vars.modules.comments.id).removeClass('nodisplay');
/* 936  */ 					poptent_helpers.show_notification('This discussion has been undeleted.', 'success', 300);
/* 937  */ 				}else{
/* 938  */ 					$$('#newMsgWrapper', '#commentsWrap-'+poptent_vars.modules.comments.id).addClass('nodisplay');
/* 939  */ 					document.id('undeleteStatusBlock').removeClass('nodisplay');
/* 940  */ 					poptent_helpers.show_notification('This discussion has been deleted.', 'success', 300);
/* 941  */ 				}
/* 942  */ 				
/* 943  */ 				if(target.id=='threadDeleteButton'){
/* 944  */ 					document.id('threadDelete_on').removeClass('active');
/* 945  */ 				}else{
/* 946  */ 					target.removeClass('active');
/* 947  */ 				}
/* 948  */ 				cItem.addClass('active');
/* 949  */ 				cItem.getParent().getElement('.list-loader').setStyle('display', 'none');
/* 950  */ 			}

/* discussions.js */

/* 951  */ 		}).send();
/* 952  */ 	},
/* 953  */ 	'change_type': function(e,target){
/* 954  */ 		var selectedText = target.options[target.selectedIndex].innerHTML;
/* 955  */ 		var answer = confirm('Are you sure you want to change the type this discussion to '+selectedText+'?');
/* 956  */ 		if(!answer) return;
/* 957  */ 		var cItem = target;
/* 958  */ 		var cVar = target.value;
/* 959  */ 		if(cItem.getParent() && cItem.getParent().getParent() && cItem.getParent().getParent().getElement('.list-loader')){
/* 960  */ 			cItem.getParent().getParent().getElement('.list-loader').setStyle('display', 'block');
/* 961  */ 		}
/* 962  */ 		new Request({
/* 963  */ 			url: '/messages/settings/'+poptent_vars.modules.comments.id+'/4/'+cVar, 
/* 964  */ 			method: 'get',
/* 965  */ 			onComplete: function(resp){
/* 966  */ 				resp=JSON.decode(resp);
/* 967  */ 				var cOptions = {
/* 968  */ 					0: { prefix: '', msgClass: '' }, 
/* 969  */ 					4: { prefix: 'Revision request: ', msgClass: 'revision-request' }, 
/* 970  */ 					7: { prefix: 'Bug Report: ', msgClass: 'bug-report' }, 
/* 971  */ 					8: { prefix: 'Feature Request: ', msgClass: 'feature-request' },  
/* 972  */ 					9: { prefix: 'Known Issues: ', msgClass: 'known-issues' },
/* 973  */ 					10: { prefix: 'Known Issues: ', msgClass: 'bounce-request' }
/* 974  */ 				};
/* 975  */ 				$each(cOptions, function(v,i){
/* 976  */ 					document.id('dynMsgContainer').removeClass(v.msgClass);
/* 977  */ 					document.id('dynMsgTitle').getElement('.mtt').removeClass('mtt_'+i); 
/* 978  */ 				});
/* 979  */ 				document.id('dynMsgContainer').addClass(cOptions[cVar]['msgClass']);
/* 980  */ 				document.id('dynMsgTitle').getElement('.mtt').addClass('mtt_'+cVar).set('text', cOptions[cVar]['prefix']);
/* 981  */ 				document.title = 'Poptent :: Discussion #'+poptent_vars.modules.comments.id+' - '+cOptions[cVar]['prefix']+resp.title;
/* 982  */ 				poptent_helpers.show_notification('This discussion type has been changed successfully.', 'success', 300);
/* 983  */ 				cItem.getParent().getParent().getElement('.list-loader').setStyle('display', 'none');
/* 984  */ 			}
/* 985  */ 		}).send();
/* 986  */ 	},
/* 987  */ 	'join': function(e,target){
/* 988  */ 		var cItem;
/* 989  */ 		var cVar;
/* 990  */ 		if(target.id=='threadJoin_off'){
/* 991  */ 			cItem = document.id('threadJoin_on');
/* 992  */ 			cVar = 1;
/* 993  */ 		}else{
/* 994  */ 			cItem = document.id('threadJoin_off');
/* 995  */ 			cVar = 0;
/* 996  */ 		}
/* 997  */ 		try{ new Event(e).preventDefault(); }catch(er){};
/* 998  */ 		if(cItem.getParent() && cItem.getParent().getElement('.list-loader')) cItem.getParent().getElement('.list-loader').setStyle('display', 'block');
/* 999  */ 		new Request({
/* 1000 */ 			url: '/messages/managepublic/'+poptent_vars.modules.comments.id+'/'+cVar+'/', 

/* discussions.js */

/* 1001 */ 			method: 'get',
/* 1002 */ 			onComplete: function(resp){
/* 1003 */ 				$$('.commentMsgArea').addClass('nodisplay');
/* 1004 */ 				if(cVar==0){
/* 1005 */ 					if(resp==0){
/* 1006 */ 						$$('#newMsgWrapper', '.slabels').removeClass('nodisplay');
/* 1007 */ 						$$('#threadArchive'/*, '#threadNotify'*/).removeClass('disabled');
/* 1008 */ 						thisComments.replies_enable();
/* 1009 */ 						poptent_helpers.show_notification('You are now a member of this discussion.', 'success', 300);
/* 1010 */ 					}else if(resp==1){
/* 1011 */ 						poptent_helpers.show_notification('You are already a member of this discussion.', 'success', 300);
/* 1012 */ 					}
/* 1013 */ 				}else{
/* 1014 */ 					$$('#newMsgWrapper', '.slabels').addClass('nodisplay');
/* 1015 */ 					$$('#threadArchive'/*, '#threadNotify'*/).addClass('disabled');
/* 1016 */ 					thisComments.replies_disable();
/* 1017 */ 					document.id('publicStatusBlock').removeClass('nodisplay');
/* 1018 */ 					poptent_helpers.show_notification('You are no longer a member of this discussion.', 'success', 300);
/* 1019 */ 				}
/* 1020 */ 				
/* 1021 */ 				membersInit.refresh();
/* 1022 */ 				if(target.id=='joinDiscButton'){
/* 1023 */ 					document.id('threadJoin_on').removeClass('active');
/* 1024 */ 				}else{
/* 1025 */ 					target.removeClass('active');
/* 1026 */ 				}
/* 1027 */ 				cItem.addClass('active');
/* 1028 */ 				cItem.getParent().getElement('.list-loader').setStyle('display', 'none');
/* 1029 */ 			}
/* 1030 */ 		}).send();
/* 1031 */ 	}
/* 1032 */ };

;
/* assets.js */

/* 1    */ function chDefault(imgId){
/* 2    */ 	//alert('chDefault called '+imgId);
/* 3    */ 	if(assetType != 'video'){
/* 4    */ 		if(loadedAssetImages.has(imgId)){
/* 5    */ 			var jsonObj = loadedAssetImages.get(imgId);
/* 6    */ 			if(document.id('imgwrap')){
/* 7    */ 				document.id('imgwrap').empty();
/* 8    */ 				new Asset.image(jsonObj.lglocation).injectInside('imgwrap');
/* 9    */ 			}else if(document.id('vidwrap')){
/* 10   */ 				if(document.id(poptent_vars.modules.player.id)) try{ swfobject.getObjectById(poptent_vars.modules.player.id).sendEvent("LOAD",poptent_vars.modules.player.playlist_url); } catch(er){};
/* 11   */ 			}
/* 12   */ 		}else{
/* 13   */ 			thumb_request = new Request.JSON({
/* 14   */ 				url: '/assets/thumbinfo/'+imgId+'/', 
/* 15   */ 				method: 'get',
/* 16   */ 				noCache: true,
/* 17   */ 				onComplete: function(jsonObj){
/* 18   */ 					loadedAssetImages.set(imgId,jsonObj);
/* 19   */ 					if(document.id('imgwrap')){
/* 20   */ 						document.id('imgwrap').empty();
/* 21   */ 						new Asset.image(jsonObj.lglocation).injectInside('imgwrap');
/* 22   */ 					}else if(document.id('vidwrap')){
/* 23   */ 						if(document.id(poptent_vars.modules.player.id)) try{ swfobject.getObjectById(poptent_vars.modules.player.id).sendEvent("LOAD",poptent_vars.modules.player.playlist_url); } catch(er){};
/* 24   */ 					}
/* 25   */ 				}
/* 26   */ 			}).send();
/* 27   */ 		}
/* 28   */ 	}
/* 29   */ }
/* 30   */ 
/* 31   */ function onAttachmentUploadComplete() {
/* 32   */ 	new Request({
/* 33   */ 		url: '/api/getnewestattachment/0/'+poptent_vars.current_page.asset.id,
/* 34   */ 		method: 'get',
/* 35   */ 		onError: function() {
/* 36   */ 		poptent_helpers.show_notification('Adding attachment failed','error');
/* 37   */ 		},
/* 38   */ 		onComplete: function(result){
/* 39   */ 			var json = (result) ? json=JSON.decode(result) : 0;
/* 40   */ 			if(json){
/* 41   */ 				if(json.status==0){
/* 42   */ 					var newElement = new Element('li', {'id': 'assetAttachment_'+json.id, 'html': '<ul>'+
/* 43   */ 						'<li class="ver">'+
/* 44   */ 							'<span class="sprite mediaIcons '+poptent_vars.modules.attach.types[json.type]+'" style="margin-right: 5px;"></span>'+
/* 45   */ 						'</li>'+
/* 46   */ 						'<li class="comment">'+
/* 47   */ 							'<span class="name">'+json.name+'</span>'+
/* 48   */ 							'<span class="date">'+
/* 49   */ 									'Uploaded:&nbsp;&nbsp;'+json.uploaded+'.<br/>'+
/* 50   */ 							'</span>'+

/* assets.js */

/* 51   */ 							'<span class="commentText"></span>'+
/* 52   */ 						'</li>'+
/* 53   */ 						'<li class="download">'+
/* 54   */ 							'<a href="/api/getattachmentsource/'+json.assetId+'/'+json.id+'/">'+
/* 55   */ 								'<img src="'+(poptent_helpers.add_image_base('assetControlIcons/download.gif'))+'" class="tips-attachment_download-1" alt="Download Media for this attachment"/>'+
/* 56   */ 							'</a>'+
/* 57   */ 						'</li>'+
/* 58   */ 						'<li class="delete">'+
/* 59   */ 							'<a rel="'+json.id+'" href="#" class="deleteFileAttachment">'+
/* 60   */ 								'<img src="'+(poptent_helpers.add_image_base('assetControlIcons/delete.gif'))+'" class="tips-attachment_delete-1" alt="Delete This Attachment"/>'+
/* 61   */ 							'</a>'+
/* 62   */ 						'</li>'+                     
/* 63   */ 						'<li class="clear"></li>'+
/* 64   */ 					'</ul>'
/* 65   */ 					});
/* 66   */ 					
/* 67   */ 					attachDeleteEvent(newElement.getElement('a.deleteFileAttachment'), 'attachment');
/* 68   */ 					newElement.injectTop('assetAttachmentsList');
/* 69   */ 					mooipeInit($$('#assetAttachment_'+ json.id +' li.comment span.commentText')[0], '/api/editattachment/' + json.id + '/',{'rows': 60, 'hideSavingText': 1, 'defaultText': 'click here to enter comment', 'loading_image': 'loaders/ajax-loader-blue-on-gray.gif'});
/* 70   */ 				}else{
/* 71   */ 					poptent_helpers.show_notification('Adding attachment failed, please try again!','error');
/* 72   */ 				}
/* 73   */ 			}
/* 74   */ 		}
/* 75   */ 	}).send();
/* 76   */ }
/* 77   */ 
/* 78   */ 
/* 79   */ function addNewVersion(isMedia) {
/* 80   */ 	new Request({
/* 81   */ 		url: '/assets/getnewestversion/'+poptent_vars.current_page.asset.id,
/* 82   */ 		method: 'get',
/* 83   */ 		onError: function() {
/* 84   */ 		poptent_helpers.show_notification('Returning new draft failed','error');
/* 85   */ 		},
/* 86   */ 		onComplete: function(result){
/* 87   */ 			var json = 0;
/* 88   */ 			if(result){
/* 89   */ 				json=JSON.decode(result);
/* 90   */ 			}
/* 91   */ 			if(json){
/* 92   */ 				if(isMedia==0){
/* 93   */ 					$$('#assetVersionsList ul.current').removeClass('current');
/* 94   */ 					var newElement = new Element('li', { 'id': 'assetVersion_'+json.versionId, 'html': ('<ul class="current">'+
/* 95   */ 						'<li class="ver">'+
/* 96   */ 							'<small>v</small>'+json.revisionNumber+'.'+
/* 97   */ 						'</li>'+
/* 98   */ 						'<li class="comment">'+
/* 99   */ 							'<span class="commentText">Enter comment here</span>'+
/* 100  */ 							'<span class="date">'+

/* assets.js */

/* 101  */ 								'<b>'+json.name+'</b><br>'+
/* 102  */ 							'</span>'+
/* 103  */ 							'<span class="date">'+
/* 104  */ 								'Uploaded:&nbsp;&nbsp;'+json.uploaded+'.<br/>'+
/* 105  */ 							'</span>'+
/* 106  */ 						'</li>'+
/* 107  */ 						'<li class="download">'+
/* 108  */ 							'<a href="/assets/getversionsource/'+json.assetId+'/'+json.versionId+'/">'+
/* 109  */ 								'<img src="'+(poptent_helpers.add_image_base('assetControlIcons/download.gif'))+'" class="tips-draft_download-1" alt="Download Media for this draft"/>'+
/* 110  */ 							'</a>'+
/* 111  */ 						'</li>'+
/* 112  */ 						((poptent_vars.current_page.owner_can_edit>0)?(
/* 113  */ 						'<li class="delete">'+
/* 114  */ 							'<a rel="'+json.versionId+'" href="#" class="deleteFileVersion_enabled">'+
/* 115  */ 								'<img src="'+(poptent_helpers.add_image_base('assetControlIcons/delete.gif'))+'" class="tips-draft_delete-1" alt="Delete This Draft"/>'+
/* 116  */ 							'</a>'+
/* 117  */ 							'<a href="#" id="deleteFileVersion" class="deleteFileVersion_disabled" style="cursor: default;">'+
/* 118  */ 								'<img src="'+(poptent_helpers.add_image_base('assetControlIcons/delete_disabled.gif'))+'" class="tips-draft_delete_disabled-1" alt="Delete This Draft"/>'+
/* 119  */ 							'</a>'+
/* 120  */ 						'</li>'
/* 121  */ 						):'')+
/* 122  */ 						'<li class="setdefault">'+
/* 123  */ 							'<a rel="'+json.versionId+'" href="#" class="setDefault_enabled">'+
/* 124  */ 								'<img src="'+(poptent_helpers.add_image_base('assetControlIcons/setdefault_disabled.gif'))+'" class="tips-draft_default-1" alt="Set this Draft as the Default"/>'+
/* 125  */ 							'</a>'+
/* 126  */ 							'<a href="#" class="setDefault_disabled">'+
/* 127  */ 								'<img src="'+(poptent_helpers.add_image_base('assetControlIcons/setdefault.gif'))+'" class="tips-draft_default_disabled-1" alt="Set this Draft as the Default"/>'+
/* 128  */ 							'</a>'+
/* 129  */ 						'</li>'+                       
/* 130  */ 						'<li class="clear"></li>'+
/* 131  */ 					'</ul>'
/* 132  */ 					)});
/* 133  */ 					
/* 134  */ 					if(poptent_vars.current_page.owner_can_edit>0) attachDeleteEvent(newElement.getElement('a.deleteFileVersion_enabled'));
/* 135  */ 					attachSetDefaultEvent(newElement.getElement('a.setDefault_enabled'));
/* 136  */ 					
/* 137  */ 					newElement.injectTop('assetVersionsList');
/* 138  */ 					mooipeInit($$('#assetVersion_'+ json.versionId +' li.comment span.commentText')[0], '/assets/saveattribute/text/versioncomment/'+ json.assetId +'/'+json.versionId+'/',{'rows': 60, 'hideSavingText': 1, 'defaultText': 'Enter comment here'});
/* 139  */ 				}
/* 140  */ 				if(
/* 141  */ 					uploadr.isencoding[poptent_vars.modules.upload.instances.fileUpload.customSettings.instance]==0 || 
/* 142  */ 					(isMedia==1 && uploadr.isencoding[poptent_vars.modules.upload.instances.fileUpload.customSettings.instance]==1)
/* 143  */ 				){
/* 144  */ 					(function() { 
/* 145  */ 						try { poptent_vars.modules.upload.instances.fileUpload.cancelQueue(); } catch (e) {};
/* 146  */ 						thumbsInit.refresh();
/* 147  */ 					}).delay(100);
/* 148  */ 				}
/* 149  */ 				
/* 150  */ 				if (document.id('vidwrap')){

/* assets.js */

/* 151  */ 					//swfobject.getObjectById(poptent_vars.modules.player.id).sendEvent('LOAD', poptent_vars.modules.player.playlist_url);
/* 152  */ 				}else if(document.id('imgwrap')){
/* 153  */ 					new Asset.image(json.thumb_large, {
/* 154  */ 						onload: function(){
/* 155  */ 							document.id('imgwrap').getElement('img').setProperty('src', json.thumb_large);
/* 156  */ 						}
/* 157  */ 					});
/* 158  */ 				}
/* 159  */ 			}
/* 160  */ 		}
/* 161  */ 	}).send();
/* 162  */ }
/* 163  */ 
/* 164  */ var myFacebox;
/* 165  */ window.addEvent(poptent_vars.load_event, function(){
/* 166  */ 	if(document.id('profile') && document.id('profile').hasClass('mediaProfile')){
/* 167  */ 		if(document.id('mediaAwards')){
/* 168  */ 			$$('.awardToggle').each(function(el){
/* 169  */ 				el.addEvent('click', function(e){
/* 170  */ 					new Event(e).stop();
/* 171  */ 					if(document.id('awardToggle').hasClass('close')){
/* 172  */ 						document.id('awardBox').removeClass('nodisplay');
/* 173  */ 						document.id('awardToggle').removeClass('close').addClass('open');
/* 174  */ 					}else{
/* 175  */ 						document.id('awardBox').addClass('nodisplay');
/* 176  */ 						document.id('awardToggle').removeClass('open').addClass('close');
/* 177  */ 					}
/* 178  */ 				});
/* 179  */ 			});
/* 180  */ 			
/* 181  */ 			var a_t = document.id('awardType');
/* 182  */ 			if(a_t){
/* 183  */ 				a_t.addEvent('change', function(e){
/* 184  */ 					try{ new Event(e).stop(); }catch(er){};
/* 185  */ 					var sp = this.value.split('|');
/* 186  */ 					switch(sp[0].toInt()){
/* 187  */ 						case 0: 
/* 188  */ 							if(typeof sp[2] != 'undefined'){
/* 189  */ 								switch(sp[2].toInt()){
/* 190  */ 									case 0: document.id('awardMedal').set('class', 'prize'); break;
/* 191  */ 									case 1: document.id('awardMedal').set('class', 'purchased'); break;
/* 192  */ 									case 2: document.id('awardMedal').set('class', 'prize'); break;
/* 193  */ 									default: document.id('awardMedal').set('class', 'hidden');
/* 194  */ 								}
/* 195  */ 							}else{
/* 196  */ 								document.id('awardMedal').addClass('hidden');
/* 197  */ 							}
/* 198  */ 						break;
/* 199  */ 						case 1: document.id('awardMedal').set('class', 'mention'); break;
/* 200  */ 						case 2: document.id('awardMedal').set('class', 'finalist'); break;

/* assets.js */

/* 201  */ 						default: document.id('awardMedal').set('class', 'hidden');
/* 202  */ 					}
/* 203  */ 				});
/* 204  */ 			}
/* 205  */ 			a_t = null;
/* 206  */ 			
/* 207  */ 			add_award_delete_event();
/* 208  */ 		}
/* 209  */ 		
/* 210  */ 		document.id('assetControlContents').getElements('a.bounceasset').addEvent('click', function (e) {
/* 211  */ 			try { new Event(e).stop(); } catch (er) {};
/* 212  */ 			
/* 213  */ 			var answer = confirm("Are you sure you want to bounce this media?");
/* 214  */ 			if (answer) {
/* 215  */ 				new Request({
/* 216  */ 					url: '/assets/bounceasset/' + poptent_vars.current_page.asset.id + '/', 
/* 217  */ 					onComplete: function (json) {
/* 218  */ 						try{ json = JSON.decode(json); }catch(er){ };
/* 219  */ 		    			if (json) {
/* 220  */ 							if (json.e==0) {
/* 221  */ 								if (json.s==1) {
/* 222  */ 									//this.getParent().destroy();
/* 223  */ 									//document.id('assetVersionsListWrap').removeClass('hidden');
/* 224  */ 									poptent_helpers.show_notification('This media was bounced successfully.','success');
/* 225  */ 								} else {
/* 226  */ 									//new Element('span', {html: 'Your bounce request has been received, however because the assignment has expired a staff member must approve the request.'}).replaces(this);
/* 227  */ 									poptent_helpers.show_notification('A bounce request was created successfully.','success');
/* 228  */ 								}
/* 229  */ 								window.location.reload();
/* 230  */ 							} else if (json.e==1 || json.e==2) {
/* 231  */ 								poptent_helpers.show_notification('Sorry, there has been an error. Please try again!','error');
/* 232  */ 							} else if(json.e==3 || json.e==4) {
/* 233  */ 								//this.getParent().addClass('hidden');
/* 234  */ 								//document.id('assetVersionsListWrap').removeClass('hidden');
/* 235  */ 								poptent_helpers.show_notification('This media has already been bounced','error');
/* 236  */ 								window.location.reload();
/* 237  */ 							}
/* 238  */ 		    			} else {
/* 239  */ 		    				poptent_helpers.show_notification('Sorry, there has been an error. Please try again!','error');
/* 240  */ 		    			}
/* 241  */ 					}.bind(this),
/* 242  */ 					onFailure: function (e) {
/* 243  */ 						poptent_helpers.show_notification('Failed to bounce this media!','error');
/* 244  */ 					}
/* 245  */ 				}).send();
/* 246  */ 			}
/* 247  */ 		});
/* 248  */ 	
/* 249  */ 		if(document.id('reencode')) {
/* 250  */ 			if(document.id('reencode').getElement('button.encode')) document.id('reencode').getElement('button.encode').addEvent('click',function(el) {

/* assets.js */

/* 251  */ 				new Event(el).stop();
/* 252  */ 				document.id('encodeform').set('send',{
/* 253  */ 					onComplete: function(){
/* 254  */ 						window.location = ((window.location.href.test('dev'))?'http://dev.poptent.net':'http://www.poptent.net')+'/media/'+poptent_vars.current_page.asset.id;
/* 255  */ 					}
/* 256  */ 				});
/* 257  */ 				document.id('encodeform').send();
/* 258  */ 				//window.location = ((window.location.href.test('dev'))?'http://dev.poptent.net':'http://www.poptent.net')+'/assets/reencode/'+poptent_vars.current_page.asset.id+'/';
/* 259  */ 			});
/* 260  */ 			
/* 261  */ 			if(document.id('reencode').getElement('button.cancel')) document.id('reencode').getElement('button.cancel').addEvent('click', function(e){
/* 262  */ 				try{ new Event(e).stop(); }catch(er){};
/* 263  */ 				document.id('reencodeLink').getParent().removeClass('active');
/* 264  */ 				hideAssetControlBlock('reencode', 'assetControlContents');
/* 265  */ 			});
/* 266  */ 			
/* 267  */ 			if(document.id('reencodeRevisions')) document.id('reencodeRevisions').addEvent('change', function(e) {
/* 268  */ 				try{ new Event(e).stop(); }catch(er){};
/* 269  */ 				if(this.value!='') {
/* 270  */ 					new Request({
/* 271  */ 						url: '/assets/getencodestats/'+poptent_vars.current_page.asset.id+'/'+this.value+'/', 
/* 272  */ 						method: 'get',
/* 273  */ 						onRequest: function() { 
/* 274  */ 							document.id('reencodeLog').value = '';
/* 275  */ 							document.id('reencodeLoader').setStyle('visibility', 'visible');
/* 276  */ 						},
/* 277  */ 						onComplete: function(result) {
/* 278  */ 							document.id('reencodeLoader').setStyle('visibility', 'hidden');
/* 279  */ 							if(result=='') {
/* 280  */ 								poptent_helpers.show_notification('no log exist for this draft!','error');
/* 281  */ 								document.id('reencodeLog').setStyle('display', 'none');
/* 282  */ 							}else{
/* 283  */ 								document.id('reencodeLog').setStyle('display', 'block');
/* 284  */ 								document.id('reencodeLog').value = result;
/* 285  */ 							}	
/* 286  */ 						},
/* 287  */ 						onFailure: function(e) {
/* 288  */ 							document.id('reencodeLoader').setStyle('visibility', 'hidden');
/* 289  */ 							poptent_helpers.show_notification('Failed to get logs of this draft!','error');
/* 290  */ 						}
/* 291  */ 					}).send();
/* 292  */ 				}
/* 293  */ 			});
/* 294  */ 		}
/* 295  */ 	
/* 296  */ 		if(document.id('manageAsset')) {
/* 297  */ 			
/* 298  */ 			document.id('manageAsset').getElement('button.bounce').addEvent('click',function(el) {
/* 299  */ 				new Event(el).stop();
/* 300  */ 				document.id('submissionStatus').setProperty('value', '9');

/* assets.js */

/* 301  */ 				var answer = confirm("Are you sure you want to remove this media from the assignment? This action is not reversible.");
/* 302  */ 				if(answer){
/* 303  */ 					if(document.id('verifyBounce').value==1){
/* 304  */ 						answer = confirm("The assignment has expired. Do you still want to bounce this media??.");
/* 305  */ 					}
/* 306  */ 					if(answer){
/* 307  */ 						poptent_helpers.simulateEvent('submit', document.id('manageAsset').getElement('form'));
/* 308  */ 					}
/* 309  */ 				}
/* 310  */ 			});
/* 311  */ 			
/* 312  */ 			$$('#manageAsset input[name=radioSwitch]').each(function(el) {
/* 313  */ 				el.addEvent('click',function(e){
/* 314  */ 					document.id('submissionStatus').setProperty('value', this.value);				
/* 315  */ 					var el2 = document.id('manageAsset').getElement('form');
/* 316  */ 					if(!el2.getProperty('id')) el2.setProperty('id',poptent_helpers.mock_id());
/* 317  */ 					var tId = el2.getProperty('id');
/* 318  */ 					poptent_helpers.simulateEvent('submit', tId);
/* 319  */ 				});
/* 320  */ 			});
/* 321  */ 			
/* 322  */ 			document.id('manageAsset').getElements('button.cancel').each(function(el){
/* 323  */ 				el.addEvent('click', function(e){
/* 324  */ 					try{ new Event(e).stop(); }catch(er){};
/* 325  */ 					document.id('manageAssetLink').getParent().removeClass('active');
/* 326  */ 					hideAssetControlBlock('manageAsset', 'assetControlContents');
/* 327  */ 				});
/* 328  */ 			});
/* 329  */ 					
/* 330  */ 			document.id('manageAsset').getElement('form').addEvent('submit',function(e){
/* 331  */ 				try{ new Event(e).stop(); }catch(er){};
/* 332  */ 				$$('#manageAsset .indicator')[0].setStyle('visibility','visible');
/* 333  */ 				this.set('send',{
/* 334  */ 					onComplete: function(obj) {
/* 335  */ 						$$('#manageAsset .indicator')[0].setStyle('visibility','hidden');
/* 336  */ 						
/* 337  */ 						obj = JSON.decode(obj);
/* 338  */ 						if(obj.status==1){
/* 339  */ 							if(document.id('submissionStatus').get('value') == 3) {//active
/* 340  */ 								poptent_helpers.show_notification('You just set this Submission to <strong>Active</strong> status','success');
/* 341  */ 								//document.id('manageAsset').getElement('label[for=bounceRadio]').setStyle('font-weight', 'normal');
/* 342  */ 								//document.id('manageAsset').getElement('label[for=finalistRadio]').setStyle('font-weight', 'normal');
/* 343  */ 								document.id('manageAsset').getElements('label').setStyle('font-weight', 'normal');
/* 344  */ 								document.id('manageAsset').getElement('label[for=activeRadio]').setStyle('font-weight', 'bold');
/* 345  */ 							} else if(document.id('submissionStatus').get('value') == 4) {//finalist
/* 346  */ 								poptent_helpers.show_notification('You just set this Submission to <strong>Finalist</strong> status','success');
/* 347  */ 								//document.id('manageAsset').getElement('label[for=activeRadio]').setStyle('font-weight', 'normal');
/* 348  */ 								//document.id('manageAsset').getElement('label[for=bounceRadio]').setStyle('font-weight', 'normal');
/* 349  */ 								document.id('manageAsset').getElements('label').setStyle('font-weight', 'normal');
/* 350  */ 								document.id('manageAsset').getElement('label[for=finalistRadio]').setStyle('font-weight', 'bold');

/* assets.js */

/* 351  */ 							} else if (document.id('submissionStatus').get('value') == 1) {//bounce
/* 352  */ 								poptent_helpers.show_notification('You just set this Submission to <strong>Bounced</strong> status','success');
/* 353  */ 								//document.id('manageAsset').getElement('label[for=activeRadio]').setStyle('font-weight', 'normal');
/* 354  */ 								//document.id('manageAsset').getElement('label[for=finalistRadio]').setStyle('font-weight', 'normal');
/* 355  */ 								document.id('manageAsset').getElements('label').setStyle('font-weight', 'normal');
/* 356  */ 								document.id('manageAsset').getElement('label[for=bounceRadio]').setStyle('font-weight', 'bold');
/* 357  */ 							} else if (document.id('submissionStatus').get('value') == 9) {//remove
/* 358  */ 								poptent_helpers.show_notification('You just <strong>removed</strong> this Submission from assignment','success');
/* 359  */ 								//Closing the tab and removing the unecessary elements from the DOM
/* 360  */ 								document.id('manageAssetLink').getParent().removeClass('active');
/* 361  */ 								hideAssetControlBlock('manageAsset', 'assetControlContents');
/* 362  */ 								document.id('manageAssetLink').getParent().destroy();
/* 363  */ 								document.id('manageAsset').destroy();
/* 364  */ 							}
/* 365  */ 						}else if(obj.status==0){
/* 366  */ 							poptent_helpers.show_notification('Sorry, there has been an error setting the status of this submission','error');	
/* 367  */ 						}else if(obj.status==2){
/* 368  */ 							poptent_helpers.show_notification('Sorry, you have no permission to change this submission status','error');	
/* 369  */ 						}
/* 370  */ 					},
/* 371  */ 					onFailure: function(e){
/* 372  */ 						$$('#manageAsset .indicator')[0].setStyle('visibility','hidden');
/* 373  */ 						poptent_helpers.show_notification('Failed to save status of this media!','error');
/* 374  */ 					}
/* 375  */ 				});
/* 376  */ 				this.send();
/* 377  */ 			});
/* 378  */ 			
/* 379  */ 			document.id('manageAwards').addEvent('submit',function(e){
/* 380  */ 				try{ new Event(e).stop(); }catch(er){};	
/* 381  */ 				var selected_index = document.id('awardType').selectedIndex;
/* 382  */ 				if(document.id('awardType').value != ''){
/* 383  */ 					this.set('send',{
/* 384  */ 						onRequest: function(){ $$('#manageAwards .indicator')[0].setStyle('visibility','visible'); },
/* 385  */ 						onComplete: function(json) {
/* 386  */ 							$$('#manageAwards .indicator')[0].setStyle('visibility','hidden');
/* 387  */ 							json = JSON.decode(json);
/* 388  */ 							if(json.error==0){
/* 389  */ 								if(typeof json.award != 'undefined'){
/* 390  */ 									var m_a_l = document.id('manage-award-list');
/* 391  */ 									if(m_a_l.getParent().hasClass('hidden')) m_a_l.getParent().removeClass('hidden');
/* 392  */ 									new Element('li', { id: 'award-item-' + json.rel[0] + '-' + json.rel[1], 'html': '<span>' + json.award + '</span><a rel="' + json.rel[0] + '|' + json.rel[1] + '" class="award-delete fr" href="#delete"><span class="delete-generic"/></a>' })
/* 393  */ 										.injectInside('manage-award-list');
/* 394  */ 									m_a_l = null;
/* 395  */ 									add_award_delete_event();
/* 396  */ 								}
/* 397  */ 								poptent_helpers.show_notification('Success, award saved successfully','success');	
/* 398  */ 							}else if(json.error==4){
/* 399  */ 								poptent_helpers.show_notification('Sorry, there has been an error. Please try again!','error');	
/* 400  */ 							}else if(json.error==3 || json.error==2 || json.error==1){

/* assets.js */

/* 401  */ 								poptent_helpers.show_notification('Sorry, there has been an error.','error');	
/* 402  */ 							}else if(json.error==5){
/* 403  */ 								poptent_helpers.show_notification('Sorry, that award has already been granted!','error');	
/* 404  */ 							}else if(json.error==6){
/* 405  */ 								poptent_helpers.show_notification('Sorry, the <strong>maximum</strong> number of prizes for assignment has already been awarded!','error');	
/* 406  */ 							}
/* 407  */ 						},
/* 408  */ 						onFailure: function(e){
/* 409  */ 							$$('#manageAwards .indicator')[0].setStyle('visibility','hidden');
/* 410  */ 							poptent_helpers.show_notification('Sorry, there has been an error saving awards to this submission','error');
/* 411  */ 						}
/* 412  */ 					});
/* 413  */ 					this.send();
/* 414  */ 				}else{
/* 415  */ 					poptent_helpers.show_notification('Please select a prize to award to this media!','error');
/* 416  */ 				}
/* 417  */ 			});
/* 418  */ 		}
/* 419  */ 		
/* 420  */ 		if(document.id('assetStatus')) {
/* 421  */ 			var cb = document.id('assetStatus').getElement('button.cancel');
/* 422  */ 			if(cb) cb.addEvent('click', function(e){
/* 423  */ 				try{ new Event(e).stop(); }catch(er){};
/* 424  */ 				document.id('assetStatusLink').getParent().removeClass('active');
/* 425  */ 				hideAssetControlBlock('assetStatus', 'assetControlContents');
/* 426  */ 			});
/* 427  */ 			cb = null;
/* 428  */ 		}
/* 429  */ 	
/* 430  */ 		if(document.id('assetSubmit')) {
/* 431  */ 			var a_s_f = $$('#assetSubmit form')[0];
/* 432  */ 			if(a_s_f){
/* 433  */ 					//add aux submit methods
/* 434  */ 					$$('.assetResubmit').each(function(el){
/* 435  */ 						el.addEvent('click', function(e){
/* 436  */ 							try{ new Event(e).stop(); }catch(er){};
/* 437  */ 							$$('#assetSubmit form')[0].fireEvent('submit');
/* 438  */ 						});
/* 439  */ 					});
/* 440  */ 					
/* 441  */ 					a_s_f.addEvent('submit',function(e){
/* 442  */ 					try{ new Event(e).stop(); }catch(er){};
/* 443  */ 					if(document.id('selectAssignment').value != '0') {
/* 444  */ 						this.set('send',{
/* 445  */ 							onRequest: function(){ $$('.submit-indicator').setStyle('visibility','visible'); },
/* 446  */ 							onComplete: function(obj) {
/* 447  */ 								$$('.submit-indicator').setStyle('visibility','hidden');
/* 448  */ 								obj = JSON.decode(obj);
/* 449  */ 								if(obj.status==0){
/* 450  */ 									poptent_helpers.show_notification('Media submitted','success');

/* assets.js */

/* 451  */ 									// Removing some menu items				
/* 452  */ 									if(document.id('assetSettingsLink')) document.id('assetSettingsLink').getParent().destroy();
/* 453  */ 									if(document.id('assetSettings')) document.id('assetSettings').destroy();
/* 454  */ 									if(document.id('selectAssignment').get('tag')=='input' && document.id('assetResubmitName')){
/* 455  */ 										var assignName = document.id('assetResubmitName').get('text');
/* 456  */ 									}else{
/* 457  */ 										var assignName = document.id('selectAssignment').getElement('option[value="'+document.id('selectAssignment').get('value')+'"]').get('text');
/* 458  */ 									}
/* 459  */ 									var html = '<strong>Congratulations!<br /> Your submission to <a href="/assignment/'+document.id('selectAssignment').get('value')+'" alt="'+assignName+'">'+assignName+'</a> is now waiting for approval.</strong>';
/* 460  */ 									document.id('assetSubmit').set('html', html);
/* 461  */ 									if(document.id('assetStatus')) document.id('assetStatus').set('html', html);
/* 462  */ 																
/* 463  */ 								}else if(obj.status==1 || obj.status==3){
/* 464  */ 									poptent_helpers.show_notification('Sorry, there has been an error submitting this media.','error');	
/* 465  */ 								}else if(obj.status==2){
/* 466  */ 									poptent_helpers.show_notification('You\'ve already submitted this media to an assignment.','error');	
/* 467  */ 								}
/* 468  */ 							},
/* 469  */ 							onFailure: function(e){
/* 470  */ 								$$('.submit-indicator').setStyle('visibility','hidden');
/* 471  */ 								poptent_helpers.show_notification('Failed to submit media!','error');
/* 472  */ 							}
/* 473  */ 						});
/* 474  */ 						this.send();
/* 475  */ 					} else poptent_helpers.show_notification('Please, select an Assignment','error');
/* 476  */ 				});
/* 477  */ 			}
/* 478  */ 			a_s_f = null;
/* 479  */ 			var cb = document.id('assetSubmit').getElement('button.cancel');
/* 480  */ 			if(cb) cb.addEvent('click', function(e){
/* 481  */ 				try{ new Event(e).stop(); }catch(er){};
/* 482  */ 				document.id('assetSubmitLink').getParent().removeClass('active');
/* 483  */ 				hideAssetControlBlock('assetSubmit', 'assetControlContents');
/* 484  */ 			});
/* 485  */ 			cb = null;
/* 486  */ 			if(document.id('mediaAssignSubmit')) document.id('mediaAssignSubmit').addEvent('click', function(e){
/* 487  */ 				try{ new Event(e).stop(); }catch(er){};
/* 488  */ 				$$('#assetSubmit form')[0].fireEvent('submit');
/* 489  */ 			});
/* 490  */ 		}
/* 491  */ 		
/* 492  */ 		
/* 493  */ 		
/* 494  */ 		
/* 495  */ 		if(document.id('media-privacy')){
/* 496  */ 			$$('#media-privacy input'/*,'#media-privacy span'*/).addEvent('click',function(e){
/* 497  */ 			//document.id('assetPermissions').addEvent('change',function(e){
/* 498  */ 				if(document.id('media-privacy-val').value==this.value) return true;
/* 499  */ 				
/* 500  */ 				document.id('sourceAccessBlock').setStyle('visibility',(this.value!=0)?'visible':'hidden')

/* assets.js */

/* 501  */ 				document.id('settings-loader').setStyle('display', 'block');
/* 502  */ 				var val = this.value;
/* 503  */ 				new Request({
/* 504  */ 					url: '/assets/saveattribute/settings/permissions/'+poptent_vars.current_page.asset.id+'/', 
/* 505  */ 					method: 'post',
/* 506  */ 					data: 'value='+val,
/* 507  */ 					onComplete: function() {
/* 508  */ 						document.id('settings-loader').setStyle('display', 'none');
/* 509  */ 						poptent_helpers.show_notification('You have changed the permissions for this media','success');
/* 510  */ 						document.id('media-privacy-val').value = val;
/* 511  */ 						if(document.id('shareonce')){
/* 512  */ 							if(val==0) document.id('shareonce').getParent().removeClass('nodisplay');
/* 513  */ 							else document.id('shareonce').getParent().addClass('nodisplay');
/* 514  */ 						}
/* 515  */ 						if(document.id('mediaPrivacy')){
/* 516  */ 							var mediaPrivacyText;
/* 517  */ 							if(val==0) mediaPrivacyText = 'Private';
/* 518  */ 							else if(val==1) mediaPrivacyText = 'Followers only';
/* 519  */ 							else if(val==3) mediaPrivacyText = 'Friends only';
/* 520  */ 							else mediaPrivacyText = 'Public';
/* 521  */ 							document.id('mediaPrivacy').set('text', mediaPrivacyText);
/* 522  */ 						}
/* 523  */ 						//share private message
/* 524  */ 						if(document.id('sharePrivateMessage')){
/* 525  */ 							if(val==0){
/* 526  */ 								document.id('sharePrivateMessage').removeClass('nodisplay');
/* 527  */ 								document.id('shareWith').disabled = true;
/* 528  */ 								document.id('permalink').disabled = true;
/* 529  */ 								document.id('shareSubmit').disabled = true;
/* 530  */ 							}else{
/* 531  */ 								document.id('sharePrivateMessage').addClass('nodisplay');
/* 532  */ 								document.id('shareWith').disabled = false;
/* 533  */ 								document.id('permalink').disabled = false;
/* 534  */ 								document.id('shareSubmit').disabled = false;
/* 535  */ 							}
/* 536  */ 						}
/* 537  */ 					},
/* 538  */ 					onFailure: function(e){
/* 539  */ 						document.id('settings-loader').setStyle('display', 'none');
/* 540  */ 						poptent_helpers.show_notification('Failed to change the permissions for this media!','error');
/* 541  */ 					}
/* 542  */ 				}).send();
/* 543  */ 			});
/* 544  */ 		}
/* 545  */ 		if(document.id('allowSourceAccess')){
/* 546  */ 			document.id('allowSourceAccess').addEvent('click',function(e){
/* 547  */ 				document.id('settings-loader').setStyle('display', 'block');
/* 548  */ 				new Request({
/* 549  */ 					url: '/assets/saveattribute/settings/sourceaccess/'+poptent_vars.current_page.asset.id+'/', 
/* 550  */ 					method: 'post',

/* assets.js */

/* 551  */ 					data: 'value=1',
/* 552  */ 					onComplete: function() {
/* 553  */ 						document.id('settings-loader').setStyle('display', 'none');
/* 554  */ 						poptent_helpers.show_notification('You have changed the permissions for this media','success');							
/* 555  */ 					},
/* 556  */ 					onFailure: function(e){
/* 557  */ 						document.id('settings-loader').setStyle('display', 'none');
/* 558  */ 						poptent_helpers.show_notification('Failed to change the permissions for this media!','error');
/* 559  */ 					}
/* 560  */ 				}).send();
/* 561  */ 			});
/* 562  */ 		}
/* 563  */ 		if(document.id('noSourceAccess')){
/* 564  */ 			document.id('noSourceAccess').addEvent('click',function(e){
/* 565  */ 				document.id('settings-loader').setStyle('display', 'block');
/* 566  */ 				new Request({
/* 567  */ 					url: '/assets/saveattribute/settings/sourceaccess/'+poptent_vars.current_page.asset.id+'/', 
/* 568  */ 					method: 'post',
/* 569  */ 					data: 'value=0',
/* 570  */ 					onComplete: function() {
/* 571  */ 						document.id('settings-loader').setStyle('display', 'none');
/* 572  */ 						poptent_helpers.show_notification('You have changed the permissions for this media','success');						
/* 573  */ 					},
/* 574  */ 					onFailure: function(e){
/* 575  */ 						document.id('settings-loader').setStyle('display', 'none');
/* 576  */ 						poptent_helpers.show_notification('Failed to change the permissions for this media!','error');
/* 577  */ 					}
/* 578  */ 				}).send();
/* 579  */ 			});
/* 580  */ 		}
/* 581  */ 		if($defined(document.id('shareWith'))){
/* 582  */ 			var searchInput = document.id('shareWith');
/* 583  */ 			if(!searchInput.getProperty('id')) searchInput.setProperty('id',poptent_helpers.mock_id());
/* 584  */ 			
/* 585  */ 			if(poptent_vars.current_user.is_signed_in){
/* 586  */ 				var tId = searchInput.getProperty('id');	
/* 587  */ 				_autocompleterAssetControls = new AutocompleterAssetControls( tId, '/users/search/', {
/* 588  */ 					postVar: searchInput.name,
/* 589  */ 					onSelect : function(){selectAssetControls(this.itemInfo,this.itemType,this.element)},
/* 590  */ 					onRequest : function(){document.id('shareAutoLoader').setStyle('display', 'block');},
/* 591  */ 					onComplete: function(){document.id('shareAutoLoader').setStyle('display', 'none');},
/* 592  */ 					closeEls: '#shareSubmit,#shareCancel'
/* 593  */ 				});
/* 594  */ 			}else{
/* 595  */ 				utility_helper.remove_default_msg(document.id('shareWith'), document.id('shareWith').get('value'));
/* 596  */ 			}
/* 597  */ 			document.id('shareSubmit').addEvent('click',function(e){
/* 598  */ 				try{ new Event(e).stop(); }catch(er){};	
/* 599  */ 				document.id('shareForm').fireEvent('submit');
/* 600  */ 			});

/* assets.js */

/* 601  */ 			
/* 602  */ 			document.id('shareForm').addEvent('submit', function(e){
/* 603  */ 				try{ new Event(e).stop(); }catch(er){};
/* 604  */ 				var pass = false;
/* 605  */ 				if(document.id('shareFrom')){
/* 606  */ 					if(
/* 607  */ 						document.id('shareFrom').value != '' && 
/* 608  */ 						document.id('shareFrom').value != document.id('shareFrom').getProperty('defaultmsg') &&
/* 609  */ 						searchInput.value != '' && 
/* 610  */ 						searchInput.value != searchInput.getProperty('defaultmsg')
/* 611  */ 					){
/* 612  */ 						pass = true;
/* 613  */ 					}
/* 614  */ 					else{
/* 615  */ 						if(document.id('shareFrom').value == '' || document.id('shareFrom').value == document.id('shareFrom').getProperty('defaultmsg')){					
/* 616  */ 							//document.id('shareFrom').focus();
/* 617  */ 							//Show error message
/* 618  */ 							poptent_helpers.apply_validation_error_state('shareFrom');
/* 619  */ 							poptent_helpers.show_notification('Error, please try again','error');
/* 620  */ 						}else{
/* 621  */ 							//searchInput.focus();
/* 622  */ 							//Show error message
/* 623  */ 							poptent_helpers.apply_validation_error_state(searchInput);
/* 624  */ 							poptent_helpers.show_notification('Error, please try again','error');
/* 625  */ 						};	 
/* 626  */ 					}
/* 627  */ 				}
/* 628  */ 				
/* 629  */ 				if(!document.id('shareFrom')){
/* 630  */ 					if(
/* 631  */ 						searchInput.value != '' && 
/* 632  */ 						searchInput.value != searchInput.getProperty('defaultmsg')
/* 633  */ 					){
/* 634  */ 						pass = true;
/* 635  */ 					}else{
/* 636  */ 						//searchInput.focus(); alert('three');
/* 637  */ 						//Show error message
/* 638  */ 						poptent_helpers.apply_validation_error_state(searchInput);
/* 639  */ 						poptent_helpers.show_notification('Error, please try again','error');
/* 640  */ 					}
/* 641  */ 				}
/* 642  */ 	
/* 643  */ 				if(pass){
/* 644  */ 					document.id('share-loader').setStyle('display', 'block');
/* 645  */ 					this.set('send',{
/* 646  */ 						onComplete: function(obj){
/* 647  */ 						obj = JSON.decode(obj);
/* 648  */ 						if(obj.status == 0){
/* 649  */ 							if(document.id('shareFrom'))
/* 650  */ 								document.id('shareFrom').value = document.id('shareFrom').addClass('defaultText').getProperty('defaultmsg');

/* assets.js */

/* 651  */ 							//Show success message
/* 652  */ 							poptent_helpers.show_notification('Media was shared with <strong>'+searchInput.value+'</strong>','success');
/* 653  */ 							searchInput.value = searchInput.addClass('defaultText').getProperty('defaultmsg');
/* 654  */ 						} else if(obj.status == 4){
/* 655  */ 							poptent_helpers.show_notification('Error, you cannot share media with yourself','error');
/* 656  */ 						} else if(obj.status == 10){
/* 657  */ 							poptent_helpers.show_notification('Error, please log in or refresh this page to share media','error');
/* 658  */ 						} else{
/* 659  */ 							//Show error message
/* 660  */ 							poptent_helpers.show_notification('Error, please try again','error');
/* 661  */ 						};
/* 662  */ 						document.id('share-loader').setStyle('display', 'none');
/* 663  */ 					},
/* 664  */ 					onFailure: function(){
/* 665  */ 						document.id('share-loader').setStyle('display', 'none');
/* 666  */ 						//Show error message
/* 667  */ 						poptent_helpers.show_notification('Error, please try again','error');
/* 668  */ 					}
/* 669  */ 				});
/* 670  */ 					this.send();
/* 671  */ 				}
/* 672  */ 			});
/* 673  */ 		}
/* 674  */ 		//Add select all to permalink
/* 675  */ 		document.id('permalink').addEvents({
/* 676  */ 			click: function(){
/* 677  */ 				this.select();
/* 678  */ 			}
/* 679  */ 		});	
/* 680  */ 		//Add cancel event
/* 681  */ 		document.id('shareCancel').addEvent('click', function(e){
/* 682  */ 			try{ new Event(e).stop(); }catch(er){};
/* 683  */ 			document.id('shareForm').reset();
/* 684  */ 			document.id('assetSendLink').getParent().removeClass('active');
/* 685  */ 			hideAssetControlBlock('assetSendLink', 'assetControlContents');
/* 686  */ 		});
/* 687  */ 		
/* 688  */ 		function hideAssetControlBlock(link, cont){
/* 689  */ 			var linkRef = ($type(link) == "string" ? document.id(link) : link);
/* 690  */ 			var contentRef = ($type(cont) == "string" ? document.id(cont) : cont);
/* 691  */ 			var thisRel = linkRef.getProperty('rel');			
/* 692  */ 			var anyVisible=0;
/* 693  */ 			$$('#assetControlContents .contentBox').each(function(el){
/* 694  */ 				if(el.getStyle('display') == 'block') el.setStyle('display','none');
/* 695  */ 				document.id('assetControlContents').setStyle('display','none');
/* 696  */ 			});
/* 697  */ 		}
/* 698  */ 		
/* 699  */ 		if (document.id('assetControlContents')) {
/* 700  */ 			

/* assets.js */

/* 701  */ 			acContents = document.id('assetControlContents');
/* 702  */ 			acContents.setStyle('display','none');
/* 703  */ 			$$('div#assetWrapper div.controls a').each(function(el){
/* 704  */ 				if (document.id(el.rel)) {
/* 705  */ 					el.addEvent('click', function(e){
/* 706  */ 						try{ new Event(e).stop(); }catch(er){};
/* 707  */ 						$$('div#assetWrapper div.controls a').each(function(el){
/* 708  */ 							//el.setStyle('background-color','transparent');
/* 709  */ 							el.getParent().removeClass('active');
/* 710  */ 						});
/* 711  */ 						
/* 712  */ 						if (document.id(el.rel).getStyle('display') == 'block' && acContents.getStyle('display')=='block') {
/* 713  */ 							var thisRel = el.rel;
/* 714  */ 							var anyVisible=0;
/* 715  */ 							$$('#assetControlContents .contentBox').each(function(el){
/* 716  */ 								if(el.getStyle('display') == 'block' && (el.id != thisRel)) anyVisible=1;
/* 717  */ 							});
/* 718  */ 							if(!anyVisible){
/* 719  */ 								document.id(el.rel).setStyle('display','none');
/* 720  */ 								acContents.setStyle('display','none');
/* 721  */ 							}
/* 722  */ 						} else {
/* 723  */ 							$$('#assetControlContents .contentBox').each(function(el){
/* 724  */ 								if(el.getStyle('display') == 'block') el.setStyle('display','none');
/* 725  */ 							});
/* 726  */ 							document.id(el.rel).setStyle('display','block');
/* 727  */ 							if(el.rel=='assetThumbs') resetScroller();
/* 728  */ 							if(acContents.getStyle('display')=='none') acContents.setStyle('display','block');
/* 729  */ 							//el.setStyle('background-color',document.id('menuContents').getStyle('background-color'))
/* 730  */ 							el.getParent().addClass('active');
/* 731  */ 						}
/* 732  */ 						
/* 733  */ 					}.bindWithEvent(el));
/* 734  */ 				}
/* 735  */ 			});
/* 736  */ 			$$('div#assetVersions ul#assetVersionsList li ul li.setdefault a.setDefault_enabled').each(function(el){
/* 737  */ 				if(!el.getProperty('id')) el.setProperty('id',poptent_helpers.mock_id());
/* 738  */ 				var tId = el.getProperty('id');
/* 739  */ 				attachSetDefaultEvent(tId);
/* 740  */ 			});
/* 741  */ 			$$('div#assetVersions ul#assetVersionsList li ul li.setdefault a.setDefault_disabled').each(function(el){
/* 742  */ 				el.addEvent('click', function(e){
/* 743  */ 					try{ new Event(e).stop(); }catch(er){};
/* 744  */ 				});
/* 745  */ 			});
/* 746  */ 			$$('div#assetVersions ul#assetVersionsList li ul li.delete a.deleteFileVersion_enabled').each(function(el){
/* 747  */ 				if(!el.getProperty('id')) el.setProperty('id',poptent_helpers.mock_id());
/* 748  */ 				var tId = el.getProperty('id');
/* 749  */ 				attachDeleteEvent(tId);
/* 750  */ 			});

/* assets.js */

/* 751  */ 			$$('div#assetVersions ul#assetVersionsList li ul li.delete a.deleteFileVersion_disabled').each(function(el){
/* 752  */ 				el.addEvent('click', function(e){
/* 753  */ 					try{ new Event(e).stop(); }catch(er){};
/* 754  */ 				});
/* 755  */ 			});
/* 756  */ 			//attachment
/* 757  */ 			$$('div#assetAttachments ul#assetAttachmentsList li ul li.delete a.deleteFileAttachment').each(function(el){
/* 758  */ 				if(!el.getProperty('id')) el.setProperty('id',poptent_helpers.mock_id());
/* 759  */ 				var tId = el.getProperty('id');
/* 760  */ 				attachDeleteEvent(tId, 'attachment');
/* 761  */ 			});
/* 762  */ 			
/* 763  */ 			$$('div#assetWrapper div.controls a.likecontrol').each(function(el){
/* 764  */ 				el.addEvent('click', function(e){
/* 765  */ 					try{ new Event(e).stop(); }catch(er){};
/* 766  */ 					new Request.JSON({
/* 767  */ 						url: '/assets/like/'+poptent_vars.current_page.is_liked+'/'+poptent_vars.current_page.asset.id+'/'+poptent_vars.current_page.asset.revision_id, 
/* 768  */ 						onComplete: likecomplete(),
/* 769  */ 						onFailure: function(e){
/* 770  */ 							poptent_helpers.show_notification('Failed to like this media!','error');
/* 771  */ 						}
/* 772  */ 					}).send();
/* 773  */ 				});
/* 774  */ 			});
/* 775  */ 			
/* 776  */ 			if($$('#removeFlag', '#addFlag')) {
/* 777  */ 				/*document.id('flagSwitch').getElement('button.cancel').addEvent('click', function(e){
/* 778  *| 					try{ new Event(e).stop(); }catch(er){};
/* 779  *| 					document.id('removeFlag').getParent().removeClass('active');
/* 780  *| 					hideAssetControlBlock('flagSwitch', 'assetControlContents');
/* 781  *| 				});
/* 782  *| 				*/
/* 783  */ 						
/* 784  */ 				$$('#removeFlag', '#addFlag').addEvent('click',function(e){
/* 785  */ 					try{ new Event(e).stop(); }catch(er){};			
/* 786  */ 					if(poptent_vars.current_page.is_flagged==0)	var answer = confirm("Are you sure you want to flag this media?");
/* 787  */ 					if(poptent_vars.current_page.is_flagged==1||answer){
/* 788  */ 						//$$('#flagSwitch .indicator')[0].setStyle('visibility','visible');
/* 789  */ 						var currentElement = this;
/* 790  */ 						currentElement.setStyle('visibility', 'hidden');
/* 791  */ 						currentElement.getParent().addClass('loading');
/* 792  */ 						new Request({
/* 793  */ 							url: '/assets/flag/'+poptent_vars.current_page.asset.id+'/', 
/* 794  */ 							onComplete: function() {
/* 795  */ 								if(poptent_vars.current_page.is_flagged==1){
/* 796  */ 									document.id('addFlag').setStyle('display','block');
/* 797  */ 									document.id('removeFlag').setStyle('display','none');
/* 798  */ 									poptent_vars.current_page.is_flagged=0;
/* 799  */ 									//document.id('flagText').set('text', 'Do you want to flag this media?');
/* 800  */ 									poptent_helpers.show_notification('You have unflagged this media','success');

/* assets.js */

/* 801  */ 								}else{
/* 802  */ 									document.id('addFlag').setStyle('display','none');
/* 803  */ 									document.id('removeFlag').setStyle('display','block');
/* 804  */ 									poptent_vars.current_page.is_flagged=1;
/* 805  */ 									//document.id('flagText').set('text', 'Do you want to unflag this media?');
/* 806  */ 									poptent_helpers.show_notification('You have flagged this media. Thank you!','success');
/* 807  */ 								}
/* 808  */ 								
/* 809  */ 								//document.id('removeFlag').getParent().removeClass('active');
/* 810  */ 								//hideAssetControlBlock('flagSwitch', 'assetControlContents');
/* 811  */ 								//$$('#flagSwitch .indicator')[0].setStyle('visibility','hidden');
/* 812  */ 								currentElement.setStyle('visibility', 'visible');
/* 813  */ 								currentElement.getParent().removeClass('loading');
/* 814  */ 							},
/* 815  */ 							onFailure: function(e){
/* 816  */ 								poptent_helpers.show_notification('Failed to flag this media!','error');
/* 817  */ 								currentElement.setStyle('visibility', 'visible');
/* 818  */ 								currentElement.getParent().removeClass('loading');
/* 819  */ 								//$$('#flagSwitch .indicator')[0].setStyle('visibility','hidden');
/* 820  */ 							}
/* 821  */ 						}).send();
/* 822  */ 					}
/* 823  */ 				});
/* 824  */ 			}
/* 825  */ 	
/* 826  */ 			if($$('#addLike', '#removeLike')) {
/* 827  */ 			//if(document.id('likeSwitch')) {
/* 828  */ 				/*document.id('likeSwitch').getElement('button.cancel').addEvent('click', function(e){
/* 829  *| 					try{ new Event(e).stop(); }catch(er){};
/* 830  *| 					document.id('removeLike').getParent().removeClass('active');
/* 831  *| 					hideAssetControlBlock('likeSwitch', 'assetControlContents');
/* 832  *| 				});
/* 833  *| 				*/
/* 834  */ 						
/* 835  */ 				$$('#addLike', '#removeLike').addEvent('click',function(e){
/* 836  */ 					try{ new Event(e).stop(); }catch(er){};
/* 837  */ 					var currentElement = this;
/* 838  */ 					currentElement.setStyle('visibility', 'hidden');
/* 839  */ 					currentElement.getParent().addClass('loading');
/* 840  */ 					//$$('#likeSwitch .indicator')[0].setStyle('visibility','visible');
/* 841  */ 					new Request.JSON({
/* 842  */ 						url: '/assets/like/'+poptent_vars.current_page.is_liked+'/'+poptent_vars.current_page.asset.id+'/'+poptent_vars.current_page.asset.revision_id, 
/* 843  */ 						onComplete: function() {
/* 844  */ 							getLikes(likesInit);
/* 845  */ 							likecomplete();
/* 846  */ 							currentElement.setStyle('visibility', 'visible');
/* 847  */ 							currentElement.getParent().removeClass('loading');
/* 848  */ 						},
/* 849  */ 						onFailure: function(e){
/* 850  */ 							poptent_helpers.show_notification('Failed to like/unlike this media!','error');

/* assets.js */

/* 851  */ 							currentElement.setStyle('visibility', 'visible');
/* 852  */ 							currentElement.getParent().removeClass('loading');
/* 853  */ 						}
/* 854  */ 					}).send();
/* 855  */ 				});
/* 856  */ 			}
/* 857  */ 			
/* 858  */ 			$$('div#assetWrapper div.controls a.flagcontrol').each(function(el){
/* 859  */ 				el.addEvent('click', function(e){
/* 860  */ 					try{ new Event(e).stop(); }catch(er){};
/* 861  */ 					if(poptent_vars.current_page.is_flagged==0)	var answer = confirm("Are you sure you want to flag this media?");
/* 862  */ 					if(poptent_vars.current_page.is_flagged==1||answer){
/* 863  */ 						new Request.JSON({
/* 864  */ 							url: '/assets/flag/'+poptent_vars.current_page.asset.id+'/', 
/* 865  */ 							onComplete: function() {
/* 866  */ 								if(poptent_vars.current_page.is_flagged==1){
/* 867  */ 									document.id('addFlag').setStyle('display','block');
/* 868  */ 									document.id('removeFlag').setStyle('display','none');
/* 869  */ 									poptent_vars.current_page.is_flagged=0;
/* 870  */ 									poptent_helpers.show_notification('You have unflagged this media','success');
/* 871  */ 									
/* 872  */ 								}else{
/* 873  */ 									document.id('addFlag').setStyle('display','none');
/* 874  */ 									document.id('removeFlag').setStyle('display','block');
/* 875  */ 									poptent_vars.current_page.is_flagged=1;
/* 876  */ 									poptent_helpers.show_notification('You have flagged this media. Thank you!','success');
/* 877  */ 								}										
/* 878  */ 							},
/* 879  */ 							onFailure: function(e){
/* 880  */ 								poptent_helpers.show_notification('Failed to flag this media!','error');
/* 881  */ 							}
/* 882  */ 						}).send();
/* 883  */ 					}
/* 884  */ 				});
/* 885  */ 			});
/* 886  */ 			if(document.id('deleteFile')){
/* 887  */ 				document.id('deleteFile').addEvent('click', function(e){
/* 888  */ 					try{ new Event(e).stop(); }catch(er){};
/* 889  */ 					var answer = confirm("Are you sure you want to delete this media? This action will delete all drafts of this file, and is not reversable.");
/* 890  */ 					if(answer){
/* 891  */ 						new Request({
/* 892  */ 							url: '/assets/delete/'+poptent_vars.current_page.asset.id+'/', 
/* 893  */ 							onComplete: function(jsonObj) {
/* 894  */ 								jsonObj = JSON.decode(jsonObj);
/* 895  */ 								window.location=poptent_vars.current_user.url;									
/* 896  */ 							},
/* 897  */ 							onFailure: function(e){
/* 898  */ 								poptent_helpers.show_notification('Failed to delete this media!','error');
/* 899  */ 							}
/* 900  */ 						}).send();

/* assets.js */

/* 901  */ 					}
/* 902  */ 				});
/* 903  */ 			}
/* 904  */ 			if($$('#assetWrapper  div#assetControlContents button.cancel')) $$('#assetWrapper  div#assetControlContents button.cancel').each(function(el){
/* 905  */ 				el.addEvent('click',function(e){
/* 906  */ 					try{ new Event(e).stop(); }catch(er){};
/* 907  */ 					$$('.menu ul li a').each(function(el){
/* 908  */ 						el.setStyle('background-color','transparent');
/* 909  */ 					});
/* 910  */ 					el.getParent().getParent().getParent().setStyle('display','none');
/* 911  */ 					acContents.setStyle('display','none');
/* 912  */ 				}.bindWithEvent(el));
/* 913  */ 			});
/* 914  */ 		}
/* 915  */ 		
/* 916  */ 		if(document.id('shareonce')){
/* 917  */ 			var ajax = new Request({
/* 918  */ 	            url: '/assets/limitedaccess/', 
/* 919  */ 				method: 'get',
/* 920  */ 	            onComplete: function(resp) {
/* 921  */ 	                json = JSON.decode(resp);
/* 922  */ 	            }
/* 923  */ 	        });
/* 924  */ 			myFacebox = new mooFacebox({
/* 925  */ 				target_url: '/assets/limitedaccess/'+poptent_vars.current_page.asset.id+'/', 
/* 926  */ 				onReveal: function(){ 
/* 927  */ 					//add event to further configure selects
/* 928  */ 					document.id('shareonce-allowview').addEvent('change', function() {
/* 929  */ 						ajax.options.url = '/assets/limitedaccess/'+poptent_vars.current_page.asset.id+'/0/'+this.options[this.selectedIndex].value+'/';
/* 930  */ 						ajax.send();
/* 931  */ 					});
/* 932  */ 					document.id('shareonce-allowdownload').addEvent('change', function() {
/* 933  */ 						ajax.options.url = '/assets/limitedaccess/'+poptent_vars.current_page.asset.id+'/1/'+this.options[this.selectedIndex].value+'/';
/* 934  */ 						ajax.send();
/* 935  */ 					});
/* 936  */ 					document.id('shareonce-expiry').addEvent('change', function() {
/* 937  */ 						ajax.options.url = '/assets/limitedaccess/'+poptent_vars.current_page.asset.id+'/2/'+this.options[this.selectedIndex].value+'/';
/* 938  */ 						ajax.send();
/* 939  */ 					});
/* 940  */ 					//add onclick selecting to permalink input
/* 941  */ 					document.id('shareonce-box')
/* 942  */ 						.removeEvents()
/* 943  */ 						.addEvent('click', function(e){ this.select(); }); 
/* 944  */ 				},
/* 945  */ 				onBeforeClose: function(){ 
/* 946  */ 					//remove all added events 
/* 947  */ 					$$('#shareonce-allowview', '#shareonce-allowdownload').removeEvents();
/* 948  */ 				},
/* 949  */ 				onClose: function(){ 
/* 950  */ 					//remove all added events 

/* assets.js */

/* 951  */ 					document.id('shareonce-box').removeEvents();
/* 952  */ 				},
/* 953  */ 				boxType: 1, 
/* 954  */ 				fadeFrame: false 
/* 955  */ 			});
/* 956  */ 		}
/* 957  */ 	}
/* 958  */ });
/* 959  */ 
/* 960  */ function likecomplete(id){
/* 961  */ 	var ismatch = true;
/* 962  */ 	if(typeof id != 'undefined' && typeof poptent_vars.current_page.asset.id != 'undefined' && poptent_vars.current_page.asset.id){
/* 963  */ 		if(id!=poptent_vars.current_page.asset.id) ismatch = false;
/* 964  */ 	}
/* 965  */ 	if(ismatch && document.id('addLike') && document.id('removeLike')){
/* 966  */ 		if(poptent_vars.current_page.is_liked==1){
/* 967  */ 			document.id('addLike').setStyle('display','block');
/* 968  */ 			document.id('removeLike').setStyle('display','none');
/* 969  */ 			poptent_vars.current_page.is_liked=0;
/* 970  */ 			poptent_helpers.show_notification('You no longer like this media','success');
/* 971  */ 		}else{
/* 972  */ 			document.id('addLike').setStyle('display','none');
/* 973  */ 			document.id('removeLike').setStyle('display','block');
/* 974  */ 			poptent_vars.current_page.is_liked=1;
/* 975  */ 			poptent_helpers.show_notification('You now like this media','success');
/* 976  */ 		}
/* 977  */ 	}
/* 978  */ };
/* 979  */ 
/* 980  */ function onAssetUploadComplete(){
/* 981  */ 	if(document.id('uploadPageButton')) document.id('uploadPageButton').removeProperty('disabled').removeClass('disabled');
/* 982  */ 	if(typeof poptent_vars.modules.upload.instances.thumbsUpload !== 'undefined'){
/* 983  */ 		uploadr.enable.call(poptent_vars.modules.upload.instances.thumbsUpload);
/* 984  */ 	}
/* 985  */ 	if(typeof thumbsInit !== 'undefined'){
/* 986  */ 		if(!up_thumb_dm) up_thumb_dm = thumbsInit.options.defaultMsg;
/* 987  */ 		thumbsInit.options.defaultMsg = '<div class="module-init-loader white"></div>';
/* 988  */ 		thumbrefr();
/* 989  */ 	}
/* 990  */ };
/* 991  */ var up_thumb_dm;
/* 992  */ var up_thumb_count = 0;
/* 993  */ var up_thumb_refr;
/* 994  */ var thumbrefr = function(){
/* 995  */ 	if(typeof thumbsInit !== 'undefined'){
/* 996  */ 		thumbsInit.refresh();
/* 997  */ 		if(thumbsInit.numItems == 0 || (up_thumb_count != thumbsInit.numItems)){
/* 998  */ 			up_thumb_count = thumbsInit.numItems;
/* 999  */ 			$clear(up_thumb_refr);
/* 1000 */ 			up_thumb_refr = null;

/* assets.js */

/* 1001 */ 			up_thumb_refr = thumbrefr.delay(5000);
/* 1002 */ 		}else{
/* 1003 */ 			thumbsInit.options.defaultMsg = up_thumb_dm;
/* 1004 */ 		}
/* 1005 */ 	}
/* 1006 */ }
/* 1007 */ 
/* 1008 */ function onAssetUploadStart(){
/* 1009 */ 	var tblock = $$('ul.aul_blocks li.thumbs')[0];
/* 1010 */ 	if(tblock) tblock.setStyle('display','block');
/* 1011 */ 	tblock = null;
/* 1012 */ };
/* 1013 */ 
/* 1014 */ function onAssetUploadCancel(){
/* 1015 */ 	$clear(up_thumb_refr);
/* 1016 */ 	up_thumb_refr = null;
/* 1017 */ 	var tblock = $$('ul.aul_blocks li.thumbs')[0];
/* 1018 */ 	if(tblock) tblock.setStyle('display','none');
/* 1019 */ 	tblock = null;
/* 1020 */ };
/* 1021 */ 
/* 1022 */ function onAssetEncodeStart(){
/* 1023 */ 	//alert('encode started');
/* 1024 */ };
/* 1025 */ 
/* 1026 */ function onAssetEncodeComplete(){
/* 1027 */ 	if(typeof thumbsInit !== 'undefined'){
/* 1028 */ 		if(!up_thumb_dm) up_thumb_dm = thumbsInit.options.defaultMsg;
/* 1029 */ 		thumbsInit.options.defaultMsg = '<div class="module-init-loader white"></div>';
/* 1030 */ 		thumbrefr();
/* 1031 */ 	}
/* 1032 */ };
/* 1033 */ 
/* 1034 */ function onAssetUploadReset(){
/* 1035 */ 	if(document.id('uploadPageButton')) document.id('uploadPageButton').setProperty('disabled', 'disabled').addClass('disabled');
/* 1036 */ 	if(typeof poptent_vars.modules.upload.instances.thumbsUpload !== 'undefined'){
/* 1037 */ 		uploadr.disable.call(poptent_vars.modules.upload.instances.thumbsUpload);
/* 1038 */ 	}
/* 1039 */ 	if(typeof thumbsInit !== 'undefined'){
/* 1040 */ 		up_thumb_count = 0;
/* 1041 */ 		$clear(up_thumb_refr);
/* 1042 */ 		up_thumb_refr = null;
/* 1043 */ 		if(up_thumb_dm){
/* 1044 */ 			thumbsInit.options.defaultMsg = up_thumb_dm;
/* 1045 */ 			up_thumb_dm = null;
/* 1046 */ 		}
/* 1047 */ 		thumbsInit.detachCallback();
/* 1048 */ 		thumbsInit.updateData([],0);
/* 1049 */ 		thumbsInit.refreshInterval = 150000;
/* 1050 */ 		thumbsInit.options.autoUpdate = false;

/* assets.js */

/* 1051 */ 		thumbsInit.refreshCallback();
/* 1052 */ 		removeCustomThumb();
/* 1053 */ 	}
/* 1054 */ 	
/* 1055 */ 	var tblock = $$('ul.aul_blocks li.thumbs')[0];
/* 1056 */ 	if(tblock) tblock.setStyle('display','none');
/* 1057 */ 	tblock = null;
/* 1058 */ };
/* 1059 */ 
/* 1060 */ var add_award_delete_event = function(){
/* 1061 */ 	$$('.award-delete').each(function(el){
/* 1062 */ 		if(!el.hasClass('e')){
/* 1063 */ 			el.addClass('e').addEvent('click', function(e){
/* 1064 */ 				try{ new Event(e).stop(); }catch(er){};
/* 1065 */ 				if(!this.rel || this.rel=='') return;
/* 1066 */ 				award_delete_request(this.rel);
/* 1067 */ 			});
/* 1068 */ 		}
/* 1069 */ 	});
/* 1070 */ };
/* 1071 */ 
/* 1072 */ var award_delete_request = function(thisRel){
/* 1073 */ 	thisRel = thisRel.split('|'); poptent_helpers.logger.log('deleting award with id: award-item-' + thisRel[0] + '-' + thisRel[1]);
/* 1074 */ 	new Request({
/* 1075 */ 		url: '/assets/manageawards/' + poptent_vars.current_page.asset.id + '/' + thisRel[0] + '/' + thisRel[1] + '/', 
/* 1076 */ 		method: 'get',
/* 1077 */ 		onComplete: function(resp) {
/* 1078 */ 			var json = false;
/* 1079 */ 			try{ json = JSON.decode(resp); }catch(er){ };
/* 1080 */ 			if(json){
/* 1081 */ 				poptent_helpers.show_notification('Success, award removed successfully','success');
/* 1082 */ 				utility_helper.add_remove_el_effect({ 
/* 1083 */ 					action: 1, 
/* 1084 */ 					elid: 'award-item-' + thisRel[0] + '-' + thisRel[1],
/* 1085 */ 					oncomplete: function(){
/* 1086 */ 						if(document.id('manage-award-list').innerHTML.trim()=='') document.id('manage-award-list').getParent().addClass('hidden');
/* 1087 */ 					}
/* 1088 */ 				});
/* 1089 */ 			}else{
/* 1090 */ 				poptent_helpers.show_notification('Sorry, there has been an error.','error');
/* 1091 */ 			};
/* 1092 */ 		}
/* 1093 */ 	}).send();
/* 1094 */ };
/* 1095 */ 

;
/* init.js */

/* 1   */ var initLogin = function(opt){
/* 2   */ 	if(typeof login_controller != 'undefined'){
/* 3   */ 		login_controller.init(opt);
/* 4   */ 	}else{
/* 5   */ 		(function(){
/* 6   */ 			initLogin(opt);
/* 7   */ 		}.bind(this)).delay(poptent_vars.modules.init_interval);
/* 8   */ 	}
/* 9   */ }
/* 10  */ 
/* 11  */ var initHistory = function(){
/* 12  */ 	if(typeof poptent_vars.history_params !== 'undefined' && poptent_vars.history_params){
/* 13  */ 		var hmlen = poptent_vars.history_params.length;
/* 14  */ 		if(hmlen>0){
/* 15  */ 			if(typeof HistoryManager !== 'undefined' && HistoryManager){
/* 16  */ 				var hmfail = false;
/* 17  */ 				if(typeof HistoryManager.modules !== 'undefined'){
/* 18  */ 					for (var i=0;i<hmlen; i++) {
/* 19  */ 						var curr_param = poptent_vars.history_params[i];
/* 20  */ 						if(!HistoryManager.modules.get(curr_param)) hmfail = true;
/* 21  */ 					}
/* 22  */ 				}else{
/* 23  */ 					hmfail = true;
/* 24  */ 				}
/* 25  */ 				if(hmfail){
/* 26  */ 					(function(){
/* 27  */ 						initHistory();
/* 28  */ 					}).delay(poptent_vars.modules.init_interval);
/* 29  */ 				}else{
/* 30  */ 					HistoryManager.start();
/* 31  */ 				}
/* 32  */ 				
/* 33  */ 			}else{
/* 34  */ 				(function(){
/* 35  */ 					initHistory();
/* 36  */ 				}).delay(poptent_vars.modules.init_interval);
/* 37  */ 			}
/* 38  */ 		}
/* 39  */ 	}
/* 40  */ };
/* 41  */ 
/* 42  */ var acommentsInit = function(){
/* 43  */ 	if(typeof comments !== 'undefined' && comments && typeof acomments !== 'undefined' && acomments && typeof mooipe !== 'undefined' && mooipe){
/* 44  */ 		thisComments = new acomments('comments',{
/* 45  */ 			threadId: poptent_vars.modules.comments.id,
/* 46  */ 			editMode: poptent_vars.current_page.edit_mode
/* 47  */ 		});
/* 48  */ 	}else{
/* 49  */ 		if(!poptent_vars.jsload.loaded.contains('comments')){
/* 50  */ 			poptent_vars.jsload.loaded.push('comments');

/* init.js */

/* 51  */ 			getjs('/min/?g=comments');
/* 52  */ 		}
/* 53  */ 		if(!poptent_vars.jsload.loaded.contains('mooipe')){
/* 54  */ 			poptent_vars.jsload.loaded.push('mooipe');
/* 55  */ 			getjs('/min/?g=mooipe');
/* 56  */ 		}
/* 57  */ 		(function(){
/* 58  */ 			acommentsInit();
/* 59  */ 		}).delay(poptent_vars.modules.init_interval);
/* 60  */ 	}
/* 61  */ };
/* 62  */ 
/* 63  */ var ucommentsInit = function(){
/* 64  */ 	if(
/* 65  */ 		typeof window.comments !== 'undefined' && window.comments && 
/* 66  */ 		typeof window.ucomments !== 'undefined' && window.ucomments && 
/* 67  */ 		typeof window.mooipe !== 'undefined' && window.mooipe
/* 68  */ 	){
/* 69  */ 		thisComments = new ucomments('comments',{
/* 70  */ 			threadId: poptent_vars.modules.comments.id,
/* 71  */ 			perPage: 10,
/* 72  */ 			editMode: poptent_vars.current_page.edit_mode
/* 73  */ 		});
/* 74  */ 	}else{
/* 75  */ 		if(!poptent_vars.jsload.loaded.contains('comments')){
/* 76  */ 			poptent_vars.jsload.loaded.push('comments');
/* 77  */ 			getjs('/min/?g=comments');
/* 78  */ 		}
/* 79  */ 		if(!poptent_vars.jsload.loaded.contains('mooipe')){
/* 80  */ 			poptent_vars.jsload.loaded.push('mooipe');
/* 81  */ 			getjs('/min/?g=mooipe');
/* 82  */ 		}
/* 83  */ 		(function(){
/* 84  */ 			ucommentsInit();
/* 85  */ 		}).delay(poptent_vars.modules.init_interval);
/* 86  */ 	}
/* 87  */ };
/* 88  */ 
/* 89  */ var album_commentsInit = function(){
/* 90  */ 	if(
/* 91  */ 		typeof window.comments !== 'undefined' && window.comments && 
/* 92  */ 		typeof window.album_comments !== 'undefined' && window.album_comments && 
/* 93  */ 		typeof window.mooipe !== 'undefined' && window.mooipe
/* 94  */ 	){
/* 95  */ 		thisComments = new album_comments('comments',{
/* 96  */ 			threadId: poptent_vars.modules.comments.id,
/* 97  */ 			perPage: 10,
/* 98  */ 			editMode: poptent_vars.current_page.edit_mode
/* 99  */ 		});
/* 100 */ 	}else{

/* init.js */

/* 101 */ 		if(!poptent_vars.jsload.loaded.contains('comments')){
/* 102 */ 			poptent_vars.jsload.loaded.push('comments');
/* 103 */ 			getjs('/min/?g=comments');
/* 104 */ 		}
/* 105 */ 		if(!poptent_vars.jsload.loaded.contains('mooipe')){
/* 106 */ 			poptent_vars.jsload.loaded.push('mooipe');
/* 107 */ 			getjs('/min/?g=mooipe');
/* 108 */ 		}
/* 109 */ 		(function(){
/* 110 */ 			album_commentsInit();
/* 111 */ 		}).delay(poptent_vars.modules.init_interval);
/* 112 */ 	}
/* 113 */ };
/* 114 */ 
/* 115 */ var dcommentsInit = function(cr,da){
/* 116 */ 	if(typeof comments !== 'undefined' && comments && typeof dcomments !== 'undefined' && dcomments && typeof mooipe !== 'undefined' && mooipe){
/* 117 */ 		thisComments = new dcomments('comments',{
/* 118 */ 			threadId: ((poptent_vars.modules.comments.id && poptent_vars.modules.comments.id != '')?poptent_vars.modules.comments.id:poptent_vars.modules.comments.latest_id),
/* 119 */ 			perPage: 20,
/* 120 */ 			editMode: poptent_vars.current_page.edit_mode,
/* 121 */ 			canreply: cr,
/* 122 */ 			disable_ajax: da
/* 123 */ 		});
/* 124 */ 	}else{
/* 125 */ 		if(!poptent_vars.jsload.loaded.contains('comments')){
/* 126 */ 			poptent_vars.jsload.loaded.push('comments');
/* 127 */ 			getjs('/min/?g=comments');
/* 128 */ 		}
/* 129 */ 		if(!poptent_vars.jsload.loaded.contains('mooipe')){
/* 130 */ 			poptent_vars.jsload.loaded.push('mooipe');
/* 131 */ 			getjs('/min/?g=mooipe');
/* 132 */ 		}
/* 133 */ 		(function(){
/* 134 */ 			dcommentsInit(cr,da);
/* 135 */ 		}.bind(this)).delay(poptent_vars.modules.init_interval);
/* 136 */ 	}
/* 137 */ };
/* 138 */ 
/* 139 */ 
/* 140 */ var mooipeInit = function(field,url,opt){
/* 141 */ 	if(typeof mooipe !== 'undefined' && mooipe){
/* 142 */ 		if(typeof opt !== 'undefined'){
/* 143 */ 			new mooipe(field, url, opt);
/* 144 */ 		}else{
/* 145 */ 			new mooipe(field, url);
/* 146 */ 		}
/* 147 */ 	}else{
/* 148 */ 		if(!poptent_vars.jsload.loaded.contains('mooipe')){
/* 149 */ 			poptent_vars.jsload.loaded.push('mooipe');
/* 150 */ 			getjs('/min/?g=mooipe');

/* init.js */

/* 151 */ 		}
/* 152 */ 		(function(){
/* 153 */ 			if(typeof opt !== 'undefined'){
/* 154 */ 				mooipeInit(field,url,opt);
/* 155 */ 			}else{
/* 156 */ 				mooipeInit(field,url);
/* 157 */ 			}
/* 158 */ 		}.bind(this)).delay(poptent_vars.modules.init_interval);
/* 159 */ 	}
/* 160 */ };
/* 161 */ 
/* 162 */ var searchInitFunc = function(st,gp,lk,pg,pp,t,ua,hk){
/* 163 */ 	if(typeof search_module !== 'undefined'){
/* 164 */ 		eval(st + " = new search_module({ get_params: gp, loc_key: lk, page: pg, per_page: pp, type: t, use_ajax: ua, history_key: hk });");
/* 165 */ 	}else{
/* 166 */ 		if(!poptent_vars.jsload.loaded.contains('search_module')){
/* 167 */ 			poptent_vars.jsload.loaded.push('search_module');
/* 168 */ 			getjs('/min/?g=search');
/* 169 */ 		}
/* 170 */ 		(function(){
/* 171 */ 			searchInitFunc(st,gp,lk,pg,pp,t,ua,hk);
/* 172 */ 		}.bind(this)).delay(100);
/* 173 */ 	}
/* 174 */ };
/* 175 */ 
/* 176 */ var uploadInit = function(assignto,status,list,opt){
/* 177 */ 	if(typeof FancyUpload2 !== 'undefined' && FancyUpload2 && typeof swfobject !== 'undefined' && swfobject){
/* 178 */ 		setZeroTimeout(function(){
/* 179 */ 			window.addEvent(poptent_vars.load_event,function(){
/* 180 */ 				if(typeof opt !== 'undefined'){
/* 181 */ 					eval(assignto + " = new FancyUpload2(status,list,opt);");
/* 182 */ 				}else{
/* 183 */ 					eval(assignto + " = new FancyUpload2(status,list);");
/* 184 */ 				}
/* 185 */ 			});
/* 186 */ 		});
/* 187 */ 	}else{
/* 188 */ 		if(!poptent_vars.jsload.loaded.contains('upload')){
/* 189 */ 			poptent_vars.jsload.loaded.push('upload');
/* 190 */ 			getjs('/min/?g=upload');
/* 191 */ 		}
/* 192 */ 		if(!poptent_vars.jsload.loaded.contains('swfobject')){
/* 193 */ 			poptent_vars.jsload.loaded.push('swfobject');
/* 194 */ 			getjs('/min/?g=swfobject');
/* 195 */ 		}
/* 196 */ 		(function(){
/* 197 */ 			if(typeof opt !== 'undefined'){
/* 198 */ 				uploadInit(assignto,status,list,opt);
/* 199 */ 			}else{
/* 200 */ 				uploadInit(assignto,status,list);

/* init.js */

/* 201 */ 			}
/* 202 */ 		}.bind(this)).delay(poptent_vars.modules.init_interval);
/* 203 */ 	}
/* 204 */ };
/* 205 */ 
/* 206 */ var cropperInit = function(assignto,tdiv,topt){
/* 207 */ 	if(typeof imgCropper !== 'undefined'){
/* 208 */ 		if(typeof topt !='undefined'){
/* 209 */ 			eval(assignto + " = new imgCropper(tdiv,topt);");
/* 210 */ 		}else{
/* 211 */ 			eval(assignto + " = new imgCropper(tdiv);");
/* 212 */ 		}
/* 213 */ 	}else{
/* 214 */ 		if(!poptent_vars.jsload.loaded.contains('avatar')){
/* 215 */ 			poptent_vars.jsload.loaded.push('avatar');
/* 216 */ 			getjs('/min/?g=avatar');
/* 217 */ 		}
/* 218 */ 		(function(){
/* 219 */ 			if(typeof topt !='undefined'){
/* 220 */ 				cropperInit(assignto,tdiv,topt);
/* 221 */ 			}else{
/* 222 */ 				cropperInit(assignto,tdiv);
/* 223 */ 			}
/* 224 */ 		}.bind(this)).delay(poptent_vars.modules.init_interval);
/* 225 */ 	}
/* 226 */ };
/* 227 */ 
/* 228 */ var activitywidgetInit = function(assignto,topt){
/* 229 */ 	if(typeof activityWidget !== 'undefined'){
/* 230 */ 		eval(assignto + " = new activityWidget(topt);");
/* 231 */ 	}else{
/* 232 */ 		if(!poptent_vars.jsload.loaded.contains('activitywidget')){
/* 233 */ 			poptent_vars.jsload.loaded.push('activitywidget');
/* 234 */ 			getjs('/min/?g=activitywidget');
/* 235 */ 		}
/* 236 */ 		(function(){
/* 237 */ 			activitywidgetInit(assignto,topt);
/* 238 */ 		}.bind(this)).delay(poptent_vars.modules.init_interval);
/* 239 */ 	}
/* 240 */ };
/* 241 */ 
/* 242 */ var moduleadminInit = function(assignto,caller,topt){
/* 243 */ 	if(typeof moduleAdmin !== 'undefined'){
/* 244 */ 		eval(assignto + " = new moduleAdmin(caller,topt);");
/* 245 */ 	}else{
/* 246 */ 		if(!poptent_vars.jsload.loaded.contains('module')){
/* 247 */ 			poptent_vars.jsload.loaded.push('module');
/* 248 */ 			getjs('/min/?g=module');
/* 249 */ 		}
/* 250 */ 		(function(){

/* init.js */

/* 251 */ 			moduleadminInit(assignto,caller,topt);
/* 252 */ 		}.bind(this)).delay(poptent_vars.modules.init_interval);
/* 253 */ 	}
/* 254 */ };
/* 255 */ 
/* 256 */ var initPlayer = function(id){
/* 257 */ 	var d=new Date();
/* 258 */ 	var ctime = d.getTime();
/* 259 */ 	if(poptent_vars.modules.player.last_init_lock){
/* 260 */ 		(function(){
/* 261 */ 			initPlayer(id);
/* 262 */ 		}.bind(this)).delay(poptent_vars.modules.player.last_init_delay);
/* 263 */ 	}else if(typeof swfobject !== 'undefined'){
/* 264 */ 		poptent_vars.modules.player.last_init_lock = true;
/* 265 */ 		var cdiff = ctime-poptent_vars.modules.player.last_init_time;
/* 266 */ 		if(cdiff>poptent_vars.modules.player.last_init_delay){
/* 267 */ 			poptent_vars.modules.player.last_init_time = ctime;
/* 268 */ 			swfobject.registerObject(id, "9.0.115");
/* 269 */ 			try{
/* 270 */ 			if(document.id(id) && document.id(id).getStyle('display')=='none') document.id(id).setStyle('display','block');
/* 271 */ 			} catch(er){ }
/* 272 */ 			poptent_vars.modules.player.last_init_lock = false;
/* 273 */ 		}else{
/* 274 */ 			poptent_vars.modules.player.last_init_lock = false;
/* 275 */ 			(function(){
/* 276 */ 				initPlayer(id);
/* 277 */ 			}.bind(this)).delay(poptent_vars.modules.player.last_init_delay);
/* 278 */ 		}
/* 279 */ 		
/* 280 */ 	}else{
/* 281 */ 		if(!poptent_vars.jsload.loaded.contains('swfobject')){
/* 282 */ 			poptent_vars.jsload.loaded.push('swfobject');
/* 283 */ 			getjs('/min/?g=swfobject');
/* 284 */ 		}
/* 285 */ 		(function(){
/* 286 */ 			initPlayer(id);
/* 287 */ 		}.bind(this)).delay(100);
/* 288 */ 	}
/* 289 */ };
/* 290 */ 
/* 291 */ var init_assignment_admin = function(){
/* 292 */ 	if(typeof assignment_controller_admin != 'undefined'){
/* 293 */ 		assignment_controller_admin.init(poptent_vars.current_page.assignment.id, {});
/* 294 */ 	}else{
/* 295 */ 		(function(){
/* 296 */ 			init_assignment_admin();
/* 297 */ 		}.bind(this)).delay(100);
/* 298 */ 	}
/* 299 */ };

;
/* thumbs.js */

/* 1   */ var getThumbs = function(callerObj,state){
/* 2   */ 	if(typeof poptent_vars.current_page.asset.id === 'undefined' || !poptent_vars.current_page.asset.id) return false;
/* 3   */ 	if($defined(thumbs_request)) thumbs_request.cancel();
/* 4   */ 	else{
/* 5   */ 		thumbs_request = new Request({
/* 6   */ 			url: '/assets/thumbs/'+poptent_vars.current_page.asset.id+'/'+callerObj.pageNum+'/'+_thumbPerPageValue+'/'+callerObj.sortOrder+'/?items='+callerObj.currItemIDs2String(),
/* 7   */ 			method: 'get',
/* 8   */ 			noCache: true,
/* 9   */ 			onComplete: function(jsonObj){
/* 10  */ 				setZeroTimeout(function(){
/* 11  */ 					if(jsonObj){
/* 12  */ 						jsonObj = JSON.decode(jsonObj);
/* 13  */ 						populateThumbs(jsonObj,callerObj);
/* 14  */ 						if($defined(_thumbPerPageValue)){
/* 15  */ 							if(_thumbPerPageValue == 'all'){
/* 16  */ 								document.id(callerObj.countBox).set('html', '1 to '+ jsonObj.total +' of '+jsonObj.total);
/* 17  */ 								document.id(callerObj.switchStateViewRight).setProperty('rel', 'less').set('html', 'show less');
/* 18  */ 							}else{
/* 19  */ 								callerObj.setTotal(jsonObj.total);
/* 20  */ 								//document.id(callerObj.countBox).set('html', 'Showing 1 to '+ ((callerObj.perPageValue < jsonObj.total) ? callerObj.perPageValue : jsonObj.total) +' of '+jsonObj.total);
/* 21  */ 								document.id(callerObj.switchStateViewRight).setProperty('rel', 'all').set('html', 'show all');
/* 22  */ 							}
/* 23  */ 						}
/* 24  */ 					}
/* 25  */ 				});
/* 26  */ 			}
/* 27  */ 		});
/* 28  */ 	}
/* 29  */ 	thumbs_request.options.url = '/assets/thumbs/'+poptent_vars.current_page.asset.id+'/'+callerObj.pageNum+'/'+_thumbPerPageValue+'/'+callerObj.sortOrder+'/?items='+callerObj.currItemIDs2String();
/* 30  */ 	thumbs_request.send();
/* 31  */ };
/* 32  */ 
/* 33  */ var populateThumbs = function(jsonObj,callerObj){
/* 34  */ 	var Thumbs = jsonObj.Thumbs;
/* 35  */ 	var itemsArray = [];
/* 36  */ 	poptent_vars.modules.avatar.default_id = jsonObj.defaultThumbId;
/* 37  */ 	Thumbs.each(function(thumb){			
/* 38  */ 		itemsArray.push({
/* 39  */ 			itemId: thumb.id,
/* 40  */ 			imgSrc: thumb.location,
/* 41  */ 			lgimgSrc: thumb.lglocation,
/* 42  */ 			urlKey: '#',
/* 43  */ 			itemTitle: thumb.name,
/* 44  */ 			itemDesc: thumb.created,
/* 45  */ 			tooltipClass: 'tips',
/* 46  */ 			tooltipTitle: thumb.name,
/* 47  */ 			tooltipDesc: '<small class="meta">created: '+thumb.created+'<br/>width: '+thumb.width+'px<br/>height: '+thumb.height+'px</small>',
/* 48  */ 			isdefault: ((thumb.id==poptent_vars.modules.avatar.default_id && thumb.id != 0) ? 1 : 0)
/* 49  */ 		});
/* 50  */ 		

/* thumbs.js */

/* 51  */ 	});
/* 52  */ 	if(jsonObj.customThumb != '') setCustomThumb(jsonObj.customThumb,callerObj,true);		
/* 53  */ 	
/* 54  */ 	if(jsonObj.total.toInt() > 4){
/* 55  */ 		document.id(callerObj.switchStateViewRight).getParent().setStyle('display', 'block');
/* 56  */ 		document.id(callerObj.switchStateViewRight).removeEvents().addEvent('click', function(e){
/* 57  */ 			try{ new Event(e).stop(); }catch(er){};
/* 58  */ 			_thumbPerPageValue = document.id(callerObj.switchStateViewRight).getProperty('rel');
/* 59  */ 			getThumbs(this,1);
/* 60  */ 		}.bindWithEvent(callerObj));
/* 61  */ 	}
/* 62  */ 	callerObj.updateData(itemsArray,jsonObj.total);
/* 63  */ };
/* 64  */ 
/* 65  */ var removeCustomThumb = function(){
/* 66  */ 	if(!custContainer) custContainer = $$('#thumbs .customImage')[0];
/* 67  */ 	custContainer.empty().setStyle('display', 'none');
/* 68  */ };
/* 69  */ 
/* 70  */ var setDefaultThumb = function(imgInfo,callerObj){
/* 71  */ 	imgInfo = (typeof imgInfo == 'object') ? imgInfo : document.id(imgInfo);
/* 72  */ 	if(!mainContainer) mainContainer = $$('#thumbs li.body ul.wrapper2 li.content')[0];
/* 73  */ 	mainContainer.getChildren().each(function(el){
/* 74  */ 		el.getElement('.item').removeClass('selected');
/* 75  */ 	});
/* 76  */ 	if(!custContainer) custContainer = $$('#thumbs .customImage')[0];
/* 77  */ 	if(custContainer.getFirst() && custContainer.getFirst().getFirst() && custContainer.getElement('.item')) custContainer.getElement('.item').removeClass('selected');
/* 78  */ 	
/* 79  */ 	imgInfo.getElement('.item').addClass('selected');
/* 80  */ 	var imageId = imgInfo.getProperty('id').split('_')[1];
/* 81  */ 	if(imageId!=poptent_vars.modules.avatar.default_id){
/* 82  */ 		var setDefault = new Request({
/* 83  */ 			url: '/assets/saveattribute/image/setdefault/'+poptent_vars.current_page.asset.id+'/',
/* 84  */ 			method: 'post',
/* 85  */ 			noCache: true,
/* 86  */ 			data: 'value='+imageId,
/* 87  */ 			onComplete: function(jsonObj){
/* 88  */ 				poptent_vars.modules.avatar.default_id = imageId;
/* 89  */ 				if(thumbs_onsetdefault) thumbs_onsetdefault(imageId);		
/* 90  */ 			}.bind(this)
/* 91  */ 		}).send();
/* 92  */ 	}
/* 93  */ };
/* 94  */ 
/* 95  */ var setCustomThumb = function(imgInfo,callerObj,noFire){
/* 96  */ 	if(!$defined(noFire)) noFire = false;
/* 97  */ 	document.id('uploadEncodeBlock2').addClass('blockWidthMin');
/* 98  */ 	if(!custContainer) custContainer = $$('#thumbs .customImage')[0];
/* 99  */ 	custContainer.setStyle('display', 'block');
/* 100 */ 	

/* thumbs.js */

/* 101 */ 	el = {
/* 102 */ 		itemId: imgInfo.id,
/* 103 */ 		imgSrc: imgInfo.location,
/* 104 */ 		urlKey: '#',
/* 105 */ 		itemTitle: imgInfo.name,
/* 106 */ 		itemDesc: imgInfo.created,
/* 107 */ 		tooltipClass: 'tips',
/* 108 */ 		tooltipTitle: imgInfo.name,
/* 109 */ 		tooltipDesc: '<small class="meta">created: '+imgInfo.created+'<br/>width: '+imgInfo.width+'px<br/>height: '+imgInfo.height+'px</small>',
/* 110 */ 		isdefault: ((imgInfo.id==poptent_vars.modules.avatar.default_id && imgInfo.id != 0) ? 1 : 0)
/* 111 */ 	};
/* 112 */ 	if(imgInfo.id!=poptent_vars.modules.avatar.default_id && imgInfo.id != 0 && !noFire){
/* 113 */ 		imageId = imgInfo.id;
/* 114 */ 		if(thumbs_onsetdefault) thumbs_onsetdefault(imageId);
/* 115 */ 	};
/* 116 */ 	custContainer.empty();
/* 117 */ 	callerObj.injectItem(el,custContainer);
/* 118 */ };

;
/* swfupload.js */

/* 1   */ /**
/* 2   *|  * SWFUpload: http://www.swfupload.org, http://swfupload.googlecode.com
/* 3   *|  *
/* 4   *|  * mmSWFUpload 1.0: Flash upload dialog - http://profandesign.se/swfupload/,  http://www.vinterwebb.se/
/* 5   *|  *
/* 6   *|  * SWFUpload is (c) 2006-2007 Lars Huring, Olov Nilzén and Mammon Media and is released under the MIT License:
/* 7   *|  * http://www.opensource.org/licenses/mit-license.php
/* 8   *|  *
/* 9   *|  * SWFUpload 2 is (c) 2007-2008 Jake Roberts and is released under the MIT License:
/* 10  *|  * http://www.opensource.org/licenses/mit-license.php
/* 11  *|  *
/* 12  *|  */
/* 13  */ 
/* 14  */ 
/* 15  */ /* ******************* */
/* 16  */ /* Constructor & Init  */
/* 17  */ /* ******************* */
/* 18  */ var SWFUpload;
/* 19  */ 
/* 20  */ if (SWFUpload == undefined) {
/* 21  */ 	SWFUpload = function (settings) {
/* 22  */ 		this.initSWFUpload(settings);
/* 23  */ 	};
/* 24  */ }
/* 25  */ 
/* 26  */ SWFUpload.prototype.initSWFUpload = function (settings) {
/* 27  */ 	try {
/* 28  */ 		this.customSettings = {};	// A container where developers can place their own settings associated with this instance.
/* 29  */ 		this.settings = settings;
/* 30  */ 		this.eventQueue = [];
/* 31  */ 		this.movieName = "SWFUpload_" + SWFUpload.movieCount++;
/* 32  */ 		this.movieElement = null;
/* 33  */ 
/* 34  */ 
/* 35  */ 		// Setup global control tracking
/* 36  */ 		SWFUpload.instances[this.movieName] = this;
/* 37  */ 
/* 38  */ 		// Load the settings.  Load the Flash movie.
/* 39  */ 		this.initSettings();
/* 40  */ 		this.loadFlash();
/* 41  */ 		this.displayDebugInfo();
/* 42  */ 	} catch (ex) {
/* 43  */ 		delete SWFUpload.instances[this.movieName];
/* 44  */ 		throw ex;
/* 45  */ 	}
/* 46  */ };
/* 47  */ 
/* 48  */ /* *************** */
/* 49  */ /* Static Members  */
/* 50  */ /* *************** */

/* swfupload.js */

/* 51  */ SWFUpload.instances = {};
/* 52  */ SWFUpload.movieCount = 0;
/* 53  */ SWFUpload.version = "2.2.0 2009-03-25";
/* 54  */ SWFUpload.QUEUE_ERROR = {
/* 55  */ 	QUEUE_LIMIT_EXCEEDED	  		: -100,
/* 56  */ 	FILE_EXCEEDS_SIZE_LIMIT  		: -110,
/* 57  */ 	ZERO_BYTE_FILE			  		: -120,
/* 58  */ 	INVALID_FILETYPE		  		: -130
/* 59  */ };
/* 60  */ SWFUpload.UPLOAD_ERROR = {
/* 61  */ 	HTTP_ERROR				  		: -200,
/* 62  */ 	MISSING_UPLOAD_URL	      		: -210,
/* 63  */ 	IO_ERROR				  		: -220,
/* 64  */ 	SECURITY_ERROR			  		: -230,
/* 65  */ 	UPLOAD_LIMIT_EXCEEDED	  		: -240,
/* 66  */ 	UPLOAD_FAILED			  		: -250,
/* 67  */ 	SPECIFIED_FILE_ID_NOT_FOUND		: -260,
/* 68  */ 	FILE_VALIDATION_FAILED	  		: -270,
/* 69  */ 	FILE_CANCELLED			  		: -280,
/* 70  */ 	UPLOAD_STOPPED					: -290
/* 71  */ };
/* 72  */ SWFUpload.FILE_STATUS = {
/* 73  */ 	QUEUED		 : -1,
/* 74  */ 	IN_PROGRESS	 : -2,
/* 75  */ 	ERROR		 : -3,
/* 76  */ 	COMPLETE	 : -4,
/* 77  */ 	CANCELLED	 : -5
/* 78  */ };
/* 79  */ SWFUpload.BUTTON_ACTION = {
/* 80  */ 	SELECT_FILE  : -100,
/* 81  */ 	SELECT_FILES : -110,
/* 82  */ 	START_UPLOAD : -120
/* 83  */ };
/* 84  */ SWFUpload.CURSOR = {
/* 85  */ 	ARROW : -1,
/* 86  */ 	HAND : -2
/* 87  */ };
/* 88  */ SWFUpload.WINDOW_MODE = {
/* 89  */ 	WINDOW : "window",
/* 90  */ 	TRANSPARENT : "transparent",
/* 91  */ 	OPAQUE : "opaque"
/* 92  */ };
/* 93  */ 
/* 94  */ // Private: takes a URL, determines if it is relative and converts to an absolute URL
/* 95  */ // using the current site. Only processes the URL if it can, otherwise returns the URL untouched
/* 96  */ SWFUpload.completeURL = function(url) {
/* 97  */ 	if (typeof(url) !== "string" || url.match(/^https?:\/\//i) || url.match(/^\//)) {
/* 98  */ 		return url;
/* 99  */ 	}
/* 100 */ 	

/* swfupload.js */

/* 101 */ 	var currentURL = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ":" + window.location.port : "");
/* 102 */ 	
/* 103 */ 	var indexSlash = window.location.pathname.lastIndexOf("/");
/* 104 */ 	if (indexSlash <= 0) {
/* 105 */ 		path = "/";
/* 106 */ 	} else {
/* 107 */ 		path = window.location.pathname.substr(0, indexSlash) + "/";
/* 108 */ 	}
/* 109 */ 	
/* 110 */ 	return /*currentURL +*/ path + url;
/* 111 */ 	
/* 112 */ };
/* 113 */ 
/* 114 */ 
/* 115 */ /* ******************** */
/* 116 */ /* Instance Members  */
/* 117 */ /* ******************** */
/* 118 */ 
/* 119 */ // Private: initSettings ensures that all the
/* 120 */ // settings are set, getting a default value if one was not assigned.
/* 121 */ SWFUpload.prototype.initSettings = function () {
/* 122 */ 	this.ensureDefault = function (settingName, defaultValue) {
/* 123 */ 		this.settings[settingName] = (this.settings[settingName] == undefined) ? defaultValue : this.settings[settingName];
/* 124 */ 	};
/* 125 */ 	
/* 126 */ 	// Upload backend settings
/* 127 */ 	this.ensureDefault("upload_url", "");
/* 128 */ 	this.ensureDefault("preserve_relative_urls", false);
/* 129 */ 	this.ensureDefault("file_post_name", "Filedata");
/* 130 */ 	this.ensureDefault("post_params", {});
/* 131 */ 	this.ensureDefault("use_query_string", false);
/* 132 */ 	this.ensureDefault("requeue_on_error", false);
/* 133 */ 	this.ensureDefault("http_success", []);
/* 134 */ 	this.ensureDefault("assume_success_timeout", 0);
/* 135 */ 	
/* 136 */ 	// File Settings
/* 137 */ 	this.ensureDefault("file_types", "*.*");
/* 138 */ 	this.ensureDefault("file_types_description", "All Files");
/* 139 */ 	this.ensureDefault("file_size_limit", 0);	// Default zero means "unlimited"
/* 140 */ 	this.ensureDefault("file_upload_limit", 0);
/* 141 */ 	this.ensureDefault("file_queue_limit", 0);
/* 142 */ 
/* 143 */ 	// Flash Settings
/* 144 */ 	this.ensureDefault("flash_url", "swfupload.swf");
/* 145 */ 	this.ensureDefault("prevent_swf_caching", true);
/* 146 */ 	
/* 147 */ 	// Button Settings
/* 148 */ 	this.ensureDefault("button_image_url", "");
/* 149 */ 	this.ensureDefault("button_width", 1);
/* 150 */ 	this.ensureDefault("button_height", 1);

/* swfupload.js */

/* 151 */ 	this.ensureDefault("button_text", "");
/* 152 */ 	this.ensureDefault("button_text_style", "color: #000000; font-size: 16pt;");
/* 153 */ 	this.ensureDefault("button_text_top_padding", 0);
/* 154 */ 	this.ensureDefault("button_text_left_padding", 0);
/* 155 */ 	this.ensureDefault("button_action", SWFUpload.BUTTON_ACTION.SELECT_FILES);
/* 156 */ 	this.ensureDefault("button_disabled", false);
/* 157 */ 	this.ensureDefault("button_placeholder_id", "");
/* 158 */ 	this.ensureDefault("button_placeholder", null);
/* 159 */ 	this.ensureDefault("button_cursor", SWFUpload.CURSOR.ARROW);
/* 160 */ 	this.ensureDefault("button_window_mode", SWFUpload.WINDOW_MODE.WINDOW);
/* 161 */ 	
/* 162 */ 	// Debug Settings
/* 163 */ 	this.ensureDefault("debug", false);
/* 164 */ 	this.settings.debug_enabled = this.settings.debug;	// Here to maintain v2 API
/* 165 */ 	
/* 166 */ 	// Event Handlers
/* 167 */ 	this.settings.return_upload_start_handler = this.returnUploadStart;
/* 168 */ 	this.ensureDefault("swfupload_loaded_handler", null);
/* 169 */ 	this.ensureDefault("file_dialog_start_handler", null);
/* 170 */ 	this.ensureDefault("file_queued_handler", null);
/* 171 */ 	this.ensureDefault("file_queue_error_handler", null);
/* 172 */ 	this.ensureDefault("file_dialog_complete_handler", null);
/* 173 */ 	
/* 174 */ 	this.ensureDefault("upload_start_handler", null);
/* 175 */ 	this.ensureDefault("upload_progress_handler", null);
/* 176 */ 	this.ensureDefault("upload_error_handler", null);
/* 177 */ 	this.ensureDefault("upload_success_handler", null);
/* 178 */ 	this.ensureDefault("upload_complete_handler", null);
/* 179 */ 	
/* 180 */ 	this.ensureDefault("debug_handler", this.debugMessage);
/* 181 */ 
/* 182 */ 	this.ensureDefault("custom_settings", {});
/* 183 */ 
/* 184 */ 	// Other settings
/* 185 */ 	this.customSettings = this.settings.custom_settings;
/* 186 */ 	
/* 187 */ 	// Update the flash url if needed
/* 188 */ 	if (!!this.settings.prevent_swf_caching) {
/* 189 */ 		this.settings.flash_url = this.settings.flash_url + (this.settings.flash_url.indexOf("?") < 0 ? "?" : "&") + "preventswfcaching=" + new Date().getTime();
/* 190 */ 	}
/* 191 */ 	
/* 192 */ 	if (!this.settings.preserve_relative_urls) {
/* 193 */ 		//this.settings.flash_url = SWFUpload.completeURL(this.settings.flash_url);	// Don't need to do this one since flash doesn't look at it
/* 194 */ 		this.settings.upload_url = SWFUpload.completeURL(this.settings.upload_url);
/* 195 */ 		this.settings.button_image_url = SWFUpload.completeURL(this.settings.button_image_url);
/* 196 */ 	}
/* 197 */ 	
/* 198 */ 	delete this.ensureDefault;
/* 199 */ };
/* 200 */ 

/* swfupload.js */

/* 201 */ // Private: loadFlash replaces the button_placeholder element with the flash movie.
/* 202 */ SWFUpload.prototype.loadFlash = function () {
/* 203 */ 	var targetElement, tempParent;
/* 204 */ 
/* 205 */ 	// Make sure an element with the ID we are going to use doesn't already exist
/* 206 */ 	if (document.getElementById(this.movieName) !== null) {
/* 207 */ 		throw "ID " + this.movieName + " is already in use. The Flash Object could not be added";
/* 208 */ 	}
/* 209 */ 
/* 210 */ 	// Get the element where we will be placing the flash movie
/* 211 */ 	targetElement = document.getElementById(this.settings.button_placeholder_id) || this.settings.button_placeholder;
/* 212 */ 
/* 213 */ 	if (targetElement == undefined) {
/* 214 */ 		throw "Could not find the placeholder element: " + this.settings.button_placeholder_id;
/* 215 */ 	}
/* 216 */ 
/* 217 */ 	// Append the container and load the flash
/* 218 */ 	tempParent = document.createElement("div");
/* 219 */ 	tempParent.innerHTML = this.getFlashHTML();	// Using innerHTML is non-standard but the only sensible way to dynamically add Flash in IE (and maybe other browsers)
/* 220 */ 	targetElement.parentNode.replaceChild(tempParent.firstChild, targetElement);
/* 221 */ 
/* 222 */ 	// Fix IE Flash/Form bug
/* 223 */ 	if (window[this.movieName] == undefined) {
/* 224 */ 		window[this.movieName] = this.getMovieElement();
/* 225 */ 	}
/* 226 */ 	
/* 227 */ };
/* 228 */ 
/* 229 */ // Private: getFlashHTML generates the object tag needed to embed the flash in to the document
/* 230 */ SWFUpload.prototype.getFlashHTML = function () {
/* 231 */ 	// Flash Satay object syntax: http://www.alistapart.com/articles/flashsatay
/* 232 */ 	return ['<object id="', this.movieName, '" type="application/x-shockwave-flash" data="', this.settings.flash_url, '" width="', this.settings.button_width, '" height="', this.settings.button_height, '" class="swfupload">',
/* 233 */ 				'<param name="wmode" value="', this.settings.button_window_mode, '" />',
/* 234 */ 				'<param name="movie" value="', this.settings.flash_url, '" />',
/* 235 */ 				'<param name="quality" value="high" />',
/* 236 */ 				'<param name="menu" value="false" />',
/* 237 */ 				'<param name="allowScriptAccess" value="always" />',
/* 238 */ 				'<param name="flashvars" value="' + this.getFlashVars() + '" />',
/* 239 */ 				'</object>'].join("");
/* 240 */ };
/* 241 */ 
/* 242 */ // Private: getFlashVars builds the parameter string that will be passed
/* 243 */ // to flash in the flashvars param.
/* 244 */ SWFUpload.prototype.getFlashVars = function () {
/* 245 */ 	// Build a string from the post param object
/* 246 */ 	var paramString = this.buildParamString();
/* 247 */ 	var httpSuccessString = this.settings.http_success.join(",");
/* 248 */ 	
/* 249 */ 	// Build the parameter string
/* 250 */ 	return ["movieName=", encodeURIComponent(this.movieName),

/* swfupload.js */

/* 251 */ 			"&amp;uploadURL=", encodeURIComponent(this.settings.upload_url),
/* 252 */ 			"&amp;useQueryString=", encodeURIComponent(this.settings.use_query_string),
/* 253 */ 			"&amp;requeueOnError=", encodeURIComponent(this.settings.requeue_on_error),
/* 254 */ 			"&amp;httpSuccess=", encodeURIComponent(httpSuccessString),
/* 255 */ 			"&amp;assumeSuccessTimeout=", encodeURIComponent(this.settings.assume_success_timeout),
/* 256 */ 			"&amp;params=", encodeURIComponent(paramString),
/* 257 */ 			"&amp;filePostName=", encodeURIComponent(this.settings.file_post_name),
/* 258 */ 			"&amp;fileTypes=", encodeURIComponent(this.settings.file_types),
/* 259 */ 			"&amp;fileTypesDescription=", encodeURIComponent(this.settings.file_types_description),
/* 260 */ 			"&amp;fileSizeLimit=", encodeURIComponent(this.settings.file_size_limit),
/* 261 */ 			"&amp;fileUploadLimit=", encodeURIComponent(this.settings.file_upload_limit),
/* 262 */ 			"&amp;fileQueueLimit=", encodeURIComponent(this.settings.file_queue_limit),
/* 263 */ 			"&amp;debugEnabled=", encodeURIComponent(this.settings.debug_enabled),
/* 264 */ 			"&amp;buttonImageURL=", encodeURIComponent(this.settings.button_image_url),
/* 265 */ 			"&amp;buttonWidth=", encodeURIComponent(this.settings.button_width),
/* 266 */ 			"&amp;buttonHeight=", encodeURIComponent(this.settings.button_height),
/* 267 */ 			"&amp;buttonText=", encodeURIComponent(this.settings.button_text),
/* 268 */ 			"&amp;buttonTextTopPadding=", encodeURIComponent(this.settings.button_text_top_padding),
/* 269 */ 			"&amp;buttonTextLeftPadding=", encodeURIComponent(this.settings.button_text_left_padding),
/* 270 */ 			"&amp;buttonTextStyle=", encodeURIComponent(this.settings.button_text_style),
/* 271 */ 			"&amp;buttonAction=", encodeURIComponent(this.settings.button_action),
/* 272 */ 			"&amp;buttonDisabled=", encodeURIComponent(this.settings.button_disabled),
/* 273 */ 			"&amp;buttonCursor=", encodeURIComponent(this.settings.button_cursor)
/* 274 */ 		].join("");
/* 275 */ };
/* 276 */ 
/* 277 */ // Public: getMovieElement retrieves the DOM reference to the Flash element added by SWFUpload
/* 278 */ // The element is cached after the first lookup
/* 279 */ SWFUpload.prototype.getMovieElement = function () {
/* 280 */ 	if (this.movieElement == undefined) {
/* 281 */ 		this.movieElement = document.getElementById(this.movieName);
/* 282 */ 	}
/* 283 */ 
/* 284 */ 	if (this.movieElement === null) {
/* 285 */ 		throw "Could not find Flash element";
/* 286 */ 	}
/* 287 */ 	
/* 288 */ 	return this.movieElement;
/* 289 */ };
/* 290 */ 
/* 291 */ // Private: buildParamString takes the name/value pairs in the post_params setting object
/* 292 */ // and joins them up in to a string formatted "name=value&amp;name=value"
/* 293 */ SWFUpload.prototype.buildParamString = function () {
/* 294 */ 	var postParams = this.settings.post_params; 
/* 295 */ 	var paramStringPairs = [];
/* 296 */ 
/* 297 */ 	if (typeof(postParams) === "object") {
/* 298 */ 		for (var name in postParams) {
/* 299 */ 			if (postParams.hasOwnProperty(name)) {
/* 300 */ 				paramStringPairs.push(encodeURIComponent(name.toString()) + "=" + encodeURIComponent(postParams[name].toString()));

/* swfupload.js */

/* 301 */ 			}
/* 302 */ 		}
/* 303 */ 	}
/* 304 */ 
/* 305 */ 	return paramStringPairs.join("&amp;");
/* 306 */ };
/* 307 */ 
/* 308 */ // Public: Used to remove a SWFUpload instance from the page. This method strives to remove
/* 309 */ // all references to the SWF, and other objects so memory is properly freed.
/* 310 */ // Returns true if everything was destroyed. Returns a false if a failure occurs leaving SWFUpload in an inconsistant state.
/* 311 */ // Credits: Major improvements provided by steffen
/* 312 */ SWFUpload.prototype.destroy = function () {
/* 313 */ 	try {
/* 314 */ 		// Make sure Flash is done before we try to remove it
/* 315 */ 		this.cancelUpload(null, false);
/* 316 */ 		
/* 317 */ 
/* 318 */ 		// Remove the SWFUpload DOM nodes
/* 319 */ 		var movieElement = null;
/* 320 */ 		movieElement = this.getMovieElement();
/* 321 */ 		
/* 322 */ 		if (movieElement && typeof(movieElement.CallFunction) === "unknown") { // We only want to do this in IE
/* 323 */ 			// Loop through all the movie's properties and remove all function references (DOM/JS IE 6/7 memory leak workaround)
/* 324 */ 			for (var i in movieElement) {
/* 325 */ 				try {
/* 326 */ 					if (typeof(movieElement[i]) === "function") {
/* 327 */ 						movieElement[i] = null;
/* 328 */ 					}
/* 329 */ 				} catch (ex1) {}
/* 330 */ 			}
/* 331 */ 
/* 332 */ 			// Remove the Movie Element from the page
/* 333 */ 			try {
/* 334 */ 				movieElement.parentNode.removeChild(movieElement);
/* 335 */ 			} catch (ex) {}
/* 336 */ 		}
/* 337 */ 		
/* 338 */ 		// Remove IE form fix reference
/* 339 */ 		window[this.movieName] = null;
/* 340 */ 
/* 341 */ 		// Destroy other references
/* 342 */ 		SWFUpload.instances[this.movieName] = null;
/* 343 */ 		delete SWFUpload.instances[this.movieName];
/* 344 */ 
/* 345 */ 		this.movieElement = null;
/* 346 */ 		this.settings = null;
/* 347 */ 		this.customSettings = null;
/* 348 */ 		this.eventQueue = null;
/* 349 */ 		this.movieName = null;
/* 350 */ 		

/* swfupload.js */

/* 351 */ 		
/* 352 */ 		return true;
/* 353 */ 	} catch (ex2) {
/* 354 */ 		return false;
/* 355 */ 	}
/* 356 */ };
/* 357 */ 
/* 358 */ 
/* 359 */ // Public: displayDebugInfo prints out settings and configuration
/* 360 */ // information about this SWFUpload instance.
/* 361 */ // This function (and any references to it) can be deleted when placing
/* 362 */ // SWFUpload in production.
/* 363 */ SWFUpload.prototype.displayDebugInfo = function () {
/* 364 */ 	this.debug(
/* 365 */ 		[
/* 366 */ 			"---SWFUpload Instance Info---\n",
/* 367 */ 			"Version: ", SWFUpload.version, "\n",
/* 368 */ 			"Movie Name: ", this.movieName, "\n",
/* 369 */ 			"Settings:\n",
/* 370 */ 			"\t", "upload_url:               ", this.settings.upload_url, "\n",
/* 371 */ 			"\t", "flash_url:                ", this.settings.flash_url, "\n",
/* 372 */ 			"\t", "use_query_string:         ", this.settings.use_query_string.toString(), "\n",
/* 373 */ 			"\t", "requeue_on_error:         ", this.settings.requeue_on_error.toString(), "\n",
/* 374 */ 			"\t", "http_success:             ", this.settings.http_success.join(", "), "\n",
/* 375 */ 			"\t", "assume_success_timeout:   ", this.settings.assume_success_timeout, "\n",
/* 376 */ 			"\t", "file_post_name:           ", this.settings.file_post_name, "\n",
/* 377 */ 			"\t", "post_params:              ", this.settings.post_params.toString(), "\n",
/* 378 */ 			"\t", "file_types:               ", this.settings.file_types, "\n",
/* 379 */ 			"\t", "file_types_description:   ", this.settings.file_types_description, "\n",
/* 380 */ 			"\t", "file_size_limit:          ", this.settings.file_size_limit, "\n",
/* 381 */ 			"\t", "file_upload_limit:        ", this.settings.file_upload_limit, "\n",
/* 382 */ 			"\t", "file_queue_limit:         ", this.settings.file_queue_limit, "\n",
/* 383 */ 			"\t", "debug:                    ", this.settings.debug.toString(), "\n",
/* 384 */ 
/* 385 */ 			"\t", "prevent_swf_caching:      ", this.settings.prevent_swf_caching.toString(), "\n",
/* 386 */ 
/* 387 */ 			"\t", "button_placeholder_id:    ", this.settings.button_placeholder_id.toString(), "\n",
/* 388 */ 			"\t", "button_placeholder:       ", (this.settings.button_placeholder ? "Set" : "Not Set"), "\n",
/* 389 */ 			"\t", "button_image_url:         ", this.settings.button_image_url.toString(), "\n",
/* 390 */ 			"\t", "button_width:             ", this.settings.button_width.toString(), "\n",
/* 391 */ 			"\t", "button_height:            ", this.settings.button_height.toString(), "\n",
/* 392 */ 			"\t", "button_text:              ", this.settings.button_text.toString(), "\n",
/* 393 */ 			"\t", "button_text_style:        ", this.settings.button_text_style.toString(), "\n",
/* 394 */ 			"\t", "button_text_top_padding:  ", this.settings.button_text_top_padding.toString(), "\n",
/* 395 */ 			"\t", "button_text_left_padding: ", this.settings.button_text_left_padding.toString(), "\n",
/* 396 */ 			"\t", "button_action:            ", this.settings.button_action.toString(), "\n",
/* 397 */ 			"\t", "button_disabled:          ", this.settings.button_disabled.toString(), "\n",
/* 398 */ 
/* 399 */ 			"\t", "custom_settings:          ", this.settings.custom_settings.toString(), "\n",
/* 400 */ 			"Event Handlers:\n",

/* swfupload.js */

/* 401 */ 			"\t", "swfupload_loaded_handler assigned:  ", (typeof this.settings.swfupload_loaded_handler === "function").toString(), "\n",
/* 402 */ 			"\t", "file_dialog_start_handler assigned: ", (typeof this.settings.file_dialog_start_handler === "function").toString(), "\n",
/* 403 */ 			"\t", "file_queued_handler assigned:       ", (typeof this.settings.file_queued_handler === "function").toString(), "\n",
/* 404 */ 			"\t", "file_queue_error_handler assigned:  ", (typeof this.settings.file_queue_error_handler === "function").toString(), "\n",
/* 405 */ 			"\t", "upload_start_handler assigned:      ", (typeof this.settings.upload_start_handler === "function").toString(), "\n",
/* 406 */ 			"\t", "upload_progress_handler assigned:   ", (typeof this.settings.upload_progress_handler === "function").toString(), "\n",
/* 407 */ 			"\t", "upload_error_handler assigned:      ", (typeof this.settings.upload_error_handler === "function").toString(), "\n",
/* 408 */ 			"\t", "upload_success_handler assigned:    ", (typeof this.settings.upload_success_handler === "function").toString(), "\n",
/* 409 */ 			"\t", "upload_complete_handler assigned:   ", (typeof this.settings.upload_complete_handler === "function").toString(), "\n",
/* 410 */ 			"\t", "debug_handler assigned:             ", (typeof this.settings.debug_handler === "function").toString(), "\n"
/* 411 */ 		].join("")
/* 412 */ 	);
/* 413 */ };
/* 414 */ 
/* 415 */ /* Note: addSetting and getSetting are no longer used by SWFUpload but are included
/* 416 *| 	the maintain v2 API compatibility
/* 417 *| */
/* 418 */ // Public: (Deprecated) addSetting adds a setting value. If the value given is undefined or null then the default_value is used.
/* 419 */ SWFUpload.prototype.addSetting = function (name, value, default_value) {
/* 420 */     if (value == undefined) {
/* 421 */         return (this.settings[name] = default_value);
/* 422 */     } else {
/* 423 */         return (this.settings[name] = value);
/* 424 */ 	}
/* 425 */ };
/* 426 */ 
/* 427 */ // Public: (Deprecated) getSetting gets a setting. Returns an empty string if the setting was not found.
/* 428 */ SWFUpload.prototype.getSetting = function (name) {
/* 429 */     if (this.settings[name] != undefined) {
/* 430 */         return this.settings[name];
/* 431 */ 	}
/* 432 */ 
/* 433 */     return "";
/* 434 */ };
/* 435 */ 
/* 436 */ 
/* 437 */ 
/* 438 */ // Private: callFlash handles function calls made to the Flash element.
/* 439 */ // Calls are made with a setTimeout for some functions to work around
/* 440 */ // bugs in the ExternalInterface library.
/* 441 */ SWFUpload.prototype.callFlash = function (functionName, argumentArray) {
/* 442 */ 	argumentArray = argumentArray || [];
/* 443 */ 	
/* 444 */ 	var movieElement = this.getMovieElement();
/* 445 */ 	var returnValue, returnString;
/* 446 */ 
/* 447 */ 	// Flash's method if calling ExternalInterface methods (code adapted from MooTools).
/* 448 */ 	try {
/* 449 */ 		returnString = movieElement.CallFunction('<invoke name="' + functionName + '" returntype="javascript">' + __flash__argumentsToXML(argumentArray, 0) + '</invoke>');
/* 450 */ 		returnValue = eval(returnString);

/* swfupload.js */

/* 451 */ 	} catch (ex) {
/* 452 */ 		throw "Call to " + functionName + " failed";
/* 453 */ 	}
/* 454 */ 	
/* 455 */ 	// Unescape file post param values
/* 456 */ 	if (returnValue != undefined && typeof returnValue.post === "object") {
/* 457 */ 		returnValue = this.unescapeFilePostParams(returnValue);
/* 458 */ 	}
/* 459 */ 
/* 460 */ 	return returnValue;
/* 461 */ };
/* 462 */ 
/* 463 */ /* *****************************
/* 464 *| 	-- Flash control methods --
/* 465 *| 	Your UI should use these
/* 466 *| 	to operate SWFUpload
/* 467 *|    ***************************** */
/* 468 */ 
/* 469 */ // WARNING: this function does not work in Flash Player 10
/* 470 */ // Public: selectFile causes a File Selection Dialog window to appear.  This
/* 471 */ // dialog only allows 1 file to be selected.
/* 472 */ SWFUpload.prototype.selectFile = function () {
/* 473 */ 	this.callFlash("SelectFile");
/* 474 */ };
/* 475 */ 
/* 476 */ // WARNING: this function does not work in Flash Player 10
/* 477 */ // Public: selectFiles causes a File Selection Dialog window to appear/ This
/* 478 */ // dialog allows the user to select any number of files
/* 479 */ // Flash Bug Warning: Flash limits the number of selectable files based on the combined length of the file names.
/* 480 */ // If the selection name length is too long the dialog will fail in an unpredictable manner.  There is no work-around
/* 481 */ // for this bug.
/* 482 */ SWFUpload.prototype.selectFiles = function () {
/* 483 */ 	this.callFlash("SelectFiles");
/* 484 */ };
/* 485 */ 
/* 486 */ 
/* 487 */ // Public: startUpload starts uploading the first file in the queue unless
/* 488 */ // the optional parameter 'fileID' specifies the ID 
/* 489 */ SWFUpload.prototype.startUpload = function (fileID) {
/* 490 */ 	this.callFlash("StartUpload", [fileID]);
/* 491 */ };
/* 492 */ 
/* 493 */ // Public: cancelUpload cancels any queued file.  The fileID parameter may be the file ID or index.
/* 494 */ // If you do not specify a fileID the current uploading file or first file in the queue is cancelled.
/* 495 */ // If you do not want the uploadError event to trigger you can specify false for the triggerErrorEvent parameter.
/* 496 */ SWFUpload.prototype.cancelUpload = function (fileID, triggerErrorEvent) {
/* 497 */ 	if (triggerErrorEvent !== false) {
/* 498 */ 		triggerErrorEvent = true;
/* 499 */ 	}
/* 500 */ 	this.callFlash("CancelUpload", [fileID, triggerErrorEvent]);

/* swfupload.js */

/* 501 */ };
/* 502 */ 
/* 503 */ // Public: stopUpload stops the current upload and requeues the file at the beginning of the queue.
/* 504 */ // If nothing is currently uploading then nothing happens.
/* 505 */ SWFUpload.prototype.stopUpload = function () {
/* 506 */ 	this.callFlash("StopUpload");
/* 507 */ };
/* 508 */ 
/* 509 */ /* ************************
/* 510 *|  * Settings methods
/* 511 *|  *   These methods change the SWFUpload settings.
/* 512 *|  *   SWFUpload settings should not be changed directly on the settings object
/* 513 *|  *   since many of the settings need to be passed to Flash in order to take
/* 514 *|  *   effect.
/* 515 *|  * *********************** */
/* 516 */ 
/* 517 */ // Public: getStats gets the file statistics object.
/* 518 */ SWFUpload.prototype.getStats = function () {
/* 519 */ 	return this.callFlash("GetStats");
/* 520 */ };
/* 521 */ 
/* 522 */ // Public: setStats changes the SWFUpload statistics.  You shouldn't need to 
/* 523 */ // change the statistics but you can.  Changing the statistics does not
/* 524 */ // affect SWFUpload accept for the successful_uploads count which is used
/* 525 */ // by the upload_limit setting to determine how many files the user may upload.
/* 526 */ SWFUpload.prototype.setStats = function (statsObject) {
/* 527 */ 	this.callFlash("SetStats", [statsObject]);
/* 528 */ };
/* 529 */ 
/* 530 */ // Public: getFile retrieves a File object by ID or Index.  If the file is
/* 531 */ // not found then 'null' is returned.
/* 532 */ SWFUpload.prototype.getFile = function (fileID) {
/* 533 */ 	if (typeof(fileID) === "number") {
/* 534 */ 		return this.callFlash("GetFileByIndex", [fileID]);
/* 535 */ 	} else {
/* 536 */ 		return this.callFlash("GetFile", [fileID]);
/* 537 */ 	}
/* 538 */ };
/* 539 */ 
/* 540 */ // Public: addFileParam sets a name/value pair that will be posted with the
/* 541 */ // file specified by the Files ID.  If the name already exists then the
/* 542 */ // exiting value will be overwritten.
/* 543 */ SWFUpload.prototype.addFileParam = function (fileID, name, value) {
/* 544 */ 	return this.callFlash("AddFileParam", [fileID, name, value]);
/* 545 */ };
/* 546 */ 
/* 547 */ // Public: removeFileParam removes a previously set (by addFileParam) name/value
/* 548 */ // pair from the specified file.
/* 549 */ SWFUpload.prototype.removeFileParam = function (fileID, name) {
/* 550 */ 	this.callFlash("RemoveFileParam", [fileID, name]);

/* swfupload.js */

/* 551 */ };
/* 552 */ 
/* 553 */ // Public: setUploadUrl changes the upload_url setting.
/* 554 */ SWFUpload.prototype.setUploadURL = function (url) {
/* 555 */ 	this.settings.upload_url = url.toString();
/* 556 */ 	this.callFlash("SetUploadURL", [url]);
/* 557 */ };
/* 558 */ 
/* 559 */ // Public: setPostParams changes the post_params setting
/* 560 */ SWFUpload.prototype.setPostParams = function (paramsObject) {
/* 561 */ 	this.settings.post_params = paramsObject;
/* 562 */ 	this.callFlash("SetPostParams", [paramsObject]);
/* 563 */ };
/* 564 */ 
/* 565 */ // Public: addPostParam adds post name/value pair.  Each name can have only one value.
/* 566 */ SWFUpload.prototype.addPostParam = function (name, value) {
/* 567 */ 	this.settings.post_params[name] = value;
/* 568 */ 	this.callFlash("SetPostParams", [this.settings.post_params]);
/* 569 */ };
/* 570 */ 
/* 571 */ // Public: removePostParam deletes post name/value pair.
/* 572 */ SWFUpload.prototype.removePostParam = function (name) {
/* 573 */ 	delete this.settings.post_params[name];
/* 574 */ 	this.callFlash("SetPostParams", [this.settings.post_params]);
/* 575 */ };
/* 576 */ 
/* 577 */ // Public: setFileTypes changes the file_types setting and the file_types_description setting
/* 578 */ SWFUpload.prototype.setFileTypes = function (types, description) {
/* 579 */ 	this.settings.file_types = types;
/* 580 */ 	this.settings.file_types_description = description;
/* 581 */ 	this.callFlash("SetFileTypes", [types, description]);
/* 582 */ };
/* 583 */ 
/* 584 */ // Public: setFileSizeLimit changes the file_size_limit setting
/* 585 */ SWFUpload.prototype.setFileSizeLimit = function (fileSizeLimit) {
/* 586 */ 	this.settings.file_size_limit = fileSizeLimit;
/* 587 */ 	this.callFlash("SetFileSizeLimit", [fileSizeLimit]);
/* 588 */ };
/* 589 */ 
/* 590 */ // Public: setFileUploadLimit changes the file_upload_limit setting
/* 591 */ SWFUpload.prototype.setFileUploadLimit = function (fileUploadLimit) {
/* 592 */ 	this.settings.file_upload_limit = fileUploadLimit;
/* 593 */ 	this.callFlash("SetFileUploadLimit", [fileUploadLimit]);
/* 594 */ };
/* 595 */ 
/* 596 */ // Public: setFileQueueLimit changes the file_queue_limit setting
/* 597 */ SWFUpload.prototype.setFileQueueLimit = function (fileQueueLimit) {
/* 598 */ 	this.settings.file_queue_limit = fileQueueLimit;
/* 599 */ 	this.callFlash("SetFileQueueLimit", [fileQueueLimit]);
/* 600 */ };

/* swfupload.js */

/* 601 */ 
/* 602 */ // Public: setFilePostName changes the file_post_name setting
/* 603 */ SWFUpload.prototype.setFilePostName = function (filePostName) {
/* 604 */ 	this.settings.file_post_name = filePostName;
/* 605 */ 	this.callFlash("SetFilePostName", [filePostName]);
/* 606 */ };
/* 607 */ 
/* 608 */ // Public: setUseQueryString changes the use_query_string setting
/* 609 */ SWFUpload.prototype.setUseQueryString = function (useQueryString) {
/* 610 */ 	this.settings.use_query_string = useQueryString;
/* 611 */ 	this.callFlash("SetUseQueryString", [useQueryString]);
/* 612 */ };
/* 613 */ 
/* 614 */ // Public: setRequeueOnError changes the requeue_on_error setting
/* 615 */ SWFUpload.prototype.setRequeueOnError = function (requeueOnError) {
/* 616 */ 	this.settings.requeue_on_error = requeueOnError;
/* 617 */ 	this.callFlash("SetRequeueOnError", [requeueOnError]);
/* 618 */ };
/* 619 */ 
/* 620 */ // Public: setHTTPSuccess changes the http_success setting
/* 621 */ SWFUpload.prototype.setHTTPSuccess = function (http_status_codes) {
/* 622 */ 	if (typeof http_status_codes === "string") {
/* 623 */ 		http_status_codes = http_status_codes.replace(" ", "").split(",");
/* 624 */ 	}
/* 625 */ 	
/* 626 */ 	this.settings.http_success = http_status_codes;
/* 627 */ 	this.callFlash("SetHTTPSuccess", [http_status_codes]);
/* 628 */ };
/* 629 */ 
/* 630 */ // Public: setHTTPSuccess changes the http_success setting
/* 631 */ SWFUpload.prototype.setAssumeSuccessTimeout = function (timeout_seconds) {
/* 632 */ 	this.settings.assume_success_timeout = timeout_seconds;
/* 633 */ 	this.callFlash("SetAssumeSuccessTimeout", [timeout_seconds]);
/* 634 */ };
/* 635 */ 
/* 636 */ // Public: setDebugEnabled changes the debug_enabled setting
/* 637 */ SWFUpload.prototype.setDebugEnabled = function (debugEnabled) {
/* 638 */ 	this.settings.debug_enabled = debugEnabled;
/* 639 */ 	this.callFlash("SetDebugEnabled", [debugEnabled]);
/* 640 */ };
/* 641 */ 
/* 642 */ // Public: setButtonImageURL loads a button image sprite
/* 643 */ SWFUpload.prototype.setButtonImageURL = function (buttonImageURL) {
/* 644 */ 	if (buttonImageURL == undefined) {
/* 645 */ 		buttonImageURL = "";
/* 646 */ 	}
/* 647 */ 	
/* 648 */ 	this.settings.button_image_url = buttonImageURL;
/* 649 */ 	this.callFlash("SetButtonImageURL", [buttonImageURL]);
/* 650 */ };

/* swfupload.js */

/* 651 */ 
/* 652 */ // Public: setButtonDimensions resizes the Flash Movie and button
/* 653 */ SWFUpload.prototype.setButtonDimensions = function (width, height) {
/* 654 */ 	this.settings.button_width = width;
/* 655 */ 	this.settings.button_height = height;
/* 656 */ 	
/* 657 */ 	var movie = this.getMovieElement();
/* 658 */ 	if (movie != undefined) {
/* 659 */ 		movie.style.width = width + "px";
/* 660 */ 		movie.style.height = height + "px";
/* 661 */ 	}
/* 662 */ 	
/* 663 */ 	this.callFlash("SetButtonDimensions", [width, height]);
/* 664 */ };
/* 665 */ // Public: setButtonText Changes the text overlaid on the button
/* 666 */ SWFUpload.prototype.setButtonText = function (html) {
/* 667 */ 	this.settings.button_text = html;
/* 668 */ 	this.callFlash("SetButtonText", [html]);
/* 669 */ };
/* 670 */ // Public: setButtonTextPadding changes the top and left padding of the text overlay
/* 671 */ SWFUpload.prototype.setButtonTextPadding = function (left, top) {
/* 672 */ 	this.settings.button_text_top_padding = top;
/* 673 */ 	this.settings.button_text_left_padding = left;
/* 674 */ 	this.callFlash("SetButtonTextPadding", [left, top]);
/* 675 */ };
/* 676 */ 
/* 677 */ // Public: setButtonTextStyle changes the CSS used to style the HTML/Text overlaid on the button
/* 678 */ SWFUpload.prototype.setButtonTextStyle = function (css) {
/* 679 */ 	this.settings.button_text_style = css;
/* 680 */ 	this.callFlash("SetButtonTextStyle", [css]);
/* 681 */ };
/* 682 */ // Public: setButtonDisabled disables/enables the button
/* 683 */ SWFUpload.prototype.setButtonDisabled = function (isDisabled) {
/* 684 */ 	this.settings.button_disabled = isDisabled;
/* 685 */ 	this.callFlash("SetButtonDisabled", [isDisabled]);
/* 686 */ };
/* 687 */ // Public: setButtonAction sets the action that occurs when the button is clicked
/* 688 */ SWFUpload.prototype.setButtonAction = function (buttonAction) {
/* 689 */ 	this.settings.button_action = buttonAction;
/* 690 */ 	this.callFlash("SetButtonAction", [buttonAction]);
/* 691 */ };
/* 692 */ 
/* 693 */ // Public: setButtonCursor changes the mouse cursor displayed when hovering over the button
/* 694 */ SWFUpload.prototype.setButtonCursor = function (cursor) {
/* 695 */ 	this.settings.button_cursor = cursor;
/* 696 */ 	this.callFlash("SetButtonCursor", [cursor]);
/* 697 */ };
/* 698 */ 
/* 699 */ /* *******************************
/* 700 *| 	Flash Event Interfaces

/* swfupload.js */

/* 701 *| 	These functions are used by Flash to trigger the various
/* 702 *| 	events.
/* 703 *| 	
/* 704 *| 	All these functions a Private.
/* 705 *| 	
/* 706 *| 	Because the ExternalInterface library is buggy the event calls
/* 707 *| 	are added to a queue and the queue then executed by a setTimeout.
/* 708 *| 	This ensures that events are executed in a determinate order and that
/* 709 *| 	the ExternalInterface bugs are avoided.
/* 710 *| ******************************* */
/* 711 */ 
/* 712 */ SWFUpload.prototype.queueEvent = function (handlerName, argumentArray) {
/* 713 */ 	// Warning: Don't call this.debug inside here or you'll create an infinite loop
/* 714 */ 	
/* 715 */ 	if (argumentArray == undefined) {
/* 716 */ 		argumentArray = [];
/* 717 */ 	} else if (!(argumentArray instanceof Array)) {
/* 718 */ 		argumentArray = [argumentArray];
/* 719 */ 	}
/* 720 */ 	
/* 721 */ 	var self = this;
/* 722 */ 	if (typeof this.settings[handlerName] === "function") {
/* 723 */ 		// Queue the event
/* 724 */ 		this.eventQueue.push(function () {
/* 725 */ 			this.settings[handlerName].apply(this, argumentArray);
/* 726 */ 		});
/* 727 */ 		
/* 728 */ 		// Execute the next queued event
/* 729 */ 		setTimeout(function () {
/* 730 */ 			self.executeNextEvent();
/* 731 */ 		}, 0);
/* 732 */ 		
/* 733 */ 	} else if (this.settings[handlerName] !== null) {
/* 734 */ 		throw "Event handler " + handlerName + " is unknown or is not a function";
/* 735 */ 	}
/* 736 */ };
/* 737 */ 
/* 738 */ // Private: Causes the next event in the queue to be executed.  Since events are queued using a setTimeout
/* 739 */ // we must queue them in order to garentee that they are executed in order.
/* 740 */ SWFUpload.prototype.executeNextEvent = function () {
/* 741 */ 	// Warning: Don't call this.debug inside here or you'll create an infinite loop
/* 742 */ 
/* 743 */ 	var  f = this.eventQueue ? this.eventQueue.shift() : null;
/* 744 */ 	if (typeof(f) === "function") {
/* 745 */ 		f.apply(this);
/* 746 */ 	}
/* 747 */ };
/* 748 */ 
/* 749 */ // Private: unescapeFileParams is part of a workaround for a flash bug where objects passed through ExternalInterface cannot have
/* 750 */ // properties that contain characters that are not valid for JavaScript identifiers. To work around this

/* swfupload.js */

/* 751 */ // the Flash Component escapes the parameter names and we must unescape again before passing them along.
/* 752 */ SWFUpload.prototype.unescapeFilePostParams = function (file) {
/* 753 */ 	var reg = /[$]([0-9a-f]{4})/i;
/* 754 */ 	var unescapedPost = {};
/* 755 */ 	var uk;
/* 756 */ 
/* 757 */ 	if (file != undefined) {
/* 758 */ 		for (var k in file.post) {
/* 759 */ 			if (file.post.hasOwnProperty(k)) {
/* 760 */ 				uk = k;
/* 761 */ 				var match;
/* 762 */ 				while ((match = reg.exec(uk)) !== null) {
/* 763 */ 					uk = uk.replace(match[0], String.fromCharCode(parseInt("0x" + match[1], 16)));
/* 764 */ 				}
/* 765 */ 				unescapedPost[uk] = file.post[k];
/* 766 */ 			}
/* 767 */ 		}
/* 768 */ 
/* 769 */ 		file.post = unescapedPost;
/* 770 */ 	}
/* 771 */ 
/* 772 */ 	return file;
/* 773 */ };
/* 774 */ 
/* 775 */ // Private: Called by Flash to see if JS can call in to Flash (test if External Interface is working)
/* 776 */ SWFUpload.prototype.testExternalInterface = function () {
/* 777 */ 	try {
/* 778 */ 		return this.callFlash("TestExternalInterface");
/* 779 */ 	} catch (ex) {
/* 780 */ 		return false;
/* 781 */ 	}
/* 782 */ };
/* 783 */ 
/* 784 */ // Private: This event is called by Flash when it has finished loading. Don't modify this.
/* 785 */ // Use the swfupload_loaded_handler event setting to execute custom code when SWFUpload has loaded.
/* 786 */ SWFUpload.prototype.flashReady = function () {
/* 787 */ 	// Check that the movie element is loaded correctly with its ExternalInterface methods defined
/* 788 */ 	var movieElement = this.getMovieElement();
/* 789 */ 
/* 790 */ 	if (!movieElement) {
/* 791 */ 		this.debug("Flash called back ready but the flash movie can't be found.");
/* 792 */ 		return;
/* 793 */ 	}
/* 794 */ 
/* 795 */ 	this.cleanUp(movieElement);
/* 796 */ 	
/* 797 */ 	this.queueEvent("swfupload_loaded_handler");
/* 798 */ };
/* 799 */ 
/* 800 */ // Private: removes Flash added fuctions to the DOM node to prevent memory leaks in IE.

/* swfupload.js */

/* 801 */ // This function is called by Flash each time the ExternalInterface functions are created.
/* 802 */ SWFUpload.prototype.cleanUp = function (movieElement) {
/* 803 */ 	// Pro-actively unhook all the Flash functions
/* 804 */ 	try {
/* 805 */ 		if (this.movieElement && typeof(movieElement.CallFunction) === "unknown") { // We only want to do this in IE
/* 806 */ 			this.debug("Removing Flash functions hooks (this should only run in IE and should prevent memory leaks)");
/* 807 */ 			for (var key in movieElement) {
/* 808 */ 				try {
/* 809 */ 					if (typeof(movieElement[key]) === "function") {
/* 810 */ 						movieElement[key] = null;
/* 811 */ 					}
/* 812 */ 				} catch (ex) {
/* 813 */ 				}
/* 814 */ 			}
/* 815 */ 		}
/* 816 */ 	} catch (ex1) {
/* 817 */ 	
/* 818 */ 	}
/* 819 */ 
/* 820 */ 	// Fix Flashes own cleanup code so if the SWFMovie was removed from the page
/* 821 */ 	// it doesn't display errors.
/* 822 */ 	window["__flash__removeCallback"] = function (instance, name) {
/* 823 */ 		try {
/* 824 */ 			if (instance) {
/* 825 */ 				instance[name] = null;
/* 826 */ 			}
/* 827 */ 		} catch (flashEx) {
/* 828 */ 		
/* 829 */ 		}
/* 830 */ 	};
/* 831 */ 
/* 832 */ };
/* 833 */ 
/* 834 */ 
/* 835 */ /* This is a chance to do something before the browse window opens */
/* 836 */ SWFUpload.prototype.fileDialogStart = function () {
/* 837 */ 	this.queueEvent("file_dialog_start_handler");
/* 838 */ };
/* 839 */ 
/* 840 */ 
/* 841 */ /* Called when a file is successfully added to the queue. */
/* 842 */ SWFUpload.prototype.fileQueued = function (file) {
/* 843 */ 	file = this.unescapeFilePostParams(file);
/* 844 */ 	this.queueEvent("file_queued_handler", file);
/* 845 */ };
/* 846 */ 
/* 847 */ 
/* 848 */ /* Handle errors that occur when an attempt to queue a file fails. */
/* 849 */ SWFUpload.prototype.fileQueueError = function (file, errorCode, message) {
/* 850 */ 	file = this.unescapeFilePostParams(file);

/* swfupload.js */

/* 851 */ 	this.queueEvent("file_queue_error_handler", [file, errorCode, message]);
/* 852 */ };
/* 853 */ 
/* 854 */ /* Called after the file dialog has closed and the selected files have been queued.
/* 855 *| 	You could call startUpload here if you want the queued files to begin uploading immediately. */
/* 856 */ SWFUpload.prototype.fileDialogComplete = function (numFilesSelected, numFilesQueued, numFilesInQueue) {
/* 857 */ 	this.queueEvent("file_dialog_complete_handler", [numFilesSelected, numFilesQueued, numFilesInQueue]);
/* 858 */ };
/* 859 */ 
/* 860 */ SWFUpload.prototype.uploadStart = function (file) {
/* 861 */ 	file = this.unescapeFilePostParams(file);
/* 862 */ 	this.queueEvent("return_upload_start_handler", file);
/* 863 */ };
/* 864 */ 
/* 865 */ SWFUpload.prototype.returnUploadStart = function (file) {
/* 866 */ 	var returnValue;
/* 867 */ 	if (typeof this.settings.upload_start_handler === "function") {
/* 868 */ 		file = this.unescapeFilePostParams(file);
/* 869 */ 		returnValue = this.settings.upload_start_handler.call(this, file);
/* 870 */ 	} else if (this.settings.upload_start_handler != undefined) {
/* 871 */ 		throw "upload_start_handler must be a function";
/* 872 */ 	}
/* 873 */ 
/* 874 */ 	// Convert undefined to true so if nothing is returned from the upload_start_handler it is
/* 875 */ 	// interpretted as 'true'.
/* 876 */ 	if (returnValue === undefined) {
/* 877 */ 		returnValue = true;
/* 878 */ 	}
/* 879 */ 	
/* 880 */ 	returnValue = !!returnValue;
/* 881 */ 	
/* 882 */ 	this.callFlash("ReturnUploadStart", [returnValue]);
/* 883 */ };
/* 884 */ 
/* 885 */ 
/* 886 */ 
/* 887 */ SWFUpload.prototype.uploadProgress = function (file, bytesComplete, bytesTotal) {
/* 888 */ 	file = this.unescapeFilePostParams(file);
/* 889 */ 	this.queueEvent("upload_progress_handler", [file, bytesComplete, bytesTotal]);
/* 890 */ };
/* 891 */ 
/* 892 */ SWFUpload.prototype.uploadError = function (file, errorCode, message) {
/* 893 */ 	file = this.unescapeFilePostParams(file);
/* 894 */ 	this.queueEvent("upload_error_handler", [file, errorCode, message]);
/* 895 */ };
/* 896 */ 
/* 897 */ SWFUpload.prototype.uploadSuccess = function (file, serverData, responseReceived) {
/* 898 */ 	file = this.unescapeFilePostParams(file);
/* 899 */ 	this.queueEvent("upload_success_handler", [file, serverData, responseReceived]);
/* 900 */ };

/* swfupload.js */

/* 901 */ 
/* 902 */ SWFUpload.prototype.uploadComplete = function (file) {
/* 903 */ 	file = this.unescapeFilePostParams(file);
/* 904 */ 	this.queueEvent("upload_complete_handler", file);
/* 905 */ };
/* 906 */ 
/* 907 */ /* Called by SWFUpload JavaScript and Flash functions when debug is enabled. By default it writes messages to the
/* 908 *|    internal debug console.  You can override this event and have messages written where you want. */
/* 909 */ SWFUpload.prototype.debug = function (message) {
/* 910 */ 	this.queueEvent("debug_handler", message);
/* 911 */ };
/* 912 */ 
/* 913 */ 
/* 914 */ /* **********************************
/* 915 *| 	Debug Console
/* 916 *| 	The debug console is a self contained, in page location
/* 917 *| 	for debug message to be sent.  The Debug Console adds
/* 918 *| 	itself to the body if necessary.
/* 919 *| 
/* 920 *| 	The console is automatically scrolled as messages appear.
/* 921 *| 	
/* 922 *| 	If you are using your own debug handler or when you deploy to production and
/* 923 *| 	have debug disabled you can remove these functions to reduce the file size
/* 924 *| 	and complexity.
/* 925 *| ********************************** */
/* 926 */    
/* 927 */ // Private: debugMessage is the default debug_handler.  If you want to print debug messages
/* 928 */ // call the debug() function.  When overriding the function your own function should
/* 929 */ // check to see if the debug setting is true before outputting debug information.
/* 930 */ SWFUpload.prototype.debugMessage = function (message) {
/* 931 */ 	if (this.settings.debug) {
/* 932 */ 		var exceptionMessage, exceptionValues = [];
/* 933 */ 
/* 934 */ 		// Check for an exception object and print it nicely
/* 935 */ 		if (typeof message === "object" && typeof message.name === "string" && typeof message.message === "string") {
/* 936 */ 			for (var key in message) {
/* 937 */ 				if (message.hasOwnProperty(key)) {
/* 938 */ 					exceptionValues.push(key + ": " + message[key]);
/* 939 */ 				}
/* 940 */ 			}
/* 941 */ 			exceptionMessage = exceptionValues.join("\n") || "";
/* 942 */ 			exceptionValues = exceptionMessage.split("\n");
/* 943 */ 			exceptionMessage = "EXCEPTION: " + exceptionValues.join("\nEXCEPTION: ");
/* 944 */ 			SWFUpload.Console.writeLine(exceptionMessage);
/* 945 */ 		} else {
/* 946 */ 			SWFUpload.Console.writeLine(message);
/* 947 */ 		}
/* 948 */ 	}
/* 949 */ };
/* 950 */ 

/* swfupload.js */

/* 951 */ SWFUpload.Console = {};
/* 952 */ SWFUpload.Console.writeLine = function (message) {
/* 953 */ 	var console, documentForm;
/* 954 */ 
/* 955 */ 	try {
/* 956 */ 		console = document.getElementById("SWFUpload_Console");
/* 957 */ 
/* 958 */ 		if (!console) {
/* 959 */ 			documentForm = document.createElement("form");
/* 960 */ 			document.getElementsByTagName("body")[0].appendChild(documentForm);
/* 961 */ 
/* 962 */ 			console = document.createElement("textarea");
/* 963 */ 			console.id = "SWFUpload_Console";
/* 964 */ 			console.style.fontFamily = "monospace";
/* 965 */ 			console.setAttribute("wrap", "off");
/* 966 */ 			console.wrap = "off";
/* 967 */ 			console.style.overflow = "auto";
/* 968 */ 			console.style.width = "700px";
/* 969 */ 			console.style.height = "350px";
/* 970 */ 			console.style.margin = "5px";
/* 971 */ 			documentForm.appendChild(console);
/* 972 */ 		}
/* 973 */ 
/* 974 */ 		console.value += message + "\n";
/* 975 */ 
/* 976 */ 		console.scrollTop = console.scrollHeight - console.clientHeight;
/* 977 */ 	} catch (ex) {
/* 978 */ 		alert("Exception: " + ex.name + " Message: " + ex.message);
/* 979 */ 	}
/* 980 */ };
/* 981 */ 

;
/* swfupload.queue.js */

/* 1  */ /*
/* 2  *| 	Queue Plug-in
/* 3  *| 	
/* 4  *| 	Features:
/* 5  *| 		*Adds a cancelQueue() method for cancelling the entire queue.
/* 6  *| 		*All queued files are uploaded when startUpload() is called.
/* 7  *| 		*If false is returned from uploadComplete then the queue upload is stopped.
/* 8  *| 		 If false is not returned (strict comparison) then the queue upload is continued.
/* 9  *| 		*Adds a QueueComplete event that is fired when all the queued files have finished uploading.
/* 10 *| 		 Set the event handler with the queue_complete_handler setting.
/* 11 *| 		
/* 12 *| 	*/
/* 13 */ 
/* 14 */ var SWFUpload;
/* 15 */ if (typeof(SWFUpload) === "function") {
/* 16 */ 	SWFUpload.queue = {};
/* 17 */ 	
/* 18 */ 	SWFUpload.prototype.initSettings = (function (oldInitSettings) {
/* 19 */ 		return function () {
/* 20 */ 			if (typeof(oldInitSettings) === "function") {
/* 21 */ 				oldInitSettings.call(this);
/* 22 */ 			}
/* 23 */ 			
/* 24 */ 			this.queueSettings = {};
/* 25 */ 			
/* 26 */ 			this.queueSettings.queue_cancelled_flag = false;
/* 27 */ 			this.queueSettings.queue_upload_count = 0;
/* 28 */ 			
/* 29 */ 			this.queueSettings.user_upload_complete_handler = this.settings.upload_complete_handler;
/* 30 */ 			this.queueSettings.user_upload_start_handler = this.settings.upload_start_handler;
/* 31 */ 			this.settings.upload_complete_handler = SWFUpload.queue.uploadCompleteHandler;
/* 32 */ 			this.settings.upload_start_handler = SWFUpload.queue.uploadStartHandler;
/* 33 */ 			
/* 34 */ 			this.settings.queue_complete_handler = this.settings.queue_complete_handler || null;
/* 35 */ 		};
/* 36 */ 	})(SWFUpload.prototype.initSettings);
/* 37 */ 
/* 38 */ 	SWFUpload.prototype.startUpload = function (fileID) {
/* 39 */ 		this.queueSettings.queue_cancelled_flag = false;
/* 40 */ 		this.callFlash("StartUpload", [fileID]);
/* 41 */ 	};
/* 42 */ 
/* 43 */ 	SWFUpload.prototype.cancelQueue = function () {
/* 44 */ 		this.queueSettings.queue_cancelled_flag = true;
/* 45 */ 		this.stopUpload();
/* 46 */ 		
/* 47 */ 		var stats = this.getStats();
/* 48 */ 		while (stats.files_queued > 0) {
/* 49 */ 			this.cancelUpload();
/* 50 */ 			stats = this.getStats();

/* swfupload.queue.js */

/* 51 */ 		}
/* 52 */ 	};
/* 53 */ 	
/* 54 */ 	SWFUpload.queue.uploadStartHandler = function (file) {
/* 55 */ 		var returnValue;
/* 56 */ 		if (typeof(this.queueSettings.user_upload_start_handler) === "function") {
/* 57 */ 			returnValue = this.queueSettings.user_upload_start_handler.call(this, file);
/* 58 */ 		}
/* 59 */ 		
/* 60 */ 		// To prevent upload a real "FALSE" value must be returned, otherwise default to a real "TRUE" value.
/* 61 */ 		returnValue = (returnValue === false) ? false : true;
/* 62 */ 		
/* 63 */ 		this.queueSettings.queue_cancelled_flag = !returnValue;
/* 64 */ 
/* 65 */ 		return returnValue;
/* 66 */ 	};
/* 67 */ 	
/* 68 */ 	SWFUpload.queue.uploadCompleteHandler = function (file) {
/* 69 */ 		var user_upload_complete_handler = this.queueSettings.user_upload_complete_handler;
/* 70 */ 		var continueUpload;
/* 71 */ 		
/* 72 */ 		if (file.filestatus === SWFUpload.FILE_STATUS.COMPLETE) {
/* 73 */ 			this.queueSettings.queue_upload_count++;
/* 74 */ 		}
/* 75 */ 
/* 76 */ 		if (typeof(user_upload_complete_handler) === "function") {
/* 77 */ 			continueUpload = (user_upload_complete_handler.call(this, file) === false) ? false : true;
/* 78 */ 		} else if (file.filestatus === SWFUpload.FILE_STATUS.QUEUED) {
/* 79 */ 			// If the file was stopped and re-queued don't restart the upload
/* 80 */ 			continueUpload = false;
/* 81 */ 		} else {
/* 82 */ 			continueUpload = true;
/* 83 */ 		}
/* 84 */ 		
/* 85 */ 		if (continueUpload) {
/* 86 */ 			var stats = this.getStats();
/* 87 */ 			if (stats.files_queued > 0 && this.queueSettings.queue_cancelled_flag === false) {
/* 88 */ 				this.startUpload();
/* 89 */ 			} else if (this.queueSettings.queue_cancelled_flag === false) {
/* 90 */ 				this.queueEvent("queue_complete_handler", [this.queueSettings.queue_upload_count]);
/* 91 */ 				this.queueSettings.queue_upload_count = 0;
/* 92 */ 			} else {
/* 93 */ 				this.queueSettings.queue_cancelled_flag = false;
/* 94 */ 				this.queueSettings.queue_upload_count = 0;
/* 95 */ 			}
/* 96 */ 		}
/* 97 */ 	};
/* 98 */ }

;
/* swfupload.speed.js */

/* 1   */ /*
/* 2   *| 	Speed Plug-in
/* 3   *| 	
/* 4   *| 	Features:
/* 5   *| 		*Adds several properties to the 'file' object indicated upload speed, time left, upload time, etc.
/* 6   *| 			- currentSpeed -- String indicating the upload speed, bytes per second
/* 7   *| 			- averageSpeed -- Overall average upload speed, bytes per second
/* 8   *| 			- movingAverageSpeed -- Speed over averaged over the last several measurements, bytes per second
/* 9   *| 			- timeRemaining -- Estimated remaining upload time in seconds
/* 10  *| 			- timeElapsed -- Number of seconds passed for this upload
/* 11  *| 			- percentUploaded -- Percentage of the file uploaded (0 to 100)
/* 12  *| 			- sizeUploaded -- Formatted size uploaded so far, bytes
/* 13  *| 		
/* 14  *| 		*Adds setting 'moving_average_history_size' for defining the window size used to calculate the moving average speed.
/* 15  *| 		
/* 16  *| 		*Adds several Formatting functions for formatting that values provided on the file object.
/* 17  *| 			- SWFUpload.speed.formatBPS(bps) -- outputs string formatted in the best units (Gbps, Mbps, Kbps, bps)
/* 18  *| 			- SWFUpload.speed.formatTime(seconds) -- outputs string formatted in the best units (x Hr y M z S)
/* 19  *| 			- SWFUpload.speed.formatSize(bytes) -- outputs string formatted in the best units (w GB x MB y KB z B )
/* 20  *| 			- SWFUpload.speed.formatPercent(percent) -- outputs string formatted with a percent sign (x.xx %)
/* 21  *| 			- SWFUpload.speed.formatUnits(baseNumber, divisionArray, unitLabelArray, fractionalBoolean)
/* 22  *| 				- Formats a number using the division array to determine how to apply the labels in the Label Array
/* 23  *| 				- factionalBoolean indicates whether the number should be returned as a single fractional number with a unit (speed)
/* 24  *| 				    or as several numbers labeled with units (time)
/* 25  *| 	*/
/* 26  */ 
/* 27  */ var SWFUpload;
/* 28  */ if (typeof(SWFUpload) === "function") {
/* 29  */ 	SWFUpload.speed = {};
/* 30  */ 	
/* 31  */ 	SWFUpload.prototype.initSettings = (function (oldInitSettings) {
/* 32  */ 		return function () {
/* 33  */ 			if (typeof(oldInitSettings) === "function") {
/* 34  */ 				oldInitSettings.call(this);
/* 35  */ 			}
/* 36  */ 			
/* 37  */ 			this.ensureDefault = function (settingName, defaultValue) {
/* 38  */ 				this.settings[settingName] = (this.settings[settingName] == undefined) ? defaultValue : this.settings[settingName];
/* 39  */ 			};
/* 40  */ 
/* 41  */ 			// List used to keep the speed stats for the files we are tracking
/* 42  */ 			this.fileSpeedStats = {};
/* 43  */ 			this.speedSettings = {};
/* 44  */ 
/* 45  */ 			this.ensureDefault("moving_average_history_size", "10");
/* 46  */ 			
/* 47  */ 			this.speedSettings.user_file_queued_handler = this.settings.file_queued_handler;
/* 48  */ 			this.speedSettings.user_file_queue_error_handler = this.settings.file_queue_error_handler;
/* 49  */ 			this.speedSettings.user_upload_start_handler = this.settings.upload_start_handler;
/* 50  */ 			this.speedSettings.user_upload_error_handler = this.settings.upload_error_handler;

/* swfupload.speed.js */

/* 51  */ 			this.speedSettings.user_upload_progress_handler = this.settings.upload_progress_handler;
/* 52  */ 			this.speedSettings.user_upload_success_handler = this.settings.upload_success_handler;
/* 53  */ 			this.speedSettings.user_upload_complete_handler = this.settings.upload_complete_handler;
/* 54  */ 			
/* 55  */ 			this.settings.file_queued_handler = SWFUpload.speed.fileQueuedHandler;
/* 56  */ 			this.settings.file_queue_error_handler = SWFUpload.speed.fileQueueErrorHandler;
/* 57  */ 			this.settings.upload_start_handler = SWFUpload.speed.uploadStartHandler;
/* 58  */ 			this.settings.upload_error_handler = SWFUpload.speed.uploadErrorHandler;
/* 59  */ 			this.settings.upload_progress_handler = SWFUpload.speed.uploadProgressHandler;
/* 60  */ 			this.settings.upload_success_handler = SWFUpload.speed.uploadSuccessHandler;
/* 61  */ 			this.settings.upload_complete_handler = SWFUpload.speed.uploadCompleteHandler;
/* 62  */ 			
/* 63  */ 			delete this.ensureDefault;
/* 64  */ 		};
/* 65  */ 	})(SWFUpload.prototype.initSettings);
/* 66  */ 
/* 67  */ 	
/* 68  */ 	SWFUpload.speed.fileQueuedHandler = function (file) {
/* 69  */ 		if (typeof this.speedSettings.user_file_queued_handler === "function") {
/* 70  */ 			file = SWFUpload.speed.extendFile(file);
/* 71  */ 			
/* 72  */ 			return this.speedSettings.user_file_queued_handler.call(this, file);
/* 73  */ 		}
/* 74  */ 	};
/* 75  */ 	
/* 76  */ 	SWFUpload.speed.fileQueueErrorHandler = function (file, errorCode, message) {
/* 77  */ 		if (typeof this.speedSettings.user_file_queue_error_handler === "function") {
/* 78  */ 			file = SWFUpload.speed.extendFile(file);
/* 79  */ 			
/* 80  */ 			return this.speedSettings.user_file_queue_error_handler.call(this, file, errorCode, message);
/* 81  */ 		}
/* 82  */ 	};
/* 83  */ 
/* 84  */ 	SWFUpload.speed.uploadStartHandler = function (file) {
/* 85  */ 		if (typeof this.speedSettings.user_upload_start_handler === "function") {
/* 86  */ 			file = SWFUpload.speed.extendFile(file, this.fileSpeedStats);
/* 87  */ 			return this.speedSettings.user_upload_start_handler.call(this, file);
/* 88  */ 		}
/* 89  */ 	};
/* 90  */ 	
/* 91  */ 	SWFUpload.speed.uploadErrorHandler = function (file, errorCode, message) {
/* 92  */ 		file = SWFUpload.speed.extendFile(file, this.fileSpeedStats);
/* 93  */ 		SWFUpload.speed.removeTracking(file, this.fileSpeedStats);
/* 94  */ 
/* 95  */ 		if (typeof this.speedSettings.user_upload_error_handler === "function") {
/* 96  */ 			return this.speedSettings.user_upload_error_handler.call(this, file, errorCode, message);
/* 97  */ 		}
/* 98  */ 	};
/* 99  */ 	SWFUpload.speed.uploadProgressHandler = function (file, bytesComplete, bytesTotal) {
/* 100 */ 		this.updateTracking(file, bytesComplete);

/* swfupload.speed.js */

/* 101 */ 		file = SWFUpload.speed.extendFile(file, this.fileSpeedStats);
/* 102 */ 
/* 103 */ 		if (typeof this.speedSettings.user_upload_progress_handler === "function") {
/* 104 */ 			return this.speedSettings.user_upload_progress_handler.call(this, file, bytesComplete, bytesTotal);
/* 105 */ 		}
/* 106 */ 	};
/* 107 */ 	
/* 108 */ 	SWFUpload.speed.uploadSuccessHandler = function (file, serverData) {
/* 109 */ 		if (typeof this.speedSettings.user_upload_success_handler === "function") {
/* 110 */ 			file = SWFUpload.speed.extendFile(file, this.fileSpeedStats);
/* 111 */ 			return this.speedSettings.user_upload_success_handler.call(this, file, serverData);
/* 112 */ 		}
/* 113 */ 	};
/* 114 */ 	SWFUpload.speed.uploadCompleteHandler = function (file) {
/* 115 */ 		file = SWFUpload.speed.extendFile(file, this.fileSpeedStats);
/* 116 */ 		SWFUpload.speed.removeTracking(file, this.fileSpeedStats);
/* 117 */ 
/* 118 */ 		if (typeof this.speedSettings.user_upload_complete_handler === "function") {
/* 119 */ 			return this.speedSettings.user_upload_complete_handler.call(this, file);
/* 120 */ 		}
/* 121 */ 	};
/* 122 */ 	
/* 123 */ 	// Private: extends the file object with the speed plugin values
/* 124 */ 	SWFUpload.speed.extendFile = function (file, trackingList) {
/* 125 */ 		var tracking;
/* 126 */ 		
/* 127 */ 		if (trackingList) {
/* 128 */ 			tracking = trackingList[file.id];
/* 129 */ 		}
/* 130 */ 		
/* 131 */ 		if (tracking) {
/* 132 */ 			file.currentSpeed = tracking.currentSpeed;
/* 133 */ 			file.averageSpeed = tracking.averageSpeed;
/* 134 */ 			file.movingAverageSpeed = tracking.movingAverageSpeed;
/* 135 */ 			file.timeRemaining = tracking.timeRemaining;
/* 136 */ 			file.timeElapsed = tracking.timeElapsed;
/* 137 */ 			file.percentUploaded = tracking.percentUploaded;
/* 138 */ 			file.sizeUploaded = tracking.bytesUploaded;
/* 139 */ 
/* 140 */ 		} else {
/* 141 */ 			file.currentSpeed = 0;
/* 142 */ 			file.averageSpeed = 0;
/* 143 */ 			file.movingAverageSpeed = 0;
/* 144 */ 			file.timeRemaining = 0;
/* 145 */ 			file.timeElapsed = 0;
/* 146 */ 			file.percentUploaded = 0;
/* 147 */ 			file.sizeUploaded = 0;
/* 148 */ 		}
/* 149 */ 		
/* 150 */ 		return file;

/* swfupload.speed.js */

/* 151 */ 	};
/* 152 */ 	
/* 153 */ 	// Private: Updates the speed tracking object, or creates it if necessary
/* 154 */ 	SWFUpload.prototype.updateTracking = function (file, bytesUploaded) {
/* 155 */ 		var tracking = this.fileSpeedStats[file.id];
/* 156 */ 		if (!tracking) {
/* 157 */ 			this.fileSpeedStats[file.id] = tracking = {};
/* 158 */ 		}
/* 159 */ 		
/* 160 */ 		// Sanity check inputs
/* 161 */ 		bytesUploaded = bytesUploaded || tracking.bytesUploaded || 0;
/* 162 */ 		if (bytesUploaded < 0) {
/* 163 */ 			bytesUploaded = 0;
/* 164 */ 		}
/* 165 */ 		if (bytesUploaded > file.size) {
/* 166 */ 			bytesUploaded = file.size;
/* 167 */ 		}
/* 168 */ 		
/* 169 */ 		var tickTime = (new Date()).getTime();
/* 170 */ 		if (!tracking.startTime) {
/* 171 */ 			tracking.startTime = (new Date()).getTime();
/* 172 */ 			tracking.lastTime = tracking.startTime;
/* 173 */ 			tracking.currentSpeed = 0;
/* 174 */ 			tracking.averageSpeed = 0;
/* 175 */ 			tracking.movingAverageSpeed = 0;
/* 176 */ 			tracking.movingAverageHistory = [];
/* 177 */ 			tracking.timeRemaining = 0;
/* 178 */ 			tracking.timeElapsed = 0;
/* 179 */ 			tracking.percentUploaded = bytesUploaded / file.size;
/* 180 */ 			tracking.bytesUploaded = bytesUploaded;
/* 181 */ 		} else if (tracking.startTime > tickTime) {
/* 182 */ 			this.debug("When backwards in time");
/* 183 */ 		} else {
/* 184 */ 			// Get time and deltas
/* 185 */ 			var now = (new Date()).getTime();
/* 186 */ 			var lastTime = tracking.lastTime;
/* 187 */ 			var deltaTime = now - lastTime;
/* 188 */ 			var deltaBytes = bytesUploaded - tracking.bytesUploaded;
/* 189 */ 			
/* 190 */ 			if (deltaBytes === 0 || deltaTime === 0) {
/* 191 */ 				return tracking;
/* 192 */ 			}
/* 193 */ 			
/* 194 */ 			// Update tracking object
/* 195 */ 			tracking.lastTime = now;
/* 196 */ 			tracking.bytesUploaded = bytesUploaded;
/* 197 */ 			
/* 198 */ 			// Calculate speeds
/* 199 */ 			tracking.currentSpeed = (deltaBytes * 8 ) / (deltaTime / 1000);
/* 200 */ 			tracking.averageSpeed = (tracking.bytesUploaded * 8) / ((now - tracking.startTime) / 1000);

/* swfupload.speed.js */

/* 201 */ 
/* 202 */ 			// Calculate moving average
/* 203 */ 			tracking.movingAverageHistory.push(tracking.currentSpeed);
/* 204 */ 			if (tracking.movingAverageHistory.length > this.settings.moving_average_history_size) {
/* 205 */ 				tracking.movingAverageHistory.shift();
/* 206 */ 			}
/* 207 */ 			
/* 208 */ 			tracking.movingAverageSpeed = SWFUpload.speed.calculateMovingAverage(tracking.movingAverageHistory);
/* 209 */ 			
/* 210 */ 			// Update times
/* 211 */ 			tracking.timeRemaining = (file.size - tracking.bytesUploaded) * 8 / tracking.movingAverageSpeed;
/* 212 */ 			tracking.timeElapsed = (now - tracking.startTime) / 1000;
/* 213 */ 			
/* 214 */ 			// Update percent
/* 215 */ 			tracking.percentUploaded = (tracking.bytesUploaded / file.size * 100);
/* 216 */ 		}
/* 217 */ 		
/* 218 */ 		return tracking;
/* 219 */ 	};
/* 220 */ 	SWFUpload.speed.removeTracking = function (file, trackingList) {
/* 221 */ 		try {
/* 222 */ 			trackingList[file.id] = null;
/* 223 */ 			delete trackingList[file.id];
/* 224 */ 		} catch (ex) {
/* 225 */ 		}
/* 226 */ 	};
/* 227 */ 	
/* 228 */ 	SWFUpload.speed.formatUnits = function (baseNumber, unitDivisors, unitLabels, singleFractional) {
/* 229 */ 		var i, unit, unitDivisor, unitLabel;
/* 230 */ 
/* 231 */ 		if (baseNumber === 0) {
/* 232 */ 			return "0 " + unitLabels[unitLabels.length - 1];
/* 233 */ 		}
/* 234 */ 		
/* 235 */ 		if (singleFractional) {
/* 236 */ 			unit = baseNumber;
/* 237 */ 			unitLabel = unitLabels.length >= unitDivisors.length ? unitLabels[unitDivisors.length - 1] : "";
/* 238 */ 			for (i = 0; i < unitDivisors.length; i++) {
/* 239 */ 				if (baseNumber >= unitDivisors[i]) {
/* 240 */ 					unit = (baseNumber / unitDivisors[i]).toFixed(2);
/* 241 */ 					unitLabel = unitLabels.length >= i ? " " + unitLabels[i] : "";
/* 242 */ 					break;
/* 243 */ 				}
/* 244 */ 			}
/* 245 */ 			
/* 246 */ 			return unit + unitLabel;
/* 247 */ 		} else {
/* 248 */ 			var formattedStrings = [];
/* 249 */ 			var remainder = baseNumber;
/* 250 */ 			

/* swfupload.speed.js */

/* 251 */ 			for (i = 0; i < unitDivisors.length; i++) {
/* 252 */ 				unitDivisor = unitDivisors[i];
/* 253 */ 				unitLabel = unitLabels.length > i ? " " + unitLabels[i] : "";
/* 254 */ 				
/* 255 */ 				unit = remainder / unitDivisor;
/* 256 */ 				if (i < unitDivisors.length -1) {
/* 257 */ 					unit = Math.floor(unit);
/* 258 */ 				} else {
/* 259 */ 					unit = (unitLabel.trim()=='s')?Math.round(unit):unit.toFixed(2);
/* 260 */ 				}
/* 261 */ 				if (unit > 0) {
/* 262 */ 					remainder = remainder % unitDivisor;
/* 263 */ 					
/* 264 */ 					formattedStrings.push(unit + unitLabel);
/* 265 */ 				}
/* 266 */ 			}
/* 267 */ 			
/* 268 */ 			return formattedStrings.join(" ");
/* 269 */ 		}
/* 270 */ 	};
/* 271 */ 	
/* 272 */ 	SWFUpload.speed.formatBPS = function (baseNumber) {
/* 273 */ 		var bpsUnits = [1073741824, 1048576, 1024, 1], bpsUnitLabels = ["Gbps", "Mbps", "Kbps", "bps"];
/* 274 */ 		return SWFUpload.speed.formatUnits(baseNumber, bpsUnits, bpsUnitLabels, true);
/* 275 */ 	
/* 276 */ 	};
/* 277 */ 	SWFUpload.speed.formatTime = function (baseNumber) {
/* 278 */ 		var timeUnits = [86400, 3600, 60, 1], timeUnitLabels = ["d", "h", "m", "s"];
/* 279 */ 		return SWFUpload.speed.formatUnits(baseNumber, timeUnits, timeUnitLabels, false);
/* 280 */ 	
/* 281 */ 	};
/* 282 */ 	SWFUpload.speed.formatBytes = function (baseNumber) {
/* 283 */ 		var sizeUnits = [1073741824, 1048576, 1024, 1], sizeUnitLabels = ["GB", "MB", "KB", "bytes"];
/* 284 */ 		return SWFUpload.speed.formatUnits(baseNumber, sizeUnits, sizeUnitLabels, true);
/* 285 */ 	
/* 286 */ 	};
/* 287 */ 	SWFUpload.speed.formatPercent = function (baseNumber) {
/* 288 */ 		return baseNumber.toFixed(2) + " %";
/* 289 */ 	};
/* 290 */ 	
/* 291 */ 	SWFUpload.speed.calculateMovingAverage = function (history) {
/* 292 */ 		var vals = [], size, sum = 0.0, mean = 0.0, varianceTemp = 0.0, variance = 0.0, standardDev = 0.0;
/* 293 */ 		var i;
/* 294 */ 		var mSum = 0, mCount = 0;
/* 295 */ 		
/* 296 */ 		size = history.length;
/* 297 */ 		
/* 298 */ 		// Check for sufficient data
/* 299 */ 		if (size >= 8) {
/* 300 */ 			// Clone the array and Calculate sum of the values 

/* swfupload.speed.js */

/* 301 */ 			for (i = 0; i < size; i++) {
/* 302 */ 				vals[i] = history[i];
/* 303 */ 				sum += vals[i];
/* 304 */ 			}
/* 305 */ 
/* 306 */ 			mean = sum / size;
/* 307 */ 
/* 308 */ 			// Calculate variance for the set
/* 309 */ 			for (i = 0; i < size; i++) {
/* 310 */ 				varianceTemp += Math.pow((vals[i] - mean), 2);
/* 311 */ 			}
/* 312 */ 
/* 313 */ 			variance = varianceTemp / size;
/* 314 */ 			standardDev = Math.sqrt(variance);
/* 315 */ 			
/* 316 */ 			//Standardize the Data
/* 317 */ 			for (i = 0; i < size; i++) {
/* 318 */ 				vals[i] = (vals[i] - mean) / standardDev;
/* 319 */ 			}
/* 320 */ 
/* 321 */ 			// Calculate the average excluding outliers
/* 322 */ 			var deviationRange = 2.0;
/* 323 */ 			for (i = 0; i < size; i++) {
/* 324 */ 				
/* 325 */ 				if (vals[i] <= deviationRange && vals[i] >= -deviationRange) {
/* 326 */ 					mCount++;
/* 327 */ 					mSum += history[i];
/* 328 */ 				}
/* 329 */ 			}
/* 330 */ 			
/* 331 */ 		} else {
/* 332 */ 			// Calculate the average (not enough data points to remove outliers)
/* 333 */ 			mCount = size;
/* 334 */ 			for (i = 0; i < size; i++) {
/* 335 */ 				mSum += history[i];
/* 336 */ 			}
/* 337 */ 		}
/* 338 */ 
/* 339 */ 		return mSum / mCount;
/* 340 */ 	};
/* 341 */ 	
/* 342 */ }

;
/* uploadr.js */

/* 1   */ var uploadr = {
/* 2   */ 	options: {
/* 3   */ 		
/* 4   */ 	},
/* 5   */ 	isencoding: [],
/* 6   */ 	iserror: [],
/* 7   */ 	
/* 8   */ 	queue: function (file) {
/* 9   */ 		try {
/* 10  */ 			this.customSettings.on_queue(); //callback: on_queue
/* 11  */ 		} catch (ex) {
/* 12  */ 			this.debug(ex);
/* 13  */ 		}
/* 14  */ 	},
/* 15  */ 	
/* 16  */ 	file_queue: function (file) {
/* 17  */ 		try {
/* 18  */ 			this.customSettings.on_select_success(); //callback: on_select_success
/* 19  */ 			var progress = new fileprogress(file, this.customSettings);
/* 20  */ 			progress.toggle_cancel(true, this);
/* 21  */ 			if (!this.customSettings.auto_start) {
/* 22  */ 				document.getElementById(progress.browseID).style.display = "none";
/* 23  */ 				document.getElementById(progress.buttonwrapperID).style.height = "0";
/* 24  */ 				//var btn = document.getElementById(progress.buttonwrapperID);
/* 25  */ 				//btn.style.visibility = "hidden";
/* 26  */ 				//btn.style.height = "0";
/* 27  */ 			}
/* 28  */ 		} catch (ex) {
/* 29  */ 			this.debug(ex);
/* 30  */ 		}
/* 31  */ 	},
/* 32  */ 
/* 33  */ 	file_queue_error: function (file, errorCode, message) {
/* 34  */ 		try {
/* 35  */ 			var errorName = "";
/* 36  */ 			if (errorCode === SWFUpload.errorCode_QUEUE_LIMIT_EXCEEDED) {
/* 37  */ 				errorName = "You have attempted to queue too many files.";
/* 38  */ 			}
/* 39  */ 	
/* 40  */ 			if (errorName !== "") {
/* 41  */ 				alert(errorName);
/* 42  */ 				return;
/* 43  */ 			}
/* 44  */ 			
/* 45  */ 			var progress = new fileprogress(file, this.customSettings);
/* 46  */ 			progress.toggle_cancel(false);
/* 47  */ 			
/* 48  */ 			this.customSettings.on_fail(); //callback: on_fail
/* 49  */ 	
/* 50  */ 			switch (errorCode) {

/* uploadr.js */

/* 51  */ 				case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:
/* 52  */ 					progress.set_error(message);
/* 53  */ 					this.debug("Error Code: HTTP Error, File name: " + file.name + ", Message: " + message);
/* 54  */ 					break;
/* 55  */ 				case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED:
/* 56  */ 					progress.set_error("Upload failed.");
/* 57  */ 					this.debug("Error Code: Upload Failed, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
/* 58  */ 					break;
/* 59  */ 				case SWFUpload.UPLOAD_ERROR.IO_ERROR:
/* 60  */ 					progress.set_error("Server error");
/* 61  */ 					this.debug("Error Code: IO Error, File name: " + file.name + ", Message: " + message);
/* 62  */ 					break;
/* 63  */ 				case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR:
/* 64  */ 					progress.set_error("Security error");
/* 65  */ 					this.debug("Error Code: Security Error, File name: " + file.name + ", Message: " + message);
/* 66  */ 					break;
/* 67  */ 				case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:
/* 68  */ 					progress.set_error("File '" + file.name + "' has zero byte");
/* 69  */ 					this.debug("Error Code: Zero bype file, File name: " + file.name + ", Message: " + message);
/* 70  */ 					break;
/* 71  */ 				case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:
/* 72  */ 					progress.set_error("Upload limit exceeded.");
/* 73  */ 					this.debug("Error Code: Upload Limit Exceeded, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
/* 74  */ 					break;
/* 75  */ 				case SWFUpload.UPLOAD_ERROR.FILE_VALIDATION_FAILED:
/* 76  */ 					progress.set_error("File '" + file.name + "' is an invalid upload type");
/* 77  */ 					this.debug("Error Code: File Validation Failed, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
/* 78  */ 					break;
/* 79  */ 				case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:
/* 80  */ 				case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:
/* 81  */ 					progress.setCancelled();
/* 82  */ 					break;
/* 83  */ 				default:
/* 84  */ 					progress.set_error(message);
/* 85  */ 					this.debug("Error Code: " + errorCode + ", File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
/* 86  */ 					break;
/* 87  */ 			}
/* 88  */ 	
/* 89  */ 		} catch (ex) {
/* 90  */ 			this.debug(ex);
/* 91  */ 		}
/* 92  */ 	},
/* 93  */ 	
/* 94  */ 	file_dialog_start: function () {
/* 95  */ 		try {
/* 96  */ 			
/* 97  */ 		} catch (ex) {
/* 98  */ 			this.debug(ex);
/* 99  */ 		}
/* 100 */ 	},

/* uploadr.js */

/* 101 */ 
/* 102 */ 	file_dialog_complete: function (numFilesSelected, numFilesQueued) {
/* 103 */ 		try {
/* 104 */ 			if (numFilesSelected > this.settings.file_queue_limit) {
/* 105 */ 				progress.setStatus("Error: Upload limit exceeded.");
/* 106 */ 				return;
/* 107 */ 			}
/* 108 */ 			if (numFilesQueued > 0) {
/* 109 */ 				if (this.customSettings.auto_start) {
/* 110 */ 					this.customSettings.on_before_start(); //callback: on_before_start
/* 111 */ 					this.startUpload();
/* 112 */ 				} else {
/* 113 */ 					
/* 114 */ 				}
/* 115 */ 			}
/* 116 */ 		} catch (ex) {
/* 117 */ 			this.debug(ex);
/* 118 */ 		}
/* 119 */ 	},
/* 120 */ 
/* 121 */ 	progress: function (file, bytesLoaded) {
/* 122 */ 		try {
/* 123 */ 			var percent = Math.ceil((bytesLoaded / file.size) * 100);
/* 124 */ 			var progress = new fileprogress(file,  this.customSettings);
/* 125 */ 			progress.update_display(file);
/* 126 */ 			progress.set_progress(percent);
/* 127 */ 			if (percent === 100) {
/* 128 */ 				progress.set_status("Uploading ( 100% ):");
/* 129 */ 				progress.toggle_cancel(false, this);
/* 130 */ 			} else {
/* 131 */ 				progress.set_status("Uploading ( " + percent + "% ):");
/* 132 */ 				progress.toggle_cancel(true, this);
/* 133 */ 			}
/* 134 */ 		} catch (ex) {
/* 135 */ 			this.debug(ex);
/* 136 */ 		}
/* 137 */ 	},
/* 138 */ 	
/* 139 */ 	start: function (file) {
/* 140 */ 		try {
/* 141 */ 			//this.customSettings.progressCount = 0;
/* 142 */ 			this.customSettings.on_start(); //callback: on_start
/* 143 */ 			var progress = new fileprogress(file,  this.customSettings);
/* 144 */ 			progress.set_start();
/* 145 */ 		}
/* 146 */ 		catch (ex) {
/* 147 */ 			this.debug(ex);
/* 148 */ 		}
/* 149 */ 	},
/* 150 */ 	

/* uploadr.js */

/* 151 */ 	disable: function () {
/* 152 */ 		try {
/* 153 */ 			//this.settings.button_disabled = true;
/* 154 */ 			document.getElementById(this.movieName).style.height = "0";
/* 155 */ 			var btn = document.getElementById(this.customSettings.instance + "-browse");
/* 156 */ 			btn.className = btn.className + " disabled";
/* 157 */ 		}
/* 158 */ 		catch (ex) {
/* 159 */ 			this.debug(ex);
/* 160 */ 		}
/* 161 */ 	},
/* 162 */ 	
/* 163 */ 	enable: function () {
/* 164 */ 		try {
/* 165 */ 			//this.settings.button_disabled = false;
/* 166 */ 			document.getElementById(this.movieName).style.height = "100%";
/* 167 */ 			var btn = document.getElementById(this.customSettings.instance + "-browse");
/* 168 */ 			var cls = btn.className.split(" ");
/* 169 */ 			var idx = cls.indexOf("disabled");
/* 170 */ 			if(idx != -1){
/* 171 */ 				cls.splice(idx, 1);
/* 172 */ 				btn.className = cls.join(" ");
/* 173 */ 			}
/* 174 */ 		}
/* 175 */ 		catch (ex) {
/* 176 */ 			this.debug(ex);
/* 177 */ 		}
/* 178 */ 	},
/* 179 */ 
/* 180 */ 	success: function (file, json) {
/* 181 */ 		try {
/* 182 */ 			json = (JSON.parse) ? JSON.parse(json) : eval(json);
/* 183 */ 			
/* 184 */ 			var progress = new fileprogress(file,  this.customSettings);
/* 185 */ 			if (json.result == "success") {
/* 186 */ 				uploadr.log("upload success.");
/* 187 */ 				
/* 188 */ 				uploadr.iserror[this.customSettings.instance] = 0;
/* 189 */ 				this.settings.button_disabled = false;
/* 190 */ 				
/* 191 */ 				if ((json.type == 2 || json.type == 4) && this.customSettings.encoding_url) {
/* 192 */ 					uploadr.log("encoding started.");
/* 193 */ 					progress.set_encoding();
/* 194 */ 					uploadr.isencoding[this.customSettings.instance] = 1;
/* 195 */ 					uploadr.encode.call(this, file, this.customSettings.encoding_url);
/* 196 */ 					if (!this.customSettings.clear_on_complete) {
/* 197 */ 						this.settings.button_disabled = true;
/* 198 */ 					}
/* 199 */ 				} else {
/* 200 */ 					uploadr.isencoding[this.customSettings.instance] = 0;

/* uploadr.js */

/* 201 */ 				}
/* 202 */ 			} else {
/* 203 */ 				uploadr.log("upload fail.");
/* 204 */ 				this.customSettings.on_fail(); //callback: on_fail
/* 205 */ 				
/* 206 */ 				uploadr.iserror[this.customSettings.instance] = 1;
/* 207 */ 				progress.set_error(json.error);
/* 208 */ 			}
/* 209 */ 		} catch (ex) {
/* 210 */ 			this.debug(ex);
/* 211 */ 		}
/* 212 */ 	},
/* 213 */ 	
/* 214 */ 	encode: function (file, url) {
/* 215 */ 		try {
/* 216 */ 			this.customSettings.on_encode_start(); //callback: on_encode_start
/* 217 */ 			
/* 218 */ 			var self = this;
/* 219 */ 			var rate = 1000;
/* 220 */ 			var percent = 5;
/* 221 */ 			var progress = new fileprogress(file, this.customSettings);
/* 222 */ 			
/* 223 */ 			var encode = function () {
/* 224 */ 				if (window.XMLHttpRequest) {
/* 225 */ 					xhttp = new XMLHttpRequest();
/* 226 */ 				} else {
/* 227 */ 					xhttp = new ActiveXObject("Microsoft.XMLHTTP");
/* 228 */ 				}
/* 229 */ 				xhttp.open("GET", url, true);
/* 230 */ 				xhttp.onreadystatechange = function() {
/* 231 */ 			        if (xhttp.readyState == 4) {
/* 232 */ 			            if (xhttp.status >= 200 && xhttp.status < 300) {
/* 233 */ 			            	json = (JSON.parse) ? JSON.parse(xhttp.responseText) : eval(xhttp.responseText);
/* 234 */ 			            	if (!json) return;
/* 235 */ 			            	if (percent>100) return;
/* 236 */ 			            	json = json.assetInfo;
/* 237 */ 			            	percent = json.currPercent;
/* 238 */ 			            	if (percent == 100 && json.generatingThumbs == 2) {
/* 239 */ 			            		uploadr.log("encoding completed.");
/* 240 */ 			            		self.customSettings.on_encode_complete(); //callback: on_encode_complete
/* 241 */ 			            		percent = 101;
/* 242 */ 								progress.set_encoding_status(101, 0, self.customSettings);
/* 243 */ 							} else {
/* 244 */ 								progress.set_encoding_status(percent, ((json.generatingThumbs == 3) ? 1 : 0), self.customSettings);
/* 245 */ 							}
/* 246 */ 			            }
/* 247 */ 			        }
/* 248 */ 			    };
/* 249 */ 			    xhttp.send();
/* 250 */ 			};

/* uploadr.js */

/* 251 */ 			
/* 252 */ 			var periodical = function () {
/* 253 */ 				if (percent < 101) {
/* 254 */ 					setTimeout(function () {
/* 255 */ 						encode(file, url);
/* 256 */ 						if (percent < 101) {
/* 257 */ 							periodical();
/* 258 */ 						}
/* 259 */ 					}, rate);
/* 260 */ 				}
/* 261 */ 			};
/* 262 */ 			periodical();
/* 263 */ 		} catch (ex) {
/* 264 */ 			this.debug(ex);
/* 265 */ 		}
/* 266 */ 	},
/* 267 */ 	
/* 268 */ 	complete: function (file) {
/* 269 */ 		try {
/* 270 */ 			if (this.getStats().files_queued > 0) {
/* 271 */ 				this.startUpload();
/* 272 */ 			} else {
/* 273 */ 				var progress = new fileprogress(file,  this.customSettings);
/* 274 */ 				if (!uploadr.isencoding[this.customSettings.instance] && !uploadr.iserror[this.customSettings.instance]) {
/* 275 */ 					progress.set_complete(this.customSettings);
/* 276 */ 				}
/* 277 */ 				if (!uploadr.iserror[this.customSettings.instance]) {
/* 278 */ 					this.customSettings.on_complete(); //callback: on_complete
/* 279 */ 				}
/* 280 */ 				progress.toggle_cancel((uploadr.iserror[this.customSettings.instance]) ? true : false);
/* 281 */ 			}
/* 282 */ 		} catch (ex) {
/* 283 */ 			this.debug(ex);
/* 284 */ 		}
/* 285 */ 	},
/* 286 */ 	
/* 287 */ 	error: function (file, errorCode, message) {
/* 288 */ 		var progress;
/* 289 */ 		try {
/* 290 */ 			this.customSettings.on_cancel(); //callback: on_cancel
/* 291 */ 			switch (errorCode) {
/* 292 */ 				case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:
/* 293 */ 					try {
/* 294 */ 						progress = new fileprogress(file,  this.customSettings);
/* 295 */ 						progress.set_cancelled();
/* 296 */ 						//progress.set_status("Cancelled");
/* 297 */ 						progress.toggle_cancel(false);
/* 298 */ 					} catch (ex1) {
/* 299 */ 						this.debug(ex1);
/* 300 */ 					}

/* uploadr.js */

/* 301 */ 					break;
/* 302 */ 				case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:
/* 303 */ 					try {
/* 304 */ 						progress = new fileprogress(file,  this.customSettings);
/* 305 */ 						progress.set_cancelled();
/* 306 */ 						//progress.set_status("Stopped");
/* 307 */ 						progress.toggle_cancel(true);
/* 308 */ 					} catch (ex2) {
/* 309 */ 						this.debug(ex2);
/* 310 */ 					}
/* 311 */ 					break;
/* 312 */ 				case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:
/* 313 */ 					try {
/* 314 */ 						alert("The file " + file.name + " too large!");
/* 315 */ 					} catch (ex2) {
/* 316 */ 						this.debug(ex2);
/* 317 */ 					}
/* 318 */ 					break;
/* 319 */ 				default:
/* 320 */ 					try {
/* 321 */ 						
/* 322 */ 					} catch (ex2) {
/* 323 */ 						this.debug(ex2);
/* 324 */ 					}
/* 325 */ 					break;
/* 326 */ 			}
/* 327 */ 	
/* 328 */ 		} catch (ex3) {
/* 329 */ 			this.debug(ex3);
/* 330 */ 		}
/* 331 */ 	
/* 332 */ 	},
/* 333 */ 	
/* 334 */ 	loaded: function () {
/* 335 */ 		try {
/* 336 */ 			if (this.customSettings.start_disabled) {
/* 337 */ 				uploadr.disable.call(this);
/* 338 */ 			}
/* 339 */ 		} catch (ex) {
/* 340 */ 			this.debug(ex);
/* 341 */ 		}
/* 342 */ 	},
/* 343 */ 	
/* 344 */ 	reset: function () {
/* 345 */ 		try {
/* 346 */ 			document.getElementById(this.customSettings.instance + "-progresscontainer").style.display = "none";
/* 347 */ 			document.getElementById(this.customSettings.instance + "-progressbar").style.width = "";
/* 348 */ 			document.getElementById(this.customSettings.instance + "-progress-speed").innerHTML = "";
/* 349 */ 			document.getElementById(this.customSettings.instance + "-progress-time").innerHTML = "";
/* 350 */ 			document.getElementById(this.customSettings.instance + "-progressbarstatus").className = "progressbarstatus";

/* uploadr.js */

/* 351 */ 			
/* 352 */ 			document.getElementById(this.customSettings.instance + "-browse").style.display = "block";
/* 353 */ 			document.getElementById(this.customSettings.instance + "-button").style.height = "auto";
/* 354 */ 			
/* 355 */ 			//var btn = document.getElementById(this.customSettings.instance + "-button");
/* 356 */ 			//btn.style.visibility = "visible";
/* 357 */ 			//btn.style.height = "auto";
/* 358 */ 			
/* 359 */ 			this.cancelQueue();
/* 360 */ 		} catch (ex) {
/* 361 */ 			this.debug(ex);
/* 362 */ 		}
/* 363 */ 	},
/* 364 */ 	
/* 365 */ 	fade_in: function (element, opacity) {
/* 366 */ 		var reduceOpacityBy = 10;
/* 367 */ 		var rate = 30;	// 15 fps
/* 368 */ 	
/* 369 */ 	
/* 370 */ 		if (opacity < 100) {
/* 371 */ 			opacity += reduceOpacityBy;
/* 372 */ 			if (opacity > 100) {
/* 373 */ 				opacity = 100;
/* 374 */ 			}
/* 375 */ 	
/* 376 */ 			if (element.filters) {
/* 377 */ 				try {
/* 378 */ 					element.filters.item("DXImageTransform.Microsoft.Alpha").opacity = opacity;
/* 379 */ 				} catch (e) {
/* 380 */ 					// If it is not set initially, the browser will throw an error.  This will set it if it is not set yet.
/* 381 */ 					element.style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=" + opacity + ")";
/* 382 */ 				}
/* 383 */ 			} else {
/* 384 */ 				element.style.opacity = opacity / 100;
/* 385 */ 			}
/* 386 */ 		}
/* 387 */ 	
/* 388 */ 		if (opacity < 100) {
/* 389 */ 			setTimeout(function () {
/* 390 */ 				uploadr.fade_in(element, opacity);
/* 391 */ 			}, rate);
/* 392 */ 		}
/* 393 */ 	},
/* 394 */ 	
/* 395 */ 	fade_out: function (element, opacity, height) {
/* 396 */ 		var reduceOpacityBy = 15;
/* 397 */ 		var reduceHeightBy = 4;
/* 398 */ 		var rate = 30;	// 15 fps
/* 399 */ 
/* 400 */ 		if (opacity > 0) {

/* uploadr.js */

/* 401 */ 			opacity -= reduceOpacityBy;
/* 402 */ 			if (opacity < 0) {
/* 403 */ 				opacity = 0;
/* 404 */ 			}
/* 405 */ 
/* 406 */ 			if (element.filters) {
/* 407 */ 				try {
/* 408 */ 					element.filters.item("DXImageTransform.Microsoft.Alpha").opacity = opacity;
/* 409 */ 				} catch (e) {
/* 410 */ 					// If it is not set initially, the browser will throw an error.  This will set it if it is not set yet.
/* 411 */ 					element.style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=" + opacity + ")";
/* 412 */ 				}
/* 413 */ 			} else {
/* 414 */ 				element.style.opacity = opacity / 100;
/* 415 */ 			}
/* 416 */ 		}
/* 417 */ 
/* 418 */ 		if (height > 0) {
/* 419 */ 			height -= reduceHeightBy;
/* 420 */ 			if (height < 0) {
/* 421 */ 				height = 0;
/* 422 */ 			}
/* 423 */ 
/* 424 */ 			element.style.height = height + "px";
/* 425 */ 		}
/* 426 */ 
/* 427 */ 		if (height > 0 || opacity > 0) {
/* 428 */ 			setTimeout(function () {
/* 429 */ 				uploadr.fade_out(element, opacity);
/* 430 */ 			}, rate);
/* 431 */ 		} else {
/* 432 */ 			element.style.display = "none";
/* 433 */ 		}
/* 434 */ 	},
/* 435 */ 	
/* 436 */ 	log: function() {
/* 437 */ 		//if (window.console && console.info) console.info.apply(console, arguments);
/* 438 */ 		if (window.console && window.console.log) console.log(arguments[0]);
/* 439 */ 	},
/* 440 */ 	
/* 441 */ 	units: {
/* 442 */ 		b: [{min: 1, unit: "B"}, {min: 1024, unit: "kB"}, {min: 1048576, unit: "MB"}, {min: 1073741824, unit: "GB"}],
/* 443 */ 		s: [{min: 1, unit: "s", pad: 2}, {min: 60, unit: "m", pad: 2}, {min: 3600, unit: "h", pad: 2}, {min: 86400, unit: "d"}]
/* 444 */ 	},
/* 445 */ 	
/* 446 */ 	format_unit: function(base, type, join) {
/* 447 */ 		var labels = this.units[(type == "bps") ? "b" : type];
/* 448 */ 		var append = (type == "bps") ? "/s" : "";
/* 449 */ 		var i, l = labels.length, value;
/* 450 */ 	

/* uploadr.js */

/* 451 */ 		if (base < 1) return "0 " + labels[0].unit + append;
/* 452 */ 	
/* 453 */ 		if (type == "s") {
/* 454 */ 			var units = [];
/* 455 */ 	
/* 456 */ 			for (i = l - 1; i >= 0; i--) {
/* 457 */ 				value = Math.floor(base / labels[i].min);
/* 458 */ 				if (value) {
/* 459 */ 					if(labels[i].pad) value = this.pad(value,labels[i].pad);
/* 460 */ 					units.push(value);
/* 461 */ 					base -= value * labels[i].min;
/* 462 */ 					if (!base){
/* 463 */ 						while(i>0){ i--; units.push(((labels[i].pad) ? this.pad(0,labels[i].pad) : 0)); }
/* 464 */ 						break;
/* 465 */ 					}
/* 466 */ 				}
/* 467 */ 			}
/* 468 */ 	
/* 469 */ 			return (join === false) ? units : units.join(join || ", ");
/* 470 */ 		}
/* 471 */ 	
/* 472 */ 		for (i = l - 1; i >= 0; i--) {
/* 473 */ 			value = labels[i].min;
/* 474 */ 			if (base >= value) break;
/* 475 */ 		}
/* 476 */ 	
/* 477 */ 		return (base / value).toFixed(1) + " " + labels[i].unit + append;
/* 478 */ 	},
/* 479 */ 	
/* 480 */ 	pad: function (number, length) {
/* 481 */ 		   
/* 482 */ 	    var str = "" + number;
/* 483 */ 	    while (str.length < length) {
/* 484 */ 	        str = "0" + str;
/* 485 */ 	    }
/* 486 */ 	   
/* 487 */ 	    return str;
/* 488 */ 	
/* 489 */ 	}
/* 490 */ 	
/* 491 */ };
/* 492 */ 
/* 493 */ /* ******************************************
/* 494 *|  *	fileprogress Object
/* 495 *|  *	Control object for displaying file info
/* 496 *|  * ****************************************** */
/* 497 */ 
/* 498 */ function fileprogress(file, customSettings) {
/* 499 */ 	this.targetID = customSettings.instance + "-progresscontainer";
/* 500 */ 	this.progressbarID = customSettings.instance + "-progressbar";

/* uploadr.js */

/* 501 */ 	this.progressbarstatusID = customSettings.instance + "-progressbarstatus";
/* 502 */ 	this.filenameID = customSettings.instance + "-filename";
/* 503 */ 	this.progress_speedID = customSettings.instance + "-progress-speed";
/* 504 */ 	this.progress_timeID = customSettings.instance + "-progress-time";
/* 505 */ 	this.progress_cancelID = customSettings.instance + "-progress-cancel";
/* 506 */ 	this.progress_errorID = customSettings.instance + "-progress-error";
/* 507 */ 	this.fileprogressID = customSettings.instance + "-fileprogress";
/* 508 */ 	this.buttonwrapperID = customSettings.instance + "-button";
/* 509 */ 	this.browseID = customSettings.instance + "-browse";
/* 510 */ 
/* 511 */ 	this.fileprogresswrapper = document.getElementById(this.fileprogressID);
/* 512 */ 	if (!this.fileprogresswrapper) {
/* 513 */ 		this.fileprogresswrapper = document.createElement("div");
/* 514 */ 		this.fileprogresswrapper.className = "progresswrapper";
/* 515 */ 		this.fileprogresswrapper.id = this.fileprogressID;
/* 516 */ 
/* 517 */ 		this.fileprogresselement = document.createElement("div");
/* 518 */ 		this.fileprogresselement.className = "progresscontainer";
/* 519 */ 		
/* 520 */ 		var progressbarstatus = document.createElement("div");
/* 521 */ 		progressbarstatus.className = "progressbarstatus";
/* 522 */ 		progressbarstatus.id = this.progressbarstatusID;
/* 523 */ 		progressbarstatus.innerHTML = "&nbsp;";
/* 524 */ 		
/* 525 */ 		var progress_speed = document.createElement("div");
/* 526 */ 		progress_speed.className = "progress_speed";
/* 527 */ 		progress_speed.id = this.progress_speedID;
/* 528 */ 		progress_speed.innerHTML = "&nbsp;";
/* 529 */ 		
/* 530 */ 		var progress_time = document.createElement("div");
/* 531 */ 		progress_time.className = "progress_time";
/* 532 */ 		progress_time.id = this.progress_timeID;
/* 533 */ 		progress_time.innerHTML = "&nbsp;";
/* 534 */ 		
/* 535 */ 		var clear = document.createElement("div");
/* 536 */ 		clear.className = "clear";
/* 537 */ 		
/* 538 */ 		//progress bar
/* 539 */ 		this.progressbar = document.createElement("div");
/* 540 */ 		this.progressbar.className = "progressbar uploading";
/* 541 */ 		this.progressbar.id = this.progressbarID;
/* 542 */ 		
/* 543 */ 		var progressbarwrapper = document.createElement("div");
/* 544 */ 		progressbarwrapper.className = "progressbarwrapper";
/* 545 */ 		
/* 546 */ 		var relativewrapper = document.createElement("div");
/* 547 */ 		relativewrapper.className = "rel";
/* 548 */ 		
/* 549 */ 		var progresscancel = document.createElement("a");
/* 550 */ 		progresscancel.className = "progresscancel";

/* uploadr.js */

/* 551 */ 		progresscancel.id = this.progress_cancelID;
/* 552 */ 		progresscancel.href = "#";
/* 553 */ 		progresscancel.style.visibility = "hidden";
/* 554 */ 		progresscancel.appendChild(document.createTextNode(" "));
/* 555 */ 		
/* 556 */ 		relativewrapper.appendChild(progresscancel);
/* 557 */ 		relativewrapper.appendChild(progressbarwrapper);
/* 558 */ 		
/* 559 */ 		var filename = document.createElement("div");
/* 560 */ 		filename.className = "filename";
/* 561 */ 		filename.id = this.filenameID;
/* 562 */ 		filename.appendChild(document.createTextNode(file.name));
/* 563 */ 		
/* 564 */ 		var filesize = document.createElement("div");
/* 565 */ 		filesize.className = "filesize";
/* 566 */ 		filesize.appendChild(document.createTextNode(uploadr.format_unit(file.size, "b")));
/* 567 */ 		
/* 568 */ 		var progress_error = document.createElement("div");
/* 569 */ 		progress_error.className = "progress_error";
/* 570 */ 		progress_error.id = this.progress_errorID;
/* 571 */ 		progress_error.innerHTML = "";
/* 572 */ 		progress_error.style.display = "none";
/* 573 */ 		
/* 574 */ 		progressbarwrapper.appendChild(this.progressbar);
/* 575 */ 		progressbarwrapper.appendChild(filename);
/* 576 */ 		progressbarwrapper.appendChild(filesize);
/* 577 */ 
/* 578 */ 		this.fileprogresselement.appendChild(progressbarstatus);
/* 579 */ 		this.fileprogresselement.appendChild(progress_speed);
/* 580 */ 		this.fileprogresselement.appendChild(progress_time);
/* 581 */ 		this.fileprogresselement.appendChild(clear);
/* 582 */ 		this.fileprogresselement.appendChild(relativewrapper);
/* 583 */ 		this.fileprogresselement.appendChild(progress_error);
/* 584 */ 		
/* 585 */ 		this.fileprogresswrapper.appendChild(this.fileprogresselement);
/* 586 */ 
/* 587 */ 		document.getElementById(this.targetID).appendChild(this.fileprogresswrapper);
/* 588 */ 		document.getElementById(this.targetID).style.display = "block";
/* 589 */ 		uploadr.fade_in(this.fileprogresswrapper, 0);
/* 590 */ 	} else {
/* 591 */ 		document.getElementById(this.targetID).style.display = "block";
/* 592 */ 		document.getElementById(this.filenameID).innerHTML = file.name;
/* 593 */ 	}
/* 594 */ 	
/* 595 */ 	this.height = this.fileprogresswrapper.offsetHeight;
/* 596 */ 
/* 597 */ }
/* 598 */ fileprogress.prototype.set_start = function () {
/* 599 */ 	document.getElementById(this.progress_speedID).innerHTML = "Initializing...";
/* 600 */ 	document.getElementById(this.browseID).style.display = "none";

/* uploadr.js */

/* 601 */ 	document.getElementById(this.buttonwrapperID).style.height = "0";
/* 602 */ 	//var btn = document.getElementById(this.buttonwrapperID);
/* 603 */ 	//btn.style.visibility = "hidden";
/* 604 */ 	//btn.style.height = "0";
/* 605 */ };
/* 606 */ fileprogress.prototype.set_progress = function (percentage) {
/* 607 */ 	var progressbar = document.getElementById(this.progressbarID);
/* 608 */ 	progressbar.className = "progressbar uploading";
/* 609 */ 	progressbar.style.width = percentage + "%";
/* 610 */ };
/* 611 */ fileprogress.prototype.set_complete = function (customSettings) {
/* 612 */ 	var progressbar = document.getElementById(this.progressbarID);
/* 613 */ 	progressbar.className = "progressbar complete";
/* 614 */ 	if (customSettings.clear_on_complete) {
/* 615 */ 		this.reset();
/* 616 */ 	} else {
/* 617 */ 		progressbar.style.width = "100%";
/* 618 */ 		document.getElementById(this.progressbarstatusID).innerHTML = "Uploading ( 100% ):";
/* 619 */ 		document.getElementById(this.progress_speedID).innerHTML = "Upload complete!";
/* 620 */ 		document.getElementById(this.progress_timeID).innerHTML = "";
/* 621 */ 	}
/* 622 */ };
/* 623 */ fileprogress.prototype.reset = function () {
/* 624 */ 	document.getElementById(this.targetID).style.display = "none";
/* 625 */ 	document.getElementById(this.progressbarID).style.width = "";
/* 626 */ 	document.getElementById(this.progress_speedID).innerHTML = "";
/* 627 */ 	document.getElementById(this.progress_timeID).innerHTML = "";
/* 628 */ 	document.getElementById(this.progressbarstatusID).className = "progressbarstatus";
/* 629 */ 	document.getElementById(this.progress_errorID).style.display = "none";
/* 630 */ 	
/* 631 */ 	document.getElementById(this.browseID).style.display = "block";
/* 632 */ 	document.getElementById(this.buttonwrapperID).style.height = "auto";
/* 633 */ 	
/* 634 */ 	//var btn = document.getElementById(this.buttonwrapperID);
/* 635 */ 	//btn.style.visibility = "visible";
/* 636 */ 	//btn.style.height = "auto";
/* 637 */ };
/* 638 */ fileprogress.prototype.set_error = function (error) {
/* 639 */ 	var progressbar = document.getElementById(this.progressbarID);
/* 640 */ 	progressbar.className = "progressbar error";
/* 641 */ 	progressbar.style.width = "100%";
/* 642 */ 	document.getElementById(this.progressbarstatusID).className = "progressbarstatus error";
/* 643 */ 	document.getElementById(this.progress_speedID).innerHTML = "";
/* 644 */ 	document.getElementById(this.progress_timeID).innerHTML = "";
/* 645 */ 	
/* 646 */ 	this.set_status("Error Detected");
/* 647 */ 	var progress_error = document.getElementById(this.progress_errorID);
/* 648 */ 	progress_error.innerHTML = "<strong>Error:</strong> " + error;
/* 649 */ 	progress_error.style.display = "block";
/* 650 */ };

/* uploadr.js */

/* 651 */ fileprogress.prototype.set_cancelled = function () {
/* 652 */ 	document.getElementById(this.targetID).style.display = "none";
/* 653 */ 	this.reset();
/* 654 */ };
/* 655 */ fileprogress.prototype.set_encoding = function () {
/* 656 */ 	var progressbar = document.getElementById(this.progressbarID);
/* 657 */ 	progressbar.className = "progressbar encoding";
/* 658 */ 	progressbar.style.width = "";
/* 659 */ };
/* 660 */ fileprogress.prototype.set_encoding_complete = function (customSettings) {
/* 661 */ 	if (customSettings.clear_on_complete) {
/* 662 */ 		this.reset();
/* 663 */ 	}
/* 664 */ };
/* 665 */ fileprogress.prototype.set_encoding_status = function (percentage, hd, customSettings) {
/* 666 */ 	this.set_status("Encoding ( " + (percentage > 100 ? 100 : percentage) + "% ):");
/* 667 */ 	document.getElementById(this.progressbarID).style.width = (percentage > 100 ? 100 : percentage) + "%";
/* 668 */ 	
/* 669 */ 	if (percentage==100) {
/* 670 */ 		document.getElementById(this.progress_speedID).innerHTML = "generating thumbnail images ...";
/* 671 */ 	} else if(percentage==101) {
/* 672 */ 		document.getElementById(this.progress_speedID).innerHTML = "thumbnail generation complete";
/* 673 */ 		this.set_encoding_complete(customSettings);
/* 674 */ 	} else {
/* 675 */ 		document.getElementById(this.progress_speedID).innerHTML = "Encoding " + ((hd == 1) ? "HD ": "" ) + "...";			
/* 676 */ 	}
/* 677 */ 	document.getElementById(this.progress_timeID).innerHTML = "";
/* 678 */ };
/* 679 */ fileprogress.prototype.set_status = function (status) {
/* 680 */ 	document.getElementById(this.progressbarstatusID).innerHTML = status;
/* 681 */ };
/* 682 */ fileprogress.prototype.update_display = function (file) {
/* 683 */ 	document.getElementById(this.progress_timeID).innerHTML = "Time Left: ~" + SWFUpload.speed.formatTime(file.timeRemaining);
/* 684 */ 	document.getElementById(this.progress_speedID).innerHTML = SWFUpload.speed.formatBPS(file.averageSpeed);
/* 685 */ };
/* 686 */ fileprogress.prototype.toggle_cancel = function (show, swfuploadInstance) {
/* 687 */ 	var cancel = document.getElementById(this.progress_cancelID);
/* 688 */ 	cancel.style.visibility = show ? "visible" : "hidden";
/* 689 */ 	var self = this;
/* 690 */ 	if (swfuploadInstance) {
/* 691 */ 		cancel.onclick = function () { 
/* 692 */ 			swfuploadInstance.customSettings.on_cancel("on cancel fired"); //callback: on_cancel
/* 693 */ 			swfuploadInstance.cancelQueue(); 
/* 694 */ 			self.set_cancelled();
/* 695 */ 			return false;
/* 696 */ 		};
/* 697 */ 	}
/* 698 */ };

;
/* last.js */

/* 1 */ initHistory();
/* 2 */ 
/* 3 */ 

;
/* queue.js */

/* 1   */ 
/* 2   */ var queue_controller = {
/* 3   */ 	options: {
/* 4   */ 		debug: false,
/* 5   */ 		hash: null,
/* 6   */ 		items: [],
/* 7   */ 		type: null
/* 8   */ 	},
/* 9   */ 	
/* 10  */ 	hash: null,
/* 11  */ 	type: 'media', // media | user
/* 12  */ 	
/* 13  */ 	open: false,
/* 14  */ 	xpos: 0,
/* 15  */ 	ypos: 48,
/* 16  */ 	count: 0,
/* 17  */ 	items: {},
/* 18  */ 	order: [],
/* 19  */ 	sortable: null,
/* 20  */ 	
/* 21  */ 	listbox: null,
/* 22  */ 	counter: null,
/* 23  */ 	queuebox: null,
/* 24  */ 	
/* 25  */ 	populated: { albums: 0, assignments: 0 },
/* 26  */ 	
/* 27  */ 	init: function(options) {
/* 28  */ 		this.options = $merge(this.options, options || {});
/* 29  */ 		
/* 30  */ 		this.options.debug = true;//(this.options.debug==1) ? true : false;
/* 31  */ 		this.type = this.options.type;
/* 32  */ 		this.hash = this.options.hash;
/* 33  */ 		this.items = new Hash({});
/* 34  */ 		if (this.options.items.length > 0) {
/* 35  */ 			this.options.items.each(function (item) {
/* 36  */ 				this.items.set(item.assoc_id, item.id);
/* 37  */ 			}, this);
/* 38  */ 		}
/* 39  */ 		this.order = this.items.getValues();
/* 40  */ 		this.count = this.items.getLength();
/* 41  */ 		
/* 42  */ 		this.events();
/* 43  */ 	},
/* 44  */ 	
/* 45  */ 	events: function() {
/* 46  */ 		this.log('queue:: init events');
/* 47  */ 		
/* 48  */ 		var self = this;
/* 49  */ 		this.queuebox = document.id('album-queue');
/* 50  */ 		if (!this.queuebox) return;

/* queue.js */

/* 51  */ 		this.listbox = document.id('queue-list');
/* 52  */ 		this.counter = document.id('queue-counter');
/* 53  */ 		
/* 54  */ 		this.sortable = new Sortables(this.listbox, {
/* 55  */ 		    revert: { 
/* 56  */ 				duration: 200, 
/* 57  */ 				transition: 'elastic:out' 
/* 58  */ 			},
/* 59  */ 		    handle: '.dragger',
/* 60  */ 		    constrain: true,
/* 61  */ 		    clone: true,
/* 62  */ 		    opacity: 0.6,
/* 63  */ 		    onComplete: this.sort.bind(this)
/* 64  */ 		});
/* 65  */ 		
/* 66  */ 		if (!this.xpos) this.xpos = window.getSize().x - this.queuebox.getCoordinates().right;
/* 67  */ 		window.addEvent('scroll', this.scroll.bind(this));
/* 68  */ 		
/* 69  */ 		loading = {
/* 70  */ 			show: function () { self.queuebox.addClass('loading'); },
/* 71  */ 			hide: function () { self.queuebox.removeClass('loading'); }
/* 72  */ 		};
/* 73  */ 		
/* 74  */ 		var handler = {			
/* 75  */ 			clear: function () {
/* 76  */ 				if (self.hash) {
/* 77  */ 					if (confirm("Are you sure you want to clear ALL entries in queue?")) {
/* 78  */ 						new Request({
/* 79  */ 							url: '/queues/clear',
/* 80  */ 							onRequest: loading.show,
/* 81  */ 							onSuccess: function (resp) {
/* 82  */ 								loading.hide();
/* 83  */ 								self.clear();
/* 84  */ 							},
/* 85  */ 							onFailure: function () {
/* 86  */ 								loading.hide();
/* 87  */ 								self.error('request');
/* 88  */ 							}
/* 89  */ 						}).send( 'hash=' + self.hash );
/* 90  */ 					}
/* 91  */ 				}
/* 92  */ 			},
/* 93  */ 			
/* 94  */ 			change: function(e, target){
/* 95  */ 				try { new Event(e).preventDefault(); } catch (er) {};
/* 96  */ 				
/* 97  */ 				if (target.value=='new') {
/* 98  */ 					document.id('album-meta').removeClass('hidden');
/* 99  */ 					document.id('queue_complete_button').getElement('span').set('text', 'Create');
/* 100 */ 				} else {

/* queue.js */

/* 101 */ 					document.id('album-meta').addClass('hidden');
/* 102 */ 					document.id('queue_complete_button').getElement('span').set('text', 'Add');
/* 103 */ 				}
/* 104 */ 			},
/* 105 */ 			
/* 106 */ 			changemenu: function(e, target){
/* 107 */ 				try { new Event(e).preventDefault(); } catch (er) {};
/* 108 */ 				
/* 109 */ 				var type = '';
/* 110 */ 				document.id('queue-content').getElements('div.menu').addClass('hidden');
/* 111 */ 				if (target.value=='album') {
/* 112 */ 					document.id('queue-menu').removeClass('hidden');
/* 113 */ 					document.id('queue-album').removeClass('hidden');
/* 114 */ 					document.id('queue_complete_button').value = 'album';
/* 115 */ 					if (!self.populated.albums) type = 'albums';
/* 116 */ 				} else if (target.value=='assign') {
/* 117 */ 					document.id('queue-menu').removeClass('hidden');
/* 118 */ 					document.id('queue-assign').removeClass('hidden');
/* 119 */ 					document.id('queue_complete_button').value = 'assign';
/* 120 */ 					if (!self.populated.assignments) type = 'assignments';
/* 121 */ 				} else {
/* 122 */ 					document.id('queue-menu').addClass('hidden');
/* 123 */ 				}
/* 124 */ 				
/* 125 */ 				if (type) {
/* 126 */ 					new Request({
/* 127 */ 						url: '/queues/populate/' + type,
/* 128 */ 						onSuccess: function (resp) {
/* 129 */ 							self.populated[type] = 1;
/* 130 */ 							switch (type) {
/* 131 */ 								case 'albums':
/* 132 */ 									document.id('album_addID').set('html', resp);
/* 133 */ 									break;
/* 134 */ 								case 'assignments':
/* 135 */ 									document.id('assign_addID').set('html', resp);
/* 136 */ 									break;
/* 137 */ 							}
/* 138 */ 						},
/* 139 */ 						onFailure: function () {
/* 140 */ 							self.error('request');
/* 141 */ 						}
/* 142 */ 					}).send();
/* 143 */ 				}
/* 144 */ 			},
/* 145 */ 			
/* 146 */ 			complete: function (e, target) {
/* 147 */ 				try { new Event(e).preventDefault(); } catch (er) {};
/* 148 */ 				
/* 149 */ 				var type = target.value;
/* 150 */ 				if (type == 'album') {

/* queue.js */

/* 151 */ 					var addID = document.id('album_addID');
/* 152 */ 					var album_id = addID.value;
/* 153 */ 					var data = new Hash({
/* 154 */ 						'type': type,
/* 155 */ 						'id': album_id,
/* 156 */ 						'hash': self.hash,
/* 157 */ 						'order': self.order.join(',')
/* 158 */ 					});
/* 159 */ 					
/* 160 */ 					if (album_id == 'new') {
/* 161 */ 						var album_name = document.id('album_name').value.trim();
/* 162 */ 						var album_desc = document.id('album_desc').value.trim();
/* 163 */ 						
/* 164 */ 						if (album_name == '') {
/* 165 */ 							poptent_helpers.show_notification('Please fill enter an album name','error');
/* 166 */ 							poptent_helpers.apply_validation_error_state('album_name');
/* 167 */ 							return;
/* 168 */ 						}
/* 169 */ 						
/* 170 */ 						data.set('name', album_name);
/* 171 */ 						data.set('desc', album_desc);
/* 172 */ 					}
/* 173 */ 				} else if (type == 'assign') {
/* 174 */ 					var addID = document.id('assign_addID');
/* 175 */ 					var assign_id = addID.value;
/* 176 */ 					
/* 177 */ 					if (!assign_id) {
/* 178 */ 						poptent_helpers.show_notification('Please select the assignment','error');
/* 179 */ 						poptent_helpers.apply_validation_error_state('assign_addID');
/* 180 */ 						return;
/* 181 */ 					}
/* 182 */ 					
/* 183 */ 					var data = new Hash({
/* 184 */ 						'type': type,
/* 185 */ 						'id': assign_id,
/* 186 */ 						'hash': self.hash,
/* 187 */ 						'order': self.order.join(',')
/* 188 */ 					});
/* 189 */ 				}
/* 190 */ 				
/* 191 */ 				new Request({
/* 192 */ 					url: '/queues/complete',
/* 193 */ 					onRequest: loading.show,
/* 194 */ 					onSuccess: function (json) {
/* 195 */ 						loading.hide();
/* 196 */ 						try { json = JSON.decode(json); }catch (er) { };
/* 197 */ 						if (json) {
/* 198 */ 							switch (json.e) {
/* 199 */ 								case 0:
/* 200 */ 									switch (type) {

/* queue.js */

/* 201 */ 										case 'assign':
/* 202 */ 											var aname = addID.options[addID.selectedIndex].innerHTML;
/* 203 */ 											poptent_helpers.show_notification(json.ct + (json.ct > 1 ? ' entries were' : ' entry was') + ' added as assets to the "' + aname + '" assignment successfully','success');
/* 204 */ 											if (json.dups) {
/* 205 */ 												var len = json.dups.length;
/* 206 */ 												if (len>1) {
/* 207 */ 													var msg = 'The following items were NOT ADDED because they are already associated with the ' + aname + ' assignment:\r\n';
/* 208 */ 												} else {
/* 209 */ 													var msg = 'The following item was NOT ADDED because it is already associated with the ' + aname + ' assignment:\r\n';
/* 210 */ 												}
/* 211 */ 												json.dups.each(function(el){
/* 212 */ 													msg += '\r\n-' + el;
/* 213 */ 												});
/* 214 */ 												alert(msg);
/* 215 */ 											}
/* 216 */ 											break;
/* 217 */ 										default:
/* 218 */ 											if (album_id == 'new') {
/* 219 */ 												poptent_helpers.show_notification('Your album "' +album_name+ '" was created successfully!','success');
/* 220 */ 											} else {
/* 221 */ 												poptent_helpers.show_notification(json.ct + (json.ct > 1 ? ' entries were' : ' entry was') + ' added to your "' + addID.options[addID.selectedIndex].innerHTML + '" album successfully','success');
/* 222 */ 											}
/* 223 */ 											window.location.href = '/album/' + json.id + '/' + json.slug;
/* 224 */ 									}
/* 225 */ 									self.clear(1);
/* 226 */ 									break;
/* 227 */ 								case 1:
/* 228 */ 									poptent_helpers.show_notification('No queued items found!','error');
/* 229 */ 									break;
/* 230 */ 								case 3:
/* 231 */ 									poptent_helpers.show_notification('Please fill enter an album name','error');
/* 232 */ 									break;
/* 233 */ 								case 4:
/* 234 */ 									poptent_helpers.show_notification('Sorry, we were unable to locate that album!','error');
/* 235 */ 									break;
/* 236 */ 								case 5:
/* 237 */ 									poptent_helpers.show_notification('Sorry, you don\'t have permission to complete this action!','error');
/* 238 */ 									break;
/* 239 */ 								case 7:
/* 240 */ 									poptent_helpers.show_notification('Sorry, that assignment is expired!','error');
/* 241 */ 									break;
/* 242 */ 								default:
/* 243 */ 									poptent_helpers.show_notification('Sorry, there has been an error. Try again!','error');
/* 244 */ 									break;
/* 245 */ 							}
/* 246 */ 						}
/* 247 */ 					},
/* 248 */ 					onFailure: function () {
/* 249 */ 						loading.hide();
/* 250 */ 						self.error('request');

/* queue.js */

/* 251 */ 					}
/* 252 */ 				}).send( data.toQueryString() );
/* 253 */ 			}
/* 254 */ 		};
/* 255 */ 		
/* 256 */ 		var delegate = function (e) {
/* 257 */ 			var target = document.id((e.target || e.srcElement));
/* 258 */ 			var tid = target.id || target.className;
/* 259 */ 			if (!tid) {
/* 260 */ 				target = target.getParent();
/* 261 */ 				tid = target.id || target.className;
/* 262 */ 			}
/* 263 */ 			
/* 264 */ 			self.log(e.type+' - '+tid);
/* 265 */ 			if (tid) {
/* 266 */ 				tid = tid.trim();
/* 267 */ 				switch (e.type) {
/* 268 */ 					case 'click':
/* 269 */ 						switch (tid) {
/* 270 */ 							case 'delete-generic':
/* 271 */ 								try { new Event(e).preventDefault(); } catch (er) {};
/* 272 */ 								return self.unqueue(target.rel);
/* 273 */ 								break;
/* 274 */ 							case 'queue_cancel_button':
/* 275 */ 								document.id('queue_complete_form').reset();
/* 276 */ 							case 'queue-indicator':
/* 277 */ 							case 'queue-counterwrap':
/* 278 */ 							case 'queue-counter':
/* 279 */ 								try { new Event(e).preventDefault(); } catch (er) {};
/* 280 */ 								if (self.open) {
/* 281 */ 									self.queuebox.addClass('collapsed');
/* 282 */ 									self.open = false;
/* 283 */ 								} else {
/* 284 */ 									self.queuebox.removeClass('collapsed');
/* 285 */ 									self.open = true;
/* 286 */ 								}
/* 287 */ 								return;
/* 288 */ 								break;
/* 289 */ 							case 'queue-clear':
/* 290 */ 								try { new Event(e).preventDefault(); } catch (er) {};
/* 291 */ 								return handler.clear();
/* 292 */ 								break;
/* 293 */ 							case 'album_addID':
/* 294 */ 								//used click event here b/c change+click causes conflict in ie
/* 295 */ 								if (target.value != target.retrieve('current')) {
/* 296 */ 									target.store('current', target.value);
/* 297 */ 									return handler.change(e, target);
/* 298 */ 								}
/* 299 */ 								break;
/* 300 */ 							case 'queue_addto':

/* queue.js */

/* 301 */ 								//used click event here b/c change+click causes conflict in ie
/* 302 */ 								if (target.value != target.retrieve('current')) {
/* 303 */ 									target.store('current', target.value);
/* 304 */ 									return handler.changemenu(e, target);
/* 305 */ 								}
/* 306 */ 								break;
/* 307 */ 							case 'queue_complete_button':
/* 308 */ 								return handler.complete(e, target);
/* 309 */ 								break;
/* 310 */ 							default:
/* 311 */ 								if(tid.indexOf('clearqueue') !== -1){
/* 312 */ 									try { new Event(e).preventDefault(); } catch (er) {};
/* 313 */ 									return handler.clear();
/* 314 */ 								}
/* 315 */ 						}
/* 316 */ 						break;
/* 317 */ 					case 'change': 
/* 318 */ 						if (tid == 'album_addID') {
/* 319 */ 							/*
/* 320 *| 							 * added here b/c chrome wasn't registering click event for select 
/* 321 *| 							 * (causes duplication in ff & safari, though this doesn't matter since if prevents
/* 322 *| 							 * action from continuing...but, still inefficient)
/* 323 *| 							 */
/* 324 */ 							if (target.value != target.retrieve('current')) {
/* 325 */ 								target.store('current', target.value);
/* 326 */ 								return handler.change(e, target);
/* 327 */ 							}
/* 328 */ 						} else if (tid == 'queue_addto') {
/* 329 */ 							/*
/* 330 *| 							 * added here b/c chrome wasn't registering click event for select 
/* 331 *| 							 * (causes duplication in ff & safari, though this doesn't matter since if prevents
/* 332 *| 							 * action from continuing...but, still inefficient)
/* 333 *| 							 */
/* 334 */ 							if (target.value != target.retrieve('current')) {
/* 335 */ 								target.store('current', target.value);
/* 336 */ 								return handler.changemenu(e, target);
/* 337 */ 							}
/* 338 */ 						}
/* 339 */ 						break;
/* 340 */ 				}
/* 341 */ 			}
/* 342 */ 		};
/* 343 */ 		
/* 344 */ 		self.queuebox.addEvents({click: delegate, change: delegate});
/* 345 */ 	},
/* 346 */ 	
/* 347 */ 	delegate: function (e, target) {
/* 348 */ 		try { new Event(e).stop(); }catch (er) {};
/* 349 */ 		
/* 350 */ 		if (target.nodeName.toUpperCase() != 'A') target = target.getParent('a');

/* queue.js */

/* 351 */ 		if (target.rel != this.type) {
/* 352 */ 			//TODO: just notify for now...will prompt user to discard or continue
/* 353 */ 			this.error('mismatch');
/* 354 */ 			return;
/* 355 */ 		}
/* 356 */ 		
/* 357 */ 		var item = target.id.split('-').getLast();
/* 358 */ 		if (target.getParent().hasClass('in')) { //remove item
/* 359 */ 			this.unqueue(item);
/* 360 */ 		} else { //add item
/* 361 */ 			this.queue(item);
/* 362 */ 		}
/* 363 */ 	},
/* 364 */ 	
/* 365 */ 	queue: function (item) {
/* 366 */ 		this.log('queue:: queue ( ' + item + ' )');
/* 367 */ 		
/* 368 */ 		var self = this;
/* 369 */ 		
/* 370 */ 		new Request({
/* 371 */ 			url: '/queues/add/' +this.type,
/* 372 */ 			onComplete: function (json) {
/* 373 */ 				try { json = JSON.decode(json); }catch (er) { };
/* 374 */ 				if (json) {
/* 375 */ 					if (json.e == 0) {
/* 376 */ 						self.hash = json.hash;
/* 377 */ 						self.add(json);
/* 378 */ 					} else if (json.e == 1) { // prompt user to delete items in different type of queued items
/* 379 */ 						var answer = confirm("You already have items in a different queue, do you want to discard?");
/* 380 */ 						if(answer){
/* 381 */ 							
/* 382 */ 						}
/* 383 */ 					} else if (json.e == 2) {
/* 384 */ 						try {
/* 385 */ 							var el = document.id('queue-add-' + item);
/* 386 */ 							if (el) {
/* 387 */ 								el.getParent().addClass('in');
/* 388 */ 								if (el.get('title')) el.set('title', 'remove from queue');
/* 389 */ 							}
/* 390 */ 						} catch(e) {}
/* 391 */ 						self.error('duplicate');
/* 392 */ 					}						
/* 393 */ 				} else {
/* 394 */ 					self.error('request');
/* 395 */ 				}
/* 396 */ 			},
/* 397 */ 			onFailure: function () {
/* 398 */ 				self.error('request');
/* 399 */ 			}
/* 400 */ 		}).send( ((self.hash) ? 'hash=' + self.hash + '&' : '') + 'id=' + item );

/* queue.js */

/* 401 */ 	},
/* 402 */ 	
/* 403 */ 	unqueue: function (item) {
/* 404 */ 		this.log('queue:: unqueue ( ' + item + ' )');
/* 405 */ 		
/* 406 */ 		var self = this;
/* 407 */ 		
/* 408 */ 		var qitem = self.items.get(item);
/* 409 */ 		if (qitem) {
/* 410 */ 			new Request({
/* 411 */ 				url: '/queues/remove',
/* 412 */ 				onRequest: function () { self.queuebox.addClass('loading'); },
/* 413 */ 				onSuccess: function (resp) {
/* 414 */ 					self.queuebox.removeClass('loading');
/* 415 */ 					self.remove(item);
/* 416 */ 				},
/* 417 */ 				onFailure: function () {
/* 418 */ 					self.queuebox.removeClass('loading');
/* 419 */ 					self.error('request');
/* 420 */ 				}
/* 421 */ 			}).send( 'hash=' + self.hash + '&id=' + qitem );
/* 422 */ 		}
/* 423 */ 	},
/* 424 */ 	
/* 425 */ 	add: function (item) {
/* 426 */ 		this.log('queue:: add item ( '+item.assoc_id+' )');
/* 427 */ 		
/* 428 */ 		if (this.items.has(item.assoc_id)) return this.error('duplicate');
/* 429 */ 			
/* 430 */ 		this.items.set(item.assoc_id, item.id);
/* 431 */ 		this.order.push(item.id);
/* 432 */ 		++this.count;
/* 433 */ 		
/* 434 */ 		var li = new Element('li', {
/* 435 */ 			id: 'qitem-' + item.id,
/* 436 */ 			html: '<div class="name"><span class="alsprite dragger"></span> ' + item.name + '</div><div class="delete"><a href="#" rel="' + item.assoc_id + '" class="delete-generic"></a></div><div class="clr"></div>'
/* 437 */ 		});
/* 438 */ 		li.inject(this.listbox);
/* 439 */ 		
/* 440 */ 		this.sortable.addItems(li);
/* 441 */ 		this.counter.set('text', this.count + ((this.count==1)?' item':' items'));
/* 442 */ 		
/* 443 */ 		var el = document.id('queue-add-' + item.assoc_id);
/* 444 */ 		if (el) {
/* 445 */ 			el.getParent().addClass('in');
/* 446 */ 			if (el.get('title')) el.set('title', 'remove from queue'); 
/* 447 */ 		}
/* 448 */ 		
/* 449 */ 		if (this.count == 1) {
/* 450 */ 			this.show();

/* queue.js */

/* 451 */ 		}
/* 452 */ 	},
/* 453 */ 	
/* 454 */ 	remove: function (item) {
/* 455 */ 		this.log('queue:: remove item ( '+item+' )');
/* 456 */ 		
/* 457 */ 		var qitem = this.items.get(item);
/* 458 */ 		if (qitem) {
/* 459 */ 			this.items.erase(item);
/* 460 */ 			var key = this.order.indexOf(item);
/* 461 */ 			if (key != -1) this.order.splice(key, 1);
/* 462 */ 			
/* 463 */ 			var li = document.id('qitem-' + qitem);
/* 464 */ 			if (this.open) {
/* 465 */ 				utility_helper.add_remove_el_effect({ action: 1, elid: 'qitem-' + qitem });
/* 466 */ 			} else {
/* 467 */ 				li.destroy();
/* 468 */ 			}
/* 469 */ 			this.sortable.removeItems(li);
/* 470 */ 			
/* 471 */ 			var el = document.id('queue-add-' + item);
/* 472 */ 			if (el) {
/* 473 */ 				el.getParent().removeClass('in');
/* 474 */ 				if (el.get('title')) el.set('title', 'add to queue'); 
/* 475 */ 			}
/* 476 */ 			
/* 477 */ 			--this.count;
/* 478 */ 			if (this.count <= 0) {
/* 479 */ 				this.count = 0;
/* 480 */ 				this.hide();
/* 481 */ 			}
/* 482 */ 			
/* 483 */ 			this.counter.set('text', this.count + ((this.count==1)?' item':' items'));
/* 484 */ 		}
/* 485 */ 	},
/* 486 */ 	
/* 487 */ 	clear: function (reset) {
/* 488 */ 		this.log('queue:: clear');
/* 489 */ 		
/* 490 */ 		this.hash = null;
/* 491 */ 		this.items.each(function (item, qitem) {
/* 492 */ 			var el = document.id('queue-add-' + qitem);
/* 493 */ 			if (el) el.getParent().removeClass('in');
/* 494 */ 		});
/* 495 */ 		this.items.empty();
/* 496 */ 		this.order = [];
/* 497 */ 		this.count = 0;
/* 498 */ 		
/* 499 */ 		this.listbox.set('html', '');
/* 500 */ 		this.counter.set('text', '0 items');

/* queue.js */

/* 501 */ 		if (reset) document.id('queue_complete_form').reset();
/* 502 */ 		
/* 503 */ 		var el = document.id('queue_addto');
/* 504 */ 		if (el) {
/* 505 */ 			document.id('queue-menu').addClass('hidden');
/* 506 */ 		}
/* 507 */ 		
/* 508 */ 		this.hide();
/* 509 */ 	},
/* 510 */ 	
/* 511 */ 	sort: function () {
/* 512 */ 		this.log('queue:: sort');
/* 513 */ 		
/* 514 */ 		var order = [];
/* 515 */ 		this.listbox.getElements('li').each(function (el) {
/* 516 */ 			order.push(el.id.split('-')[1]);
/* 517 */ 		});
/* 518 */ 		
/* 519 */ 		this.order = order;
/* 520 */ 		this.log('queue:: new order (' + order.join(',') + ' )');
/* 521 */ 	},
/* 522 */ 	
/* 523 */ 	show: function () {
/* 524 */ 		this.queuebox.set('opacity', 1);
/* 525 */ 		this.queuebox.removeClass('hidden');
/* 526 */ 	},
/* 527 */ 	
/* 528 */ 	hide: function () {
/* 529 */ 		new Fx.Morph(this.queuebox, {
/* 530 */ 			duration: 200, 
/* 531 */ 			transition: Fx.Transitions.linear
/* 532 */ 		}).start({
/* 533 */ 			'opacity': 0
/* 534 */ 		}).chain(function(){
/* 535 */ 			this.queuebox.addClass('hidden').addClass('collapsed');
/* 536 */ 		}.bind(this));
/* 537 */ 	},
/* 538 */ 	
/* 539 */ 	scroll: function () {
/* 540 */ 		var scrolltop = window.getScrollTop();
/* 541 */ 		if (scrolltop < 37) {
/* 542 */ 			this.queuebox.setStyle('top', this.ypos + 'px');
/* 543 */ 		} else {
/* 544 */ 			this.queuebox.setStyle('top', this.ypos + scrolltop - 37 + 'px');
/* 545 */ 		}
/* 546 */ 	},
/* 547 */ 	
/* 548 */ 	error: function (type) {
/* 549 */ 		switch(type){
/* 550 */ 			case 'mismatch':

/* queue.js */

/* 551 */ 				poptent_helpers.show_notification('You\'ve already started a ' + this.type + ' queue!','error');
/* 552 */ 			break;
/* 553 */ 			case 'duplicate':
/* 554 */ 				poptent_helpers.show_notification('That ' + this.type + ' is already in the queue!','error');
/* 555 */ 				break;
/* 556 */ 			case 'request':
/* 557 */ 				poptent_helpers.show_notification('Failed. Try again!','error');
/* 558 */ 				break;
/* 559 */ 			default: 
/* 560 */ 				poptent_helpers.show_notification('Queue error. Try again!','error');
/* 561 */ 		}
/* 562 */ 		return false;
/* 563 */ 	},
/* 564 */ 	
/* 565 */ 	log: function (val) {
/* 566 */ 		if (window.console && window.console.log && this.options.debug) console.log(val);
/* 567 */ 	}
/* 568 */ }
