Вы находитесь на странице: 1из 168

/* :asset_packager_compatibility, 'config/asset_packages.yml' @ 1319142822 */ /* public/javascripts/prototype_uncompressed.js @ 1319142822 */ var Prototype={Version:'1.6.1',Browser:(function(){var ua=navigator.userAgent;va r isOpera=Object.prototype.toString.call(window.opera)=='[object Opera]';return{ IE:!!window.attachEvent&&!isOpera,Opera:isOpera,WebKit:ua.indexOf('AppleWebKit/' )>-1,Gecko:ua.indexOf('Gecko')>-1&&ua.indexOf('KHTML')===-1,MobileSafari:/Apple. *Mobile.*Safari/.test(ua)}})(),BrowserFeatures:{XPath:!!document.evaluate,Select orsAPI:!!document.

querySelector,ElementExtensions:(function(){var constructor=wi ndow.Element window.HTMLElement;return!!(constructor&&constructor.prototype);}) (),SpecificElementExtensions:(function(){if(typeof window.HTMLDivElement!=='unde fined') return true;var div=document.createElement('div');var form=document.createElemen t('form');var isSupported=false;if(div['__proto__']&&(div['__proto__']!==form['_ _proto__'])){isSupported=true;} div=form=null;return isSupported;})()},ScriptFragment:'<script[^>]*>([\\S\\s]*?) <\/script>',JSONFilter:/^\/\*-secure-([\s\S]*)\*\/\s*$/,emptyFunction:function() {},K:function(x){return x}};if(Prototype.Browser.MobileSafari) Prototype.BrowserFeatures.SpecificElementExtensions=false;var Abstract={};var Tr y={these:function(){var returnValue;for(var i=0,length=arguments.length;i<length ;i++){var lambda=arguments[i];try{returnValue=lambda();break;}catch(e){}} return returnValue;}};var Class=(function(){function subclass(){};function creat e(){var parent=null,properties=$A(arguments);if(Object.isFunction(properties[0]) ) parent=properties.shift();function klass(){this.initialize.apply(this,arguments) ;} Object.extend(klass,Class.Methods);klass.superclass=parent;klass.subclasses=[];i f(parent){subclass.prototype=parent.prototype;klass.prototype=new subclass;paren t.subclasses.push(klass);} for(var i=0;i<properties.length;i++) klass.addMethods(properties[i]);if(!klass.prototype.initialize) klass.prototype.initialize=Prototype.emptyFunction;klass.prototype.constructor=k lass;return klass;} function addMethods(source){var ancestor=this.superclass&&this.superclass.protot ype;var properties=Object.keys(source);if(!Object.keys({toString:true}).length){ if(source.toString!=Object.prototype.toString) properties.push("toString");if(source.valueOf!=Object.prototype.valueOf) properties.push("valueOf");} for(var i=0,length=properties.length;i<length;i++){var property=properties[i],va lue=source[property];if(ancestor&&Object.isFunction(value)&&value.argumentNames( ).first()=="$super"){var method=value;value=(function(m){return function(){retur n ancestor[m].apply(this,arguments);};})(property).wrap(method);value.valueOf=me thod.valueOf.bind(method);value.toString=method.toString.bind(method);} this.prototype[property]=value;} return this;} return{create:create,Methods:{addMethods:addMethods}};})();(function(){var _toSt ring=Object.prototype.toString;function extend(destination,source){for(var prope rty in source) destination[property]=source[property];return destination;} function inspect(object){try{if(isUndefined(object))return'undefined';if(object= ==null)return'null';return object.inspect?object.inspect():String(object);}catch (e){if(e instanceof RangeError)return'...';throw e;}} function toJSON(object){var type=typeof object;switch(type){case'undefined':case 'function':case'unknown':return;case'boolean':return object.toString();} if(object===null)return'null';if(object.toJSON)return object.toJSON();if(isEleme nt(object))return;var results=[];for(var property in object){var value=toJSON(ob ject[property]);if(!isUndefined(value)) results.push(property.toJSON()+': '+value);} return'{'+results.join(', ')+'}';} function toQueryString(object){return $H(object).toQueryString();}

function toHTML(object){return object&&object.toHTML?object.toHTML():String.inte rpret(object);} function keys(object){var results=[];for(var property in object) results.push(property);return results;} function values(object){var results=[];for(var property in object) results.push(object[property]);return results;} function clone(object){return extend({},object);} function isElement(object){return!!(object&&object.nodeType==1);} function isArray(object){return _toString.call(object)=="[object Array]";} function isHash(object){return object instanceof Hash;} function isFunction(object){return typeof object==="function";} function isString(object){return _toString.call(object)=="[object String]";} function isNumber(object){return _toString.call(object)=="[object Number]";} function isUndefined(object){return typeof object==="undefined";} extend(Object,{extend:extend,inspect:inspect,toJSON:toJSON,toQueryString:toQuery String,toHTML:toHTML,keys:keys,values:values,clone:clone,isElement:isElement,isA rray:isArray,isHash:isHash,isFunction:isFunction,isString:isString,isNumber:isNu mber,isUndefined:isUndefined});})();Object.extend(Function.prototype,(function() {var slice=Array.prototype.slice;function update(array,args){var arrayLength=arr ay.length,length=args.length;while(length--)array[arrayLength+length]=args[lengt h];return array;} function merge(array,args){array=slice.call(array,0);return update(array,args);} function argumentNames(){var names=this.toString().match(/^[\s\(]*function[^(]*\ (([^)]*)\)/)[1].replace(/\/\/.*?[\r\n] \/\*(?:. [\r\n])*?\*\//g,'').replace(/\s+ /g,'').split(',');return names.length==1&&!names[0]?[]:names;} function bind(context){if(arguments.length<2&&Object.isUndefined(arguments[0]))r eturn this;var __method=this,args=slice.call(arguments,1);return function(){var a=merge(args,arguments);return __method.apply(context,a);}} function bindAsEventListener(context){var __method=this,args=slice.call(argument s,1);return function(event){var a=update([event window.event],args);return __me thod.apply(context,a);}} function curry(){if(!arguments.length)return this;var __method=this,args=slice.c all(arguments,0);return function(){var a=merge(args,arguments);return __method.a pply(this,a);}} function delay(timeout){var __method=this,args=slice.call(arguments,1);timeout=t imeout*1000 return window.setTimeout(function(){return __method.apply(__method,args);},timeo ut);} function defer(){var args=update([0.01],arguments);return this.delay.apply(this, args);} function wrap(wrapper){var __method=this;return function(){var a=update([__metho d.bind(this)],arguments);return wrapper.apply(this,a);}} function methodize(){if(this._methodized)return this._methodized;var __method=th is;return this._methodized=function(){var a=update([this],arguments);return __me thod.apply(null,a);};} return{argumentNames:argumentNames,bind:bind,bindAsEventListener:bindAsEventList ener,curry:curry,delay:delay,defer:defer,wrap:wrap,methodize:methodize}})());Dat e.prototype.toJSON=function(){return'"'+this.getUTCFullYear()+'-'+ (this.getUTCMonth()+1).toPaddedString(2)+'-'+ this.getUTCDate().toPaddedString(2)+'T'+ this.getUTCHours().toPaddedString(2)+':'+ this.getUTCMinutes().toPaddedString(2)+':'+ this.getUTCSeconds().toPaddedString(2)+'Z"';};RegExp.prototype.match=RegExp.prot otype.test;RegExp.escape=function(str){return String(str).replace(/([.*+?^=!:${} () [\]\/\\])/g,'\\$1');};var PeriodicalExecuter=Class.create({initialize:functio n(callback,frequency){this.callback=callback;this.frequency=frequency;this.curre ntlyExecuting=false;this.registerCallback();},registerCallback:function(){this.t imer=setInterval(this.onTimerEvent.bind(this),this.frequency*1000);},execute:fun ction(){this.callback(this);},stop:function(){if(!this.timer)return;clearInterva l(this.timer);this.timer=null;},onTimerEvent:function(){if(!this.currentlyExecut

ing){try{this.currentlyExecuting=true;this.execute();this.currentlyExecuting=fal se;}catch(e){this.currentlyExecuting=false;throw e;}}}});Object.extend(String,{i nterpret:function(value){return value==null?'':String(value);},specialChar:{'\b' :'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','\\':'\\\\'}});Object.extend( String.prototype,(function(){function prepareReplacement(replacement){if(Object. isFunction(replacement))return replacement;var template=new Template(replacement );return function(match){return template.evaluate(match)};} function gsub(pattern,replacement){var result='',source=this,match;replacement=p repareReplacement(replacement);if(Object.isString(pattern)) pattern=RegExp.escape(pattern);if(!(pattern.length pattern.source)){replacement =replacement('');return replacement+source.split('').join(replacement)+replaceme nt;} while(source.length>0){if(match=source.match(pattern)){result+=source.slice(0,ma tch.index);result+=String.interpret(replacement(match));source=source.slice(matc h.index+match[0].length);}else{result+=source,source='';}} return result;} function sub(pattern,replacement,count){replacement=prepareReplacement(replaceme nt);count=Object.isUndefined(count)?1:count;return this.gsub(pattern,function(ma tch){if(--count<0)return match[0];return replacement(match);});} function scan(pattern,iterator){this.gsub(pattern,iterator);return String(this); } function truncate(length,truncation){length=length 30;truncation=Object.isUndef ined(truncation)?'...':truncation;return this.length>length?this.slice(0,lengthtruncation.length)+truncation:String(this);} function strip(){return this.replace(/^\s+/,'').replace(/\s+$/,'');} function stripTags(){return this.replace(/<\w+(\s+("[^"]*" '[^']*' [^>])+)?> <\/ \w+>/gi,'');} function stripScripts(){return this.replace(new RegExp(Prototype.ScriptFragment, 'img'),'');} function extractScripts(){var matchAll=new RegExp(Prototype.ScriptFragment,'img' );var matchOne=new RegExp(Prototype.ScriptFragment,'im');return(this.match(match All) []).map(function(scriptTag){return(scriptTag.match(matchOne) ['',''])[1]; });} function evalScripts(){return this.extractScripts().map(function(script){return eval(script)});} function escapeHTML(){return this.replace(/&/g,'&amp;').replace(/</g,'&lt;').rep lace(/>/g,'&gt;');} function unescapeHTML(){return this.stripTags().replace(/&lt;/g,'<').replace(/&g t;/g,'>').replace(/&amp;/g,'&');} function toQueryParams(separator){var match=this.strip().match(/([^?#]*)(#.*)?$/ );if(!match)return{};return match[1].split(separator '&').inject({},function(ha sh,pair){if((pair=pair.split('='))[0]){var key=decodeURIComponent(pair.shift()); var value=pair.length>1?pair.join('='):pair[0];if(value!=undefined)value=decodeU RIComponent(value);if(key in hash){if(!Object.isArray(hash[key]))hash[key]=[hash [key]];hash[key].push(value);} else hash[key]=value;} return hash;});} function toArray(){return this.split('');} function succ(){return this.slice(0,this.length-1)+ String.fromCharCode(this.charCodeAt(this.length-1)+1);} function times(count){return count<1?'':new Array(count+1).join(this);} function camelize(){var parts=this.split('-'),len=parts.length;if(len==1)return parts[0];var camelized=this.charAt(0)=='-'?parts[0].charAt(0).toUpperCase()+part s[0].substring(1):parts[0];for(var i=1;i<len;i++) camelized+=parts[i].charAt(0).toUpperCase()+parts[i].substring(1);return cameliz ed;} function capitalize(){return this.charAt(0).toUpperCase()+this.substring(1).toLo werCase();} function underscore(){return this.replace(/::/g,'/').replace(/([A-Z]+)([A-Z][a-z ])/g,'$1_$2').replace(/([a-z\d])([A-Z])/g,'$1_$2').replace(/-/g,'_').toLowerCase

();} function dasherize(){return this.replace(/_/g,'-');} function inspect(useDoubleQuotes){var escapedString=this.replace(/[\x00-\x1f\\]/ g,function(character){if(character in String.specialChar){return String.specialC har[character];} return'\\u00'+character.charCodeAt().toPaddedString(2,16);});if(useDoubleQuotes) return'"'+escapedString.replace(/"/g,'\\"')+'"';return"'"+escapedString.replace( /'/g,'\\\'')+"'";} function toJSON(){return this.inspect(true);} function unfilterJSON(filter){return this.replace(filter Prototype.JSONFilter,' $1');} function isJSON(){var str=this;if(str.blank())return false;str=this.replace(/\\. /g,'@').replace(/"[^"\\\n\r]*"/g,'');return(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]* $/).test(str);} function evalJSON(sanitize){var json=this.unfilterJSON();try{if(!sanitize json. isJSON())return eval('('+json+')');}catch(e){} throw new SyntaxError('Badly formed JSON string: '+this.inspect());} function include(pattern){return this.indexOf(pattern)>-1;} function startsWith(pattern){return this.indexOf(pattern)===0;} function endsWith(pattern){var d=this.length-pattern.length;return d>=0&&this.la stIndexOf(pattern)===d;} function empty(){return this=='';} function blank(){return/^\s*$/.test(this);} function interpolate(object,pattern){return new Template(this,pattern).evaluate( object);} return{gsub:gsub,sub:sub,scan:scan,truncate:truncate,strip:String.prototype.trim ?String.prototype.trim:strip,stripTags:stripTags,stripScripts:stripScripts,extra ctScripts:extractScripts,evalScripts:evalScripts,escapeHTML:escapeHTML,unescapeH TML:unescapeHTML,toQueryParams:toQueryParams,parseQuery:toQueryParams,toArray:to Array,succ:succ,times:times,camelize:camelize,capitalize:capitalize,underscore:u nderscore,dasherize:dasherize,inspect:inspect,toJSON:toJSON,unfilterJSON:unfilte rJSON,isJSON:isJSON,evalJSON:evalJSON,include:include,startsWith:startsWith,ends With:endsWith,empty:empty,blank:blank,interpolate:interpolate};})());var Templat e=Class.create({initialize:function(template,pattern){this.template=template.toS tring();this.pattern=pattern Template.Pattern;},evaluate:function(object){if(ob ject&&Object.isFunction(object.toTemplateReplacements)) object=object.toTemplateReplacements();return this.template.gsub(this.pattern,fu nction(match){if(object==null)return(match[1]+'');var before=match[1] '';if(bef ore=='\\')return match[2];var ctx=object,expr=match[3];var pattern=/^([^.[]+ \[( (?:.*?[^\\])?)\])(\. \[ $)/;match=pattern.exec(expr);if(match==null)return befor e;while(match!=null){var comp=match[1].startsWith('[')?match[2].replace(/\\\\]/g ,']'):match[1];ctx=ctx[comp];if(null==ctx ''==match[3])break;expr=expr.substrin g('['==match[3]?match[1].length:match[0].length);match=pattern.exec(expr);} return before+String.interpret(ctx);});}});Template.Pattern=/(^ . \r \n)(#\{(.*? )\})/;var $break={};var Enumerable=(function(){function each(iterator,context){v ar index=0;try{this._each(function(value){iterator.call(context,value,index++);} );}catch(e){if(e!=$break)throw e;} return this;} function eachSlice(number,iterator,context){var index=-number,slices=[],array=th is.toArray();if(number<1)return array;while((index+=number)<array.length) slices.push(array.slice(index,index+number));return slices.collect(iterator,cont ext);} function all(iterator,context){iterator=iterator Prototype.K;var result=true;th is.each(function(value,index){result=result&&!!iterator.call(context,value,index );if(!result)throw $break;});return result;} function any(iterator,context){iterator=iterator Prototype.K;var result=false;t his.each(function(value,index){if(result=!!iterator.call(context,value,index)) throw $break;});return result;} function collect(iterator,context){iterator=iterator Prototype.K;var results=[] ;this.each(function(value,index){results.push(iterator.call(context,value,index)

);});return results;} function detect(iterator,context){var result;this.each(function(value,index){if( iterator.call(context,value,index)){result=value;throw $break;}});return result; } function findAll(iterator,context){var results=[];this.each(function(value,index ){if(iterator.call(context,value,index)) results.push(value);});return results;} function grep(filter,iterator,context){iterator=iterator Prototype.K;var result s=[];if(Object.isString(filter)) filter=new RegExp(RegExp.escape(filter));this.each(function(value,index){if(filt er.match(value)) results.push(iterator.call(context,value,index));});return results;} function include(object){if(Object.isFunction(this.indexOf)) if(this.indexOf(object)!=-1)return true;var found=false;this.each(function(value ){if(value==object){found=true;throw $break;}});return found;} function inGroupsOf(number,fillWith){fillWith=Object.isUndefined(fillWith)?null: fillWith;return this.eachSlice(number,function(slice){while(slice.length<number) slice.push(fillWith);return slice;});} function inject(memo,iterator,context){this.each(function(value,index){memo=iter ator.call(context,memo,value,index);});return memo;} function invoke(method){var args=$A(arguments).slice(1);return this.map(function (value){return value[method].apply(value,args);});} function max(iterator,context){iterator=iterator Prototype.K;var result;this.ea ch(function(value,index){value=iterator.call(context,value,index);if(result==nul l value>=result) result=value;});return result;} function min(iterator,context){iterator=iterator Prototype.K;var result;this.ea ch(function(value,index){value=iterator.call(context,value,index);if(result==nul l value<result) result=value;});return result;} function partition(iterator,context){iterator=iterator Prototype.K;var trues=[] ,falses=[];this.each(function(value,index){(iterator.call(context,value,index)?t rues:falses).push(value);});return[trues,falses];} function pluck(property){var results=[];this.each(function(value){results.push(v alue[property]);});return results;} function reject(iterator,context){var results=[];this.each(function(value,index) {if(!iterator.call(context,value,index)) results.push(value);});return results;} function sortBy(iterator,context){return this.map(function(value,index){return{v alue:value,criteria:iterator.call(context,value,index)};}).sort(function(left,ri ght){var a=left.criteria,b=right.criteria;return a<b?-1:a>b?1:0;}).pluck('value' );} function toArray(){return this.map();} function zip(){var iterator=Prototype.K,args=$A(arguments);if(Object.isFunction( args.last())) iterator=args.pop();var collections=[this].concat(args).map($A);return this.map( function(value,index){return iterator(collections.pluck(index));});} function size(){return this.toArray().length;} function inspect(){return'#<Enumerable:'+this.toArray().inspect()+'>';} return{each:each,eachSlice:eachSlice,all:all,every:all,any:any,some:any,collect: collect,map:collect,detect:detect,findAll:findAll,select:findAll,filter:findAll, grep:grep,include:include,member:include,inGroupsOf:inGroupsOf,inject:inject,inv oke:invoke,max:max,min:min,partition:partition,pluck:pluck,reject:reject,sortBy: sortBy,toArray:toArray,entries:toArray,zip:zip,size:size,inspect:inspect,find:de tect};})();function $A(iterable){if(!iterable)return[];if('toArray'in Object(ite rable))return iterable.toArray();var length=iterable.length 0,results=new Array (length);while(length--)results[length]=iterable[length];return results;} function $w(string){if(!Object.isString(string))return[];string=string.strip();r eturn string?string.split(/\s+/):[];} Array.from=$A;(function(){var arrayProto=Array.prototype,slice=arrayProto.slice,

_each=arrayProto.forEach;function each(iterator){for(var i=0,length=this.length; i<length;i++) iterator(this[i]);} if(!_each)_each=each;function clear(){this.length=0;return this;} function first(){return this[0];} function last(){return this[this.length-1];} function compact(){return this.select(function(value){return value!=null;});} function flatten(){return this.inject([],function(array,value){if(Object.isArray (value)) return array.concat(value.flatten());array.push(value);return array;});} function without(){var values=slice.call(arguments,0);return this.select(functio n(value){return!values.include(value);});} function reverse(inline){return(inline!==false?this:this.toArray())._reverse();} function uniq(sorted){return this.inject([],function(array,value,index){if(0==in dex (sorted?array.last()!=value:!array.include(value))) array.push(value);return array;});} function intersect(array){return this.uniq().findAll(function(item){return array .detect(function(value){return item===value});});} function clone(){return slice.call(this,0);} function size(){return this.length;} function inspect(){return'['+this.map(Object.inspect).join(', ')+']';} function toJSON(){var results=[];this.each(function(object){var value=Object.toJ SON(object);if(!Object.isUndefined(value))results.push(value);});return'['+resul ts.join(', ')+']';} function indexOf(item,i){i (i=0);var length=this.length;if(i<0)i=length+i;for(; i<length;i++) if(this[i]===item)return i;return-1;} function lastIndexOf(item,i){i=isNaN(i)?this.length:(i<0?this.length+i:i)+1;var n=this.slice(0,i).reverse().indexOf(item);return(n<0)?n:i-n-1;} function concat(){var array=slice.call(this,0),item;for(var i=0,length=arguments .length;i<length;i++){item=arguments[i];if(Object.isArray(item)&&!('callee'in it em)){for(var j=0,arrayLength=item.length;j<arrayLength;j++) array.push(item[j]);}else{array.push(item);}} return array;} Object.extend(arrayProto,Enumerable);if(!arrayProto._reverse) arrayProto._reverse=arrayProto.reverse;Object.extend(arrayProto,{_each:_each,cle ar:clear,first:first,last:last,compact:compact,flatten:flatten,without:without,r everse:reverse,uniq:uniq,intersect:intersect,clone:clone,toArray:clone,size:size ,inspect:inspect,toJSON:toJSON});var CONCAT_ARGUMENTS_BUGGY=(function(){return[] .concat(arguments)[0][0]!==1;})(1,2) if(CONCAT_ARGUMENTS_BUGGY)arrayProto.concat=concat;if(!arrayProto.indexOf)arrayP roto.indexOf=indexOf;if(!arrayProto.lastIndexOf)arrayProto.lastIndexOf=lastIndex Of;})();function $H(object){return new Hash(object);};var Hash=Class.create(Enum erable,(function(){function initialize(object){this._object=Object.isHash(object )?object.toObject():Object.clone(object);} function _each(iterator){for(var key in this._object){var value=this._object[key ],pair=[key,value];pair.key=key;pair.value=value;iterator(pair);}} function set(key,value){return this._object[key]=value;} function get(key){if(this._object[key]!==Object.prototype[key]) return this._object[key];} function unset(key){var value=this._object[key];delete this._object[key];return value;} function toObject(){return Object.clone(this._object);} function keys(){return this.pluck('key');} function values(){return this.pluck('value');} function index(value){var match=this.detect(function(pair){return pair.value===v alue;});return match&&match.key;} function merge(object){return this.clone().update(object);} function update(object){return new Hash(object).inject(this,function(result,pair ){result.set(pair.key,pair.value);return result;});}

function toQueryPair(key,value){if(Object.isUndefined(value))return key;return k ey+'='+encodeURIComponent(String.interpret(value));} function toQueryString(){return this.inject([],function(results,pair){var key=en codeURIComponent(pair.key),values=pair.value;if(values&&typeof values=='object') {if(Object.isArray(values)) return results.concat(values.map(toQueryPair.curry(key)));}else results.push(toQ ueryPair(key,values));return results;}).join('&');} function inspect(){return'#<Hash:{'+this.map(function(pair){return pair.map(Obje ct.inspect).join(': ');}).join(', ')+'}>';} function toJSON(){return Object.toJSON(this.toObject());} function clone(){return new Hash(this);} return{initialize:initialize,_each:_each,set:set,get:get,unset:unset,toObject:to Object,toTemplateReplacements:toObject,keys:keys,values:values,index:index,merge :merge,update:update,toQueryString:toQueryString,inspect:inspect,toJSON:toJSON,c lone:clone};})());Hash.from=$H;Object.extend(Number.prototype,(function(){functi on toColorPart(){return this.toPaddedString(2,16);} function succ(){return this+1;} function times(iterator,context){$R(0,this,true).each(iterator,context);return t his;} function toPaddedString(length,radix){var string=this.toString(radix 10);return '0'.times(length-string.length)+string;} function toJSON(){return isFinite(this)?this.toString():'null';} function abs(){return Math.abs(this);} function round(){return Math.round(this);} function ceil(){return Math.ceil(this);} function floor(){return Math.floor(this);} return{toColorPart:toColorPart,succ:succ,times:times,toPaddedString:toPaddedStri ng,toJSON:toJSON,abs:abs,round:round,ceil:ceil,floor:floor};})());function $R(st art,end,exclusive){return new ObjectRange(start,end,exclusive);} var ObjectRange=Class.create(Enumerable,(function(){function initialize(start,en d,exclusive){this.start=start;this.end=end;this.exclusive=exclusive;} function _each(iterator){var value=this.start;while(this.include(value)){iterato r(value);value=value.succ();}} function include(value){if(value<this.start) return false;if(this.exclusive) return value<this.end;return value<=this.end;} return{initialize:initialize,_each:_each,include:include};})());var Ajax={getTra nsport:function(){return Try.these(function(){return new XMLHttpRequest()},funct ion(){return new ActiveXObject('Msxml2.XMLHTTP')},function(){return new ActiveXO bject('Microsoft.XMLHTTP')}) false;},activeRequestCount:0};Ajax.Responders={res ponders:[],_each:function(iterator){this.responders._each(iterator);},register:f unction(responder){if(!this.include(responder)) this.responders.push(responder);},unregister:function(responder){this.responders =this.responders.without(responder);},dispatch:function(callback,request,transpo rt,json){this.each(function(responder){if(Object.isFunction(responder[callback]) ){try{responder[callback].apply(responder,[request,transport,json]);}catch(e){}} });}};Object.extend(Ajax.Responders,Enumerable);Ajax.Responders.register({onCrea te:function(){Ajax.activeRequestCount++},onComplete:function(){Ajax.activeReques tCount--}});Ajax.Base=Class.create({initialize:function(options){this.options={m ethod:'post',asynchronous:true,contentType:'application/x-www-form-urlencoded',e ncoding:'UTF-8',parameters:'',evalJSON:true,evalJS:true};Object.extend(this.opti ons,options {});this.options.method=this.options.method.toLowerCase();if(Object .isString(this.options.parameters)) this.options.parameters=this.options.parameters.toQueryParams();else if(Object.i sHash(this.options.parameters)) this.options.parameters=this.options.parameters.toObject();}});Ajax.Request=Clas s.create(Ajax.Base,{_complete:false,initialize:function($super,url,options){$sup er(options);this.transport=Ajax.getTransport();this.request(url);},request:funct ion(url){this.url=url;this.method=this.options.method;var params=Object.clone(th is.options.parameters);if(!['get','post'].include(this.method)){params['_method'

]=this.method;this.method='post';} this.parameters=params;if(params=Object.toQueryString(params)){if(this.method==' get') this.url+=(this.url.include('?')?'&':'?')+params;else if(/Konqueror Safari KHTML /.test(navigator.userAgent)) params+='&_=';} try{var response=new Ajax.Response(this);if(this.options.onCreate)this.options.o nCreate(response);Ajax.Responders.dispatch('onCreate',this,response);this.transp ort.open(this.method.toUpperCase(),this.url,this.options.asynchronous);if(this.o ptions.asynchronous)this.respondToReadyState.bind(this).defer(1);this.transport. onreadystatechange=this.onStateChange.bind(this);this.setRequestHeaders();this.b ody=this.method=='post'?(this.options.postBody params):null;this.transport.send (this.body);if(!this.options.asynchronous&&this.transport.overrideMimeType) this.onStateChange();} catch(e){this.dispatchException(e);}},onStateChange:function(){var readyState=th is.transport.readyState;if(readyState>1&&!((readyState==4)&&this._complete)) this.respondToReadyState(this.transport.readyState);},setRequestHeaders:function (){var headers={'X-Requested-With':'XMLHttpRequest','X-Prototype-Version':Protot ype.Version,'Accept':'text/javascript, text/html, application/xml, text/xml, */* '};if(this.method=='post'){headers['Content-type']=this.options.contentType+ (this.options.encoding?'; charset='+this.options.encoding:'');if(this.transport. overrideMimeType&&(navigator.userAgent.match(/Gecko\/(\d{4})/) [0,2005])[1]<200 5) headers['Connection']='close';} if(typeof this.options.requestHeaders=='object'){var extras=this.options.request Headers;if(Object.isFunction(extras.push)) for(var i=0,length=extras.length;i<length;i+=2) headers[extras[i]]=extras[i+1];else $H(extras).each(function(pair){headers[pair.key]=pair.value});} for(var name in headers) this.transport.setRequestHeader(name,headers[name]);},success:function(){var sta tus=this.getStatus();return!status (status>=200&&status<300);},getStatus:functi on(){try{return this.transport.status 0;}catch(e){return 0}},respondToReadyStat e:function(readyState){var state=Ajax.Request.Events[readyState],response=new Aj ax.Response(this);if(state=='Complete'){try{this._complete=true;(this.options['o n'+response.status] this.options['on'+(this.success()?'Success':'Failure')] Pr ototype.emptyFunction)(response,response.headerJSON);}catch(e){this.dispatchExce ption(e);} var contentType=response.getHeader('Content-type');if(this.options.evalJS=='forc e' (this.options.evalJS&&this.isSameOrigin()&&contentType&&contentType.match(/^ \s*(text application)\/(x-)?(java ecma)script(;.*)?\s*$/i))) this.evalResponse();} try{(this.options['on'+state] Prototype.emptyFunction)(response,response.header JSON);Ajax.Responders.dispatch('on'+state,this,response,response.headerJSON);}ca tch(e){this.dispatchException(e);} if(state=='Complete'){this.transport.onreadystatechange=Prototype.emptyFunction; }},isSameOrigin:function(){var m=this.url.match(/^\s*https?:\/\/[^\/]*/);return! m (m[0]=='#{protocol}//#{domain}#{port}'.interpolate({protocol:location.protoco l,domain:document.domain,port:location.port?':'+location.port:''}));},getHeader: function(name){try{return this.transport.getResponseHeader(name) null;}catch(e) {return null;}},evalResponse:function(){try{return eval((this.transport.response Text '').unfilterJSON());}catch(e){this.dispatchException(e);}},dispatchExcepti on:function(exception){(this.options.onException Prototype.emptyFunction)(this, exception);Ajax.Responders.dispatch('onException',this,exception);}});Ajax.Reque st.Events=['Uninitialized','Loading','Loaded','Interactive','Complete'];Ajax.Res ponse=Class.create({initialize:function(request){this.request=request;var transp ort=this.transport=request.transport,readyState=this.readyState=transport.readyS tate;if((readyState>2&&!Prototype.Browser.IE) readyState==4){this.status=this.g etStatus();this.statusText=this.getStatusText();this.responseText=String.interpr et(transport.responseText);this.headerJSON=this._getHeaderJSON();}

if(readyState==4){var xml=transport.responseXML;this.responseXML=Object.isUndefi ned(xml)?null:xml;this.responseJSON=this._getResponseJSON();}},status:0,statusTe xt:'',getStatus:Ajax.Request.prototype.getStatus,getStatusText:function(){try{re turn this.transport.statusText '';}catch(e){return''}},getHeader:Ajax.Request.p rototype.getHeader,getAllHeaders:function(){try{return this.getAllResponseHeader s();}catch(e){return null}},getResponseHeader:function(name){return this.transpo rt.getResponseHeader(name);},getAllResponseHeaders:function(){return this.transp ort.getAllResponseHeaders();},_getHeaderJSON:function(){var json=this.getHeader( 'X-JSON');if(!json)return null;json=decodeURIComponent(escape(json));try{return json.evalJSON(this.request.options.sanitizeJSON !this.request.isSameOrigin());} catch(e){this.request.dispatchException(e);}},_getResponseJSON:function(){var op tions=this.request.options;if(!options.evalJSON (options.evalJSON!='force'&&!(t his.getHeader('Content-type') '').include('application/json')) this.responseTe xt.blank()) return null;try{return this.responseText.evalJSON(options.sanitizeJSON !this.re quest.isSameOrigin());}catch(e){this.request.dispatchException(e);}}});Ajax.Upda ter=Class.create(Ajax.Request,{initialize:function($super,container,url,options) {this.container={success:(container.success container),failure:(container.failu re (container.success?null:container))};options=Object.clone(options);var onCom plete=options.onComplete;options.onComplete=(function(response,json){this.update Content(response.responseText);if(Object.isFunction(onComplete))onComplete(respo nse,json);}).bind(this);$super(url,options);},updateContent:function(responseTex t){var receiver=this.container[this.success()?'success':'failure'],options=this. options;if(!options.evalScripts)responseText=responseText.stripScripts();if(rece iver=$(receiver)){if(options.insertion){if(Object.isString(options.insertion)){v ar insertion={};insertion[options.insertion]=responseText;receiver.insert(insert ion);} else options.insertion(receiver,responseText);} else receiver.update(responseText);}}});Ajax.PeriodicalUpdater=Class.create(Ajax .Base,{initialize:function($super,container,url,options){$super(options);this.on Complete=this.options.onComplete;this.frequency=(this.options.frequency 2);this .decay=(this.options.decay 1);this.updater={};this.container=container;this.url =url;this.start();},start:function(){this.options.onComplete=this.updateComplete .bind(this);this.onTimerEvent();},stop:function(){this.updater.options.onComplet e=undefined;clearTimeout(this.timer);(this.onComplete Prototype.emptyFunction). apply(this,arguments);},updateComplete:function(response){if(this.options.decay) {this.decay=(response.responseText==this.lastText?this.decay*this.options.decay: 1);this.lastText=response.responseText;} this.timer=this.onTimerEvent.bind(this).delay(this.decay*this.frequency);},onTim erEvent:function(){this.updater=new Ajax.Updater(this.container,this.url,this.op tions);}});function $(element){if(arguments.length>1){for(var i=0,elements=[],le ngth=arguments.length;i<length;i++) elements.push($(arguments[i]));return elements;} if(Object.isString(element)) element=document.getElementById(element);return Element.extend(element);} if(Prototype.BrowserFeatures.XPath){document._getElementsByXPath=function(expres sion,parentElement){var results=[];var query=document.evaluate(expression,$(pare ntElement) document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(var i =0,length=query.snapshotLength;i<length;i++) results.push(Element.extend(query.snapshotItem(i)));return results;};} if(!window.Node)var Node={};if(!Node.ELEMENT_NODE){Object.extend(Node,{ELEMENT_N ODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5, ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUM ENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12});} (function(global){var SETATTRIBUTE_IGNORES_NAME=(function(){var elForm=document. createElement("form");var elInput=document.createElement("input");var root=docum ent.documentElement;elInput.setAttribute("name","test");elForm.appendChild(elInp ut);root.appendChild(elForm);var isBuggy=elForm.elements?(typeof elForm.elements .test=="undefined"):null;root.removeChild(elForm);elForm=elInput=null;return isB uggy;})();var element=global.Element;global.Element=function(tagName,attributes)

{attributes=attributes {};tagName=tagName.toLowerCase();var cache=Element.cache ;if(SETATTRIBUTE_IGNORES_NAME&&attributes.name){tagName='<'+tagName+' name="'+at tributes.name+'">';delete attributes.name;return Element.writeAttribute(document .createElement(tagName),attributes);} if(!cache[tagName])cache[tagName]=Element.extend(document.createElement(tagName) );return Element.writeAttribute(cache[tagName].cloneNode(false),attributes);};Ob ject.extend(global.Element,element {});if(element)global.Element.prototype=elem ent.prototype;})(this);Element.cache={};Element.idCounter=1;Element.Methods={vis ible:function(element){return $(element).style.display!='none';},toggle:function (element){element=$(element);Element[Element.visible(element)?'hide':'show'](ele ment);return element;},hide:function(element){element=$(element);element.style.d isplay='none';return element;},show:function(element){element=$(element);element .style.display='';return element;},remove:function(element){element=$(element);e lement.parentNode.removeChild(element);return element;},update:(function(){var S ELECT_ELEMENT_INNERHTML_BUGGY=(function(){var el=document.createElement("select" ),isBuggy=true;el.innerHTML="<option value=\"test\">test</option>";if(el.options &&el.options[0]){isBuggy=el.options[0].nodeName.toUpperCase()!=="OPTION";} el=null;return isBuggy;})();var TABLE_ELEMENT_INNERHTML_BUGGY=(function(){try{va r el=document.createElement("table");if(el&&el.tBodies){el.innerHTML="<tbody><tr ><td>test</td></tr></tbody>";var isBuggy=typeof el.tBodies[0]=="undefined";el=nu ll;return isBuggy;}}catch(e){return true;}})();var SCRIPT_ELEMENT_REJECTS_TEXTNO DE_APPENDING=(function(){var s=document.createElement("script"),isBuggy=false;tr y{s.appendChild(document.createTextNode(""));isBuggy=!s.firstChild s.firstChild &&s.firstChild.nodeType!==3;}catch(e){isBuggy=true;} s=null;return isBuggy;})();function update(element,content){element=$(element);i f(content&&content.toElement) content=content.toElement();if(Object.isElement(content)) return element.update().insert(content);content=Object.toHTML(content);var tagNa me=element.tagName.toUpperCase();if(tagName==='SCRIPT'&&SCRIPT_ELEMENT_REJECTS_T EXTNODE_APPENDING){element.text=content;return element;} if(SELECT_ELEMENT_INNERHTML_BUGGY TABLE_ELEMENT_INNERHTML_BUGGY){if(tagName in Element._insertionTranslations.tags){while(element.firstChild){element.removeChi ld(element.firstChild);} Element._getContentFromAnonymousElement(tagName,content.stripScripts()).each(fun ction(node){element.appendChild(node)});} else{element.innerHTML=content.stripScripts();}} else{element.innerHTML=content.stripScripts();} content.evalScripts.bind(content).defer();return element;} return update;})(),replace:function(element,content){element=$(element);if(conte nt&&content.toElement)content=content.toElement();else if(!Object.isElement(cont ent)){content=Object.toHTML(content);var range=element.ownerDocument.createRange ();range.selectNode(element);content.evalScripts.bind(content).defer();content=r ange.createContextualFragment(content.stripScripts());} element.parentNode.replaceChild(content,element);return element;},insert:functio n(element,insertions){element=$(element);if(Object.isString(insertions) Object. isNumber(insertions) Object.isElement(insertions) (insertions&&(insertions.toE lement insertions.toHTML))) insertions={bottom:insertions};var content,insert,tagName,childNodes;for(var pos ition in insertions){content=insertions[position];position=position.toLowerCase( );insert=Element._insertionTranslations[position];if(content&&content.toElement) content=content.toElement();if(Object.isElement(content)){insert(element,content );continue;} content=Object.toHTML(content);tagName=((position=='before' position=='after')? element.parentNode:element).tagName.toUpperCase();childNodes=Element._getContent FromAnonymousElement(tagName,content.stripScripts());if(position=='top' positio n=='after')childNodes.reverse();childNodes.each(insert.curry(element));content.e valScripts.bind(content).defer();} return element;},wrap:function(element,wrapper,attributes){element=$(element);if (Object.isElement(wrapper)) $(wrapper).writeAttribute(attributes {});else if(Object.isString(wrapper))wrapp

er=new Element(wrapper,attributes);else wrapper=new Element('div',wrapper);if(el ement.parentNode) element.parentNode.replaceChild(wrapper,element);wrapper.appendChild(element);re turn wrapper;},inspect:function(element){element=$(element);var result='<'+eleme nt.tagName.toLowerCase();$H({'id':'id','className':'class'}).each(function(pair) {var property=pair.first(),attribute=pair.last();var value=(element[property] ' ').toString();if(value)result+=' '+attribute+'='+value.inspect(true);});return r esult+'>';},recursivelyCollect:function(element,property){element=$(element);var elements=[];while(element=element[property]) if(element.nodeType==1) elements.push(Element.extend(element));return elements;},ancestors:function(elem ent){return Element.recursivelyCollect(element,'parentNode');},descendants:funct ion(element){return Element.select(element,"*");},firstDescendant:function(eleme nt){element=$(element).firstChild;while(element&&element.nodeType!=1)element=ele ment.nextSibling;return $(element);},immediateDescendants:function(element){if(! (element=$(element).firstChild))return[];while(element&&element.nodeType!=1)elem ent=element.nextSibling;if(element)return[element].concat($(element).nextSibling s());return[];},previousSiblings:function(element){return Element.recursivelyCol lect(element,'previousSibling');},nextSiblings:function(element){return Element. recursivelyCollect(element,'nextSibling');},siblings:function(element){element=$ (element);return Element.previousSiblings(element).reverse().concat(Element.next Siblings(element));},match:function(element,selector){if(Object.isString(selecto r)) selector=new Selector(selector);return selector.match($(element));},up:function( element,expression,index){element=$(element);if(arguments.length==1)return $(ele ment.parentNode);var ancestors=Element.ancestors(element);return Object.isNumber (expression)?ancestors[expression]:Selector.findElement(ancestors,expression,ind ex);},down:function(element,expression,index){element=$(element);if(arguments.le ngth==1)return Element.firstDescendant(element);return Object.isNumber(expressio n)?Element.descendants(element)[expression]:Element.select(element,expression)[i ndex 0];},previous:function(element,expression,index){element=$(element);if(arg uments.length==1)return $(Selector.handlers.previousElementSibling(element));var previousSiblings=Element.previousSiblings(element);return Object.isNumber(expre ssion)?previousSiblings[expression]:Selector.findElement(previousSiblings,expres sion,index);},next:function(element,expression,index){element=$(element);if(argu ments.length==1)return $(Selector.handlers.nextElementSibling(element));var next Siblings=Element.nextSiblings(element);return Object.isNumber(expression)?nextSi blings[expression]:Selector.findElement(nextSiblings,expression,index);},select: function(element){var args=Array.prototype.slice.call(arguments,1);return Select or.findChildElements(element,args);},adjacent:function(element){var args=Array.p rototype.slice.call(arguments,1);return Selector.findChildElements(element.paren tNode,args).without(element);},identify:function(element){element=$(element);var id=Element.readAttribute(element,'id');if(id)return id;do{id='anonymous_element _'+Element.idCounter++}while($(id));Element.writeAttribute(element,'id',id);retu rn id;},readAttribute:function(element,name){element=$(element);if(Prototype.Bro wser.IE){var t=Element._attributeTranslations.read;if(t.values[name])return t.va lues[name](element,name);if(t.names[name])name=t.names[name];if(name.include(':' )){return(!element.attributes !element.attributes[name])?null:element.attribute s[name].value;}} return element.getAttribute(name);},writeAttribute:function(element,name,value){ element=$(element);var attributes={},t=Element._attributeTranslations.write;if(t ypeof name=='object')attributes=name;else attributes[name]=Object.isUndefined(va lue)?true:value;for(var attr in attributes){name=t.names[attr] attr;value=attri butes[attr];if(t.values[attr])name=t.values[attr](element,value);if(value===fals e value===null) element.removeAttribute(name);else if(value===true) element.setAttribute(name,name);else element.setAttribute(name,value);} return element;},getHeight:function(element){return Element.getDimensions(elemen t).height;},getWidth:function(element){return Element.getDimensions(element).wid th;},classNames:function(element){return new Element.ClassNames(element);},hasCl

assName:function(element,className){if(!(element=$(element)))return;var elementC lassName=element.className;return(elementClassName.length>0&&(elementClassName== className new RegExp("(^ \\s)"+className+"(\\s $)").test(elementClassName)));}, addClassName:function(element,className){if(!(element=$(element)))return;if(!Ele ment.hasClassName(element,className)) element.className+=(element.className?' ':'')+className;return element;},removeC lassName:function(element,className){if(!(element=$(element)))return;element.cla ssName=element.className.replace(new RegExp("(^ \\s+)"+className+"(\\s+ $)"),' ' ).strip();return element;},toggleClassName:function(element,className){if(!(elem ent=$(element)))return;return Element[Element.hasClassName(element,className)?'r emoveClassName':'addClassName'](element,className);},cleanWhitespace:function(el ement){element=$(element);var node=element.firstChild;while(node){var nextNode=n ode.nextSibling;if(node.nodeType==3&&!/\S/.test(node.nodeValue)) element.removeChild(node);node=nextNode;} return element;},empty:function(element){return $(element).innerHTML.blank();},d escendantOf:function(element,ancestor){element=$(element),ancestor=$(ancestor);i f(element.compareDocumentPosition) return(element.compareDocumentPosition(ancestor)&8)===8;if(ancestor.contains) return ancestor.contains(element)&&ancestor!==element;while(element=element.pare ntNode) if(element==ancestor)return true;return false;},scrollTo:function(element){eleme nt=$(element);var pos=Element.cumulativeOffset(element);window.scrollTo(pos[0],p os[1]);return element;},getStyle:function(element,style){element=$(element);styl e=style=='float'?'cssFloat':style.camelize();var value=element.style[style];if(! value value=='auto'){var css=document.defaultView.getComputedStyle(element,null );value=css?css[style]:null;} if(style=='opacity')return value?parseFloat(value):1.0;return value=='auto'?null :value;},getOpacity:function(element){return $(element).getStyle('opacity');},se tStyle:function(element,styles){element=$(element);var elementStyle=element.styl e,match;if(Object.isString(styles)){element.style.cssText+=';'+styles;return sty les.include('opacity')?element.setOpacity(styles.match(/opacity:\s*(\d?\.?\d*)/) [1]):element;} for(var property in styles) if(property=='opacity')element.setOpacity(styles[property]);else elementStyle[(property=='float' property=='cssFloat')?(Object.isUndefined(eleme ntStyle.styleFloat)?'cssFloat':'styleFloat'):property]=styles[property];return e lement;},setOpacity:function(element,value){element=$(element);element.style.opa city=(value==1 value==='')?'':(value<0.00001)?0:value;return element;},getDimen sions:function(element){element=$(element);var display=Element.getStyle(element, 'display');if(display!='none'&&display!=null) return{width:element.offsetWidth,height:element.offsetHeight};var els=element.st yle;var originalVisibility=els.visibility;var originalPosition=els.position;var originalDisplay=els.display;els.visibility='hidden';if(originalPosition!='fixed' ) els.position='absolute';els.display='block';var originalWidth=element.clientWidt h;var originalHeight=element.clientHeight;els.display=originalDisplay;els.positi on=originalPosition;els.visibility=originalVisibility;return{width:originalWidth ,height:originalHeight};},makePositioned:function(element){element=$(element);va r pos=Element.getStyle(element,'position');if(pos=='static' !pos){element._made Positioned=true;element.style.position='relative';if(Prototype.Browser.Opera){el ement.style.top=0;element.style.left=0;}} return element;},undoPositioned:function(element){element=$(element);if(element. _madePositioned){element._madePositioned=undefined;element.style.position=elemen t.style.top=element.style.left=element.style.bottom=element.style.right='';} return element;},makeClipping:function(element){element=$(element);if(element._o verflow)return element;element._overflow=Element.getStyle(element,'overflow') ' auto';if(element._overflow!=='hidden') element.style.overflow='hidden';return element;},undoClipping:function(element){ element=$(element);if(!element._overflow)return element;element.style.overflow=e lement._overflow=='auto'?'':element._overflow;element._overflow=null;return elem

ent;},cumulativeOffset:function(element){var valueT=0,valueL=0;do{valueT+=elemen t.offsetTop 0;valueL+=element.offsetLeft 0;element=element.offsetParent;}while (element);return Element._returnOffset(valueL,valueT);},positionedOffset:functio n(element){var valueT=0,valueL=0;do{valueT+=element.offsetTop 0;valueL+=element .offsetLeft 0;element=element.offsetParent;if(element){if(element.tagName.toUpp erCase()=='BODY')break;var p=Element.getStyle(element,'position');if(p!=='static ')break;}}while(element);return Element._returnOffset(valueL,valueT);},absolutiz e:function(element){element=$(element);if(Element.getStyle(element,'position')== 'absolute')return element;var offsets=Element.positionedOffset(element);var top= offsets[1];var left=offsets[0];var width=element.clientWidth;var height=element. clientHeight;element._originalLeft=left-parseFloat(element.style.left 0);elemen t._originalTop=top-parseFloat(element.style.top 0);element._originalWidth=eleme nt.style.width;element._originalHeight=element.style.height;element.style.positi on='absolute';element.style.top=top+'px';element.style.left=left+'px';element.st yle.width=width+'px';element.style.height=height+'px';return element;},relativiz e:function(element){element=$(element);if(Element.getStyle(element,'position')== 'relative')return element;element.style.position='relative';var top=parseFloat(e lement.style.top 0)-(element._originalTop 0);var left=parseFloat(element.style .left 0)-(element._originalLeft 0);element.style.top=top+'px';element.style.le ft=left+'px';element.style.height=element._originalHeight;element.style.width=el ement._originalWidth;return element;},cumulativeScrollOffset:function(element){v ar valueT=0,valueL=0;do{valueT+=element.scrollTop 0;valueL+=element.scrollLeft 0;element=element.parentNode;}while(element);return Element._returnOffset(value L,valueT);},getOffsetParent:function(element){if(element.offsetParent)return $(e lement.offsetParent);if(element==document.body)return $(element);while((element= element.parentNode)&&element!=document.body) if(Element.getStyle(element,'position')!='static') return $(element);return $(document.body);},viewportOffset:function(forElement){ var valueT=0,valueL=0;var element=forElement;do{valueT+=element.offsetTop 0;val ueL+=element.offsetLeft 0;if(element.offsetParent==document.body&&Element.getSt yle(element,'position')=='absolute')break;}while(element=element.offsetParent);e lement=forElement;do{if(!Prototype.Browser.Opera (element.tagName&&(element.tag Name.toUpperCase()=='BODY'))){valueT-=element.scrollTop 0;valueL-=element.scrol lLeft 0;}}while(element=element.parentNode);return Element._returnOffset(valueL ,valueT);},clonePosition:function(element,source){var options=Object.extend({set Left:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arg uments[2] {});source=$(source);var p=Element.viewportOffset(source);element=$(e lement);var delta=[0,0];var parent=null;if(Element.getStyle(element,'position')= ='absolute'){parent=Element.getOffsetParent(element);delta=Element.viewportOffse t(parent);} if(parent==document.body){delta[0]-=document.body.offsetLeft;delta[1]-=document. body.offsetTop;} if(options.setLeft)element.style.left=(p[0]-delta[0]+options.offsetLeft)+'px';if (options.setTop)element.style.top=(p[1]-delta[1]+options.offsetTop)+'px';if(opti ons.setWidth)element.style.width=source.offsetWidth+'px';if(options.setHeight)el ement.style.height=source.offsetHeight+'px';return element;}};Object.extend(Elem ent.Methods,{getElementsBySelector:Element.Methods.select,childElements:Element. Methods.immediateDescendants});Element._attributeTranslations={write:{names:{cla ssName:'class',htmlFor:'for'},values:{}}};if(Prototype.Browser.Opera){Element.Me thods.getStyle=Element.Methods.getStyle.wrap(function(proceed,element,style){swi tch(style){case'left':case'top':case'right':case'bottom':if(proceed(element,'pos ition')==='static')return null;case'height':case'width':if(!Element.visible(elem ent))return null;var dim=parseInt(proceed(element,style),10);if(dim!==element['o ffset'+style.capitalize()]) return dim+'px';var properties;if(style==='height'){properties=['border-top-widt h','padding-top','padding-bottom','border-bottom-width'];} else{properties=['border-left-width','padding-left','padding-right','border-righ t-width'];} return properties.inject(dim,function(memo,property){var val=proceed(element,pro perty);return val===null?memo:memo-parseInt(val,10);})+'px';default:return proce

ed(element,style);}});Element.Methods.readAttribute=Element.Methods.readAttribut e.wrap(function(proceed,element,attribute){if(attribute==='title')return element .title;return proceed(element,attribute);});} else if(Prototype.Browser.IE){Element.Methods.getOffsetParent=Element.Methods.ge tOffsetParent.wrap(function(proceed,element){element=$(element);try{element.offs etParent} catch(e){return $(document.body)} var position=element.getStyle('position');if(position!=='static')return proceed( element);element.setStyle({position:'relative'});var value=proceed(element);elem ent.setStyle({position:position});return value;});$w('positionedOffset viewportO ffset').each(function(method){Element.Methods[method]=Element.Methods[method].wr ap(function(proceed,element){element=$(element);try{element.offsetParent} catch(e){return Element._returnOffset(0,0)} var position=element.getStyle('position');if(position!=='static')return proceed( element);var offsetParent=element.getOffsetParent();if(offsetParent&&offsetParen t.getStyle('position')==='fixed') offsetParent.setStyle({zoom:1});element.setStyle({position:'relative'});var valu e=proceed(element);element.setStyle({position:position});return value;});});Elem ent.Methods.cumulativeOffset=Element.Methods.cumulativeOffset.wrap(function(proc eed,element){try{element.offsetParent} catch(e){return Element._returnOffset(0,0)} return proceed(element);});Element.Methods.getStyle=function(element,style){elem ent=$(element);style=(style=='float' style=='cssFloat')?'styleFloat':style.came lize();var value=element.style[style];if(!value&&element.currentStyle)value=elem ent.currentStyle[style];if(style=='opacity'){if(value=(element.getStyle('filter' ) '').match(/alpha\(opacity=(.*)\)/)) if(value[1])return parseFloat(value[1])/100;return 1.0;} if(value=='auto'){if((style=='width' style=='height')&&(element.getStyle('displ ay')!='none')) return element['offset'+style.capitalize()]+'px';return null;} return value;};Element.Methods.setOpacity=function(element,value){function strip Alpha(filter){return filter.replace(/alpha\([^\)]*\)/gi,'');} element=$(element);var currentStyle=element.currentStyle;if((currentStyle&&!curr entStyle.hasLayout) (!currentStyle&&element.style.zoom=='normal')) element.style.zoom=1;var filter=element.getStyle('filter'),style=element.style;i f(value==1 value===''){(filter=stripAlpha(filter))?style.filter=filter:style.re moveAttribute('filter');return element;}else if(value<0.00001)value=0;style.filt er=stripAlpha(filter)+'alpha(opacity='+(value*100)+')';return element;};Element. _attributeTranslations=(function(){var classProp='className';var forProp='for';v ar el=document.createElement('div');el.setAttribute(classProp,'x');if(el.classNa me!=='x'){el.setAttribute('class','x');if(el.className==='x'){classProp='class'; }} el=null;el=document.createElement('label');el.setAttribute(forProp,'x');if(el.ht mlFor!=='x'){el.setAttribute('htmlFor','x');if(el.htmlFor==='x'){forProp='htmlFo r';}} el=null;return{read:{names:{'class':classProp,'className':classProp,'for':forPro p,'htmlFor':forProp},values:{_getAttr:function(element,attribute){return element .getAttribute(attribute);},_getAttr2:function(element,attribute){return element. getAttribute(attribute,2);},_getAttrNode:function(element,attribute){var node=el ement.getAttributeNode(attribute);return node?node.value:"";},_getEv:(function() {var el=document.createElement('div');el.onclick=Prototype.emptyFunction;var val ue=el.getAttribute('onclick');var f;if(String(value).indexOf('{')>-1){f=function (element,attribute){attribute=element.getAttribute(attribute);if(!attribute)retu rn null;attribute=attribute.toString();attribute=attribute.split('{')[1];attribu te=attribute.split('}')[0];return attribute.strip();};} else if(value===''){f=function(element,attribute){attribute=element.getAttribute (attribute);if(!attribute)return null;return attribute.strip();};} el=null;return f;})(),_flag:function(element,attribute){return $(element).hasAtt ribute(attribute)?attribute:null;},style:function(element){return element.style. cssText.toLowerCase();},title:function(element){return element.title;}}}}})();El

ement._attributeTranslations.write={names:Object.extend({cellpadding:'cellPaddin g',cellspacing:'cellSpacing'},Element._attributeTranslations.read.names),values: {checked:function(element,value){element.checked=!!value;},style:function(elemen t,value){element.style.cssText=value?value:'';}}};Element._attributeTranslations .has={};$w('colSpan rowSpan vAlign dateTime accessKey tabIndex '+'encType maxLen gth readOnly longDesc frameBorder').each(function(attr){Element._attributeTransl ations.write.names[attr.toLowerCase()]=attr;Element._attributeTranslations.has[a ttr.toLowerCase()]=attr;});(function(v){Object.extend(v,{href:v._getAttr2,src:v. _getAttr2,type:v._getAttr,action:v._getAttrNode,disabled:v._flag,checked:v._flag ,readonly:v._flag,multiple:v._flag,onload:v._getEv,onunload:v._getEv,onclick:v._ getEv,ondblclick:v._getEv,onmousedown:v._getEv,onmouseup:v._getEv,onmouseover:v. _getEv,onmousemove:v._getEv,onmouseout:v._getEv,onfocus:v._getEv,onblur:v._getEv ,onkeypress:v._getEv,onkeydown:v._getEv,onkeyup:v._getEv,onsubmit:v._getEv,onres et:v._getEv,onselect:v._getEv,onchange:v._getEv});})(Element._attributeTranslati ons.read.values);if(Prototype.BrowserFeatures.ElementExtensions){(function(){fun ction _descendants(element){var nodes=element.getElementsByTagName('*'),results= [];for(var i=0,node;node=nodes[i];i++) if(node.tagName!=="!") results.push(node);return results;} Element.Methods.down=function(element,expression,index){element=$(element);if(ar guments.length==1)return element.firstDescendant();return Object.isNumber(expres sion)?_descendants(element)[expression]:Element.select(element,expression)[index 0];}})();}} else if(Prototype.Browser.Gecko&&/rv:1\.8\.0/.test(navigator.userAgent)){Element .Methods.setOpacity=function(element,value){element=$(element);element.style.opa city=(value==1)?0.999999:(value==='')?'':(value<0.00001)?0:value;return element; };} else if(Prototype.Browser.WebKit){Element.Methods.setOpacity=function(element,va lue){element=$(element);element.style.opacity=(value==1 value==='')?'':(value<0 .00001)?0:value;if(value==1) if(element.tagName.toUpperCase()=='IMG'&&element.width){element.width++;element. width--;}else try{var n=document.createTextNode(' ');element.appendChild(n);elem ent.removeChild(n);}catch(e){} return element;};Element.Methods.cumulativeOffset=function(element){var valueT=0 ,valueL=0;do{valueT+=element.offsetTop 0;valueL+=element.offsetLeft 0;if(eleme nt.offsetParent==document.body) if(Element.getStyle(element,'position')=='absolute')break;element=element.offset Parent;}while(element);return Element._returnOffset(valueL,valueT);};} if('outerHTML'in document.documentElement){Element.Methods.replace=function(elem ent,content){element=$(element);if(content&&content.toElement)content=content.to Element();if(Object.isElement(content)){element.parentNode.replaceChild(content, element);return element;} content=Object.toHTML(content);var parent=element.parentNode,tagName=parent.tagN ame.toUpperCase();if(Element._insertionTranslations.tags[tagName]){var nextSibli ng=element.next();var fragments=Element._getContentFromAnonymousElement(tagName, content.stripScripts());parent.removeChild(element);if(nextSibling) fragments.each(function(node){parent.insertBefore(node,nextSibling)});else fragments.each(function(node){parent.appendChild(node)});} else element.outerHTML=content.stripScripts();content.evalScripts.bind(content). defer();return element;};} Element._returnOffset=function(l,t){var result=[l,t];result.left=l;result.top=t; return result;};Element._getContentFromAnonymousElement=function(tagName,html){v ar div=new Element('div'),t=Element._insertionTranslations.tags[tagName];if(t){d iv.innerHTML=t[0]+html+t[1];t[2].times(function(){div=div.firstChild});}else div .innerHTML=html;return $A(div.childNodes);};Element._insertionTranslations={befo re:function(element,node){element.parentNode.insertBefore(node,element);},top:fu nction(element,node){element.insertBefore(node,element.firstChild);},bottom:func tion(element,node){element.appendChild(node);},after:function(element,node){elem ent.parentNode.insertBefore(node,element.nextSibling);},tags:{TABLE:['<table>',' </table>',1],TBODY:['<table><tbody>','</tbody></table>',2],TR:['<table><tbody><t

r>','</tr></tbody></table>',3],TD:['<table><tbody><tr><td>','</td></tr></tbody>< /table>',4],SELECT:['<select>','</select>',1]}};(function(){var tags=Element._in sertionTranslations.tags;Object.extend(tags,{THEAD:tags.TBODY,TFOOT:tags.TBODY,T H:tags.TD});})();Element.Methods.Simulated={hasAttribute:function(element,attrib ute){attribute=Element._attributeTranslations.has[attribute] attribute;var node =$(element).getAttributeNode(attribute);return!!(node&&node.specified);}};Elemen t.Methods.ByTag={};Object.extend(Element,Element.Methods);(function(div){if(!Pro totype.BrowserFeatures.ElementExtensions&&div['__proto__']){window.HTMLElement={ };window.HTMLElement.prototype=div['__proto__'];Prototype.BrowserFeatures.Elemen tExtensions=true;} div=null;})(document.createElement('div')) Element.extend=(function(){function checkDeficiency(tagName){if(typeof window.El ement!='undefined'){var proto=window.Element.prototype;if(proto){var id='_'+(Mat h.random()+'').slice(2);var el=document.createElement(tagName);proto[id]='x';var isBuggy=(el[id]!=='x');delete proto[id];el=null;return isBuggy;}} return false;} function extendElementWith(element,methods){for(var property in methods){var val ue=methods[property];if(Object.isFunction(value)&&!(property in element)) element[property]=value.methodize();}} var HTMLOBJECTELEMENT_PROTOTYPE_BUGGY=checkDeficiency('object');if(Prototype.Bro wserFeatures.SpecificElementExtensions){if(HTMLOBJECTELEMENT_PROTOTYPE_BUGGY){re turn function(element){if(element&&typeof element._extendedByPrototype=='undefin ed'){var t=element.tagName;if(t&&(/^(?:object applet embed)$/i.test(t))){extendE lementWith(element,Element.Methods);extendElementWith(element,Element.Methods.Si mulated);extendElementWith(element,Element.Methods.ByTag[t.toUpperCase()]);}} return element;}} return Prototype.K;} var Methods={},ByTag=Element.Methods.ByTag;var extend=Object.extend(function(ele ment){if(!element typeof element._extendedByPrototype!='undefined' element.nod eType!=1 element==window)return element;var methods=Object.clone(Methods),tagNa me=element.tagName.toUpperCase();if(ByTag[tagName])Object.extend(methods,ByTag[t agName]);extendElementWith(element,methods);element._extendedByPrototype=Prototy pe.emptyFunction;return element;},{refresh:function(){if(!Prototype.BrowserFeatu res.ElementExtensions){Object.extend(Methods,Element.Methods);Object.extend(Meth ods,Element.Methods.Simulated);}}});extend.refresh();return extend;})();Element. hasAttribute=function(element,attribute){if(element.hasAttribute)return element. hasAttribute(attribute);return Element.Methods.Simulated.hasAttribute(element,at tribute);};Element.addMethods=function(methods){var F=Prototype.BrowserFeatures, T=Element.Methods.ByTag;if(!methods){Object.extend(Form,Form.Methods);Object.ext end(Form.Element,Form.Element.Methods);Object.extend(Element.Methods.ByTag,{"FOR M":Object.clone(Form.Methods),"INPUT":Object.clone(Form.Element.Methods),"SELECT ":Object.clone(Form.Element.Methods),"TEXTAREA":Object.clone(Form.Element.Method s)});} if(arguments.length==2){var tagName=methods;methods=arguments[1];} if(!tagName)Object.extend(Element.Methods,methods {});else{if(Object.isArray(ta gName))tagName.each(extend);else extend(tagName);} function extend(tagName){tagName=tagName.toUpperCase();if(!Element.Methods.ByTag [tagName]) Element.Methods.ByTag[tagName]={};Object.extend(Element.Methods.ByTag[tagName],m ethods);} function copy(methods,destination,onlyIfAbsent){onlyIfAbsent=onlyIfAbsent false ;for(var property in methods){var value=methods[property];if(!Object.isFunction( value))continue;if(!onlyIfAbsent !(property in destination)) destination[property]=value.methodize();}} function findDOMClass(tagName){var klass;var trans={"OPTGROUP":"OptGroup","TEXTA REA":"TextArea","P":"Paragraph","FIELDSET":"FieldSet","UL":"UList","OL":"OList", "DL":"DList","DIR":"Directory","H1":"Heading","H2":"Heading","H3":"Heading","H4" :"Heading","H5":"Heading","H6":"Heading","Q":"Quote","INS":"Mod","DEL":"Mod","A" :"Anchor","IMG":"Image","CAPTION":"TableCaption","COL":"TableCol","COLGROUP":"Ta bleCol","THEAD":"TableSection","TFOOT":"TableSection","TBODY":"TableSection","TR

":"TableRow","TH":"TableCell","TD":"TableCell","FRAMESET":"FrameSet","IFRAME":"I Frame"};if(trans[tagName])klass='HTML'+trans[tagName]+'Element';if(window[klass] )return window[klass];klass='HTML'+tagName+'Element';if(window[klass])return win dow[klass];klass='HTML'+tagName.capitalize()+'Element';if(window[klass])return w indow[klass];var element=document.createElement(tagName);var proto=element['__pr oto__'] element.constructor.prototype;element=null;return proto;} var elementPrototype=window.HTMLElement?HTMLElement.prototype:Element.prototype; if(F.ElementExtensions){copy(Element.Methods,elementPrototype);copy(Element.Meth ods.Simulated,elementPrototype,true);} if(F.SpecificElementExtensions){for(var tag in Element.Methods.ByTag){var klass= findDOMClass(tag);if(Object.isUndefined(klass))continue;copy(T[tag],klass.protot ype);}} Object.extend(Element,Element.Methods);delete Element.ByTag;if(Element.extend.re fresh)Element.extend.refresh();Element.cache={};};document.viewport={getDimensio ns:function(){return{width:this.getWidth(),height:this.getHeight()};},getScrollO ffsets:function(){return Element._returnOffset(window.pageXOffset document.docu mentElement.scrollLeft document.body.scrollLeft,window.pageYOffset document.do cumentElement.scrollTop document.body.scrollTop);}};(function(viewport){var B=P rototype.Browser,doc=document,element,property={};function getRootElement(){if(B .WebKit&&!doc.evaluate) return document;if(B.Opera&&window.parseFloat(window.opera.version())<9.5) return document.body;return document.documentElement;} function define(D){if(!element)element=getRootElement();property[D]='client'+D;v iewport['get'+D]=function(){return element[property[D]]};return viewport['get'+D ]();} viewport.getWidth=define.curry('Width');viewport.getHeight=define.curry('Height' );})(document.viewport);Element.Storage={UID:1};Element.addMethods({getStorage:f unction(element){if(!(element=$(element)))return;var uid;if(element===window){ui d=0;}else{if(typeof element._prototypeUID==="undefined") element._prototypeUID=[Element.Storage.UID++];uid=element._prototypeUID[0];} if(!Element.Storage[uid]) Element.Storage[uid]=$H();return Element.Storage[uid];},store:function(element,k ey,value){if(!(element=$(element)))return;if(arguments.length===2){Element.getSt orage(element).update(key);}else{Element.getStorage(element).set(key,value);} return element;},retrieve:function(element,key,defaultValue){if(!(element=$(elem ent)))return;var hash=Element.getStorage(element),value=hash.get(key);if(Object. isUndefined(value)){hash.set(key,defaultValue);value=defaultValue;} return value;},clone:function(element,deep){if(!(element=$(element)))return;var clone=element.cloneNode(deep);clone._prototypeUID=void 0;if(deep){var descendant s=Element.select(clone,'*'),i=descendants.length;while(i--){descendants[i]._prot otypeUID=void 0;}} return Element.extend(clone);}});var Selector=Class.create({initialize:function( expression){this.expression=expression.strip();if(this.shouldUseSelectorsAPI()){ this.mode='selectorsAPI';}else if(this.shouldUseXPath()){this.mode='xpath';this. compileXPathMatcher();}else{this.mode="normal";this.compileMatcher();}},shouldUs eXPath:(function(){var IS_DESCENDANT_SELECTOR_BUGGY=(function(){var isBuggy=fals e;if(document.evaluate&&window.XPathResult){var el=document.createElement('div') ;el.innerHTML='<ul><li></li></ul><div><ul><li></li></ul></div>';var xpath=".//*[ local-name()='ul' or local-name()='UL']"+"//*[local-name()='li' or local-name()= 'LI']";var result=document.evaluate(xpath,el,null,XPathResult.ORDERED_NODE_SNAPS HOT_TYPE,null);isBuggy=(result.snapshotLength!==2);el=null;} return isBuggy;})();return function(){if(!Prototype.BrowserFeatures.XPath)return false;var e=this.expression;if(Prototype.Browser.WebKit&&(e.include("-of-type") e.include(":empty"))) return false;if((/(\[[\w-]*?: :checked)/).test(e)) return false;if(IS_DESCENDANT_SELECTOR_BUGGY)return false;return true;}})(),shou ldUseSelectorsAPI:function(){if(!Prototype.BrowserFeatures.SelectorsAPI)return f alse;if(Selector.CASE_INSENSITIVE_CLASS_NAMES)return false;if(!Selector._div)Sel ector._div=new Element('div');try{Selector._div.querySelector(this.expression);} catch(e){return false;}

return true;},compileMatcher:function(){var e=this.expression,ps=Selector.patter ns,h=Selector.handlers,c=Selector.criteria,le,p,m,len=ps.length,name;if(Selector ._cache[e]){this.matcher=Selector._cache[e];return;} this.matcher=["this.matcher = function(root) {","var r = root, h = Selector.hand lers, c = false, n;"];while(e&&le!=e&&(/\S/).test(e)){le=e;for(var i=0;i<len;i++ ){p=ps[i].re;name=ps[i].name;if(m=e.match(p)){this.matcher.push(Object.isFunctio n(c[name])?c[name](m):new Template(c[name]).evaluate(m));e=e.replace(m[0],'');br eak;}}} this.matcher.push("return h.unique(n);\n}");eval(this.matcher.join('\n'));Select or._cache[this.expression]=this.matcher;},compileXPathMatcher:function(){var e=t his.expression,ps=Selector.patterns,x=Selector.xpath,le,m,len=ps.length,name;if( Selector._cache[e]){this.xpath=Selector._cache[e];return;} this.matcher=['.//*'];while(e&&le!=e&&(/\S/).test(e)){le=e;for(var i=0;i<len;i++ ){name=ps[i].name;if(m=e.match(ps[i].re)){this.matcher.push(Object.isFunction(x[ name])?x[name](m):new Template(x[name]).evaluate(m));e=e.replace(m[0],'');break; }}} this.xpath=this.matcher.join('');Selector._cache[this.expression]=this.xpath;},f indElements:function(root){root=root document;var e=this.expression,results;swi tch(this.mode){case'selectorsAPI':if(root!==document){var oldId=root.id,id=$(roo t).identify();id=id.replace(/([\.:])/g,"\\$1");e="#"+id+" "+e;} results=$A(root.querySelectorAll(e)).map(Element.extend);root.id=oldId;return re sults;case'xpath':return document._getElementsByXPath(this.xpath,root);default:r eturn this.matcher(root);}},match:function(element){this.tokens=[];var e=this.ex pression,ps=Selector.patterns,as=Selector.assertions;var le,p,m,len=ps.length,na me;while(e&&le!==e&&(/\S/).test(e)){le=e;for(var i=0;i<len;i++){p=ps[i].re;name= ps[i].name;if(m=e.match(p)){if(as[name]){this.tokens.push([name,Object.clone(m)] );e=e.replace(m[0],'');}else{return this.findElements(document).include(element) ;}}}} var match=true,name,matches;for(var i=0,token;token=this.tokens[i];i++){name=tok en[0],matches=token[1];if(!Selector.assertions[name](element,matches)){match=fal se;break;}} return match;},toString:function(){return this.expression;},inspect:function(){r eturn"#<Selector:"+this.expression.inspect()+">";}});if(Prototype.BrowserFeature s.SelectorsAPI&&document.compatMode==='BackCompat'){Selector.CASE_INSENSITIVE_CL ASS_NAMES=(function(){var div=document.createElement('div'),span=document.create Element('span');div.id="prototype_test_id";span.className='Test';div.appendChild (span);var isIgnored=(div.querySelector('#prototype_test_id .test')!==null);div= span=null;return isIgnored;})();} Object.extend(Selector,{_cache:{},xpath:{descendant:"//*",child:"/*",adjacent:"/ following-sibling::*[1]",laterSibling:'/following-sibling::*',tagName:function(m ){if(m[1]=='*')return'';return"[local-name()='"+m[1].toLowerCase()+"' or local-n ame()='"+m[1].toUpperCase()+"']";},className:"[contains(concat(' ', @class, ' ') , ' #{1} ')]",id:"[@id='#{1}']",attrPresence:function(m){m[1]=m[1].toLowerCase() ;return new Template("[@#{1}]").evaluate(m);},attr:function(m){m[1]=m[1].toLower Case();m[3]=m[5] m[6];return new Template(Selector.xpath.operators[m[2]]).evalu ate(m);},pseudo:function(m){var h=Selector.xpath.pseudos[m[1]];if(!h)return'';if (Object.isFunction(h))return h(m);return new Template(Selector.xpath.pseudos[m[1 ]]).evaluate(m);},operators:{'=':"[@#{1}='#{3}']",'!=':"[@#{1}!='#{3}']",'^=':"[ starts-with(@#{1}, '#{3}')]",'$=':"[substring(@#{1}, (string-length(@#{1}) - str ing-length('#{3}') + 1))='#{3}']",'*=':"[contains(@#{1}, '#{3}')]",'~=':"[contai ns(concat(' ', @#{1}, ' '), ' #{3} ')]",' =':"[contains(concat('-', @#{1}, '-'), '-#{3}-')]"},pseudos:{'first-child':'[not(preceding-sibling::*)]','last-child': '[not(following-sibling::*)]','only-child':'[not(preceding-sibling::* or followi ng-sibling::*)]','empty':"[count(*) = 0 and (count(text()) = 0)]",'checked':"[@c hecked]",'disabled':"[(@disabled) and (@type!='hidden')]",'enabled':"[not(@disab led) and (@type!='hidden')]",'not':function(m){var e=m[6],p=Selector.patterns,x= Selector.xpath,le,v,len=p.length,name;var exclusion=[];while(e&&le!=e&&(/\S/).te st(e)){le=e;for(var i=0;i<len;i++){name=p[i].name if(m=e.match(p[i].re)){v=Object.isFunction(x[name])?x[name](m):new Template(x[na me]).evaluate(m);exclusion.push("("+v.substring(1,v.length-1)+")");e=e.replace(m

[0],'');break;}}} return"[not("+exclusion.join(" and ")+")]";},'nth-child':function(m){return Sele ctor.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ",m);},'nth-last-chi ld':function(m){return Selector.xpath.pseudos.nth("(count(./following-sibling::* ) + 1) ",m);},'nth-of-type':function(m){return Selector.xpath.pseudos.nth("posit ion() ",m);},'nth-last-of-type':function(m){return Selector.xpath.pseudos.nth("( last() + 1 - position()) ",m);},'first-of-type':function(m){m[6]="1";return Sele ctor.xpath.pseudos['nth-of-type'](m);},'last-of-type':function(m){m[6]="1";retur n Selector.xpath.pseudos['nth-last-of-type'](m);},'only-of-type':function(m){var p=Selector.xpath.pseudos;return p['first-of-type'](m)+p['last-of-type'](m);},nt h:function(fragment,m){var mm,formula=m[6],predicate;if(formula=='even')formula= '2n+0';if(formula=='odd')formula='2n+1';if(mm=formula.match(/^(\d+)$/)) return'['+fragment+"= "+mm[1]+']';if(mm=formula.match(/^(-?\d*)?n(([+-])(\d+))?/ )){if(mm[1]=="-")mm[1]=-1;var a=mm[1]?Number(mm[1]):1;var b=mm[2]?Number(mm[2]): 0;predicate="[((#{fragment} - #{b}) mod #{a} = 0) and "+"((#{fragment} - #{b}) d iv #{a} >= 0)]";return new Template(predicate).evaluate({fragment:fragment,a:a,b :b});}}}},criteria:{tagName:'n = h.tagName(n, r, "#{1}", c); c = false;',cl assName:'n = h.className(n, r, "#{1}", c); c = false;',id:'n = h.id(n, r, "#{ 1}", c); c = false;',attrPresence:'n = h.attrPresence(n, r, "#{1}", c) ; c = false;',attr:function(m){m[3]=(m[5] m[6]);return new Template('n = h.attr (n, r, "#{1}", "#{3}", "#{2}", c); c = false;').evaluate(m);},pseudo:function(m) {if(m[6])m[6]=m[6].replace(/"/g,'\\"');return new Template('n = h.pseudo(n, "#{1 }", "#{6}", r, c); c = false;').evaluate(m);},descendant:'c = "descendant";',chi ld:'c = "child";',adjacent:'c = "adjacent";',laterSibling:'c = "laterSibling";'} ,patterns:[{name:'laterSibling',re:/^\s*~\s*/},{name:'child',re:/^\s*>\s*/},{nam e:'adjacent',re:/^\s*\+\s*/},{name:'descendant',re:/^\s/},{name:'tagName',re:/^\ s*(\* [\w\-]+)(\b $)?/},{name:'id',re:/^#([\w\-\*]+)(\b $)/},{name:'className',r e:/^\.([\w\-\*]+)(\b $)/},{name:'pseudo',re:/^:((first last nth nth-last only)(child -of-type) empty checked (en dis)abled not)(\((.*?)\))?(\b $ (?=\s [:+~>])) /},{name:'attrPresence',re:/^\[((?:[\w-]+:)?[\w-]+)\]/},{name:'attr',re:/\[((?:[ \w-]*:)?[\w-]+)\s*(?:([!^$*~ ]?=)\s*((['"])([^\4]*?)\4 ([^'"][^\]]*?)))?\]/}],as sertions:{tagName:function(element,matches){return matches[1].toUpperCase()==ele ment.tagName.toUpperCase();},className:function(element,matches){return Element. hasClassName(element,matches[1]);},id:function(element,matches){return element.i d===matches[1];},attrPresence:function(element,matches){return Element.hasAttrib ute(element,matches[1]);},attr:function(element,matches){var nodeValue=Element.r eadAttribute(element,matches[1]);return nodeValue&&Selector.operators[matches[2] ](nodeValue,matches[5] matches[6]);}},handlers:{concat:function(a,b){for(var i= 0,node;node=b[i];i++) a.push(node);return a;},mark:function(nodes){var _true=Prototype.emptyFunction;f or(var i=0,node;node=nodes[i];i++) node._countedByPrototype=_true;return nodes;},unmark:(function(){var PROPERTIES_ ATTRIBUTES_MAP=(function(){var el=document.createElement('div'),isBuggy=false,pr opName='_countedByPrototype',value='x' el[propName]=value;isBuggy=(el.getAttribute(propName)===value);el=null;return is Buggy;})();return PROPERTIES_ATTRIBUTES_MAP?function(nodes){for(var i=0,node;nod e=nodes[i];i++) node.removeAttribute('_countedByPrototype');return nodes;}:function(nodes){for(v ar i=0,node;node=nodes[i];i++) node._countedByPrototype=void 0;return nodes;}})(),index:function(parentNode,rev erse,ofType){parentNode._countedByPrototype=Prototype.emptyFunction;if(reverse){ for(var nodes=parentNode.childNodes,i=nodes.length-1,j=1;i>=0;i--){var node=node s[i];if(node.nodeType==1&&(!ofType node._countedByPrototype))node.nodeIndex=j++ ;}}else{for(var i=0,j=1,nodes=parentNode.childNodes;node=nodes[i];i++) if(node.nodeType==1&&(!ofType node._countedByPrototype))node.nodeIndex=j++;}},u nique:function(nodes){if(nodes.length==0)return nodes;var results=[],n;for(var i =0,l=nodes.length;i<l;i++) if(typeof(n=nodes[i])._countedByPrototype=='undefined'){n._countedByPrototype=Pr ototype.emptyFunction;results.push(Element.extend(n));} return Selector.handlers.unmark(results);},descendant:function(nodes){var h=Sele

ctor.handlers;for(var i=0,results=[],node;node=nodes[i];i++) h.concat(results,node.getElementsByTagName('*'));return results;},child:function (nodes){var h=Selector.handlers;for(var i=0,results=[],node;node=nodes[i];i++){f or(var j=0,child;child=node.childNodes[j];j++) if(child.nodeType==1&&child.tagName!='!')results.push(child);} return results;},adjacent:function(nodes){for(var i=0,results=[],node;node=nodes [i];i++){var next=this.nextElementSibling(node);if(next)results.push(next);} return results;},laterSibling:function(nodes){var h=Selector.handlers;for(var i= 0,results=[],node;node=nodes[i];i++) h.concat(results,Element.nextSiblings(node));return results;},nextElementSibling :function(node){while(node=node.nextSibling) if(node.nodeType==1)return node;return null;},previousElementSibling:function(no de){while(node=node.previousSibling) if(node.nodeType==1)return node;return null;},tagName:function(nodes,root,tagNam e,combinator){var uTagName=tagName.toUpperCase();var results=[],h=Selector.handl ers;if(nodes){if(combinator){if(combinator=="descendant"){for(var i=0,node;node= nodes[i];i++) h.concat(results,node.getElementsByTagName(tagName));return results;}else nodes= this[combinator](nodes);if(tagName=="*")return nodes;} for(var i=0,node;node=nodes[i];i++) if(node.tagName.toUpperCase()===uTagName)results.push(node);return results;}else return root.getElementsByTagName(tagName);},id:function(nodes,root,id,combinato r){var targetNode=$(id),h=Selector.handlers;if(root==document){if(!targetNode)re turn[];if(!nodes)return[targetNode];}else{if(!root.sourceIndex root.sourceIndex <1){var nodes=root.getElementsByTagName('*');for(var j=0,node;node=nodes[j];j++) {if(node.id===id)return[node];}}} if(nodes){if(combinator){if(combinator=='child'){for(var i=0,node;node=nodes[i]; i++) if(targetNode.parentNode==node)return[targetNode];}else if(combinator=='descenda nt'){for(var i=0,node;node=nodes[i];i++) if(Element.descendantOf(targetNode,node))return[targetNode];}else if(combinator= ='adjacent'){for(var i=0,node;node=nodes[i];i++) if(Selector.handlers.previousElementSibling(targetNode)==node) return[targetNode];}else nodes=h[combinator](nodes);} for(var i=0,node;node=nodes[i];i++) if(node==targetNode)return[targetNode];return[];} return(targetNode&&Element.descendantOf(targetNode,root))?[targetNode]:[];},clas sName:function(nodes,root,className,combinator){if(nodes&&combinator)nodes=this[ combinator](nodes);return Selector.handlers.byClassName(nodes,root,className);}, byClassName:function(nodes,root,className){if(!nodes)nodes=Selector.handlers.des cendant([root]);var needle=' '+className+' ';for(var i=0,results=[],node,nodeCla ssName;node=nodes[i];i++){nodeClassName=node.className;if(nodeClassName.length== 0)continue;if(nodeClassName==className (' '+nodeClassName+' ').include(needle)) results.push(node);} return results;},attrPresence:function(nodes,root,attr,combinator){if(!nodes)nod es=root.getElementsByTagName("*");if(nodes&&combinator)nodes=this[combinator](no des);var results=[];for(var i=0,node;node=nodes[i];i++) if(Element.hasAttribute(node,attr))results.push(node);return results;},attr:func tion(nodes,root,attr,value,operator,combinator){if(!nodes)nodes=root.getElements ByTagName("*");if(nodes&&combinator)nodes=this[combinator](nodes);var handler=Se lector.operators[operator],results=[];for(var i=0,node;node=nodes[i];i++){var no deValue=Element.readAttribute(node,attr);if(nodeValue===null)continue;if(handler (nodeValue,value))results.push(node);} return results;},pseudo:function(nodes,name,value,root,combinator){if(nodes&&com binator)nodes=this[combinator](nodes);if(!nodes)nodes=root.getElementsByTagName( "*");return Selector.pseudos[name](nodes,value,root);}},pseudos:{'first-child':f unction(nodes,value,root){for(var i=0,results=[],node;node=nodes[i];i++){if(Sele ctor.handlers.previousElementSibling(node))continue;results.push(node);} return results;},'last-child':function(nodes,value,root){for(var i=0,results=[], node;node=nodes[i];i++){if(Selector.handlers.nextElementSibling(node))continue;r

esults.push(node);} return results;},'only-child':function(nodes,value,root){var h=Selector.handlers ;for(var i=0,results=[],node;node=nodes[i];i++) if(!h.previousElementSibling(node)&&!h.nextElementSibling(node)) results.push(node);return results;},'nth-child':function(nodes,formula,root){ret urn Selector.pseudos.nth(nodes,formula,root);},'nth-last-child':function(nodes,f ormula,root){return Selector.pseudos.nth(nodes,formula,root,true);},'nth-of-type ':function(nodes,formula,root){return Selector.pseudos.nth(nodes,formula,root,fa lse,true);},'nth-last-of-type':function(nodes,formula,root){return Selector.pseu dos.nth(nodes,formula,root,true,true);},'first-of-type':function(nodes,formula,r oot){return Selector.pseudos.nth(nodes,"1",root,false,true);},'last-of-type':fun ction(nodes,formula,root){return Selector.pseudos.nth(nodes,"1",root,true,true); },'only-of-type':function(nodes,formula,root){var p=Selector.pseudos;return p['l ast-of-type'](p['first-of-type'](nodes,formula,root),formula,root);},getIndices: function(a,b,total){if(a==0)return b>0?[b]:[];return $R(1,total).inject([],funct ion(memo,i){if(0==(i-b)%a&&(i-b)/a>=0)memo.push(i);return memo;});},nth:function (nodes,formula,root,reverse,ofType){if(nodes.length==0)return[];if(formula=='eve n')formula='2n+0';if(formula=='odd')formula='2n+1';var h=Selector.handlers,resul ts=[],indexed=[],m;h.mark(nodes);for(var i=0,node;node=nodes[i];i++){if(!node.pa rentNode._countedByPrototype){h.index(node.parentNode,reverse,ofType);indexed.pu sh(node.parentNode);}} if(formula.match(/^\d+$/)){formula=Number(formula);for(var i=0,node;node=nodes[i ];i++) if(node.nodeIndex==formula)results.push(node);}else if(m=formula.match(/^(-?\d*) ?n(([+-])(\d+))?/)){if(m[1]=="-")m[1]=-1;var a=m[1]?Number(m[1]):1;var b=m[2]?Nu mber(m[2]):0;var indices=Selector.pseudos.getIndices(a,b,nodes.length);for(var i =0,node,l=indices.length;node=nodes[i];i++){for(var j=0;j<l;j++) if(node.nodeIndex==indices[j])results.push(node);}} h.unmark(nodes);h.unmark(indexed);return results;},'empty':function(nodes,value, root){for(var i=0,results=[],node;node=nodes[i];i++){if(node.tagName=='!' node. firstChild)continue;results.push(node);} return results;},'not':function(nodes,selector,root){var h=Selector.handlers,sel ectorType,m;var exclusions=new Selector(selector).findElements(root);h.mark(excl usions);for(var i=0,results=[],node;node=nodes[i];i++) if(!node._countedByPrototype)results.push(node);h.unmark(exclusions);return resu lts;},'enabled':function(nodes,value,root){for(var i=0,results=[],node;node=node s[i];i++) if(!node.disabled&&(!node.type node.type!=='hidden')) results.push(node);return results;},'disabled':function(nodes,value,root){for(va r i=0,results=[],node;node=nodes[i];i++) if(node.disabled)results.push(node);return results;},'checked':function(nodes,va lue,root){for(var i=0,results=[],node;node=nodes[i];i++) if(node.checked)results.push(node);return results;}},operators:{'=':function(nv, v){return nv==v;},'!=':function(nv,v){return nv!=v;},'^=':function(nv,v){return nv==v nv&&nv.startsWith(v);},'$=':function(nv,v){return nv==v nv&&nv.endsWith( v);},'*=':function(nv,v){return nv==v nv&&nv.include(v);},'~=':function(nv,v){r eturn(' '+nv+' ').include(' '+v+' ');},' =':function(nv,v){return('-'+(nv "").t oUpperCase()+'-').include('-'+(v "").toUpperCase()+'-');}},split:function(expre ssion){var expressions=[];expression.scan(/(([\w#:.~>+()\s-]+ \* \[.*?\])+)\s*(, $)/,function(m){expressions.push(m[1].strip());});return expressions;},matchEle ments:function(elements,expression){var matches=$$(expression),h=Selector.handle rs;h.mark(matches);for(var i=0,results=[],element;element=elements[i];i++) if(element._countedByPrototype)results.push(element);h.unmark(matches);return re sults;},findElement:function(elements,expression,index){if(Object.isNumber(expre ssion)){index=expression;expression=false;} return Selector.matchElements(elements,expression '*')[index 0];},findChildEle ments:function(element,expressions){expressions=Selector.split(expressions.join( ','));var results=[],h=Selector.handlers;for(var i=0,l=expressions.length,select or;i<l;i++){selector=new Selector(expressions[i].strip());h.concat(results,selec tor.findElements(element));}

return(l>1)?h.unique(results):results;}});if(Prototype.Browser.IE){Object.extend (Selector.handlers,{concat:function(a,b){for(var i=0,node;node=b[i];i++) if(node.tagName!=="!")a.push(node);return a;}});} function $$(){return Selector.findChildElements(document,$A(arguments));} var Form={reset:function(form){form=$(form);form.reset();return form;},serialize Elements:function(elements,options){if(typeof options!='object')options={hash:!! options};else if(Object.isUndefined(options.hash))options.hash=true;var key,valu e,submitted=false,submit=options.submit;var data=elements.inject({},function(res ult,element){if(!element.disabled&&element.name){key=element.name;value=$(elemen t).getValue();if(value!=null&&element.type!='file'&&(element.type!='submit' (!s ubmitted&&submit!==false&&(!submit key==submit)&&(submitted=true)))){if(key in result){if(!Object.isArray(result[key]))result[key]=[result[key]];result[key].pu sh(value);} else result[key]=value;}} return result;});return options.hash?data:Object.toQueryString(data);}};Form.Met hods={serialize:function(form,options){return Form.serializeElements(Form.getEle ments(form),options);},getElements:function(form){var elements=$(form).getElemen tsByTagName('*'),element,arr=[],serializers=Form.Element.Serializers;for(var i=0 ;element=elements[i];i++){arr.push(element);} return arr.inject([],function(elements,child){if(serializers[child.tagName.toLow erCase()]) elements.push(Element.extend(child));return elements;})},getInputs:function(form ,typeName,name){form=$(form);var inputs=form.getElementsByTagName('input');if(!t ypeName&&!name)return $A(inputs).map(Element.extend);for(var i=0,matchingInputs= [],length=inputs.length;i<length;i++){var input=inputs[i];if((typeName&&input.ty pe!=typeName) (name&&input.name!=name)) continue;matchingInputs.push(Element.extend(input));} return matchingInputs;},disable:function(form){form=$(form);Form.getElements(for m).invoke('disable');return form;},enable:function(form){form=$(form);Form.getEl ements(form).invoke('enable');return form;},findFirstElement:function(form){var elements=$(form).getElements().findAll(function(element){return'hidden'!=element .type&&!element.disabled;});var firstByIndex=elements.findAll(function(element){ return element.hasAttribute('tabIndex')&&element.tabIndex>=0;}).sortBy(function( element){return element.tabIndex}).first();return firstByIndex?firstByIndex:elem ents.find(function(element){return/^(?:input select textarea)$/i.test(element.ta gName);});},focusFirstElement:function(form){form=$(form);form.findFirstElement( ).activate();return form;},request:function(form,options){form=$(form),options=O bject.clone(options {});var params=options.parameters,action=form.readAttribute ('action') '';if(action.blank())action=window.location.href;options.parameters= form.serialize(true);if(params){if(Object.isString(params))params=params.toQuery Params();Object.extend(options.parameters,params);} if(form.hasAttribute('method')&&!options.method) options.method=form.method;return new Ajax.Request(action,options);}};Form.Eleme nt={focus:function(element){$(element).focus();return element;},select:function( element){$(element).select();return element;}};Form.Element.Methods={serialize:f unction(element){element=$(element);if(!element.disabled&&element.name){var valu e=element.getValue();if(value!=undefined){var pair={};pair[element.name]=value;r eturn Object.toQueryString(pair);}} return'';},getValue:function(element){element=$(element);var method=element.tagN ame.toLowerCase();return Form.Element.Serializers[method](element);},setValue:fu nction(element,value){element=$(element);var method=element.tagName.toLowerCase( );Form.Element.Serializers[method](element,value);return element;},clear:functio n(element){$(element).value='';return element;},present:function(element){return $(element).value!='';},activate:function(element){element=$(element);try{elemen t.focus();if(element.select&&(element.tagName.toLowerCase()!='input' !(/^(?:but ton reset submit)$/i.test(element.type)))) element.select();}catch(e){} return element;},disable:function(element){element=$(element);element.disabled=t rue;return element;},enable:function(element){element=$(element);element.disable d=false;return element;}};var Field=Form.Element;var $F=Form.Element.Methods.get

Value;Form.Element.Serializers={input:function(element,value){switch(element.typ e.toLowerCase()){case'checkbox':case'radio':return Form.Element.Serializers.inpu tSelector(element,value);default:return Form.Element.Serializers.textarea(elemen t,value);}},inputSelector:function(element,value){if(Object.isUndefined(value))r eturn element.checked?element.value:null;else element.checked=!!value;},textarea :function(element,value){if(Object.isUndefined(value))return element.value;else element.value=value;},select:function(element,value){if(Object.isUndefined(value )) return this[element.type=='select-one'?'selectOne':'selectMany'](element);else{v ar opt,currentValue,single=!Object.isArray(value);for(var i=0,length=element.len gth;i<length;i++){opt=element.options[i];currentValue=this.optionValue(opt);if(s ingle){if(currentValue==value){opt.selected=true;return;}} else opt.selected=value.include(currentValue);}}},selectOne:function(element){va r index=element.selectedIndex;return index>=0?this.optionValue(element.options[i ndex]):null;},selectMany:function(element){var values,length=element.length;if(! length)return null;for(var i=0,values=[];i<length;i++){var opt=element.options[i ];if(opt.selected)values.push(this.optionValue(opt));} return values;},optionValue:function(opt){return Element.extend(opt).hasAttribut e('value')?opt.value:opt.text;}};Abstract.TimedObserver=Class.create(PeriodicalE xecuter,{initialize:function($super,element,frequency,callback){$super(callback, frequency);this.element=$(element);this.lastValue=this.getValue();},execute:func tion(){var value=this.getValue();if(Object.isString(this.lastValue)&&Object.isSt ring(value)?this.lastValue!=value:String(this.lastValue)!=String(value)){this.ca llback(this.element,value);this.lastValue=value;}}});Form.Element.Observer=Class .create(Abstract.TimedObserver,{getValue:function(){return Form.Element.getValue (this.element);}});Form.Observer=Class.create(Abstract.TimedObserver,{getValue:f unction(){return Form.serialize(this.element);}});Abstract.EventObserver=Class.c reate({initialize:function(element,callback){this.element=$(element);this.callba ck=callback;this.lastValue=this.getValue();if(this.element.tagName.toLowerCase() =='form') this.registerFormCallbacks();else this.registerCallback(this.element);},onElementEvent:function(){var value=this.g etValue();if(this.lastValue!=value){this.callback(this.element,value);this.lastV alue=value;}},registerFormCallbacks:function(){Form.getElements(this.element).ea ch(this.registerCallback,this);},registerCallback:function(element){if(element.t ype){switch(element.type.toLowerCase()){case'checkbox':case'radio':Event.observe (element,'click',this.onElementEvent.bind(this));break;default:Event.observe(ele ment,'change',this.onElementEvent.bind(this));break;}}}});Form.Element.EventObse rver=Class.create(Abstract.EventObserver,{getValue:function(){return Form.Elemen t.getValue(this.element);}});Form.EventObserver=Class.create(Abstract.EventObser ver,{getValue:function(){return Form.serialize(this.element);}});(function(){var Event={KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38 ,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,KEY_HOME:36,KEY_END:35,KEY_PAGEUP:33,KEY _PAGEDOWN:34,KEY_INSERT:45,cache:{}};var docEl=document.documentElement;var MOUS EENTER_MOUSELEAVE_EVENTS_SUPPORTED='onmouseenter'in docEl&&'onmouseleave'in docE l;var _isButton;if(Prototype.Browser.IE){var buttonMap={0:1,1:4,2:2};_isButton=f unction(event,code){return event.button===buttonMap[code];};}else if(Prototype.B rowser.WebKit){_isButton=function(event,code){switch(code){case 0:return event.w hich==1&&!event.metaKey;case 1:return event.which==1&&event.metaKey;default:retu rn false;}};}else{_isButton=function(event,code){return event.which?(event.which ===code+1):(event.button===code);};} function isLeftClick(event){return _isButton(event,0)} function isMiddleClick(event){return _isButton(event,1)} function isRightClick(event){return _isButton(event,2)} function element(event){event=Event.extend(event);var node=event.target,type=eve nt.type,currentTarget=event.currentTarget;if(currentTarget&&currentTarget.tagNam e){if(type==='load' type==='error' (type==='click'&&currentTarget.tagName.toLo werCase()==='input'&&currentTarget.type==='radio')) node=currentTarget;} if(node.nodeType==Node.TEXT_NODE)

node=node.parentNode;return Element.extend(node);} function findElement(event,expression){var element=Event.element(event);if(!expr ession)return element;if(element.ancestors){var elements=[element].concat(elemen t.ancestors());return Selector.findElement(elements,expression,0);}else{return n ull;}} function pointer(event){return{x:pointerX(event),y:pointerY(event)};} function pointerX(event){var docElement=document.documentElement,body=document.b ody {scrollLeft:0};return event.pageX (event.clientX+ (docElement.scrollLeft body.scrollLeft)(docElement.clientLeft 0));} function pointerY(event){var docElement=document.documentElement,body=document.b ody {scrollTop:0};return event.pageY (event.clientY+ (docElement.scrollTop body.scrollTop)(docElement.clientTop 0));} function stop(event){Event.extend(event);event.preventDefault();event.stopPropag ation();event.stopped=true;} Event.Methods={isLeftClick:isLeftClick,isMiddleClick:isMiddleClick,isRightClick: isRightClick,element:element,findElement:findElement,pointer:pointer,pointerX:po interX,pointerY:pointerY,stop:stop};var methods=Object.keys(Event.Methods).injec t({},function(m,name){m[name]=Event.Methods[name].methodize();return m;});if(Pro totype.Browser.IE){function _relatedTarget(event){var element;switch(event.type) {case'mouseover':element=event.fromElement;break;case'mouseout':element=event.to Element;break;default:return null;} return Element.extend(element);} Object.extend(methods,{stopPropagation:function(){this.cancelBubble=true},preven tDefault:function(){this.returnValue=false},inspect:function(){return'[object Ev ent]'}});Event.extend=function(event,element){if(!event)return false;if(event._e xtendedByPrototype)return event;event._extendedByPrototype=Prototype.emptyFuncti on;var pointer=Event.pointer(event);Object.extend(event,{target:event.srcElement element,relatedTarget:_relatedTarget(event),pageX:pointer.x,pageY:pointer.y}); return Object.extend(event,methods);};}else{Event.prototype=window.Event.prototy pe document.createEvent('HTMLEvents').__proto__;Object.extend(Event.prototype,m ethods);Event.extend=Prototype.K;} function _createResponder(element,eventName,handler){var registry=Element.retrie ve(element,'prototype_event_registry');if(Object.isUndefined(registry)){CACHE.pu sh(element);registry=Element.retrieve(element,'prototype_event_registry',$H());} var respondersForEvent=registry.get(eventName);if(Object.isUndefined(respondersF orEvent)){respondersForEvent=[];registry.set(eventName,respondersForEvent);} if(respondersForEvent.pluck('handler').include(handler))return false;var respond er;if(eventName.include(":")){responder=function(event){if(Object.isUndefined(ev ent.eventName)) return false;if(event.eventName!==eventName) return false;Event.extend(event,element);handler.call(element,event);};}else{if( !MOUSEENTER_MOUSELEAVE_EVENTS_SUPPORTED&&(eventName==="mouseenter" eventName=== "mouseleave")){if(eventName==="mouseenter" eventName==="mouseleave"){responder= function(event){Event.extend(event,element);var parent=event.relatedTarget;while (parent&&parent!==element){try{parent=parent.parentNode;} catch(e){parent=element;}} if(parent===element)return;handler.call(element,event);};}}else{responder=functi on(event){Event.extend(event,element);handler.call(element,event);};}} responder.handler=handler;respondersForEvent.push(responder);return responder;} function _destroyCache(){for(var i=0,length=CACHE.length;i<length;i++){Event.sto pObserving(CACHE[i]);CACHE[i]=null;}} var CACHE=[];if(Prototype.Browser.IE) window.attachEvent('onunload',_destroyCache);if(Prototype.Browser.WebKit) window.addEventListener('unload',Prototype.emptyFunction,false);var _getDOMEvent Name=Prototype.K;if(!MOUSEENTER_MOUSELEAVE_EVENTS_SUPPORTED){_getDOMEventName=fu nction(eventName){var translations={mouseenter:"mouseover",mouseleave:"mouseout" };return eventName in translations?translations[eventName]:eventName;};} function observe(element,eventName,handler){element=$(element);var responder=_cr

eateResponder(element,eventName,handler);if(!responder)return element;if(eventNa me.include(':')){if(element.addEventListener) element.addEventListener("dataavailable",responder,false);else{element.attachEve nt("ondataavailable",responder);element.attachEvent("onfilterchange",responder); }}else{var actualEventName=_getDOMEventName(eventName);if(element.addEventListen er) element.addEventListener(actualEventName,responder,false);else element.attachEvent("on"+actualEventName,responder);} return element;} function stopObserving(element,eventName,handler){element=$(element);var registr y=Element.retrieve(element,'prototype_event_registry');if(Object.isUndefined(reg istry))return element;if(eventName&&!handler){var responders=registry.get(eventN ame);if(Object.isUndefined(responders))return element;responders.each(function(r ){Element.stopObserving(element,eventName,r.handler);});return element;}else if( !eventName){registry.each(function(pair){var eventName=pair.key,responders=pair. value;responders.each(function(r){Element.stopObserving(element,eventName,r.hand ler);});});return element;} var responders=registry.get(eventName);if(!responders)return;var responder=respo nders.find(function(r){return r.handler===handler;});if(!responder)return elemen t;var actualEventName=_getDOMEventName(eventName);if(eventName.include(':')){if( element.removeEventListener) element.removeEventListener("dataavailable",responder,false);else{element.detach Event("ondataavailable",responder);element.detachEvent("onfilterchange",responde r);}}else{if(element.removeEventListener) element.removeEventListener(actualEventName,responder,false);else element.detachEvent('on'+actualEventName,responder);} registry.set(eventName,responders.without(responder));return element;} function fire(element,eventName,memo,bubble){element=$(element);if(Object.isUnde fined(bubble)) bubble=true;if(element==document&&document.createEvent&&!element.dispatchEvent) element=document.documentElement;var event;if(document.createEvent){event=docume nt.createEvent('HTMLEvents');event.initEvent('dataavailable',true,true);}else{ev ent=document.createEventObject();event.eventType=bubble?'ondataavailable':'onfil terchange';} event.eventName=eventName;event.memo=memo {};if(document.createEvent) element.dispatchEvent(event);else element.fireEvent(event.eventType,event);return Event.extend(event);} Object.extend(Event,Event.Methods);Object.extend(Event,{fire:fire,observe:observ e,stopObserving:stopObserving});Element.addMethods({fire:fire,observe:observe,st opObserving:stopObserving});Object.extend(document,{fire:fire.methodize(),observ e:observe.methodize(),stopObserving:stopObserving.methodize(),loaded:false});if( window.Event)Object.extend(window.Event,Event);else window.Event=Event;})();(fun ction(){var timer;function fireContentLoadedEvent(){if(document.loaded)return;if (timer)window.clearTimeout(timer);document.loaded=true;document.fire('dom:loaded ');} function checkReadyState(){if(document.readyState==='complete'){document.stopObs erving('readystatechange',checkReadyState);fireContentLoadedEvent();}} function pollDoScroll(){try{document.documentElement.doScroll('left');} catch(e){timer=pollDoScroll.defer();return;} fireContentLoadedEvent();} if(document.addEventListener){document.addEventListener('DOMContentLoaded',fireC ontentLoadedEvent,false);}else{document.observe('readystatechange',checkReadySta te);if(window==top) timer=pollDoScroll.defer();} Event.observe(window,'load',fireContentLoadedEvent);})();Element.addMethods();Ha sh.toQueryString=Object.toQueryString;var Toggle={display:Element.toggle};Elemen t.Methods.childOf=Element.Methods.descendantOf;var Insertion={Before:function(el ement,content){return Element.insert(element,{before:content});},Top:function(el ement,content){return Element.insert(element,{top:content});},Bottom:function(el ement,content){return Element.insert(element,{bottom:content});},After:function(

element,content){return Element.insert(element,{after:content});}};var $continue =new Error('"throw $continue" is deprecated, use "return" instead');var Position ={includeScrollOffsets:false,prepare:function(){this.deltaX=window.pageXOffset document.documentElement.scrollLeft document.body.scrollLeft 0;this.deltaY=win dow.pageYOffset document.documentElement.scrollTop document.body.scrollTop 0; },within:function(element,x,y){if(this.includeScrollOffsets) return this.withinIncludingScrolloffsets(element,x,y);this.xcomp=x;this.ycomp=y; this.offset=Element.cumulativeOffset(element);return(y>=this.offset[1]&&y<this.o ffset[1]+element.offsetHeight&&x>=this.offset[0]&&x<this.offset[0]+element.offse tWidth);},withinIncludingScrolloffsets:function(element,x,y){var offsetcache=Ele ment.cumulativeScrollOffset(element);this.xcomp=x+offsetcache[0]-this.deltaX;thi s.ycomp=y+offsetcache[1]-this.deltaY;this.offset=Element.cumulativeOffset(elemen t);return(this.ycomp>=this.offset[1]&&this.ycomp<this.offset[1]+element.offsetHe ight&&this.xcomp>=this.offset[0]&&this.xcomp<this.offset[0]+element.offsetWidth) ;},overlap:function(mode,element){if(!mode)return 0;if(mode=='vertical') return((this.offset[1]+element.offsetHeight)-this.ycomp)/element.offsetHeight;if (mode=='horizontal') return((this.offset[0]+element.offsetWidth)-this.xcomp)/element.offsetWidth;},cu mulativeOffset:Element.Methods.cumulativeOffset,positionedOffset:Element.Methods .positionedOffset,absolutize:function(element){Position.prepare();return Element .absolutize(element);},relativize:function(element){Position.prepare();return El ement.relativize(element);},realOffset:Element.Methods.cumulativeScrollOffset,of fsetParent:Element.Methods.getOffsetParent,page:Element.Methods.viewportOffset,c lone:function(source,target,options){options=options {};return Element.clonePos ition(target,source,options);}};if(!document.getElementsByClassName)document.get ElementsByClassName=function(instanceMethods){function iter(name){return name.bl ank()?null:"[contains(concat(' ', @class, ' '), ' "+name+" ')]";} instanceMethods.getElementsByClassName=Prototype.BrowserFeatures.XPath?function( element,className){className=className.toString().strip();var cond=/\s/.test(cla ssName)?$w(className).map(iter).join(''):iter(className);return cond?document._g etElementsByXPath('.//*'+cond,element):[];}:function(element,className){classNam e=className.toString().strip();var elements=[],classNames=(/\s/.test(className)? $w(className):null);if(!classNames&&!className)return elements;var nodes=$(eleme nt).getElementsByTagName('*');className=' '+className+' ';for(var i=0,child,cn;c hild=nodes[i];i++){if(child.className&&(cn=' '+child.className+' ')&&(cn.include (className) (classNames&&classNames.all(function(name){return!name.toString().b lank()&&cn.include(' '+name+' ');})))) elements.push(Element.extend(child));} return elements;};return function(className,parentElement){return $(parentElemen t document.body).getElementsByClassName(className);};}(Element.Methods);Element .ClassNames=Class.create();Element.ClassNames.prototype={initialize:function(ele ment){this.element=$(element);},_each:function(iterator){this.element.className. split(/\s+/).select(function(name){return name.length>0;})._each(iterator);},set :function(className){this.element.className=className;},add:function(classNameTo Add){if(this.include(classNameToAdd))return;this.set($A(this).concat(classNameTo Add).join(' '));},remove:function(classNameToRemove){if(!this.include(classNameT oRemove))return;this.set($A(this).without(classNameToRemove).join(' '));},toStri ng:function(){return $A(this).join(' ');}};Object.extend(Element.ClassNames.prot otype,Enumerable); /* public/javascripts/effects.js @ 1319142822 */ var Scriptaculous={Version:'1.8.3'} String.prototype.parseColor=function(){var color='#';if(this.slice(0,4)=='rgb(') {var cols=this.slice(4,this.length-1).split(',');var i=0;do{color+=parseInt(cols [i]).toColorPart()}while(++i<3);}else{if(this.slice(0,1)=='#'){if(this.length==4 )for(var i=1;i<4;i++)color+=(this.charAt(i)+this.charAt(i)).toLowerCase();if(thi s.length==7)color=this.toLowerCase();}} return(color.length==7?color:(arguments[0] this));};Element.collectTextNodes=fu

nction(element){return $A($(element).childNodes).collect(function(node){return(n ode.nodeType==3?node.nodeValue:(node.hasChildNodes()?Element.collectTextNodes(no de):''));}).flatten().join('');};Element.collectTextNodesIgnoreClass=function(el ement,className){return $A($(element).childNodes).collect(function(node){return( node.nodeType==3?node.nodeValue:((node.hasChildNodes()&&!Element.hasClassName(no de,className))?Element.collectTextNodesIgnoreClass(node,className):''));}).flatt en().join('');};Element.setContentZoom=function(element,percent){element=$(eleme nt);element.setStyle({fontSize:(percent/100)+'em'});if(Prototype.Browser.WebKit) window.scrollBy(0,0);return element;};Element.getInlineOpacity=function(element) {return $(element).style.opacity '';};Element.forceRerendering=function(element ){try{element=$(element);var n=document.createTextNode(' ');element.appendChild( n);element.removeChild(n);}catch(e){}};var Effect={_elementDoesNotExistError:{na me:'ElementDoesNotExistError',message:'The specified DOM element does not exist, but is required for this effect to operate'},Transitions:{linear:Prototype.K,si noidal:function(pos){return(-Math.cos(pos*Math.PI)/2)+.5;},reverse:function(pos) {return 1-pos;},flicker:function(pos){var pos=((-Math.cos(pos*Math.PI)/4)+.75)+M ath.random()/4;return pos>1?1:pos;},wobble:function(pos){return(-Math.cos(pos*Ma th.PI*(9*pos))/2)+.5;},pulse:function(pos,pulses){return(-Math.cos((pos*((pulses 5)-.5)*2)*Math.PI)/2)+.5;},spring:function(pos){return 1-(Math.cos(pos*4.5*Mat h.PI)*Math.exp(-pos*6));},none:function(pos){return 0;},full:function(pos){retur n 1;}},DefaultOptions:{duration:1.0,fps:100,sync:false,from:0.0,to:1.0,delay:0.0 ,queue:'parallel'},tagifyText:function(element){var tagifyStyle='position:relati ve';if(Prototype.Browser.IE)tagifyStyle+=';zoom:1';element=$(element);$A(element .childNodes).each(function(child){if(child.nodeType==3){child.nodeValue.toArray( ).each(function(character){element.insertBefore(new Element('span',{style:tagify Style}).update(character==' '?String.fromCharCode(160):character),child);});Elem ent.remove(child);}});},multiple:function(element,effect){var elements;if(((type of element=='object') Object.isFunction(element))&&(element.length)) elements=element;else elements=$(element).childNodes;var options=Object.extend({speed:0.1,delay:0.0},a rguments[2] {});var masterDelay=options.delay;$A(elements).each(function(elemen t,index){new effect(element,Object.extend(options,{delay:index*options.speed+mas terDelay}));});},PAIRS:{'slide':['SlideDown','SlideUp'],'blind':['BlindDown','Bl indUp'],'appear':['Appear','Fade']},toggle:function(element,effect){element=$(el ement);effect=(effect 'appear').toLowerCase();var options=Object.extend({queue: {position:'end',scope:(element.id 'global'),limit:1}},arguments[2] {});Effect[ element.visible()?Effect.PAIRS[effect][1]:Effect.PAIRS[effect][0]](element,optio ns);}};Effect.DefaultOptions.transition=Effect.Transitions.sinoidal;Effect.Scope dQueue=Class.create(Enumerable,{initialize:function(){this.effects=[];this.inter val=null;},_each:function(iterator){this.effects._each(iterator);},add:function( effect){var timestamp=new Date().getTime();var position=Object.isString(effect.o ptions.queue)?effect.options.queue:effect.options.queue.position;switch(position ){case'front':this.effects.findAll(function(e){return e.state=='idle'}).each(fun ction(e){e.startOn+=effect.finishOn;e.finishOn+=effect.finishOn;});break;case'wi th-last':timestamp=this.effects.pluck('startOn').max() timestamp;break;case'end ':timestamp=this.effects.pluck('finishOn').max() timestamp;break;} effect.startOn+=timestamp;effect.finishOn+=timestamp;if(!effect.options.queue.li mit (this.effects.length<effect.options.queue.limit)) this.effects.push(effect);if(!this.interval) this.interval=setInterval(this.loop.bind(this),15);},remove:function(effect){thi s.effects=this.effects.reject(function(e){return e==effect});if(this.effects.len gth==0){clearInterval(this.interval);this.interval=null;}},loop:function(){var t imePos=new Date().getTime();for(var i=0,len=this.effects.length;i<len;i++) try{this.effects[i]&&this.effects[i].loop(timePos);}catch(e){}}});Effect.Queues= {instances:$H(),get:function(queueName){if(!Object.isString(queueName))return qu eueName;return this.instances.get(queueName) this.instances.set(queueName,new E ffect.ScopedQueue());}};Effect.Queue=Effect.Queues.get('global');Effect.Base=Cla ss.create({position:null,start:function(options){function codeForEvent(options,e ventName){return((options[eventName+'Internal']?'this.options.'+eventName+'Inter nal(this);':'')+

(options[eventName]?'this.options.'+eventName+'(this);':''));} if(options&&options.transition===false)options.transition=Effect.Transitions.lin ear;this.options=Object.extend(Object.extend({},Effect.DefaultOptions),options {});this.currentFrame=0;this.state='idle';this.startOn=this.options.delay*1000;t his.finishOn=this.startOn+(this.options.duration*1000);this.fromToDelta=this.opt ions.to-this.options.from;this.totalTime=this.finishOn-this.startOn;this.totalFr ames=this.options.fps*this.options.duration;this.render=(function(){function dis patch(effect,eventName){if(effect.options[eventName+'Internal']) effect.options[eventName+'Internal'](effect);if(effect.options[eventName]) effect.options[eventName](effect);} return function(pos){if(this.state==="idle"){this.state="running";dispatch(this, 'beforeSetup');if(this.setup)this.setup();dispatch(this,'afterSetup');} if(this.state==="running"){pos=(this.options.transition(pos)*this.fromToDelta)+t his.options.from;this.position=pos;dispatch(this,'beforeUpdate');if(this.update) this.update(pos);dispatch(this,'afterUpdate');}};})();this.event('beforeStart'); if(!this.options.sync) Effect.Queues.get(Object.isString(this.options.queue)?'global':this.options.queu e.scope).add(this);},loop:function(timePos){if(timePos>=this.startOn){if(timePos >=this.finishOn){this.render(1.0);this.cancel();this.event('beforeFinish');if(th is.finish)this.finish();this.event('afterFinish');return;} var pos=(timePos-this.startOn)/this.totalTime,frame=(pos*this.totalFrames).round ();if(frame>this.currentFrame){this.render(pos);this.currentFrame=frame;}}},canc el:function(){if(!this.options.sync) Effect.Queues.get(Object.isString(this.options.queue)?'global':this.options.queu e.scope).remove(this);this.state='finished';},event:function(eventName){if(this. options[eventName+'Internal'])this.options[eventName+'Internal'](this);if(this.o ptions[eventName])this.options[eventName](this);},inspect:function(){var data=$H ();for(property in this) if(!Object.isFunction(this[property]))data.set(property,this[property]);return'# <Effect:'+data.inspect()+',options:'+$H(this.options).inspect()+'>';}});Effect.P arallel=Class.create(Effect.Base,{initialize:function(effects){this.effects=effe cts [];this.start(arguments[1]);},update:function(position){this.effects.invoke ('render',position);},finish:function(position){this.effects.each(function(effec t){effect.render(1.0);effect.cancel();effect.event('beforeFinish');if(effect.fin ish)effect.finish(position);effect.event('afterFinish');});}});Effect.Tween=Clas s.create(Effect.Base,{initialize:function(object,from,to){object=Object.isString (object)?$(object):object;var args=$A(arguments),method=args.last(),options=args .length==5?args[3]:null;this.method=Object.isFunction(method)?method.bind(object ):Object.isFunction(object[method])?object[method].bind(object):function(value){ object[method]=value};this.start(Object.extend({from:from,to:to},options {}));} ,update:function(position){this.method(position);}});Effect.Event=Class.create(E ffect.Base,{initialize:function(){this.start(Object.extend({duration:0},argument s[0] {}));},update:Prototype.emptyFunction});Effect.Opacity=Class.create(Effect .Base,{initialize:function(element){this.element=$(element);if(!this.element)thr ow(Effect._elementDoesNotExistError);if(Prototype.Browser.IE&&(!this.element.cur rentStyle.hasLayout)) this.element.setStyle({zoom:1});var options=Object.extend({from:this.element.get Opacity() 0.0,to:1.0},arguments[1] {});this.start(options);},update:function(p osition){this.element.setOpacity(position);}});Effect.Move=Class.create(Effect.B ase,{initialize:function(element){this.element=$(element);if(!this.element)throw (Effect._elementDoesNotExistError);var options=Object.extend({x:0,y:0,mode:'rela tive'},arguments[1] {});this.start(options);},setup:function(){this.element.mak ePositioned();this.originalLeft=parseFloat(this.element.getStyle('left') '0');t his.originalTop=parseFloat(this.element.getStyle('top') '0');if(this.options.mo de=='absolute'){this.options.x=this.options.x-this.originalLeft;this.options.y=t his.options.y-this.originalTop;}},update:function(position){this.element.setStyl e({left:(this.options.x*position+this.originalLeft).round()+'px',top:(this.optio ns.y*position+this.originalTop).round()+'px'});}});Effect.MoveBy=function(elemen t,toTop,toLeft){return new Effect.Move(element,Object.extend({x:toLeft,y:toTop}, arguments[3] {}));};Effect.Scale=Class.create(Effect.Base,{initialize:function(

element,percent){this.element=$(element);if(!this.element)throw(Effect._elementD oesNotExistError);var options=Object.extend({scaleX:true,scaleY:true,scaleConten t:true,scaleFromCenter:false,scaleMode:'box',scaleFrom:100.0,scaleTo:percent},ar guments[2] {});this.start(options);},setup:function(){this.restoreAfterFinish=t his.options.restoreAfterFinish false;this.elementPositioning=this.element.getSt yle('position');this.originalStyle={};['top','left','width','height','fontSize'] .each(function(k){this.originalStyle[k]=this.element.style[k];}.bind(this));this .originalTop=this.element.offsetTop;this.originalLeft=this.element.offsetLeft;va r fontSize=this.element.getStyle('font-size') '100%';['em','px','%','pt'].each( function(fontSizeType){if(fontSize.indexOf(fontSizeType)>0){this.fontSize=parseF loat(fontSize);this.fontSizeType=fontSizeType;}}.bind(this));this.factor=(this.o ptions.scaleTo-this.options.scaleFrom)/100;this.dims=null;if(this.options.scaleM ode=='box') this.dims=[this.element.offsetHeight,this.element.offsetWidth];if(/^content/.tes t(this.options.scaleMode)) this.dims=[this.element.scrollHeight,this.element.scrollWidth];if(!this.dims) this.dims=[this.options.scaleMode.originalHeight,this.options.scaleMode.original Width];},update:function(position){var currentScale=(this.options.scaleFrom/100. 0)+(this.factor*position);if(this.options.scaleContent&&this.fontSize) this.element.setStyle({fontSize:this.fontSize*currentScale+this.fontSizeType});t his.setDimensions(this.dims[0]*currentScale,this.dims[1]*currentScale);},finish: function(position){if(this.restoreAfterFinish)this.element.setStyle(this.origina lStyle);},setDimensions:function(height,width){var d={};if(this.options.scaleX)d .width=width.round()+'px';if(this.options.scaleY)d.height=height.round()+'px';if (this.options.scaleFromCenter){var topd=(height-this.dims[0])/2;var leftd=(width -this.dims[1])/2;if(this.elementPositioning=='absolute'){if(this.options.scaleY) d.top=this.originalTop-topd+'px';if(this.options.scaleX)d.left=this.originalLeft -leftd+'px';}else{if(this.options.scaleY)d.top=-topd+'px';if(this.options.scaleX )d.left=-leftd+'px';}} this.element.setStyle(d);}});Effect.Highlight=Class.create(Effect.Base,{initiali ze:function(element){this.element=$(element);if(!this.element)throw(Effect._elem entDoesNotExistError);var options=Object.extend({startcolor:'#ffff99'},arguments [1] {});this.start(options);},setup:function(){if(this.element.getStyle('displa y')=='none'){this.cancel();return;} this.oldStyle={};if(!this.options.keepBackgroundImage){this.oldStyle.backgroundI mage=this.element.getStyle('background-image');this.element.setStyle({background Image:'none'});} if(!this.options.endcolor) this.options.endcolor=this.element.getStyle('background-color').parseColor('#fff fff');if(!this.options.restorecolor) this.options.restorecolor=this.element.getStyle('background-color');this._base=$ R(0,2).map(function(i){return parseInt(this.options.startcolor.slice(i*2+1,i*2+3 ),16)}.bind(this));this._delta=$R(0,2).map(function(i){return parseInt(this.opti ons.endcolor.slice(i*2+1,i*2+3),16)-this._base[i]}.bind(this));},update:function (position){this.element.setStyle({backgroundColor:$R(0,2).inject('#',function(m, v,i){return m+((this._base[i]+(this._delta[i]*position)).round().toColorPart()); }.bind(this))});},finish:function(){this.element.setStyle(Object.extend(this.old Style,{backgroundColor:this.options.restorecolor}));}});Effect.ScrollTo=function (element){var options=arguments[1] {},scrollOffsets=document.viewport.getScroll Offsets(),elementOffsets=$(element).cumulativeOffset();if(options.offset)element Offsets[1]+=options.offset;return new Effect.Tween(null,scrollOffsets.top,elemen tOffsets[1],options,function(p){scrollTo(scrollOffsets.left,p.round());});};Effe ct.Fade=function(element){element=$(element);var oldOpacity=element.getInlineOpa city();var options=Object.extend({from:element.getOpacity() 1.0,to:0.0,afterFin ishInternal:function(effect){if(effect.options.to!=0)return;effect.element.hide( ).setStyle({opacity:oldOpacity});}},arguments[1] {});return new Effect.Opacity( element,options);};Effect.Appear=function(element){element=$(element);var option s=Object.extend({from:(element.getStyle('display')=='none'?0.0:element.getOpacit y() 0.0),to:1.0,afterFinishInternal:function(effect){effect.element.forceRerend ering();},beforeSetup:function(effect){effect.element.setOpacity(effect.options.

from).show();}},arguments[1] {});return new Effect.Opacity(element,options);};E ffect.Puff=function(element){element=$(element);var oldStyle={opacity:element.ge tInlineOpacity(),position:element.getStyle('position'),top:element.style.top,lef t:element.style.left,width:element.style.width,height:element.style.height};retu rn new Effect.Parallel([new Effect.Scale(element,200,{sync:true,scaleFromCenter: true,scaleContent:true,restoreAfterFinish:true}),new Effect.Opacity(element,{syn c:true,to:0.0})],Object.extend({duration:1.0,beforeSetupInternal:function(effect ){Position.absolutize(effect.effects[0].element);},afterFinishInternal:function( effect){effect.effects[0].element.hide().setStyle(oldStyle);}},arguments[1] {}) );};Effect.BlindUp=function(element){element=$(element);element.makeClipping();v ar elementDimensions=element.getDimensions();var m=/(.*?)px/.exec(element.getSty le('height'));var height=m[1]?parseInt(m[1]):elementDimensions.height;return new Effect.Scale(element,0,Object.extend({scaleContent:false,scaleX:false,scaleMode :{originalHeight:height,originalWidth:elementDimensions.width},restoreAfterFinis h:true,afterFinishInternal:function(effect){effect.element.hide().undoClipping() ;}},arguments[1] {}));};Effect.BlindDown=function(element){element=$(element);v ar elementDimensions=element.getDimensions();return new Effect.Scale(element,100 ,Object.extend({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalH eight:elementDimensions.height,originalWidth:elementDimensions.width},restoreAft erFinish:true,afterSetup:function(effect){effect.element.makeClipping().setStyle ({height:'0px'}).show();},afterFinishInternal:function(effect){effect.element.un doClipping();}},arguments[1] {}));};Effect.SwitchOff=function(element){element= $(element);var oldOpacity=element.getInlineOpacity();return new Effect.Appear(el ement,Object.extend({duration:0.4,from:0,transition:Effect.Transitions.flicker,a fterFinishInternal:function(effect){new Effect.Scale(effect.element,1,{duration: 0.3,scaleFromCenter:true,scaleX:false,scaleContent:false,restoreAfterFinish:true ,beforeSetup:function(effect){effect.element.makePositioned().makeClipping();},a fterFinishInternal:function(effect){effect.element.hide().undoClipping().undoPos itioned().setStyle({opacity:oldOpacity});}});}},arguments[1] {}));};Effect.Drop Out=function(element){element=$(element);var oldStyle={top:element.getStyle('top '),left:element.getStyle('left'),opacity:element.getInlineOpacity()};return new Effect.Parallel([new Effect.Move(element,{x:0,y:100,sync:true}),new Effect.Opaci ty(element,{sync:true,to:0.0})],Object.extend({duration:0.5,beforeSetup:function (effect){effect.effects[0].element.makePositioned();},afterFinishInternal:functi on(effect){effect.effects[0].element.hide().undoPositioned().setStyle(oldStyle); }},arguments[1] {}));};Effect.Shake=function(element){element=$(element);var op tions=Object.extend({distance:20,duration:0.5},arguments[1] {});var distance=pa rseFloat(options.distance);var split=parseFloat(options.duration)/10.0;var oldSt yle={top:element.getStyle('top'),left:element.getStyle('left')};return new Effec t.Move(element,{x:distance,y:0,duration:split,afterFinishInternal:function(effec t){new Effect.Move(effect.element,{x:-distance*2,y:0,duration:split*2,afterFinis hInternal:function(effect){new Effect.Move(effect.element,{x:distance*2,y:0,dura tion:split*2,afterFinishInternal:function(effect){new Effect.Move(effect.element ,{x:-distance*2,y:0,duration:split*2,afterFinishInternal:function(effect){new Ef fect.Move(effect.element,{x:distance*2,y:0,duration:split*2,afterFinishInternal: function(effect){new Effect.Move(effect.element,{x:-distance,y:0,duration:split, afterFinishInternal:function(effect){effect.element.undoPositioned().setStyle(ol dStyle);}});}});}});}});}});}});};Effect.SlideDown=function(element){element=$(e lement).cleanWhitespace();var oldInnerBottom=element.down().getStyle('bottom');v ar elementDimensions=element.getDimensions();return new Effect.Scale(element,100 ,Object.extend({scaleContent:false,scaleX:false,scaleFrom:window.opera?0:1,scale Mode:{originalHeight:elementDimensions.height,originalWidth:elementDimensions.wi dth},restoreAfterFinish:true,afterSetup:function(effect){effect.element.makePosi tioned();effect.element.down().makePositioned();if(window.opera)effect.element.s etStyle({top:''});effect.element.makeClipping().setStyle({height:'0px'}).show(); },afterUpdateInternal:function(effect){effect.element.down().setStyle({bottom:(e ffect.dims[0]-effect.element.clientHeight)+'px'});},afterFinishInternal:function (effect){effect.element.undoClipping().undoPositioned();effect.element.down().un doPositioned().setStyle({bottom:oldInnerBottom});}},arguments[1] {}));};Effect. SlideUp=function(element){element=$(element).cleanWhitespace();var oldInnerBotto

m=element.down().getStyle('bottom');var elementDimensions=element.getDimensions( );return new Effect.Scale(element,window.opera?0:1,Object.extend({scaleContent:f alse,scaleX:false,scaleMode:'box',scaleFrom:100,scaleMode:{originalHeight:elemen tDimensions.height,originalWidth:elementDimensions.width},restoreAfterFinish:tru e,afterSetup:function(effect){effect.element.makePositioned();effect.element.dow n().makePositioned();if(window.opera)effect.element.setStyle({top:''});effect.el ement.makeClipping().show();},afterUpdateInternal:function(effect){effect.elemen t.down().setStyle({bottom:(effect.dims[0]-effect.element.clientHeight)+'px'});}, afterFinishInternal:function(effect){effect.element.hide().undoClipping().undoPo sitioned();effect.element.down().undoPositioned().setStyle({bottom:oldInnerBotto m});}},arguments[1] {}));};Effect.Squish=function(element){return new Effect.Sc ale(element,window.opera?1:0,{restoreAfterFinish:true,beforeSetup:function(effec t){effect.element.makeClipping();},afterFinishInternal:function(effect){effect.e lement.hide().undoClipping();}});};Effect.Grow=function(element){element=$(eleme nt);var options=Object.extend({direction:'center',moveTransition:Effect.Transiti ons.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effec t.Transitions.full},arguments[1] {});var oldStyle={top:element.style.top,left:e lement.style.left,height:element.style.height,width:element.style.width,opacity: element.getInlineOpacity()};var dims=element.getDimensions();var initialMoveX,in itialMoveY;var moveX,moveY;switch(options.direction){case'top-left':initialMoveX =initialMoveY=moveX=moveY=0;break;case'top-right':initialMoveX=dims.width;initia lMoveY=moveY=0;moveX=-dims.width;break;case'bottom-left':initialMoveX=moveX=0;in itialMoveY=dims.height;moveY=-dims.height;break;case'bottom-right':initialMoveX= dims.width;initialMoveY=dims.height;moveX=-dims.width;moveY=-dims.height;break;c ase'center':initialMoveX=dims.width/2;initialMoveY=dims.height/2;moveX=-dims.wid th/2;moveY=-dims.height/2;break;} return new Effect.Move(element,{x:initialMoveX,y:initialMoveY,duration:0.01,befo reSetup:function(effect){effect.element.hide().makeClipping().makePositioned();} ,afterFinishInternal:function(effect){new Effect.Parallel([new Effect.Opacity(ef fect.element,{sync:true,to:1.0,from:0.0,transition:options.opacityTransition}),n ew Effect.Move(effect.element,{x:moveX,y:moveY,sync:true,transition:options.move Transition}),new Effect.Scale(effect.element,100,{scaleMode:{originalHeight:dims .height,originalWidth:dims.width},sync:true,scaleFrom:window.opera?1:0,transitio n:options.scaleTransition,restoreAfterFinish:true})],Object.extend({beforeSetup: function(effect){effect.effects[0].element.setStyle({height:'0px'}).show();},aft erFinishInternal:function(effect){effect.effects[0].element.undoClipping().undoP ositioned().setStyle(oldStyle);}},options));}});};Effect.Shrink=function(element ){element=$(element);var options=Object.extend({direction:'center',moveTransitio n:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacit yTransition:Effect.Transitions.none},arguments[1] {});var oldStyle={top:element .style.top,left:element.style.left,height:element.style.height,width:element.sty le.width,opacity:element.getInlineOpacity()};var dims=element.getDimensions();va r moveX,moveY;switch(options.direction){case'top-left':moveX=moveY=0;break;case' top-right':moveX=dims.width;moveY=0;break;case'bottom-left':moveX=0;moveY=dims.h eight;break;case'bottom-right':moveX=dims.width;moveY=dims.height;break;case'cen ter':moveX=dims.width/2;moveY=dims.height/2;break;} return new Effect.Parallel([new Effect.Opacity(element,{sync:true,to:0.0,from:1. 0,transition:options.opacityTransition}),new Effect.Scale(element,window.opera?1 :0,{sync:true,transition:options.scaleTransition,restoreAfterFinish:true}),new E ffect.Move(element,{x:moveX,y:moveY,sync:true,transition:options.moveTransition} )],Object.extend({beforeStartInternal:function(effect){effect.effects[0].element .makePositioned().makeClipping();},afterFinishInternal:function(effect){effect.e ffects[0].element.hide().undoClipping().undoPositioned().setStyle(oldStyle);}},o ptions));};Effect.Pulsate=function(element){element=$(element);var options=argum ents[1] {},oldOpacity=element.getInlineOpacity(),transition=options.transition Effect.Transitions.linear,reverser=function(pos){return 1-transition((-Math.cos ((pos*(options.pulses 5)*2)*Math.PI)/2)+.5);};return new Effect.Opacity(element ,Object.extend(Object.extend({duration:2.0,from:0,afterFinishInternal:function(e ffect){effect.element.setStyle({opacity:oldOpacity});}},options),{transition:rev erser}));};Effect.Fold=function(element){element=$(element);var oldStyle={top:el

ement.style.top,left:element.style.left,width:element.style.width,height:element .style.height};element.makeClipping();return new Effect.Scale(element,5,Object.e xtend({scaleContent:false,scaleX:false,afterFinishInternal:function(effect){new Effect.Scale(element,1,{scaleContent:false,scaleY:false,afterFinishInternal:func tion(effect){effect.element.hide().undoClipping().setStyle(oldStyle);}});}},argu ments[1] {}));};Effect.Morph=Class.create(Effect.Base,{initialize:function(elem ent){this.element=$(element);if(!this.element)throw(Effect._elementDoesNotExistE rror);var options=Object.extend({style:{}},arguments[1] {});if(!Object.isString (options.style))this.style=$H(options.style);else{if(options.style.include(':')) this.style=options.style.parseStyle();else{this.element.addClassName(options.sty le);this.style=$H(this.element.getStyles());this.element.removeClassName(options .style);var css=this.element.getStyles();this.style=this.style.reject(function(s tyle){return style.value==css[style.key];});options.afterFinishInternal=function (effect){effect.element.addClassName(effect.options.style);effect.transforms.eac h(function(transform){effect.element.style[transform.style]='';});};}} this.start(options);},setup:function(){function parseColor(color){if(!color ['r gba(0, 0, 0, 0)','transparent'].include(color))color='#ffffff';color=color.parse Color();return $R(0,2).map(function(i){return parseInt(color.slice(i*2+1,i*2+3), 16);});} this.transforms=this.style.map(function(pair){var property=pair[0],value=pair[1] ,unit=null;if(value.parseColor('#zzzzzz')!='#zzzzzz'){value=value.parseColor();u nit='color';}else if(property=='opacity'){value=parseFloat(value);if(Prototype.B rowser.IE&&(!this.element.currentStyle.hasLayout)) this.element.setStyle({zoom:1});}else if(Element.CSS_LENGTH.test(value)){var com ponents=value.match(/^([\+\-]?[0-9\.]+)(.*)$/);value=parseFloat(components[1]);u nit=(components.length==3)?components[2]:null;} var originalValue=this.element.getStyle(property);return{style:property.camelize (),originalValue:unit=='color'?parseColor(originalValue):parseFloat(originalValu e 0),targetValue:unit=='color'?parseColor(value):value,unit:unit};}.bind(this)) .reject(function(transform){return((transform.originalValue==transform.targetVal ue) (transform.unit!='color'&&(isNaN(transform.originalValue) isNaN(transform. targetValue))));});},update:function(position){var style={},transform,i=this.tra nsforms.length;while(i--) style[(transform=this.transforms[i]).style]=transform.unit=='color'?'#'+ (Math.round(transform.originalValue[0]+ (transform.targetValue[0]-transform.originalValue[0])*position)).toColorPart()+ (Math.round(transform.originalValue[1]+ (transform.targetValue[1]-transform.originalValue[1])*position)).toColorPart()+ (Math.round(transform.originalValue[2]+ (transform.targetValue[2]-transform.originalValue[2])*position)).toColorPart():( transform.originalValue+ (transform.targetValue-transform.originalValue)*position).toFixed(3)+ (transform.unit===null?'':transform.unit);this.element.setStyle(style,true);}}); Effect.Transform=Class.create({initialize:function(tracks){this.tracks=[];this.o ptions=arguments[1] {};this.addTracks(tracks);},addTracks:function(tracks){trac ks.each(function(track){track=$H(track);var data=track.values().first();this.tra cks.push($H({ids:track.keys().first(),effect:Effect.Morph,options:{style:data}}) );}.bind(this));return this;},play:function(){return new Effect.Parallel(this.tr acks.map(function(track){var ids=track.get('ids'),effect=track.get('effect'),opt ions=track.get('options');var elements=[$(ids) $$(ids)].flatten();return elemen ts.map(function(e){return new effect(e,Object.extend({sync:true},options))});}). flatten(),this.options);}});Element.CSS_PROPERTIES=$w('backgroundColor backgroun dPosition borderBottomColor borderBottomStyle '+'borderBottomWidth borderLeftCol or borderLeftStyle borderLeftWidth '+'borderRightColor borderRightStyle borderRi ghtWidth borderSpacing '+'borderTopColor borderTopStyle borderTopWidth bottom cl ip color '+'fontSize fontWeight height left letterSpacing lineHeight '+'marginBo ttom marginLeft marginRight marginTop markerOffset maxHeight '+'maxWidth minHeig ht minWidth opacity outlineColor outlineOffset '+'outlineWidth paddingBottom pad dingLeft paddingRight paddingTop '+'right textIndent top width wordSpacing zInde x');Element.CSS_LENGTH=/^(([\+\-]?[0-9\.]+)(em ex px in cm mm pt pc \%)) 0$/;Str

ing.__parseStyleElement=document.createElement('div');String.prototype.parseStyl e=function(){var style,styleRules=$H();if(Prototype.Browser.WebKit) style=new Element('div',{style:this}).style;else{String.__parseStyleElement.inne rHTML='<div style="'+this+'"></div>';style=String.__parseStyleElement.childNodes [0].style;} Element.CSS_PROPERTIES.each(function(property){if(style[property])styleRules.set (property,style[property]);});if(Prototype.Browser.IE&&this.include('opacity')) styleRules.set('opacity',this.match(/opacity:\s*((?:0 1)?(?:\.\d*)?)/)[1]);retur n styleRules;};if(document.defaultView&&document.defaultView.getComputedStyle){E lement.getStyles=function(element){var css=document.defaultView.getComputedStyle ($(element),null);return Element.CSS_PROPERTIES.inject({},function(styles,proper ty){styles[property]=css[property];return styles;});};}else{Element.getStyles=fu nction(element){element=$(element);var css=element.currentStyle,styles;styles=El ement.CSS_PROPERTIES.inject({},function(results,property){results[property]=css[ property];return results;});if(!styles.opacity)styles.opacity=element.getOpacity ();return styles;};} Effect.Methods={morph:function(element,style){element=$(element);new Effect.Morp h(element,Object.extend({style:style},arguments[2] {}));return element;},visual Effect:function(element,effect,options){element=$(element);var s=effect.dasheriz e().camelize(),klass=s.charAt(0).toUpperCase()+s.substring(1);new Effect[klass]( element,options);return element;},highlight:function(element,options){element=$( element);new Effect.Highlight(element,options);return element;}};$w('fade appear grow shrink fold blindUp blindDown slideUp slideDown '+'pulsate shake puff squi sh switchOff dropOut').each(function(effect){Effect.Methods[effect]=function(ele ment,options){element=$(element);Effect[effect.charAt(0).toUpperCase()+effect.su bstring(1)](element,options);return element;};});$w('getInlineOpacity forceReren dering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles').e ach(function(f){Effect.Methods[f]=Element[f];});Element.addMethods(Effect.Method s); /* public/javascripts/slider.js @ 1319142822 */ if(!Control)var Control={};Control.Slider=Class.create({initialize:function(hand le,track,options){var slider=this;if(Object.isArray(handle)){this.handles=handle .collect(function(e){return $(e)});}else{this.handles=[$(handle)];} this.track=$(track);this.options=options {};this.axis=this.options.axis 'horiz ontal';this.increment=this.options.increment 1;this.step=parseInt(this.options. step '1');this.range=this.options.range $R(0,1);this.value=0;this.values=this. handles.map(function(){return 0});this.spans=this.options.spans?this.options.spa ns.map(function(s){return $(s)}):false;this.options.startSpan=$(this.options.sta rtSpan null);this.options.endSpan=$(this.options.endSpan null);this.restricted =this.options.restricted false;this.maximum=this.options.maximum this.range.en d;this.minimum=this.options.minimum this.range.start;this.alignX=parseInt(this. options.alignX '0');this.alignY=parseInt(this.options.alignY '0');this.trackLe ngth=this.maximumOffset()-this.minimumOffset();this.handleLength=this.isVertical ()?(this.handles[0].offsetHeight!=0?this.handles[0].offsetHeight:this.handles[0] .style.height.replace(/px$/,"")):(this.handles[0].offsetWidth!=0?this.handles[0] .offsetWidth:this.handles[0].style.width.replace(/px$/,""));this.active=false;th is.dragging=false;this.disabled=false;if(this.options.disabled)this.setDisabled( );this.allowedValues=this.options.values?this.options.values.sortBy(Prototype.K) :false;if(this.allowedValues){this.minimum=this.allowedValues.min();this.maximum =this.allowedValues.max();} this.eventMouseDown=this.startDrag.bindAsEventListener(this);this.eventMouseUp=t his.endDrag.bindAsEventListener(this);this.eventMouseMove=this.update.bindAsEven tListener(this);this.handles.each(function(h,i){i=slider.handles.length-1-i;slid er.setValue(parseFloat((Object.isArray(slider.options.sliderValue)?slider.option s.sliderValue[i]:slider.options.sliderValue) slider.range.start),i);h.makePosit ioned().observe("mousedown",slider.eventMouseDown);});this.track.observe("moused own",this.eventMouseDown);document.observe("mouseup",this.eventMouseUp);document

.observe("mousemove",this.eventMouseMove);this.initialized=true;},dispose:functi on(){var slider=this;Event.stopObserving(this.track,"mousedown",this.eventMouseD own);Event.stopObserving(document,"mouseup",this.eventMouseUp);Event.stopObservi ng(document,"mousemove",this.eventMouseMove);this.handles.each(function(h){Event .stopObserving(h,"mousedown",slider.eventMouseDown);});},setDisabled:function(){ this.disabled=true;},setEnabled:function(){this.disabled=false;},getNearestValue :function(value){if(this.allowedValues){if(value>=this.allowedValues.max())retur n(this.allowedValues.max());if(value<=this.allowedValues.min())return(this.allow edValues.min());var offset=Math.abs(this.allowedValues[0]-value);var newValue=th is.allowedValues[0];this.allowedValues.each(function(v){var currentOffset=Math.a bs(v-value);if(currentOffset<=offset){newValue=v;offset=currentOffset;}});return newValue;} if(value>this.range.end)return this.range.end;if(value<this.range.start)return t his.range.start;return value;},setValue:function(sliderValue,handleIdx){if(!this .active){this.activeHandleIdx=handleIdx 0;this.activeHandle=this.handles[this.a ctiveHandleIdx];this.updateStyles();} handleIdx=handleIdx this.activeHandleIdx 0;if(this.initialized&&this.restricte d){if((handleIdx>0)&&(sliderValue<this.values[handleIdx-1])) sliderValue=this.values[handleIdx-1];if((handleIdx<(this.handles.length-1))&&(sl iderValue>this.values[handleIdx+1])) sliderValue=this.values[handleIdx+1];} sliderValue=this.getNearestValue(sliderValue);this.values[handleIdx]=sliderValue ;this.value=this.values[0];this.handles[handleIdx].style[this.isVertical()?'top' :'left']=this.translateToPx(sliderValue);this.drawSpans();if(!this.dragging !th is.event)this.updateFinished();},setValueBy:function(delta,handleIdx){this.setVa lue(this.values[handleIdx this.activeHandleIdx 0]+delta,handleIdx this.active HandleIdx 0);},translateToPx:function(value){value=Math.max(this.range.start,Ma th.min(this.range.end,value));return Math.round(((this.trackLength-this.handleLe ngth)/(this.range.end-this.range.start))*(value-this.range.start))+"px";},transl ateToValue:function(offset){return((offset/(this.trackLength-this.handleLength)* (this.range.end-this.range.start))+this.range.start);},getRange:function(range){ var v=this.values.sortBy(Prototype.K);range=range 0;return $R(v[range],v[range+ 1]);},minimumOffset:function(){return(this.isVertical()?this.alignY:this.alignX) ;},maximumOffset:function(){return(this.isVertical()?(this.track.offsetHeight!=0 ?this.track.offsetHeight:this.track.style.height.replace(/px$/,""))-this.alignY: (this.track.offsetWidth!=0?this.track.offsetWidth:this.track.style.width.replace (/px$/,""))-this.alignX);},isVertical:function(){return(this.axis=='vertical');} ,drawSpans:function(){var slider=this;if(this.spans) $R(0,this.spans.length-1).each(function(r){slider.setSpan(slider.spans[r],slider .getRange(r))});if(this.options.startSpan) this.setSpan(this.options.startSpan,$R(0,this.values.length>1?this.getRange(0).m in():this.value));if(this.options.endSpan) this.setSpan(this.options.endSpan,$R(this.values.length>1?this.getRange(this.spa ns.length-1).max():this.value,this.maximum));},setSpan:function(span,range){if(t his.isVertical()){span.style.top=this.translateToPx(range.start);span.style.heig ht=this.translateToPx(range.end-range.start+this.range.start);}else{span.style.l eft=this.translateToPx(range.start);span.style.width=this.translateToPx(range.en d-range.start+this.range.start);}},updateStyles:function(){this.handles.each(fun ction(h){Element.removeClassName(h,'selected')});Element.addClassName(this.activ eHandle,'selected');},startDrag:function(event){if(Event.isLeftClick(event)){if( !this.disabled){this.active=true;var handle=Event.element(event);var pointer=[Ev ent.pointerX(event),Event.pointerY(event)];var track=handle;if(track==this.track ){var offsets=this.track.cumulativeOffset();this.event=event;this.setValue(this. translateToValue((this.isVertical()?pointer[1]-offsets[1]:pointer[0]-offsets[0]) -(this.handleLength/2)));var offsets=this.activeHandle.cumulativeOffset();this.o ffsetX=(pointer[0]-offsets[0]);this.offsetY=(pointer[1]-offsets[1]);}else{while( (this.handles.indexOf(handle)==-1)&&handle.parentNode) handle=handle.parentNode;if(this.handles.indexOf(handle)!=-1){this.activeHandle= handle;this.activeHandleIdx=this.handles.indexOf(this.activeHandle);this.updateS tyles();var offsets=this.activeHandle.cumulativeOffset();this.offsetX=(pointer[0

]-offsets[0]);this.offsetY=(pointer[1]-offsets[1]);}}} Event.stop(event);}},update:function(event){if(this.active){if(!this.dragging)th is.dragging=true;this.draw(event);if(Prototype.Browser.WebKit)window.scrollBy(0, 0);Event.stop(event);}},draw:function(event){var pointer=[Event.pointerX(event), Event.pointerY(event)];var offsets=this.track.cumulativeOffset();pointer[0]-=thi s.offsetX+offsets[0];pointer[1]-=this.offsetY+offsets[1];this.event=event;this.s etValue(this.translateToValue(this.isVertical()?pointer[1]:pointer[0]));if(this. initialized&&this.options.onSlide) this.options.onSlide(this.values.length>1?this.values:this.value,this);},endDrag :function(event){if(this.active&&this.dragging){this.finishDrag(event,true);Even t.stop(event);} this.active=false;this.dragging=false;},finishDrag:function(event,success){this. active=false;this.dragging=false;this.updateFinished();},updateFinished:function (){if(this.initialized&&this.options.onChange) this.options.onChange(this.values.length>1?this.values:this.value,this);this.eve nt=null;}}); /* public/javascripts/swfobject.js @ 1319142822 */ if(typeof deconcept=="undefined")var deconcept=new Object();if(typeof deconcept. util=="undefined")deconcept.util=new Object();if(typeof deconcept.SWFObjectUtil= ="undefined")deconcept.SWFObjectUtil=new Object();deconcept.SWFObject=function(s wf,id,w,h,ver,c,useExpressInstall,quality,xiRedirectUrl,redirectUrl,detectKey){i f(!document.getElementById){return;} this.DETECT_KEY=detectKey?detectKey:'detectflash';this.skipDetect=deconcept.util .getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=ne w Object();this.attributes=new Array();if(swf){this.setAttribute('swf',swf);} if(id){this.setAttribute('id',id);} if(w){this.setAttribute('width',w);} if(h){this.setAttribute('height',h);} if(ver){this.setAttribute('version',new deconcept.PlayerVersion(ver.toString().s plit(".")));} this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(c){this.addParam ('bgcolor',c);} var q=quality?quality:'high';this.addParam('quality',q);this.setAttribute('useEx pressInstall',useExpressInstall);this.setAttribute('doExpressInstall',false);var xir=(xiRedirectUrl)?xiRedirectUrl:window.location;this.setAttribute('xiRedirect Url',xir);this.setAttribute('redirectUrl','');if(redirectUrl){this.setAttribute( 'redirectUrl',redirectUrl);}} deconcept.SWFObject.prototype={setAttribute:function(name,value){this.attributes [name]=value;},getAttribute:function(name){return this.attributes[name];},addPar am:function(name,value){this.params[name]=value;},getParams:function(){return th is.params;},addVariable:function(name,value){this.variables[name]=value;},getVar iable:function(name){return this.variables[name];},getVariables:function(){retur n this.variables;},getVariablePairs:function(){var variablePairs=new Array();var key;var variables=this.getVariables();for(key in variables){variablePairs.push( key+"="+variables[key]);} return variablePairs;},getSWFHTML:function(){var swfNode="";if(navigator.plugins &&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpre ssInstall")){this.addVariable("MMplayerType","PlugIn");} swfNode='<embed type="application/x-shockwave-flash" src="'+this.getAttribute('s wf')+'" width="'+this.getAttribute('width')+'" height="'+this.getAttribute('heig ht')+'"';swfNode+=' id="'+this.getAttribute('id')+'" name="'+this.getAttribute(' id')+'" ';var params=this.getParams();for(var key in params){swfNode+=[key]+'="' +params[key]+'" ';} var pairs=this.getVariablePairs().join("&");if(pairs.length>0){swfNode+='flashva rs="'+pairs+'"';} swfNode+='/>';}else{if(this.getAttribute("doExpressInstall")){this.addVariable(" MMplayerType","ActiveX");}

swfNode='<object id="'+this.getAttribute('id')+'" classid="clsid:D27CDB6E-AE6D-1 1cf-96B8-444553540000" width="'+this.getAttribute('width')+'" height="'+this.get Attribute('height')+'">';swfNode+='<param name="movie" value="'+this.getAttribut e('swf')+'" />';var params=this.getParams();for(var key in params){swfNode+='<pa ram name="'+key+'" value="'+params[key]+'" />';} var pairs=this.getVariablePairs().join("&");if(pairs.length>0){swfNode+='<param name="flashvars" value="'+pairs+'" />';} swfNode+="</object>";} return swfNode;},write:function(elementId){if(this.getAttribute('useExpressInsta ll')){var expressInstallReqVer=new deconcept.PlayerVersion([6,0,65]);if(this.ins talledVer.versionIsValid(expressInstallReqVer)&&!this.installedVer.versionIsVali d(this.getAttribute('version'))){this.setAttribute('doExpressInstall',true);this .addVariable("MMredirectURL",escape(this.getAttribute('xiRedirectUrl')));documen t.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariab le("MMdoctitle",document.title);}} if(this.skipDetect this.getAttribute('doExpressInstall') this.installedVer.ver sionIsValid(this.getAttribute('version'))){var n=(typeof elementId=='string')?do cument.getElementById(elementId):elementId;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute('redirectUrl')!=""){document.location.replace(th is.getAttribute('redirectUrl'));}} return false;}} deconcept.SWFObjectUtil.getPlayerVersion=function(){var PlayerVersion=new deconc ept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){PlayerVersion=new d econcept.PlayerVersion(x.description.replace(/([a-zA-Z] \s)+/,"").replace(/(\s+r \s+b[0-9]+)/,".").split("."));}}else{try{var axo=new ActiveXObject("ShockwaveFl ash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.S hockwaveFlash.6");PlayerVersion=new deconcept.PlayerVersion([6,0,21]);axo.AllowS criptAccess="always";}catch(e){if(PlayerVersion.major==6){return PlayerVersion;} } try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}} if(axo!=null){PlayerVersion=new deconcept.PlayerVersion(axo.GetVariable("$versio n").split(" ")[1].split(","));}} return PlayerVersion;} deconcept.PlayerVersion=function(arrVersion){this.major=arrVersion[0]!=null?pars eInt(arrVersion[0]):0;this.minor=arrVersion[1]!=null?parseInt(arrVersion[1]):0;t his.rev=arrVersion[2]!=null?parseInt(arrVersion[2]):0;} deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.m ajor)return false;if(this.major>fv.major)return true;if(this.minor<fv.minor)retu rn false;if(this.minor>fv.minor)return true;if(this.rev<fv.rev)return false;retu rn true;} deconcept.util={getRequestParameter:function(param){var q=document.location.sear ch document.location.hash;if(q){var pairs=q.substring(1).split("&");for(var i=0 ;i<pairs.length;i++){if(pairs[i].substring(0,pairs[i].indexOf("="))==param){retu rn pairs[i].substring((pairs[i].indexOf("=")+1));}}} return"";}} deconcept.SWFObjectUtil.cleanupSWFs=function(){if(window.opera !document.all)re turn;var objects=document.getElementsByTagName("OBJECT");for(var i=0;i<objects.l ength;i++){objects[i].style.display='none';for(var x in objects[i]){if(typeof ob jects[i][x]=='function'){objects[i][x]=function(){};}}}} deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){} ;__flash_savedUnloadHandler=function(){};if(typeof window.onunload=='function'){ var oldUnload=window.onunload;window.onunload=function(){deconcept.SWFObjectUtil .cleanupSWFs();oldUnload();}}else{window.onunload=deconcept.SWFObjectUtil.cleanu pSWFs;}} if(typeof window.onbeforeunload=='function'){var oldBeforeUnload=window.onbefore unload;window.onbeforeunload=function(){deconcept.SWFObjectUtil.prepUnload();old BeforeUnload();}}else{window.onbeforeunload=deconcept.SWFObjectUtil.prepUnload;} if(Array.prototype.push==null){Array.prototype.push=function(item){this[this.len gth]=item;return this.length;}}

var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconc ept.SWFObject;var SWFObject=deconcept.SWFObject; /* public/javascripts/util.js @ 1319142822 */ if(!window.Scribd)var Scribd={};if(false){Ajax.Responders.register({onException: function(request,exception){(function(){throw exception;}).defer();}});} Scribd.Remote=(function(){function getElement(e,type){if(e.tagName&&e.tagName==t ype){var el=$(e);}else{e.stop();var el=e.findElement(type);} return el;} function formSendSuccess(req){var reply=req.responseJSON;if(reply&&reply.errors& &this.use_alert){var form=$(document[reply.form_name]);reply.errors.each(functio n(er){var input=form.down("input[name='"+er.input_name+"']");if(input){var error _node=input.next('.alert');if(!error_node){error_node=new Element('div',{'class' :'alert'});input.insert({after:error_node});} error_node.update(er.msg);}});}} var pub={Form:function(e,opts){var options=Object.extend({use_alert:true},opts); var form=getElement(e,'FORM');options.form_name=form.readAttribute('name');if(op tions.use_alert) form.select('.alert').invoke('update');form.request(Object.extend({evalScripts:t rue,parameters:'form_name='+encodeURIComponent(form.readAttribute('name')),onSuc cess:formSendSuccess.bind(options),onFailure:function(){Scribd.Alerts.error('fla shes_placeholder',"Request failed! Please try again later.",{auto_fade:true});$( 'flashes_placeholder').scrollTo();}.bind(options),onComplete:function(){var form =$$("form[name='"+this.form_name+"']").first();form.enable();form.down(".spinner ").hide();}.bind(options)},options));form.disable();var spinner=form.down('.spin ner');if(spinner) spinner.show();form=null;},Link:function(e,opts){var options=opts {};var link=g etElement(e,'A');var url=link.readAttribute('href');new Ajax.Request(url,Object. extend({method:'GET',evalScripts:true},options));link=null;}};return pub;})();Sc ribd.dynamicIncluder=(function(){function dispatchCallbacks(status){s.complete(s tatus,loaded,errors);s[status](status=='error'?errors:loaded);clearTimeout(tTime out);clearTimeout(cssTimeout);};function checkProgress(){if(loaded.length==files .length)Scribd.dynamicIncluder.dispatchCallbacks('success');else if(loaded.lengt h+errors.length==files.length)Scribd.dynamicIncluder.dispatchCallbacks('error'); };function addError(){errors.push(this.src);Scribd.dynamicIncluder.checkProgress ();};var pub={include:function(src,callback,name){var script=$$('script[src*="'+ src+'"]');if(script.length>0){var thisScript=script[0];thisScript.readAttribute( 'pending')?thisScript.observe('dynamicloader:scriptload',callback):callback();re turn;};var s=new Element('script',{"type":"text/javascript","src":src,"id":name, "pending":1});if(Prototype.Browser.Gecko){s.onerror=this.addError;} s.observe('dynamicloader:scriptload',function(){$(this).writeAttribute('pending' ,null);callback();setTimeout(function(){s.stopObserving('dynamicloader:scriptloa d');},10);});var done=false;s.onload=s.onreadystatechange=function(){if(!done&&( !this.readyState /loaded complete/.test(this.readyState))){done=true;s.onload=s .onreadystatechange=null;s.fire('dynamicloader:scriptload');};};document.getElem entsByTagName("head")[0].appendChild(s);}};return pub;})();Scribd.jsonp=function (options){if(Object.isFunction(options.callback)){var callbackName='jsonp'+Math. floor(Math.random()*1000001);window[callbackName]=function(jsonData){options.cal lback(jsonData);window[callbackName]=undefined;};}else{var callbackName=options. callback;} var url=options.url;if(options.params){var params=options.params.toQueryString() +'&callback='+callbackName;if(options.url.indexOf('?')>=0){url+=("&"+params);}el se{url+=("?"+params);}}else{url+='?callback='+callbackName;} var scriptTag=document.createElement('script');scriptTag.setAttribute('src',url) ;scriptTag.setAttribute('async','true');scriptTag.setAttribute('charset','utf-8' ) document.documentElement.firstChild.appendChild(scriptTag);} Scribd.tabber=Class.create({initialize:function(tabs,prefix,default_tab,options)

{this.tabs=tabs;this.prefix=prefix;this.default_tab=default_tab;this.current_tab =default_tab;this.options=options {};this.current_tab_class_name=this.options.c urrent_tab_class_name 'current';this.tabs.each(function(li){var a=li.down('a'); a.href='#'+this.getTabNameFromUrl(a.href);a.observe('click',this.activateTab.bin d(this,a));},this);this.activateTab();Event.observe(window,'hashchange',function (e){this.activateTab();}.bindAsEventListener(this))},activateTab:function(a){var src=a window.location;var tab=this.getTabNameFromUrl(src.href);if(tab!=this.cu rrent_tab){this.resetTabs();this.current_tab=tab;if(this.options.ajaxy) this.ajaxTab();else this.staticTab();if(typeof(this.options.onShow)=='function') this.options.onShow.call(this);}},staticTab:function(){var tab=$(this.prefix+'-' +this.current_tab);if(!tab){tab=$(this.prefix+'-'+this.default_tab);this.current _tab=this.default_tab;} tab.show();this.selectCurrentTab();},ajaxTab:function(){var tab=$(this.prefix+''+this.current_tab);if(tab.empty()){var url=[window.location.pathname,this.curre nt_tab].join('/');new Ajax.Updater(tab,url,{method:'get',onComplete:function(req ){var tab=$(this.prefix+'-'+this.current_tab);tab.show();}.bind(this)});}else{ta b.show();} this.selectCurrentTab();},resetTabs:function(){var current_tab_class_name=this.c urrent_tab_class_name;var current=this.tabs.find(function(li){return li.hasClass Name(current_tab_class_name);});var tab_container=$(this.prefix+'-'+this.current _tab);if(tab_container)tab_container.hide();current.removeClassName(this.current _tab_class_name);},selectCurrentTab:function(){this.tabs.each(function(li){var a =li.down('a[href=#'+this.current_tab+']');if(a){li.addClassName(this.current_tab _class_name);throw $break;}},this);},getTabNameFromUrl:function(url){return Try. these(function(){var matches=url.match(/#(.*)$/);return matches[1];},function(){ var matches=url.match(/.*?t=([^&]+).*/);return matches[1];},function(){if(this.o ptions.ajaxy){var matches=url.match(/\/[a-z0-9]+\/([a-z0-9]+)/i);return matches[ 1];}else return null;}.bind(this)) this.default_tab;}});Scribd.is_safari=functi on(){var ua=navigator.userAgent.toLowerCase();return ua.indexOf('safari/')!=-1;} ;Scribd.addDefaultTextEvents=function(element,default_text,cb){element.addClassN ame('inactive');element.value=default_text;element.observe('focus',function(e){i f(this.value==default_text) this.value='';this.removeClassName('inactive');if(cb)cb(e);});element.observe('b lur',function(e){if($F(element)==''){element.value=default_text;element.addClass Name('inactive');}});};Scribd.enforceMaxLength=function(textarea,countDisplay,ma xLength){if(textarea&&countDisplay){var updateCharCount=function(e){var val=$F(t extarea);var left=maxLength-val.length;if(left<0){textarea.setValue(val.slice(0, maxLength));left=0;} if(left==0){countDisplay.addClassName('limit_reached');}else{countDisplay.remove ClassName('limit_reached');} countDisplay.update(left);} updateCharCount();textarea.observe('focus',updateCharCount);textarea.observe('ch ange',updateCharCount);textarea.observe('keyup',updateCharCount);}};Scribd.JSONC ookie=Class.create({initialize:function(name,jar){this.jar=jar new CookieJar({p ath:'/',expires:''});this.name=name;var cstring=this.jar.get(name) "{}";this.st ore=$H(cstring.evalJSON(true));},set:function(k,v){return this.store.set(k,v);}, unset:function(key){return this.store.unset(key);},toJSON:function(){return this .store.toJSON();},get:function(key){return this.store.get(key);},save:function() {this.jar.put(this.name,this.toJSON());}});Scribd.usernameRestriction=/[A-Za-z_0 -9]/g;Scribd.restrictCharactersForUsername=function(e){if(!e)var e=window.event; if(e.keyCode)code=e.keyCode;else if(e.which)code=e.which;var character=String.fr omCharCode(code);if(code==27){this.blur();return false;} if(!e.ctrlKey&&code!=9&&code!=8&&code!=36&&code!=37&&code!=38&&(code!=39)&&code! =40&&code!=46){if(character.match(Scribd.usernameRestriction)){return true;}else {e.stop();}}};Scribd.documentTimelineEvents={mouseover:function(e){var delete_bu tton=this.down('.delete_event');if(delete_button) delete_button.style.visibility='visible';var flag_container=this.down('.flag_con tainer') if(flag_container)

flag_container.style.visibility='visible';},mouseout:function(e,fromChild){var d elete_button=this.down('.delete_event');if(delete_button) delete_button.style.visibility='hidden';var flag_container=this.down('.flag_cont ainer') if(flag_container) flag_container.style.visibility='hidden';},mouseReEnter:function(e){if(this.up(' .autogen_class_views_events_base_feed_item')) if(this.up('.autogen_class_views_events_base_feed_item').over) Scribd.timelineEvents.mouseover.call(this.up('.autogen_class_views_events_base_f eed_item'),e);}};Scribd.String={breakWords:function(str,max_len){var re_str="(.{ 1,"+max_len+"})";var re=new RegExp(re_str,"g");var str_parts=$w(str);str_parts=s tr_parts.map(function(s){return s.replace(re,"$1 ");});return str_parts.join(' ' );}};Scribd.logOn=false;Scribd.log=function(msg,obj,logger){if(!logger) logger='log';if(Scribd.logOn&&window['console']&&window['console'][logger]){cons ole[logger](msg);if(obj) console[logger](obj);}};Scribd.logError=function(msg,obj){Scribd.log(msg,obj,'er ror');};Scribd.createCopyButton=function(container,text_field,opts){var options= Object.extend({min_version:8,bg_color:'#cccccc',width:'55',height:'25'},opts {} );options.params=Object.extend({copyTextContainerId:text_field,fontSize:11,fontF ace:'Arial',fontColor:"#000000",copyText:'',imageUrl:Scribd.cdn_path+'images/but tons/copy_reg.gif'},options.params {});$(container).addClassName('copy_button') ;var swf=new SWFObject(Scribd.cdn_path+'swf/CopyClipboardButton.swf?v=3.0','copy _'+text_field,options.width,options.height,options.min_version,options.bg_color) ;swf.addParam('flashvars',decodeURIComponent($H(options.params).toQueryString()) );swf.addParam('wmode','transparent');swf.addParam('allowscriptaccess','always') ;swf.addParam('menu',false);swf.write(container);$(container).observe('click',fu nction(){this.addClassName('active');Element.removeClassName.delay(2,this,'activ e');});};var CopyClipboardButton={getCopyText:function(a){var el=$(a);return Try .these(function(){return el.value;},function(){return el.innerText;},function(){ return el.textContent;}) "";}};Scribd.createZeroCopyButton=function(button,text _field){ZeroClipboard.setMoviePath(Scribd.cdn_path+'swf/ZeroClipboard.swf');var clip=new ZeroClipboard.Client();clip.setText('');clip.setHandCursor(true);clip.s etCSSEffects(true);clip.addEventListener('mouseDown',function(client){clip.setTe xt($(text_field).value);});clip.glue(button);};Scribd.BrowserDetect={init:functi on(){this.browser=this.searchString(this.dataBrowser) "An unknown browser";this .version=this.searchVersion(navigator.userAgent) this.searchVersion(navigator.a ppVersion) "an unknown version";this.OS=this.searchString(this.dataOS) "an unk nown OS";},searchString:function(data){for(var i=0;i<data.length;i++){var dataSt ring=data[i].string;var dataProp=data[i].prop;this.versionSearchString=data[i].v ersionSearch data[i].identity;if(dataString){if(dataString.indexOf(data[i].subS tring)!=-1) return data[i].identity;} else if(dataProp) return data[i].identity;}},searchVersion:function(dataString){var index=dataStri ng.indexOf(this.versionSearchString);if(index==-1)return;return parseFloat(dataS tring.substring(index+this.versionSearchString.length+1));},dataBrowser:[{string :navigator.userAgent,subString:"Chrome",identity:"Chrome"},{string:navigator.use rAgent,subString:"OmniWeb",versionSearch:"OmniWeb/",identity:"OmniWeb"},{string: navigator.vendor,subString:"Apple",identity:"Safari",versionSearch:"Version"},{p rop:window.opera,identity:"Opera"},{string:navigator.vendor,subString:"iCab",ide ntity:"iCab"},{string:navigator.vendor,subString:"KDE",identity:"Konqueror"},{st ring:navigator.userAgent,subString:"Firefox",identity:"Firefox"},{string:navigat or.vendor,subString:"Camino",identity:"Camino"},{string:navigator.userAgent,subS tring:"Netscape",identity:"Netscape"},{string:navigator.userAgent,subString:"MSI E",identity:"Explorer",versionSearch:"MSIE"},{string:navigator.userAgent,subStri ng:"Gecko",identity:"Mozilla",versionSearch:"rv"},{string:navigator.userAgent,su bString:"Mozilla",identity:"Netscape",versionSearch:"Mozilla"}],dataOS:[{string: navigator.platform,subString:"Win",identity:"Windows"},{string:navigator.platfor m,subString:"Mac",identity:"Mac"},{string:navigator.userAgent,subString:"iPhone" ,identity:"iPhone/iPod"},{string:navigator.platform,subString:"Linux",identity:"

Linux"}]};Scribd.BrowserDetect.init();Prototype.Browser.IE6=Prototype.Browser.IE &&parseInt(navigator.userAgent.substring(navigator.userAgent.indexOf("MSIE")+5)) ==6;Prototype.Browser.IE7=Prototype.Browser.IE&&parseInt(navigator.userAgent.sub string(navigator.userAgent.indexOf("MSIE")+5))==7;Prototype.Browser.IE8=Prototyp e.Browser.IE&&!Prototype.Browser.IE6&&!Prototype.Browser.IE7;Scribd.init=functio n(a){if(arguments.length>0){var len=arguments.length;var prev=null;for(var i=0;i <len;i++){if(arguments[i].length==0)throw"Cannot initialize an empty string";var current=prev?prev[arguments[i]]:window[arguments[i]];var base=prev?prev:window; if(!current)current=base[arguments[i]]={};prev=current;} return current;}else{return null;}};Scribd.getOption=function(name,defaultVal){v ar val=window["_sbdOptions_"+name];if(typeof val==='undefined'){val=defaultVal;} return val;};Element.fromString=function(str){return new Element('div').update(s tr).firstChild;};Element.addMethods({getDimensionsWithHidden:function(element){e lement=$(element);var dimensions={width:element.clientWidth,height:element.clien tHeight};if((dimensions.width dimensions.height)==0){var restore=element.ancest ors(function(element){return!element.visible()}),styles=[];restore.push(element) ;restore.each(function(r){styles.push({display:r.getStyle('display'),position:r. getStyle('position'),visibility:r.getStyle('visibility')});r.setStyle({display:' block',position:'absolute',visibility:'visible'});});dimensions={width:element.c lientWidth,height:element.clientHeight};restore.each(function(r,index){r.setStyl e(styles[index]);});} return dimensions;}}); /* public/javascripts/word.js @ 1319142822 */ if(!window.Scribd)var Scribd=new Object();function disableButton(button){button. disabled=true;button.value='Saving...';} function update_progress_bar(id){if($('status_'+id).innerHTML[0]!='(') {$('progress-indicator-'+id).hide();}} function pageHeight(){return window.innerHeight!=null?window.innerHeight:documen t.documentElement&&document.documentElement.clientHeight?document.documentElemen t.clientHeight:document.body!=null?document.body.clientHeight:0;} function pageWidth(){return document.documentElement&&document.documentElement.o ffsetWidth?document.documentElement.offsetWidth:document.body!=null?document.bod y.offsettWidth:window.innerWidth!=null?window.innerWidth:0;} function toggle_class_id(id,c){if($(id).hasClassName(c)){$(id).removeClassName(c );}else{$(id).addClassName(c);}} function highlight_checkbox(id,row){if($(id).checked==true){$(row).addClassName( 'highlighted');}} function show_tab(tab_num){$('graph_tab_1').className="graph_unselected";$('grap h_tab_2').className="graph_unselected";$('graph_tab_3').className="graph_unselec ted";$('graph_tab_4').className="graph_unselected";$('graph_tab_5').className="g raph_unselected";$('graph_tab_6').className="graph_unselected";$('graph_tab_7'). className="graph_unselected";var graph_tab_base="graph_tab_";var tab_name=graph_ tab_base.concat(tab_num.toString());$(tab_name).className="graph_selected";refre sh_log=(tab_num==4);} function toggle_analytics(){if(Element.visible('inner_analytics')){$('analytics_ switch').innerHTML="Show analytics";$('inner_analytics').hide();}else{$('analyti cs_switch').innerHTML="Hide analytics";$('inner_analytics').show();}} function toggle_statistics(){if(Element.visible('text_statistics_internal')){$(' statistics_switch').innerHTML="Show text statistics";$('text_statistics_internal ').hide();}else{$('statistics_switch').innerHTML="Hide text statistics";$('text_ statistics_internal').show();}} function shiftCheck(event,id){if(!event){event=window.event} if(event) {if(id!=null) {var num=parseInt(/my_documents_checkbox_row(\d+)/.exec($(id).id)[1]);} else {var num=parseInt(/my_documents_checkbox_row(\d+)/.exec(this.id)[1]);}

if(event.shiftKey&&last!=-1){var di=num>last?1:-1 for(var i=last;i!=num;i+=di){$('my_documents_checkbox_row'+i).checked=true;$('my _documents_row'+i).addClassName('highlighted');}} last=num}} function checkAll(id,checked,highlight){var el=$(id);for(var i=0;i<el.elements.l ength;i++){cb=el.elements[i];cb.checked=checked;if(highlight) {row=$('my_documents_row'+i);if(row) {if(!checked) {row.removeClassName('highlighted');} else if(checked) {row.addClassName('highlighted');}}}}} function selectMyDocs(turnOn,highlight){if(highlight){$$("tr.my_documents_row"). each(function(row){turnOn?row.addClassName('highlighted'):row.removeClassName('h ighlighted');});} $$("tr.my_documents_row td.check input").each(function(check){check.checked=turn On;});} function getCheckedDocIds(form){var checked_doc_ids=new Array();$$("td.check > i nput").each(function(check){if(check.checked) checked_doc_ids.push(check.value);});form.getElementsBySelector('input[name="doc s"]')[0].value=checked_doc_ids.join(",");} function SetAllCheckBoxes(FormName,FieldName,CheckValue) {if(!document.forms[FormName]) return;var objCheckBoxes=document.forms[FormName].elements[FieldName];if(!objChe ckBoxes) return;var countCheckBoxes=objCheckBoxes.length;if(!countCheckBoxes) objCheckBoxes.checked=CheckValue;else for(var i=0;i<countCheckBoxes;i++) objCheckBoxes[i].checked=CheckValue;} function activateScribdLinks(){var all=$$('.preview_link');for(var i=0,o;o=all[i ];i++){var link_id=o.href.match("id=([0-9]+)");o.setAttribute('id',link_id[1]);o .onclick=new Function("showScribdDiv('"+link_id[1]+"','"+o.href+"'); return fals e;");}} function showScribdDiv(link_id,url){var dd=document.getElementById('scribd_inlin e_div');var obj=document.getElementById(link_id);if((dd.style.display=='block')& &(url==dd.getAttribute('scribd_doc_id'))){dd.style.display='none';return;} else {dd.setAttribute('scribd_doc_id',url);var width=535;var height=600;var image=fal se;if(obj.href.match(/\.[jpg gif png jpeg]/i)) {image=true;} if(image) {code_str="";code_str+="<a href='#' onclick=\"javascript:showScribdDiv("+link_id +",'"+url+"'); return false;\">[Close Window]</a><br>\n";code_str+="<img src='"+ url+"' width='"+width+"' />";} else {var code_str="";code_str+="<a href='#' onclick=\"javascript:showScribdDiv("+lin k_id+",'"+url+"'); return false;\">[Close Window]</a><br>\n";code_str+="<iframe ";code_str+="scrolling='no' ";code_str+="frameborder='0 ";code_str+="border='0' ";code_str+="marginwidth='0' ";code_str+="marginheight='0' ";code_str+="vspace=' 0' ";code_str+="hspace='0' ";code_str+="allowtransparency='true' ";code_str+="st yle='visibility: visible;' ";code_str+="src='"+(url)+"' width='"+width+"' height ='"+height+"'></iframe>";} dd.innerHTML=code_str;dd.style.display='block';var arrayPageSize=document.viewpo rt.getDimensions();var arrayPageScroll=document.viewport.getScrollOffsets();dd.s tyle.top=(arrayPageScroll[1]+((arrayPageSize.height-35-height)/2)+'px');dd.style .left=(((arrayPageSize.width-20-width)/2)+'px');}} function show_more_info(id,i){$('more_info_'+id).show();$('more_info_link_'+id). hide();$('less_info_link_'+id).show();} function show_less_info(id,i){$('more_info_link_'+id).show();$('less_info_link_' +id).hide();$('more_info_'+id).hide();} function select_email_provider(provider){if(provider.id=='yahoo'){idx=0;}else if

(provider.id=='gmail'){idx=1;}else{idx=2;} $('provider_select').selectedIndex=idx;$('yahoo').removeClassName('yahoo_button_ active');$('gmail').removeClassName('gmail_button_active');$('hotmail').removeCl assName('hotmail_button_active');$('yahoo').addClassName('yahoo_button');$('gmai l').addClassName('gmail_button');$('hotmail').addClassName('hotmail_button');$(p rovider).addClassName(provider.id+'_button_active');$(provider).removeClassName( provider.id+'_button');} function visible(id){$(id).style.visibility='visible';} function invisible(id){$(id).style.visibility='hidden';} function hideElements(selector){$$(selector).each(function(item){item.hide();})} function filetype_image_url(size,extension){var base;switch(extension){case'pdf' :case'ps':base='pdf';break;case'doc':case'docx':base='word';break;case'txt':case 'rtf':base='txt2';break;case'ppt':case'pptx':case'pps':case'ppsx':base='powerpoi nt';break;case'xls':base='excel';break;case'odt':case'odp':case'ods':case'odg':c ase'odf':case'sxw':case'sxc':case'sxi':case'sxd':base='openoffice';break;case'jp g':case'jpeg':case'gif':case'png':case'tiff':base='Photo';break;case'html':case' htm':base='File';break;case'mp3':base='mp3';break;default:base='File';} return Scribd.cdn_path+"images/filetypes/"+base+"_"+size+"x"+size+".gif";} function titleizer(filename){var out=filename;out=out.substring(0,out.lastIndexO f('.'));return out.gsub('[_.]',' ');} function isDefined(variable){return(typeof(window[variable])=="undefined")?false :true;} function resizeProfileThumbnail(thumb){resizeThumbnail(thumb,100);thumb.show();} function resizeThumbnail(thumb,maxThumbWidth){width=thumb.getWidth();height=thum b.getHeight();if(width>maxThumbWidth){width_delta=width-maxThumbWidth;thumb.styl e.width=maxThumbWidth+"px";thumb.style.height=Math.round((thumb.getWidth()/width )*height)+"px";}};function show_explore(tab){if(tab=='tags'){$('explore_tags').s tyle.display='block';$('explore_categories').style.display='none';$('explore_tab _tags').addClassName('current');$('explore_tab_categories').removeClassName('cur rent');}else{$('explore_tags').style.display='none';$('explore_categories').styl e.display='block';$('explore_tab_tags').removeClassName('current');$('explore_ta b_categories').addClassName('current');}} function nextLightbox(curId){if(document.getElementById("alert_lightbox_"+(curId +1))){Scribd.Lightbox.open("alert_lightbox_"+(curId+1));}} function removeDocumentFromGroup(id,link){$(id).addClassName('notice_fluid');$(i d).addClassName('no_clear');$(id).innerHTML='<div class="center">Successfully Re moved '+link+' from Group</div>';} function trackEvent(category,action,label,value){try{_gaq.push(['_trackEvent',ca tegory,action,label,value]);Scribd.log('GA trackEvent: '+category+', '+action+', '+label+', '+value);}catch(ohNo){}} function dateNowString(offset){var d=new Date();if(offset)d.setDate(d.getDate()+ offset);return(d.getMonth()+1)+"/"+(d.getDate()+1)+"/"+d.getFullYear();} function previousMonthString(){var d=new Date();var month=d.getMonth();var year= d.getFullYear();if(month==0){month=12;year-=1;} return month+"/"+year;} function enableButton(button){if($(button)){$(button).disabled=false;$(button).r emoveClassName('button_disabled');}} function disableButton(button){if($(button)){$(button).disabled=true;$(button).a ddClassName('button_disabled');}} Scribd.carouselLazyLoad=function(carousel){function callback(force){var currentI ndex=(this.current)?this.current._index:0;var nextItem=(this.slides.length-1==cu rrentIndex)?(this.options.circular?0:currentIndex):currentIndex+1;var item=(forc e)?carousel.slides[0]:carousel.slides[nextItem];if(item&&!item.readAttribute('im agesloaded')){item.select('a').each(function(a){var orig=a.readAttribute('orig') ;if(orig){a.style.backgroundImage='url('+a.readAttribute('orig')+')';a.writeAttr ibute('orig','');}});item.writeAttribute('imagesloaded','true');} return true;} callback.call(carousel,true);carousel.options.beforeMove=callback.bind(carousel, false);}

/* public/javascripts/lightbox.js @ 1319142822 */ if(!window.Scribd)var Scribd=new Object();Scribd.Lightbox=(function(){var scroll Height=function(){var h=window.pageYOffset document.body.scrollTop document.do cumentElement.scrollTop;return h?h:0;};var center=function(id,topOffset){if(type of topOffset=="undefined"){topOffset=0;} if((id=='toolbar_download_lightbox') (id=='toolbar_print_lightbox') (id=='prem ium_download') (id=='premium_credit_card_flow')){var container=$('viewer') $(' content_wrap');c_w=container.getWidth();c_offsets=container.cumulativeOffset();c _left_offset=c_offsets[0];el_w=$(id).getWidth();left=c_left_offset+Math.round((c _w-el_w)/2);}else{el_w=$(id).getWidth();view_w=document.viewport.getWidth();left =Math.round((view_w-el_w)/2);} if(left<0){left=0;} $(id).style.left=left+'px';$(id).style.top=(scrollHeight()+70+topOffset)+'px';}; var hideSelects=function(){selects=$$('select');for(i=0;i<selects.length;i++){se lects[i].hide();}};var showSelects=function(){selects=$$('select');for(i=0;i<sel ects.length;i++){selects[i].show();}};return{current_open:null,isOpen:function() {return this.current_open!==null;},current:function(){return $(this.current_open );},initialize:function(options){document.observe('keydown',function(e){if(Event .KEY_ESC==e.keyCode){this.close(this.current_open);}}.bind(this));if(options){if rameShim=options.iframeShim;}else{iframeShim=null;} document.observe('dom:loaded',function(){this.overlay=$('overlay');if(!this.over lay){document.body.appendChild(new Element('div',{'id':'overlay',style:'display: none;'}));this.overlay=$('overlay');}}.bind(this));document.observe('click',thi s.delegateCloseHandler.bind(this));},create:function(id,options){if($(id))this.d estroy(id);var options=Scribd.Options({style:'normal',close:false},options);if(o ptions.style=='tight'){var content_class='content content_tight';}else{var conte nt_class='content';} element_style='display:none';if(options.width){element_style+=';width:'+options. width+'px'} var contents='<div class="'+content_class+'"></div><div class="footer"></div>';i f(options.close){contents='<div class="close_button"></div>'+contents;} document.body.appendChild(new Element('div',{'class':'lightbox',id:id,style:elem ent_style}).update(contents));},update:function(id,content){$(id).down('.content ').update(content).fire("Scribd:dom_updated");},set_content_style_class:function (id,style){if(style=='normal') $(id).down('.content').removeClassName('content_tight').fire("Scribd:dom_updated ");if(style=='tight') $(id).down('.content').addClassName('content_tight').fire("Scribd:dom_updated"); },insert:function(id,content){$(id).down('.content').insert(content).fire("Scrib d:dom_updated");},showOverlay:function(){if(!this.overlay.visible()){this.overla y.show();}},hideOverlay:function(){if(this.overlay.visible()){this.overlay.hide( );}},open:function(id,topOffset,hideSelects){this.showOverlay();if(!this.current _open this.current_open!=id){this.close(this.current_open);center(id,topOffset) ;this.id=id;$(id).appear({duration:0.2});if(hideSelects) hideSelects();this.current_open=id;$(document).fire('lightbox:open');}},remoteOp en:function(id,url,params,create_options){var params=Scribd.Options({lightbox:tr ue,method:'post'},params);var create_options=Scribd.Options({},create_options);v ar method=params.method;delete params.method;this.create(id,create_options);this .update(id,'<div class="spinner_container"><img src="/images/spinner_large_mac_w hite.gif?1319142822" /></div>');this.open(id,75);new Ajax.Request(url,{parameter s:params,method:method,evalScripts:true,requestHeaders:{Accept:'application/json '},onSuccess:function(t){var r=t.responseJSON;if(r.content_style_class) this.set_content_style_class(id,r.content_style_class);if(r.content) this.update(id,r.content);if(r.redirect) Scribd.Lightbox.remoteOpen(id,r.redirect,{},create_options)}.bind(this)});},secu reIframeOpen:function(id,url,options,create_options){var create_options=Scribd.O ptions({},create_options);var options=Scribd.Options({showLoading:true},options) ;this.create(id,create_options);var container=new Element('div',{'class':'iframe

_container'});this.insert(id,container);var remote=options.remoteUrl?options.rem oteUrl:(url.protocol()+'//'+url.domain());var intermediaryUrl=remote+'/easyxdm/i ntermediary.html#url='+encodeURIComponent(url)+'&showLoading='+(options.showLoad ing?'1':'0');new easyXDM.Socket({remote:intermediaryUrl,remoteHelper:remote+"/ea syxdm/name.html",local:"/easyxdm/name.html",container:container,props:{framebord er:0,border:0,scrolling:'no'},onMessage:function(message,origin){var args=messag e.split(' ');message=args.shift();if(message=='open'){Scribd.Lightbox.open(args[ 0],75);}else if(message=='close'){this.close();}else if(message=='resize'){conta iner.down('iframe').style.height=args[0]+"px";}else if(options.onMessage){option s.onMessage(message,origin);}}.bind(this)});if(options.height) container.down('iframe').style.height=options.height+'px';this.open(id,75);},clo se:function(id){var lb=id?$(id):$(this.current_open);if(lb){if(lb.visible()){lb. fade({duration:0.1});showSelects();this.current_open=null;document.fire('lightbo x:closed',{'lightbox_id':lb.id});this.hideOverlay();}}},toggle:function(id,topOf fset){var lb=$(id);if(lb.visible()) this.close(id);else this.open(id,topOffset);},closeHandler:function(e){e.stop();var lb=e.element().u p('.lightbox');if(lb)Scribd.Lightbox.close(lb.id);},delegateCloseHandler:functio n(e){if(!e.findElement('.lightbox .close_button')){return;} this.closeHandler(e);},destroy:function(id){if($(id)){this.close(id);$(id).remov e();}}}})(); /* public/javascripts/lowpro_0_5.js @ 1319142822 */ LowPro={};LowPro.Version='0.5';LowPro.CompatibleWithPrototype='1.6';if(Prototype .Version.indexOf(LowPro.CompatibleWithPrototype)!=0&&console&&console.warn) console.warn("This version of Low Pro is tested with Prototype "+LowPro.Compatib leWithPrototype+" it may not work as expected with this version ("+Prototype.Ver sion+")");if(!Element.addMethods) Element.addMethods=function(o){Object.extend(Element.Methods,o)};DOM={};DOM.Buil der={tagFunc:function(tag){return function(){var attrs,children;if(arguments.len gth>0){if(arguments[0].nodeName typeof arguments[0]=="string") children=arguments;else{attrs=arguments[0];children=Array.prototype.slice.call(a rguments,1);};} return DOM.Builder.create(tag,attrs,children);};},create:function(tag,attrs,chil dren){attrs=attrs {};children=children [];tag=tag.toLowerCase();var el=new Ele ment(tag,attrs);for(var i=0;i<children.length;i++){if(typeof children[i]=='strin g') children[i]=document.createTextNode(children[i]);el.appendChild(children[i]);} return $(el);}};(function(){var els=("p div span strong em img table tr td th th ead tbody tfoot pre code "+"h1 h2 h3 h4 h5 h6 ul ol li form input textarea legen d fieldset "+"select option blockquote cite br hr dd dl dt address a button abbr acronym "+"script link style bdo ins del object param col colgroup optgroup cap tion "+"label dfn kbd samp var").split(" ");var el,i=0;while(el=els[i++]) window['$'+el]=DOM.Builder.tagFunc(el);})();DOM.Builder.fromHTML=function(html){ var root;if(!(root=arguments.callee._root)) root=arguments.callee._root=document.createElement('div');root.innerHTML=html;re turn root.childNodes[0];};Object.extend(Event,{onReady:function(f){if(document.b ody)f();else document.observe('dom:loaded',f);}});Event.addBehavior=function(rul es){var ab=this.addBehavior;Object.extend(ab.rules,rules);if(!ab.responderApplie d){Ajax.Responders.register({onComplete:function(){if(Event.addBehavior.reassign AfterAjax) setTimeout(function(){ab.reload()},10);}});ab.responderApplied=true;} if(ab.autoTrigger){this.onReady(ab.load.bind(ab,rules));}};Object.extend(Event.a ddBehavior,{rules:{},cache:[],reassignAfterAjax:true,autoTrigger:true,load:funct ion(rules){for(var selector in rules){var observer=rules[selector];var sels=sele ctor.split(',');sels.each(function(sel){var parts=sel.split(/:(?=[a-z]+$)/),css= parts[0],event=parts[1];$$(css).each(function(element){if(event){observer=Event. addBehavior._wrapObserver(observer);$(element).observe(event,observer);Event.add

Behavior.cache.push([element,event,observer]);}else{if(!element.$$assigned !ele ment.$$assigned.include(observer)){if(observer.attach)observer.attach(element);e lse observer.call($(element));element.$$assigned=element.$$assigned [];element. $$assigned.push(observer);}}});});}},unload:function(){this.cache.each(function( c){Event.stopObserving.apply(Event,c);});this.cache=[];},reload:function(){var a b=Event.addBehavior;ab.unload();ab.load(ab.rules);},_wrapObserver:function(obser ver){return function(event){if(observer.call(this,event)===false)event.stop();}} });Event.observe(window,'unload',Event.addBehavior.unload.bind(Event.addBehavior ));$$$=Event.addBehavior.bind(Event);var Behavior={create:function(){var parent= null,properties=$A(arguments);if(Object.isFunction(properties[0])) parent=properties.shift();var behavior=function(){var behavior=arguments.callee; if(!this.initialize){var args=$A(arguments);return function(){var initArgs=[this ].concat(args);behavior.attach.apply(behavior,initArgs);};}else{var args=(argume nts.length==2&&arguments[1]instanceof Array)?arguments[1]:Array.prototype.slice. call(arguments,1);this.element=$(arguments[0]);this.initialize.apply(this,args); behavior._bindEvents(this);behavior.instances.push(this);}};Object.extend(behavi or,Class.Methods);Object.extend(behavior,Behavior.Methods);behavior.superclass=p arent;behavior.subclasses=[];behavior.instances=[];if(parent){var subclass=funct ion(){};subclass.prototype=parent.prototype;behavior.prototype=new subclass;pare nt.subclasses.push(behavior);} for(var i=0;i<properties.length;i++) behavior.addMethods(properties[i]);if(!behavior.prototype.initialize) behavior.prototype.initialize=Prototype.emptyFunction;behavior.prototype.constru ctor=behavior;return behavior;},Methods:{attach:function(element){return new thi s(element,Array.prototype.slice.call(arguments,1));},_bindEvents:function(bound) {for(var member in bound) if(member.match(/^on(.+)/)&&typeof bound[member]=='function') bound.element.observe(RegExp.$1,Event.addBehavior._wrapObserver(bound[member].bi ndAsEventListener(bound)));}}};Remote=Behavior.create({initialize:function(optio ns){if(this.element.nodeName=='FORM')new Remote.Form(this.element,options);else new Remote.Link(this.element,options);}});Remote.Base={initialize:function(optio ns){this.options=Object.extend({evaluateScripts:true},options {});},_makeReques t:function(options){if(options.update)new Ajax.Updater(options.update,options.ur l,options);else new Ajax.Request(options.url,options);return false;}} Remote.Link=Behavior.create(Remote.Base,{onclick:function(){var options=Object.e xtend({url:this.element.href,method:'get'},this.options);return this._makeReques t(options);}});Remote.Form=Behavior.create(Remote.Base,{onclick:function(e){var sourceElement=e.element();if(['input','button'].include(sourceElement.nodeName.t oLowerCase())&&sourceElement.type=='submit') this._submitButton=sourceElement;},onsubmit:function(){var options=Object.extend ({url:this.element.action,method:this.element.method 'get',parameters:this.elem ent.serialize({submit:this._submitButton.name})},this.options);this._submitButto n=null;return this._makeRequest(options);}});Observed=Behavior.create({initializ e:function(callback,options){this.callback=callback.bind(this);this.options=opti ons {};this.observer=(this.element.nodeName=='FORM')?this._observeForm():this._ observeField();},stop:function(){this.observer.stop();},_observeForm:function(){ return(this.options.frequency)?new Form.Observer(this.element,this.options.frequ ency,this.callback):new Form.EventObserver(this.element,this.callback);},_observ eField:function(){return(this.options.frequency)?new Form.Element.Observer(this. element,this.options.frequency,this.callback):new Form.Element.EventObserver(thi s.element,this.callback);}}); /* public/javascripts/analytics.js @ 1319142822 */ var Analytics=function(referrer){this._searchEngine=null;this._searchEngineName= '';this._searchEngineQuery='';this._searchEngineKeywords='';if(this._getParam('u se_google_view')=='1'&&this._getParam('query')!=''){this._searchEngineName='goog le';this._searchEngine=this._searchEngines['google'];this._searchEngineQuery=thi s._getParam('query').replace(/\+/g,' ');this._searchEngineKeywords=this._extract

Keywords(this._searchEngineQuery);return;} referrer=referrer document.referrer;if(!referrer)return;var uri=this._parseUri( referrer);for(var name in this._searchEngines){var se=this._searchEngines[name]; if(uri.domain.match(se.match)){this._searchEngineName=name;this._searchEngine=se ;this._parseQueryString(uri);if(this._searchEngineKeywords)break;}} if(!this._searchEngine)return;} Analytics.prototype={isSearchEngineVisitor:function(){return!!this._searchEngine ;},getSearchEngineName:function(){return this._searchEngineName;},getSearchEngin eQuery:function(){return this._searchEngineQuery;},getSearchEngineKeywords:funct ion(){return this._searchEngineKeywords;},_searchEngines:{scribd:{param:'query', match:/\.?scribd\.com$/},scribd_seo:{param:'query2',match:/\.?scribd\.com$/},goo gle:{param:'q',match:/\.?google\.\w{2,3}(?:\.\w{2,3})?$/},msn:{param:'q',match:/ (?:live msn)\.com$/},yahoo:{param:'p',match:/\.?yahoo\.\w{2,3}(?:\.\w{2,3})?$/}, baidu:{param:'wd',match:/\.?baidu\.\w{2,3}$/},cuil:{param:'q',match:/\.?cuil\.co m$/},aol:{param:'query',match:/\.?aol\.com$/}},_parseUri:function(sourceUri){var uriPartNames=['source','protocol','authority','domain','port','path','directory Path','fileName','query','anchor'];var uriParts=new RegExp("^(?:([^:/?#.]+):)?(? ://)?(([^:/?#]*)(?::(\\d*))?)?((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[\\?#] $)))*/?) ?([^?#/]*))?(?:\\?([^#]*))?(?:#(.*))?").exec(sourceUri);var uri={};for(var i=0;i <10;i++){uri[uriPartNames[i]]=(uriParts[i]?uriParts[i]:'');} if(uri.directoryPath.length>0){uri.directoryPath=uri.directoryPath.replace(/\/?$ /,'/');} return uri;},_parseQueryString:function(uri){var params=uri.query.split('&');for (var i=params.length;i--;){var parts=params[i].split('=');if(parts[0]==this._sea rchEngine.param){this._searchEngineQuery=decodeURIComponent(parts[1].replace(/\+ /g,' '));this._searchEngineKeywords=this._extractKeywords(this._searchEngineQuer y);break;}}},_getParam:function(name){var regexS="[\\?&]"+name+"=([^&#]*)";var r egex=new RegExp(regexS);var results=regex.exec(window.location.href);if(results= =null) return"";else return results[1];},_extractKeywords:function(text){var match=text.toLowerCase() .match(/[^\W\d\s\-][^\W\'\d\s]{3,30}/g);if(match!=null){return match.join(' ');} else{return null;}}} /* public/javascripts/behaviors.js @ 1319142822 */ Event.addBehavior({'.dropdowns li > a:click, li.with_dropdown > a:click':functio n(e){e.stop();var li=e.findElement('li');var dropdown=li.down('.dropdown');if(Sc ribd.openDropDown&&Scribd.openDropDown!=li){Scribd.openDropDown.removeClassName( 'open');Scribd.openDropDown=null;} if(dropdown){if(!li.hasClassName('open')){li.addClassName('open');Scribd.openDro pDown=li;}else if(!Scribd.menuOver){li.removeClassName('open');Scribd.openDropDo wn=null;}}},'.truncated_text .truncated_more:click':function(e){this.up('.trunca ted_short').hide();this.up('.truncated_short').up('.truncated_text').down('.trun cated_long').show();},'.truncated_text .truncated_less:click':function(e){this.u p('.truncated_long').hide();this.up('.truncated_long').up('.truncated_text').dow n('.truncated_short').show();},'.embed_code_title_toggle:click':function(e){if(t his.checked){$(this.id+'title').show();$(this.id+'notitle').hide();}else{$(this. id+'title').hide();$(this.id+'notitle').show();}},'ul.nav_list_lined li.expanded :mouseover':function(e){this.addClassName('expanded_hover');},'ul.nav_list_lined li.expanded:mouseout':function(e){this.removeClassName('expanded_hover');},'ul. subcategories:mouseover':function(e){e.stop();},'.autogen_class_views_shared_con tainers_revealer .revealer:mouseover':function(e){this.down('a').removeClassName ('plus').addClassName('plus_active');this.down('.show_more').show();if(this.down ('.see_all_link')){this.down('.see_all_link').show();}},'.autogen_class_views_sh ared_containers_revealer .revealer:mouseout':function(e){this.down('a').addClass Name('plus').removeClassName('plus_active');this.down('.show_more').hide();if(th is.down('.see_all_link')){this.down('.see_all_link').hide();}},'.autogen_class_v iews_shared_containers_revealer .revealer:click':function(e){if(!e.element().has

ClassName('see_all_link')){this.hide();this.up('.autogen_class_views_shared_cont ainers_revealer').down('.to_reveal').show();}},'.autogen_class_views_shared_cont ainers_revealer .less:click':function(e){this.up('.to_reveal').hide();},'#homepa ge_login_tab_link:click':function(e){$('homepage_login').show();$('homepage_sign up').hide();$('homepage_signup_tab_link').removeClassName('signup_active');$('ho mepage_signup_tab_link').addClassName('signup_inactive');$('homepage_login_tab_l ink').removeClassName('login_inactive');$('homepage_login_tab_link').addClassNam e('login_active');},'#homepage_signup_tab_link:click':function(e){$('homepage_lo gin').hide();$('homepage_signup').show();$('homepage_signup_tab_link').addClassN ame('signup_active');$('homepage_signup_tab_link').removeClassName('signup_inact ive');$('homepage_login_tab_link').addClassName('login_inactive');$('homepage_lo gin_tab_link').removeClassName('login_active');},'.horizontal_carousel_arrows .l eft_arrow img:mouseover':function(e){this.src=Scribd.cdn_path+"images/homepage/c arousel_arrow_left_active.gif";},'.horizontal_carousel_arrows .left_arrow img:mo useout':function(e){this.src=Scribd.cdn_path+"images/homepage/carousel_arrow_lef t.gif";},'.horizontal_carousel_arrows .right_arrow img:mouseover':function(e){th is.src=Scribd.cdn_path+"images/homepage/carousel_arrow_right_active.gif";},'.hor izontal_carousel_arrows .right_arrow img:mouseout':function(e){this.src=Scribd.c dn_path+"images/homepage/carousel_arrow_right.gif";},'.document_event_in_timelin e_container:mouseenter,.document_event_container:mouseenter,.event_reply_contain er:mouseenter':function(e){Scribd.documentTimelineEvents.mouseover.call(this,e); },'.document_event_in_timeline_container:mouseleave,.document_event_container:mo useleave,.event_reply_container:mouseleave':function(e){Scribd.documentTimelineE vents.mouseout.call(this,e,false);},'.document_event_children:mouseleave':functi on(e){Scribd.documentTimelineEvents.mouseReEnter.call(this,e);},'#select_all_sug gested_users:click':function(e){if(document.suggested_users_form) {count=document.suggested_users_form.elements.length;for(i=0;i<count;i++){checkb ox=document.suggested_users_form.elements[i];checkbox.checked=this.checked;}}},' #doc_description_text':function(e){if(this.getHeight()==16){$('doc_description') .style.height='17px';} $('doc_description_more').show();},'#related_docs_show_link:click':function(e){$ ('related_docs_show').hide();$('related_docs_hidden').show();},'#related_docs_hi dden_link:click':function(e){$('related_docs_hidden').hide();$('related_docs_sho w').show();},'#admin_show_link:click':function(e){$('admin_show').hide();$('admi n_hidden').show();},'#admin_hidden_link:click':function(e){$('admin_hidden').hid e();$('admin_show').show();},'#related_queries_show_link:click':function(e){$('r elated_queries_show').hide();$('related_queries_hidden').show();},'#related_quer ies_hidden_link:click':function(e){$('related_queries_hidden').hide();$('related _queries_show').show();},'#disable_highlighting_link:click':function(e){$('embed ded_flash').childElements()[0].disableKeywordHighlighting();$('enable_highlighti ng').show();$('disable_highlighting').hide();},'#enable_highlighting_link:click' :function(e){$('embedded_flash').childElements()[0].enableKeywordHighlighting(); $('enable_highlighting').hide();$('disable_highlighting').show();},'.button_box, #document_group_overlay_toolbar':function(e){if($('viewer')) this.style.width=($('viewer').getWidth()-30)+'px';},'.module_bar .search:click': function(e){this.value='';this.addClassName('search_active');},'.survey:mouseove r':function(e){this.addClassName('survey_active');},'.survey:mouseout':function( e){this.addClassName('survey_active');},'#uploadButton:click':function(e){FileQu eue.upload();return false;},'#uploadButton2:click':function(e){if($('copyright_c heck')&&$('copyright_check').checked!=true){alert('Please verify that you agree and understand the Scribd Terms of Service and Copyright Policy by checking the checkbox above the upload button');}else{FileQueue.upload();} return false;},'#markAllPrivate:click':function(e){FileQueue.markAllPrivate();}, '#markAllPaid:click':function(e){FileQueue.markAllPaid();},'#purchase_button:cli ck':function(e){this.removeClassName('purchase_document_button');this.disabled=t rue;this.addClassName('purchase_document_button_inactive');$('purchase_spinner') .show();$('order_form').submit();},'#select_all_contacts:click,#select_all_conta cts':function(e){if(document.contact_form) {count=document.contact_form.elements.length;for(i=0;i<count;i++){checkbox=docum ent.contact_form.elements[i];checkbox.checked=this.checked;}}},'#invite_more_lin

k:click':function(e){this.up("div").hide();$('invite_more').show();},'.provider_ icon:click':function(e){select_email_provider(this);},'.credentials':function(e) {select_email_provider($('yahoo'));},'#provider_select:change':function(e){if(th is.selectedIndex==0){select_email_provider($('yahoo'));}else if(this.selectedInd ex==1){select_email_provider($('gmail'));}else{select_email_provider($('hotmail' ));}},'.trunc_url:mouseover':function(e){if(e.target.hint){e.target.hint.style.d isplay='block';return;} var pos=Element.cumulativeOffset(e.target);var el=document.createElement('div'); el.className='trunc_url_popup';el.style.left=pos.left-2+'px';el.style.top=pos.to p-2+'px';el.innerHTML=e.target.title;Event.observe(el,'mouseout',function(e){e.t arget.style.display='none';});e.target.hint=el;document.body.appendChild(el);},' .tweet_docs_checkbox:click':function(e){$$('.tweet_docs_checkbox').each(function (item){if(this!=item){item.checked=this.checked;}}.bind(this));}}); /* public/javascripts/view.js @ 1319142822 */ if(typeof scribd=="undefined"){var scribd=new Object();scribd.Document=function( ){this.__params=[];this.__callQueue=[];this.__listenerLookup={};if(arguments.len gth==2){this.document_id=arguments[0];this.access_key=arguments[1];return this;} if(scribd.Document.caller!=scribd.Document.getDoc&&scribd.Document.caller!=scrib d.Document.getDocFromUrl&&scribd.Document.caller!=scribd.Document.getDocFromUrlF orExtension&&scribd.Document.caller!=undefined){throw new Error("There is no pub lic constructor for scribd.Document.");}} scribd.Document.getDoc=function(document_id,access_key){scribd_doc=new scribd.Do cument();scribd_doc.document_id=document_id;scribd_doc.access_key=access_key;ret urn scribd_doc;} scribd.Document.getDocFromUrl=function(url,publisher_id){scribd_doc=new scribd.D ocument();scribd_doc.url=url;scribd_doc.publisher_id=publisher_id;return scribd_ doc;} scribd.Document.getDocFromUrlForExtension=function(url,extension_id){scribd_doc= new scribd.Document();scribd_doc.url=url;scribd_doc.extension_id=extension_id;sc ribd_doc.addParam("should_redirect",true);return scribd_doc;} scribd.Document.prototype={__handleEvent:function(eventType){var listeners=this. __listenerLookup[eventType] [];for(var i=0;i<listeners.length;i++) {listeners[i]();}},__addRoutedListener:function(eventType,callback){if(this.__li stenerExists(eventType,callback)) return;if(this.__listenerLookup[eventType]){this.__listenerLookup[eventType].pus h(callback);}else{this.__listenerLookup[eventType]=new Array(callback);}},__remo veRoutedListener:function(eventType,callback){var listeners=this.__listenerLooku p[eventType];for(var i=0;i<listeners.length;i++){if(listeners[i]==callback){list eners.splice(i,1);}}},__listenerExists:function(eventType,callback){var listener s=this.__listenerLookup[eventType] [];for(var i=0;i<listeners.length;i++){if(li steners[i]==callback)return true;} return false;},addEventListener:function(eventType,callback,optBubble){if(this.a pi){if(window.addEventListener){this.api.parentNode.addEventListener(eventType,c allback,false);}else{this.__addRoutedListener(eventType,callback);}}else{this.__ callQueue.push(["addEventListener",eventType,callback,false]);}},removeEventList ener:function(eventType,callback){if(this.api){if(window.addEventListener){this. api.removeEventListener(eventType,callback,false);}else{this.__removeRoutedListe ner(eventType,callback);}}else{this.__callQueue.push(["removeEventListener",even tType,callback]);}},getElement:function(){return document.getElementsByName(this .__embedName)[0]},addParam:function(name,value){this.__params[name]=value;},gran tAccess:function(user_identifier,secure_session_id,signature){this.__params["use r_identifier"]=user_identifier;this.__params["secure_session_id"]=secure_session _id;this.__params["signature"]=signature;},write:function(elementId){var element =document.getElementById(elementId);quickswitch=(this.__params["quickswitch"]==t rue);if(quickswitch){var container=document.createElement('div');container.style .width="100%";container.style.height="100%";document.body.appendChild(container) ;}

var auto_width=element.offsetWidth;var view_mode='';var flashVars='';if(this.__p arams["width"]&&this.__params["width"]!="parent"){auto_width=this.__params["widt h"];} if(this.__params["mode"]){view_mode=this.__params['mode'];flashVars+='&viewMode= '+escape(this.__params['mode']);} if(this.__params["height"]!="parent"){var auto_height=Math.round(auto_width*11.0 /8.5) if(view_mode=='slideshow') {auto_height=35+Math.round(auto_width*3.0/4.0);} var page_height=window.innerHeight!=null?window.innerHeight:document.documentEle ment&&document.documentElement.clientHeight?document.documentElement.clientHeigh t:document.body!=null?document.body.clientHeight:0;page_height-=25;if(auto_heigh t<200){auto_height=200;} if(auto_height>page_height){auto_height=page_height;} var embedHeight=auto_height+"px";}else{var embedHeight="100%";} var embedWidth="100%";var embedName=elementId+'_embed'+Math.round(Math.random()* 9e9);this.__embedName=embedName;var srcString="ScribdViewer";if(this.__params["a uto_size"]!=true){flashVars+='&auto_size=false';} if(this.__params["height"]&&this.__params["height"]!="parent"){embedHeight=this. __params["height"]+"px";} if(this.__params["width"]&&this.__params["width"]!="parent"){embedWidth=this.__p arams["width"]+"px";} if(this.__params["swf_name"]){srcString=this.__params["swf_name"];} if(this.__params["disable_related_docs"]){flashVars+='&disable_related_docs='+th is.__params["disable_related_docs"];} if(this.__params["page"]){flashVars+='&page='+this.__params["page"];} if(this.__params["extension"]){flashVars+='&extension='+this.__params["extension "];} if(this.__params["title"]){flashVars+='&title='+escape(this.__params["title"]);} if(this.__params["my_user_id"]){flashVars+='&my_user_id='+this.__params["my_user _id"];} if(this.__params["api_url"]){flashVars+='&api_url='+this.__params["api_url"];} if(this.__params["doctype"]){flashVars+='&doctype='+this.__params["doctype"];} if(this.__params["current_user_id"]){flashVars+='&current_user_id='+this.__param s["current_user_id"];} if(this.__params["search_query"]){flashVars+='&search_query='+escape(this.__para ms["search_query"]);} if(this.__params["search_keywords"]){flashVars+='&search_keywords='+escape(this. __params["search_keywords"]);} if(this.__params["transferCookie"]==true){flashVars+='&cookie='+escape(document. cookie);} if(this.__params["should_redirect"]){flashVars+='&should_redirect='+this.__param s["should_redirect"];} if(this.__params["secret_password"]){flashVars+='&secret_password='+this.__param s["secret_password"];} if(this.__params["public"]==true){flashVars+='&privacy=0';} else{flashVars+='&privacy=1';} if(this.__params["user_identifier"]){flashVars+='&user_identifier='+escape(this. __params["user_identifier"]);} if(this.__params["secure_session_id"]){flashVars+='&secure_session_id='+escape(t his.__params["secure_session_id"]);} if(this.__params["signature"]){flashVars+='&signature='+this.__params["signature "];} if(this.__params["docinfo"]){flashVars+='&docinfo='+encodeURIComponent(this.__pa rams["docinfo"]);} if(this.__params["useIntegratedUi"]){flashVars+='&useIntegratedUi='+this.__param s["useIntegratedUi"];} if(this.document_id){flashVars+='&document_id='+this.document_id;} if(this.access_key){flashVars+='&access_key='+this.access_key;} if(this.extension_id){flashVars+='&extension_id='+this.extension_id;}

if(this.url){flashVars+='&url='+escape(this.url);} if(this.publisher_id){flashVars+='&publisher_id='+escape(this.publisher_id);} var srcPath="http://d1.scribdassets.com/";var protocol="http://";if(this.__param s["use_ssl"]==true){srcPath="https://s3.amazonaws.com/documents.scribd.com/";fla shVars+="&use_ssl=true";protocol='https://';} if(this.__params["src_path"]){srcPath=this.__params["src_path"];} if(this.__params["hide_sample_banner"]){flashVars+='&hide_sample_banner='+this._ _params["hide_sample_banner"];} if(this.__params["disable_resume_reading"]==true){flashVars+='&disable_resume_re ading=true';} if(this.__params["hide_full_screen_button"]==true){flashVars+='&hide_full_screen _button=true';} if(this.__params["hide_disabled_buttons"]==true){flashVars+='&hide_disabled_butt ons=true';} if(this.__params["full_screen_type"]){flashVars+='&full_screen_type='+this.__par ams["full_screen_type"];} if(this.__params["custom_logo_image_url"]){flashVars+='&custom_logo_image_url='+ escape(this.__params["custom_logo_image_url"]);} if(this.__params["custom_logo_click_url"]){flashVars+='&custom_logo_click_url='+ escape(this.__params["custom_logo_click_url"]);} var embedString=Scribd_AC_RunActiveContent.Mod_AC_FL_RunContent('codebase',proto col+'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0, 0','width',embedWidth,'height',embedHeight,'flashvars',flashVars,'src',srcPath+s rcString,'quality','high','pluginspage',protocol+'www.macromedia.com/go/getflash player','align','middle','play','true','loop','true','scale','showall','wmode',' opaque','devicefont','false','id',embedName,'bgcolor','#ffffff','name',embedName ,'menu','true','allowFullScreen','true','allowScriptAccess','always','movie',src Path+srcString,'salign','');var flash_ok=Scribd_AC_RunActiveContent.DetectFlashV er(9,0,0);if(!flash_ok){embedString='<div style="font-size:16px;width:300px;bord er:1px solid #dddddd;padding:3px">Hello, you have an old version of Adobe Flash Player. To use iPaper (and lots of other stuff on the web) you need to <a href=" http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFl ash">get the latest Flash player</a>. </div>';} if(quickswitch){container.innerHTML=embedString;if(element.hasChildNodes()){whil e(element.childNodes.length>=1){element.removeChild(element.firstChild);}} element.appendChild(container);} else {element.innerHTML=embedString;} var __this=this;window["_scribd_event_handler_"+embedName]=function(eventType){_ _this.__handleEvent(eventType)};var onSetupJsApi=function(e) {var e=e {};var target=e.srcElement document.getElementsByName(embedName)[0];i f(target.getAttribute('name')==embedName) {__this.api=target;var i,method,callParams,rejectedCalls=[];for(var i=0;i<__this .__callQueue.length;i++) {callParams=__this.__callQueue[i];if(callParams[0]=="addEventListener"){method=c allParams.shift();__this[method].apply(__this,callParams);}else{rejectedCalls.pu sh(callParams);}} __this.__callQueue=rejectedCalls;}} var oniPaperReady=function(e) {var e=e {};var target=e.srcElement document.getElementsByName(embedName)[0];i f(target.getAttribute('name')==embedName){if(__this.onReady){__this.onReady();} var i,method,callParams,rejectedCalls=[];for(i=0;i<__this.__callQueue.length;i++ ){callParams=__this.__callQueue.pop();if(callParams[0]!="addEventListener"){meth od=callParams.shift();if(typeof method!="function")alert(typeof method) __this[method].apply(__this,callParams);}else{rejectedCalls.push(callParams);}} __this.__callQueue=rejectedCalls;}} if(window.addEventListener){window.addEventListener('iPaperReady',oniPaperReady, true);window.addEventListener('setupJsApi',onSetupJsApi,true)}else{this.__addRou tedListener('iPaperReady',oniPaperReady);this.__addRoutedListener('setupJsApi',o nSetupJsApi);}}}

var Scribd_AC_RunActiveContent=new function() {var isIE=(navigator.appVersion.indexOf("MSIE")!=-1)?true:false;var isWin=(navig ator.appVersion.toLowerCase().indexOf("win")!=-1)?true:false;var isOpera=(naviga tor.userAgent.indexOf("Opera")!=-1)?true:false;this.ControlVersion=function() {var version;var axo;var e;try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFl ash.7");version=axo.GetVariable("$version");}catch(e){} if(!version) {try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");version="WIN 6,0,2 1,0";axo.AllowScriptAccess="always";version=axo.GetVariable("$version");}catch(e ){}} if(!version) {try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");version=axo.GetVar iable("$version");}catch(e){}} if(!version) {try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");version="WIN 3,0,1 8,0";}catch(e){}} if(!version) {try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");version="WIN 2,0,0,1 1";}catch(e){version=-1;}} return version;};this.GetSwfVer=function(){var flashVer=-1;if(navigator.plugins! =null&&navigator.plugins.length>0){if(navigator.plugins["Shockwave Flash 2.0"] navigator.plugins["Shockwave Flash"]){var swVer2=navigator.plugins["Shockwave Fl ash 2.0"]?" 2.0":"";var flashDescription=navigator.plugins["Shockwave Flash"+swV er2].description;var descArray=flashDescription.split(" ");var tempArrayMajor=de scArray[2].split(".");var versionMajor=tempArrayMajor[0];var versionMinor=tempAr rayMajor[1];var versionRevision=descArray[3];if(versionRevision==""){versionRevi sion=descArray[4];} if(versionRevision[0]=="d"){versionRevision=versionRevision.substring(1);}else i f(versionRevision[0]=="r"){versionRevision=versionRevision.substring(1);if(versi onRevision.indexOf("d")>0){versionRevision=versionRevision.substring(0,versionRe vision.indexOf("d"));}} var flashVer=versionMajor+"."+versionMinor+"."+versionRevision;}} else if(navigator.userAgent.toLowerCase().indexOf("webtv/2.6")!=-1)flashVer=4;el se if(navigator.userAgent.toLowerCase().indexOf("webtv/2.5")!=-1)flashVer=3;else if(navigator.userAgent.toLowerCase().indexOf("webtv")!=-1)flashVer=2;else if(is IE&&isWin&&!isOpera){flashVer=this.ControlVersion();} return flashVer;};this.DetectFlashVer=function(reqMajorVer,reqMinorVer,reqRevisi on) {versionStr=this.GetSwfVer();if(versionStr==-1){return false;}else if(versionStr !=0){if(isIE&&isWin&&!isOpera){tempArray=versionStr.split(" ");tempString=tempAr ray[1];versionArray=tempString.split(",");}else{versionArray=versionStr.split(". ");} var versionMajor=versionArray[0];var versionMinor=versionArray[1];var versionRev ision=versionArray[2];if(versionMajor>parseFloat(reqMajorVer)){return true;}else if(versionMajor==parseFloat(reqMajorVer)){if(versionMinor>parseFloat(reqMinorVe r)) return true;else if(versionMinor==parseFloat(reqMinorVer)){if(versionRevision>=p arseFloat(reqRevision)) return true;}} return false;}};this.AC_AddExtension=function(src,ext) {if(src.indexOf('?')!=-1) return src.replace(/\?/,ext+'?');else return src+ext;};this.Mod_AC_Generateobj=function(objAttrs,params,embedAttrs) {var str='';if(isIE&&isWin&&!isOpera) {str+='<object ';for(var i in objAttrs) {str+=i+'="'+objAttrs[i]+'" ';} str+='>';for(var i in params) {str+='<param name="'+i+'" value="'+params[i]+'" /> ';} str+='</object>';} else

{str+='<embed ';for(var i in embedAttrs) {str+=i+'="'+embedAttrs[i]+'" ';} str+='> </embed>';} return str;};this.Mod_AC_FL_RunContent=function(){var ret=this.Mod_AC_GetArgs(ar guments,".swf","movie","clsid:d27cdb6e-ae6d-11cf-96b8-444553540000","application /x-shockwave-flash");return this.Mod_AC_Generateobj(ret.objAttrs,ret.params,ret. embedAttrs);} this.Mod_AC_SW_RunContent=function(){var ret=this.Mod_AC_GetArgs (arguments,".dcr","src","clsid:166B1BCA-3F9C-11CF-8075-444553540000",null);retur n this.Mod_AC_Generateobj(ret.objAttrs,ret.params,ret.embedAttrs);};this.Mod_AC_ GetArgs=function(args,ext,srcParamName,classid,mimeType){var ret=new Object();re t.embedAttrs=new Object();ret.params=new Object();ret.objAttrs=new Object();for( var i=0;i<args.length;i=i+2){var currArg=args[i].toLowerCase();switch(currArg){c ase"classid":break;case"pluginspage":ret.embedAttrs[args[i]]=args[i+1];break;cas e"src":case"movie":args[i+1]=this.AC_AddExtension(args[i+1],ext);ret.embedAttrs[ "src"]=args[i+1];ret.params[srcParamName]=args[i+1];break;case"onafterupdate":ca se"onbeforeupdate":case"onblur":case"oncellchange":case"onclick":case"ondblclick ":case"ondrag":case"ondragend":case"ondragenter":case"ondragleave":case"ondragov er":case"ondrop":case"onfinish":case"onfocus":case"onhelp":case"onmousedown":cas e"onmouseup":case"onmouseover":case"onmousemove":case"onmouseout":case"onkeypres s":case"onkeydown":case"onkeyup":case"onload":case"onlosecapture":case"onpropert ychange":case"onreadystatechange":case"onrowsdelete":case"onrowenter":case"onrow exit":case"onrowsinserted":case"onstart":case"onscroll":case"onbeforeeditfocus": case"onactivate":case"onbeforedeactivate":case"ondeactivate":case"type":case"cod ebase":case"id":ret.objAttrs[args[i]]=args[i+1];break;case"width":case"height":c ase"align":case"vspace":case"hspace":case"class":case"title":case"accesskey":cas e"name":case"tabindex":ret.embedAttrs[args[i]]=ret.objAttrs[args[i]]=args[i+1];b reak;default:ret.embedAttrs[args[i]]=ret.params[args[i]]=args[i+1];}} ret.objAttrs["classid"]=classid;if(mimeType)ret.embedAttrs["type"]=mimeType;retu rn ret;} if(typeof scribd_view_callback!="undefined"){scribd_view_callback();}}} /* public/javascripts/iPaper.js @ 1319142822 */ var vFlashScrollbar;var hFlashScrollbar;var iPaperSearchPlaceholder="Search with in document";var iPaperSearchSummaryPlaceholder="Enter a search query below";var iPaperSearchPlaceholderDisplayed=true;var iPaperIsFullscreen=false;var sidebarI sOpen=false;var calculateScrollbarWidth=function(){if(!document.body){if(Prototy pe.Browser.IE){return 17} return 15} var inner=document.createElement('p');inner.style.width="100%";inner.style.heigh t="200px";var outer=document.createElement('div');outer.style.position="absolute ";outer.style.top="0px";outer.style.left="0px";outer.style.visibility="hidden";o uter.style.width="200px";outer.style.height="150px";outer.style.overflow="hidden ";outer.appendChild(inner);document.body.appendChild(outer);var w1=inner.offsetW idth;outer.style.overflow='scroll';var w2=inner.offsetWidth;if(w1==w2)w2=outer.c lientWidth;document.body.removeChild(outer);return(w1-w2);};var setViewModeSelec ted=function(mode) {switch(mode){case"list":$('view_mode_selector').selectedIndex=0;break;case"book ":$('view_mode_selector').selectedIndex=1;break;case"slide":$('view_mode_selecto r').selectedIndex=2;break;case"tile":$('view_mode_selector').selectedIndex=999;b reak;}} var iPaperSetDimensions=function(ipaper_width,ipaper_height) {ipaper_width=ipaper_width view_page.ipaper_width;ipaper_height=ipaper_height view_page.ipaper_height;var containerHeightStyle=(ipaper_height+$('ipaper_toolba r').getHeight()).toString()+"px";$('iPaper').style.width=(ipaper_width-scrollBar ContainerSize-2).toString()+"px";$('iPaper').style.height=(ipaper_height-scrollB arContainerSize-2).toString()+"px";$('h_scroll_box').style.width=(ipaper_width-s crollBarContainerSize).toString()+"px";$('h_scroll_box').style.height=scrollBarC

ontainerSize.toString()+"px";$('rightScrollBarContainer').style.width=rightScrol lBarContainerSize.toString()+"px";$('v_scroll_box').style.width=scrollBarContain erSize.toString()+"px";$('v_scroll_box').style.height=(ipaper_height-2).toString ()+"px";$('ipaper_container').style.width=ipaper_width.toString()+"px";$('ipaper _container').style.height=containerHeightStyle;$('ipaper_placeholder').style.wid th=ipaper_width.toString()+"px";$('ipaper_placeholder').style.height=ipaper_heig ht.toString()+"px";if(sidebarIsOpen) {$('ipaper_absolute_container').style.width=(ipaper_width).toString()+"px";}else {$('ipaper_absolute_container').style.width=ipaper_width.toString()+"px";} $('ipaper_absolute_container').style.height=containerHeightStyle;} var resetSearchElements=function(){var el=$('ipaper_document_search') if(iPaperIsFullscreen){el=$('ipaper_document_toolbar_search')} el.style.color="#bbb";el.value=iPaperSearchPlaceholder;iPaperSearchPlaceholderDi splayed=true;$('search_results_summary').innerHTML=iPaperSearchSummaryPlaceholde r;$('sidebar_results_content').innerHTML="";} var clearSearch=function() {resetSearchElements() doc.api.updateSearchQuery("");doc.api.closeSearchPanel();} var closeSideBar=function(ipaper_height) {$('ipaper_absolute_container').style.width=(parseInt($('ipaper_absolute_contain er').style.width,10)-iPaperSidebarWidth).toString()+"px";$('ipaper_sidebar_conta iner').style.width="0";$('ipaper_sidebar_container').hide();$('ipaper_toolbar'). removeClassName('sidebar_open');$('ipaper_document_toolbar_search').show();$('ip aper_toolbar_search_submit').show();sidebarIsOpen=false;$('ipaper_document_searc h').stopObserving("keyup");clearSearch();} var openSideBar=function() {var ipaper_height=$('ipaper_container').getHeight();$('search_results_summary') .innerHTML=iPaperSearchSummaryPlaceholder;$('ipaper_sidebar_container').show();$ ('ipaper_sidebar_container').style.width=iPaperSidebarWidth.toString()+"px";if(! iPaperIsFullscreen){$('ipaper_absolute_container').style.width=($('ipaper_absolu te_container').getWidth()+$('ipaper_sidebar_container').getWidth()).toString()+" px";} $('ipaper_sidebar_container').style.height=ipaper_height.toString()+"px";$('side bar_results').style.height=(ipaper_height-($('search_results_summary_container') .getHeight())-$('sidebar_footer').getHeight()-1).toString()+"px";$('ipaper_toolb ar').addClassName('sidebar_open');$('ipaper_document_search').focus();$('ipaper_ document_search').observe("keyup",iPaperCallbacks.onSearchKeyUp.bindAsEventListe ner(iPaperCallbacks));sidebarIsOpen=true;} var _updateFullscreenDimensions=function() {var PADDING=10;var TOP_PADDING=15;var TOOLBAR_HEIGHT=65;var IPAPER_TOOLBAR_HEIG HT=28;var targetWidth=document.viewport.getWidth()-2*PADDING;var targetHeight=do cument.viewport.getHeight()-(PADDING+TOP_PADDING+TOOLBAR_HEIGHT+IPAPER_TOOLBAR_H EIGHT);iPaperSetDimensions(targetWidth,targetHeight);} var updateFullscreenDimensions=function() {if(!doc.api) return false;_updateFullscreenDimensions() setTimeout("_updateFullscreenDimensions()",10)} var iPaperCallbacks={onResizeScrollbar:function(event) {if(vFlashScrollbar&&hFlashScrollbar) {vFlashScrollbar.updatePositionAndMax();hFlashScrollbar.updatePositionAndMax();} },onRepositionScrollbar:function(event) {if(vFlashScrollbar&&hFlashScrollbar) {vFlashScrollbar.onPositionUpdateRequested();hFlashScrollbar.onPositionUpdateReq uested();}},onShareEmbedClick:function(e) {doc.api.showSharePanel();},onSearchSubmit:function(e) {var query=$('ipaper_document_search').value;if(query.length==1) doc.api.updateSearchQuery(query);doc.api.executeSearchQuery(!iPaperIsFullscreen) ;},onSearchFocus:function(e) {$('ipaper_document_search').style.color="#333";if(iPaperSearchPlaceholderDispla yed)

{$('ipaper_document_search').value="";iPaperSearchPlaceholderDisplayed=false;}}, onSearchBlur:function(e) {var el=$('ipaper_document_search') if(iPaperIsFullscreen){el=$('ipaper_document_toolbar_search')} if(el.value=="") {clearSearch()}},onSearchKeyUp:function(e) {var query=$('ipaper_document_search').value;if(iPaperIsFullscreen){query=$('ipa per_document_toolbar_search').value;} if(e.keyCode==Event.KEY_RETURN) {this.onSearchSubmit();} else if(e.keyCode==Event.KEY_ESC) {$('ipaper_document_search').blur();} else if(e.keyCode!=Event.KEY_TAB&&e.keyCode!=Event.KEY_UP&&e.keyCode!=Event.KEY_ DOWN&&e.keyCode!=Event.KEY_LEFT&&e.keyCode!=Event.KEY_RIGHT) {if(query.length<=1){query=""} doc.api.updateSearchQuery(query);}},onFlashSearchResults:function(results) {var resultString="";var query=results['query'].escapeHTML();var queryRegExp=new RegExp(query.replace(/[^\w^\s^\d]/gi,''),'i');var selectedMatch="";var matchInd ex=0;var index=0 var pages=results["results"] if(!pages pages.length==0){return} var chunks=new Array() for(var i=0;i<pages.length;i++){var pageArray=pages[i] if(!pageArray){continue} chunks.push("<h6>Page "+i.toString()+"</h6><ul>") for(var j=0;j<pageArray.length;j++){var match=pageArray[j] if(!match){continue} var hash=$H(match) selectedMatch=hash.get('context').escapeHTML();matchPosition=hash.get('position' );selectedMatch=selectedMatch.strip() chunks.push("<li onclick='iPaperCallbacks.onSearchResultClick("+matchIndex+")'>" );if(selectedMatch.charAt(0)==selectedMatch.charAt(0).toLowerCase()) chunks.push("...");selectedMatch=selectedMatch.gsub(queryRegExp,function(match){ return"<span class='match'>"+match+"</span>"});if(selectedMatch.charAt(selectedM atch.length-1)!="."){chunks.push(selectedMatch) chunks.push("... </li>");} matchIndex++;} chunks.push("</ul><br/>");index++} var resultString=chunks.join('') $('search_results_summary').innerHTML=matchIndex.toString()+' matches for "'+que ry+'"';$('sidebar_results_content').innerHTML=resultString;},onSearchResultClick :function(matchIndex) {doc.api.highlightSearchMatchByIndex(matchIndex);this.onRepositionScrollbar();}, onToolbarSearchClick:function() {if(!iPaperIsFullscreen){$('ipaper_document_toolbar_search').hide();$('ipaper_to olbar_search_submit').hide();window.openSideBar();} else{var v=$("ipaper_document_toolbar_search").value if(v==iPaperSearchPlaceholder){$("ipaper_document_toolbar_search").value="" $('ipaper_document_toolbar_search').observe("keyup",iPaperCallbacks.onSearchKeyU p.bindAsEventListener(iPaperCallbacks));doc.api.executeSearchQuery(false);}}},on TextSelectionClick:function(e) {if($('ipaper_text_selection').hasClassName('ipaper_selected')) {$('ipaper_text_selection').removeClassName('ipaper_selected');} else {$('ipaper_text_selection').addClassName('ipaper_selected');} doc.api.toggleCursorMode();},onListClick:function(e) {doc.api.setViewMode('list');},onBookClick:function(e) {doc.api.setViewMode('book');},onSlideClick:function(e) {doc.api.setViewMode('slide');},onPrevPageClick:function(e) {doc.api.gotoPrevPage();},onNextPageClick:function(e)

{doc.api.gotoNextPage();},onTileClick:function(e) {if($('ipaper_tile').hasClassName('ipaper_selected')) {$('ipaper_tile').removeClassName('ipaper_selected');} else {$('ipaper_tile').addClassName('ipaper_selected');} doc.api.toggleTileMode();},onViewModeChange:function(e) {var mode=doc.api.getViewMode();if(mode) setViewModeSelected(mode);$('ipaper_text_selection').removeClassName('ipaper_sel ected');if(mode!="tile") {$('ipaper_tile').removeClassName('ipaper_selected');}else{setViewModeSelected(" tile");}},onViewModeClicked:function(e) {switch($('view_mode_selector').selectedIndex){case 0:doc.api.setViewMode("list" );break;case 1:doc.api.setViewMode("book");break;case 2:doc.api.setViewMode("sli de");break;}},setPaginationLabel:function(curPage,pageCount) {if(curPage<=0 pageCount<=0) return;var chars=(curPage.toString()+pageCount.toString()).length+4;$('paginatio n_label').style.width=(0.47*chars).toString()+"em";$('ipaper_pagination').style. width=(0.47*chars+4).toString()+"em";$('pagination_label').innerHTML=curPage.toS tring()+" / "+pageCount.toString();},onPageChanged:function(e) {this.setPaginationLabel(doc.api.getPage(),doc.api.getPageCount());},oniPaperRea dy:function(e) {this.setPaginationLabel(doc.api.getPage(),doc.api.getPageCount());},onZoomInCli ck:function(e) {doc.api.interfaceZoomIn();},onZoomOutClick:function(e) {doc.api.interfaceZoomOut();},onDownloadClick:function(e) {if($('ipaper_download').hasClassName('link_open')) {$$('.ipaper_submenu_option.text_download').invoke('hide');$('ipaper_download'). innerHTML='Download';$('ipaper_download').removeClassName('link_open');} else {$$('.ipaper_submenu_option.text_download').invoke('show');$('ipaper_download'). innerHTML='Download:';$('ipaper_download').addClassName('link_open');}},onPrintC lick:function(startPage,endPage) {startPage=startPage 1;endPage=endPage 10;doc.api.interfacePrint(startPage,end Page);},onPrintDisabledClick:function(){alert('Sorry, printing is disabled for t his document!');},isPrintSupported:function(){return doc.api.isPrintSupported(); },onWindowResize:function(e){updateFullscreenDimensions()},enterFullScreen:funct ion(){if(iPaperIsFullscreen){return;} var PADDING=10;var TOP_PADDING=15;var TOOLBAR_HEIGHT=65;var xDelta,yDelta;if(sid ebarIsOpen){closeSideBar();} $('ipaper_absolute_container').addClassName("fullscreen");if(window._Scribd_resi ze) {window._Scribd_resize('ipaper_placeholder_container');} else if(_Scribd_resize) {_Scribd_resize('ipaper_placeholder_container');} var toolbar=new Element('div',{'id':'ipaper_toolbar_container'}) var ipaper_toolbar=$('ipaper_top_toolbar_inner_container').remove().addClassName ('fullscreen');var title=$('ipaper_title_wrapper').remove().addClassName('fullsc reen');title.select('.private').invoke('hide');$('ipaper_container').insert({top :ipaper_toolbar});$('ipaper_container').insert({top:title});if($('ipaper_uploade r_info')){var uploader_info=$('ipaper_uploader_info').remove().addClassName('ful lscreen');$('ipaper_container').insert({top:uploader_info});} $('ipaper_absolute_container').style.left=PADDING.toString()+"px";$('ipaper_abso lute_container').style.top=TOP_PADDING.toString()+"px";updateFullscreenDimension s() window.iPaperIsFullscreen=true;$('ipaper_placeholder_container').addClassName('f ullscreen_mode');doc.api.setFullscreen(true);Event.observe(window,'resize',this. onWindowResize);},exitFullScreen:function(){if(!iPaperIsFullscreen){return;} var PADDING=10;var TOP_PADDING=15;var TOOLBAR_HEIGHT=65;var xDelta,yDelta;Event. stopObserving(window,'resize',this.onWindowResize);var ipaper_toolbar=$('ipaper_ top_toolbar_inner_container').remove().removeClassName('fullscreen');var title=$

('ipaper_title_wrapper').remove().removeClassName('fullscreen');title.select('.p rivate').invoke('show');$('ipaper_title_container').insert({top:title});$('ipape r_top_toolbar_container').insert({top:ipaper_toolbar});if($('ipaper_uploader_inf o_container')){var uploader_info=$('ipaper_uploader_info').remove().removeClassN ame('fullscreen');$('ipaper_uploader_info_container').insert({top:uploader_info} );} if(window._Scribd_resize) {window._Scribd_resize('ipaper_placeholder_container');} else if(_Scribd_resize) {_Scribd_resize('ipaper_placeholder_container');} $('ipaper_absolute_container').style.left="0";$('ipaper_absolute_container').sty le.top="";$('ipaper_absolute_container').removeClassName("fullscreen");$('h_scro ll_box').style.display="block";$('v_scroll_box').style.display="block";iPaperSet Dimensions();iPaperCallbacks.onResizeScrollbar();window.iPaperIsFullscreen=false ;$('ipaper_placeholder_container').removeClassName('fullscreen_mode');clearSearc h() doc.api.setFullscreen(false);}} var directSetScrollPositions=function(verticalPosition,horizontalPosition) {vFlashScrollbar.updateScrollPositionDirect(verticalPosition);hFlashScrollbar.up dateScrollPositionDirect(horizontalPosition);} var directDisplaySearchResults=function(results) {iPaperCallbacks.onFlashSearchResults(results);} var FlashScrollbar=function(scrollBoxElement,scrollTrackElement,flashElement,isV ertical) {if(!(scrollBoxElement&&scrollTrackElement&&flashElement)) return;this.__isVertical=isVertical;this.__scrollBox=scrollBoxElement;this.__scr ollTrack=scrollTrackElement;this.__flash=flashElement;this.__ignoreScrollEvent=f alse;scrollBoxElement.observe("scroll",this.scrollPositionChanged.bindAsEventLis tener(this));} FlashScrollbar.prototype={updateScrollPositionDirect:function(position) {this.__ignoreScrollEvent=true;if(this.__isVertical) {if(this.__scrollBox.scrollTop==position) {return;} this.__scrollBox.scrollTop=position;}else{if(this.__scrollBox.scrollLeft==positi on) {return;} this.__scrollBox.scrollLeft=position;}},updateScrollPosition:function() {this.__ignoreScrollEvent=true;if(this.__isVertical) {this.__scrollBox.scrollTop=this.__flash.getVerticalScrollOffset();}else{this.__ scrollBox.scrollLeft=this.__flash.getHorizontalScrollOffset();}},scrollPositionC hanged:function() {if(this.__ignoreScrollEvent) {this.__ignoreScrollEvent=false;return;} if(this.__isVertical) {this.__flash.setVerticalScrollOffset(this.__scrollBox.scrollTop);} else {this.__flash.setHorizontalScrollOffset(this.__scrollBox.scrollLeft);}},updateSc rollMax:function() {var scrollTrackMax;var scrollTrackCurrent;if(this.__isVertical) {scrollTrackMax=this.__flash.getDocumentHeight();scrollTrackCurrent=parseInt(thi s.__scrollBox.style.height);this.__scrollTrack.style.height=scrollTrackMax+"px"; } else {scrollTrackMax=this.__flash.getDocumentWidth();scrollTrackCurrent=parseInt(this .__scrollBox.style.width)+scrollBarSize;this.__scrollTrack.style.width=scrollTra ckMax+"px";} if(scrollTrackMax<=scrollTrackCurrent) {if(this.__scrollBox.style.display=="block") {if(this.__isVertical) {$('iPaper').style.width=(parseInt($('iPaper').style.width)+scrollBarSize).toStr

ing()+"px";} else {$('iPaper').style.height=(parseInt($('iPaper').style.height)+scrollBarSize).toS tring()+"px";} this.__scrollBox.style.display="none";}} else if(scrollTrackMax>scrollTrackCurrent) {if(this.__scrollBox.style.display=="none") {if(this.__isVertical) {$('iPaper').style.width=(parseInt($('iPaper').style.width)-scrollBarSize).toStr ing()+"px";} else {$('iPaper').style.height=(parseInt($('iPaper').style.height)-scrollBarSize).toS tring()+"px";} this.__scrollBox.style.display="block";}}},updateScrollbarVisibility:function() {this.updateScrollMax();},onPositionUpdateRequested:function() {this.updateScrollPosition();},updatePositionAndMax:function() {this.updateScrollMax();this.updateScrollPosition();}};var onApiSetup=function() {vFlashScrollbar=new FlashScrollbar($('v_scroll_box'),$('v_scroll_track'),doc.ap i,true);hFlashScrollbar=new FlashScrollbar($('h_scroll_box'),$('h_scroll_track') ,doc.api,false);$('ipaper_toolbar').onselectstart=function(){return false;} $('ipaper_toolbar').style.MozUserSelect="none";$('view_mode_selector').observe(" change",iPaperCallbacks.onViewModeClicked.bindAsEventListener(iPaperCallbacks)); doc.addEventListener("viewModeChanged",iPaperCallbacks.onViewModeChange.bindAsEv entListener(iPaperCallbacks));doc.addEventListener("pageChanged",iPaperCallbacks .onPageChanged.bindAsEventListener(iPaperCallbacks));doc.addEventListener("iPape rReady",iPaperCallbacks.oniPaperReady.bindAsEventListener(iPaperCallbacks));}; /* public/javascripts/doc_view.js @ 1319142822 */ var ViewPage=Class.create({initialize:function(){this.edge_padding=50;this.top_h eight=269;this.bottom_padding=40;this.min_ipaper_width=640;this.min_ipaper_heigh t=540;this.view_right_bar=295;this.view_main=this.min_ipaper_width;this.view_con tainer=this.view_right_bar+this.view_main+20;this.ipaper_height=this.min_ipaper_ height;this.full_width_mode=false;this.ipaper_width=this.view_main;this.calculat e_dimensions();},calculate_dimensions:function(){this.width=1096;this.height=pag eHeight();if(this.width>this.view_container){var width_extra=this.width-this.vie w_container-this.edge_padding*2;if(width_extra>0) {this.view_main=this.view_main+width_extra;this.view_container=this.view_contain er+width_extra;this.ipaper_width=this.view_main;}} var height_extra=this.height-this.min_ipaper_height-this.bottom_padding-this.top _height;if(height_extra>0){this.ipaper_height+=height_extra;}},set_view_containe r:function(){$('view_container').style.width=this.view_container+'px';},set_view _main:function(){$('view_main').style.width=this.view_main+'px';},set_view_meta: function(){$('view_meta').style.width=this.view_main+'px';},set_full_width_mode: function(state){if(state){if(!this.full_width_mode){$('view_main').style.width=t his.view_container+'px';$('embedded_flash').firstDescendant().width=this.view_co ntainer;this.full_width_mode=true;}}else{if(this.full_width_mode){this.set_view_ main();$('embedded_flash').firstDescendant().width=this.view_main;this.full_widt h_mode=false;}}}});var wildfire_intialized=false;function update_document_view(d ocId){url='/word/document_update/'+docId;if(document.referrer){url+="?referer="+ encodeURIComponent(document.referrer);} new Ajax.Request(url,{asynchronous:true,evalScripts:true});} function setRatingBox(currentAverage,currentCount,currentRating,locked){var opti ons={buttons:5,className:'pointy',max:5,stars:5};if(currentRating!=null){options ['rated']=currentRating;options['rerate']=true;} if(currentCount!=null){options['total']=currentCount;} if(locked!=null){options['locked']=locked;} var rating=$('rating');if(rating){new Starbox(rating,currentAverage,options);ena bleRating();}}

Scribd.setTitleEditEvents=function(){$('doc_title_text').observe('mouseover',fun ction(e){this.addClassName('highlight');});$('doc_title_text').observe('mouseout ',function(e){this.removeClassName('highlight');});$('doc_title_text').observe(' click',function(e){$('doc_title_display').hide();$('doc_title_edit').show();});} Scribd.setDocInfoReveal=function(){$('metadata-about').select('.revealer').invok e('observe','click',function(){$('document_description_short').hide();});$('meta data-about').down('.to_reveal .less').observe('click',function(){$('document_des cription_short').show();$('metadata-about').down('.revealer').show();});} Scribd.documentEditForm=Class.create({initialize:function(){this.show_edit=$('do cinfo_tabs').down('.show_edit');this.cancel_edit=$('docinfo_tabs').down('.cancel _edit');this.revealer_link=$('metadata-about').down('.revealer');this.to_reveal= $('docinfo_wrapper').down('.to_reveal');this.edit_field_containers=$('document_d escription_edit_field','document_tags_edit_form','document_category_edit_form'); this.edit_view_containers=$$('#document_description_full > p, #document_tags_vie w > p, #document_category_view');this.form_footer=$('metadata-about').down('.for m_footer');this.spinner=this.form_footer.down('.spinner');this.doc_desc_short=$( 'document_description_short');this.uneditable=$$('.uneditable');this.doc_edit_op en=false;this.cancel_edit.observe('click',this.cancelEdit.bindAsEventListener(th is));this.form_footer.down('.cancel_edit').observe('click',this.cancelEdit.bindA sEventListener(this));this.show_edit.observe('click',this.startEdit.bindAsEventL istener(this));$('document_edit_form').observe('submit',this.submit.bindAsEventL istener(this));},submit:function(e){e.stop();var form=e.element();var params=For m.serializeElements($$('#document_description, #tags'),true);var cats=Form.seria lizeElements($$('#document_category_edit_form select'),true);if(Object.values(ca ts).size()>0){var category_id=("document[child_category_id]"in cats)?cats['docum ent[child_category_id]']:cats['document[top_category_id]'];params['category_id'] =category_id;} this.spinner.show();new Ajax.Request(form.action,{method:form.method,parameters: Object.toQueryString(params),onSuccess:function(){[this.spinner,this.cancel_edit ,this.show_edit,this.form_footer].invoke('toggle');Scribd.doc_edit_open=false;th is.edit_field_containers=$('document_description_edit_field','document_tags_edit _form','document_category_edit_form');this.edit_view_containers=$$('#document_de scription_full > p, #document_tags_view > p, #document_category_view');}.bind(th is)});},startEdit:function(e){e.stop();[this.to_reveal,this.form_footer,this.can cel_edit].concat(this.edit_field_containers).invoke('show');[this.revealer_link, this.show_edit,this.doc_desc_short,this.to_reveal.down('.less')].concat(this.edi t_view_containers,this.uneditable).invoke('hide');if($('doc_edit_undo')) $('doc_edit_undo').hide();if(!$('metadata-about').visible()&&!!window.metadata_t abs) metadata_tabs.activateTab($$('#docinfo_tabs li a[href~=#about]').first());this.d oc_edit_open=true;},cancelEdit:function(e){[this.to_reveal,this.form_footer,this .cancel_edit].concat(this.edit_field_containers).invoke('hide');[this.doc_desc_s hort,this.revealer_link,this.show_edit,this.to_reveal.down('.less')].concat(this .edit_view_containers,this.uneditable).invoke('show');this.doc_edit_open=false;S cribd.Remote.Link(e,{method:'get',onComplete:function(req){this.edit_field_conta iners=$('document_description_edit_field','document_tags_edit_form','document_ca tegory_edit_form');this.edit_view_containers=$$('#document_description_full > p, #document_tags_view > p, #document_category_view');}.bind(this)});}});Scribd.ge tMoreComments=function(e,id,page,extras){var url='/documents/'+id+'/comments?pag e='+page;extras=extras {};new Ajax.Request(url,{method:'get',parameters:extras, onComplete:function(req){var revealer=$('more_comments_container_'+page).down('. revealer');if(revealer) revealer.observe('click',Scribd.getMoreComments.bindAsEventListener(revealer,id, page+1,extras));document.fire('scribd:dom_height_changed');}});} Scribd.referrerIsGoogleSearch=function(){return document.referrer&&document.refe rrer.indexOf('www.google')>-1;} Scribd.referrerIsOtherSearch=function(){if(document.referrer){var engines=['bing .com','aol.com','ask.com','yahoo.com'];for(e in engines){if(document.referrer.in dexOf(engines[e])>-1)return true;}} return false;}

Scribd.staticLoadScript=function(url){document.write('<script src="',url,'" type ="text/javascript"><\/script>');} Scribd.showICComplete=function(container,tmpl){container=$(container);var nag_up date=function(req){container.insert({top:req.responseText});container.fire('Scri bd:dom_updated');Scribd.Facebook.getSharedFriends(container.down('.nag .facebook _friends'),6,tmpl,function(){new Effect.Appear(container.down('.nag'));});contai ner.down('#finish_signup').observe('click',Scribd.Facebook.upgradeAccount);conta iner.down('.dismiss a').observe('click',Scribd.Remote.Link.bindAsEventListener(c ontainer.down('.dismiss a'),{onCreate:function(){container.down('.nag').hide();} }));};new Ajax.Request('/nags?nag=complete_account',{method:'get',onComplete:nag _update});} /* public/javascripts/wildfire_wfapiv2.js @ 1319142822 */ if(typeof Wildfire=='undefined'){Wildfire=new Object();Wildfire.LinkedLoading=tr ue;Wildfire._pixeIframeCreated=false;Wildfire._NextZIndex=1000;} Wildfire.Flash={isIE:(navigator.appVersion.indexOf("MSIE")!=-1)?true:false,isWin :(navigator.appVersion.toLowerCase().indexOf("win")!=-1)?true:false,isOpera:(nav igator.userAgent.indexOf("Opera")!=-1)?true:false,getFlashVersion:function(){var version=-1;if(navigator.plugins!=null&&navigator.plugins.length>0){if(navigator .plugins["Shockwave Flash"]){var flashDescription=navigator.plugins["Shockwave F lash"].description;if(flashDescription!=null){version=flashDescription.split(" " )[2].split(".")[0];}}} else if(this.isIE&&this.isWin&&!this.isOpera){try{var axo=new ActiveXObject("Sho ckwaveFlash.ShockwaveFlash.7");var flashDescription=axo.GetVariable("$version"); }catch(e){} if(flashDescription!=null){version=flashDescription.split(" ")[1].split(",")[0]; }} return version;},AC_Generateobj:function(objAttrs,params,embedAttrs){var str=''; if(this.isIE&&this.isWin&&!this.isOpera){str+='<object ';for(var i in objAttrs){ str+=i+'="'+objAttrs[i]+'" ';} str+='>';for(var i in params){str+='<param name="'+i+'" value="'+params[i]+'" /> ';} str+='</object>';} else{str+='<embed ';for(var i in embedAttrs){str+=i+'="'+embedAttrs[i]+'" ';} str+='> </embed>';} return str;},AC_FL_GetContent:function(){var ret=this.AC_GetArgs(arguments);retu rn this.AC_Generateobj(ret.objAttrs,ret.params,ret.embedAttrs);},AC_GetArgs:func tion(args,classid,mimeType){var ret={};ret.embedAttrs={};ret.params={};ret.objAt trs={};for(var i=0;i<args.length;i=i+2){var currArg=args[i].toLowerCase();switch (currArg){case"movie":ret.embedAttrs["src"]=args[i+1];ret.params["movie"]=args[i +1];break;case"id":case"width":case"height":case"align":case"name":ret.embedAttr s[args[i]]=ret.objAttrs[args[i]]=args[i+1];break;default:ret.embedAttrs[args[i]] =ret.params[args[i]]=args[i+1];}} ret.objAttrs['codebase']='http://download.macromedia.com/pub/shockwave/cabs/flas h/swflash.cab#version=8,0,0,0';ret.objAttrs["classid"]="clsid:d27cdb6e-ae6d-11cf -96b8-444553540000";ret.embedAttrs["type"]="application/x-shockwave-flash";ret.e mbedAttrs['pluginspage']='http://www.macromedia.com/go/getflashplayer';return re t;}} Wildfire.onClose=Wildfire.onPostProfile=Wildfire.onPostComment=Wildfire.onSend=W ildfire.onEmail=function(){};Wildfire.modules=new Object();Wildfire.modulesArray =new Array();Wildfire.initShare=function(partner,targetId,width,height,config){r eturn Wildfire._createJSModule("share",''+partner,targetId,width,height,config,' cssURL,cornerRoundness,initialMessageType,domainForCallback,partner,source,partn erData,width,height,emailTabHidden,customCheckboxVisible,customCheckboxChecked,c ustomCheckboxText,'+'internalColor,frameColor,externalColor,tabTextColor,textCol or,fontType,fontSize,'+'headerInternalColor,headerFrameColor');} Wildfire.initPost=function(partner,targetId,width,height,config){return Wildfire ._createFlashModule("post",''+partner,targetId,width,height,config);}

Wildfire.init=Wildfire.initShare;Wildfire.applyConfig=function(config){if(isnotn ull(Wildfire.share))Wildfire.share.applyConfig(config);} Wildfire._GetFlashModuleXMLConfig=function(targetId){document.getElementById(tar getId).style.background='';var pdiv=document.getElementById(targetId+"_progress" );if(pdiv!=null){pdiv.innerHTML='&nbsp;';pdiv.style.display="none";pdiv.style.vi sibility="hidden";} xs=['config',[],['display',['width','height','showCodeBox','rememberMeVisible',' emailImportProviders','networksToShow','networksToHide','bookmarksToShow','bookm arksToHide','bulletinChecked','showEmail','showPost','showBookmark','showDesktop ','showCloseButton'],'body',['font=fontType','size=fontSize'],['background',['fr ame-color=frameColor','background-color=internalColor','corner-roundness=cornerR oundness'],'controls',[],['textboxes',[],['inputs',['color=textInputColor','back ground-color=textInputBackgroundColor','frame-color=textInputBorderColor']],'snb uttons',['color=tabTextColor snButtonsTextColor','background-color=snButtonsBack groundColor','frame-color=snButtonsFrameColor','over-color=tabTextColor snButton sOverTextColor','over-background-color=snButtonsOverBackgroundColor','over-frame -color=snButtonsOverFrameColor'],'buttons',['font=fontType buttonFontType','colo r=buttonTextColor']],'texts background-color="transparent" ',['color=textColor'] ,['messages',['color=messageTextColor'],'links',['font=linkFontType','color=link TextColor'],'privacy',['color=privacyTextColor']]]]];var oConfig=Wildfire._GetFl ashModuleConfig(targetId);var s=Wildfire._BuildXMLConfigFromJSON(oConfig,xs);ret urn s;} Wildfire._GetFlashModuleConfigAttribute=function(targetId,configAttribute,canBeT extareaID,network){document.getElementById(targetId).style.background='';var pdi v=document.getElementById(targetId+"_progress");if(pdiv!=null){pdiv.innerHTML='& nbsp;';pdiv.style.display="none";pdiv.style.visibility="hidden";} var module=Wildfire.modules[targetId];if(module!=null){var AttribValue=module.co nfig[configAttribute];if(typeof AttribValue=='undefined')return null;if(typeof A ttribValue=='function')return AttribValue(configAttribute,network);if(canBeTexta reaID==true){if(isnotnull(AttribValue)){try{var element=document.getElementById( AttribValue);if(isnotnull(element)){return element.value;} else{return AttribValue;}}catch(e){return AttribValue;}}} else{return AttribValue;}} else{return{error:'Modlue not found',MID:targetId};}} Wildfire._GetFlashModuleConfig=function(targetId){if(Wildfire.modules==null){ale rt('Wildfire has no modules yet');} var module=Wildfire.modules[targetId];if(module!=null){var res=module.config;ret urn res;} else{return null;}} Wildfire._BuildXMLConfigFromJSON=function(oConfig,xs){var s=new Array();try{for( var i=0;i<xs.length;i+=2){s[s.length]='<'+xs[i]+' ';var atts=xs[i+1];for(var ia= 0;ia<atts.length;ia++){var attrAndKeys=atts[ia].split('=');var key=attrAndKeys[0 ];var valkeys;if(attrAndKeys.length>1){valkeys=attrAndKeys[1]} else{valkeys=attrAndKeys[0];} var arrKeys=valkeys.split(' ') for(var ikey=0;ikey<arrKeys.length;ikey++){if(typeof oConfig[arrKeys[ikey]]!='un defined'){s[s.length]=key+'="';s[s.length]=(''+oConfig[arrKeys[ikey]]).replace(' &','&amp;').replace('"','&quot;').replace('<','&lt;').replace('>','&gt;');s[s.le ngth]='" ';break;}}} if(i+2==xs.length){s[s.length]='/>';} else{if(typeof xs[i+2]!='string'){s[s.length]='>';s[s.length]=Wildfire._BuildXML ConfigFromJSON(oConfig,xs[i+2]);s[s.length]='</'+xs[i].split(' ')[0]+'>';i++;} else{s[s.length]='/>';}}}} catch(e){} return s.join('');} Wildfire._createJSModule=function(moduleType,partner,targetId,width,height,confi g,getParams) {try{config.location=document.location.href;}catch(err){} config.partner=partner;config.width=width;config.height=height;if(undef(moduleTy pe) undef(partner) undef(targetId) undef(width) undef(height) undef(config)

)return;var module=this[targetId]=this.modules[targetId]=this.modulesArray[this. modulesArray.length]=new Wildfire._JSModule();module.copyConfig(config);module.r eady=false;module.type=moduleType;module.id=targetId;module.partner=partner;modu le.width=width;module.height=height;module.container=document.getElementById(tar getId);module.container.style.width=width+"px";module.container.style.height=hei ght+"px";module.qsParams=new Array();var getParamArray=getParams.split(',');for( var i=0;i<getParamArray.length;i++) Wildfire._addQSParam(module,getParamArray[i]);module.init(true);return module;}; Wildfire._origOnLoad=null;Wildfire._onLoad=function(evt) {Wildfire.onLoad=Wildfire._origOnLoad;if(Wildfire.LinkedLoading==false){if(Wildf ire._origOnLoad!=null){Wildfire._origOnLoad(evt);} return;} Wildfire.LinkedLoading=false;if(Wildfire._origOnLoad!=null){Wildfire._origOnLoad (evt);} if((evt.ModuleID==Wildfire.modulesArray[0].id)) {for(var i=1;i<Wildfire.modulesArray.length;i++) {if(!Wildfire.modulesArray[i].ready) {try{Wildfire.modulesArray[i].init(true);}catch(e){}}}}};Wildfire._createTextare aModule=function(width,height,config,targetId){var str='';var defaultContent=con fig.defaultContent;if(document.getElementById(defaultContent)!=null){defaultCont ent=document.getElementById(defaultContent).value;} if(!(config.UIConfig&&(config.UIConfig.indexOf('showCodeBox="false"')!=-1 confi g.UIConfig.indexOf("showCodeBox='false'")!=-1))){str+='<textarea style="width: ' +width+'px; height: '+height+'px">';str+=defaultContent;str+='</textarea>';} var container=document.getElementById(targetId);container.style.width=width+"px" ;container.style.height=height+"px";container.innerHTML=str;} Wildfire._createFlashModule=function(moduleType,partner,targetId,width,height,co nfig) {try{if(typeof config['bookmarkURL']=='undefined') config['bookmarkURL']=document.location.href;}catch(e){} if(Wildfire.LinkedLoading) {if(typeof Wildfire.onLoad!='undefined'&&Wildfire.onLoad!=Wildfire._onLoad) Wildfire._origOnLoad=Wildfire.onLoad;Wildfire.onLoad=Wildfire._onLoad;} var blnRecreate=false;var idxInArray;if(this.modules[targetId]!=null){blnRecreat e=true;document.getElementById(targetId).innerHTML='&nbsp;';idxInArray=this.modu les[targetId].idxInArray;} else{idxInArray=this.modulesArray.length;} try{config.location=document.location.href;}catch(err){} config.partner=partner;config.width=width;config.height=height;if(undef(moduleTy pe) undef(partner) undef(targetId) undef(width) undef(height) undef(config) )return;var module=new Wildfire._FlashModule();this.modulesArray[idxInArray]=thi s[targetId]=this.modules[targetId]=module;module.idxInArray=idxInArray;module.co pyConfig(config);module.queued=false;module.ready=false;module.type=moduleType;m odule.id=targetId;module.partner=partner;module.width=width;module.height=height ;module.container=document.getElementById(targetId);module.container.style.width =width+"px";module.container.style.height=height+"px";if(!Wildfire.LinkedLoading this.modulesArray.length==1 this.modulesArray[0].ready) {module.init(true);}else{module.queued=true;} return module;};Wildfire._raiseModulesUpdate=function() {var moduleList="";for(var key in this.modules)moduleList+=key+",";var eventData ={'type':'modulesUpdate','modules':moduleList};this._raiseSysEvent(eventData);} Wildfire._raiseSysSignoutEvent=function(){this._raiseSysEvent({'type':'signout'} );} Wildfire._raiseSysEvent=function(eventData) {if(this.modulesArray.length<=1)return;for(var key in this.modules){var rse=this .modules[key].raiseSysEvent;if(rse!=null){rse(eventData);}}} Wildfire._onFrameLoaded=function(moduleId) {var ui=document.getElementById(moduleId+"_UIFrame");if(ui!=null)ui.style.visibi lity="visible";var pdiv=document.getElementById(moduleId+"_progress");if(pdiv!=n ull)pdiv.style.display="none";this.modules[moduleId].UIFrame.style.visibility="v

isible";this.modules[moduleId].applyConfig();this.modules[moduleId].ready=true;s etTimeout("Wildfire._raiseModulesUpdate()",1500);};Wildfire._addQSParam=function (module,pName){if(def(typeof module.config)&&def(module.config[pName])){module.q sParams[module.qsParams.length]=pName+'='+Wildfire._URLEncode(module.config[pNam e]);}};Wildfire._URLEncode=function(s){if(encodeURIComponent){return encodeURICo mponent(s);} else{es=escape(s);return es.replace(/\+/g,'%2b').replace(/%20/g,'+').replace(/[\ /]/g,'%2f').replace(/%3D/g,'%3d');}};Wildfire._onCallback=Wildfire._raiseEvent=f unction(WFEvent){try{switch(WFEvent.type) {case'send':if(isnotnull(Wildfire.onSend)) Wildfire.onSend(WFEvent);break;case'postComment':if(isnotnull(Wildfire.onPostCom ment)) Wildfire.onPostComment(WFEvent);break;case'postProfile':if(isnotnull(Wildfire.on PostProfile)) var a=['Wildfire.onPostProfile({'];for(var p in WFEvent){a.push(p);a.push(':\'') ;a.push(WFEvent[p]);a.push('\'');a.push(',');} a.pop();a.push('})');window.setTimeout(a.join(''),1);break;case'close':if(isnotn ull(Wildfire.onClose)) Wildfire.onClose(WFEvent);if(isnotnull(Wildfire.modules[WFEvent.ModuleID].config .onClose)) Wildfire.modules[WFEvent.ModuleID].config.onClose(WFEvent);break;case'renderDone ':if(isnotnull(Wildfire.modules[WFEvent.ModuleID].config.onRenderDone)) Wildfire.modules[WFEvent.ModuleID].config.onRenderDone(WFEvent);break;case'load' :if(isnotnull(Wildfire.onLoad)) {Wildfire.modules[WFEvent.ModuleID].ready=true;Wildfire.onLoad(WFEvent);} break;case'email':if(isnotnull(Wildfire.onEmail)){Wildfire.onEmail(WFEvent);}}}c atch(err){}};Wildfire._Module=function(){} Wildfire._JSModule=function(){this.formsContainer=null;this.pingTimeout=null;} Wildfire._JSModule.prototype=new Wildfire._Module();Wildfire._FlashModule=functi on(){} Wildfire._FlashModule.prototype=new Wildfire._Module();Wildfire._JSModule.protot ype.pingOK=function(ok){window.clearTimeout(this.pingTimeout);this.config.safeMo de=!ok;this.init(false);} Wildfire._FlashModule.prototype.init=function(checkPing){var html='';if((''+this .config.isApply)!='true'&&this.config.hideProgress!=true){document.getElementByI d(this.id).style.background='url('+this.config.progressImageSrc+') no-repeat cen ter center';} var swf='http://cdn.gigya.com/WildFire/swf/wildfire_en.swf';if(this.config.lang! =null){swf='http://cdn.gigya.com/WildFire/swf/wildfire_'+this.config.lang+'.swf' ;} var wmode=(this.config.nowmode?'':'transparent');if(this.config.wmodeType)wmode= this.config.wmodeType;html+=Wildfire.Flash.AC_FL_GetContent('id','wfmodule_'+thi s.id,'name','wfmodule_'+this.id,'width',this.config.width,'height',this.config.h eight,'movie',swf,'quality','high','align','middle','play','true','loop','true', 'scale','showall','wmode',wmode,'devicefont','false','bgcolor',((this.config.now mode&&this.config.outsideColor)?this.config.outsideColor:'#ffffff'),'menu','true ','allowFullScreen','false','allowScriptAccess','always','salign','','flashvars' ,'ModuleID='+this.id+'&now='+(new Date()).getTime(),'swLiveConnect','true') window['wfmodule_'+this.id]=null;if(!Wildfire._pixeIframeCreated){html+="<iframe src='http://cdn.gigya.com/wildfire/do_not_delete.htm' style='width:0;height:0;v isibility:hidden' />";Wildfire._pixeIframeCreated=true;} this._injectWFCode(html);window['wfmodule_'+this.id]=document.getElementById('wf module_'+this.id);} Wildfire._IsModuleReady=function(targetId){return(window['wfmodule_'+targetId]!= null)} Wildfire._JSModule.prototype.init=function(checkPing) {var wfroot='http://wildfire.gigya.com/wildfire';var id=this.id;var uifid=id+'_U IFrame';var cfg=this.config;if(!cfg.safeMode&&checkPing&&this.pingTimeout==null) {var script=document.createElement("script");script.src=wfroot+'/jsping.ashx?mid ='+id+"&rand="+Math.random()+Math.random();this.container.appendChild(script);th

is.pingTimeout=window.setTimeout("Wildfire.modules['"+id+"'].pingOK(false)",1000 0);return;} var qs=this.qsParams.join('&');qs+=("&mid="+id);var html="";var formsHTML="";var UIURL=wfroot+'/'+this.type+"Main.aspx?"+qs;if(cfg.safeMode){UIURL=this.getSafeM odeURL();if(UIURL==null){Wildfire[id]=Wildfire.modules[id]=Wildfire.modulesArray [Wildfire.modulesArray.length]=null;return null;} html+="<iframe allowtransparency='true' id="+uifid+" name="+uifid+" style='width :"+cfg.width+"px;height:"+cfg.height+"px;display:inherit;visibility:inherit' fra meborder=0 scrolling=no></iframe>";formsHTML+="<form id='"+id+"_postForm' action ='"+UIURL+"' method='POST' target="+uifid+" style='display:none'></form>";} else if(cfg.simple){if(this.type=="share")UIURL=wfroot+'/shareSimple.aspx';if(UI URL==null){Wildfire[id]=Wildfire.modules[id]=Wildfire.modulesArray[Wildfire.modu lesArray.length]=null;return null;} html+="<iframe allowtransparency='true' id="+uifid+" name="+uifid+" style='width :"+cfg.width+"px;height:"+cfg.height+"px;display:inherit;visibility:inherit' fra meborder=0 scrolling=no></iframe>";formsHTML+="<form id='"+id+"_postForm' action ='"+UIURL+"' method='POST' target="+uifid+" style='display:none'></form>";}else{ html+="<div style='position:relative;top:50%;text-align:center;font-size:12px;' id='"+id+"_progress'><center><img src='"+cfg.progressImageSrc+"'></center></div >";html+="<iframe allowtransparency='true' onload='Wildfire._onFrameLoaded(\""+i d+"\")' id="+uifid+" style='visibility:hidden;width:"+cfg.width+"px;height:"+cfg .height+"px;' src='"+UIURL+"' frameborder=0 scrolling=no></iframe>";html+='<ifra me id="IFREndlessActivityBugFix" style="display:none;width:100px;height:10px"></ iframe>';html+=this._createCBFrame();formsHTML+="<form id='"+id+"_postForm' acti on='"+wfroot+"/WFHandler.ashx?cmd=config' method='POST' target='"+id+"_postTarge tFrame' style='display:none'></form>";formsHTML+="<form id='"+id+"_sysEventForm' action='"+wfroot+"/WFHandler.ashx?cmd=sysEvent' method='POST' target='"+id+"_sy sEventFrame' style='display:none'></form>";} this._injectWFCode(html,formsHTML);if(document.getElementById(id+"_wfCBFrame")== null){cfg.domainForCallback=null;} this.UIFrame=document.getElementById(id+"_UIFrame");this.postForm=document.getEl ementById(id+"_postForm");this.sysEventForm=document.getElementById(id+"_sysEven tForm");if(cfg.simple cfg.safeMode)this.applyConfig();} Wildfire._JSModule.prototype._createCBFrame=function() {if(def(this.config.domainForCallback)&&document.getElementById(this.id+'_wfCBDi v')==null) {try{document.domain=this.config.domainForCallback;return"<iframe name='"+this.i d+"_wfCBFrame' style='visibility:hidden;width:0px;height:0px;' src='http://wildf ire."+this.config.domainForCallback+"/wildfire/WFHandler.ashx?domain="+escape(th is.config.domainForCallback)+"'></iframe>";}catch(ex){return"";}}else{return"";} } Wildfire._FlashModule.prototype.copyConfig=Wildfire._JSModule.prototype.copyConf ig=function(config) {if(config!=null){this.config={};for(var key in config)this.config[key]=config[k ey];} if(undef(this.config.progressImageSrc))this.config.progressImageSrc="http://cdn. gigya.com/WildFire/i/progress_ani.gif";if(undef(this.config.simple))this.config. simple=navigator.userAgent.toLowerCase().indexOf('safari')!=-1;} Wildfire._JSModule.prototype.getSafeModeURL=function(){if(this.type=="share")ret urn"http://backup.gigya.com/WFSimple/share.aspx";return null;} Wildfire._JSModule.prototype._injectWFCode=function(html,formsHTML){var el=this. container;for(;((el!=null)&&((''+el.tagName).toLowerCase()!='form'));el=el.paren tNode);if(el!=null){this.container.innerHTML=html;this.formsContainer=document.c reateElement('div');this.formsContainer.style.display='none';el.parentNode.inser tBefore(this.formsContainer,el);this.formsContainer.innerHTML=formsHTML;}else {this.container.innerHTML=html+formsHTML;}};Wildfire._FlashModule.prototype._inj ectWFCode=function(html){this.container.innerHTML=html;};Wildfire._JSModule.prot otype.raiseSysEvent=function(eventData){if(this.sysEventForm==null !this.ready) return;var s=new Array();var i=0;for(var key in eventData){if(typeof key!='funct ion'&&eventData[key]!=null){s[i++]="<input type=hidden name='"+key+"'/>"}}

this.sysEventForm.innerHTML=s.join('');for(var i=0;i<this.sysEventForm.length;i+ +){this.sysEventForm[i].value=eventData[this.sysEventForm[i].name];} this.sysEventForm.submit();};Wildfire._FlashModule.prototype.applyConfig=functio n(conf){conf.isApply="true";return Wildfire._createFlashModule(this.type,this.pa rtner,this.id,this.width,this.height,conf);};Wildfire._JSModule.prototype.applyC onfig=function(conf){if(conf!=null)this.copyConfig(conf);var cfg=this.config;if( cfg==null)return;if(cfg.location==null cfg.location==""){try{cfg.location=docum ent.location.href;}catch(err){}} cfg.partner=this.partner;cfg.width=this.width;cfg.height=this.height;postContent =['default','myspace','hi5','friendster','xanga','livejournal','freewebs','faceb ook','bebo','blogger','tagged','typepad','blackplanet'];for(var pci=0;pci<postCo ntent.length;pci++){this._getTemplate(postContent[pci]+'Content');} shareTemplates=['default','comment','email','myspace','hi5','friendster','xanga' ,'freewebs'];for(var sti=0;sti<shareTemplates.length;sti++){this._getTemplate(sh areTemplates[sti]+'Template');} var s=new Array();var i=0;for(var key in cfg){if(typeof key!='function'&&cfg[key ]!=null){s[i++]="<input type=hidden name='"+key+"'/>"}} this.postForm.innerHTML=s.join('');for(var i=0;i<this.postForm.length;i++){this. postForm[i].value=this.config[this.postForm[i].name];} this.postForm.submit();window.setTimeout('Wildfire._EndlessActivityBugFix();',10 00);};Wildfire._EndlessActivityBugFix=function(){var ifr=document.getElementById ('IFREndlessActivityBugFix');if(ifr!=null){ifr.src='http://cdn.gigya.com/wildfir e/i/n.gif';}};Wildfire._JSModule.prototype._getTemplate=function(key){if(isnotnu ll(this.config[key])){try{if(isnotnull(document.getElementById(this.config[key]) )) this.config[key]=document.getElementById(this.config[key]).value;}catch(e){}}};W ildfire._CopyAtts=function(t,s,atts){for(k in atts.split(',')){t[atts[k]]=s[atts [k]];}} Wildfire._CopyAllAtts=function(t,s){for(k in s){t[k]=s[k];}} function undef(o){return(typeof(o)=='undefined');} function def(o){return(typeof(o)!='undefined');} function isnotnull(o){return(def(o)&&(o!=null));} function WFQueue(){var queue=new Array();var queueSpace=0;this.count=function() {return queue.length;} this.enqueue=function(element){queue.push(element);} this.dequeue=function(){if(queue.length){var element=queue[queueSpace];if(++queu eSpace*2>=queue.length){for(var i=queueSpace;i<queue.length;i++)queue[i-queueSpa ce]=queue[i];queue.length-=queueSpace;queueSpace=0;} return element;}else{return undefined;}}} Wildfire._GetElementPos=function(obj){var curleft=curtop=0;if(obj.offsetParent){ do{curleft+=obj.offsetLeft;curtop+=obj.offsetTop;}while(obj=obj.offsetParent);}; return{left:curleft,top:curtop};} Wildfire._HandleEmbedAndObjectsBelow=function(container,w,h){var blnHide=true;va r cpos=Wildfire._GetElementPos(container);var ctop=cpos.top;var cleft=cpos.left; var cright=cleft+w;var cbottom=ctop+h;var tags;if(Wildfire.Flash.isIE){tags=['if rame'];} else{tags=['embed','iframe'];} for(var itag=0;itag<tags.length;itag++){tagname=tags[itag];elements=document.get ElementsByTagName(tagname);for(var i=0;i<elements.length;i++){var el=elements[i] ;if(el.style.visibility!='hidden'&&container.childNodes[0]!=el){var epos=Wildfir e._GetElementPos(el);var etop=epos.top;var eleft=epos.left;var elcs=(document.de faultView)?document.defaultView.getComputedStyle(el,""):el.currentStyle;var erig ht=eleft+parseInt(elcs.getPropertyValue?elcs.getPropertyValue('width'):elcs.widt h);var ebottom=etop+parseInt(elcs.getPropertyValue?elcs.getPropertyValue('height '):elcs.height);if(!((etop>cbottom) (ebottom<ctop) (eleft>cright) (eright<cle ft))){var isNonGigyaIframe=(tagname=='iframe')&&((el.id+' ').substr(0,1 0)!='gigya_ifr_');if(((tagname=='embed')&&((el.getAttribute('wmode')==null) (el .getAttribute('wmode')=='') (el.getAttribute('wmode')=='window'))) isNonGigyaI frame){if(blnHide&&(container.id!='coreDiv')){el.style.visibility='hidden';if(co ntainer.elementsToShowOnClose==null)container.elementsToShowOnClose=[];container

.elementsToShowOnClose.push(el);}}}}}}} Wildfire._CreateContainer=function(id,noIframe){var ifrel;if(Wildfire.Flash.isIE &&Wildfire.Flash.isWin&&!noIframe){ifrel=document.createElement('IFRAME');ifrel. id='gigya_ifr_'+id;ifrel.frameBorder="0";ifrel.style.border='0px';ifrel.style.po sition='absolute';ifrel.style.width='1px';ifrel.style.height='1px';if(ifrel.styl e.zIndex!=null){ifrel.style.zIndex=Wildfire._NextZIndex++;}} var el=document.createElement('div');el.style.position='absolute';if(el.style.zI ndex!=null){el.style.zIndex=Wildfire._NextZIndex++;} var html='';el.innerHTML=html;el.id=id;el.swfLoaded=false;if(document.body){if(d ocument.body.insertBefore){if(document.body.firstChild){if(ifrel!=null)document. body.insertBefore(ifrel,document.body.firstChild);document.body.insertBefore(el, document.body.firstChild);}}} return el;} Wildfire._hideWildfirePopup=function(o){var wildfireDiv=document.getElementById( o.ModuleID) var ifr=document.getElementById('gigya_ifr_'+o.ModuleID) if(ifr!=null)ifr.style.visibility='hidden';var elementsToShowOnClose=wildfireDiv .elementsToShowOnClose;if(elementsToShowOnClose!=null){for(var i=0;i<elementsToS howOnClose.length;i++){elementsToShowOnClose[i].style.visibility='';}} wildfireDiv.style.visibility='hidden';} if(typeof Wildfire._popupConfigs=='undefined'){Wildfire._popupConfigs=[];} Wildfire.drawWildfireButton=function(params){if(typeof params.w=='undefined')par ams.w=400;if(typeof params.h=='undefined')params.h=300;if(params.b==null){params .b='click';} var altText='';if(typeof(params.btnurl)=='undefined'){switch(params.conf['module ']){case'bookmarks':params.btnurl='http://cdn.gigya.com/wildfire/i/bookmark_butt on.gif';break;case'post':default:params.btnurl='http://cdn.gigya.com/wildfire/i/ post-to-button.gif';}} switch(params.conf['module']){case'bookmarks':altText='Add to bookmarks';params. conf["showBookmark"]="true";params.conf["showEmail"]="false";params.conf["showPo st"]="false";break;case'post':params.conf["showEmail"]="true";params.conf["showB ookmark"]="true";default:altText='Post to my social network or blog';} switch(params['theme']){case'1':params.conf['UIConfig']='<config><display showEm ail="true" useTransitions="true" showBookmark="true"></display><body corner-roun dness="8"><background gradient-color-begin="#00006D" gradient-color-end="#28516D "></background><controls><snbuttons type="textUnder" background-color="#FFFFFF" over-background-color="#FFFFFF" color="DEE8EC" corner-roundness="0;10;0;10" size ="11" bold="true" over-color="#FFFFC8"></snbuttons><textboxes><codeboxes color=" #6A6A6A" frame-color="#0D1B6D" background-color="DEE8EC"></codeboxes><inputs gra dient-color-begin="E9F0F3" gradient-color-end="E9F0F3"></inputs><dropdowns listitem-over-color="#1B0D6D" gradient-color-begin="E9F0F3" gradient-color-end="E9F0 F3" list-item-over-gradient-color-end="#28516D"></dropdowns></textboxes><buttons gradient-color-begin="#0099FF" gradient-color-end="#223276" color="#FFFFFF" cor ner-roundness="0;8;0;8" font="arial" size="11" bold="true" over-gradient-color-b egin="#0099FF" over-gradient-color-end="#0099FF"></buttons><servicemarker gradie nt-color-begin="Transparent" gradient-color-end="#0098FE"></servicemarker></cont rols><texts color="#FFFFFF" bold="true"><privacy color="#AAAAAA"></privacy><labe ls color="C1D7E5"></labels><messages color="#F4F4F4" background-color="#1B366D" bold="true"></messages><links color="E9F0F3" underline="false" over-color="#ADC8 FF"></links></texts></body></config>';break;case'2':params.conf['UIConfig']='<co nfig><display showDesktop="false" showEmail="true" useTransitions="true" showBoo kmark="true" codeBoxHeight="auto" showCodeBox="true" showCloseButton="false" bul letinChecked="false" networksWithCodeBox=""></display><body corner-roundness="8" ><background frame-color="Transparent" gradient-color-begin="#353535" gradient-c olor-end="#606060" corner-roundness="8;8;8;8"></background><controls size="11" b old="true"><snbuttons type="textUnder" frame-color="#6D0000" background-color="# FFFFFF" over-background-color="#FFFFFF" color="#CACACA" corner-roundness="0;8;8; 8" gradient-color-begin="#8A8A8A" gradient-color-end="#000000" font="Arial" size ="11" bold="false" over-gradient-color-begin="#AAAAAA" over-gradient-color-end=" #000000" over-color="#F4F4F4" down-color="#000000"><more frame-color="Transparen

t"></more></snbuttons><textboxes frame-color="#000000" color="#AAAAAA" corner-ro undness="0;0;0;0" gradient-color-begin="#202020" gradient-color-end="#0B0B0B" fo nt="Arial" bold="false"><codeboxes color="#EAEAEA" frame-color="#8A8A8A" gradien t-color-begin="#000000" font="Arial" bold="false"></codeboxes><inputs frame-colo r="#6D0000"></inputs><dropdowns frame-color="#6D0000" handle-gradient-color-begi n="#B60000" handle-gradient-color-end="#6D0000" handle-over-gradient-color-begin ="#FF0000" handle-over-gradient-color-end="#DA0000" handle-down-gradient-color-b egin="#FF0000" handle-down-gradient-color-end="#6D0000" background-color="#6D000 0" gradient-color-begin="#000000" font="Arial" bold="false"></dropdowns></textbo xes><buttons frame-color="#FF0000" gradient-color-begin="#FF2424" gradient-color -end="#6D0000" color="#F4F4F4" corner-roundness="0;8;8;8" font="Arial" size="10" bold="false" down-frame-color="#000000" over-gradient-color-begin="#DA0000" dow n-gradient-color-begin="#910000" over-gradient-color-end="#DA0000" down-gradient -color-end="#FF0000" over-color="#F4F4F4"><post-buttons gradient-color-begin="#F F4949" gradient-color-end="#6D0000"></post-buttons></buttons><listboxes corner-r oundness="5"></listboxes><checkboxes down-corner-roundness="0"></checkboxes><ser vicemarker gradient-color-begin="#DA0000" gradient-color-end="#DA0000"></service marker></controls><texts color="#FFFFFF" font="Arial" size="10"><privacy color=" #959595" size="11"></privacy><headers size="11" bold="true"></headers><labels si ze="11" bold="true"></labels><messages color="#D5D5D5" frame-thickness="0" corne r-roundness="0;0;0;0" gradient-color-begin="#B60000" gradient-color-end="#000000 " size="11" bold="true"></messages><links color="#DFDFDF" underline="false" size ="11" bold="true" over-color="#FFFFFF"></links></texts></body></config>';break;c ase'3':params.conf['UIConfig']='<config><display showDesktop="false" showEmail=" true" useTransitions="true" showBookmark="true" codeBoxHeight="auto" showCodeBox ="true" showCloseButton="false" bulletinChecked="false" networksWithCodeBox="">< /display><body corner-roundness="8"><background frame-color="Transparent" gradie nt-color-begin="#DA0000" gradient-color-end="#FFC8AD" corner-roundness="8;8;8;8" ></background><controls size="11" bold="true"><snbuttons type="textUnder" framecolor="#DA0000" background-color="#FFFFFF" over-frame-color="#F4F4F4" over-backg round-color="#FFFFFF" color="#6D0000" corner-roundness="0;8;8;8" gradient-colorbegin="#6D0000" gradient-color-end="#6D0000" font="Arial" size="11" bold="true" down-frame-color="#6D0000" over-gradient-color-begin="#FFAD9F" down-gradient-col or-begin="#910000" over-gradient-color-end="#6D0D1B" down-gradient-color-end="#F FAD9F" over-color="#F4F4F4" down-color="#000000"><more frame-color="#AAAAAA" ove r-frame-color="#AAAAAA" gradient-color-begin="#DA0000" over-gradient-color-begin ="#FF5B40"></more><previous frame-color="#AAAAAA" background-color="DBDBDB" over -frame-color="#6D0000" over-background-color="#6A6A6A" gradient-color-begin="#FF 5B40" gradient-color-end="#6D0D1B" down-frame-color="6D0000" down-background-col or="DBDBDB" over-gradient-color-begin="#910000" down-gradient-color-begin="FF5B4 0" over-gradient-color-end="#FFAD9F" down-gradient-color-end="6D0D1B"></previous ></snbuttons><textboxes frame-color="#353535" color="#F4F4F4" corner-roundness=" 0;0;0;0" gradient-color-begin="#202020" gradient-color-end="#0B0B0B" font="Arial " bold="false"><codeboxes color="#1B366D" frame-color="#DA0000" gradient-color-b egin="#EAEAEA" gradient-color-end="#F4F4F4" font="Arial" bold="false"></codeboxe s><inputs frame-color="#B60000" color="#606060" gradient-color-begin="#DFDFDF" g radient-color-end="#DFDFDF"></inputs><dropdowns list-item-over-color="#FF2424" f rame-color="#B60000" handle-gradient-color-begin="#AEC8F7" handle-gradient-color -end="#6D0000" handle-over-gradient-color-begin="#AEC8F7" handle-over-gradient-c olor-end="#AEC8F7" handle-down-gradient-color-begin="#FF0000" handle-down-gradie nt-color-end="#6D0000" background-color="#EAEAEA" color="#4A4A4A" gradient-color -begin="#EAEAEA" gradient-color-end="#EAEAEA" font="Arial" bold="false" list-ite m-over-gradient-color-end="#F4F4F4"></dropdowns></textboxes><buttons frame-color ="#DA0000" gradient-color-begin="#FF0000" gradient-color-end="#910000" color="#F 4F4F4" corner-roundness="0;8;8;8" font="Arial" size="10" bold="true" over-framecolor="#DA0000" down-frame-color="#F4F4F4" over-gradient-color-begin="#DA0000" d own-gradient-color-begin="#910000" over-gradient-color-end="#910000" down-gradie nt-color-end="#0D1B6D" over-color="#F4F4F4"><post-buttons gradient-color-begin=" #FF4949" gradient-color-end="#6D0000"></post-buttons></buttons><listboxes corner -roundness="5;5;5;5" bold="false"></listboxes><checkboxes down-corner-roundness=

"0"></checkboxes><servicemarker gradient-color-begin="#555555" gradient-color-en d="#555555"></servicemarker></controls><texts color="#FFFFFF" font="Arial" size= "10" bold="true"><privacy color="#910000" size="11" bold="false"></privacy><head ers size="11" bold="true"></headers><labels color="#B60000" size="11" bold="true "></labels><messages color="#FFC8AD" background-color="#1B366D" frame-thickness= "0" corner-roundness="3;3;3;3" gradient-color-begin="#912412" gradient-color-end ="#6D1B0D" size="11" bold="true"></messages><links color="#F4F4F4" underline="fa lse" size="11" bold="true" over-color="#FFFFFF"></links></texts></body></config> ';break;case'4':params.conf['UIConfig']='<config><display showDesktop="false" sh owEmail="true" useTransitions="true" showBookmark="true" codeBoxHeight="auto" sh owCodeBox="true" showCloseButton="false" bulletinChecked="false" networksWithCod eBox=""></display><body corner-roundness="8"><background frame-color="Transparen t" gradient-color-begin="#A4DA52" gradient-color-end="#6D9136" corner-roundness= "8"></background><controls size="11" bold="true"><snbuttons type="textUnder" fra me-color="#6D9136" background-color="#FFFFFF" over-frame-color="#D5D5D5" over-ba ckground-color="#FFFFFF" color="#1B6D0D" corner-roundness="0;8;0;8" gradient-col or-begin="#88B644" gradient-color-end="#000000" font="Arial" size="11" bold="tru e" over-gradient-color-begin="#88B644" down-gradient-color-begin="#DADA6D" overgradient-color-end="#000000" down-gradient-color-end="#6D9136" over-color="#F4F4 F4" down-color="#000000"><more frame-color="#BABABA" gradient-color-begin="#516D 28" gradient-color-end="#516D28" bold="true"></more><previous frame-color="#BABA BA" gradient-color-begin="#516D28" gradient-color-end="#516D28"></previous></snb uttons><textboxes frame-color="#000000" color="#AAAAAA" corner-roundness="0;8;0; 8" gradient-color-begin="#6D5128" gradient-color-end="#6D5128" font="Verdana" co rner-roundness-top="8" corner-roundness-bottom="8" bold="false"><codeboxes color ="#EAEAEA" frame-color="6D1B0D" background-color="#B6B65B" gradient-color-begin= "#919148" gradient-color-end="#919148" font="Arial" bold="false"></codeboxes><in puts frame-color="#6D1B0D" color="#FFFFC8" gradient-color-begin="#919148" gradie nt-color-end="#919148" font="Arial"></inputs><dropdowns list-item-over-color="6D 1B0D" frame-color="#6D1B0D" handle-gradient-color-begin="#FFFFC8" handle-gradien t-color-end="#DADA6D" handle-over-gradient-color-begin="#FFFFC8" handle-over-gra dient-color-end="#FFFFB6" handle-down-gradient-color-begin="#DADA6D" handle-down -gradient-color-end="#DADA6D" background-color="#FFFFC8" color="#FFFFC8" gradien t-color-begin="#919148" gradient-color-end="#919148" font="Arial" bold="false" l ist-item-over-gradient-color-end="#FFFFC8"></dropdowns></textboxes><buttons fram e-color="6D1B0D" gradient-color-begin="#FFFFC8" gradient-color-end="#B6B65B" cor ner-roundness="0;8;8;8" font="Arial" size="11" bold="true" over-frame-color="#6D 1B0D" down-frame-color="#F4F4F4" over-gradient-color-begin="#FFFFC8" down-gradie nt-color-begin="#F4F4F4" over-gradient-color-end="#DADA6D" down-gradient-color-e nd="#FFFF92" over-color="#28516D"><post-buttons frame-color="#6D1B0D" background -color="#FFFFC8" gradient-color-begin="#FFFFC8" gradient-color-end="B6B65B"></po st-buttons></buttons><listboxes corner-roundness="5;5;5;5" bold="false"></listbo xes><checkboxes down-corner-roundness="0"></checkboxes><servicemarker gradient-c olor-begin="#A4DA52" gradient-color-end="#516D28"></servicemarker></controls><te xts color="#FFFFFF" font="Arial" size="11" bold="true"><privacy color="#6D361B" size="11" bold="true"></privacy><headers color="#EAEAEA" size="11" bold="true">< /headers><labels color="#6D1B0D" size="11" bold="true"></labels><messages color= "#6D6D36" background-color="#1B366D" frame-thickness="0" corner-roundness="0;0;0 ;0" gradient-color-begin="#FFFFC8" gradient-color-end="#FFFFC8" size="11" bold=" true"></messages><links color="#FFFFFF" underline="false" size="11" bold="true" over-color="#6D1B0D" down-color="#366D1B"></links></texts></body></config>';brea k;case'5':params.conf['UIConfig']='<config><display showEmail="true" useTransiti ons="true" showBookmark="true"></display><body corner-roundness="8"><background gradient-color-begin="#ADC8FF"></background><controls><snbuttons type="textUnder " background-color="#FFFFFF" over-background-color="#FFFFFF" color="#376DDA" cor ner-roundness="0;10;0;10" size="11" bold="false" over-color="#0D1B6D"></snbutton s><textboxes><codeboxes color="#6A6A6A" frame-color="#1B366D" background-color=" #F4F4F4"></codeboxes></textboxes><buttons gradient-color-begin="#0099FF" gradien t-color-end="#223276" color="#FFFFFF" corner-roundness="0;8;0;8" font="arial" si ze="11" bold="true" over-gradient-color-begin="#0099FF" over-gradient-color-end=

"#0099FF"></buttons><servicemarker gradient-color-begin="#F4F4F4" gradient-color -end="#F4F4F4"></servicemarker></controls><texts color="#FFFFFF" bold="true"><pr ivacy color="#AAAAAA"></privacy><labels color="#1B366D"></labels><messages color ="#F4F4F4" background-color="#1B366D" bold="true"></messages><links color="#376D DA" underline="false" over-color="#1B366D"></links></texts></body></config>';bre ak;case'6':params.conf['UIConfig']='<config><display showEmail="true" useTransit ions="true" showBookmark="true" codeBoxHeight="auto" showCodeBox="true" showClos eButton="false" networksWithCodeBox=""></display><body><background frame-color=" #BFBFBF" background-color="#FFFFFF" gradient-color-begin="#ffffff" gradient-colo r-end="#F4F4F4" corner-roundness="4;4;4;4"></background><controls color="#202020 " corner-roundness="4;4;4;4" gradient-color-begin="#EAEAEA" gradient-color-end=" #F4F4F4" bold="false"><snbuttons type="textUnder" frame-color="#D5D5D5" over-fr ame-color="#60BFFF" color="#808080" gradient-color-begin="#FFFFFF" gradient-colo r-end="d4d6d7" size="10" bold="false" down-frame-color="#60BFFF" down-gradient-c olor-begin="#6DDADA" over-gradient-color-end="#6DDADA" down-gradient-color-end=" #F4F4F4" over-color="#52A4DA" down-color="#52A4DA" over-bold="false"><more frame -color="#A4DBFF" over-frame-color="#A4DBFF" gradient-color-begin="#F4F4F4" gradi ent-color-end="#BBE4FF" over-gradient-color-begin="#A4DBFF" over-gradient-colorend="#F4F4F4"></more><previous frame-color="#BBE4FF" over-frame-color="#A4DBFF" gradient-color-begin="#FFFFFF" gradient-color-end="#A4DBFF" over-gradient-colorbegin="#A4DBFF" over-gradient-color-end="#F4F4F4"></previous></snbuttons><textbo xes frame-color="#CACACA" color="#757575" gradient-color-begin="#ffffff" bold="f alse"><codeboxes color="#757575" frame-color="#DFDFDF" background-color="#FFFFFF " gradient-color-begin="#ffffff" gradient-color-end="#FFFFFF" size="10"></codebo xes><inputs frame-color="#CACACA" color="#757575" gradient-color-begin="#F4F4F4" gradient-color-end="#ffffff"></inputs><dropdowns frame-color="#CACACA" list-ite m-over-color="#52A4DA" ></dropdowns></textboxes><buttons frame-color="#8DD1FF" g radient-color-end="#BBE4FF" color="#202020" bold="false" over-gradient-color-beg in="#BBE4FF" down-gradient-color-begin="#BBE4FF" over-gradient-color-end="#FFFFF F" down-gradient-color-end="#ffffff"><post-buttons frame-color="#8DD1FF" gradien t-color-end="#BBE4FF"></post-buttons></buttons><listboxes frame-color="#CACACA" corner-roundness="4;4;4;4" gradient-color-begin="#F4F4F4" gradient-color-end="#F FFFFF"></listboxes><checkboxes checkmark-color="#00B600" frame-color="#D5D5D5" c orner-roundness="3;3;3;3" gradient-color-begin="#F4F4F4" gradient-color-end="#FF FFFF"></checkboxes><servicemarker gradient-color-begin="#ffffff" gradient-colorend="#D5D5D5"></servicemarker><tooltips color="#6D5128" gradient-color-begin="#F FFFFF" gradient-color-end="#FFE4BB" size="10" frame-color="#FFDBA4"></tooltips>< /controls><texts color="#202020"><headers color="#202020"></headers><messages co lor="#202020"></messages><links color="#52A4DA" underline="false" over-color="#3 53535" down-color="#353535" down-bold="false"></links></texts></body></config>'; break;} params.conf.showCloseButton=true;params.conf.wmodeType='opaque';params.conf.corn erRoundness=0;params.conf.onClose=Wildfire._hideWildfirePopup;params.conf.onRend erDone=function(o){var popDiv=document.getElementById(o.ModuleID);popDiv.style.v isibility="";Wildfire._GetContainer(o.ModuleID+'Progress').style.visibility="hid den";popDiv.style.zIndex=Wildfire._NextZIndex++;} Wildfire._popupConfigs.push(params.conf);var configID=Wildfire._popupConfigs.len gth-1;var html='<img id="Wildfire_Button'+configID+'" src="'+params.btnurl+'" st yle="cursor: pointer" border=0 alt="'+altText+'" title="'+altText+'" />';if(para ms.button_divID){document.getElementById(params.button_divID).innerHTML=html}els e{document.write(html);} var btn=document.getElementById('Wildfire_Button'+configID);btn.openWildfirePopu p=function(){btn.mouseIsOut=true;Wildfire._showWildfirePopup(params.partner,para ms.w,params.h,configID);} btn.onmouseout=function(){btn.mouseIsOut=true;} if(typeof Wildfire.buttonsData=='undefined')Wildfire.buttonsData={};switch(param s.b.toLowerCase()){case'mouseover':btn.configID=configID;Wildfire.buttonsData[co nfigID]=function(){if(!btn.mouseIsOut)btn.openWildfirePopup();} btn.onmouseover=function(){btn.mouseIsOut=false;setTimeout('Wildfire.buttonsData ['+btn.configID+']()',500);}

break;case'click':default:btn.onclick=btn.openWildfirePopup;} return'wildfire_postDiv_'+configID;} Wildfire.disposeWildfireButton=function(id){var wfDiv=document.getElementById(id );var progressDiv=document.getElementById(id+'Progress');var ifrel=document.getE lementById('gigya_ifr_'+id);if(wfDiv){var elementsToShowOnClose=wfDiv.elementsTo ShowOnClose;if(elementsToShowOnClose!=null){for(var i=0;i<elementsToShowOnClose. length;i++){elementsToShowOnClose[i].style.visibility='';}}} if(wfDiv)document.body.removeChild(wfDiv);if(progressDiv)document.body.removeChi ld(progressDiv);if(ifrel)document.body.removeChild(ifrel);} Wildfire.renderPostButton=function(partner,width,height,config,btnurl,eventType, divID){var params={partner:partner,w:width,h:height,conf:config,btnurl:btnurl,b: eventType,divID:divID} return Wildfire.drawWildfireButton(params);} Wildfire._lastID=0;Wildfire._getScrollXY=function(){var scrOfX=0,scrOfY=0;if(typ eof(window.pageYOffset)=='number'){scrOfY=window.pageYOffset;scrOfX=window.pageX Offset;}else if(document.body&&(document.body.scrollLeft document.body.scrollTo p)){scrOfY=document.body.scrollTop;scrOfX=document.body.scrollLeft;}else if(docu ment.documentElement&&(document.documentElement.scrollLeft document.documentEle ment.scrollTop)){scrOfY=document.documentElement.scrollTop;scrOfX=document.docum entElement.scrollLeft;} return[scrOfX,scrOfY];} Wildfire._GetContainer=function(id){if(id=='')return null;var el=document.getEle mentById(id);if(typeof(el)=='Array'){return el[el.length];} return el;} Wildfire._preparePopup=function(w,h,id,btnDiv,progressImageSrc){var wfDiv=Wildfi re._CreateContainer(id);var progressDiv=Wildfire._CreateContainer(id+'Progress', true);var dst;dst=wfDiv.style;var vph;var vpw;var de=document.documentElement;vp h=de.clientHeight;vpw=de.clientWidth;if(typeof vph=='undefined' vph==0){vph=doc ument.body.clientHeight;vpw=document.body.clientWidth;} if(typeof vph=='undefined' vph==0){vph=window.innerHeight;vpw=window.innerWidth ;} scrl=Wildfire._getScrollXY();var vpt=scrl[1];var vpl=scrl[0];var middlePointTop= vpt+Math.floor(vph/2);var middlePointLeft=vpl+Math.floor(vpw/2);var btnPos=Wildf ire._GetElementPos(btnDiv);if(btnPos.top>middlePointTop){dst.top=''+(btnPos.toph)+'px';}else{dst.top=''+(btnPos.top+btnDiv.height)+'px';} if(btnPos.left>middlePointLeft){dst.left=''+(btnPos.left+btnDiv.width-w)+'px';}e lse{dst.left=''+btnPos.left+'px';} dst.width=''+w+'px';dst.height=''+h+'px';progressDiv.style.position='absolute';p rogressDiv.style.background='url('+progressImageSrc+') no-repeat center center'; progressDiv.style.width=dst.width;progressDiv.style.height=dst.height;progressDi v.style.top=dst.top;progressDiv.style.left=dst.left;var ifrel=document.getElemen tById('gigya_ifr_'+id);if(ifrel!=null){ifrel.style.top=dst.top;ifrel.style.left= dst.left;ifrel.style.width=dst.width;ifrel.style.height=dst.height;} Wildfire._HandleEmbedAndObjectsBelow(wfDiv,w,h);} Wildfire._showWildfirePopup=function(partner,width,height,configID){var divID='w ildfire_postDiv_'+configID;var btnDiv=document.getElementById('Wildfire_Button'+ configID);var popDiv=Wildfire._GetContainer(divID);if(popDiv==null popDiv.style .visibility=='hidden'){Wildfire._preparePopup(width,height,divID,btnDiv,'http:// cdn.gigya.com/WildFire/i/progress_ani.gif');Wildfire.initPost(partner,divID,widt h,height,Wildfire._popupConfigs[configID]);}} Wildfire.revealDiv=function(divID,maxHeight){var div=document.getElementById(div ID);var nextHeight=parseInt(div.style.height.replace('px',''))+20;if(nextHeight< maxHeight){var ifrel=document.getElementById('gigya_ifr_'+divID);div.style.heigh t=nextHeight+'px';if(ifrel!=null){ifrel.style.height=nextHeight+'px';} window.setTimeout('Wildfire.revealDiv("'+divID+'", '+maxHeight+')',10);}else{div .style.height=maxHeight+'px';}} Wildfire._injectCIMP=function(){if(document.getElementById('wildfire_cimp')==nul l&&document.body!=null){var cimp=document.createElement('div');cimp.id='wildfire _cimp';cimp.width=1;cimp.height=1;cimp.style.display='none';cimp.style.visibilit y='hidden';cimp.style.position='absolute';cimp.innerHTML='<img src="http://cdn.g

igya.com/wildfire/i/CIMP.gif?CXNID=2000002.0NXC" />';document.body.insertBefore( cimp,document.body.firstChild);}} if(typeof WildfireBtn!='undefined'&&typeof WildfireBtn.pendingButtons!='undefine d'){for(var i=0;i<WildfireBtn.pendingButtons.length;i++){Wildfire.drawWildfireBu tton(WildfireBtn.pendingButtons[i]);}} /* public/javascripts/starbox.js @ 1319142822 */ var Starboxes={options:{buttons:5,className:'default',color:false,duration:0.6,e ffect:{mouseover:false,mouseout:(window.Effect&&Effect.Morph)},hoverColor:false, hoverClass:'hover',ghostColor:false,ghosting:false,identity:false,indicator:fals e,inverse:false,locked:false,max:5,onRate:Prototype.emptyFunction,rated:false,ra tedClass:'rated',rerate:false,overlay:'default_gradient.png',overlayImages:Scrib d.cdn_path+'images/starbox/',stars:5,total:0}};eval(function(p,a,c,k,e,r){e=func tion(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c. toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c] e(c);k=[funct ion(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.repla ce(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('P.1a(n,{2r:"1.6.0.3",2s:"1. 8.2",1Q:i(){5.1o("12");5.Q.1R=1;h(/^(2t?:\\/\\/ \\/)/.2u(5.9.1p)){5.1q=5.9.1p}1r {j a=/13(?:-[\\w\\d.]+)?\\.2v(.*)/;5.1q=(($$("2w[C]").1S(i(b){o b.C.2x(a)}) {}) .C "").1T(a,"")+5.9.1p}},1o:i(a){h((2y 1b[a]=="2z") (5.1s(1b[a].2A)<5.1s(5["1U "+a]))){2B("1V 2C "+a+" >= "+5["1U"+a]);}},1s:i(a){j b=a.1T(/1t.* \\./g,"");b=1u (b+"0".1v(4-b.2D));o a.2E("1t")>-1?b-1:b},1W:(i(b){j a=l 2F("2G ([\\\\d.]+)").2H (b);o a?(2I(a[1])<7):1X})(2J.2K),Q:i(b){b=$(b);j c=b.2L("1Y"),a=1w.2M;h(c){o c}2 N{c="2O"+a.1R++}2P($(c));b.2Q("1Y",c);o c},1x:[],2R:i(a){h(!5.1y(a.C)){5.1x.1c(a )}o a},1y:i(a){o 5.1x.1S(i(b){o b.C==a})},G:[],1Z:i(a){5.G.1c(a)},1d:i(){h(!5.G[ 0]){5.20=21;o}5.22(5.G[0])},22:i(c){j e=[],b=c.9.23,a=5.1y(b);5.G.H(i(f){h(f.9.2 3==b){e.1c(f);5.G=5.G.2S(f)}}.y(5));h(!a){j d=l 2T();d.2U=i(){5.1z(e,{C:b,I:d.I, J:d.J,24:d.C})}.y(5);d.C=n.1q+b}1r{5.1z(e,a)}},1z:i(b,a){b.H(i(c){c.1e=a;c.25()} );5.1d()},1A:(i(a){o{1f:"1f",R:"R",K:(a?"2V":"K")}})(12.1g.1h),26:i(a){h(!12.1g. 1h){a=a.2W(i(e,d){j c=P.2X(5)?5:5.r,b=d.2Y;h(b!=c&&!$A(c.2Z("*")).30(b)){e(d)}}) }o a}});n.1Q();31.27("32:33",n.1d.y(n));j 1V=34.35({36:i(a,b){5.r=$(a);5.p=b;5.9 =P.1a(P.37(n.9),1w[2] {});$w("L m D t").H(i(c){5[c]=5.9[c]}.y(5));5.S=5.9.S (5 .m&&!5.9.1B);h(!5.L){5.L=n.Q(5.r)}h(5.9.u&&(5.9.u.R 5.9.u.K)){n.1o("38")}n.1Z(5 );h(n.20){n.1d()}},28:i(){$w("K R 1f").H(i(c){j b=c.29(),a=5["1i"+b].39(5);5["1i "+b+"1C"]=(c=="K"&&!12.1g.1h)?n.26(a):a;5.14.27(n.1A[c],5["1i"+b+"1C"])}.y(5));5 .M.2a("k",{2b:"3a"})},2c:i(){$w("R K 1f").H(i(a){5.14.3b(n.1A[a],5["1i"+a.29()+" 1C"])}.y(5));5.M.2a("k",{2b:"3c"})},25:i(){5.15=5.1e.J;5.16=5.1e.I;5.1D=5.1e.24; 5.T=5.15*5.9.1E;5.17=5.T/5.9.M;5.1j=5.9.D/5.9.M;h(5.9.u){5.2d=5.18(0);5.2e=5.18( 5.9.D)}j a={N:{U:"N",1k:0,z:0,J:5.T+"q",I:5.16+"q"},1F:{U:"2f",J:5.T+"q",I:5.16+ "q"},2g:{U:"N",1k:0,z:0,J:5.15+"q",I:5.16+"q"}};5.r.V("13");5.2h=l s("v",{W:5.9. W ""}).k({U:"2f"}).x(5.19=l s("v").x(5.1l=l s("v").x(5.1G=l s("v",{W:"1E"}).k(P .1a({3d:"2i"},a.1F)))));h(5.m){5.19.V("m")}h(5.S){5.19.V("S")}h(5.9.2j){5.1G.x(5 .O=l s("v",{W:"O"}).k(a.N));h(5.9.2k){5.O.k({X:5.9.2k})}h(5.9.u){5.O.E=5.O.Q()}5 .Y(5.O,5.p,(1b.Z&&Z.1H))}5.1G.x(5.B=l s("v",{W:"B"}).k(a.N)).x(l s("v").k(a.N).x (5.14=l s("v").k(a.1F)));h(5.9.1I){5.B.k({X:5.9.1I})}h(5.9.u){5.B.E=5.B.Q()}5.9. 1E.1v(i(b){j c;5.14.x(c=l s("v").k(P.1a({X:"3e("+5.1D+") 1k z 3f-3g",z:5.15*b+"q "},a.2g)));c.k({z:5.15*b+"q"});h(n.1W){c.k({X:"3h",3i:"3j:3k.3l.3m(C=\'"+5.1D+"\ '\', 3n=\'3o\')"})}}.y(5));5.M=[];5.9.M.1v(i(d){j c,b=5.9.2l?5.T-5.17*(d+1):5.17 *d;5.14.x(c=l s("v").k({U:"N",1k:0,z:b+"q",J:5.17+(12.1g.1h?1:0)+"q",I:5.16+"q"} ));c.F=5.1j*d+5.1j;5.M.1c(c)}.y(5));5.Y(5.B,5.p);5.r.2m(5.2h);5.1J={};$w("p D m 1m t").H(i(b){5.r.x(5.1J[b]=l s("3p",{3q:"2i",3r:5.L+"1t"+b,2n:""+(b=="1m"?!!5[b ]:5[b])}))}.y(5));h(5.9.11){5.1l.x(5.11=l s("v",{W:"11"}));5.1K()}h(!5.S){5.28() }},2o:i(a){h(5.m&&5.9.1B){5.p=(5.t*5.p-5.m)/(5.t-1 1)}j b=5.m?5.t:5.t++;5.p=(5. p==0)?a:(5.p*(5.m?b-1:b)+a)/(5.m?b:b+1)},1K:i(){5.11.2m(l 3s(5.9.11).3t({D:5.9.D ,t:5.t,p:(5.p*10).3u()/10}))},18:i(b){j a=(5.T-(b/5.1j)*5.17);o 1u(5.9.2l?a.3v() :-1*a.3w())},Y:i(a,b){h(5.9.u&&5["1L"+a.E]){Z.3x.3y(a.E).3z(5["1L"+a.E])}j d=5.1 8(b);h(1w[2]){j c=1u(a.3A("z")),f=5.18(b);h(c==f){o}j e=((5.2e-(c-f).1M()).1M()/ 5.2d.1M()).3B(2);5["1L"+a.E]=l Z.1H(a,{3C:{z:d+"q"},3D:{U:"3E",3F:1,E:a.E},2p:(5

.9.2p*e)})}1r{a.k({z:d+"q"})}},3G:i(c){j b=c.r();h(!b.F){o}5.2o(b.F);h(5.9.11){5 .1K()}h(5.9.2j){5.Y(5.O,5.p,(1b.Z&&Z.1H))}h(!5.m){5.19.V("m")}5.1m=!!5.m;5.m=b.F ;h(!5.9.1B){5.2c();5.19.V("S");5.2q(c)}j a={};$w("p L D m 1m t").H(i(d){h(d!="L" ){5.1J[d].2n=5[d]}a[d]=5[d]}.y(5));5.9.3H(5.r,a);5.r.1N("13:m",a)},2q:i(a){5.Y(5 .B,5.p,(5.9.u&&5.9.u.K));5.1O=1X;h(5.9.1n){5.1l.3I(5.9.1n)}h(5.9.1P){5.B.k({X:5. 9.1I})}5.r.1N("13:z")},3J:i(b){j a=b.r();h(!a.F){o}5.Y(5.B,a.F,(5.9.u&&5.9.u.R)) ;h(!5.1O&&5.9.1n){5.1l.V(5.9.1n)}5.1O=21;h(5.9.1P){5.B.k({X:5.9.1P})}5.r.1N("13: 3K",{Q:5.9.L,D:5.9.D,F:a.F,t:5.t})}});',62,233,' this options if f unction var setStyle new rated Starboxes return average px element Element total effect div insert bind left colorbar src max scope rating buildQueue each hei ght width mouseout identity buttons absolute ghost Object identify mouseover loc ked boxWidth position addClassName className background setBarPosition Effect i ndicator Prototype starbox starbar starWidth starHeight buttonWidth getBarPositi on status extend window push processBuildQueue imageInfo click Browser IE on but tonRating top hover rerated hoverClass require overlayImages imageSource else co nvertVersionString _ parseInt times arguments imagecache getCachedImage buildBat ch useEvent rerate _cached starSrc stars base wrapper Morph color inputs updateI ndicator activeEffect_ abs fire hovered hoverColor load counter find replace REQ UIRED_ Starbox fixIE false id queueBuild batchLoading true cacheBuildBatch overl ay fullsrc build capture observe enable capitalize invoke cursor disable zeroPos ition maxPosition relative star container hidden ghosting ghostColor inverse upd ate value updateAverage duration onMouseout REQUIRED_Prototype REQUIRED_Scriptac ulous https test js script match typeof undefined Version throw requires length indexOf RegExp MSIE exec parseFloat navigator userAgent readAttribute callee do starbox_ while writeAttribute cacheImage without Image onload mouseleave wrap is Element relatedTarget select member document dom loaded Class create initialize clone Scriptaculous bindAsEventListener pointer stopObserving auto overflow url no repeat none filter progid DXImageTransform Microsoft AlphaImageLoader sizingM ethod scale input type name Template evaluate round ceil floor Queues get remove getStyle toFixed style queue end limit onClick onRate removeClassName onMouseov er changed'.split(' '),0,{})); /* public/javascripts/cookiejar.js @ 1319142822 */ var CookieJar=Class.create();CookieJar.prototype={appendString:"__CJ_",initializ e:function(options){this.options={expires:3600,path:'',domain:'',secure:''};Obje ct.extend(this.options,options {});if(this.options.expires!=''){var date=new Da te();date=new Date(date.getTime()+(this.options.expires*1000));this.options.expi res='; expires='+date.toGMTString();} if(this.options.path!=''){this.options.path='; path='+escape(this.options.path); } if(this.options.domain!=''){this.options.domain='; domain='+escape(this.options. domain);} if(this.options.secure=='secure'){this.options.secure='; secure';}else{this.opti ons.secure='';}},put:function(name,value){name=this.appendString+name;cookie=thi s.options;var type=typeof value;switch(type){case'undefined':case'function':case 'unknown':return false;case'boolean':case'string':case'number':value=String(valu e.toString());} var cookie_str=name+"="+escape(Object.toJSON(value));try{document.cookie=cookie_ str+cookie.expires+cookie.path+cookie.domain+cookie.secure;}catch(e){return fals e;} return true;},remove:function(name){name=this.appendString+name;cookie=this.opti ons;try{var date=new Date();date.setTime(date.getTime()-(3600*1000));var expires ='; expires='+date.toGMTString();document.cookie=name+"="+expires+cookie.path+co okie.domain+cookie.secure;}catch(e){return false;} return true;},get:function(name){name=this.appendString+name;var cookies=documen t.cookie.match(name+'=(.*?)(; $)');if(cookies){return(unescape(cookies[1])).eval JSON();}else{return null;}},empty:function(){keys=this.getKeys();size=keys.size( );for(i=0;i<size;i++){this.remove(keys[i]);}},getPack:function(){pack={};keys=th

is.getKeys();size=keys.size();for(i=0;i<size;i++){pack[keys[i]]=this.get(keys[i] );} return pack;},getKeys:function(){keys=$A();keyRe=/[^=; ]+(?=\=)/g;str=document.c ookie;CJRe=new RegExp("^"+this.appendString);while((match=keyRe.exec(str))!=unde fined){if(CJRe.test(match[0].strip())){keys.push(match[0].strip().gsub("^"+this. appendString,""));}} return keys;}}; /* public/javascripts/login.js @ 1319142822 */ if(!window.Scribd)var Scribd=new Object();Scribd.loginManager=Class.create({init ialize:function(options){this.hasFBCallback=false;this.options=options {};this. explanations={premium_reader:'',follow:'to Subscribe to this user',comment:'to S cribble a Comment',readcast:'to Readcast',download:'to Download a Document',disc ussion:'to Participate in This Discussion',add_to_collections:'to Add This Docum ent to Your Collections',join:'',upload:'to Publish Your Documents',view_purchas ed_document:'to View Your Purchased Document',status_reply:'to Reply Status Mess ages',comment_reply:'to Reply to this Comment',rate:'to Rate this Document',tria l:'to Start Your Free Trial'};this.explanationBase="You Must be Logged in ";this .after_facebook_signup_url='/login/signup_success';this.after_facebook_login_url ='/login/callbacks';var login_lb=$('login_lb');this.login_form=login_lb.down('.g lobal_login_form');this.signup_form=login_lb.down('.global_signup_form');this.lo gin_header=login_lb.down('.login_lb_header');this.signup_header=login_lb.down('. signup_header');this.login_section=login_lb.down('.login_section');this.signup_t oggle=login_lb.down('.signup_toggle');this.login_toggle=login_lb.down('.login_to ggle');this.setEvents();},setEvents:function(){$$('#login_lb .lightbox_form').in voke('observe','submit',this.sendForm.bindAsEventListener(this));$('login_lb').s elect('.close_button').invoke('observe','click',Scribd.Lightbox.closeHandler);if (this.signup_toggle){this.signup_toggle.down('a').observe('click',function(e){e. stop();e.element().up().toggleClassName('open');this.signup_form.toggle();}.bind (this));} if(this.login_toggle){this.login_toggle.down('a').observe('click',function(e){e. stop();e.element().up().toggleClassName('open');this.login_form.toggle();}.bind( this));}},defaultExplanation:function(context){switch(context){case'join':return 'Sign Up';default:return'Log In';}},sendForm:function(e){e.stop();var form=e.ele ment();Scribd.Remote.Form(form);},checkField:function(url,el){var name=Element.r eadAttribute(el,'name');var name_parsed=name.match(/\[([a-z_]+)\]/i);if(name_par sed.length>1) name=name_parsed[1];var value=$F(el);if(value) new Ajax.Request(url,{asynchronous:true,evalScripts:true,parameters:name+'='+esc ape(value)});},open:function(options){if(this.login_form){if(options.context=='j oin'){this.login_toggle.hide();}else{this.login_toggle.show();} this.login_form.down('.hidden').update('');this.signup_form.down('.hidden').upda te('');$H(options).each(function(pair){var input=new Element('input',{'type':'hi dden','value':pair.value,'name':'login_params['+pair.key+']'});this.login_form.d own('.hidden').appendChild(input);this.signup_form.down('.hidden').appendChild(i nput.cloneNode(true));$('login_lb').select('.login_add_hidden_form_fields_for_op tions').each(function(e){e.appendChild(input.cloneNode(true));});}.bind(this));i f(options.fallback_url&&$('openid_form')){var input=new Element('input',{'type': 'hidden','value':options.fallback_url,'name':"login_params[next_url]"});$('openi d_form').appendChild(input);} if(this.login_header){var exp=this.explanations[options.context];if(exp){this.lo gin_header.update(this.explanationBase+exp);}else{this.login_header.update(this. defaultExplanation(options.context));}} Scribd.Lightbox.open('login_lb');this.hasFBCallback=true;this.callbackFBFunction =function(new_user){if(new_user){var url=this.after_facebook_signup_url;}else{va r url=this.after_facebook_login_url;} new Ajax.Request(url,{method:'post',parameters:options,asynchronous:true,evalScr ipts:true});}.bind(this);}},callbackFB:function(new_user){var cookie=new Scribd.

JSONCookie('session_metadata');if(cookie.get('denied_IC')){cookie.unset('denied_ IC');cookie.save();} if(this.hasFBCallback){this.callbackFBFunction(new_user);}else{window.location.r eload();}}}); /* public/javascripts/generic_form_handler.js @ 1319142822 */ if(!window.Scribd)var Scribd=new Object();if(!Scribd.common)window.Scribd.common =new Object();Scribd.common.genericFormHandler=Class.create({initialize:function (outerElement){this.outer_element=$(outerElement);if(!this.outer_element){throw" No such outer element: "+outerElement;} if(this.outer_element.tagName.toLowerCase()=='form'){this.form=this.outer_elemen t;}else{this.form=$(this.outer_element).down("form");} if(!this.form){throw"No form in: "+this.outer_element;} Event.observe(this.form,"submit",this.formSubmitted.bindAsEventListener(this));t his.form.scribd_handler=this;},submit:function(){this.formSubmitted(null);},form Submitted:function(e){if(e){Event.stop(e);} if(this.isSubmittable()){this.outer_element.select(".gfh_pre_submit").invoke("hi de");new Ajax.Request(this.form.action,{asynchronous:true,evalScripts:true,metho d:'post',parameters:Form.serialize(this.form),onLoading:this.onLoading.bind(this ),onLoaded:this.onLoaded.bind(this),onSuccess:this.onSuccess.bind(this),onFailur e:this.onFailure.bind(this)});}},onLoading:function(ajax_request){this.loading() ;},loading:function(){this.outer_element.select('.gfh_loading').invoke('show');t his.outer_element.select(".gfh_success").invoke("hide");this.outer_element.selec t(".gfh_failure").invoke("hide");},onLoaded:function(ajax_request){this.loaded() ;},loaded:function(){this.outer_element.select('.gfh_loading').invoke('hide');}, isSubmittable:function(){return true;},parseResponse:function(ajax_request){var data=null;try{data=ajax_request.responseText.evalJSON();}catch(e){data=null;this .bindData({failure_message:"Server returned invalid data",failure_debugging_deta il:e.toString()},false,false);} return data;},onSuccess:function(ajax_request){var data=this.parseResponse(ajax_ request);if(!data){return;} try{if(data['failure_message']){this.failed(data);}else{this.succeeded(data);}}c atch(e){this.clientFailed(e);}},onFailure:function(ajax_request){var data=this.p arseResponse(ajax_request);if(!data){return;} try{this.failed(data);}catch(e){this.clientFailed(e);}},onComplete:function(succ eeded){this.outer_element.select(".gfh_pre_complete").invoke("hide");this.outer_ element.select(".gfh_pre_complete_"+(succeeded?"success":"failure")).invoke("hid e");},succeeded:function(data){this.bindData(data,true,true);this.onComplete(tru e);},failed:function(data){this.bindData(data,false,false);this.onComplete(false );},clientFailed:function(exception){this.bindData({failure_message:"Client fail ed",failure_debugging_detail:exception.toString()},false);},bindData:function(ob ject,isSuccess,throwOnMissing){if(isSuccess){this.outer_element.select(".gfh_suc cess").invoke("show");this.outer_element.select(".gfh_failure").invoke("hide");} else{this.outer_element.select(".gfh_success").invoke("hide");this.outer_element .select(".gfh_failure").invoke("show");} var theElement=this.outer_element;var bindClasses=["gfh_bind_text","gfh_bind_hre f"];var elementsToBind=[];bindClasses.each(function(i){elementsToBind=elementsTo Bind.concat(theElement.select("."+i));});elementsToBind.each(function(sub_elemen t){sub_element.classNames().each(function(class_name){if(bindClasses.include(cla ss_name) class_name=="gfh_bind_required"){}else{var results=class_name.match(/^ gfh_bind_(.*)$/i);if(results){var desiredValueName=results[1];var actualValue=ob ject[desiredValueName];if((!actualValue)&&(sub_element.hasClassName("gfh_bind_re quired"))&&throwOnMissing){throw"Server did not return required data '"+desiredV alueName+"'";} if(actualValue){if(sub_element.hasClassName("gfh_bind_text")){sub_element.update (actualValue);}else if(sub_element.hasClassName("gfh_bind_href")){sub_element.hr ef=actualValue;}}}}});});}});

/* public/javascripts/anonymous.js @ 1319142822 */ if(!window.Scribd)var Scribd=new Object();if(!window.Scribd.uploads)window.Scrib d.uploads=new Object();Scribd.uploads.anonymous={setClaimHandlers:function(enclo singDivName,entireUiDivName,claimHandlersOptions){var func=function(){var enclos ingDiv=$(enclosingDivName);if(!enclosingDiv){throw"No enclosing div: "+enclosing DivName;} var entireUiDiv=$(entireUiDivName);if(!entireUiDiv){throw"No entire-UI div: "+en tireUiDivName;} var newEmailHandler=Class.create(Scribd.common.genericFormHandler,{isSubmittable :function(){var emailInput=this.form.down("input[name='email']");return(!emailIn put.getValue().blank());},failed:function($super,data){enclosingDiv.down('.anony mous_claim_other').show();if(data['failure_type']=='duplicate_email'){this.outer _element.select(".duplicate_email").invoke('show');enclosingDiv.down(".anonymous _merge_accounts").down("input[name='email']").value=this.outer_element.down("inp ut[name='email']").getValue();enclosingDiv.down('.anonymous_merge_accounts').bli ndDown();}else{$super(data);}},loading:function($super){$super();enclosingDiv.do wn('.anonymous_claim_other').hide();},succeeded:function($super,data){$super(dat a);if(window.setPrivate){window.setPrivate(false);} if(claimHandlersOptions['reload_on_signup']){this.doReload.delay(2);}},doReload: function(){window.location.reload(true);}});new newEmailHandler(enclosingDiv.dow n(".anonymous_claim_new_email"));var mergeAccountsLink=enclosingDiv.down('.anony mous_merge_accounts_link');if(!mergeAccountsLink){throw"No mergeAccountsLink";} Event.observe(mergeAccountsLink,'click',function(e){Event.stop(e);var elem=enclo singDiv.down('.anonymous_merge_accounts');if(elem.visible()){elem.hide();}else{e lem.show();}});var mergeAccountsHandler=Class.create(Scribd.common.genericFormHa ndler,{isSubmittable:function(){return((!this.form.down("input[name='email']").g etValue().blank())&&(!this.form.down("input[name='password']").getValue().blank( )));},succeeded:function($super,data){$super(data);if(window.setPrivate){window. setPrivate(false);} this.outer_element.down(".input_elements").hide();this.outer_element.up(".anonym ous_merge_accounts").down(".reset_password_form").hide();if(claimHandlersOptions ['reload_on_signup']){this.doReload.delay(2);}else{(function(){entireUiDiv.blind Up();}).delay(4);}},doReload:function(){window.location.reload(true);}});var mer geAccountsDiv=enclosingDiv.down('.anonymous_merge_accounts');new mergeAccountsHa ndler(mergeAccountsDiv.down(".merge_accounts_form"));var resetPasswordHandler=Cl ass.create(Scribd.common.genericFormHandler,{isSubmittable:function(){var email= mergeAccountsDiv.down(".merge_accounts_form").down("input[name='email']").getVal ue();if(email.blank()){var pleaseEnterEmail=this.outer_element.down(".please_ent er_email");pleaseEnterEmail.show();new Effect.Fade(pleaseEnterEmail,{duration:2} );return false;}else{this.form.down("input[name='email']").value=email;return tr ue;}}});var resetPasswordForm=enclosingDiv.down(".reset_password_form");new rese tPasswordHandler(resetPasswordForm);var resetPasswordLink=mergeAccountsDiv.down( "a.reset_password");Event.observe(resetPasswordLink,'click',function(e){resetPas swordForm.scribd_handler.submit();});var disclaimDiv=enclosingDiv.down(".anonymo us_disclaim");if(disclaimDiv){var disclaimHandler=Class.create(Scribd.common.gen ericFormHandler,{isSubmittable:function(){return confirm("Are you sure these doc uments aren't yours? You won't be able to delete them, make them public or priva te, or change them in any way.");},succeeded:function($super,data){$super(data); Effect.BlindUp(entireUiDiv.id);}});new disclaimHandler(disclaimDiv);Event.observ e(disclaimDiv.down('a'),'click',function(e){Event.stop(e);enclosingDiv.down('.an onymous_disclaim').scribd_handler.submit();})}} if(claimHandlersOptions['lightbox']){func();}else{Event.observe(window,'load',fu nc);}}}; /* public/javascripts/comment.js @ 1319142822 */ if(!window.Scribd)var Scribd=new Object();Scribd.commentManager=Class.create({in

itialize:function(opts){this.options=Object.extend({},opts {});this.delete_fade _time=8;this.flag_fade_time=8;this.poll_interval=30;this.event_content='';this.p age_num=1;this.input_selector='textarea';},deleteEvent:function(event_id,url){va r ev=$('document_event_container_'+event_id);new Ajax.Request(url,{asynchronous: true,evalScripts:true,method:'delete'});ev.select('div').each(function(item){new Effect.Fade(item,{duration:0.5});});ev.select('p').each(function(item){new Effe ct.Fade(item,{duration:0.5});});(function(){ev.className='';Scribd.Alerts.succes s_red(ev,'Entry Deleted');}).delay(0.5);},flagEvent:function(event_id,url,contai ner){var ev=$('document_event_container_'+event_id);new Ajax.Request(url,{asynch ronous:true,evalScripts:true,method:'post'});var flag_container=container.up('.f lag_container');msg=new Element('span').update('You have successfully reported t his item!').addClassName('flag');flag_container.insert(msg).removeClassName('fla g_container');container.remove();},getMoreTimeline:function(link,url,page){$(lin k).hide();$('timeline_spinner').show();trackEvent('Timeline Feed',page,'View Mor e - Page '+this.page_num);new Ajax.Request(url,{method:'GET',onSuccess:function( ){this.page_num++;$('timeline_spinner').hide();}.bind(this),onComplete:function( ){$('document_activity').fire('Scribd:dom_updated');}});},showReplyForm:function (url,event_id){var that=this;if($('document_event_reply_container_'+event_id).em pty()){$('document_event_reply_spinner_'+event_id).show();var after=function(){$ ('document_event_reply_spinner_'+event_id).hide();$('document_event_reply_contai ner_'+event_id).down('.event_reply_fields '+that.input_selector).focus();};new A jax.Request(url,{evalScripts:true,method:'get',onComplete:after});}else{$('docum ent_event_reply_container_'+event_id).toggle();if($('document_event_reply_contai ner_'+event_id).style.display!='none'){$('document_event_reply_container_'+event _id).down('.event_reply_fields '+that.input_selector).focus();}}},submitCommentE vent:function(e){var form=e.element();e.stop();this.submitComment(form);},displa yComment:function(comment){if(comment&&!comment.visible()){comment.setOpacity(0) ;new Effect.BlindDown(comment,{transition:Effect.Transitions.spring});new Effect .Appear(comment,{afterFinish:function(){document.fire('scribd:dom_height_changed ');}});}},submitComment:function(form){var that=this;$('document_comment_errors' ).update();document.fire('scribd:dom_height_changed');Scribd.Remote.Form(form,{o nComplete:function(req){form.down(that.input_selector).value='';form.down(that.i nput_selector).removeClassName('taller');if(form.down('.spinner'))form.down('.sp inner').hide();form.enable();var comment=$('document_activity').select('.documen t_event_container').first();that.displayComment(comment);$('document_activity'). fire('Scribd:dom_updated');}});}});Scribd.scribbleComment=function(el){el.observ e('focus',function(e){this.addClassName('taller')});el.observe('blur',function(e ){if(!$F(this))this.removeClassName('taller')});} /* public/javascripts/status_updater.js @ 1319142822 */ var StatusUpdater=Class.create({tracking:false,textLimit:400,currentDocId:0,docL ock:false,manualSelection:false,initialMessage:"... or scribble what you're read ing!",initialize:function(container,id,post_url){this.postUrl=post_url;this.obje ctId=id;this.opened=false;this.container=container;this.statusFormElement=this.c ontainer.down('form');this.statusTextarea=this.container.down('.status_update_te xtarea');this.submitButton=this.container.down('.status_submit');this.statusForm =this.container.down('.status_updater_form');this.statusSpinner=this.container.d own('.status_spinner');this.isReply=(this.submitButton.getAttribute('data-is-rep ly')=='true');if(trackEvent) this.tracking=true;this.setupEvents();},setupEvents:function(){if(!this.isReply& &this.statusForm){if(this.statusTextarea.value==''){var dt=new Element('div',{'c lass':'default_text'}).update(this.initialMessage);var d=$(this.statusTextarea). positionedOffset();dt.setStyle({top:d.top+'px',left:d.left+'px'});this.statusFor m.insert({top:dt});} this.statusTextarea.observe('focus',function(e){var dtext=this.statusForm.down(' .default_text');if(dtext) dtext.hide();e.element().addClassName('taller');}.bindAsEventListener(this));thi s.statusTextarea.observe('blur',function(e){if(this.statusTextarea.value==''){va

r dtext=this.statusForm.down('.default_text');if(dtext) dtext.show();e.element().removeClassName('taller');}}.bindAsEventListener(this)) ;this.statusForm.select('.default_text').invoke('observe','click',function(e){th is.statusTextarea.focus();}.bindAsEventListener(this));this.statusFormElement.ob serve('submit',function(e){e.stop();this.submit();}.bindAsEventListener(this))} this.statusTextarea.observe('keyup',this.truncateText.bind(this));},submit:funct ion(){if(((this.statusTextarea.value.length==0)&&(this.currentDocId==0))){return false;}else{if(this.tracking){if(this.isReply) {trackEvent('Status Updater','Status Reply');}else{trackEvent('Status Updater',' Status Update');}} this.submitButton.disabled=true;this.submitButton.addClassName('button_disabled' );this.statusSpinner.show();new Ajax.Request(this.postUrl,{asynchronous:true,eva lScripts:true,onComplete:function(request){this.submitButton.removeClassName('bu tton_disabled');this.statusTextarea.value='';this.statusSpinner.hide();this.clea rDocument();this.submitButton.disabled=false;if(this.isReply){this.container.up( '.autogen_class_views_events_base_feed_item').replace(request.responseText);}els e{var status=$('timeline').down('.autogen_class_views_events_base_feed_item');if (status&&!status.visible()){status.setOpacity(0);new Effect.BlindDown(status,{tr ansition:Effect.Transitions.spring});new Effect.Appear(status,{duration:1.5});}} this.container.fire('Scribd:dom_updated');}.bind(this),parameters:Form.serialize (this.statusFormElement)});}},truncateText:function(e){if(this.statusTextarea.va lue.length>this.textLimit){this.statusTextarea.value=this.statusTextarea.value.s ubstring(0,this.textLimit);}},enableSubmitButton:function(e){if(((this.statusTex tarea.value.length==0)&&(this.currentDocId==0))){this.submitButton.disabled=true ;this.submitButton.addClassName('button_disabled');}else{this.submitButton.disab led=false;this.submitButton.removeClassName('button_disabled');}}}); /* public/javascripts/pcarousel.js @ 1319142822 */ Carousel=Class.create(Abstract,{initialize:function(scroller,slides,controls,opt ions){this.scrolling=false;this.scroller=$(scroller);this.slides=slides;this.con trols=controls;this.options=Object.extend({duration:1,auto:false,frequency:3,vis ibleSlides:1,controlClassName:'carousel-control',jumperClassName:'carousel-jumpe r',disabledClassName:'carousel-disabled',selectedClassName:'carousel-selected',c ircular:false,wheel:true,effect:'scroll',transition:'sinoidal'},options {});if( this.options.effect=='fade'){this.options.circular=true;} this.slides.each(function(slide,index){slide._index=index;});if(this.controls){t his.controls.invoke('observe','click',this.click.bind(this));} if(this.options.wheel){this.scroller.observe('mousewheel',this.wheel.bindAsEvent Listener(this)).observe('DOMMouseScroll',this.wheel.bindAsEventListener(this));; } if(this.options.auto){this.start();} if(this.options.initial){var initialIndex=this.slides.indexOf($(this.options.ini tial));if(initialIndex>(this.options.visibleSlides-1)&&this.options.visibleSlide s>1){if(initialIndex>this.slides.length-(this.options.visibleSlides+1)){initialI ndex=this.slides.length-this.options.visibleSlides;}} this.moveTo(this.slides[initialIndex]);}},click:function(event){this.stop();var element=event.findElement('a');if(!element.hasClassName(this.options.disabledCla ssName)){if(element.hasClassName(this.options.controlClassName)){eval("this."+el ement.rel+"()");}else if(element.hasClassName(this.options.jumperClassName)){thi s.moveTo(element.rel);if(this.options.selectedClassName){this.controls.invoke('r emoveClassName',this.options.selectedClassName);element.addClassName(this.option s.selectedClassName);}}} this.deactivateControls();event.stop();},moveTo:function(element){if(this.option s.beforeMove&&(typeof this.options.beforeMove=='function')){this.options.beforeM ove();} this.previous=this.current?this.current:this.slides[0];this.current=$(element);v ar scrollerOffset=this.scroller.cumulativeOffset();var elementOffset=this.curren t.cumulativeOffset();if(this.scrolling){this.scrolling.cancel();}

switch(this.options.effect){case'fade':this.scrolling=new Effect.Opacity(this.sc roller,{from:1.0,to:0,duration:this.options.duration,afterFinish:(function(){thi s.scroller.scrollLeft=elementOffset[0]-scrollerOffset[0];this.scroller.scrollTop =elementOffset[1]-scrollerOffset[1];new Effect.Opacity(this.scroller,{from:0,to: 1.0,duration:this.options.duration,afterFinish:(function(){if(this.controls){thi s.activateControls();} if(this.options.afterMove&&(typeof this.options.afterMove=='function')){this.opt ions.afterMove();}}).bind(this)});}).bind(this)});break;case'scroll':default:var transition;switch(this.options.transition){case'spring':transition=Effect.Trans itions.spring;break;case'sinoidal':default:transition=Effect.Transitions.sinoida l;break;} this.scrolling=new Effect.SmoothScroll(this.scroller,{duration:this.options.dura tion,x:(elementOffset[0]-scrollerOffset[0]),y:(elementOffset[1]-scrollerOffset[1 ]),transition:transition,afterFinish:(function(){if(this.controls){this.activate Controls();} if(this.options.afterMove&&(typeof this.options.afterMove=='function')){this.opt ions.afterMove();} this.scrolling=false;}).bind(this)});break;} return false;},prev:function(){if(this.current){var currentIndex=this.current._i ndex;var prevIndex=(currentIndex==0)?(this.options.circular?this.slides.length-1 :0):currentIndex-1;}else{var prevIndex=(this.options.circular?this.slides.length -1:0);} if(prevIndex==(this.slides.length-1)&&this.options.circular&&this.options.effect !='fade'){this.scroller.scrollLeft=(this.slides.length-1)*this.slides.first().ge tWidth();this.scroller.scrollTop=(this.slides.length-1)*this.slides.first().getH eight();prevIndex=this.slides.length-2;} this.moveTo(this.slides[prevIndex]);},next:function(){if(this.current){var curre ntIndex=this.current._index;var nextIndex=(this.slides.length-1==currentIndex)?( this.options.circular?0:currentIndex):currentIndex+1;}else{var nextIndex=1;} if(nextIndex==0&&this.options.circular&&this.options.effect!='fade'){this.scroll er.scrollLeft=0;this.scroller.scrollTop=0;nextIndex=1;} if(nextIndex>this.slides.length-(this.options.visibleSlides+1)){nextIndex=this.s lides.length-this.options.visibleSlides;} this.moveTo(this.slides[nextIndex]);},first:function(){this.moveTo(this.slides[0 ]);},last:function(){this.moveTo(this.slides[this.slides.length-1]);},toggle:fun ction(){if(this.previous){this.moveTo(this.slides[this.previous._index]);}else{r eturn false;}},stop:function(){if(this.timer){clearTimeout(this.timer);}},start: function(){this.periodicallyUpdate();},pause:function(){this.stop();this.activat eControls();},resume:function(event){if(event){var related=event.relatedTarget event.toElement;if(!related (!this.slides.include(related)&&!this.slides.any(fu nction(slide){return related.descendantOf(slide);}))){this.start();}}else{this.s tart();}},periodicallyUpdate:function(){if(this.timer!=null){clearTimeout(this.t imer);this.next();} this.timer=setTimeout(this.periodicallyUpdate.bind(this),this.options.frequency* 1000);},wheel:function(event){event.cancelBubble=true;event.stop();var delta=0;i f(!event){event=window.event;} if(event.wheelDelta){delta=event.wheelDelta/120;}else if(event.detail){delta=-ev ent.detail/3;} if(!this.scrolling){this.deactivateControls();if(delta>0){this.prev();}else{this .next();}} return Math.round(delta);},deactivateControls:function(){this.controls.invoke('a ddClassName',this.options.disabledClassName);},activateControls:function(){this. controls.invoke('removeClassName',this.options.disabledClassName);}});Effect.Smo othScroll=Class.create();Object.extend(Object.extend(Effect.SmoothScroll.prototy pe,Effect.Base.prototype),{initialize:function(element){this.element=$(element); var options=Object.extend({x:0,y:0,mode:'absolute'},arguments[1] {});this.start (options);},setup:function(){if(this.options.continuous&&!this.element._ext){thi s.element.cleanWhitespace();this.element._ext=true;this.element.appendChild(this .element.firstChild);} this.originalLeft=this.element.scrollLeft;this.originalTop=this.element.scrollTo

p;if(this.options.mode=='absolute'){this.options.x-=this.originalLeft;this.optio ns.y-=this.originalTop;}},update:function(position){this.element.scrollLeft=this .options.x*position+this.originalLeft;this.element.scrollTop=this.options.y*posi tion+this.originalTop;}});Scribd.carousel=Class.create(Carousel,{periodicallyUpd ate:function($super){if(this.timer!=null){clearTimeout(this.timer);var currentIn dex=(this.current)?this.current._index:0;if(this.slides.length-1==currentIndex) this.moveTo(this.slides[0]);else this.next();} this.timer=setTimeout(this.periodicallyUpdate.bind(this),this.options.frequency* 1000);},prev:function(){if(this.current){var currentIndex=this.current._index;va r prevIndex=(currentIndex==0)?(this.options.circular?this.slides.length-1:0):cur rentIndex-1;}else{var prevIndex=(this.options.circular?this.slides.length-1:0);} this.moveTo(this.slides[prevIndex]);},next:function(){if(this.current){var curre ntIndex=this.current._index;var nextIndex=(this.slides.length-1==currentIndex)?( this.options.circular?0:currentIndex):currentIndex+1;}else{var nextIndex=1;} if(nextIndex>this.slides.length-(this.options.visibleSlides+1)){nextIndex=this.s lides.length-this.options.visibleSlides;} this.moveTo(this.slides[nextIndex]);},start:function(){this.periodicallyUpdate() ;if(this.options.auto){this.scroller.observe('mouseenter',function(e){this.stop( );}.bind(this));this.scroller.observe('mouseleave',function(e){setTimeout(this.p eriodicallyUpdate.bind(this),this.options.frequency*1000);}.bind(this));}},reloa d:function(){this.slides.each(function(slide,index){slide._index=index;});this.f irst();},click:function($super,event){if(!event.element().hasClassName(this.opti ons.disabledClassName)){$super(event);this.activateControls();}}});Scribd.carous elUtil={disableButton:function(carousel_name){var _this=Scribd[carousel_name];if (!_this.current _this.current._index==0){var btn=_this.controls.find(function(e l){return el.readAttribute('rel')=='prev'});if(btn) btn.addClassName(_this.options.disabledClassName);}else if(_this.current._index= =_this.slides.length-1){var btn=_this.controls.find(function(el){return el.readA ttribute('rel')=='next'});if(btn) btn.addClassName(_this.options.disabledClassName);}}}; /* public/javascripts/document_collections_manager.js @ 1319142822 */ Scribd.DocumentCollectionsManager={docs_in_collections:{},docs:{},loadPageForDoc ument:function(doc_id,page,collections_container,progress_indicator){progress_in dicator.show();var M=Scribd.DocumentCollectionsManager;if(!M.docs_in_collections [doc_id]){M.docs_in_collections[doc_id]={}};M.getCollectionsForDocument(doc_id,p age,{onSuccess:function(data){M.storeCollections(doc_id,data.collections);collec tions_container.update(M.renderCollectionsIn(doc_id,data));M.attachEvents(doc_id ,collections_container.select('li.document_collection'));},onComplete:function() {progress_indicator&&progress_indicator.hide();},onCreate:function(){progress_in dicator&&progress_indicator.show();}});},getCollectionsForDocument:function(doc_ id,page,callbacks){var collections=[];new Ajax.Request('/my_document_collections .json',{parameters:{view:'add_document_to_collections',document_id:doc_id,'page' :page},method:'get',onCreate:callbacks.onCreate,onComplete:callbacks.onComplete, onFailure:callbacks.onFailure,onSuccess:function(response){callbacks.onSuccess(r esponse.responseJSON);}});},storeCollections:function(doc_id,collections){var M= Scribd.DocumentCollectionsManager;collections=$A(collections);collections.select (function(collection){return collection.selected=='1';}).each(function(collectio n){M.docs_in_collections[doc_id][collection.id]=true;});},attachEvents:function( doc_id,collection_containers){var M=Scribd.DocumentCollectionsManager;collection _containers.each(function(container){M.attachEvent(doc_id,container);});},attach Event:function(doc_id,container){var M=Scribd.DocumentCollectionsManager;var col lection_id=container.getAttribute('data-document_collection_id');var checkbox=co ntainer.down('input');var loader=container.down('.status_loader');container.obse rve('click',function(e){e.stop();if(M.docs_in_collections[doc_id][collection_id] ){var action='/remove_document';var http_method='delete';}else{var action='/add_ document';var http_method='post';}

new Ajax.Request('/document_collections/'+collection_id+action,{parameters:{docu ment_id:doc_id},method:http_method,onCreate:function(){loader.show();checkbox.hi de();},onComplete:function(){loader.hide();checkbox.show();},onSuccess:function( response){var result=response.responseJSON;if(result&&result.added){checkbox.che cked=true;M.docs_in_collections[doc_id][collection_id]=true;}else{checkbox.check ed=false;delete M.docs_in_collections[doc_id][collection_id];}}});});},renderCol lectionsIn:function(doc_id,data){var M=Scribd.DocumentCollectionsManager;var ren dered_collections=$A(data.collections).map(function(collection){var transformed_ collection=M.renderingCollectionAttributes(doc_id,collection);return M.collectio n_template.evaluate(transformed_collection);}).join("\n");if(data.total==0){var private_text=M.docs[doc_id]['private']?'private ':'';rendered_collections='<span class="no_collections">You have not created any '+private_text+'collections yet .</span>';} return M.collections_template.evaluate({collections_list:rendered_collections,pa gination_control:M.renderPagination(data.page,data.per_page,data.total),'doc_id' :doc_id});},renderPagination:function(page,per_page,total,window_size){var num_o f_pages=Math.ceil(total/per_page);if(num_of_pages<=1){return'';} var htmls=['<span>',page,'</span>'];if(!window_size){window_size=2};var last_pag e=num_of_pages;var prev_page=next_page=page;for(var i=1;i<=window_size;i++){if(p rev_page>1){prev_page=page-i;htmls.unshift('<a href="#" data-page="',prev_page,' ">',prev_page,'</a>');} if(next_page<last_page){next_page=page+i;htmls.push('<a href="#" data-page="',ne xt_page,'">',next_page,'</a>');}} if(prev_page>2){htmls.unshift('<span class="ellipsis">...</span>');} if(prev_page>1){htmls.unshift('<a href="#" data-page="',page-1,'">','','</a>','<a href="#" data-page="1">1</a>');} if(next_page<last_page-1){htmls.push('<span class="ellipsis">...</span>');} if(next_page<last_page){htmls.push('<a href="#" data-page="',last_page,'">',last _page,'</a>','<a href="#" data-page="',page+1,'">','','</a>');} return('<div class="paginator ">'+htmls.join('')+'</div>');},renderingCollection Attributes:function(doc_id,collection){var transformed_collection={'id':collecti on.id,'name':collection.name.truncate(80),doc_id:doc_id,privacy_type:collection. privacy_type,combined_privacy_type:collection.combined_privacy_type} if(collection.selected=='1'){transformed_collection['checked']='checked="checked "';} return transformed_collection;},addToCollectionsEventHandler:function(doc_id,e){ e.stop();var M=Scribd.DocumentCollectionsManager;var add_to_collection=e.findEle ment();var lightbox=$$('#lightbox_document_collections').first();if(lightbox.vis ible()) Scribd.Lightbox.toggle('lightbox_document_collections',0);lightbox.down('.privat e').hide();var manager_container=lightbox.down('.manage_collection');var collect ions_container=manager_container.down('.document_collections_container');if(coll ections_container.retrieve('document_id')!==doc_id){collections_container.store( 'document_id',doc_id);M.renderDoc(doc_id);collections_container.update('');var s pinner=manager_container.down('img');M.loadPageForDocument(doc_id,1,collections_ container,spinner);} Scribd.Lightbox.toggle('lightbox_document_collections',75);},addPaginationEvent: function(){var M=Scribd.DocumentCollectionsManager;var manager_container=$$('#li ghtbox_document_collections .manage_collection').first();var collections_contain er=manager_container.down('.document_collections_container');var spinner=manager _container.down('img');collections_container.observe('click',function(e){var cli cker=e.findElement();if(clicker.getAttribute('data-page')){e.stop();var doc_id=c ollections_container.retrieve('document_id');M.loadPageForDocument(doc_id,clicke r.getAttribute('data-page'),collections_container,spinner);}});},renderDoc:funct ion(doc_id){var M=Scribd.DocumentCollectionsManager;var doc=M.docs[doc_id];var d ocument_container=$$('#lightbox_document_collections .document_container').first ();if(doc){document_container.update(new Scribd.DocumentCell(doc).render('collec tion_old'));if(doc['private']) document_container.parentNode.down('.private').show();}else{document_container.u pdate('');new Ajax.Request("/documents/"+doc_id+'.json',{method:'get',onSuccess:

function(response){if(response.responseJSON){M.docs[doc_id]=response.responseJSO N;M.renderDoc(doc_id);}}});}}} Scribd.DocumentCollectionsManager.Paginator=Class.create({initialize:function(op tions){this.total=options.total,this.per_page=options.per_page 10,this.window_s ize=options.window_size;this.url=options.url,this.params=options.params;}});Scri bd.DocumentCollectionsManager.collections_template=new Template('\ <ul style="right: auto;" class="add_to_my_collections sub_menu">\ #{collections_list}\ #{pagination_control}\ </ul>');Scribd.DocumentCollectionsManager.collection_template=new Template('\ <li class="clearfix document_collection document_collection_#{id}" data-document _collection_id="#{id}">\ <span>\ <img src="/images/loader_black_on_white.gif?1319142822" class="status_lo ader" alt="Loader_black_on_white" style="display:none;">\ <input type="checkbox" value="#{id}" name="document_collection_id" #{che cked}/>\ </span>\ <label>#{name}</label>\ <span class="privacy #{privacy_type}"> #{combined_privacy_type} </span>\ </li>'); /* public/javascripts/perf_analytics.js @ 1319142822 */ function trackPerfAnalytics(pageTracker,perfStart,perfEnd,total){var category=to tal?'Page Load':'DOM Load';var perfTime=perfEnd.getTime()-perfStart.getTime();va r range;if(perfTime<1000) range='less than 1s';else if(perfTime<2000) range='less than 2s';else if(perfTime<5000) range='less than 5s';else if(perfTime<10000) range='less than 10s';else if(perfTime<30000) range='less than 30s';else if(perfTime<45000) range='less than 45s';else range='more than 45s';var path=document.location.pathname;if(document.location.s earch) path+=document.location.search;try{if(pageTracker){pageTracker._trackEvent(categ ory,range,path,Math.round(perfTime/100));}else{_gaq.push(['pageTrackerPerf._trac kEvent',category,range,path,Math.round(perfTime/100)]);}}catch(err){}} /* public/javascripts/doc_cell.js @ 1319142822 */ Scribd.DocumentCell=Class.create({initialize:function(data){this.doc=data;},rend er:function(template){var template_name_and_control=template.split('.');var temp late_name=template_name_and_control[0];var control=template_name_and_control[1]; return Scribd.DocumentCell.templates[template_name].template.evaluate(this[templ ate_name+'_template_data'](control));},collection_template_data:function(control ){return({doc_id:this.doc.id,doc_title:this.doc.title,doc_url:this.doc.url,doc_p age_count:this.doc.page_count,doc_description:this.doc.description.truncate(270) ,doc_thumbnail_url:this.doc.thumbnail_small_url,doc_views:this.doc.views,doc_cre ated_on:this.doc.created_on,doc_category:this.doc.category&&this.doc.category.na me&&['<li class="category"><span class="metadata_label">Category:</span><a href= "',this.doc.category.url+'">',this.doc.category.name+'</a></li>'].join(''),user_ url:this.doc.user.url,user_login:this.doc.user.login,doc_price:this.doc.price&&( '<li class="price"><span class="price">'+this.doc.price+'</span></li>'),doc_read casts:this.doc.readcasts,control:Scribd.DocumentCell.templates.collection.contro ls[control]});},collection_old_template_data:function(control){return({doc_id:th is.doc.id,doc_title:this.doc.title,doc_url:this.doc.url,doc_page_count:this.doc. page_count,doc_description:this.doc.description.truncate(270),doc_thumbnail_url:

this.doc.thumbnail_url,doc_views:this.doc.views,doc_created_on:this.doc.created_ on,doc_category:this.doc.category&&this.doc.category.name&&['<li class="category "><span class="metadata_label">Category:</span><a href="',this.doc.category.url+ '">',this.doc.category.name+'</a></li>'].join(''),user_url:this.doc.user.url,use r_login:this.doc.user.login,doc_price:this.doc.price&&('<li class="price"><span class="price">'+this.doc.price+'</span></li>'),control:Scribd.DocumentCell.templ ates.collection_old.controls[control]});}});Scribd.DocumentCell.templates={colle ction:{controls:{add_document:'<a href="#" class="add_document"> </a>',remove_do cument:'<a href="#" class="subtle_close_button destroy"> </a>'},template:new Tem plate('\ <div class="document_mixed document_summary document_#{doc_id}">\ <div class="document_thumbnail">\ <div class="document_thumbnail_shadow gainlayout">\ <a href="#{doc_url}">\ <div class="thumbnail">\ <img src="#{doc_thumbnail_url}">\ <span class="no_of_pages">#{doc_page_count} p.</span>\ </div>\ </a>\ </div>\ </div>\ <div class="document_body">\ <h4 class="document_title">\ <a class="name_link" href="#{doc_url}">#{doc_title}</a>\ </h4>\ <p class="document_description">#{doc_description}</p>\ <p class="document_attrition">\ <span>From: </span>\ <a href="#{user_url}" class="username">#{user_login}</a>\ </p>\ </div>\ <div class="right_toolbar">#{control}</div>\ <ul class="document_meta pills">\ <li class="meta_node top">\ <label>Reads:</label>\ <strong>#{doc_views}</strong>\ <div class="clearfix"></div>\ </li>\ <li class="meta_node">\ <label>Readcasts:</label>\ <strong>#{doc_readcasts}</strong>\ <div class="clearfix"></div>\ </li>\ <li class="meta_node bottom">\ <label>Uploaded:</label>\ <strong>#{doc_created_on}</strong>\ <div class="clearfix"></div>\ </li>\ </ul>\ <div class="clearfix"></div>\ </div>\ ')},collection_old:{controls:{add_document:'<a href="#" class="add_document"> </ a>',remove_document:'<a href="#" class="close_button destroy"> </a>'},template:n ew Template('\ <div class="document_summary document_#{doc_id}">\ <div class="clearfix">\ <div class="right_toolbar">\ #{control}\ </div>\ <input type="hidden" class="confirmation" name=document_ids[] value="#{d

oc_id}" />\ <div class="document_thumbnail_shadow">\ <a href="#{doc_url}">\ <div class="thumbnail">\ <img src="#{doc_thumbnail_url}">\ <span class="no_of_pages">#{doc_page_count} p.</span>\ </div>\ </a>\ </div>\ <div class="summary clearfix">\ <h5> \ <a href="#{doc_url}">#{doc_title}</a>\ </h5>\ <div class="description">\ #{doc_description}\ </div>\ <ul class="stats_bottom">\ <div class="left_column">\ #{doc_price}\ <li class="user">\ <span class="metadata_label">From:</span>\ <a class="username" href="#{user_url}">#{user_login}</a> \ </li>\ <li class="created_at">\ <span class="metadata_label">Uploaded:</span> #{doc_crea ted_on}\ </li>\ <li class="views">\ <span class="metadata_label">Reads:</span> #{doc_views}\ </li>\ #{doc_category}\ </div>\ </ul>\ </div>\ </div>\ </div>\ ')}}; /* public/javascripts/4gen_in_doc_search.js @ 1319142822 */ Scribd.init('Scribd','Annotation');Scribd.init('Scribd','Fourgen');Scribd.init(' Scribd','DOM');Scribd.Fourgen.DocSearcher=Class.create({initialize:function(opti ons){var doc_id=options.doc_id,upload_id=options.upload_id,secret_password=optio ns.secret_password;var that=this;this.cache=new Scribd.Fourgen.DocSearcher.Cache (function(query,dataHandler){var cache=this;Scribd.Fourgen.DocSearcher.remote_se arch({'query':query,'doc_id':doc_id,'upload_id':upload_id,'secret_password':secr et_password,success:function(data){if(data){cache.set(query,data);dataHandler(da ta);that.trackEvent('result.success',data.length);}else{cache.set(query,null);th at.trackEvent('result.null');}},failure:function(error){cache.set(query,false);d ataHandler(false);that.trackEvent('result.failed');}});});this.queryHistory=[];t his.queryHistoryIndex=0;},search:function(query,resultHandler){this.queryHistory .push(query);this.queryHistoryIndex=this.queryHistory.length-1;this.trackEvent(' submit');this.cache.fetch(query,resultHandler);},trackEvent:function(eventName,e xtra){if(window.$rat){if(this.currentQuery()){var eventData=[this.queryHistoryIn dex,this.currentQuery()];if(extra!==undefined){eventData.push(extra);} $rat('fourgen.toolbar.search.'+eventName,eventData);}}},currentResults:function( ){return this.cache.get(this.currentQuery());},currentQuery:function(){return th is.queryHistory[this.queryHistoryIndex];},setCurrentQueryTo:function(position){i

f(position>=0&&position<this.queryHistory.length){this.queryHistoryIndex=positio n;}},pastQueries:function(n){var historyLength=this.queryHistory.length,queries= [];n=Math.min(n 10,historyLength);for(var i=1;i<=n;i++){var position=historyLen gth-i;queries.push({'position':position,'query':this.queryHistory[position]});} return queries;}});Scribd.Fourgen.DocSearcher.BASE_URL="/search-4gen";Scribd.Fou rgen.DocSearcher.remote_search=function(options){var params={'query':options.que ry,'wordUploadId':options.upload_id,'wordDocumentId':options.doc_id};if(options. secret_password) params.secretPassword=options.secret_password;new Ajax.Request(Scribd.Fourgen.Do cSearcher.BASE_URL,{parameters:params,method:'get',onSuccess:options.success&&fu nction(resp){options.success(resp.responseJSON);},onFailure:options.failure});}; Scribd.Fourgen.DocSearcher.UI=Class.create({initialize:function(containerSelecto r,searcher){this.searcher=searcher;this.templates=Scribd.Fourgen.DocSearcher.UI. Templates;/*<sl:translate>*/ this.queryPlaceholder='Explorar el documento...';/*</sl:translate>*/ this.query=null;this.selectedResult=null;this.currentHightedText=null;this.loade dPages={};this.highlightedPages={};this.resultsCount=0;this.resultsPosition=0;th is.highlightingSelectedPage={};this.container=$$(containerSelector).first();this .popupContainer=$('search_results_popup');this.form=this.container.down('form'); this.queryInput=this.form.down('.query');this.clearButton=this.form.down('.clear _query');this.searchButton=this.form.down('.search_submit');this.results=this.co ntainer.down('.results');this.summary=this.container.down('.header .search_summa ry');this.queryHistory=this.container.down('.query_history');this.resultSelectio nContainers=this.container.select('.results_selection') this.resultSelectionInfo=this.container.down('.header .result_selection_info') this.attachBehaviors();},attachBehaviors:function(){this.handleSearchForm();this .handleCloseButton();this.handleClearButton();this.handleSearchButton();this.han dleResultsSelectionControls();this.handleResultClick();this.handleHistoryClick() ;docManager.addEvent('pageLoaded',this.handlePageLoaded.bind(this));docManager.a ddEvent('expectedFirstPageChanged',this.handlePageChanged.bind(this));},handleSe archForm:function(){var that=this;this.form.observe('submit',function(e){e.stop( );that.fireSearch();});this.queryInput.setValue(this.queryPlaceholder);this.quer yInput.observe('focus',function(){if(that.queryInput.getValue()===that.queryPlac eholder){that.queryInput.setValue('');}});this.queryInput.observe('keyup',functi on(e){var newquery=that.queryInput.getValue();if(e.keyCode===27){that.hide();} if(newquery&&newquery!==''&&newquery!=that.queryPlaceholder){that.clearButton.ad dClassName('clear_query_on');that.form.addClassName('querying');}else{that.clear Button.removeClassName('clear_query_on');that.form.removeClassName('querying');} });this.form.enable();},handleCloseButton:function(){var that=this;this.containe r.down('.header .close_button').observe('click',function(e){e.stop();that.hide() ;});},handleClearButton:function(){var that=this;this.clearButton.observe('click ',function(e){e.stop();that.resetAndClearQuery();});},handleSearchButton:functio n(){var that=this;this.searchButton.observe('click',function(e){e.stop();that.fi reSearch();});},handlePageLoaded:function(container){var pageNum=/^outer_page_(\ d+)$/.exec(container.id)[1];if(this.query&&!this.isHighlightingSelectedPage(page Num)){this.setLoadedPage(pageNum);this.highlightOnPage(pageNum,this.query);}},ha ndlePageChanged:function(pageNum){if(this.query&&!this.hasHighlightedPage(pageNu m)&&!this.isHighlightingSelectedPage(pageNum)) this.highlightOnPage(pageNum,this.query);},handleResultsSelectionControls:functi on(){var that=this;this.resultSelectionContainers.invoke('observe','click',funct ion(e){e.stop();var clicker=e.findElement();if(clicker.hasClassName('next')){tha t.gotoNextSelected();}else if(clicker.hasClassName('previous')){that.gotoPreviou sSelected();}});},handleResultClick:function(){var that=this;this.results.observ e('click',function(e){var result=e.findElement().up();if(result.hasClassName('re sult')){e.stop();that.gotoSelectedPage(result);}});},handleHistoryClick:function (){var that=this;if(this.queryHistory){this.queryHistory.observe('click',functio n(e){e.stop();var clicked=e.findElement();if(!clicked.hasClassName('selected')&& clicked.readAttribute('data-position')){var position=parseInt(clicked.readAttrib ute('data-position'));that.queryHistory.select('a.selected').invoke('removeClass Name','selected')

clicked.addClassName('selected') that.searcher.setCurrentQueryTo(position);that.queryInput.setValue(that.searcher .currentQuery());that.query=that.searcher.currentQuery();that.renderResults(that .searcher.currentResults());that.renderResultSelectionInfo()}});}},fireSearch:fu nction(){var that=this;if(this.query!==this.queryInput.getValue()){this.reset(); this.query=this.queryInput.getValue();if(this.query&&this.query!==''&&this.query !==this.queryPlaceholder){this.renderSearching();this.show();this.searcher.searc h(this.query,function(data){that.renderResults(data);that.gotoNextSelected();}); this.renderQueryHistory();}else{this.resetAndClearQuery();}}else{if(this.query&& this.query!==''&&this.query!==this.queryPlaceholder){this.toggle();}}},gotoNextS elected:function(){if(this.resultsCount<=0)return;if(this.selectedResult&&this.s electedResult.next('.result')){this.setSelectedResult(this.selectedResult.next(' .result'));}else{this.setSelectedResult(this.results.down('.result'));} this.gotoSelected();},gotoPreviousSelected:function(){if(this.resultsCount<=0)re turn;if(this.selectedResult&&this.selectedResult.previous('.result')){this.setSe lectedResult(this.selectedResult.previous('.result'));}else{this.setSelectedResu lt(this.results.down('.result',this.resultsCount-1));} this.gotoSelected();},gotoSelected:function(){if(this.selectedResult){var positi on=parseInt(this.selectedResult.readAttribute('data-position'));if(position<this .resultsPosition){this.resultsPosition=position;}else if(position>this.resultsPo sition+3){this.resultsPosition=Math.max(0,position-3);} this.results.scrollTop=this.selectedResult.getHeight()*this.resultsPosition;this .gotoSelectedPage(this.selectedResult);}},gotoSelectedPage:function(result){var that=this;this.setSelectedResult(result);this.renderResultSelectionInfo();var pa geNum=result.readAttribute('data-pagenum'),position=result.readAttribute('data-p osition');if(pageNum!=docManager.currentPageNum()){this.setHighlightingSelectedP age(pageNum);docManager.gotoPage(pageNum);} this.highlightOnPage(pageNum,that.query,function(){var highlightedIndex=0,snippe ts=that.results.select('.pagefound'+pageNum);for(var i=0;i<snippets.length;i++){ if(position==snippets[i].getAttribute('data-position')){highlightedIndex=i;break ;}} var expectedHighlightsOnPage=snippets.length,highlighted=$$('#outer_page_'+pageN um+' .fourgen_highlight'),currentHighlighted=highlighted[highlightedIndex];if(cu rrentHighlighted){if(that.currentHighlightedText)that.currentHighlightedText.rem oveClassName('fourgen_highlight_selected') that.currentHighlightedText=currentHighlighted;currentHighlighted.addClassName(' fourgen_highlight_selected');var offset=Scribd.DOM.scaledCumulativeOffset(curren tHighlighted);if(offset!==0){window.scrollTo(offset.left,offset.top-10);}} that.unsetHighlightingSelectedPage(pageNum);});},highlightOnPage:function(pageNu m,query,callback){var that=this;var snippets=this.results.select('.pagefound'+pa geNum);var expectedHighlightsOnPage=snippets.length;if(expectedHighlightsOnPage> 0){var page_container_id='outer_page_'+pageNum;if(that.hasLoadedPage(pageNum)){S cribd.Annotation.highlightText($(page_container_id),query,'fourgen_highlight');t hat.setHighlightedPage(pageNum);callback&&callback($$('#outer_page_'+pageNum+' . fourgen_highlight'));}else{var _highlight=function(attempt,retries){window.setTi meout(function(){var found=Scribd.Annotation.highlightText($(page_container_id), query,'fourgen_highlight');if(attempt<retries&&found<expectedHighlightsOnPage){r eturn _highlight(attempt+1,retries);} that.setHighlightedPage(pageNum);callback&&callback($$('#outer_page_'+pageNum+' .fourgen_highlight'));},500);} _highlight(0,8);}}},renderResults:function(data){if(this.query){if(data&&data.le ngth>0){this.resultsCount=data.length;var results=[];var matchPattern=new RegExp ('('+RegExp.escape(this.query)+')','i');this.form.addClassName('found');this.ren derResultsSelectionControls();this.summary.update(this.templates.summary.evaluat e({count:data.length,query:this.query.escapeHTML()}));for(var i=0;i<data.length; i++){var d=data[i];var snippet=d.snippet.escapeHTML().sub(matchPattern,function( match){return('<span class="found">'+match[1]+'</span>');});results[i]=this.temp lates.result.evaluate({position:i,pageNum:d.pageNum,'snippet':snippet});} this.results.update(results.join(''));}else{this.resultsCount=0;this.form.remove ClassName('found');this.summary.update(this.templates.summary.evaluate({count:0,

query:this.query.escapeHTML()}));this.results.update('No search result is found' );} this.show();}},renderSearching:function(){this.renderResultsSelectionControls(); this.form.addClassName('querying');this.summary.update(this.templates.searching. evaluate({query:this.query.escapeHTML()}));this.results.update(this.templates.sp inner.evaluate());},renderResultsSelectionControls:function(){this.resultsCount= ==0?this.resultSelectionContainers.invoke('hide'):this.resultSelectionContainers .invoke('show');},renderResultSelectionInfo:function(){if(this.resultSelectionIn fo&&this.selectedResult&&this.resultsCount!==0){var position=parseInt(this.selec tedResult.readAttribute('data-position'));this.resultSelectionInfo.update('Resul t '+(position+1)+' of '+this.resultsCount);}else{this.resultSelectionInfo.update ('');}},renderQueryHistory:function(){if(this.queryHistory){var queries=this.sea rcher.pastQueries(6);if(queries.length>1){this.queryHistory.update('<span class= "label">Search history: </span>'+ $A(queries).map(function(q){return Scribd.Fourgen.DocSearcher.UI.Templates.query History.evaluate({position:q.position,query:q.query.truncate('25').escapeHTML()} );}).join('<span class="sep"> </span>'));this.queryHistory.down('a').addClassName ('selected');this.queryHistory.show();}}},show:function(){if(!this.popupContaine r.visible()) Scribd.Toolbar.handlePopup(this.popupContainer.id);Scribd.Toolbar.viewmode_popup .hide();},hide:function(){if(this.popupContainer.visible()) Scribd.Toolbar.handlePopup(this.popupContainer.id);},toggle:function(){Scribd.To olbar.handlePopup(this.popupContainer.id);Scribd.Toolbar.viewmode_popup.hide();} ,reset:function(){this.query=null,this.resultsCount=0;this.highlightedPages={},t his.highlightingSelectedPage={};Scribd.Annotation.removeHighlight();this.resetSe lectedResult();this.form.removeClassName('found');this.resultSelectionContainers .invoke('hide');},resetAndClearQuery:function(){this.reset();this.queryInput.set Value(this.queryPlaceholder);this.clearButton.removeClassName('clear_query_on'); this.form.removeClassName('querying');this.hide();},setSelectedResult:function(r esult){if(!result)return;if(this.selectedResult){this.selectedResult.removeClass Name('selected');} result.addClassName('selected');this.selectedResult=result;},resetSelectedResult :function(){if(this.selectedResult){this.selectedResult.removeClassName('selecte d');this.selectedResult=null;}},isHighlightingSelectedPage:function(pageNum){ret urn this.highlightingSelectedPage['p'+pageNum]===true;},setHighlightingSelectedP age:function(pageNum){this.highlightingSelectedPage['p'+pageNum]=true;},unsetHig hlightingSelectedPage:function(pageNum){this.highlightingSelectedPage['p'+pageNu m]=false;},hasLoadedPage:function(pageNum){return this.loadedPages['p'+pageNum]= ==true;},setLoadedPage:function(pageNum){this.loadedPages['p'+pageNum]=true;},ha sHighlightedPage:function(pageNum){return this.highlightedPages['p'+pageNum]===t rue;},setHighlightedPage:function(pageNum){this.highlightedPages['p'+pageNum]=tr ue;}});Scribd.Fourgen.DocSearcher.UI.Templates={summary:new Template('<span clas s="count">#{count}</span> results for: <span class="found">#{query}</span>'),res ult:new Template('\ <a class="result pagefound#{pageNum}" data-position="#{position}" data-pagen um="#{pageNum}">\ <span class="snippet">...#{snippet}...</span>\ <span class="page">p. #{pageNum}</span>\ </a>'),searching:new Template('Searching for: <span class="found">#{query}</ span>'),spinner:new Template('<img src="/images/4gen/spinner_24x24.gif" class="s pinner"/>'),queryHistory:new Template('<a data-position="#{position}">#{query}</ a>')};Scribd.Fourgen.DocSearcher.Cache=Class.create({initialize:function(missHan dler){this.cache={};this.missHandler=missHandler.bind(this);},fetch:function(key ,dataHandler){var data=this.get(key);if(data===undefined){this.missHandler(key,d ataHandler);}else{dataHandler(data);}},get:function(key){return this.cache[this. _normalizedKey(key)];},set:function(key,data){this.cache[this._normalizedKey(key )]=data;},_normalizedKey:function(key){if(key) return key.toUpperCase();return key;}});Scribd.Annotation.highlightText=function (node,text,highlightClass){var highlightClass=highlightClass 'fourgen_highlight ';var highlighted=0;var highlight=function(node){var skip=0;if(node.nodeType==3)

{var pos=node.data.toUpperCase().indexOf(text.toUpperCase());if(pos>=0){var span _node=document.createElement('span');span_node.className=highlightClass;var foun d=node.splitText(pos);found.splitText(text.length);var found_clone=found.cloneNo de(true);span_node.appendChild(found_clone);found.parentNode.replaceChild(span_n ode,found);skip=1;highlighted++;}}else if(node.nodeType==1&&node.childNodes&&!/( script style)/i.test(node.tagName)){if(node.className?node.className.indexOf(hig hlightClass)<0:true){for(var i=0;i<node.childNodes.length;++i) i+=highlight(node.childNodes[i]);}else{highlighted++;}} return skip;};highlight(node);return highlighted;};Scribd.Annotation.removeHighl ight=function(highlightSelector){var highlightSelector=highlightSelector '.four gen_highlight' $$(highlightSelector).each(function(e){var parent=e.parentNode;parent.replaceChi ld(e.firstChild,e);parent.normalize();});};Scribd.DOM.scaledCumulativeOffset=fun ction(element){if(Prototype.Browser.IE){Scribd.DOM.scaledCumulativeOffset=functi on(elem){var top=0,left=0;do{var scale=parseFloat(elem.getStyle('zoom'))/100;if( scale){top*=scale;left*=scale;} top+=elem.offsetTop;left+=elem.offsetLeft;elem=elem.offsetParent;}while(elem);re turn Element._returnOffset(left,top);}}else if(Prototype.Browser.WebKit Prototy pe.Browser.Gecko){var transformStyle=Prototype.Browser.WebKit?'-webkit-transform ':'-moz-transform';Scribd.DOM.scaledCumulativeOffset=function(elem){var top=0,le ft=0,transformParser=new RegExp("scale\\(([0-9\\.]+)\\) matrix\\(([0-9\\.]+,)"); do{var matchedScale=transformParser.exec(Element.getStyle(elem,transformStyle)); if(matchedScale&&matchedScale.length>1){var scale=parseFloat(matchedScale[1] ma tchedScale[2]);top*=scale;left*=scale;} top+=elem.offsetTop;left+=elem.offsetLeft;elem=elem.offsetParent;}while(elem);re turn Element._returnOffset(left,top);}}else{Scribd.DOM.scaledCumulativeOffset=El ement.cumulativeOffset;} return Scribd.DOM.scaledCumulativeOffset(element);}; /* public/javascripts/prototip/prototip.js @ 1319142822 */ var Prototip={Version:'2.2.0.2'};var Tips={options:{paths:{images:'/images/proto tip/',javascript:'../../javascripts/prototip/'},zIndex:6000}};Prototip.Styles={' default':{border:6,borderColor:'#c7c7c7',className:'default',closeButton:false,h ideAfter:false,hideOn:'mouseleave',hook:false,radius:6,showOn:'mousemove',stem:{ height:12,width:15}},'protoblue':{className:'protoblue',border:6,borderColor:'#1 16497',radius:6,stem:{height:12,width:15}},'darkgrey':{className:'darkgrey',bord er:6,borderColor:'#363636',radius:6,stem:{height:12,width:15}},'creamy':{classNa me:'creamy',border:6,borderColor:'#ebe4b4',radius:6,stem:{height:12,width:15}},' protogrey':{className:'protogrey',border:6,borderColor:'#606060',radius:6,stem:{ height:12,width:15}},'black_trans':{className:'black_trans',border:0,radius:0,of fset:{x:0,y:-2},stem:{position:'bottomMiddle',width:9,height:5},hook:{target:'to pMiddle',tip:'bottomMiddle'}},'black_trans_bottom':{className:'black_trans_botto m',border:0,radius:0,offset:{x:0,y:-2},stem:{position:'topMiddle',width:9,height :5},hook:{target:'bottomMiddle',tip:'topMiddle'}},'black_trans_right':{className :'black_trans_right',border:0,radius:0,offset:{x:0,y:0},stem:{position:'leftMidd le',width:35,height:9},hook:{target:'rightMiddle',tip:'leftMiddle'}}};eval(funct ion(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?Strin g.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e( c)]=k[c] e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};whil e(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('M.10 (11,{4p:"1.6.1",2J:{24:!!X.4q("24").3q},3r:p(a){4r{X.4s("<2g 3s=\'3t/1y\' 1C=\'" +a+"\'><\\/2g>")}4t(b){$$("4u")[0].J(I G("2g",{1C:a,3s:"3t/1y"}))}},3u:p(){3.3v( "2K");q a=/1D([\\w\\d-2L.]+)?\\.3w(.*)/;3.2M=(($$("2g[1C]").4v(p(b){K b.1C.25(a) }) {}).1C "").2N(a,"");s.26=(p(b){K{T:(/^(3x?:\\/\\/ \\/)/.3y(b.T))?b.T:3.2M+b .T,1y:(/^(3x?:\\/\\/ \\/)/.3y(b.1y))?b.1y:3.2M+b.1y}}.1d(3))(s.9.26);o(!11.2h){3 .3r(s.26.1y+"3z.3w")}o(!3.2J.24){o(X.4w>=8&&!X.3A.2i){X.3A.2O("2i","4x:4y-4z-4A: 4B","#2j#3B")}Y{X.1a("3C:2P",p(){q b=X.4C();b.4D="2i\\\\:*{4E:2Q(#2j#3B)}"})}}s. 2k();G.1a(2R,"2S",3.2S)},3v:p(a){o((4F 2R[a]=="4G") (3.2T(2R[a].4H)<3.2T(3["3D"

+a]))){3E("11 4I "+a+" >= "+3["3D"+a]);}},2T:p(a){q b=a.2N(/2L.* \\./g,"");b=4J( b+"0".4K(4-b.1Q));K a.4L("2L")>-1?b-1:b},2U:p(a){K(a>0)?(-1*a):(a).4M()},2S:p(){ s.3F()}});M.10(s,(p(){p a(b){o(!b){K}b.3G();o(b.13){b.E.1E();o(s.1i){b.1l.1E()}} s.1m=s.1m.3H(b)}K{1m:[],15:[],2k:p(){3.2l=3.1n},27:{B:"2V",2V:"B",u:"1o",1o:"u", 1R:"1R",1b:"1e",1e:"1b"},3I:{H:"1b",F:"1e"},2W:p(b){K!!1S[1]?3.27[b]:b},1i:(p(c) {q b=I 4N("4O ([\\\\d.]+)").4P(c);K b?(3J(b[1])<7):U})(4Q.4R),2X:(2K.4S.4T&&!X.4 U),2O:p(b){3.1m.28(b)},1E:p(d){q g,e=[];1T(q c=0,b=3.1m.1Q;c<b;c++){q f=3.1m[c]; o(!g&&f.C==$(d)){g=f}Y{o(!f.C.3K){e.28(f)}}}a(g);1T(q c=0,b=e.1Q;c<b;c++){q f=e[ c];a(f)}d.1D=29},3F:p(){1T(q c=0,b=3.1m.1Q;c<b;c++){a(3.1m[c])}},2m:p(d){o(d==3. 3L){K}o(3.15.1Q===0){3.2l=3.9.1n;1T(q c=0,b=3.1m.1Q;c<b;c++){3.1m[c].E.r({1n:3.9 .1n})}}d.E.r({1n:3.2l++});o(d.Q){d.Q.r({1n:3.2l})}3.3L=d},3M:p(b){3.2Y(b);3.15.2 8(b)},2Y:p(b){3.15=3.15.3H(b)},3N:p(){s.15.1F("S")},V:p(c,g){c=$(c),g=$(g);q l=M .10({1c:{x:0,y:0},N:U},1S[2] {});q e=l.1t g.2n();e.B+=l.1c.x;e.u+=l.1c.y;q d=l .1t?[0,0]:g.3O(),b=X.1z.2o(),h=l.1t?"1U":"17";e.B+=(-1*(d[0]-b[0]));e.u+=(-1*(d[ 1]-b[1]));o(l.1t){q f=[0,0];f.H=0;f.F=0}q j={C:c.1V()},k={C:M.2a(e)};j[h]=l.1t?f :g.1V();k[h]=M.2a(e);1T(q i 3P k){3Q(l[i]){R"4V":R"4W":k[i].B+=j[i].H;18;R"4X":k [i].B+=(j[i].H/2);18;R"4Y":k[i].B+=j[i].H;k[i].u+=(j[i].F/2);18;R"4Z":R"51":k[i] .u+=j[i].F;18;R"52":R"53":k[i].B+=j[i].H;k[i].u+=j[i].F;18;R"54":k[i].B+=(j[i].H /2);k[i].u+=j[i].F;18;R"55":k[i].u+=(j[i].F/2);18}}e.B+=-1*(k.C.B-k[h].B);e.u+=1*(k.C.u-k[h].u);o(l.N){c.r({B:e.B+"v",u:e.u+"v"})}K e}}})());s.2k();q 56=57.3R( {2k:p(c,e){3.C=$(c);o(!3.C){3E("11: G 58 59, 5a 3R a 13.");K}s.1E(3.C);q a=(M.2p (e) M.2Z(e)),b=a?1S[2] []:e;3.1p=a?e:29;o(b.1W){b=M.10(M.2a(11.2h[b.1W]),b)}3. 9=M.10(M.10({1j:U,1f:0,30:"#5b",1k:0,L:s.9.L,19:s.9.5c,1u:!(b.W&&b.W=="1X")?0.14 :U,1q:U,1g:"1G",3S:U,V:b.V,1c:b.V?{x:0,y:0}:{x:16,y:16},1H:(b.V&&!b.V.1t)?1h:U,W :"2q",D:U,1W:"2j",17:3.C,12:U,1z:(b.V&&!b.V.1t)?U:1h,H:U},11.2h["2j"]),b);3.17=$ (3.9.17);3.1k=3.9.1k;3.1f=(3.1k>3.9.1f)?3.1k:3.9.1f;o(3.9.T){3.T=3.9.T.3T("://") ?3.9.T:s.26.T+3.9.T}Y{3.T=s.26.T+"3z/"+(3.9.1W "")+"/"}o(!3.T.5d("/")){3.T+="/" }o(M.2p(3.9.D)){3.9.D={N:3.9.D}}o(3.9.D.N){3.9.D=M.10(M.2a(11.2h[3.9.1W].D) {}, 3.9.D);3.9.D.N=[3.9.D.N.25(/[a-z]+/)[0].2r(),3.9.D.N.25(/[A-Z][a-z]+/)[0].2r()]; 3.9.D.1A=["B","2V"].5e(3.9.D.N[0])?"1b":"1e";3.1r={1b:U,1e:U}}o(3.9.1j){3.9.1j.9 =M.10({31:2K.5f},3.9.1j.9 {})}o(3.9.V.1t){q d=3.9.V.1s.25(/[a-z]+/)[0].2r();3.1 U=s.27[d]+s.27[3.9.V.1s.25(/[A-Z][a-z]+/)[0].2r()].2s()}3.3U=(s.2X&&3.1k);3.3V() ;s.2O(3);3.3W();11.10(3)},3V:p(){3.E=I G("P",{L:"1D"}).r({1n:s.9.1n});o(3.3U){3. E.S=p(){3.r("B:-3X;u:-3X;1I:2t;");K 3};3.E.O=p(){3.r("1I:15");K 3};3.E.15=p(){K( 3.32("1I")=="15"&&3J(3.32("u").2N("v",""))>-5g)}}3.E.S();o(s.1i){3.1l=I G("5h",{ L:"1l",1C:"1y:U;",5i:0}).r({2u:"2b",1n:s.9.1n-1,5j:0})}o(3.9.1j){3.1Y=3.1Y.33(3. 34)}3.1s=I G("P",{L:"1p"});3.12=I G("P",{L:"12"}).S();o(3.9.19 (3.9.1g.C&&3.9.1 g.C=="19")){3.19=I G("P",{L:"2c"}).1Z(3.T+"2c.2v")}},2w:p(){o(X.2P){3.35();3.3Y= 1h;K 1h}Y{o(!3.3Y){X.1a("3C:2P",3.35);K U}}},35:p(){$(X.36).J(3.E);o(s.1i){$(X.3 6).J(3.1l)}o(3.9.1j){$(X.36).J(3.Q=I G("P",{L:"5k"}).1Z(3.T+"Q.5l").S())}q g="E" ;o(3.9.D.N){3.D=I G("P",{L:"5m"}).r({F:3.9.D[3.9.D.1A=="1e"?"F":"H"]+"v"});q b=3 .9.D.1A=="1b";3[g].J(3.37=I G("P",{L:"5n 2x"}).J(3.3Z=I G("P",{L:"5o 2x"})));3.D .J(3.1J=I G("P",{L:"5p"}).r({F:3.9.D[b?"H":"F"]+"v",H:3.9.D[b?"F":"H"]+"v"}));o( s.1i&&!3.9.D.N[1].40().3T("5q")){3.1J.r({2u:"5r"})}g="3Z"}o(3.1f){q d=3.1f,f;3[g ].J(3.20=I G("5s",{L:"20"}).J(3.21=I G("38",{L:"21 39"}).r("F: "+d+"v").J(I G("P ",{L:"2y 5t"}).J(I G("P",{L:"22"}))).J(f=I G("P",{L:"5u"}).r({F:d+"v"}).J(I G("P ",{L:"41"}).r({1v:"0 "+d+"v",F:d+"v"}))).J(I G("P",{L:"2y 5v"}).J(I G("P",{L:"22 "})))).J(3.3a=I G("38",{L:"3a 39"}).J(3.3b=I G("P",{L:"3b"}).r("2z: 0 "+d+"v"))) .J(3.42=I G("38",{L:"42 39"}).r("F: "+d+"v").J(I G("P",{L:"2y 5w"}).J(I G("P",{L :"22"}))).J(f.5x(1h)).J(I G("P",{L:"2y 5y"}).J(I G("P",{L:"22"})))));g="3b";q c= 3.20.3c(".22");$w("5z 5A 5B 5C").43(p(j,h){o(3.1k>0){11.44(c[h],j,{1K:3.9.30,1f: d,1k:3.9.1k})}Y{c[h].2A("45")}c[h].r({H:d+"v",F:d+"v"}).2A("22"+j.2s())}.1d(3)); 3.20.3c(".41",".3a",".45").1F("r",{1K:3.9.30})}3[g].J(3.13=I G("P",{L:"13 "+3.9. L}).J(3.23=I G("P",{L:"23"}).J(3.12)));o(3.9.H){q e=3.9.H;o(M.5D(e)){e+="v"}3.13 .r("H:"+e)}o(3.D){q a={};a[3.9.D.1A=="1b"?"u":"1o"]=3.D;3.E.J(a);3.2e()}3.13.J(3 .1s);o(!3.9.1j){3.3d({12:3.9.12,1p:3.1p})}},3d:p(e){q a=3.E.32("1I");3.E.r("F:1L ;H:1L;1I:2t").O();o(3.1f){3.21.r("F:0");3.21.r("F:0")}o(e.12){3.12.O().46(e.12); 3.23.O()}Y{o(!3.19){3.12.S();3.23.S()}}o(M.2Z(e.1p)){e.1p.O()}o(M.2p(e.1p) M.2Z (e.1p)){3.1s.46(e.1p)}3.13.r({H:3.13.47()+"v"});3.E.r("1I:15").O();3.13.O();q c= 3.13.1V(),b={H:c.H+"v"},d=[3.E];o(s.1i){d.28(3.1l)}o(3.19){3.12.O().J({u:3.19});

3.23.O()}o(e.12 3.19){3.23.r("H: 3e%")}b.F=29;3.E.r({1I:a});3.1s.2A("2x");o(e.1 2 3.19){3.12.2A("2x")}o(3.1f){3.21.r("F:"+3.1f+"v");3.21.r("F:"+3.1f+"v");b="H: "+(c.H+2*3.1f)+"v";d.28(3.20)}d.1F("r",b);o(3.D){3.2e();o(3.9.D.1A=="1b"){3.E.r ({H:3.E.47()+3.9.D.F+"v"})}}3.E.S()},3W:p(){3.3f=3.1Y.1w(3);3.48=3.S.1w(3);o(3.9 .1H&&3.9.W=="2q"){3.9.W="3g"}o(3.9.W&&3.9.W==3.9.1g){3.1M=3.49.1w(3);3.C.1a(3.9. W,3.1M)}o(3.19){3.19.1a("3g",p(d){d.1Z(3.T+"5E.2v")}.1d(3,3.19)).1a("3h",p(d){d. 1Z(3.T+"2c.2v")}.1d(3,3.19))}q c={C:3.1M?[]:[3.C],17:3.1M?[]:[3.17],1s:3.1M?[]:[ 3.E],19:[],2b:[]},a=3.9.1g.C;3.3i=a (!3.9.1g?"2b":"C");3.1N=c[3.3i];o(!3.1N&&a& &M.2p(a)){3.1N=3.1s.3c(a)}$w("O S").43(p(g){q f=g.2s(),d=(3.9[g+"4a"].5F 3.9[g+ "4a"]);o(d=="3g"){d=="3j"}Y{o(d=="3h"){d=="1G"}}3[g+"5G"]=d}.1d(3));o(!3.1M&&3.9 .W){3.C.1a(3.9.W,3.3f)}o(3.1N&&3.9.1g){3.1N.1F("1a",3.5H,3.48)}o(!3.9.1H&&3.9.W= ="1X"){3.2B=3.N.1w(3);3.C.1a("2q",3.2B)}3.4b=3.S.33(p(f,e){q d=e.5I(".2c");o(d){ d.5J();e.5K();f(e)}}).1w(3);o(3.19 (3.9.1g&&(3.9.1g.C==".2c"))){3.E.1a("1X",3.4 b)}o(3.9.W!="1X"&&(3.3i!="C")){3.2C=p(){3.1B("O")}.1w(3);3.C.1a("1G",3.2C)}o(3.9 .1g 3.9.1q){q b=[3.C,3.E];3.3k=p(){s.2m(3);3.2D()}.1w(3);3.3l=3.1q.1w(3);b.1F(" 1a","3j",3.3k).1F("1a","1G",3.3l)}o(3.9.1j&&3.9.W!="1X"){3.2E=3.4c.1w(3);3.C.1a( "1G",3.2E)}},3G:p(){o(3.9.W&&3.9.W==3.9.1g){3.C.1x(3.9.W,3.1M)}Y{o(3.9.W){3.C.1x (3.9.W,3.3f)}o(3.1N&&3.9.1g){3.1N.1F("1x")}}o(3.2B){3.C.1x("2q",3.2B)}o(3.2C){3. C.1x("3h",3.2C)}3.E.1x();o(3.9.1g 3.9.1q){3.C.1x("3j",3.3k).1x("1G",3.3l)}o(3.2 E){3.C.1x("1G",3.2E)}},34:p(c,b){o(!3.13){o(!3.2w()){K}}3.N(b);o(3.2F){K}Y{o(3.4 d){c(b);K}}3.2F=1h;q e=b.5L(),d={2f:{1O:e.x,1P:e.y}};q a=M.2a(3.9.1j.9);a.31=a.3 1.33(p(g,f){3.3d({12:3.9.12,1p:f.5M});3.N(d);(p(){g(f);q h=(3.Q&&3.Q.15());o(3.Q ){3.1B("Q");3.Q.1E();3.Q=29}o(h){3.O()}3.4d=1h;3.2F=29}.1d(3)).1u(0.6)}.1d(3));3 .5N=G.O.1u(3.9.1u,3.Q);3.E.S();3.2F=1h;3.Q.O();3.5O=(p(){I 5P.5Q(3.9.1j.2Q,a)}.1 d(3)).1u(3.9.1u);K U},4c:p(){3.1B("Q")},1Y:p(a){o(!3.13){o(!3.2w()){K}}3.N(a);o( 3.E.15()){K}3.1B("O");3.5R=3.O.1d(3).1u(3.9.1u)},1B:p(a){o(3[a+"4e"]){5S(3[a+"4e "])}},O:p(){o(3.E.15()){K}o(s.1i){3.1l.O()}o(3.9.3S){s.3N()}s.3M(3);3.13.O();3.E .O();o(3.D){3.D.O()}3.C.4f("1D:5T")},1q:p(a){o(3.9.1j){o(3.Q&&3.9.W!="1X"){3.Q.S ()}}o(!3.9.1q){K}3.2D();3.5U=3.S.1d(3).1u(3.9.1q)},2D:p(){o(3.9.1q){3.1B("1q")}} ,S:p(){3.1B("O");3.1B("Q");o(!3.E.15()){K}3.4g()},4g:p(){o(s.1i){3.1l.S()}o(3.Q) {3.Q.S()}3.E.S();(3.20 3.13).O();s.2Y(3);3.C.4f("1D:2t")},49:p(a){o(3.E&&3.E.15 ()){3.S(a)}Y{3.1Y(a)}},2e:p(){q c=3.9.D,b=1S[0] 3.1r,d=s.2W(c.N[0],b[c.1A]),f=s .2W(c.N[1],b[s.27[c.1A]]),a=3.1k 0;3.1J.1Z(3.T+d+f+".2v");o(c.1A=="1b"){q e=(d= ="B")?c.F:0;3.37.r("B: "+e+"v;");3.1J.r({"2G":d});3.D.r({B:0,u:(f=="1o"?"3e%":f= ="1R"?"50%":0),5V:(f=="1o"?-1*c.H:f=="1R"?-0.5*c.H:0)+(f=="1o"?-1*a:f=="u"?a:0)+ "v"})}Y{3.37.r(d=="u"?"1v: 0; 2z: "+c.F+"v 0 0 0;":"2z: 0; 1v: 0 0 "+c.F+"v 0;") ;3.D.r(d=="u"?"u: 0; 1o: 1L;":"u: 1L; 1o: 0;");3.1J.r({1v:0,"2G":f!="1R"?f:"2b"} );o(f=="1R"){3.1J.r("1v: 0 1L;")}Y{3.1J.r("1v-"+f+": "+a+"v;")}o(s.2X){o(d=="1o" ){3.D.r({N:"4h",5W:"5X",u:"1L",1o:"1L","2G":"B",H:"3e%",1v:(-1*c.F)+"v 0 0 0"}); 3.D.1W.2u="4i"}Y{3.D.r({N:"4j","2G":"2b",1v:0})}}}3.1r=b},N:p(b){o(!3.13){o(!3.2 w()){K}}s.2m(3);o(s.1i){q a=3.E.1V();o(!3.2H 3.2H.F!=a.F 3.2H.H!=a.H){3.1l.r({ H:a.H+"v",F:a.F+"v"})}3.2H=a}o(3.9.V){q j,h;o(3.1U){q k=X.1z.2o(),c=b.2f {};q g ,i=2;3Q(3.1U.40()){R"5Y":R"5Z":g={x:0-i,y:0-i};18;R"60":g={x:0,y:0-i};18;R"61":R "62":g={x:i,y:0-i};18;R"63":g={x:i,y:0};18;R"64":R"65":g={x:i,y:i};18;R"66":g={x :0,y:i};18;R"67":R"68":g={x:0-i,y:i};18;R"69":g={x:0-i,y:0};18}g.x+=3.9.1c.x;g.y +=3.9.1c.y;j=M.10({1c:g},{C:3.9.V.1s,1U:3.1U,1t:{u:c.1P 2I.1P(b)-k.u,B:c.1O 2I .1O(b)-k.B}});h=s.V(3.E,3.17,j);o(3.9.1z){q n=3.3m(h),m=n.1r;h=n.N;h.B+=m.1e?2*1 1.2U(g.x-3.9.1c.x):0;h.u+=m.1e?2*11.2U(g.y-3.9.1c.y):0;o(3.D&&(3.1r.1b!=m.1b 3. 1r.1e!=m.1e)){3.2e(m)}}h={B:h.B+"v",u:h.u+"v"};3.E.r(h)}Y{j=M.10({1c:3.9.1c},{C: 3.9.V.1s,17:3.9.V.17});h=s.V(3.E,3.17,M.10({N:1h},j));h={B:h.B+"v",u:h.u+"v"}}o( 3.Q){q e=s.V(3.Q,3.17,M.10({N:1h},j))}o(s.1i){3.1l.r(h)}}Y{q f=3.17.2n(),c=b.2f {},h={B:((3.9.1H)?f[0]:c.1O 2I.1O(b))+3.9.1c.x,u:((3.9.1H)?f[1]:c.1P 2I.1P(b) )+3.9.1c.y};o(!3.9.1H&&3.C!==3.17){q d=3.C.2n();h.B+=-1*(d[0]-f[0]);h.u+=-1*(d[1 ]-f[1])}o(!3.9.1H&&3.9.1z){q n=3.3m(h),m=n.1r;h=n.N;o(3.D&&(3.1r.1b!=m.1b 3.1r. 1e!=m.1e)){3.2e(m)}}h={B:h.B+"v",u:h.u+"v"};3.E.r(h);o(3.Q){3.Q.r(h)}o(s.1i){3.1 l.r(h)}}},3m:p(c){q e={1b:U,1e:U},d=3.E.1V(),b=X.1z.2o(),a=X.1z.1V(),g={B:"H",u: "F"};1T(q f 3P g){o((c[f]+d[g[f]]-b[f])>a[g[f]]){c[f]=c[f]-(d[g[f]]+(2*3.9.1c[f= ="B"?"x":"y"]));o(3.D){e[s.3I[g[f]]]=1h}}}K{N:c,1r:e}}});M.10(11,{44:p(d,g){q j= 1S[2] 3.9,f=j.1k,c=j.1f,e={u:(g.4k(0)=="t"),B:(g.4k(1)=="l")};o(3.2J.24){q b=I G("24",{L:"6a"+g.2s(),H:c+"v",F:c+"v"});d.J(b);q i=b.3q("2d");i.6b=j.1K;i.6c((e.

B?f:c-f),(e.u?f:c-f),f,0,6d.6e*2,1h);i.6f();i.4l((e.B?f:0),0,c-f,c);i.4l(0,(e.u? f:0),c,c-f)}Y{q h;d.J(h=I G("P").r({H:c+"v",F:c+"v",1v:0,2z:0,2u:"4i",N:"4h",6g: "2t"}));q a=I G("2i:6h",{6i:j.1K,6j:"6k",6l:j.1K,6m:(f/c*0.5).6n(2)}).r({H:2*c-1 +"v",F:2*c-1+"v",N:"4j",B:(e.B?0:(-1*c))+"v",u:(e.u?0:(-1*c))+"v"});h.J(a);a.4m= a.4m}}});G.6o({1Z:p(c,b){c=$(c);q a=M.10({4n:"u B",3n:"6p-3n",3o:"6q",1K:""},1S[ 2] {});c.r(s.1i?{6r:"6s:6t.6u.6v(1C=\'"+b+"\'\', 3o=\'"+a.3o+"\')"}:{6w:a.1K+" 2Q("+b+") "+a.4n+" "+a.3n});K c}});11.3p={4o:p(a){o(a.C&&!a.C.3K){K 1h}K U},O:p( ){o(11.3p.4o(3)){K}s.2m(3);3.2D();q d={};o(3.9.V){d.2f={1O:0,1P:0}}Y{q a=3.17.2n (),c=3.17.3O(),b=X.1z.2o();a.B+=(-1*(c[0]-b[0]));a.u+=(-1*(c[1]-b[1]));d.2f={1O: a.B,1P:a.u}}o(3.9.1j){3.34(d)}Y{3.1Y(d)}3.1q()}};11.10=p(a){a.C.1D={};M.10(a.C.1 D,{O:11.3p.O.1d(a),S:a.S.1d(a),1E:s.1E.1d(s,a.C)})};11.3u();',62,405,' this options if function var setStyle Tips top px left element stem wrapper height Element width new insert return className Object position s how div loader case hide images false hook showOn document else extend Prototip title tooltip visible target break closeButton observe horizontal offset bind vertical border hideOn true fixIE ajax radius iframeShim tips zIndex bottom con tent hideAfter stemInverse tip mouse delay margin bindAsEventListener stopObserv ing javascript viewport orientation clearTimer src prototip remove invoke mousel eave fixed visibility stemImage backgroundColor auto eventToggle hideTargets poi nterX pointerY length middle arguments for mouseHook getDimensions style click s howDelayed setPngBackground borderFrame borderTop prototip_Corner toolbar canvas match paths _inverse push null clone none close positionStem fakePointer scrip t Styles ns_vml default initialize zIndexTop raise cumulativeOffset getScrollOff sets isString mousemove toLowerCase capitalize hidden display png build clearfix prototip_CornerWrapper padding addClassName eventPosition eventCheckDelay cance lHideAfter ajaxHideEvent ajaxContentLoading float iframeShimDimensions Event sup port Prototype _ path replace add loaded url window unload convertVersionString toggleInt right inverseStem WebKit419 removeVisible isElement borderColor onComp lete getStyle wrap ajaxShow _build body stemWrapper li borderRow borderMiddle bo rderCenter select _update 100 eventShow mouseover mouseout hideElement mouseente r activityEnter activityLeave getPositionWithinViewport repeat sizingMethod Meth ods getContext insertScript type text start require js https test styles namespa ces VML dom REQUIRED_ throw removeAll deactivate without _stemTranslation parseF loat parentNode _highest addVisibile hideAll cumulativeScrollOffset in switch cr eate hideOthers include fixSafari2 setup activate 9500px _isBuilding stemBox toU pperCase prototip_Between borderBottom each createCorner prototip_Fill update ge tWidth eventHide toggle On buttonEvent ajaxHide ajaxContentLoaded Timer fire aft erHide relative block absolute charAt fillRect outerHTML align hold REQUIRED_Pro totype createElement try write catch head find documentMode urn schemas microsof t com vml createStyleSheet cssText behavior typeof undefined Version requires pa rseInt times indexOf abs RegExp MSIE exec navigator userAgent Browser WebKit eva luate topRight rightTop topMiddle rightMiddle bottomLeft leftBottom bottomRight rightBottom bottomMiddle leftMiddle Tip Class not available cannot 000000 close Buttons endsWith member emptyFunction 9500 iframe frameBorder opacity prototipLo ader gif prototip_Stem prototip_StemWrapper prototip_StemBox prototip_StemImage MIDDLE inline ul prototip_CornerWrapperTopLeft prototip_BetweenCorners prototip_ CornerWrapperTopRight prototip_CornerWrapperBottomLeft cloneNode prototip_Corner WrapperBottomRight tl tr bl br isNumber close_hover event Action hideAction find Element blur stop pointer responseText loaderTimer ajaxTimer Ajax Request showTi mer clearTimeout shown hideAfterTimer marginTop clear both LEFTTOP TOPLEFT TOPMI DDLE TOPRIGHT RIGHTTOP RIGHTMIDDLE RIGHTBOTTOM BOTTOMRIGHT BOTTOMMIDDLE BOTTOMLE FT LEFTBOTTOM LEFTMIDDLE cornerCanvas fillStyle arc Math PI fill overflow roundr ect fillcolor strokeWeight 1px strokeColor arcSize toFixed addMethods no scale f ilter progid DXImageTransform Microsoft AlphaImageLoader background'.split(' '), 0,{})); /* public/javascripts/json2.js @ 1319142822 */ var JSON;if(!JSON){JSON={};}

(function(){"use strict";function f(n){return n<10?'0'+n:n;} if(typeof Date.prototype.toJSON!=='function'){Date.prototype.toJSON=function(key ){return isFinite(this.valueOf())?this.getUTCFullYear()+'-'+ f(this.getUTCMonth()+1)+'-'+ f(this.getUTCDate())+'T'+ f(this.getUTCHours())+':'+ f(this.getUTCMinutes())+':'+ f(this.getUTCSeconds())+'Z':null;};String.prototype.toJSON=Number.prototype.toJS ON=Boolean.prototype.toJSON=function(key){return this.valueOf();};} var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u 2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600 -\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uf fff]/g,gap,indent,meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r',' "':'\\"','\\':'\\\\'},rep;function quote(string){escapable.lastIndex=0;return es capable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];retu rn typeof c==='string'?c:'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4);} )+'"':'"'+string+'"';} function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if( value&&typeof value==='object'&&typeof value.toJSON==='function'){value=value.to JSON(key);} if(typeof rep==='function'){value=rep.call(holder,key,value);} switch(typeof value){case'string':return quote(value);case'number':return isFini te(value)?String(value):'null';case'boolean':case'null':return String(value);cas e'object':if(!value){return'null';} gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==='[object Arra y]'){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value) 'null'; } v=partial.length===0?'[]':gap?'[\n'+gap+partial.join(',\n'+gap)+'\n'+mind+']':'[ '+partial.join(',')+']';gap=mind;return v;} if(rep&&typeof rep==='object'){length=rep.length;for(i=0;i<length;i+=1){if(typeo f rep[i]==='string'){k=rep[i];v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}else{for(k in value){if(Object.prototype.hasOwnProperty.call(valu e,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}} v=partial.length===0?'{}':gap?'{\n'+gap+partial.join(',\n'+gap)+'\n'+mind+'}':'{ '+partial.join(',')+'}';gap=mind;return v;}} if(typeof JSON.stringify!=='function'){JSON.stringify=function(value,replacer,sp ace){var i;gap='';indent='';if(typeof space==='number'){for(i=0;i<space;i+=1){in dent+=' ';}}else if(typeof space==='string'){indent=space;} rep=replacer;if(replacer&&typeof replacer!=='function'&&(typeof replacer!=='obje ct' typeof replacer.length!=='number')){throw new Error('JSON.stringify');} return str('',{'':value});};} if(typeof JSON.parse!=='function'){JSON.parse=function(text,reviver){var j;funct ion walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==='object' ){for(k in value){if(Object.prototype.hasOwnProperty.call(value,k)){v=walk(value ,k);if(v!==undefined){value[k]=v;}else{delete value[k];}}}} return reviver.call(holder,key,value);} text=String(text);cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function (a){return'\\u'+ ('0000'+a.charCodeAt(0).toString(16)).slice(-4);});} if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt] u[0-9a-fA-F]{4})/g,'@'). replace(/"[^"\\\n\r]*" true false null -?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']'). replace(/(?:^ : ,)(?:\s*\[)+/g,''))){j=eval('('+text+')');return typeof reviver= =='function'?walk({'':j},''):j;} throw new SyntaxError('JSON.parse');};}}()); /* :files, 'public/javascripts/shared', ... @ 1319142822 */ /* public/javascripts/shared/ZeroClipboard.js @ 1319142822 */ var ZeroClipboard={version:"1.0.7",clients:{},moviePath:'ZeroClipboard.swf',next

Id:1,$:function(thingy){if(typeof(thingy)=='string')thingy=document.getElementBy Id(thingy);if(!thingy.addClass){thingy.hide=function(){this.style.display='none' ;};thingy.show=function(){this.style.display='';};thingy.addClass=function(name) {this.removeClass(name);this.className+=' '+name;};thingy.removeClass=function(n ame){var classes=this.className.split(/\s+/);var idx=-1;for(var k=0;k<classes.le ngth;k++){if(classes[k]==name){idx=k;k=classes.length;}} if(idx>-1){classes.splice(idx,1);this.className=classes.join(' ');} return this;};thingy.hasClass=function(name){return!!this.className.match(new Re gExp("\\s*"+name+"\\s*"));};} return thingy;},setMoviePath:function(path){this.moviePath=path;},dispatch:funct ion(id,eventName,args){var client=this.clients[id];if(client){client.receiveEven t(eventName,args);}},register:function(id,client){this.clients[id]=client;},getD OMObjectPosition:function(obj,stopObj){var info={left:0,top:0,width:obj.width?ob j.width:obj.offsetWidth,height:obj.height?obj.height:obj.offsetHeight};while(obj &&(obj!=stopObj)){info.left+=obj.offsetLeft;info.top+=obj.offsetTop;obj=obj.offs etParent;} return info;},Client:function(elem){this.handlers={};this.id=ZeroClipboard.nextI d++;this.movieId='ZeroClipboardMovie_'+this.id;ZeroClipboard.register(this.id,th is);if(elem)this.glue(elem);}};ZeroClipboard.Client.prototype={id:0,ready:false, movie:null,clipText:'',handCursorEnabled:true,cssEffects:true,handlers:null,glue :function(elem,appendElem,stylesToAdd){this.domElement=ZeroClipboard.$(elem);var zIndex=99;if(this.domElement.style.zIndex){zIndex=parseInt(this.domElement.styl e.zIndex,10)+1;} if(typeof(appendElem)=='string'){appendElem=ZeroClipboard.$(appendElem);} else if(typeof(appendElem)=='undefined'){appendElem=document.getElementsByTagNam e('body')[0];} var box=ZeroClipboard.getDOMObjectPosition(this.domElement,appendElem);this.div= document.createElement('div');var style=this.div.style;style.position='absolute' ;style.left=''+box.left+'px';style.top=''+box.top+'px';style.width=''+box.width+ 'px';style.height=''+box.height+'px';style.zIndex=zIndex;if(typeof(stylesToAdd)= ='object'){for(addedStyle in stylesToAdd){style[addedStyle]=stylesToAdd[addedSty le];}} appendElem.appendChild(this.div);this.div.innerHTML=this.getHTML(box.width,box.h eight);},getHTML:function(width,height){var html='';var flashvars='id='+this.id+ '&width='+width+'&height='+height;if(navigator.userAgent.match(/MSIE/)){var prot ocol=location.href.match(/^https/i)?'https://':'http://';html+='<object classid= "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="'+protocol+'download.macr omedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="'+width+ '" height="'+height+'" id="'+this.movieId+'" align="middle"><param name="allowSc riptAccess" value="always" /><param name="allowFullScreen" value="false" /><para m name="movie" value="'+ZeroClipboard.moviePath+'" /><param name="loop" value="f alse" /><param name="menu" value="false" /><param name="quality" value="best" /> <param name="bgcolor" value="#ffffff" /><param name="flashvars" value="'+flashva rs+'"/><param name="wmode" value="transparent"/></object>';} else{html+='<embed id="'+this.movieId+'" src="'+ZeroClipboard.moviePath+'" loop= "false" menu="false" quality="best" bgcolor="#ffffff" width="'+width+'" height=" '+height+'" name="'+this.movieId+'" align="middle" allowScriptAccess="always" al lowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://w ww.macromedia.com/go/getflashplayer" flashvars="'+flashvars+'" wmode="transparen t" />';} return html;},hide:function(){if(this.div){this.div.style.left='-2000px';}},show :function(){this.reposition();},destroy:function(){if(this.domElement&&this.div) {this.hide();this.div.innerHTML='';var body=document.getElementsByTagName('body' )[0];try{body.removeChild(this.div);}catch(e){;} this.domElement=null;this.div=null;}},reposition:function(elem){if(elem){this.do mElement=ZeroClipboard.$(elem);if(!this.domElement)this.hide();} if(this.domElement&&this.div){var box=ZeroClipboard.getDOMObjectPosition(this.do mElement);var style=this.div.style;style.left=''+box.left+'px';style.top=''+box. top+'px';}},setText:function(newText){this.clipText=newText;if(this.ready)this.m ovie.setText(newText);},addEventListener:function(eventName,func){eventName=even

tName.toString().toLowerCase().replace(/^on/,'');if(!this.handlers[eventName])th is.handlers[eventName]=[];this.handlers[eventName].push(func);},setHandCursor:fu nction(enabled){this.handCursorEnabled=enabled;if(this.ready)this.movie.setHandC ursor(enabled);},setCSSEffects:function(enabled){this.cssEffects=!!enabled;},rec eiveEvent:function(eventName,args){eventName=eventName.toString().toLowerCase(). replace(/^on/,'');switch(eventName){case'load':this.movie=document.getElementByI d(this.movieId);if(!this.movie){var self=this;setTimeout(function(){self.receive Event('load',null);},1);return;} if(!this.ready&&navigator.userAgent.match(/Firefox/)&&navigator.userAgent.match( /Windows/)){var self=this;setTimeout(function(){self.receiveEvent('load',null);} ,100);this.ready=true;return;} this.ready=true;this.movie.setText(this.clipText);this.movie.setHandCursor(this. handCursorEnabled);break;case'mouseover':if(this.domElement&&this.cssEffects){th is.domElement.addClass('hover');if(this.recoverActive)this.domElement.addClass(' active');} break;case'mouseout':if(this.domElement&&this.cssEffects){this.recoverActive=fal se;if(this.domElement.hasClass('active')){this.domElement.removeClass('active'); this.recoverActive=true;} this.domElement.removeClass('hover');} break;case'mousedown':if(this.domElement&&this.cssEffects){this.domElement.addCl ass('active');} break;case'mouseup':if(this.domElement&&this.cssEffects){this.domElement.removeC lass('active');this.recoverActive=false;} break;} if(this.handlers[eventName]){for(var idx=0,len=this.handlers[eventName].length;i dx<len;idx++){var func=this.handlers[eventName][idx];if(typeof(func)=='function' ){func(this,args);} else if((typeof(func)=='object')&&(func.length==2)){func[0][func[1]](this,args); } else if(typeof(func)=='string'){window[func](this,args);}}}}}; /* public/javascripts/shared/account_link.js @ 1319142822 */ Scribd.init('Scribd','AccountLink');Scribd.AccountLink.Base=Class.create({initia lize:function(linkElement,unlinkElement){this.linkElement=linkElement;this.unlin kElement=unlinkElement;this.setupBindings();},handleUnlinkResponse:function(){do cument.fire(this.eventFor('unlinked'));},reactToLink:function(){if(this.unlinkEl ement){this.unlinkElement.show();} this.linkElement.hide();},reactToUnlink:function(){if(this.unlinkElement){this.u nlinkElement.hide();} this.linkElement.show();},setupBindings:function(){document.observe(this.eventFo r('linked'),this.reactToLink.bind(this));document.observe(this.eventFor('unlinke d'),this.reactToUnlink.bind(this));this.linkElement.observe('click',this.linkCli ck.bind(this));if(this.unlinkElement){this.unlinkElement.observe('click',this.un linkClick.bind(this));}}});Scribd.AccountLink.Facebook=Class.create(Scribd.Accou ntLink.Base,{eventFor:function(name){return"scribd:accountLink:facebook:"+name;} ,getName:function(){var that=this;FB.api({method:'fql.query',query:'SELECT name FROM profile WHERE id='+FB.getAuthResponse().userID},function(response){var name =response[0] if(name){document.fire(that.eventFor('name'),{'name':name});}});},linkClick:func tion(e){e.stop();FB.login(this.handleLinkResponse.bind(this),{perms:"email,publi sh_stream,read_stream,offline_access"});},handleLinkResponse:function(response){ if(response.authResponse){new Ajax.Request("/facebook_link",{method:'post',onSuc cess:this.linkSuccess.bind(this),onFailure:this.linkFailure.bind(this)});}else{t his.linkFailure.apply(this);}},unlinkClick:function(e){e.stop();new Ajax.Request ("/facebook_links/destroy",{method:'delete',onSuccess:this.handleUnlinkResponse. bind(this)});},setGlobalState:function(){var cookie=FB.Cookie.load();if(cookie){ facebookUser=true;facebookSessionKey=cookie.session_key;facebookUserId=cookie.ui d;}},linkSuccess:function(){document.fire(this.eventFor('linked'));this.setGloba

lState();this.getName();},linkFailure:function(){document.fire(this.eventFor('fa ilure'));}});Scribd.AccountLink.Twitter=Class.create(Scribd.AccountLink.Base,{ev entFor:function(name){return"scribd:accountLink:twitter:"+name;},getName:functio n(){var that=this;new Ajax.Request("/twitter_link/info.json",{method:'get',evalJ SON:'force',onSuccess:function(trans){var name="@"+trans.responseJSON.info.scree n_name;document.fire(that.eventFor('name'),{'name':name});}});},linkClick:functi on(e){e.stop();var popupParams='location=0,status=0,width=800,height=400';this._ twitterWindow=window.open("/twitter_link/new.js",'twitterWindow',popupParams);th is._twitterInterval=window.setInterval(this.handleLinkResponse.bind(this),200);} ,handleLinkResponse:function(){if(!this._twitterWindow){this.responseDone();} try{if(this._twitterWindow.location.href.indexOf('oauth_token')>=0){this._twitte rWindow.close();this.responseDone();}}catch(e){}},responseDone:function(){window .clearInterval(this._twitterInterval);this.testLink();},testLink:function(){new Ajax.Request("/twitter_link.js",{method:'get',onSuccess:this.linkSuccess.bind(th is),onFailure:this.linkFailure.bind(this)});},unlinkClick:function(e){e.stop();n ew Ajax.Request("/twitter_links/destroy",{method:'delete',onSuccess:this.handleU nlinkResponse.bind(this)});},linkSuccess:function(){document.fire(this.eventFor( 'linked'));this.getName();},linkFailure:function(){document.fire(this.eventFor(' failure'));}}); /* public/javascripts/shared/ad_hider.js @ 1319142822 */ Scribd.AdHider=(function(){var hideElement=function(el){try{el.setStyle({visibil ity:'hidden !important'});}catch(e){el.hide();}} var showElement=function(el){try{el.setStyle({visibility:'visible !important'}); }catch(e){el.show();}} AdHider=function(){this.HIDE_EVENTS.each(function(hide_event){$(document).observ e(hide_event,function(e){this.AD_CLASSES.each(function(klass){$$(klass).each(fun ction(el){hideElement(el);el.select("iframe").each(hideElement);});});}.bind(thi s));}.bind(this));this.SHOW_EVENTS.each(function(show_event){$(document).observe (show_event,function(e){this.AD_CLASSES.each(function(klass){$$(klass).each(func tion(el){showElement(el);el.select("iframe").each(showElement);});});}.bind(this ));}.bind(this));} AdHider.prototype={AD_CLASSES:['.hideable_ad'],HIDE_EVENTS:['lightbox:open'],SHO W_EVENTS:['lightbox:closed']} return AdHider;})(); /* public/javascripts/shared/alerts.js @ 1319142822 */ if(!window.Scribd)var Scribd=new Object();Scribd.alertsManager=Class.create({ini tialize:function(){},error:function(el,message,options){var options=Object.exten d({auto_fade:false},options {});this.render('error',el,message,options);},progr ess:function(el,message,options){var options=Object.extend({auto_fade:false},opt ions {});this.render('progress',el,message,options);},success:function(el,messa ge,options){this.render('success',el,message,options);},success_blue:function(el ,message,options){this.render('success_blue',el,message,options);},success_red:f unction(el,message,options){this.render('success_red',el,message,options);},rend er:function(type,el,message,options){var options=Object.extend({auto_fade:true,e lement_to_fade:null,delay:7,duration:1.0},options {});var el=$(el);el.show();el .update(this[type+'_template'].evaluate({message:message}));var element_to_fade= options.element_to_fade?$(options.element_to_fade):el;if(options.auto_fade){(fun ction(){element_to_fade.fade({duration:options.duration});}).delay(options.delay );}},error_template:new Template("<div class=\"autogen_class_views_shared_alerts _error autogen_class_views_shared_alerts_base error_alert\"><div class=\"inner\" >#{message}</div></div>"),success_template:new Template("<div class=\"autogen_cl ass_views_shared_alerts_success autogen_class_views_shared_alerts_base\"><div cl ass=\"inner\">#{message}</div></div>"),success_blue_template:new Template("<div class=\"autogen_class_views_shared_alerts_success_blue autogen_class_views_share

d_alerts_base\"><div class=\"inner\">#{message}</div></div>"),success_red_templa te:new Template("<div class=\"autogen_class_views_shared_alerts_success_red auto gen_class_views_shared_alerts_base\"><div class=\"inner\">#{message}</div></div> "),progress_template:new Template("<div class=\"autogen_class_views_shared_alert s_progress autogen_class_views_shared_alerts_base\"><div class=\"inner\"><img sr c=\"/images/shared/alerts/spinner.gif\" />#{message}</div></div>")});Scribd.Aler ts=new Scribd.alertsManager(); /* public/javascripts/shared/buttons.js @ 1319142822 */ if(!window.Scribd)var Scribd=new Object();Scribd.buttonsManager=Class.create({to ggle:function(el){var el=$(el);var toggle_button=function(this_el){this_el.class Names().each(function(klass){if(klass.endsWith('_button_selected')){this_el.remo veClassName(klass);this_el.addClassName(klass.gsub('_selected',''));}else if(kla ss.endsWith('_button')){this_el.removeClassName(klass);this_el.addClassName(klas s+'_selected');}});};if(Object.isArray(el)){el.each(function(item){toggle_button (item)});}else{toggle_button(el);}}});Scribd.Buttons=new Scribd.buttonsManager() ; /* public/javascripts/shared/cohorts.js @ 1319142822 */ Cohorts=(function(){var Options={debug:false};var GoogleAnalyticsAdapter={nameSp ace:'cohorts',trackEvent:function(category,action,opt_label,opt_value){Utils.log ('GA trackEvent: '+category+', '+action+', '+opt_label+', '+opt_value);if(window ['_gaq']){_gaq.push(['_trackEvent',category,action,opt_label,opt_value]);}else{t hrow(" _gaq object not found: It looks like you haven't correctly setup the asyn chronous Google Analytics tracking code, and you are using the default GoogleAna lyticsAdapter.");}},onInitialize:function(inTest,testName,cohort){if(inTest){thi s.trackEvent(this.nameSpace,testName,cohort+' Total');}},onEvent:function(test Name,cohort,eventName){this.trackEvent(this.nameSpace,testName,cohort+' '+even tName);}};var Test=(function(){var cookieName='_cohorts';var constructor=functio n(options){this.options=Utils.extend({name:null,cohorts:null,sample:1.0,storageA dapter:null},options);if(this.options.name===null) throw('A name for this test must be specified');if(this.options.cohorts===null) throw('Cohorts must be specified for this test');if(Utils.size(options.cohorts)< 2) throw('You must specify at least 2 cohorts for a test');if(!this.options.storage Adapter){if(!window.Scribd !Scribd.CohortsAdapter) throw("Couldn't find Scribd.CohortsAdapter");this.options.storageAdapter=Scribd. CohortsAdapter;} this.cohorts=Utils.keys(this.options.cohorts);this.run();};constructor.prototype ={run:function(){var hash=window.location.hash;if(hash.indexOf('#')==0)hash=hash .slice(1,hash.length);var pairs=hash.split('&');for(var i=0;i<pairs.length;i++){ var pair=pairs[i].split('=');var name=pair[0];var cohort=pair[1];if(this.options .name==name){Utils.log('Forcing test '+name+' into cohort '+cohort);this.setCoho rt(cohort);}} var in_test=this.inTest();if(in_test===null) in_test=Math.random()<=this.options.sample;if(in_test){this.setCookie('in_test', 1);if(!this.getCohort()){var partitions=1.0/Utils.size(this.options.cohorts);var chosen_partition=Math.floor(Math.random()/partitions);var chosen_cohort=Utils.k eys(this.options.cohorts)[chosen_partition];this.setCohort(chosen_cohort);}else{ var chosen_cohort=this.getCohort();} this.options.storageAdapter.onInitialize(in_test,this.options.name,chosen_cohort );if(this.options.cohorts[chosen_cohort].onChosen) this.options.cohorts[chosen_cohort].onChosen();}else{this.setCookie('in_test',0) ;if(this.options.onNotInTest) this.options.onNotInTest();}},event:function(eventName){if(this.inTest()) this.options.storageAdapter.onEvent(this.options.name,this.getCohort(),eventName

);},inTest:function(){if(this.getCookie('in_test')==1){return true;}else if(this .getCookie('in_test')==0){return false;}else{return null;}},inCohort:function(co hort){if(this.inTest()){return this.getCohort()==cohort;}else{return false;}},ge tCohort:function(){if(this.inTest()){return this.getCookie('chosen_cohort');}els e{return null;}},setCohort:function(cohort){if(this.cohorts.indexOf(cohort)==-1) {return false;}else{this.setCookie('chosen_cohort',cohort);return true;}},setCoo kie:function(name,value){var data=Cookies.get(cookieName) {};data[this.options. name]=data[this.options.name] {};data[this.options.name][name]=value;Cookies.se t(cookieName,data);},getCookie:function(name){var data=Cookies.get(cookieName) {};if(!data[this.options.name])return null;return data[this.options.name][name]; }};return constructor;})();var Utils={extend:function(destination,source){for(va r property in source) destination[property]=source[property];return destination;},size:function(object ){var i=0;for(var property in object) i+=1;return i;},keys:function(object){var results=[];for(var property in object) results.push(property);return results;},log:function(message){if(window['console ']&&Options.debug){if(console.log){console.log(message);}else{alert(message);}}} };var Cookies=(function() {var resolveOptions,assembleOptionsString,parseCookies,constructor,defaultOption s={expiresAt:null,path:'/',domain:null,secure:false};resolveOptions=function(opt ions) {var returnValue,expireDate;if(typeof options!=='object' options===null) {returnValue=defaultOptions;} else {returnValue={expiresAt:defaultOptions.expiresAt,path:defaultOptions.path,domain :defaultOptions.domain,secure:defaultOptions.secure};if(typeof options.expiresAt ==='object'&&options.expiresAt instanceof Date) {returnValue.expiresAt=options.expiresAt;} else if(typeof options.hoursToLive==='number'&&options.hoursToLive!==0) {expireDate=new Date();expireDate.setTime(expireDate.getTime()+(options.hoursToL ive*60*60*1000));returnValue.expiresAt=expireDate;} if(typeof options.path==='string'&&options.path!=='') {returnValue.path=options.path;} if(typeof options.domain==='string'&&options.domain!=='') {returnValue.domain=options.domain;} if(options.secure===true) {returnValue.secure=options.secure;}} return returnValue;};assembleOptionsString=function(options) {options=resolveOptions(options);return((typeof options.expiresAt==='object'&&op tions.expiresAt instanceof Date?'; expires='+options.expiresAt.toGMTString():'') +'; path='+options.path+ (typeof options.domain==='string'?'; domain='+options.domain:'')+ (options.secure===true?'; secure':''));};parseCookies=function() {var cookies={},i,pair,name,value,separated=document.cookie.split(';'),unparsedV alue;for(i=0;i<separated.length;i=i+1) {pair=separated[i].split('=');name=pair[0].replace(/^\s*/,'').replace(/\s*$/,'') ;try {value=decodeURIComponent(pair[1]);} catch(e1) {value=pair[1];} if(typeof JSON==='object'&&JSON!==null&&typeof JSON.parse==='function') {try {unparsedValue=value;value=JSON.parse(value);} catch(e2) {value=unparsedValue;}} cookies[name]=value;} return cookies;};constructor=function(){};constructor.prototype.get=function(coo kieName) {var returnValue,item,cookies=parseCookies();if(typeof cookieName==='string') {returnValue=(typeof cookies[cookieName]!=='undefined')?cookies[cookieName]:null

;} else if(typeof cookieName==='object'&&cookieName!==null) {returnValue={};for(item in cookieName) {if(typeof cookies[cookieName[item]]!=='undefined') {returnValue[cookieName[item]]=cookies[cookieName[item]];} else {returnValue[cookieName[item]]=null;}}} else {returnValue=cookies;} return returnValue;};constructor.prototype.filter=function(cookieNameRegExp) {var cookieName,returnValue={},cookies=parseCookies();if(typeof cookieNameRegExp ==='string') {cookieNameRegExp=new RegExp(cookieNameRegExp);} for(cookieName in cookies) {if(cookieName.match(cookieNameRegExp)) {returnValue[cookieName]=cookies[cookieName];}} return returnValue;};constructor.prototype.set=function(cookieName,value,options ) {if(typeof options!=='object' options===null) {options={};} if(typeof value==='undefined' value===null) {value='';options.hoursToLive=-8760;} else if(typeof value!=='string') {if(typeof JSON==='object'&&JSON!==null&&typeof JSON.stringify==='function') {value=JSON.stringify(value);} else {throw new Error('cookies.set() received non-string value and could not serializ e.');}} var optionsString=assembleOptionsString(options);document.cookie=cookieName+'='+ encodeURIComponent(value)+optionsString;};constructor.prototype.del=function(coo kieName,options) {var allCookies={},name;if(typeof options!=='object' options===null) {options={};} if(typeof cookieName==='boolean'&&cookieName===true) {allCookies=this.get();} else if(typeof cookieName==='string') {allCookies[cookieName]=true;} for(name in allCookies) {if(typeof name==='string'&&name!=='') {this.set(name,null,options);}}};constructor.prototype.test=function() {var returnValue=false,testName='cT',testValue='data';this.set(testName,testValu e);if(this.get(testName)===testValue) {this.del(testName);returnValue=true;} return returnValue;};constructor.prototype.setOptions=function(options) {if(typeof options!=='object') {options=null;} defaultOptions=resolveOptions(options);};return new constructor();})();return{Te st:Test,Cookies:Cookies,Options:Options};})(); /* public/javascripts/shared/cohorts_adapter.js @ 1319142822 */ if(!window.Scribd)var Scribd=new Object();var _gaq=_gaq [];Scribd.CohortsAdapte r={assignments:{},onInitialize:function(inTest,testName,cohort){if(!inTest)retur n;this.assignments[testName]=cohort;$rat('cohort.'+testName+'.'+cohort);Scribd.A ds.addAttribute(testName,cohort);},getTestAssignments:function(){return $H(this. assignments).map(function(pair){return pair.key+'='+pair.value;}).join('&');}}; /* public/javascripts/shared/columns.js @ 1319142822 */

if(!window.Scribd)var Scribd=new Object();Scribd.columnManager=Class.create({ini tialize:function(){this.tallest=0;if(!Prototype.Browser.IE6) document.observe('dom:loaded',this.equalizeColumnHeights.bind(this));},classesWi thBorders:['main1','main3','main5'],equalizeColumnHeights:function(){$$('.scribd _columns').each(function(item){item.childElements().each(function(child){var hei ght=child.getHeight();if(height>this.tallest) this.tallest=height;}.bind(this));if(this.tallest>0) item.childElements().each(function(child){if(this.shouldResize(child)) child.setStyle({minHeight:(this.tallest+'px')});}.bind(this));}.bind(this));},sh ouldResize:function(el){var hasBorder=false;this.classesWithBorders.each(functio n(klass){if(el.hasClassName(klass)) hasBorder=true;});var isTallest=el.getHeight()==this.tallest;return hasBorder&&! isTallest;}});Scribd.Columns=new Scribd.columnManager(); /* public/javascripts/shared/csrf.js @ 1319142822 */ Scribd.init('Scribd','CSRF');Scribd.CSRF={initialize:function(){var meta_param=$ $('meta[name=csrf-param]').first(),meta_token=$$('meta[name=csrf-token]').first( );this.active=meta_param&&meta_token;this.paramsHash={};if(this.active){this.par am=meta_param.readAttribute('content');this.token=meta_token.readAttribute('cont ent');this.paramsHash[this.param]=this.token;}},paramsWithToken:function(params) {return Object.extend(params,this.paramsHash);}};document.observe('dom:loaded',S cribd.CSRF.initialize.bind(Scribd.CSRF)); /* public/javascripts/shared/customEffects.js @ 1319142822 */ Effect.FadeWithCallback=function(element){element=$(element);var oldOpacity=elem ent.getInlineOpacity();var options=Object.extend({from:element.getOpacity() 1.0 ,to:0.0,callback:function(){},afterFinishInternal:function(effect){effect.option s.callback();}},arguments[1] {});return new Effect.Opacity(element,options);}; /* public/javascripts/shared/embed_code.js @ 1319142822 */ Scribd.genericEmbedCodeGenerator=Class.create({minWidth:400,minHeight:400,maxWid th:1600,maxHeight:1600,defaultWidth:400,defaultHeight:600,defaultPage:1,defaultM ode:'list',defaultAutoWidth:true,defaultAutoHeight:false,initialize:function(opt ions){this.options=Object.extend({width:this.defaultWidth,height:this.defaultHei ght,page:this.defaultPage,mode:this.defaultMode,auto_width:this.defaultAutoWidth ,auto_height:this.defaultAutoHeight,show_title:true,doc_url:'',title:',',doc_id: 0,access_key:''},options {});this.options.object_id='doc_'+Math.floor(Math.rand om()*99999);this.buildTemplates();},render:function(options){this.updateOptions( options);return this.renderTemplates();},updateOptions:function(options){this.op tions=Object.extend(this.options,options);this.options.width=this.options.width this.defaultWidth;this.options.height=this.options.height this.defaultHeight;t his.options.page=this.options.page this.defaultPage;if(this.options.auto_width this.options.width=="100%"){this.options.width='100%';}else if(parseInt(this.op tions.width)<this.minWidth){this.options.width=this.minWidth;} if(this.options.auto_height){this.options.height=this.defaultHeight;}else if(par seInt(this.options.height)<this.minHeight){this.options.height=this.minHeight;}} ,titleString:function(){if(this.options.show_title){return this.title_tmpl.evalu ate({title:this.options.title,doc_url:this.options.doc_url,title_truncated:this. options.title.truncate(110)});}else{return"";}}});Scribd.embedCodeGenerator=Clas s.create(Scribd.genericEmbedCodeGenerator,{buildTemplates:function(){this.title_ tmpl=new Template('<a title="View #{title} on Scribd" href="#{doc_url}" style="m argin: 12px auto 6px auto; font-family: Helvetica,Arial,Sans-serif; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height:

normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none; dis play: block; text-decoration: underline;">#{title_truncated}</a> ');this.object_ tmpl=new Template('<object id="#{object_id}" name="#{object_id}" height="#{heigh t}" width="#{width}" type="application/x-shockwave-flash" data="http://d1.scribd assets.com/ScribdViewer.swf" style="outline:none;" >\ <param name="movie" value="http://d1.scribdassets.com/ScribdViewer.s wf"> \ <param name="wmode" value="opaque"> \ <param name="bgcolor" value="#ffffff"> \ <param name="allowFullScreen" value="true"> \ <param name="allowScriptAccess" value="always"> \ <param name="FlashVars" value="document_id=#{doc_id}&access_key=#{ac cess_key}&page=#{page}&viewMode=#{mode}"> \ <embed id="#{object_id}" name="#{object_id}" src="http://d1.scribdas sets.com/ScribdViewer.swf?document_id=#{doc_id}&access_key=#{access_key}&page=#{ page}&viewMode=#{mode}" type="application/x-shockwave-flash" allowscriptaccess=" always" allowfullscreen="true" height="#{height}" width="#{width}" wmode="opaque " bgcolor="#ffffff"></embed> \ </object>');this.script_tmpl=new Template('');},renderTemplates:function (){var object_str=this.object_tmpl.evaluate(this.options);return(this.titleStrin g()+object_str);}});Scribd.HTML5EmbedCodeGenerator=Class.create(Scribd.genericEm bedCodeGenerator,{renderTemplates:function(){var generate_height_script=false;if (this.options.auto_height&&this.options.aspect_ratio){if(this.options.auto_width ){generate_height_script=true;}else{this.options.height=Math.round((1/this.optio ns.aspect_ratio)*this.options.width)+60;}} this.options.embed_url="http://www.scribd.com/embeds/"+this.options.doc_id+"/con tent";this.options.embed_url=this.options.embed_url.updateQueryParams({start_pag e:this.options.page,view_mode:this.options.mode});if(this.options.access_key&&th is.options.access_key.length>0){this.options.embed_url=this.options.embed_url.up dateQueryParams({access_key:this.options.access_key});} if(this.options.secret_password){this.options.embed_url=this.options.embed_url.u pdateQueryParams({secret_password:this.options.secret_password});} var object_str=this.iframe_tmpl.evaluate({embed_url:this.options.embed_url,objec t_id:this.options.object_id,aspect_ratio:this.options.aspect_ratio,width:this.op tions.width,height:this.options.height,auto_height:!!this.options.auto_width});o ut=this.titleString()+object_str;if(generate_height_script){out+=this.height_scr ipt_tmpl.evaluate({object_id:this.options.object_id});} return out;},buildTemplates:function(){this.title_tmpl=new Template('<a title="V iew #{title} on Scribd" href="#{doc_url}" style="margin: 12px auto 6px auto; fon t-family: Helvetica,Arial,Sans-serif; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: normal; font-size-adjust: non e; font-stretch: normal; -x-system-font: none; display: block; text-decoration: underline;">#{title_truncated}</a>');this.iframe_tmpl=new Template('<iframe clas s="scribd_iframe_embed" src="#{embed_url}" data-auto-height="#{auto_height}" dat a-aspect-ratio="#{aspect_ratio}" scrolling="no" id="#{object_id}" width="#{width }" height="#{height}" frameborder="0"></iframe>');this.height_script_tmpl=new Te mplate('<script type="text/javascript">(function() { var scribd = document.creat eElement("script"); scribd.type = "text/javascript"; scribd.async = true; scribd .src = "http://www.scribd.com/javascripts/embed_code/inject.js"; var s = documen t.getElementsByTagName("script")[0]; s.parentNode.insertBefore(scribd, s); })(); </script>');}}); /* public/javascripts/shared/facebook.js @ 1319142822 */ if(!window.Scribd)var Scribd=new Object();Scribd.Facebook=function(){var apiKey= '1b464203f13e585f17de89797e59bd98';var appId='136494494209';var knobURL='';var l oaded=false;var session=null;var cookie=new Scribd.JSONCookie('session_metadata' );var transitioned=false;var isReadPage=false;var pageTransitionURL="/session_tr ansition/new_page_content";var userUtilTemplate=new Template('\

<li id="user_util" class="hover_menu l1">\ <img src="/images/icons/fb_icon_15x15.gif" class="facebook_notice_icon">

<a href="http://www.scribd.com/people/view/#{word_user_id}" class="menu_ control">#{word_user_name}</a>\ <div class="sub_menu">\ <div class="tail">\ <img alt="Tri_11x6" src="/images/global_header/tri_11x6.gif">\ </div>\ <div class="menu_content">\ #{ic_faq}\ <h3>\ <fb:profile-pic class="fb_profile_thumb" uid="#{fbuid}" facebo ok-logo="false" linked="false" size="square" width="15" height="15"></fb:profile -pic>\ Account\ </h3>\ <ul>\ <li><a href="http://www.scribd.com/">My Home</a></li>\ <li><a href="http://www.scribd.com/people/view/#{word_user_i d}">View Public Profile</a></li>\ <li><a href="http://www.scribd.com/documents">My Documents</ a></li>\ <li><a href="http://www.scribd.com/my_document_collections"> My Collections</a></li>\ <li><a href="http://www.scribd.com/inbox">Messages</a></li>\ <li id="util_logout"><a href="/account/edit">Settings</a></l i>\ <li><a href="http://support.scribd.com">Help</a></li>\ <li><a href="http://www.scribd.com/logout">Log Out</a></li>\ </ul>\ </div>\ </div>\ </li>');var userUtilInstantConnectFaqHtml='<div class="facebook_notice"><h4> How does Scribd know my name?</h4><p>We are using Facebook to personalize your e xperience on Scribd.</p><a href="http://www.scribd.com/facebookfaq" target="_bla nk">Learn More</a></div>';function checkSessionState(){if(cookie.get('active_fac ebook_session')=='false'){Event.fire(document,Scribd.Facebook.EVENTS.inactive_fa cebook_session);session=false;} else{FB.getLoginStatus(function(response){if(response.status==='connected'&&resp onse.authResponse){Scribd.log('FB checkSessionState: active fb session');session =response.authResponse;Event.fire(document,Scribd.Facebook.EVENTS.active_faceboo k_session);}else{Scribd.log('FB checkSessionState: inactive fb session');cookie. set('active_facebook_session','false');cookie.save();session=false;Event.fire(do cument,Scribd.Facebook.EVENTS.inactive_facebook_session);}});}} function updateGlobalHeader(word_user_id,word_user_name,created_by_ic){var html= userUtilTemplate.evaluate({'word_user_id':word_user_id,'word_user_name':word_use r_name,fbuid:session.uid,ic_faq:created_by_ic?userUtilInstantConnectFaqHtml:''}) ;Effect.FadeWithCallback('header_login',{callback:function(){var header=$('heade r_login') header.update(html);header.removeClassName('logged_out_utilities');Effect.Fade(' header_login',{from:0,to:1});new Scribd.HoverMenu($('user_util'));}});} function updatePageUI(){var isFourgen=!!Scribd.FourGen;new Ajax.Request(pageTran sitionURL,{method:'get',evalJSON:'force',onSuccess:function(trans){var content;t ry{var parts=trans.responseText.split("\n");parts.pop();content=JSON.parse(parts .join("\n"));}catch(e){if(typeof(trans.responseJSON)!="undefined"&&trans.respons eJSON){content=trans.responseJSON;} else{try{content=JSON.parse(trans.responseText);} catch(e2){}}} if(Scribd.Facebook.isReadPage){if(isFourgen){updateFourgenUI(content);}else{upda

teiPaperUI(content);}}else{updateFacebookWelcomeUI(content);} Scribd.logged_in=true;document.body.fire('Scribd:dom_updated');document.fire(Scr ibd.Facebook.EVENTS.transition);transitioned=true;}});} function updateFourgenUI(content){updateFacebookWelcomeUI(content);updateReadCas tUI(content);updateCollectionsUI(content);if(content.is_owner){$('flag_document_ link').addClassName('disabled');} updateCommentFormUI(content);updateCommentsSection(content);} function updateiPaperUI(content){if(content!=null){document.body.insert(content. facebook_session_js);updateCommentsSection(content);$('docinfo_wrapper').replace (content.document_information);$$('.follow_button')[0].replace(content.subscribe _button);$('ipaper_top_toolbar_inner_container').replace(content.ipaper_toolbar) ;$$('.right .ipaper_reading_list')[0].replace(content.ipaper_reading_list);updat eReadCastUI(content);} else{}} function updateCommentFormUI(content){if(content.comment_form){$('document_comme nt_form').replace(content.comment_form);}} function updateCommentsSection(content){if(content.comments_section){$('comments _section').replace(content.comments_section);}} function updateReadCastUI(content){if(content.readcast){$('readcast_popup_outer' ).up().replace(content.readcast);$('readcast_popup_outer').show();} if(content.readcast_settings){var doc_data=content.readcast_settings.document_da ta;(new Scribd.Readcast.Event.AutoShare({doc:doc_data,auto_submit:content.readca st_settings.prefs['event_settings']['reading']['scribd']=='on',service_type:'scr ibd',event_type:'read'})).start();(new Scribd.Readcast.Event.AutoShare({doc:doc_ data,auto_submit:content.readcast_settings.prefs['event_settings']['reading']['t witter']=='on',service_type:'twitter',event_type:'read'})).start();(new Scribd.R eadcast.Event.FacebookAutoShare({doc:doc_data,auto_submit:content.readcast_setti ngs.prefs['event_settings']['reading']['facebook']=='on',event_type:'read'})).st art();}} function updateCollectionsUI(content){var collection_containter=$$('.autogen_cla ss_views_shared_document_collections_lightbox')[0];if(!collection_containter){$$ ('.toolbar_lightboxes')[0].insert(content.collections);Scribd.Toolbar.switchToLo ggedInAction('collections');Scribd.enableDocumentCollectionForm();}} function updateFacebookWelcomeUI(content){$('wrap').insert({before:content.faceb ook_top_banner});} function generateMediaAttachment(doc,type){switch(type){case'flash':return{type: type,imgsrc:doc.imageUrl,swfsrc:'http://d1.scribdassets.com/ScribdViewer.swf?doc ument_id=#{id}&access_key=#{access_key}&page=1&version=1&viewMode=list'.interpol ate(doc),width:'100',height:'129',expanded_width:'320',expanded_height:'260'};ca se'image':return{type:type,src:doc.imageUrl,href:doc.url};default:return{};}} function publishToStream(message,attachment,autoPost){Scribd.Facebook.ensureInit (function(){var publish_options={method:'stream.publish',message:message,attachm ent:attachment,action_links:[{text:"Upload Your Documents",href:'http://www.scri bd.com/upload-document?from=facebook'}]};if(autoPost){FB.api({method:'users.hasA ppPermission',ext_perm:'publish_stream'},function(response){if(response==1){FB.a pi(publish_options,function(response){});}else{FB.ui(Object.extend({display:'pop up'},publish_options),function(response){});}});}else{FB.ui(Object.extend({displ ay:'popup'},publish_options),function(response){});}});} return{scribdSessionActive:false,serverEnableInstantConnect:true,EVENTS:{loaded: 'Scribd:Facebook:loaded',active_facebook_session:'Scribd:Facebook:active_faceboo k_session',inactive_facebook_session:'Scribd:Facebook:inactive_facebook_session' ,auto_logged_in:'Scribd:Facebook:auto_logged_in',auto_logged_out:'Scribd:Faceboo k:auto_logged_out',transition:'Scribd:Facebook:transition'},isSessionTransitione d:function(){return transitioned;},getSessionUID:function(){if(!session !sessio n.userID){return null;} return session.userID;},ensureInit:function(func){if(loaded){func();} else{document.observe(Scribd.Facebook.EVENTS.loaded,func);}},beforeFacebookIniti alize:function(){Scribd.Facebook.AutoLogin.initialize();},initializeConnect:func tion(){FB.init({appId:appId,status:false,cookie:true,xfbml:true,oauth:true});thi s.session=FB._session;if(facebookUser){FB.getLoginStatus();}

if(Scribd.Facebook.AutoLogin.enabled()){checkSessionState();} loaded=true;Scribd.log('FacebookManager: Finished initializing FB Connect',this) ;document.fire(Scribd.Facebook.EVENTS.loaded);},instantConnectFilter:function(kn obs){var chance;if(Scribd.Request.controller=="word"&&Scribd.Request.action=="vi ew"){chance=knobs.read_page;} else if(Scribd.Request.controller=="home"){chance=knobs.home_page;} else{chance=knobs.other_page;} chance*=(document.referrer.indexOf('www.facebook')>-1)?knobs.facebook_referral:k nobs.non_facebook_referral;if(Math.random()<chance){this.instantConnect();}},ini tiateLogin:function(e,onFBSessionInit){Scribd.Facebook.ensureInit(function(){var btn=e.element();if(btn.hasClassName('fb_connect_button_deactivated') btn.hasCl assName('fb_connect_button_large_deactivated')){window.blur();return;} var spinner=btn.previous('.spinner') btn.next('.spinner');if(spinner) spinner.setStyle({visibility:'visible'});function onCancel(){btn.removeClassName ('fb_connect_button_deactivated');btn.removeClassName('fb_connect_button_large_d eactivated');if(spinner) spinner.setStyle({visibility:'hidden'});btn=spinner=null;} FB.login(function(response){if(response.authResponse){onFBSessionInit();} else{onCancel();}});if(btn.hasClassName('fb_connect_button')) btn.addClassName('fb_connect_button_deactivated');else if(btn.hasClassName('fb_c onnect_button_large')) btn.addClassName('fb_connect_button_large_deactivated');});},setPageTransitionUR L:function(url){pageTransitionURL=url;},transitionToLoggedInUI:function(login_in fo){updateGlobalHeader(login_info.word_user_id,login_info.word_user_name,login_i nfo.created_by_ic);if(login_info.created_by_ic){Scribd.blueBarUtil.show();} updatePageUI();},publishDocumentToStream:function(doc,autoPost){if(doc.imageUrl) {if(!doc.imageUrl.startsWith('http://')) doc.imageUrl='http://www.scribd.com'+doc.imageUrl;var m={media:[generateMediaAtt achment(doc,'image')],name:doc.title,description:doc.desc.truncate(200),href:doc .url};}else{var m=null;};publishToStream('published '+doc.title+' to Scribd.',m, autoPost);}};}();Scribd.Facebook.AutoLogin={cookie:new Scribd.JSONCookie('sessio n_metadata'),initialize:function(){if(this.enabled()){Event.observe(document,Scr ibd.Facebook.EVENTS.active_facebook_session,function(e){new Ajax.Request('/faceb ook_session/instant_connect',{parameters:{facebook_id:Scribd.Facebook.getSession UID()},onComplete:function(r){if(r.responseJSON.success){trackEvent('Facebook',' Autologin');Scribd.log('FB autoLogin: login response',r.responseJSON);Event.fire (document,Scribd.Facebook.EVENTS.auto_logged_in);Scribd.Facebook.transitionToLog gedInUI(r.responseJSON);}else if(r.responseJSON.new_user){Scribd.log('FB autoCre ate: create response',r.responseJSON);Event.fire(document,Scribd.Facebook.EVENTS .auto_logged_in);Scribd.Facebook.transitionToLoggedInUI(r.responseJSON);}else{Sc ribd.log(r.responseJSON.success);Scribd.log('FB autoLogin: no existing scribd us er');this.loggedOut();this.cookie.set('no_existing_scribd_user','true');this.coo kie.save();}}.bind(this)});}.bind(this));Event.observe(document,Scribd.Facebook. EVENTS.inactive_facebook_session,function(e){Scribd.log('FB autoLogin: no active fb session');this.loggedOut();}.bind(this));} else{this.loggedOut();}},enabled:function(){if(this.cookie.get('no_existing_scri bd_user')=='true'){Scribd.log('FB autoLogin: no existing scribd user (cached)'); return false;} if(document.cookie.match('user_forced_logout=true')){Scribd.log('FB autoLogin: u ser forced logout');return false;} if(!Scribd.Facebook.serverEnableInstantConnect Scribd.Facebook.scribdSessionAct ive){Scribd.log('FB autoLogin: disabled server side');return false;} return true;},loggedOut:function(){Event.fire(document,Scribd.Facebook.EVENTS.au to_logged_out);}};Scribd.Facebook.Permissions={context_permissions:{"homepage":[ "email","publish_stream","read_stream","offline_access"],"toolbar_download":["em ail","publish_stream","read_stream","offline_access"]},all_permissions:["email", "publish_stream","read_stream","offline_access"],hasPermissionsForContext:functi on(context){var context_permissions=Scribd.Facebook.Permissions.context_permissi ons[context].join(',');return Scribd.Facebook.Permissions.hasFacebookPermissions (context_permissions);},requestPermissionsForContext:function(context,callbacks)

{var context_permissions=Scribd.Facebook.Permissions.context_permissions[context ].join(',');if(!callbacks.onPermissionsGranted){throw"You must provide an onPerm issionsGranted callback";} if(!callbacks.onPermissionsDenied){throw"You must provide an onPermissionsDenied callback";} Scribd.Facebook.Permissions.requestFacebookPermissions(context_permissions,callb acks);},hasAllPermissions:function(actualPermissionsString,requiredPermissionsSt ring){if(!actualPermissionsString)return false;var actualPermissionsArray=actual PermissionsString.split(",");var requiredPermissionsArray=requiredPermissionsStr ing.split(",");var hasAll=true;for(var i=0;i<requiredPermissionsArray.length;++i ){if(!actualPermissionsArray.include(requiredPermissionsArray[i]))hasAll=false;} return hasAll;},hasFacebookPermissions:function(permissions){if(!facebookUser)re turn true;if(!facebookUserPermissions)Scribd.Facebook.Permissions.fetchFacebookP ermissions();if(Scribd.Facebook.Permissions.hasAllPermissions(facebookUserPermis sions,permissions)){return true;}else{return false;}},requestFacebookPermissions :function(permissions,callbacks){Scribd.Facebook.ensureInit(function(){Scribd.Fa cebook.Permissions.fetchFacebookPermissions();if(Scribd.Facebook.Permissions.has FacebookPermissions(permissions)){callbacks.onPermissionsGranted();}else{FB.ui({ method:'permissions.request',perms:permissions},function(response){if(response.a uthResponse){if(Scribd.Facebook.Permissions.hasAllPermissions(response.perms,per missions)){Scribd.Facebook.Permissions.updateScribdPermissions(response.perms);c allbacks.onPermissionsGranted();}else{callbacks.onPermissionsDenied();}}else{cal lbacks.onPermissionsDenied();}});}});},fetchFacebookPermissions:function(){Scrib d.Facebook.ensureInit(function(){var all_permissions=Scribd.Facebook.Permissions .all_permissions;FB.api({method:'fql.query',query:'SELECT '+all_permissions.join (',')+' FROM permissions WHERE uid='+facebookUserId},function(response){if(respo nse&&response[0]){var perms=response[0];var perms_granted=[];all_permissions.eac h(function(perm){if((perms[perm]==1) (perms[perm]=='1')){perms_granted.push(per m);}});Scribd.Facebook.Permissions.updateScribdPermissions(perms_granted.join(', '));}else{facebookUserPermissions='';}});});},updateScribdPermissions:function(p ermissions){facebookUserPermissions=permissions;new Ajax.Request("/facebook_acco unts/set_permissions");}};Scribd.Facebook.getSharedFriends=function(container,ma x,tmpl,onSuccess){container=$(container);var api_callback=function(response){if( !!response&&response.length>0){response.each(function(id,i){if(i<=max){var pic=t mpl.evaluate({fb_user_id:id});container.insert(pic);}else{throw $break;}});var c ount_msg=container.down('.friend_count_msg a');if(count_msg){count_msg.update("# {count} friend#{plural}".interpolate({count:response.length,plural:((response.le ngth==1)?'':'s')}));} container.fire('Scribd:dom_updated');onSuccess();}};Scribd.Facebook.ensureInit(f unction(){FB.api({method:'Friends.getAppUsers'},api_callback);});};Scribd.Facebo ok.upgradeAccount=function(e){e.stop();var container=e.element().up('.nag') e.e lement().up('.special_nag');Scribd.Facebook.Permissions.requestPermissionsForCon text('homepage',{onPermissionsGranted:function(){container.down('.inner').update ('<h2 class="first">Thanks, your profile is now complete.</h2>');(function(){Eff ect.Fade(container);}).delay(3);},onPermissionsDenied:function(){Scribd.log('FB Permissions Request Denied.');}});};Scribd.blueBarUtil={show:function(){},barClo sed:function(){trackEvent('Facebook','Blue Bar','Close This Message');},noThanks :function(){FB.api({method:'auth.revokeAuthorization',block:1},function(){});new Ajax.Request("/facebook_session/no_thanks",{asynchronous:false,onSuccess:functi on(req){trackEvent('Facebook','Blue Bar','No Thanks');(function(){window.locatio n='/logout?return_to='+encodeURIComponent(window.location.pathname);}).delay(1); },on409:function(req){window.location='/account/blocked_from_deletion';}});},onL oadHandler:function(){Scribd.Facebook.ensureInit(function(){if(facebookUser&&Scr ibd.FacebookSession.correct()&&facebookUserInstantConnected){Scribd.blueBarUtil. show();}});}};Scribd.LikeButtonManager=Class.create({initialize:function(current _facebook_user_id,container,url,width,layout,extras){extras=extras 'show_faces= "true"';container=$(container);document.observe(Scribd.Facebook.EVENTS.loaded,fu nction(){var cookie=FB.Cookie.load();var no_fb_cookie_on_scribd_domain=cookie=== undefined;var matching_session=(current_facebook_user_id&&cookie&&(cookie.uid==c urrent_facebook_user_id));if(!Scribd.logged_in current_facebook_user_id===null

no_fb_cookie_on_scribd_domain matching_session){container.update('<fb:like hre f="'+url+'" width="'+width+'" layout="'+layout+'" '+extras+'></fb:like>').show() ;}});}}); /* public/javascripts/shared/flash_heed.js @ 1319142822 */ var FlashHeed=(function(window){var document=window.document;var gsub=function(s tring,pattern,replacement){var result='',source=string,match;while(source.length >0){if(match=source.match(pattern)){result+=source.slice(0,match.index);result+= replacement;source=source.slice(match.index+match[0].length);}else{result+=sourc e,source='';}} return result;};var heed=function(el){if(el===undefined)var el=document;var obje cts=el.getElementsByTagName('object');var len=objects.length;var i;for(i=0;i<len ;i++){var o=objects[i];var params=o.getElementsByTagName('param');var params_len gth=params.length;var embeds=o.getElementsByTagName('embed');var embed=null;if(e mbeds.length>0)var embed=embeds[0];if(embed){embed.setAttribute('wmode','transpa rent');var nx=embed.nextSibling,pn=embed.parentNode;pn.removeChild(embed);pn.ins ertBefore(embed,nx);} var correct_wmode_found=false;var incorrect_wmode_found=false;for(var j=0;j<para ms_length;j++){if(params[j].name==='wmode'){if(/transparent/i.test(params[j].val ue) /opaque/i.test(params[j].value)){correct_wmode_found=true;}else{incorrect_w mode_found=true;}}} if(!correct_wmode_found incorrect_wmode_found){var html=o.outerHTML;var nx=o.ne xtSibling,pn=o.parentNode;html=gsub(html,/<param name="wmode".*?>/i,'');html=gsu b(html,/<\/object>/i,'<PARAM NAME="WMode" VALUE="Transparent"></object>');pn.rem oveChild(o);var div=document.createElement("div");div.appendChild(o);div.innerHT ML='';div.innerHTML=html;pn.insertBefore(div,nx);}}} return{heed:heed}})(window); /* public/javascripts/shared/link_account.js @ 1319142822 */ if(!window.Scribd)var Scribd=new Object();if(!Scribd.Facebook)Scribd.Facebook={} ;if(!Scribd.Twitter)Scribd.Twitter={};Scribd.SocialAccount=Class.create({initial ize:function(element,callbacks){this.element=element;if(this.element){this.eleme nt.observe('click',this.linkPrompt.bind(this));} if(typeof callbacks!=='undefined'){this.onSuccess=callbacks.onSuccess;this.onFai lure=callbacks.onFailure;}},success:function(){if(this.onSuccess)this.onSuccess( );},failure:function(){if(this.onFailure)this.onFailure();},linkedTemplate:new T emplate('<span>#{name}</span>')});Scribd.Facebook.Account=Class.create(Scribd.So cialAccount,{linkPrompt:function(e){e.stop();FB.login(this.handleLinkResponse.bi nd(this));},handleLinkResponse:function(response){if(response.authResponse){new Ajax.Request("/facebook_link",{method:'post',onSuccess:this.linkSuccess.bind(thi s),onFailure:this.linkFailure.bind(this)});}else{this.linkFailure();}},setGlobal State:function(){var cookie=FB.Cookie.load();if(cookie){facebookUser=true;facebo okSessionKey=cookie.session_key;facebookUserId=cookie.uid;}},linkSuccess:functio n(){this.setGlobalState();this.setName();$$(".facebook_prefs").invoke('hide');Sc ribd.Alerts.success('flashes_placeholder',"Your facebook account is now linked." ,{auto_fade:true});$$('.facebook_not_linked').invoke('hide');this.success();},li nkFailure:function(){Scribd.Alerts.error('flashes_placeholder',"Sorry, another S cribd user is already associated with that Facebook account.",{auto_fade:false}) ;this.failure();},replaceLink:function(response){if(response[0]){var span=this.l inkedTemplate.evaluate({name:response[0].name});$$('.facebook_unlink_account').i nvoke('show');$$('.facebook_link_account').invoke('hide');$$('.facebook_username ').each(function(element){element.update(response[0].name);element.show();});}}, setName:function(){FB.api({method:'fql.query',query:'SELECT name FROM profile WH ERE id='+FB.getAuthResponse().userID},this.replaceLink.bind(this));}});Scribd.Tw itter.Account=Class.create(Scribd.SocialAccount,{linkPrompt:function(e){e.stop() ;var popupParams='location=0,status=0,width=800,height=400';this._twitterWindow=

window.open("/twitter_link/new.js",'twitterWindow',popupParams);this._twitterInt erval=window.setInterval(this.handleLinkResponse.bind(this),200);},handleLinkRes ponse:function(){if(!this._twitterWindow){this.responseDone();} try{if(this._twitterWindow.location.href.indexOf('oauth_token')>=0){this._twitte rWindow.close();this.responseDone();}}catch(e){}},responseDone:function(){window .clearInterval(this._twitterInterval);this.testLink();},testLink:function(){new Ajax.Request("/twitter_link.js",{method:'get',onSuccess:this.linkSuccess.bind(th is),onFailure:this.linkFailure.bind(this)});},linkSuccess:function(){$$(".twitte r_prefs").invoke('hide');Scribd.Alerts.success('flashes_placeholder',"Your twitt er account is now linked.",{auto_fade:true});$$('.twitter_not_linked').invoke('h ide');this.success();this.setName();},linkFailure:function(){Scribd.Alerts.error ('flashes_placeholder',"We could not link your twitter account. Please try agai n.",{auto_fade:true});this.failure();},replaceLink:function(trans){$$('.twitter_ unlink_account').invoke('show');$$('.twitter_link_account').invoke('hide');$$('. twitter_username').each(function(element){element.update("@"+trans.responseJSON. info.screen_name);element.show();});},setName:function(){new Ajax.Request("/twit ter_link/info.json",{method:'get',evalJSON:'force',onSuccess:this.replaceLink.bi nd(this)});}});Scribd.Facebook.UnlinkAccount=Class.create({initialize:function(e lement){this.element=element;if(this.element){this.element.observe('click',this. unlinkAccount.bind(this));}},unlinkAccount:function(e){e.stop();new Ajax.Request ("/facebook_links/destroy",{method:'delete',onSuccess:this.handleUnlinkAccountRe sponse.bind(this)});},handleUnlinkAccountResponse:function(response){$$('.facebo ok_unlink_account').invoke('hide');$$('.facebook_username').invoke('hide');$$('. facebook_link_account').invoke('show');}});Scribd.Twitter.UnlinkAccount=Class.cr eate({initialize:function(element){this.element=element;if(this.element){this.el ement.observe('click',this.unlinkAccount.bind(this));}},unlinkAccount:function(e ){e.stop();new Ajax.Request("/twitter_links/destroy",{method:'delete',onSuccess: this.handleUnlinkAccountResponse.bind(this)});},handleUnlinkAccountResponse:func tion(response){$$('.twitter_unlink_account').invoke('hide');$$('.twitter_usernam e').invoke('hide');$$('.twitter_link_account').invoke('show');}});document.obser ve(Scribd.Facebook.EVENTS.loaded,function(){if(!Scribd.Readcast.active())return; $$('.facebook_link').each(function(el){new Scribd.Facebook.Account(el);});$$('.t witter_link').each(function(el){new Scribd.Twitter.Account(el);});}); /* public/javascripts/shared/login_required.js @ 1319142822 */ Scribd.requireLogin=function(){if(Scribd.logged_in){return true;} Scribd.login.open({});return false;}; /* public/javascripts/shared/logoutAlert.js @ 1319142822 */ if(!window.Scribd)var Scribd=new Object();Scribd.logoutAlert=Class.create({messa ge:'You have logged out.',initialize:function(container){var container=$(contain er);if(container&&Scribd.Alerts&&!Scribd.logged_in){if(window.location.hash=='#l ogout'){container.addClassName('active').show();Scribd.Alerts.success_blue(conta iner,this.message);window.location.hash='';}}}});Event.observe(window,'load',fun ction(e){new Scribd.logoutAlert('flashes_placeholder');}); /* public/javascripts/shared/options.js @ 1319142822 */ if(!window.Scribd)var Scribd=new Object();Scribd.Options=function(defaults,optio ns){if(options===undefined)var options={};var r=defaults;for(var property in opt ions) r[property]=options[property];return r;}; /* public/javascripts/shared/premium.js @ 1319142822 */

if(!window.Scribd)var Scribd=new Object();if(!window.Scribd.Premium)Scribd.Premi um=new Object();Scribd.Premium.ReadPage={initialize:function(options){this.optio ns=Object.extend({logged_in:false,show_gate:true,extension:'pdf'},options {});i f(!this.options.document_id) throw'Initialized without a document id';Event.observe(window,'load',function(){ if(window.location.hash==="#open_download"){Scribd.Lightbox.remoteOpen('toolbar_ download_lightbox','/word/toolbar_download',{id:this.options.document_id,secret_ password:this.options.secret_password});}else if(window.location.hash==="#archiv e"){if(options.show_gate==true){if(options.logged_in==true){Scribd.Lightbox.remo teOpen('premium_download','/premium/purchases/gate',{doc:this.options.document_i d,extension:this.options.extension});}else{Scribd.login.open({context:'download' ,document_id:this.options.document_id,next_url:'/doc/'+this.options.document_id+ '#open_download'});}}}else if(window.location.hash==="#archive_trial"){if(option s.show_gate==true){if(options.logged_in==true){Scribd.Lightbox.remoteOpen('premi um_download','/premium/purchases/gate',{doc:this.options.document_id,trial:true} );}else{Scribd.login.open({context:'trial',document_id:this.options.document_id, callback:"Scribd.Lightbox.remoteOpen('premium_trial','/premium/purchases/gate' , {trial:true, doc: "+this.options.document_id+" });",fallback_url:window.locatio n});}}}}.bind(this));}}; /* public/javascripts/shared/prototypes/string.js @ 1319142822 */ Object.extend(String.prototype,(function(){var updateQueryParams=function(params ){if(this.indexOf('?')==-1){return this+'?'+Object.toQueryString(params);}else{v ar old_params=this.toQueryParams();var new_params=Object.extend(old_params,param s);return this.baseUrl()+'?'+Object.toQueryString(new_params);}};var baseUrl=fun ction(){return this.slice(0,this.indexOf('?'));};var protocol=function(){var mat ches=/^(.*?:)\/\//.exec(this);return matches?matches[1]:null;};var domain=functi on(){var matches=/\/\/(.*?)\//.exec(this);return matches?matches[1]:null;};retur n{updateQueryParams:updateQueryParams,baseUrl:baseUrl,protocol:protocol,domain:d omain};})()); /* public/javascripts/shared/readcast.js @ 1319142822 */ Scribd.Readcast=Scribd.Readcast {};Scribd.Readcast.Event=Scribd.Readcast.Event {};Scribd.Readcast.active_events={};Scribd.Readcast.Event.Share=Class.create({i nitialize:function(options){this.klass=this._klass();this.options=Object.extend( Object.clone(this.klass.DEFAULT_OPTIONS),options);this.events=this.klass.EVENTS; this.doc=this.options.doc;this.doc_collection=this.options.doc_collection;this.s cribble_text=this.options.scribble_text;},_klass:function(){return Scribd.Readca st.Event.Share;},resubmit:function(cb){this.submitted=false;this.submit(cb);},su bmit:function(cb){if(this.submitted)return;this.submitToRemote(cb);document.fire (this.events.submitted,{event:this});return this;},submitToRemote:function(cb){t his.submitToScribd();if(Object.isFunction(cb))cb.call(this);return this;},submit ToScribd:function(params){var that=this;this.submitted=true;if(this.doc&&this.do c.id) params=Object.extend({document_id:this.doc.id},params);if(this.doc_collection&&t his.doc_collection.id) params=Object.extend({document_collection_id:this.doc_collection.id},params);if( this.scribble_text){params=Object.extend(params {},{scribble_text:this.scribble _text});} new Ajax.Request(this.readcastURL(),{parameters:params,onComplete:function(t){do cument.fire(that.events.completed,{event:t})}});return this;},readcastURL:functi on(){return'/readcast/'+this.options.service_type+'/'+this.options.event_type;}} );Scribd.Readcast.Event.Share.DEFAULT_OPTIONS={event_type:'read'};Scribd.Readcas t.Event.Share.EVENTS={started:'Scribd:Readcast:Share:started',ready:'Scribd:Read cast:Share:ready',submitted:'Scribd:Readcast:Share:submitted',completed:'Scribd:

Readcast:Share:completed'};Scribd.Readcast.Event.BlankReadcast=Class.create({ini tialize:function(options){this.klass=Scribd.Readcast.Event.BlankReadcast;this.op tions=Object.extend(Object.clone(this.klass.DEFAULT_OPTIONS),options);this.event s=this.klass.EVENTS;this.doc=this.options.doc;this.doc_collection=this.options.d oc_collection;},start:function(){var that=this;this.start_timer=setTimeout(funct ion(){document.fire(that.events.ready,{event:that});},this.options.delay*1000);r eturn this;}});Scribd.Readcast.Event.BlankReadcast.EVENTS={ready:'Scribd:Readcas t:BlankReadcast:ready'};Scribd.Readcast.Event.BlankReadcast.DEFAULT_OPTIONS={del ay:10};Scribd.Readcast.Event.AutoShare=Class.create(Scribd.Readcast.Event.Share, {_klass:function(){return Scribd.Readcast.Event.AutoShare;},start:function(){var that=this;this.start_timer=setTimeout(function(){document.fire(that.events.read y,{event:that});Scribd.Readcast.active_events[that.options.service_type]=that;if (that.options.auto_submit){that.undo_timer=setTimeout(function(){Scribd.Readcast .trackEvent("auto submit",that.options.service_type);that.submit();},that.option s.submit_delay*1000);document.fire(that.events.started,{event:that});}},this.opt ions.delay*1000);return this;},stop:function(){if(!this.submitted){if(this.undo_ timer){clearTimeout(this.undo_timer);} if(this.start_timer){clearTimeout(this.start_timer);}} return this;}});Scribd.Readcast.Event.AutoShare.DEFAULT_OPTIONS={delay:10,submit _delay:5,auto_submit:false,service_type:'scribd',event_type:'read'};Scribd.Readc ast.Event.AutoShare.EVENTS={started:'Scribd:Readcast:AutoShare:started',ready:'S cribd:Readcast:AutoShare:ready',submitted:'Scribd:Readcast:AutoShare:submitted', completed:'Scribd:Readcast:AutoShare:completed'};Scribd.Readcast.Event.FacebookA utoShare=Class.create(Scribd.Readcast.Event.AutoShare,{initialize:function($supe r,options){$super(options);this.options.service_type='facebook';this.comments=th is.klass.COMMENTS;},_klass:function(){return Scribd.Readcast.Event.FacebookAutoS hare;},submitToRemote:function(cb){var fn=this.sendToFacebook.bind(this)(cb);Scr ibd.FacebookSession.ensureValid(fn);return this;},sendToFacebook:function(cb){va r that=this;return(function(){Scribd.Readcast.Permissions.Facebook.ensurePublish (function(response){FB.api(that.facebookApiParams(),function(response){if(!respo nse response.error){return;} that.submitToScribd();that.submitted=true;if(Object.isFunction(cb))cb.call(that) ;});});});},facebookApiParams:function(){var that=this,action_links;if(this.doc) {action_links=[{"text":"Readcast","href":Scribd.SharedLink.urlForFacebook(that.d oc.url)}];}else{action_links=[{"text":"Readcast","href":Scribd.SharedLink.urlFor Facebook(that.doc_collection.url)}];} return({method:'stream.publish',action_links:action_links,attachment:that.stream Attachment()});},actionComment:function(){return this.klass.ACTION_COMMENTS[this .options.event_type];},streamAttachment:function(){var that=this,props={};if(tha t.doc){if(that.doc.author!==undefined){props["By"]={"text":that.doc.author.name, "href":that.doc.author.url};} return({"name":that.doc.title.truncate(80),"caption":that.actionComment(),"descr iption":that.doc.description.truncate(190),"href":Scribd.SharedLink.urlForFacebo ok(that.doc.url),"properties":props,"media":[{"type":"image","src":that.doc.thum bnail_url,"href":Scribd.SharedLink.urlForFacebook(that.doc.url)}]});}else{if(tha t.doc_collection.author!==undefined){props["By"]={"text":that.doc_collection.aut hor.name,"href":that.doc_collection.author.url};} return({"name":that.doc_collection.name.truncate(80),"caption":that.actionCommen t(),"description":that.doc_collection.description.truncate(190),"href":Scribd.Sh aredLink.urlForFacebook(that.doc_collection.url),"properties":props,"media":[{"t ype":"image","src":that.doc_collection.thumbnail_url,"href":Scribd.SharedLink.ur lForFacebook(that.doc_collection.url)}]});}}});Scribd.Readcast.Event.FacebookAut oShare.DEFAULT_OPTIONS=Object.clone(Scribd.Readcast.Event.AutoShare.DEFAULT_OPTI ONS);Scribd.Readcast.Event.FacebookAutoShare.EVENTS=Object.clone(Scribd.Readcast .Event.AutoShare.EVENTS);Scribd.Readcast.Event.FacebookAutoShare.ACTION_COMMENTS ={read:'{*actor*} readcast this',download:'{*actor*} readcast this',upload:'{*ac tor*} published this'};Scribd.Readcast.Event.FacebookScribbleAutoShare=Class.cre ate(Scribd.Readcast.Event.FacebookAutoShare,{initialize:function($super,options) {$super(options);this.options.service_type='facebook';},_klass:function(){return Scribd.Readcast.Event.FacebookScribbleAutoShare;},sendToFacebook:function(cb){v

ar that=this;return(function(){Scribd.Readcast.Permissions.Facebook.ensurePublis h(function(response){FB.api(that.facebookApiParams(),function(response){that.sub mitToScribd();that.submitted=true;});});});},facebookApiParams:function(){if(thi s.doc){return({method:'links.post',comment:this.scribble_text,url:Scribd.SharedL ink.urlForFacebook(this.doc.url)});}else{return({method:'status.set',status:this .scribble_text});}}});Scribd.Readcast.Event.FacebookScribbleAutoShare.EVENTS=Obj ect.clone(Scribd.Readcast.Event.AutoShare.EVENTS); /* public/javascripts/shared/refreshing.js @ 1319142822 */ Scribd.init('Scribd','Refreshing');Scribd.Refreshing=Class.create({initialize:fu nction(el,opacity,color){this.element=$(el);this.overlay=new Element('div',{'cla ss':'refreshing_overlay'});this.overlay.update('<div class="refreshing_spinner"> </div>');style={display:'none',zIndex:999,position:'absolute'};if(opacity!=='non e'){style.opacity=opacity 0.7;} if(color!=='none'){style.backgroundColor=color '#eeeeee';} this.overlay.setStyle(style);$(document.body).insert({bottom:this.overlay});},re setOverlay:function(){this.positionOverlay();this.sizeOverlay();},sizeOverlay:fu nction(){this.dimensions=this.element.getDimensions();this.overlay.setStyle({wid th:this.dimensions.width+'px',height:this.dimensions.height+'px',lineHeight:this .dimensions.height+'px'});},positionOverlay:function(){this.overlay.clonePositio n(this.element);},begin:function(){this.show();},show:function(){this.resetOverl ay();this.overlay.show();},hide:function(){this.overlay.hide();},end:function(){ this.overlay.hide();this.overlay.remove();}}); /* public/javascripts/shared/shared_link.js @ 1319142822 */ if(!window.Scribd)var Scribd=new Object();Scribd.SharedLink=function(){var sourc e=window.location.hash.match('#source:(.+)');if(source){source=source[1];} return{trackDocumentLink:function(id){if(source=='facebook'){trackEvent('Faceboo k','Link Sharing',id);}},urlForSource:function(url,source){return url.split('#') [0]+'#source:'+source;},urlForFacebook:function(url){return this.urlForSource(ur l,'facebook');}};}(); /* public/javascripts/shared/smartling.js @ 1319142822 */ Scribd.SmartlingManager=Class.create({currentLanguage:null,languages:{"es":{"pre fix":"es","lcid":"es","english_name":"Spanish","position":1,"name":"Espa\u00f1ol ","id":"es"},"pt":{"prefix":"pt","lcid":"pt-br","english_name":"Portuguese","pos ition":2,"name":"Portugu\u00eas (Brasil)","id":"pt"},"en":{"prefix":null,"lcid": "en","english_name":"English","position":0,"name":"English","id":"en"}},initiali ze:function(options){var options=options {};this.detectLanguage();},detectLangu age:function(){var classNames=$w($$('body').first().className);classNames.each(f unction(klass){var results=/smartling-(.*)$/.exec(klass);if(results&&results[1]) {var lang=this.languages[results[1]];if(lang){this.currentLanguage=lang;}else{}} }.bind(this));if(!this.currentLanguage)this.currentLanguage=this.languages.en;wi ndow.setTimeout(function(){Event.fire(document,'Scribd:language_detected')},0);} }); /* public/javascripts/shared/sticky_element.js @ 1319142822 */ if(!window.Scribd)var Scribd={};Scribd.StickyElement=function(id,fixed_callback, absolute_callback,sticky_func,update_func){if(!!(document.all&&(/msie 6./i).test (navigator.appVersion)&&window.ActiveXObject)) return;var previous_stickiness=!sticky_func();var old_callback=window.onscroll;v ar element=$(id);var new_callback=function(force_apply){var force_apply=!!force_

apply;var new_stickiness=sticky_func();if(force_apply (new_stickiness!=previous _stickiness)){previous_stickiness=new_stickiness;if(new_stickiness){fixed_callba ck(element);}else{absolute_callback(element);} update_func(element);} if(old_callback) old_callback();};var force_apply_callback=function(){new_callback(true);};window .onscroll=new_callback;docManager.addEvent('zoomed',force_apply_callback);docMan ager.addEvent('viewmodeChanged',new_callback);docManager.addEvent('enteredFullsc reen',new_callback);docManager.addEvent('exitedFullscreen',new_callback);documen t.observe('scribd:dom_height_changed',function(){previous_stickiness=null;force_ apply_callback();});Event.observe(document.onresize?document:window,'resize',for ce_apply_callback);new_callback();}; /* public/javascripts/shared/tooltip.js @ 1319142822 */ Scribd.Tooltips={initialize:function(){function buildInner(text){var leftEl=new Element('div',{'class':'tooltip_left'}),rightEl=new Element('div',{'class':'tool tip_right'}),centerEl=new Element('div',{'class':'tooltip_center'});centerEl.upd ate(text);rightEl.insert({top:centerEl});leftEl.insert({top:rightEl});return lef tEl;} $$('[data-tip]').each(function(el){var txt=el.readAttribute('data-tip').escapeHT ML();el.writeAttribute('title',null);el.writeAttribute('data-tip',null);new Tip( el,txt,{style:'black_trans'});});$$('[data-tip-bottom]').each(function(el){var t xt=el.readAttribute('data-tip-bottom').escapeHTML();el.writeAttribute('title',nu ll);el.writeAttribute('data-tip-bottom',null);new Tip(el,txt,{style:'black_trans _bottom'});});$$('[data-tip-right]').each(function(el){var txt=el.readAttribute( 'data-tip-right').escapeHTML();el.writeAttribute('title',null);el.writeAttribute ('data-tip-right',null);new Tip(el,buildInner(txt),{style:'black_trans_right'}); });}};document.observe('dom:loaded',Scribd.Tooltips.initialize.bind(Scribd.Toolt ips));document.observe('Scribd:dom_updated',Scribd.Tooltips.initialize.bind(Scri bd.Tooltips)); /* public/javascripts/shared/twitter.js @ 1319142822 */ Scribd.init('Scribd','Twitter');Scribd.Twitter.loadName=function(){var placehold ers=$$('.twitter_placeholder');if(placeholders.length<1){return;} new Ajax.Request("/twitter_link/info.json",{method:'get',onSuccess:function(tran s){try{var name=trans.responseJSON.info.screen_name;if(typeof name==='undefined' )return;placeholders.each(function(element){element.update("@"+name);});}catch(e ){}}});}; /* public/javascripts/shared/url.js @ 1319142822 */ Scribd.Url=(function(){var hash=function(){var url=document.location.href;var ha sh_loc=url.indexOf('#');if(hash_loc==-1){return'';}else{return url.slice(url.ind exOf('#')+1);}};return{hash:hash};})(); /* public/javascripts/shared/vendor/easyXDM.js @ 1319142822 */ (function(window,document,location,setTimeout,decodeURIComponent,encodeURICompon ent){var global=this;var _channelId=0;var emptyFn=Function.prototype;var reURI=/ ^(http.?:\/\/([^\/\s]+))/,reParent=/[\-\w]+\/\.\.\//,reDoubleSlash=/([^:])\/\//g ;var CREATE_FRAME_USING_HTML=/msie [67]/.test(navigator.userAgent.toLowerCase()) ;function isHostMethod(object,property){var t=typeof object[property];return t== 'function' (!!(t=='object'&&object[property])) t=='unknown';} function isHostObject(object,property){return!!(typeof(object[property])=='objec

t'&&object[property]);} var on=(function(){if(isHostMethod(window,"addEventListener")){return function(t arget,type,listener){target.addEventListener(type,listener,false);};} else{return function(object,sEvent,fpNotify){object.attachEvent("on"+sEvent,fpNo tify);};}}());var un=(function(){if(isHostMethod(window,"removeEventListener")){ return function(target,type,listener,useCapture){target.removeEventListener(type ,listener,useCapture);};} else{return function(object,sEvent,fpNotify){object.detachEvent("on"+sEvent,fpNo tify);};}}());function getDomainName(url){return url.match(reURI)[2];} function getLocation(url){return url.match(reURI)[1];} function resolveUrl(url){url=url.replace(reDoubleSlash,"$1/");if(!url.match(/^(h ttp https):\/\//)){var path=(url.substring(0,1)==="/")?"":location.pathname;if( path.substring(path.length-1)!=="/"){path=path.substring(0,path.lastIndexOf("/") +1);} url=location.protocol+"//"+location.host+path+url;} while(reParent.test(url)){url=url.replace(reParent,"");} return url;} function appendQueryParameters(url,parameters){var hash="",indexOf=url.indexOf(" #");if(indexOf!==-1){hash=url.substring(indexOf);url=url.substring(0,indexOf);} var q=[];for(var key in parameters){if(parameters.hasOwnProperty(key)){q.push(ke y+"="+parameters[key]);}} return url+((url.indexOf("?")===-1)?"?":"&")+q.join("&")+hash;} var _query=(function(){var query={},pair,search=location.search.substring(1).spl it("&"),i=search.length;while(i--){pair=search[i].split("=");query[pair[0]]=pair [1];} return query;}());function undef(v){return typeof v==="undefined";} function getJSON(){var cached={};var obj={a:[1,2,3]},json="{\"a\":[1,2,3]}";if(J SON&&typeof JSON.stringify==="function"&&JSON.stringify(obj).replace((/\s/g),"") ===json){return JSON;} if(Object.toJSON){if(Object.toJSON(obj).replace((/\s/g),"")===json){cached.strin gify=Object.toJSON;}} if(typeof String.prototype.evalJSON==="function"){obj=json.evalJSON();if(obj.a&& obj.a.length===3&&obj.a[2]===3){cached.parse=function(str){return str.evalJSON() ;};}} if(cached.stringify&&cached.parse){getJSON=function(){return cached;};return cac hed;} return null;} function apply(destination,source,noOverwrite){var member;for(var prop in source ){if(source.hasOwnProperty(prop)){if(prop in destination){member=source[prop];if (typeof member==="object"){apply(destination[prop],member,noOverwrite);} else if(!noOverwrite){destination[prop]=source[prop];}} else{destination[prop]=source[prop];}}} return destination;} function createFrame(config){var frame;if(config.props.name&&CREATE_FRAME_USING_ HTML){frame=document.createElement("<iframe name=\""+config.props.name+"\"/>");} else{frame=document.createElement("IFRAME");} apply(frame,config.props);frame.id=frame.name;if(config.onLoad){frame.loadFn=fun ction(){config.onLoad(frame.contentWindow);};on(frame,"load",frame.loadFn);} if(config.container){frame.border=frame.frameBorder=0;config.container.appendChi ld(frame);} else{frame.style.position="absolute";frame.style.left="-2000px";frame.style.top= "0px";document.body.appendChild(frame);} return frame;} var getXhr=(function(){if(isHostMethod(window,"XMLHttpRequest")){return function (){return new XMLHttpRequest();};} else{var item=(function(){var list=["Microsoft","Msxml2","Msxml3"],i=list.length ;while(i--){try{item=list[i]+".XMLHTTP";var obj=new ActiveXObject(item);return i tem;} catch(e){}}}());return function(){return new ActiveXObject(item);};}}());functio n ajax(config){apply(config,{method:"POST",headers:{"Content-Type":"application/

x-www-form-urlencoded","X-Requested-With":"XMLHttpRequest"},success:emptyFn,erro r:function(msg){throw new Error(msg);},data:{},type:"plain"},true);var req=getXh r(),q=[];req.open(config.method,config.url,true);for(var prop in config.headers) {if(config.headers.hasOwnProperty(prop)){req.setRequestHeader(prop,config.header s[prop]);}} req.onreadystatechange=function(){if(req.readyState==4){if(req.status>=200&&req. status<300){var response=req.responseText;if(config.type==="json"){response=getJ SON().parse(response);} config.success(response);} else{config.error("An error occured. Status code: "+req.status);} req.onreadystatechange=null;delete req.onreadystatechange;}};for(var key in conf ig.data){if(config.data.hasOwnProperty(key)){q.push(encodeURIComponent(key)+"="+ encodeURIComponent(config.data[key]));}} req.send(q.join("&"));} function prepareTransportStack(config){var protocol=config.protocol,stackEls;con fig.isHost=config.isHost undef(_query.xdm_p);if(!config.props){config.props={}; } if(!config.isHost){config.channel=_query.xdm_c;config.secret=_query.xdm_s;config .remote=decodeURIComponent(_query.xdm_e);protocol=_query.xdm_p;} else{config.remote=resolveUrl(config.remote);config.channel=config.channel "def ault"+_channelId++;config.secret=Math.random().toString(16).substring(2);if(unde f(protocol)){if(isHostMethod(window,"postMessage")){protocol="1";} else if(isHostMethod(window,"ActiveXObject")&&isHostMethod(window,"execScript")) {protocol="3";} else if(config.remoteHelper){config.remoteHelper=resolveUrl(config.remoteHelper) ;protocol="2";} else{protocol="0";}}} switch(protocol){case"0":apply(config,{interval:300,delay:2000,useResize:true,us eParent:false,usePolling:false},true);if(config.isHost){if(!config.local){var do main=location.protocol+"//"+location.host,images=document.body.getElementsByTagN ame("img"),i=images.length,image;while(i--){image=images[i];if(image.src.substri ng(0,domain.length)===domain){config.local=image.src;break;}} if(!config.local){config.local=window;}} var parameters={xdm_c:config.channel,xdm_p:0};if(config.local===window){config.u sePolling=true;config.useParent=true;config.local=location.protocol+"//"+locatio n.host+location.pathname+location.search;parameters.xdm_e=encodeURIComponent(con fig.local);parameters.xdm_pa=1;} else{parameters.xdm_e=resolveUrl(config.local);} if(config.container){config.useResize=false;parameters.xdm_po=1;} config.remote=appendQueryParameters(config.remote,parameters);} else{apply(config,{channel:_query.xdm_c,remote:decodeURIComponent(_query.xdm_e), useParent:!undef(_query.xdm_pa),usePolling:!undef(_query.xdm_po),useResize:confi g.useParent?false:config.useResize});} stackEls=[new easyXDM.stack.HashTransport(config),new easyXDM.stack.ReliableBeha vior({timeout:((config.useResize?50:config.interval*1.5)+(config.usePolling?conf ig.interval*1.5:50))}),new easyXDM.stack.QueueBehavior({encode:true,maxLength:40 00-config.remote.length}),new easyXDM.stack.VerifyBehavior({initiate:config.isHo st})];break;case"1":stackEls=[new easyXDM.stack.PostMessageTransport(config),new easyXDM.stack.QueueBehavior()];break;case"2":stackEls=[new easyXDM.stack.NameTr ansport(config),new easyXDM.stack.QueueBehavior(),new easyXDM.stack.VerifyBehavi or({initiate:config.isHost})];break;case"3":stackEls=[new easyXDM.stack.NixTrans port(config),new easyXDM.stack.QueueBehavior()];break;} return stackEls;} function chainStack(stackElements){var stackEl,defaults={incoming:function(messa ge,origin){this.up.incoming(message,origin);},outgoing:function(message,recipien t){this.down.outgoing(message,recipient);},callback:function(success){this.up.ca llback(success);},init:function(){this.down.init();},destroy:function(){this.dow n.destroy();}};for(var i=0,len=stackElements.length;i<len;i++){stackEl=stackElem ents[i];apply(stackEl,defaults,true);if(i!==0){stackEl.down=stackElements[i-1];} if(i!==len-1){stackEl.up=stackElements[i+1];}}

return stackEl;} global.easyXDM={version:"2.4.0.90",apply:apply,query:_query,ajax:ajax,getJSONObj ect:getJSON,stack:{}};easyXDM.DomHelper={on:on,un:un,requiresJSON:function(path) {if(!isHostObject(window,"JSON")){document.write('<script type="text/javascript" src="'+path+'"></script>');}}};(function(){var _map={};easyXDM.Fn={set:function (name,fn){_map[name]=fn;},get:function(name,del){var fn=_map[name];if(del){delet e _map[name];} return fn;}};}());easyXDM.Socket=function(config){var stack=chainStack(prepareTr ansportStack(config).concat([{incoming:function(message,origin){config.onMessage (message,origin);},callback:function(success){if(config.onReady){config.onReady( success);}}}])),recipient=getLocation(config.remote);this.destroy=function(){sta ck.destroy();};this.postMessage=function(message){stack.outgoing(message,recipie nt);};stack.init();};easyXDM.Rpc=function(config,jsonRpcConfig){if(jsonRpcConfig .local){for(var method in jsonRpcConfig.local){if(jsonRpcConfig.local.hasOwnProp erty(method)){var member=jsonRpcConfig.local[method];if(typeof member==="functio n"){jsonRpcConfig.local[method]={method:member};}}}} var stack=chainStack(prepareTransportStack(config).concat([new easyXDM.stack.Rpc Behavior(this,jsonRpcConfig),{callback:function(success){if(config.onReady){conf ig.onReady(success);}}}]));this.destroy=function(){stack.destroy();};stack.init( );};easyXDM.stack.PostMessageTransport=function(config){var pub,frame,callerWind ow,targetOrigin;function _getOrigin(event){if(event.origin){return event.origin; } if(event.uri){return getLocation(event.uri);} if(event.domain){return location.protocol+"//"+event.domain;} throw"Unable to retrieve the origin of the event";} function _window_onMessage(event){var origin=_getOrigin(event);if(origin==target Origin&&event.data.substring(0,config.channel.length+1)==config.channel+" "){pub .up.incoming(event.data.substring(config.channel.length+1),origin);}} return(pub={outgoing:function(message,domain,fn){callerWindow.postMessage(config .channel+" "+message,domain targetOrigin);fn();},destroy:function(){un(window," message",_window_onMessage);if(frame){callerWindow=null;frame.parentNode.removeC hild(frame);frame=null;}},init:function(){targetOrigin=getLocation(config.remote );if(config.isHost){on(window,"message",function waitForReady(event){if(event.da ta==config.channel+"-ready"){callerWindow=frame.contentWindow;un(window,"message ",waitForReady);on(window,"message",_window_onMessage);setTimeout(function(){pub .up.callback(true);},0);}});apply(config.props,{src:appendQueryParameters(config .remote,{xdm_e:location.protocol+"//"+location.host,xdm_c:config.channel,xdm_p:1 })});frame=createFrame(config);} else{on(window,"message",_window_onMessage);callerWindow=window.parent;callerWin dow.postMessage(config.channel+"-ready",targetOrigin);setTimeout(function(){pub. up.callback(true);},0);}}});};easyXDM.stack.NixTransport=function(config){var pu b,frame,send,targetOrigin,proxy;return(pub={outgoing:function(message,domain,fn) {send(message);fn();},destroy:function(){proxy=null;if(frame){frame.parentNode.r emoveChild(frame);frame=null;}},init:function(){targetOrigin=getLocation(config. remote);if(config.isHost){try{if(!isHostMethod(window,"GetNixProxy")){window.exe cScript('Class NixProxy\n'+' Private m_parent, m_child, m_Auth\n'+'\n'+' P ublic Sub SetParent(obj, auth)\n'+' If isEmpty(m_Auth) Then m_Auth = auth \n'+' SET m_parent = obj\n'+' End Sub\n'+' Public Sub SetChild(obj) \n'+' SET m_child = obj\n'+' m_parent.ready()\n'+' End Sub\n'+' \n'+' Public Sub SendToParent(data, auth)\n'+' If m_Auth = auth Then m _parent.send(CStr(data))\n'+' End Sub\n'+' Public Sub SendToChild(data, au th)\n'+' If m_Auth = auth Then m_child.send(CStr(data))\n'+' End Sub\n '+'End Class\n'+'Function GetNixProxy()\n'+' Set GetNixProxy = New NixProxy\n '+'End Function\n','vbscript');} proxy=GetNixProxy();proxy.SetParent({send:function(msg){pub.up.incoming(msg,targ etOrigin);},ready:function(){setTimeout(function(){pub.up.callback(true);},0);}} ,config.secret);send=function(msg){proxy.SendToChild(msg,config.secret);};} catch(e){throw new Error("Could not set up VBScript NixProxy:"+e.message);} apply(config.props,{src:appendQueryParameters(config.remote,{xdm_e:location.prot ocol+"//"+location.host,xdm_c:config.channel,xdm_s:config.secret,xdm_p:3})});fra

me=createFrame(config);frame.contentWindow.opener=proxy;} else{try{proxy=window.opener;} catch(e){throw new Error("Cannot access window.opener");} proxy.SetChild({send:function(msg){global.setTimeout(function(){pub.up.incoming( msg,targetOrigin);},0);}});send=function(msg){proxy.SendToParent(msg,config.secr et);};setTimeout(function(){pub.up.callback(true);},0);}}});};easyXDM.stack.Name Transport=function(config){var pub;var isHost,callerWindow,remoteWindow,readyCou nt,callback,remoteOrigin,remoteUrl;function _sendMessage(message){var url=config .remoteHelper+(isHost?("#_3"+encodeURIComponent(remoteUrl+"#"+config.channel)):( "#_2"+config.channel));callerWindow.contentWindow.sendMessage(message,url);} function _onReady(){if(isHost){if(++readyCount===2 !isHost){pub.up.callback(tru e);}} else{_sendMessage("ready");pub.up.callback(true);}} function _onMessage(message){pub.up.incoming(message,remoteOrigin);} function _onLoad(){if(callback){setTimeout(function(){callback(true);},0);}} return(pub={outgoing:function(message,domain,fn){callback=fn;_sendMessage(messag e);},destroy:function(){callerWindow.parentNode.removeChild(callerWindow);caller Window=null;if(isHost){remoteWindow.parentNode.removeChild(remoteWindow);remoteW indow=null;}},init:function(){isHost=config.isHost;readyCount=0;remoteOrigin=get Location(config.remote);config.local=resolveUrl(config.local);if(isHost){easyXDM .Fn.set(config.channel,function(message){if(isHost&&message==="ready"){easyXDM.F n.set(config.channel,_onMessage);_onReady();}});remoteUrl=appendQueryParameters( config.remote,{xdm_e:config.local,xdm_c:config.channel,xdm_p:2});apply(config.pr ops,{src:remoteUrl+'#'+config.channel,name:config.channel});remoteWindow=createF rame(config);} else{config.remoteHelper=config.remote;easyXDM.Fn.set(config.channel,_onMessage) ;} callerWindow=createFrame({props:{src:config.local+"#_4"+config.channel},onLoad:f unction(){un(callerWindow,"load",callerWindow.loadFn);easyXDM.Fn.set(config.chan nel+"_load",_onLoad);_onReady();}});}});};easyXDM.stack.HashTransport=function(c onfig){var pub;var me=this,isHost,_timer,pollInterval,_lastMsg,_msgNr,_listenerW indow,_callerWindow;var usePolling,useParent,useResize,_remoteOrigin;function _s endMessage(message){if(!_callerWindow){return;} var url=config.remote+"#"+(_msgNr++)+"_"+message;if(isHost !useParent){_callerW indow.contentWindow.location=url;if(useResize){_callerWindow.width=_callerWindow .width>75?50:100;}} else{_callerWindow.location=url;}} function _handleHash(hash){_lastMsg=hash;pub.up.incoming(_lastMsg.substring(_las tMsg.indexOf("_")+1),_remoteOrigin);} function _onResize(){_handleHash(_listenerWindow.location.hash);} function _pollHash(){if(_listenerWindow.location.hash&&_listenerWindow.location. hash!=_lastMsg){_handleHash(_listenerWindow.location.hash);}} function _attachListeners(){if(usePolling){_timer=setInterval(_pollHash,pollInte rval);} else{on(_listenerWindow,"resize",_onResize);}} return(pub={outgoing:function(message,domain){_sendMessage(message);},destroy:fu nction(){if(usePolling){window.clearInterval(_timer);} else if(_listenerWindow){un(_listenerWindow,"resize",_pollHash);} if(isHost !useParent){_callerWindow.parentNode.removeChild(_callerWindow);} _callerWindow=null;},init:function(){isHost=config.isHost;pollInterval=config.in terval;_lastMsg="#"+config.channel;_msgNr=0;usePolling=config.usePolling;usePare nt=config.useParent;useResize=config.useResize;_remoteOrigin=getLocation(config. remote);if(!isHost&&useParent){_listenerWindow=window;_callerWindow=parent;_atta chListeners();pub.up.callback(true);} else{apply(config,{props:{src:(isHost?config.remote:config.remote+"#"+config.cha nnel),name:(isHost?"local_":"remote_")+config.channel},onLoad:(isHost&&useParent !isHost)?(function(){_listenerWindow=window;_attachListeners();pub.up.callback (true);}):null});_callerWindow=createFrame(config);if(isHost&&!useParent){var tr ies=0,max=config.delay/50;(function getRef(){if(++tries>max){throw new Error("Un able to reference listenerwindow");}

if(_listenerWindow){return;} try{_listenerWindow=_callerWindow.contentWindow.frames["remote_"+config.channel] ;window.clearTimeout(_timer);_attachListeners();pub.up.callback(true);return;} catch(ex){setTimeout(getRef,50);}}());}}}});};easyXDM.stack.ReliableBehavior=fun ction(config){var pub,timer,current,next,sendId=0,sendCount=0,maxTries=config.tr ies 5,timeout=config.timeout,receiveId=0,callback;return(pub={incoming:function (message,origin){var indexOf=message.indexOf("_"),ack=parseInt(message.substring (0,indexOf),10),id;message=message.substring(indexOf+1);indexOf=message.indexOf( "_");id=parseInt(message.substring(0,indexOf),10);indexOf=message.indexOf("_");m essage=message.substring(indexOf+1);if(timer&&ack===sendId){window.clearTimeout( timer);timer=null;if(callback){setTimeout(function(){callback(true);},0);}} if(id!==0){if(id!==receiveId){receiveId=id;message=message.substring(id.length+1 );pub.down.outgoing(id+"_0_ack",origin);setTimeout(function(){pub.up.incoming(me ssage,origin);},config.timeout/2);} else{pub.down.outgoing(id+"_0_ack",origin);}}},outgoing:function(message,origin, fn){callback=fn;sendCount=0;current={data:receiveId+"_"+(++sendId)+"_"+message,o rigin:origin};(function send(){timer=null;if(++sendCount>maxTries){if(callback){ setTimeout(function(){callback(false);},0);}} else{pub.down.outgoing(current.data,current.origin);timer=setTimeout(send,config .timeout);}}());},destroy:function(){if(timer){window.clearInterval(timer);} pub.down.destroy();}});};easyXDM.stack.QueueBehavior=function(config){var pub,qu eue=[],waiting=true,incoming="",destroying,maxLength=0;function dispatch(){if(wa iting queue.length===0 destroying){return;} waiting=true;var message=queue.shift();pub.down.outgoing(message.data,message.or igin,function(success){waiting=false;if(message.callback){setTimeout(function(){ message.callback(success);},0);} dispatch();});} return(pub={init:function(){if(undef(config)){config={};} maxLength=config.maxLength?config.maxLength:0;pub.down.init();},callback:functio n(success){waiting=false;dispatch();pub.up.callback(success);},incoming:function (message,origin){var indexOf=message.indexOf("_"),seq=parseInt(message.substring (0,indexOf),10);incoming+=message.substring(indexOf+1);if(seq===0){if(config.enc ode){incoming=decodeURIComponent(incoming);} pub.up.incoming(incoming,origin);incoming="";}},outgoing:function(message,origin ,fn){if(config.encode){message=encodeURIComponent(message);} var fragments=[],fragment;if(maxLength){while(message.length!==0){fragment=messa ge.substring(0,maxLength);message=message.substring(fragment.length);fragments.p ush(fragment);}} else{fragments.push(message);} while((fragment=fragments.shift())){queue.push({data:fragments.length+"_"+fragme nt,origin:origin,callback:fragments.length===0?fn:null});} dispatch();},destroy:function(){destroying=true;pub.down.destroy();}});};easyXDM .stack.VerifyBehavior=function(config){var pub,mySecret,theirSecret,verified=fal se;function startVerification(){mySecret=Math.random().toString(16).substring(2) ;pub.down.outgoing(mySecret);} return(pub={incoming:function(message,origin){var indexOf=message.indexOf("_");i f(indexOf===-1){if(message===mySecret){pub.up.callback(true);} else if(!theirSecret){theirSecret=message;if(!config.initiate){startVerification ();} pub.down.outgoing(message);}} else{if(message.substring(0,indexOf)===theirSecret){pub.up.incoming(message.subs tring(indexOf+1),origin);}}},outgoing:function(message,origin,fn){pub.down.outgo ing(mySecret+"_"+message,origin,fn);},callback:function(success){if(config.initi ate){startVerification();}}});};easyXDM.stack.RpcBehavior=function(proxy,config) {var pub,serializer=config.serializer getJSON();var _callbackCounter=0,_callbac ks={};function _send(data){data.jsonrpc="2.0";pub.down.outgoing(serializer.strin gify(data));} function _createMethod(definition,method){var slice=Array.prototype.slice;return function(){var l=arguments.length,callback,message={method:method};if(l>0&&type of arguments[l-1]==="function"){if(l>1&&typeof arguments[l-2]==="function"){call

back={success:arguments[l-2],error:arguments[l-1]};message.params=slice.call(arg uments,0,l-2);} else{callback={success:arguments[l-1]};message.params=slice.call(arguments,0,l-1 );} _callbacks[""+(++_callbackCounter)]=callback;message.id=_callbackCounter;} else{message.params=slice.call(arguments,0);} _send(message);};} function _executeMethod(method,id,fn,params){if(!fn){if(id){_send({id:id,error:{ code:-32601,message:"Procedure not found."}});} return;} var used=false,success,error;if(id){success=function(result){if(used){return;} used=true;_send({id:id,result:result});};error=function(message){if(used){return ;} used=true;_send({id:id,error:{code:-32099,message:"Application error: "+message} });};} else{success=error=emptyFn;} try{var result=fn.method.apply(fn.scope,params.concat([success,error]));if(!unde f(result)){success(result);}} catch(ex1){error(ex1.message);}} return(pub={incoming:function(message,origin){var data=serializer.parse(message) ;if(data.method){if(config.handle){config.handle(data,_send);} else{_executeMethod(data.method,data.id,config.local[data.method],data.params);} } else{var callback=_callbacks[data.id];if(data.error){if(callback.error){callback .error(data.error);}} else if(callback.success){callback.success(data.result);} delete _callbacks[data.id];}},init:function(){if(config.remote){for(var method i n config.remote){if(config.remote.hasOwnProperty(method)){proxy[method]=_createM ethod(config.remote[method],method);}}} pub.down.init();},destroy:function(){for(var method in config.remote){if(config. remote.hasOwnProperty(method)&&proxy.hasOwnProperty(method)){delete proxy[method ];}} pub.down.destroy();}});};})(window,document,location,window.setTimeout,decodeURI Component,encodeURIComponent); /* :files, 'app/views', ... @ 1319142724 */ /* app/views/accounts/sharing.js @ 1319142721 */ if(!window.Scribd)var Scribd=new Object();Scribd.ShareSettings={permissionStates :['on','ask'],websites:['scribd','facebook','twitter'],alwaysShared:['scribbling ','publishing'],initialize:function(){this.form=$('share_form');$('save_changes_ button').observe('click',this.submitForm.bind(this));this.observers.observeSwitc hes();this.observers.observeHeaderControls();},observers:{observeHeaderControls: function(){Scribd.ShareSettings.websites.each(function(website){Scribd.ShareSett ings.permissionStates.each(function(permissionState){$('control_button_'+website +'_'+permissionState).observe('click',function(e){e.stop();Scribd.ShareSettings. eventHandlers.toggleControlButtons(permissionState,website);});});});},observeSw itches:function(){$$('a.switch_button').invoke('observe','click',Scribd.ShareSet tings.eventHandlers.handleSwitchButtonClick);}},eventHandlers:{setInitialState:f unction(state){Scribd.ShareSettings.form.reset();$$('td.radio_button_controls in put').invoke('enable');$H(state.event_settings).each(function(eventType){$H(even tType.value).each(function(website){var event_type=eventType.key;var website_nam e=website.key;var setting=website.value;var el=$(event_type+"_"+website_name+"_" +setting);if(el) el.checked=true;});});state.disabled_events.each(function(eventType){Scribd.Shar eSettings.eventHandlers.toggleEventActiveState($('switch_'+eventType));});},hand leSwitchButtonClick:function(event){event.stop();Scribd.ShareSettings.eventHandl ers.toggleEventActiveState(Event.element(event));},toggleEventActiveState:functi on(switchButtonElement){var eventType=switchButtonElement.id.split("_")[1];var d

isableSwitchCheckBox=$('disabled_events_'+eventType);switchButtonElement.toggleC lassName("switch_button_off");$$('tr#row_'+eventType+' input').each(function(but ton){button.disabled=!button.disabled;});$('row_'+eventType).toggleClassName("di sabledEventType");disableSwitchCheckBox.checked=!disableSwitchCheckBox.checked;i f(disableSwitchCheckBox.checked&&Scribd.ShareSettings.alwaysShared.include(event Type)){Scribd.Alerts.success_blue('sharing_alerts',"Note: "+eventType.capitalize ()+" events will always be shared on Scribd.",{auto_fade:true});}},toggleControl Buttons:function(state,website){$$('td.'+website+' input.'+state).each(function( button){button.checked=true;});}},submitForm:function(event){event.stop();this.p repareFormStateForSerialization();new Ajax.Request(Scribd.ShareSettings.form.act ion,{method:'post',parameters:Form.serialize(Scribd.ShareSettings.form),onSucces s:function(response){Scribd.Alerts.success('sharing_alerts',"Preferences saved." ,{auto_fade:true});},onFailure:function(response){Scribd.Alerts.error('sharing_a lerts',"Error saving preferences. Please try again later.",{auto_fade:true});}}) ;this.restoreFormState();},prepareFormStateForSerialization:function(){$$('input .disabled_control').each(function(checkbox){checkbox.enable();});this.disabledEv ents=$$('input.disabled_control').select(function(checkbox){return checkbox.chec ked;});$$('td.radio_button_controls input').each(function(radioButton){radioButt on.enable();});},restoreFormState:function(){this.disabledEvents.each(function(c heckbox){$$('tr#row_'+checkbox.value+' td.radio_button_controls input').each(fun ction(radio){radio.disable();});});}}; /* app/views/community/community.js @ 1319142721 */ Scribd.toggle_people_view=function(e){e.stop();if(!this.up().hasClassName('selec ted')){$$('#grid_listing_buttons, #list_listing_buttons').each(Scribd.Buttons.to ggle);var container=$('community_main');var loading=container.down('.loading_ove rlay');if(loading){loading.show();}else{var csize=container.getDimensions();load ing=new Element('div',{'class':'loading_overlay'}).update('<img src="/images/spi nner_large_mac_white.gif?1319142822" class="spinner">');loading.setStyle({'width ':csize.width+'px','height':csize.height+'px'});loading.clonePosition(container, {offsetLeft:container.cumulativeScrollOffset().left,offsetTop:document.viewport. getScrollOffsets().top});loading.setOpacity(.75);container.insert(loading);} new Ajax.Request(this.href,{method:'get',onSuccess:function(req){container.repla ce(req.responseText);}});}} /* app/views/explore/explore.js @ 1319142721 */ Scribd.explore_cookies=new CookieJar({path:'/',expires:(60*60*24*360*10)});Scrib d.toggle_doc_row=function(e){var title=this.value this.rel;var callback=functio n(){var on=$(title+'_docs').visible();if(this.tagName=='A') $('cb_'+title).checked=on;var cookie=Scribd.explore_cookies.get('explore_carouse ls') {};var rows=cookie['trends_rows'] [];var changed=false;if(on&&rows.includ e(title)){rows=rows.without(title);changed=true;} if(!on&&!rows.include(title)){rows.push(title);changed=true;} if(changed){cookie['trends_rows']=rows;Scribd.explore_cookies.put('explore_carou sels',cookie);}}.bind(this);new Effect.toggle(title+'_docs','blind',{duration:0. 5,afterFinish:callback});};Scribd.setup_trending_row=function(title,url){Scribd[ title+'_carousel']=new Scribd.carousel('trending_'+title,$$('#trending_'+title+' li'),$$('#'+title+'_arrows a'),{duration:0.5,wheel:false,initial:$$('#trending_ '+title+' li').first(),afterMove:function(){Scribd.carouselUtil.disableButton(ti tle+'_carousel');}});Scribd.carouselLazyLoad(Scribd[title+'_carousel']);$$('#'+t itle+'_docs .timespan .pseudoLink').invoke('observe','click',function(e){this.up ('.timespan').down('.selected').removeClassName('selected');this.addClassName('s elected');var timespan=this.up('li').readAttribute('class');var scrollContainer= $("trending_"+title);var csize=scrollContainer.getDimensions();var loading=new E lement('div',{'class':'loading'}).update('<img src="/images/spinner_large_mac_wh ite.gif?1319142822" class="spinner">');loading.setStyle({'width':csize.width+'px

','height':csize.height+'px'});loading.clonePosition(scrollContainer,{offsetLeft :scrollContainer.cumulativeScrollOffset().left,offsetTop:document.viewport.getSc rollOffsets().top});loading.setOpacity(.75);$(title+'_docs').insert(loading);Scr ibd[title+'_carousel'].deactivateControls();new Ajax.Updater("trending_"+title,u rl,{method:'get',parameters:{carousel:title,tl:timespan,offset:0},onComplete:fun ction(){var cname=title+'_carousel';Scribd[cname].slides=$$('#trending_'+title+' li');Scribd[cname].reload();Scribd.carouselLazyLoad(Scribd[cname]);loading.remo ve();}});});};Scribd.toggle_doc_view=function(e){e.stop();if(!this.up().hasClass Name('selected')){$$('#grid_listing_buttons, #list_listing_buttons').each(Scribd .Buttons.toggle);$('docs_overlay').show();new Ajax.Updater('docs',this.href,{met hod:'get',onComplete:function(){$('docs_overlay').hide();activateScribdLinks();} });}}; /* app/views/home/_index.js @ 1319142721 */

if(!window.Scribd)var Scribd=new Object();Scribd.HomepageManager=Class.create({c ontainer_element_id:'template_main_content',loading_element_id:'instant_connect_ loading',loggedOutShown:false,instantConnectRedirectStarted:false,facebookTimeou t:10,initialize:function(options){this.cookie=new Scribd.JSONCookie('session_met adata');this.container_element=$(this.container_element_id);this.loading_element =$(this.loading_element_id);this.body=$$('body').first();if(!this.container_elem ent){Scribd.log('HomepageInstantConnectManager: Missing container element for: ' +this.container_element_id);return;} if(!this.loading_element){Scribd.log('HomepageInstantConnectManager: Missing loa ding container: '+this.loading_element_id);return;} this.body.setStyle({backgroundColor:'#ffffff'});this.container_element.hide();th is.loading_element.show();if(Scribd.Facebook.AutoLogin.enabled()){Event.observe( document,Scribd.Facebook.EVENTS.auto_logged_in,this.loggedInHandler.bind(this)); Event.observe(document,Scribd.Facebook.EVENTS.auto_logged_out,this.loggedOutHand ler.bind(this));(function(){if(!this.loggedOutShown&&!this.instantConnectRedirec tStarted){trackEvent('Facebook','HomepageAutoLogin','TimedOut');Scribd.log('Home pageManager: Facebook timeout, showing logged out homepage');this.loading_elemen t.hide();this.showContent();}}.bind(this)).delay(this.facebookTimeout);trackEven t('Facebook','HomepageAutoLogin','Attempted');}else{this.loading_element.hide(); this.showContent();}},loggedInHandler:function(){this.instantConnectRedirectStar ted=true;/*<sl:translate>*/ Scribd.log('Administrador de pgina de inicio: informacin sobre el inicio de sesin rec bida; redirigiendo a la pgina de inicio de sesin');this.loading_element.down('h2').u pdate("Hola! Usted est iniciando sesin.");/*</sl:translate>*/ window.location.reload();},loggedOutHandler:function(){/*<sl:translate>*/ Scribd.log('Administrador de pgina de inicio: informacin sobre el cierre de sesin rec bida; mostrando la pgina de cierre de sesin');/*</sl:translate>*/ this.loading_element.hide();this.showContent();},showContent:function(){this.log gedOutShown=true;this.container_element.show();this.body.setStyle({backgroundCol or:'#161312'});}}); /* app/views/layouts/global_search.js @ 1319142721 */ Scribd.SearchAutoCompleter=(function(){function DataSource(data,category){this.d ata=data;this.category=category;} DataSource.prototype={find:function(query){var matches=[];this.data.each(functio n(element){if(this.category==="documents"){var pos=firstMatchedPosition(element. n,query);element.title=element.n;element.url='/doc/'+element.i;}else if(this.cat egory==="users" this.category==="publishers"){var pos=firstMatchedPosition(elem ent.un,query);element.title=element.un;if(pos<0){pos=firstMatchedPosition(elemen t.ul,query);element.title=element.ul;} var id=(this.category==="users"?element.i:element.ui);element.url='/users/'+id;} else if(this.category==="document_collections" this.category==="scribd_pages"){

element.title=element.n;var pos=firstMatchedPosition(element.n,query);if(this.ca tegory==="document_collections"){element.url='/document_collections/'+element.i; }else{element.url=element.u;}} element.sanitizedTitle=element.title&&element.title.escapeHTML();element.sanitiz edUserName=element.un&&element.un.escapeHTML();if(pos>-1){matches.push([element, pos,query.length]);}else if(element.e&&element.e.indexOf(query)>-1){matches.push ([element,0,0]);}}.bind(this));return matches;},size:function(){return this.data .length;}};function Result(obj,pos,len){this.obj=obj;this.pos=pos;this.len=len;t his.dom_id=null;this.next=null;this.prev=null;this.dom_id="ac_result_"+this.obj. t+"_"+this.obj.i;} Result.prototype={render:function(template){this.obj.mod_title=this.obj.title.su bstr(0,this.pos).escapeHTML()+"<strong>"+ this.obj.title.substr(this.pos,this.len).escapeHTML()+"</strong>"+ this.obj.title.substr(this.pos+this.len,this.obj.title.length).escapeHTML();retu rn("<span id='"+this.dom_id+"'>"+template+"</span>").interpolate(this.obj);},ele ment:function(){if(this._element){return this._element;} this._element=$(this.dom_id);return this._element;}};function Container(element, title){this.element=element;this.title=title;this.results=[];} Container.prototype={updateWith:function(results){this.results=[];if(results.len gth===0){this.element.hide();return;} this.element.show();var html=["<h4>"+this.title.gsub('_',' ')+"</h4><ul>"];var t hat=this;results.each(function(result){var obj=result[0];var pos=result[1];var l en=result[2];that.results.push(new Result(obj,pos,len));});this.results.each(fun ction(result){html.push(result.render(that.template));});html.push('</ul>');this .element.down('.ac_main').update(html.join(''));},clear:function(){this.element. down('.ac_main').update('');}};function firstMatchedPosition(text,query){text=te xt.toLowerCase();if(text.substr(0,query.length)===query){return pos=0;} var pos=text.indexOf(" "+query);if(pos>-1){pos++;} return pos;} function normalizeQuery(query){return query?query.strip().toLowerCase():query;} var SearchAutocompleter=function(field,resultsContainerId,keyStrokeBufferDelay){ this.field=field;this.resultsContainerId=resultsContainerId;this.selectedElement =null;this.results=[];this.categories=[];this.bufferKeyTimer=null;this.keyStroke BufferDelay=keyStrokeBufferDelay 200;Event.observe(window,"keyup",function(e){i f((e.keyCode===13 e.keyCode==9)&&this.results.length>0&&this.selectedElement){l ocation.href=this.selectedElement.obj.url;}else if(e.keyCode==38){if(this.select edElement===null){this.changeSelectedElement(this.results[this.results.length-1] );}else{this.changeSelectedElement(this.selectedElement.prev);}}else if(e.keyCod e==40){if(this.selectedElement===null){this.changeSelectedElement(this.results[0 ]);}else{this.changeSelectedElement(this.selectedElement.next);}}else if(e.keyCo de==27){e.stop();this.hide();}}.bind(this));Event.observe(window,"click",functio n(e){if(e.findElement()!==this.field){this.hide();}}.bind(this));Event.observe(t his.field,"keyup",this.bufferedKeyup.bind(this));this.dataSources=[];this.contai ners={};};SearchAutocompleter.prototype={hide:function(){this.results=[];this.se lectedElement=null;$(this.resultsContainerId).hide();this.categories.each(functi on(category){this.containers[category].clear();}.bind(this));},bufferedKeyup:fun ction(){if(this.bufferedQuery!==this.field.getValue()){window.clearTimeout(this. bufferKeyTimer);this.bufferedQuery=this.field.getValue();var query=normalizeQuer y(this.bufferedQuery);var that=this;this.bufferKeyTimer=window.setTimeout(functi on(){that.service.find(query,{found:function(json){that.initDataSources(json);th at.find(query);$(that.resultsContainerId).show();},notFound:function(){that.hide ();}});},query.length==1&&((query>='a'&&query<='z') (query>='A'&&query<='Z'))?0 :that.keyStrokeBufferDelay);}},initDataSources:function(data){var total=0 this.dataSources=[];for(var category in data){var ds=new DataSource(data[categor y],category);total+=ds.size();this.dataSources.push(ds);} return total;},init:function(data){this.initDataSources(data);for(var category i n data){this.categories.push(category);var sectionId=this.resultsContainerId+"_" +category;if(!$(sectionId)){$(this.resultsContainerId).insert("<div id='#{id}' c lass='ac_section'></div>".interpolate({id:sectionId}));} var container=new Container($(sectionId),category);this.containers[category]=con

tainer;if(category==="scribd_pages"){container.template="<a href='#{url}'><li><p >#{mod_title}</p></li></a>";}else if(category==='users' category==='publishers' ){container.template="<a href='#{url}'><li><img src='#{tu}' alt='#{sanitizedTitl e}' /><p>#{mod_title}</p></li></a>";}else if(category==="documents" category=== "document_collections"){container.template="<a href='#{url}'><li><img src='#{tu} ' alt='#{sanitizedTitle}' /><div><p>#{mod_title}</p><p class='ac_user_credit'><s pan class='label'>From:</span> #{sanitizedUserName}</p></div></li></a>";}}},chan geSelectedElement:function(newElement){if(this.selectedElement!==null){var selec tedElement=this.selectedElement.element();if(selectedElement){selectedElement.do wn().removeClassName("highlight");}} this.selectedElement=newElement;if(newElement!==null){var selectedElement=this.s electedElement.element();if(selectedElement){selectedElement.down().addClassName ("highlight");}}},addKeybindings:function(){var that=this;this.results.each(func tion(result){Event.observe(result.element(),"mouseover",function(e){that.changeS electedElement(result);});});},find:function(query){this.results=[];this.selecte dElement=null;for(var i=0;i<this.dataSources.length;i++){var dataSource=this.dat aSources[i];var container=this.containers[dataSource.category];if(container){con tainer.updateWith(dataSource.find(query));this.results=this.results.concat(conta iner.results);}} if(this.results.length==0){this.hide();}else{for(var i=0;i<this.results.length;i ++){if(i!==0){this.results[i-1].next=this.results[i];this.results[i].prev=this.r esults[i-1];} if(i!==this.results.length-1){this.results[i+1].prev=this.results[i];this.result s[i].next=this.results[i+1];}} this.addKeybindings();}}};var GlobalService=Class.create({initialize:function(ur l){this.url=url,this.resultCache={},this.executedQueries={},this.bufferedQuery=n ull;},find:function(query,callbacks){if(this.hasNoResults(query)){callbacks.notF ound();}else if(this.hasCache(query)){return callbacks.found(this.resultCache[qu ery]);}else if(query!==this.bufferedQuery){if(!this.isFetching){this.isFetching= true;this._fetch(query,callbacks);}} this.bufferedQuery=query;},_fetch:function(query,callbacks){this.bufferedQuery=q uery;this._remoteFetch(query,{q:query},callbacks);},_remoteFetch:function(query, params,callbacks){var that=this;new Ajax.Request(this.url,{method:'get',paramete rs:params,onSuccess:function(resp){var data=resp.responseJSON;if(data){var total Found=0;for(var category in data){totalFound+=data[category].length;} if(that.shouldCache()){that.executedQueries[query]=totalFound;that.resultCache[q uery]=data;} if(totalFound>0){return callbacks.found(data);}} callbacks.notFound();},onFailure:function(resp){Scribd.logError(resp);callbacks. notFound();},onException:function(req,e){Scribd.logError(e);},onComplete:functio n(){that.isFetching=false;if(query!==that.bufferedQuery){that.find(that.buffered Query,callbacks);}}});},hasNoResults:function(query){if(!query){return true;} var found=this.executedQueries[query];if(found&&found<=0){return true;} for(var q in this.executedQueries){if(query.indexOf(q)===0&&this.executedQueries [q]<=0){return true;}} return false;},hasCache:function(query){var found=this.executedQueries[query];re turn(found&&found>0);},shouldCache:function(){return true;},preAlphabetCache:fun ction(){var that=this;new Ajax.Request(this.url,{method:'get',parameters:{prefet ch:true},onSuccess:function(resp){var data=resp.responseJSON;if(data){for(var pr eQuery in data){var pqData=data[preQuery];;var totalFound=0;for(var category in pqData){totalFound+=pqData[category].length;} that.executedQueries[preQuery]=totalFound;that.resultCache[preQuery]=pqData;}}}, onFailure:function(resp){Scribd.logError(resp);},onException:function(req,e){Scr ibd.logError(e);}});}});var UserService=Class.create(GlobalService,{initialize:f unction($super,userId){this.userId=userId;$super('/users/'+userId+'/autocomplete r/fetchids');this.tries={0:new Scribd.CompactTrie(),1:new Scribd.CompactTrie(),3 :new Scribd.CompactTrie()};this.triesLoaded=0;},fetchTrie:function(type,url){var that=this,typeId=SearchAutocompleter.TypesToIDs[type],globalCallback='__uactJso np'+typeId;window[globalCallback]=undefined;window[globalCallback]=function(data ){that.initTrie(typeId,data);};Scribd.jsonp({url:url,callback:globalCallback});}

,initTrie:function(category,data){this.tries[category].data=data;this.triesLoade d++;},_fetch:function(query,callbacks){if(query.length<2){callbacks.notFound();t his.isFetching=false;}else{var params={};var found=false;for(var category in thi s.tries){var trie=this.tries[category];var ids=trie.search(query).flatten().uniq ();if(ids.length>0){params[category]=ids.slice(0,5).join(',');found=true;}} if(found){this._remoteFetch(query,params,callbacks);}else{if(this.shouldCache()) {this.executedQueries[query]=0;} callbacks.notFound();this.isFetching=false;}}},shouldCache:function(){return thi s.triesLoaded===3;}});SearchAutocompleter.GlobalService=GlobalService;SearchAuto completer.UserService=UserService;SearchAutocompleter.TypesToIDs={documents:0,us ers:1,publisers:2,document_collections:3,scribd_pages:4};return SearchAutocomple ter;})();Scribd.CompactTrie=(function(){var CT=function(data,endpoint){this.data =data {};this.endpoint=endpoint CT.endpoint;};CT.endpoint=String.fromCharCode( 0x1337);CT.prototype={search:function(query){var data=this.data;var currentQuery ='';for(var i=0;i<query.length;i++){var ch=query[i];currentQuery=currentQuery.co ncat(ch);var d=data[ch];if(d){data=d;currentQuery='';}else{var found=prefixMatch (data,currentQuery);if(!found){return[];} if((found.key.length>=query.length-i&&found.key.indexOf(query.substr(i))===0)){d ata=found.data;break;}else if(query.substr(i).indexOf(found.key)===0){i+=(found. key.length-1);if(this.isEndPoint(found.data)){return[];} currentQuery='';data=found.data;}else{return[];}}} return this.enumerate(data);},enumerate:function(data){var results=[];for(var ke y in data){var ep=data[key];if(key==this.endpoint){results.push(data[key]);}else {results=results.concat(this.enumerate(data[key],key,this.endpoint));}} return results;},isEndPoint:function(data){for(var k in data){var ep=data[k];if( k!=this.endpoint) return false;} return true;}};function prefixMatch(data,prefix){for(var key in data){if(key.ind exOf(prefix)===0){return({'key':key,'data':data[key]});}} return null;} return CT;})();Event.observe(window,'load',function(){var globalHeader=$('global _header');if(!globalHeader){return;} if($('template_main_content')){if(!$('template_main_content').visible()){return; }} var queryFields=$$('#global_header .search_input, #footer .search_input');queryF ields.each(function(query){query.blur();/*<sl:translate>*/ var defaultText='Busque libros, presentaciones, negocios, trabajos acadmicos...',v al=$F(query);/*</sl:translate>*/ if(query.visible()&&(!val val===defaultText)){Scribd.addDefaultTextEvents(query ,defaultText);}});if(Scribd.getOption('GlobalAutoCompleterEnabled')&&$("autocomp leter")){var a=new Scribd.SearchAutoCompleter($('query_header'),"autocompleter") ;a.init({"documents":[],"users":[],"document_collections":[],"publishers":[],"sc ribd_pages":[]});a.service=new Scribd.SearchAutoCompleter.GlobalService('/autoco mpleter');}});document.observe('dom:loaded',function(){$$('.search_button').invo ke('observe','click',function(e){e.stop();var button=e.findElement(),form=button .up('form');form.submit();});}); /* app/views/library/controller.js @ 1319142721 */ Scribd.init('Scribd','Library');Scribd.Library.Controller=Class.create({initiali ze:function(container){this.container=container;this._resetParameters();},_rende rFrame:function(){this.frameTemplate.renderTo(this.container);},_resetParameters :function(){this.parameters={};},_load:function(callback){new Ajax.Request(this. route,{parameters:this.parameters,method:'GET',onSuccess:function(response){call back(response.responseJSON);},onFailure:function(){console.log("Loader failure!" ,name,url,parameters);}});},open:function(){this._resetParameters();this._render Frame();var callback=function(data){this._clear();this._render(data);this._start ();}.bind(this);this._load(callback);},close:function(){this._stop();},_start:fu nction(){},_stop:function(){}});

/* app/views/library/events.js @ 1319142721 */ Scribd.init('Scribd','Library');Scribd.Library.events={open:'library:open',more: 'library:more',sort:'library:sort'}; /* app/views/library/history.js @ 1319142721 */ Scribd.init('Scribd','Library');Scribd.Library.History=Class.create(Scribd.Libra ry.Controller,{route:'/library/history',initialize:function($super,container){$s uper(container);this.frameTemplate=Scribd.Templates.get('library/history_frame') ;this.rowTemplate=Scribd.Templates.get('library/_history');},more:function(){if( !this.parameters.page) this.parameters.page=1;this.parameters.page++;this._load(this._render.bind(this) );},_render:function(data){var element=this.container.down('table');var len=data .length;for(var i=0;i<len;i++){this.rowTemplate.renderAndAppend(element,data[i]) ;}},_clear:function(){var element=this.container.down('table');element.update('' );}}); /* app/views/library/library.js @ 1319142721 */ Scribd.init('Scribd','Library');Scribd.Library.Manager=Class.create({containerNa me:'content_wrap',routes:{uploads:'/library/uploads',my_docs:'/library/my_docs', history:'/library/history',collections:'/library/collections'},initialize:functi on(){this.container=$(this.containerName);this.controllers={my_docs:new Scribd.L ibrary.MyDocs(this.container),history:new Scribd.Library.History(this.container) };this.paginator=new Scribd.Library.Paginator(this.container);this.currentSectio n=null;this._setupBindings();},_setupBindings:function(){this.container.observe( Scribd.Library.events.open,this._openEvent.bind(this));this.container.observe(Sc ribd.Library.events.more,this._moreEvent.bind(this));},_openEvent:function(e){if (this.currentSection){this.controllers[this.currentSection].close();} this.currentSection=e.memo.name;this.currentParameters={};this.controllers[this. currentSection].open();},_moreEvent:function(e){this.controllers[this.currentSec tion].more();}}); /* app/views/library/loader.js @ 1319142721 */ Scribd.init('Scribd','Library');Scribd.Library.Loader=Class.create({initialize:f unction(routes){this.routes=routes;},load:function(name,parameters,callback){par ameters=parameters {};var url=this.routes[name];new Ajax.Request(url,{parameter s:parameters,method:'GET',onSuccess:function(response){callback(response.respons eJSON);},onFailure:function(){console.log("Loader failure!",name,url,parameters) ;}});}}); /* app/views/library/my_docs.js @ 1319142721 */ Scribd.init('Scribd','Library');Scribd.Library.MyDocs=Class.create(Scribd.Librar y.Controller,{route:'/library/my_docs',initialize:function($super,container){$su per(container);this.frameTemplate=Scribd.Templates.get('library/my_docs_frame'); this.rowTemplate=Scribd.Templates.get('library/_my_docs');this.sortCallback=func tion(e){var sortBy=e.target.getValue();this.sort(sortBy);}.bind(this);this.facet Callback=function(e){var facetBy=e.target.getValue();this.facet(facetBy);}.bind( this);},more:function(){if(!this.parameters.page) this.parameters.page=1;this.parameters.page++;this._load(this._render.bind(this) );},sort:function(by){this.parameters.sort=by;this.parameters.page=1;var callbac

k=function(data){this._clear();this._render(data);}.bind(this) this._load(callback);},facet:function(filter){console.log(filter);this.parameter s.facet=filter;this.parameters.page=1;var callback=function(data){this._clear(); this._render(data);}.bind(this);this._load(callback);},_start:function(){this.co ntainer.down('.controls #library_sort').observe('change',this.sortCallback);this .container.down('.controls #library_facet').observe('change',this.facetCallback) ;},_stop:function(){this.container.down('.controls #library_sort').stopObserving ('change',this.sortCallback);this.container.down('.controls #library_facet').sto pObserving('change',this.facetCallback);},_render:function(data){var element=thi s.container.down('table');var len=data.length;for(var i=0;i<len;i++){this.rowTem plate.renderAndAppend(element,data[i]);}},_clear:function(){var element=this.con tainer.down('table');element.update('');}}); /* app/views/library/pagination.js @ 1319142721 */ (function(){var setupPagination=function(){var loadPrefix='library:load:';var lo adMorePrefix='library:load_more:';var loadedPrefix='library:loaded:';var targetE lement=$('content_outer');var paginate=function(name){var checkScroll=function() {var scrollHeight=document.viewport.getHeight()+document.viewport.getScrollOffse ts()[1];var pageHeight=targetElement.getHeight();document.fire(loadMorePrefix+na me);};var enablePagination=function(){Event.observe(window,'scroll',checkScroll) ;};document.observe(loadedPrefix+name);}};document.observe('dom:loaded',setupPag ination);})(); /* app/views/library/paginator.js @ 1319142721 */ Scribd.init('Scribd','Library');Scribd.Library.Paginator=Class.create({initializ e:function(container){this.container=container;this.on=false;var scrollContainer =$('content_outer');this._scrollCallback=function(){var scrollHeight=document.vi ewport.getScrollOffsets()[1]+document.viewport.getHeight();if(scrollContainer.ge tHeight()==scrollHeight){container.fire('library:more');}};this.start();},start: function(){if(!this.on){Event.observe(window,'scroll',this._scrollCallback);this .on=true;}},stop:function(){if(this.on){Event.stopObserving(window,'scroll',this ._scrollCallback);this.on=false;}}}); /* app/views/library/renderer.js @ 1319142721 */ Scribd.init('Scribd','Library');Scribd.Library.Renderer=Class.create({initialize :function(container,name){this.container=container;this.name=name;this.template= Scribd.Library.Templates.rows[name];},drawFrame:function(){var frameHtml=Scribd. Library.Templates.libraryFrame();this.container.update(frameHtml);},render:funct ion(data){this._getContentElement().update('');this.append(data);},append:functi on(data){var table=this._getContentElement();var len=data.length;for(var i=0;i<l en;i++){var html=this.template(data[i]);table.insert({bottom:html});}},_getConte ntElement:function(){return this.container.down('table');}}); /* app/views/library/templates.js @ 1319142721 */ Scribd.init('Scribd','Library','Templates'); /* app/views/people/activity/_admin_header.js @ 1319142721 */ document.observe("dom:loaded",function(){var el=$('show_user_admin_controls') controls=$('admin_user_container');if(!(el&&controls)){return;} el.observe('click',function(e){e.stop();controls.toggle();});});

/* app/views/shared/menu/hover_menu.js @ 1319142721 */ Scribd.HoverMenu=Class.create({initialize:function(hover_el,menu_el){this.hover_ element=hover_el;this.menu_element=this.hover_element.down('.sub_menu');this.act ive=false;this.timerId=null;this.setupObservers();},controls:function(){return[t his.hover_element,this.menu_element];},setupObservers:function(){this.hover_elem ent.observe('mouseenter',this.showMenu.bind(this));this.controls().invoke('obser ve','mouseenter',this.activate.bind(this));this.controls().invoke('observe','mou semove',this.activate.bind(this));this.controls().invoke('observe','mouseout',th is.deactivate.bind(this));document.body.observe('click',function(){this.hover_el ement.removeClassName('open');}.bind(this));},activate:function(){this.active=tr ue;clearTimeout(this.timerId);this.timerId=this.tryHide.bind(this).delay(1);},de activate:function(){this.active=false;},tryHide:function(){if(this.active){retur n false;} this.hover_element.removeClassName('open');},showMenu:function(){this.hideOthers ();this.hover_element.addClassName('open');},hideOthers:function(){$$('.hover_me nu').each(function(el){el.removeClassName('open');});}});document.observe('dom:l oaded',function(){$$('.hover_menu').each(function(el){new Scribd.HoverMenu(el);} );}); /* app/views/shared/rat.js @ 1319142721 */ var RAT_API_VERSION='2';var ratInit=(function(){function getRandomInt(min,max){r eturn Math.floor(Math.random()*(max-min+1))+min;} var Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456 789+/=",encode:function(input){var output="";var chr1,chr2,chr3,enc1,enc2,enc3,e nc4;var i=0;input=Base64._utf8_encode(input);while(i<input.length){chr1=input.ch arCodeAt(i++);chr2=input.charCodeAt(i++);chr3=input.charCodeAt(i++);enc1=chr1>>2 ;enc2=((chr1&3)<<4) (chr2>>4);enc3=((chr2&15)<<2) (chr3>>6);enc4=chr3&63;if(isNa N(chr2)){enc3=enc4=64;}else if(isNaN(chr3)){enc4=64;} output=output+ this._keyStr.charAt(enc1)+this._keyStr.charAt(enc2)+ this._keyStr.charAt(enc3)+this._keyStr.charAt(enc4);} return output;},_utf8_encode:function(string){string=string.replace(/\r\n/g,"\n" );var utftext="";for(var n=0;n<string.length;n++){var c=string.charCodeAt(n);if( c<128){utftext+=String.fromCharCode(c);} else if((c>127)&&(c<2048)){utftext+=String.fromCharCode((c>>6) 192);utftext+=Str ing.fromCharCode((c&63) 128);} else{utftext+=String.fromCharCode((c>>12) 224);utftext+=String.fromCharCode(((c> >6)&63) 128);utftext+=String.fromCharCode((c&63) 128);}} return utftext;}};function jsonp(url,callback){var head=document.getElementsByTa gName('head')[0];var newScript=document.createElement('script');var callbackName ='jsonp'+getRandomInt(0,1000000);window[callbackName]=function(data){callback(da ta[0]);window[callbackName]=undefined;};var newurl=url.replace(/(.*\?.*)(\?)/,'$ 1'+callbackName);newScript.src=newurl;newScript.async=true;newScript.defer='defe r';head.appendChild(newScript);return newScript;} function now(){return(new Date()).getTime()/1000.0;} function encodeObj(raw_args){var args=[];for(var k in raw_args){if(raw_args.hasO wnProperty(k)){var v=raw_args[k];if(v===undefined){v=null;} v=Base64.encode(Object.toJSON(v));args.push(k+'='+encodeURIComponent(v));}} return args.join('&');} function addListener(el,e,f){if(el.addEventListener){el.addEventListener(e,f,fal se);}else if(el.attachEvent){el.attachEvent('on'+e,f);}} function removeListener(el,e,f){if(el.removeEventListener){el.removeEventListene r(e,f,false);}else if(el.detachEvent){el.detachEvent('on'+e,f);}} function Rats(hosts,otherData){this.hosts=hosts;this.es=[];this.vs=[];this.ts=[] ;this.otherData=otherData;this._flushTimeoutId=null;this.lastPing=null;this.numP

ings=0;this.dhost=this._randHost()+RAT_API_VERSION+'/';} Rats.prototype.start=function(){var self=this;this._getVid();addListener(window, 'load',function(){self.docLoaded=true;});function unloadf(){if(self.lps){self.lp s.parentElement.removeChild(self.lps);delete self.lps;self.lps=null;} self.logEvent('dom.window.beforeunload');self.flushEvents(true);} this.unloadf=unloadf;addListener(window,'beforeunload',unloadf);};Rats.prototype ._getVid=function(callback){var url=this.dhost+'getvid.jsonp?callback=?&'+ encodeObj({l:location.href,r:(document.referrer document.referer null),ea:this .otherData,ubtc:this._getUBTC()});var self=this;jsonp(url,function(data){if(data .status!='success'){self.disable();return;} self.vid=data.vid;self.lastFlushed=now();self._setupPing();self.logTimeoutLen=da ta.logTimeoutLen;if(callback){callback(self.vid);}});};Rats.prototype._setupPing =function(){if(this.disabled()){return;} if(this._pingSetup){return;} this._pingSetup=true;var self=this;function ping(){self.lastPing=now();self.numP ings+=1;self._pingSetup=false;self._startFlushTimeout();removeListener(document, 'mousemove',ping);setTimeout(function(){self._setupPing();},1000.0);} addListener(document,'mousemove',ping);};Rats.prototype._resetBuffers=function() {this.es=[];this.ts=[];this.vs=[];this.lastFlushed=this.lastPing;this.lastPing=n ull;this.numPings=0;this._clearFlushTimeout();};Rats.prototype._getUBTC=function (){this._ubtc=this._ubtc document.cookie.replace(/; */g,'&').parseQuery().scrib d_ubtc;return this._ubtc;};Rats.prototype.flushEvents=function(useImg,callback){ if(this.disabled()){return;} var args=encodeObj({es:this.es,ts:this.ts,vs:this.vs,n:now(),lp:this.lastPing,np :this.numPings,ubtc:this._getUBTC()});this._resetBuffers();var self=this;if(useI mg){var i=new Image();i.src=this.dhost+this.vid+'/de.png?rand='+getRandomInt(0,1 00000)+'&'+args;document.body.appendChild(i);}else{jsonp(this.dhost+this.vid+'/d e.jsonp?callback=?&'+args,function(data){if(data.status=='success'){if(callback) {callback();}}else{self.disable();}});}};Rats.prototype.logEvent=function(e,v){i f(this.disabled()){return;} var n=now();this.lastPing=n;v=v null;this.es.push(e);this.vs.push(v);this.ts.pu sh(n);this._startFlushTimeout();};Rats.prototype.l=Rats.prototype.logEvent;Rats. prototype._startFlushTimeout=function(){if(this.disabled()){return;} if(this._flushTimeoutId!==null !this.logTimeoutLen){return;} var self=this;this._flushTimeoutId=window.setTimeout(function(){self.flushEvents (false,function(){self._setupPing();});},this._getTimeoutLen());};Rats.prototype ._getTimeoutLen=function(){return this.logTimeoutLen-((now()-this.lastFlushed)*1 000.0);};Rats.prototype._clearFlushTimeout=function(){if(this._flushTimeoutId=== null){return;} window.clearTimeout(this._flushTimeoutId);this._flushTimeoutId=null;};Rats.proto type._randHost=function(urlSuffix){urlSuffix=urlSuffix '';return this.hosts[get RandomInt(0,this.hosts.length-1)]+urlSuffix;};Rats.prototype.disable=function(){ this._disabled=true;if(this.unloadf){removeListener(window,'beforeunload',this.u nloadf);}};Rats.prototype.disabled=function(){return this._disabled;};Rats.proto type.root=function(){return this;};function makeScope(parent,prefix){function Ra tScope(e,v){if(prefix){e=prefix+'.'+e;} parent.logEvent(e,v);} RatScope.logEvent=RatScope;RatScope.parent=parent;RatScope.root=function(){retur n parent.root();};RatScope.disable=function(){parent.disable();};RatScope.disabl ed=function(){return parent.disabled();};RatScope.s=function(prefix){return make Scope(RatScope,prefix);};RatScope.o=function(element,domEvent,logEventNameOrFunc tion,maxTimes,fireTimeout){maxTimes=maxTimes -1;fireTimeout=fireTimeout 1000;i f(RatScope.disabled()){return;} var isSetUp=false;function setUp(){if(isSetUp){return;}else{isSetUp=true;}} isSetUp=true;var self=this;function fire(e){if(!e){e=window.event;} if(logEventNameOrFunction instanceof Function){RatScope.logEvent(logEventNameOrF unction.call(this,e));}else{RatScope.logEvent(logEventNameOrFunction);} removeListener(element,domEvent,fire);maxTimes-=1;if(maxTimes==-1 maxTimes>0){s etTimeout(function(){setUp();},fireTimeout);}} addListener(element,domEvent,fire);};return RatScope;}

return function(ratHosts,otherData,disabled){var r=new Rats(ratHosts,otherData); if(disabled){r.disable();}else{r.start();} return makeScope(r);};})(); /* app/views/shared/shelf/shelf.js @ 1319142721 */ Scribd.init('Scribd','Shelf');Scribd.Shelf.DeleteControls={initialize:function() {$$('.shelf_document .shelf_control.delete').each(function(el){el.observe('click ',function(e){e.stop();var anchor=e.findElement();el.up('.shelf_document').remov e();new Ajax.Request(anchor.href,{method:'delete',onSuccess:function(trans){Scri bd.Alerts.success('flashes_placeholder','Successfully removed document.');},onFa ilure:function(){Scribd.Alerts.error('flashes_placeholder','Error removing docum ent.');}});});});}};document.observe('dom:loaded',Scribd.Shelf.DeleteControls.in itialize.bind(Scribd.Shelf.DeleteControls));Scribd.Shelf.Documents={initialize:f unction(){$$('.shelf_document img').each(function(el){el.observe('click',functio n(e){e.stop();var anchor=el.up('a');window.location=anchor.href;});});}};documen t.observe('dom:loaded',Scribd.Shelf.Documents.initialize.bind(Scribd.Shelf.Docum ents)); /* app/views/user_document_collections/cyclic_class.js @ 1319142722 */ if(!window.Scribd)var Scribd=new Object();Scribd.Cyclic={swapClasses:function(co ntainer_selector,element_selector,toggle_classes){var toggle_classes=toggle_clas ses ['on','off'];$$(container_selector).each(function(container){var i=0;contai ner.select(element_selector).each(function(el){var next_i=(i+1)%2;el.addClassNam e(toggle_classes[i]);el.removeClassName(toggle_classes[next_i]);i=next_i;})});}} ; /* app/views/word/view/_ipaper_toolbar.js @ 1319142724 */ if(!window.Scribd)var Scribd=new Object();Scribd.ipaperToolbarManager=Class.crea te({last_hash:null,initialize:function(options){this.options=Object.extend({},op tions {});this.container=this.options.container;this.fullscreen_button=this.con tainer.down('.fullscreen_button');this.document_id=options.document_id;this.logg ed_in=options.logged_in;this.post_params={id:this.document_id,show_container:tru e};if(options.secret_password){this.post_params.secret_password=this.options.sec ret_password;} this.setupEvents();},setupEvents:function(){this.lb_buttons=this.container.selec t('.lb_button');this.lbs=this.lb_buttons.map(function(button){return $(button.id +'_lightbox');});this.lb_buttons.invoke('observe','click',function(e){e.stop();v ar el=e.element();var lb=$(el.id+'_lightbox');this.lbButtonClick(el,lb);}.bindAs EventListener(this));var usePolling=true;if(navigator.appName=='Microsoft Intern et Explorer'){var ua=navigator.userAgent;var re=new RegExp("MSIE ([0-9]{1,}[\.09]{0,})");if(re.exec(ua)!=null){usePolling=parseFloat(RegExp.$1)>=8.0;}} this.fullscreen_button.observe('click',function(e){if(iPaperIsFullscreen){if(use Polling){window.location.hash='#fullscreen:off';} else{iPaperCallbacks.exitFullScreen();this.removeClassName('exit_fullscreen_butt on').addClassName('fullscreen_button');}} else{if(usePolling){window.location.hash='#fullscreen:on'} else{iPaperCallbacks.enterFullScreen();this.removeClassName('fullscreen_button') .addClassName('exit_fullscreen_button');}}});if(usePolling){setInterval(function (){if(window.location.hash!=this.last_hash){if(window.location.hash=='#fullscree n:on'){iPaperCallbacks.enterFullScreen();this.removeClassName('fullscreen_button ').addClassName('exit_fullscreen_button');} else{iPaperCallbacks.exitFullScreen();this.removeClassName('exit_fullscreen_butt on').addClassName('fullscreen_button');} this.last_hash=window.location.hash;}}.bind(this.fullscreen_button),200);}

this.container.select('a').invoke('observe','click',function(e){trackEvent('iPap er Top Toolbar','Button Clicks',e.element().id);});},lbButtonClick:function(el,l b){if(lb.hasClassName('inline_lb')){Scribd.Lightbox.open(lb.id,75);}else{this.lb Open(lb.id);}},mobileButtonClick:function(){if(this.logged_in){this.toolbarLogin Callback('toolbar_mobile','/device/choose_device',true);}else{Scribd.login.open( {callback:"Scribd.ipaperToolbar.toolbarLoginCallback('toolbar_mobile', '/device/ choose_device', true)",context:'document_mobile'});}},downloadButtonClick:functi on(){if(this.logged_in){this.toolbarLoginCallback('toolbar_download','/word/tool bar_download',true);}else{Scribd.login.open({callback:"Scribd.ipaperToolbar.tool barLoginCallback('toolbar_download', '/word/toolbar_download', true)",context:'d ownload'});}},toolbarLoginCallback:function(id,url,force_reload){this.logged_in= true;this.lbOpen(id+'_lightbox',url,force_reload);},lbOpen:function(id,url,force _reload){var lb=$(id);if(force_reload lb.down('.content').empty()){Scribd.Light box.remoteOpen(id,url?url:'/word/'+id.gsub('_lightbox',''),this.post_params);}el se{Scribd.Lightbox.toggle(id,75);}}});Scribd.mobileLightboxManager=Class.create( {initialize:function(options){this.options=Object.extend({},options {});this.de livery_radios=$$('input.delivery_methods');this.read_radios=$$('input.read_forma ts');this.setupEvents();},setupEvents:function(){this.delivery_radios.invoke('ob serve','click',function(e){this.showDeliveryMethod(e.element().value);}.bind(thi s));this.delivery_radios.each(function(item){if(item.checked==true){this.showDel iveryMethod(item.value);}}.bind(this));this.read_radios.invoke('observe','click' ,function(e){this.showReadFormat(e.element().value);}.bind(this));this.read_radi os.each(function(item){if(item.checked==true){this.showReadFormat(item.value);}} .bind(this));},showDeliveryMethod:function(item){$$('div.delivery_method_blocks' ).invoke('hide');$('delivery_method_'+item+'_block').show();if(item=='download') {$('send_to_my_device').hide();$('download_to_my_device').show();}else{$('downlo ad_to_my_device').hide();$('send_to_my_device').show();}},showReadFormat:functio n(item){$$('div.read_format_blocks').invoke('hide');$('read_format_'+item+'_bloc k').show();}}); /* app/views/word/view/_toolbar_print.js @ 1319142724 */ if(!window.Scribd)var Scribd=new Object();Scribd.printLightboxManager=Class.crea te({initialize:function(options){this.options=Object.extend({secret_password:'', extension_sizes:{},logged_in:false},options {});this.download_query=$H({secret_ password:this.options.secret_password});this.autodown_query=$H({secret_password: this.options.secret_password});this.download_query.set('extension','pdf');this.a utodown_query.set('autodown','pdf');if($('high_quality_print')){$('high_quality_ print').down('.download_print_button').observe('click',function(e){if(this.optio ns.logged_in){trackEvent('Print','Download and Print');window.location=this.down loadUrl();Scribd.Lightbox.close('toolbar_print_lightbox');}else{trackEvent('Prin t','Download and Print','Login');Scribd.login.open({context:'download',document_ id:this.options.document_id,extension:'pdf',next_url:this.autodownUrl()});}}.bin d(this));} $('standard_quality_print').down('.print_button').observe('click',function(e){va r start=parseInt($('print_start').value);var end=parseInt($('print_end').value); var errorMsg=null;if(!start !end start<1 end<1){errorMsg='Invalid number in p age range';}else if(this.options.page_count<start this.options.page_count<end){ errorMsg='Page number must be less than document page count';}else if(end<start) {errorMsg='End page cannot be less than start page';} if(errorMsg!=null){Scribd.Alerts.error('print_error',errorMsg);return;} iPaperCallbacks.onPrintClick(start,end);Scribd.Alerts.success('print_error','Pri nting...');trackEvent('Print','Print from iPaper');Scribd.Lightbox.close('toolba r_print_lightbox');}.bind(this));},downloadUrl:function(){return this.options.ba se_url+'?'+this.download_query.toQueryString();},autodownUrl:function(){return t his.options.autodown_base_url+'?'+this.autodown_query.toQueryString();}}); /* app/views/word/view/toolbar_share/_embed.js @ 1319142724 */

if(!window.Scribd){var Scribd={};} Scribd.embedCodeUIManager=Class.create({initialize:function(options){this.option s=Object.extend({num_pages:null,doc_url:'',title:'',doc_id:0,access_key:'',secre t_password:null,aspect_ratio:null},options {});this.container=this.options.cont ainer;this.preview_url="/word/embed/"+this.options.doc_id;this.auto_value='(auto )';this.width_input=this.container.down('.embed_width');this.auto_width_input=th is.container.down('.auto_width');this.height_input=this.container.down('.embed_h eight');this.height_container=this.container.down('.height_container');this.page _input=this.container.down('.embed_page');this.mode_input=this.container.down('. view_mode');this.flash_embed_code=this.container.down('.flash_embed_code_input') ;this.html5_embed_code=this.container.down('.html5_embed_code_input');this.previ ew_link=this.container.down('.preview');this.update_link=this.container.down('.u pdate_code');this.embed_params=this.container.down('.embed_params');this.embed_d rawer=this.container.down('.embed_drawer');this.generator=new Scribd.embedCodeGe nerator({doc_url:this.options.doc_url,title:this.options.title,doc_id:this.optio ns.doc_id,access_key:this.options.access_key});this.html_generator=new Scribd.HT ML5EmbedCodeGenerator({doc_url:this.options.doc_url,title:this.options.title,doc _id:this.options.doc_id,access_key:this.options.access_key,secret_password:this. options.secret_password,aspect_ratio:this.options.aspect_ratio});this.updatePrev ious();this.width_input.disable();this.updateEmbedCode(true);new PeriodicalExecu ter(this.updateEmbedCode.bind(this),1);this.setEvents();},$$:function(selector){ return this.container.select(selector);},setEvents:function(){this.auto_width_in put.observe('click',function(e){if(e.element().checked){this.width_input.disable ();this.width_input.value=this.auto_value;}else{this.uncheck_auto_width();}}.bin dAsEventListener(this));this.width_input.observe('blur',function(e){var el=e.ele ment();if($F(el)==this.auto_value $F(el)=="100%"){return;} if($F(el)===""){el.value=this.generator.defaultWidth;}else if(parseInt($F(el))>t his.generator.maxWidth){el.value=this.generator.maxWidth;}else if(parseInt($F(el ))<this.generator.minWidth){el.value=this.generator.minWidth;}}.bindAsEventListe ner(this));this.preview_link.observe('click',function(e){var url=this.preview_ur l+"?width="+(this.auto_width_input.checked?this.generator.defaultWidth:this.widt h_input.value)+"&height="+this.height_input.value+"&view_mode="+$F(this.mode_inp ut)+"&page="+this.page_input.value;if(this.options.secret_password){url=url+'&se cret_password='+this.options.secret_password;} window.open(url);e.stop();}.bind(this));this.width_input.up().observe('click',fu nction(e){var el=e.element();if(el==this.width_input&&this.auto_width_input.chec ked){this.uncheck_auto_width();}}.bindAsEventListener(this));this.height_input.o bserve('click',function(e){var el=e.element();if($F(el)==this.auto_value){el.sel ect();}}.bindAsEventListener(this));this.page_input.observe('blur',function(e){v ar val=parseInt($F(this.page_input));if(val<1 isNaN(val)){this.page_input.value ='1';}else if(this.options.num_pages!=null&&val>parseInt(this.options.num_pages) ){this.page_input.value=this.options.num_pages;}}.bindAsEventListener(this));thi s.height_input.observe('blur',function(e){var el=e.element();if($F(el)==this.aut o_value){return;} if($F(el)===""){el.value=this.generator.defaultHeight;}else if(parseInt($F(el))> this.generator.maxHeight){el.value=this.generator.maxHeight;}else if(parseInt($F (el))<this.generator.minHeight){el.value=this.generator.minHeight;}}.bindAsEvent Listener(this));this.mode_input.observe('change',function(e){var el=e.element(); var val=$F(el);if(val=='slideshow' val=='book'){this.height_input.value=this.au to_value;this.height_input.disable();if(this.container.down('.book_height_text') ){this.container.down('.book_height_text').show();this.container.down('.embed_he ight').hide();}}else{if(this.height_input.value==this.auto_value){this.height_in put.value=this.generator.defaultHeight;this.height_input.enable();} if(this.container.down('.book_height_text')){this.container.down('.book_height_t ext').hide();this.container.down('.embed_height').show();}}}.bindAsEventListener (this));this.$$(".small_tabs li").invoke('observe','click',function(e){var el=$( e.findElement('li'));this.$$(".small_tabs li").invoke('removeClassName','selecte d');el.addClassName('selected');this.$$('.lb_embed_code_container').invoke('hide ');this.$$('[data-content='+el.readAttribute('data-tab')+']').invoke('show');}.b

ind(this));this.$$('.lb_embed_code_container input').invoke('observe','click',fu nction(e){this.select();});this.$$('.embed_params input').invoke('observe','keyp ress',this.restrictToNumbers.bindAsEventListener(this));if(this.embed_drawer){th is.embed_drawer.down('label').observe('click',function(){this.embed_drawer.toggl eClassName('expanded');this.embed_drawer.down('.more_share_options').toggle();}. bind(this));} if(this.update_link){this.update_link.observe('click',function(e){e.stop();this. updateEmbedCode();}.bindAsEventListener(this));}},uncheck_auto_width:function(){ this.width_input.enable();this.width_input.value=this.generator.defaultWidth;thi s.auto_width_input.checked=false;},updateEmbedCode:function(force){if(this.value sChanged() (force===true)){var params={width:this.width_input.value,height:this .height_input.value,page:this.page_input.value,mode:$F(this.mode_input),auto_wid th:this.auto_width_input.checked,auto_height:this.height_input.value==this.auto_ value};if(this.flash_embed_code){this.flash_embed_code.value=this.generator.rend er(params);} if(this.html5_embed_code){this.html5_embed_code.value=this.html_generator.render (params);} this.updatePrevious();}},updatePrevious:function(){this.previous_width=this.widt h_input.value;this.previous_height=this.height_input.value;this.previous_page=th is.page_input.value;this.previous_mode=this.mode_input.value;this.previous_auto_ width=this.auto_width_input.checked;},valuesChanged:function(){return(this.previ ous_width!=this.width_input.value this.previous_height!=this.height_input.value this.previous_page!=this.page_input.value this.previous_mode!=this.mode_input .value this.previous_auto_width!=this.auto_width_input.checked);},restrictToNum bers:function(e){if(!e)var e=window.event;if(e.keyCode)code=e.keyCode;else if(e. which)code=e.which;var character=String.fromCharCode(code);if(code==27){this.blu r();return false;} if(!e.ctrlKey&&code!=9&&code!=8&&code!=36&&code!=37&&code!=38&&(code!=39)&&code! =40&&code!=46){if(character.match(/[0-9]/g)){return true;}else{e.stop();}}}}); /* app/views/word/view/toolbar_share/_send_to_friend.js @ 1319142724 */ if(!window.Scribd)var Scribd=new Object();Scribd.SendToFriendUIManager=Class.cre ate({initialize:function(options){this.options=Object.extend({logged_in:false},o ptions {});/*<sl:translate>*/ this.defaultEmailInputText=this.options.logged_in?'direcciones de correo electrnic o o nombres de usuario de Scribd':'direcciones de correo electrnico de los destina tarios';/*</sl:translate>*/ this.container=this.options.container;this.email_input=this.container.down('.ema il_input');this.send_form=$('toolbar_share_send_to_friend');this.email_input=thi s.send_form.down('.email_input');Scribd.addDefaultTextEvents(this.email_input,th is.defaultEmailInputText);this.send_form.observe('submit',Scribd.Remote.Form.bin dAsEventListener(this.send_form,{onCreate:function(){if(this.email_input.value== this.defaultEmailInputText) this.email_input.clear();var success_div=this.container.down('.success');if(succ ess_div) success_div.hide();}.bind(this),onComplete:function(req){var success_div=this.co ntainer.down('.success');if(!req.responseJSON.errors){this.send_form.select('.in put').invoke('clear');if(!success_div){/*<sl:translate>*/ var str='Se ha enviado el documento!';/*</sl:translate>*/ var success_div=new Element('div',{'class':'success'}).update(str);this.send_for m.insert({before:success_div});}else{success_div.show();}}else{if(success_div) success_div.hide();}}.bind(this)}));}}); /* :class_inlines, 'app/views', ... @ 1319142724 */ /* app/views/shared/readcast/share_button.js @ 1319142721 */ Scribd.init('Scribd','ShareButton');Scribd.ShareButton=Class.create({initialize:

function(element){this.element=element;this.normalButton=element.down('.normal_s hare');this.quickButton=element.down('.quick_share');this.setupBindings();},setu pBindings:function(){var that=this;that.normalButton.observe('click',this.normal Click.bind(this));that.quickButton.observe('click',this.quickClick.bind(this));d ocument.observe(Scribd.RC.Events.forType('quickCommit'),function(){that.quickBut ton.addClassName('submitting');that.finished=true;});document.observe(Scribd.RC. Events.forType('quickDone'),function(){that.quickButton.addClassName('submitted' );that.quickButton.removeClassName('submitting');});},normalClick:function(e){e. stop();Scribd.Lightbox.open('readcast_lightbox');},quickClick:function(e){e.stop ();if(this.finished){return;} document.fire(Scribd.RC.Events.forType('quickCommit'));}}); /* app/views/timeline_events/event.js @ 1319142721 */ Scribd.init('Scribd','Timeline');Scribd.Timeline.Reshare={initialize:function(){ this.setupBinding('.reshare_link');this.closeBinding('.close_reshare');},setupBi nding:function(selector){document.observe('click',function(e){var el=e.findEleme nt(selector);if(!el){return;} e.stop();if(!Scribd.requireLogin()){return;} var container=el.up('.action_container'),form=el.up('.event').down('.add_form'), reshare_controls=container.down('.reshare_controls');if(container.hasClassName(' comment_activated')){container.removeClassName('comment_activated');form.hide(); reshare_controls.show();}else{reshare_controls.blindDown({duration:0.2});} if(container.hasClassName('reshare_activated')){container.removeClassName('resha re_activated');reshare_controls.blindUp({duration:0.1});return;} container.addClassName('reshare_activated');});},closeBinding:function(selector) {document.observe('click',function(e){var el=e.findElement(selector);if(!el){ret urn;} e.stop();var container=el.up('.event').down('.action_container'),reshare_control s=container.down('.reshare_controls');if(container.hasClassName('reshare_activat ed')){container.removeClassName('reshare_activated');reshare_controls.blindUp({d uration:0.1});}});}};document.observe('dom:loaded',Scribd.Timeline.Reshare.initi alize.bind(Scribd.Timeline.Reshare));Scribd.Timeline.Comment={initialize:functio n(){this.setupBinding('.comment_link');this.closeBinding('.close_reply');},setup Binding:function(selector){document.observe('click',function(e){var el=e.findEle ment(selector);if(!el){return;} e.stop();if(!Scribd.requireLogin()){return;} var container=el.up('.event').down('.action_container'),form=el.up('.event').dow n('.add_form'),reshare_controls=container.down('.reshare_controls');if(container .hasClassName('reshare_activated')){container.removeClassName('reshare_activated ');reshare_controls.hide();form.show();}else{form.blindDown({duration:0.2});} Scribd.Timeline.Comment.toggleCommentActiveClass(container.up('.event').down('.s tatus'));if(container.hasClassName('comment_activated')){form.blindUp({duration: 0.1,afterFinish:function(){container.removeClassName('comment_activated');}});re turn;} container.addClassName('comment_activated');});},closeBinding:function(selector) {document.observe('click',function(e){var el=e.findElement(selector);if(!el){ret urn;} e.stop();var form=el.up('.event').down('.add_form'),container=el.up('.event').do wn('.comment_activated, .comment.expanded');if(container){Scribd.Timeline.Commen t.removeCommentActiveClass(container.up('.event').down('.status'));form.blindUp( {duration:0.1,afterFinish:function(){container.removeClassName('comment_activate d');container.removeClassName('expanded');}});}});},toggleCommentActiveClass:fun ction(status_container){if(status_container){if(status_container.hasClassName('c omment_activated')){status_container.removeClassName('comment_activated');}else{ status_container.addClassName('comment_activated');}}},removeCommentActiveClass: function(status_container){if(status_container){status_container.removeClassName ('comment_activated');}}};document.observe('dom:loaded',Scribd.Timeline.Comment. initialize.bind(Scribd.Timeline.Comment));Scribd.Timeline.Dismiss={initialize:fu

nction(){this.setupBinding('.dismiss');},setupBinding:function(selector){documen t.observe('click',function(e){var el=e.findElement(selector);if(!el){return;} e.stop();var nag=el.getAttribute('data-nag');if(nag){new Ajax.Request('/nags/unn ag',{parameters:Scribd.CSRF.paramsWithToken({nag:nag})});} var container=el.up('.dismissable');if(container){container.hide();}});}};docume nt.observe('dom:loaded',Scribd.Timeline.Dismiss.initialize.bind(Scribd.Timeline. Dismiss));Scribd.Timeline.Controls={initialize:function(){this.deleteBinding('.e vent .controls .delete');this.dismissBinding('.event .controls .dismiss');},dele teBinding:function(selector){var that=this;document.observe('click',function(e){ var link=e.findElement(selector);if(!link){return;} e.stop();/*<sl:translate>*/ if(!confirm("Est seguro de que quiere eliminar este tem?")){return;} /*</sl:translate>*/ var controls=link.up();var eventId=parseInt(link.readAttribute('data-event-id')) ;var uId=parseInt(link.readAttribute('data-uid'));that._request(link,'/events/'+ eventId,Scribd.CSRF.paramsWithToken({event_id:eventId,_method:'delete',user_id:u Id}));});},dismissBinding:function(selector){var that=this;document.observe('cli ck',function(e){var link=e.findElement(selector);if(!link){return;} e.stop();var eventId=parseInt(link.readAttribute('data-event-id'));var uId=parse Int(link.readAttribute('data-uid'));that._request(link,'/events/'+eventId+'/dism iss',Scribd.CSRF.paramsWithToken({}));});},_request:function(link,url,params){va r controls=link.up();new Ajax.Request(url,{parameters:params,method:'POST',onCre ate:function(resp){link.hide();controls.addClassName('persist');controls.down('. working').show();},onSuccess:function(resp){controls.down('.working').hide();new Effect.BlindUp(link.up('.event'),{duration:0.5});new Effect.Fade(link.up('.even t'),{duration:0.5});},onFailure:function(resp){controls.down('.working').hide(); controls.down('.error').update('Sorry, something went wrong.').show();},onExcept ion:function(req,e){controls.down('.working').hide();controls.down('.error').upd ate('Sorry, something went wrong.').show();}});}} document.observe('dom:loaded',Scribd.Timeline.Controls.initialize.bind(Scribd.Ti meline.Controls)); /* app/views/people/profile.js @ 1319142721 */ document.observe('dom:loaded',function(){$$('.sidebar_submenu').each(function(se ction){var subselectors=section.select('a.subselector'),content_panels=section.s elect('div.content_panel');subselectors.each(function(el){var content=$(el.id+"_ content");if(content&&el.hasClassName("active")){content.show();}});subselectors .invoke('observe','click',function(e){var el=e.findElement();if(!el.hasClassName ('follow-href')){e.stop();var active=el.hasClassName("active");if(!active){subse lectors.each(function(el){el.removeClassName("active");});el.addClassName("activ e");content_panels.each(function(el){el.hide();});var content=$(el.id+"_content" );if(content) content.show();}}});});}); /* app/views/documents/index.js @ 1319142721 */ Scribd.MyDocsManager={setup:function(){document.observe('dom:loaded',function(){ var m=Scribd.MyDocsManager;m.manager=new ManageDocuments();m.setupPagination();m .setupToolbar();});},setupPagination:function(){var manager=Scribd.MyDocsManager .manager;manager.enabledPrevious=$$('#my_documents .paginator .previous');manage r.enabledNext=$$('#my_documents .paginator .next');manager.disabledPrevious=$$(' #my_documents .paginator .disabled_previous');manager.disabledNext=$$('#my_docum ents .paginator .disabled_next');manager.enabledPrevious.invoke('observe','click ',manager.eventHandlers.previousPage.bind(manager));manager.enabledNext.invoke(' observe','click',manager.eventHandlers.nextPage.bind(manager));manager.refreshPa gination();},setupToolbar:function(){var manager=Scribd.MyDocsManager.manager;va r updateHash=function(e){manager.resetView();manager.setView(e.element().getValu

e());manager.requestView();};$$('#my_documents select.filter').invoke('observe', 'change',updateHash);}} /* app/views/embeds/share.js @ 1319142721 */ Scribd.init('Scribd','Embeds');Scribd.Embeds.Share=Class.create({initialize:func tion(doc,secret_password){this.doc=doc;this.el=$$('.autogen_class_views_embeds_s hare .container')[0];this.$$('textarea').invoke('setValue',new Scribd.HTML5Embed CodeGenerator({doc_url:'http://www.scribd.com/doc/'+doc.id,doc_id:doc.id,title:d oc.title}).render());this.$$('.close').invoke('observe','click',this.close.bind( this));var select_it=function(el){var e=el.element();e.focus();e.select();} $('html5_embed_code').observe('click',select_it);$('doc_url').observe('click',se lect_it);$('share_on_scribd_link').observe('click',function(e){if(e)e.stop();new Ajax.Updater('readcast_doc','/readcast/scribd/read'+'?'+$H({document_id:e.findE lement().getAttribute('doc_id')}).toQueryString(),{method:'post',onSuccess:funct ion(response){$('share_on_scribd_link').hide();$('shared_on_scribd').show();}}); });},$$:function(selector){return this.el.select(selector);},open:function(){thi s.el.show();},close:function(e){if(e)e.stop();this.el.hide();},toggle:function() {this.el.toggle();}}); /* app/views/shared/javascript_widget.js @ 1319142721 */ if(!window.Scribd)var Scribd=new Object();if(!window.Scribd.Shared)Scribd.Shared =new Object();Scribd.Shared.JavascriptWidget=Class.create({initialize:function(o ptions){this.options=options;this.widget_dom_id=options.widget_dom_id;this.is_wi dget_loaded=false;},onDomLoaded:function(event){this.widget_dom=$(this.widget_do m_id);this.widget_dom.javascript_widget=this;this.on_widgets_loaded=this.onWidge tsLoaded.bind(this);Event.observe(document,'Scribd:widgets_loaded',this.on_widge ts_loaded);},onWidgetsLoaded:function(event){Event.stopObserving(document,'Scrib d:widgets_loaded',this.on_widgets_loaded);this.is_widget_loaded=true;}}); /* app/views/upload/_base_upload_widget.js @ 1319142721 */ if(!Scribd)Scribd=new Object();if(!Scribd.Upload)Scribd.Upload=new Object();Scri bd.Upload.BaseUploadWidget=Class.create(Scribd.Shared.JavascriptWidget,{initiali ze:function($super,options){$super(options);this.upload_template_dom_id=options. upload_template_dom_id;},enforceCopyrightWarning:function(){if(window.copyright_ agreed_to) return true;var result=confirm($(this.widget_dom_id).down('.copyright_warning'). innerHTML);window.copyright_agreed_to=result;return result;}}); /* app/views/upload/_upload_button_widget.js @ 1319142722 */ if(!Scribd)Scribd=new Object();if(!Scribd.Upload)Scribd.Upload=new Object();Scri bd.Upload.UploadButtonWidget=Class.create(Scribd.Upload.BaseUploadWidget,{SCRIBD _ERROR:{INVALID_JSON:1201,NO_FILE_ID_PRESENT:1202},initialize:function($super,op tions){$super(options);this.auto_submit_to_facebook=options.auto_submit_to_faceb ook;this.button_height=options.button_height;this.button_width=options.button_wi dth;this.button_image_url=options.button_image_url;this.button_placeholder_id=op tions.button_placeholder_id;this.debug_swf_upload=options.debug_swf_upload;this. file_queue_limit=options.file_queue_limit;this.file_upload_limit=options.file_up load_limit;this.file_size_limit_mb=options.file_size_limit_mb;this.file_types=op tions.file_types;this.file_types_description=options.file_types_description;this .flash_url=options.flash_url;this.is_private=options.is_private;this.minimum_fla sh_version=options.minimum_flash_version;this.post_params=options.post_params;th is.prevent_swf_caching=options.prevent_swf_caching;this.track_event_action=optio

ns.track_event_action;this.track_event_label=options.track_event_label;this.uplo ad_source=options.upload_source;this.upload_status_dom_id=options.upload_status_ dom_id;this.upload_template_dom_id=options.upload_template_dom_id;this.upload_ur l=options.upload_url;this.user_creation_source=options.user_creation_source;this .user_creation_url=options.user_creation_url;this.button_cursor=SWFUpload.CURSOR .HAND;this.button_window_mode=SWFUpload.WINDOW_MODE.TRANSPARENT;this.event_eleme nt=document;this.upload_manager_by_file_id=$H();if(Scribd.override_upload_url){t his.upload_url=Scribd.override_upload_url;} var swf_options=this.optionsForSWFUpload();this.swf_upload=this.newSWFUpload(swf _options);},optionsForSWFUpload:function(){return{button_cursor:this.button_curs or,button_height:this.button_height,button_width:this.button_width,button_image_ url:this.button_image_url,button_placeholder_id:this.button_placeholder_id,butto n_window_mode:this.button_window_mode,debug:this.debug_swf_upload,file_queue_lim it:this.file_queue_limit,file_upload_limit:this.file_upload_limit,file_size_limi t_mb:this.file_size_limit_mb+' MB',file_types:this.file_types,file_types_descrip tion:this.file_types_description,flash_url:this.flash_url,minimum_flash_version: this.minimum_flash_version,post_params:this.post_params,prevent_swf_caching:this .prevent_swf_caching,upload_url:this.upload_url,file_dialog_start_handler:this.f ileDialogStart.bind(this),file_dialog_complete_handler:this.fileDialogComplete.b ind(this),file_queued_handler:this.fileQueued.bind(this),file_queue_error_handle r:this.fileQueueError.bind(this),upload_start_handler:this.uploadStart.bind(this ),upload_progress_handler:this.uploadProgress.bind(this),upload_error_handler:th is.uploadError.bind(this),upload_success_handler:this.uploadSuccess.bind(this),u pload_complete_handler:this.uploadComplete.bind(this)};},newSWFUpload:function(o ptions){return new SWFUpload(options);},fileDialogStart:function(){window.copyri ght_message_seen=false;},fileDialogComplete:function(num_files_selected,num_file s_queued,total_queued){this.num_files_selected=num_files_selected;this.num_files _completed=0;this.num_files_successful=0;if(num_files_selected>0&&this.enforceCo pyrightWarning()){this.startUploadOrCreateAnonymousUser();}},fileQueued:function (file){if(!this.enforceCopyrightWarning()) return;var options=this.optionsForUploadManager(file);var upload_manager=this.ne wUploadManager(options);var parsed_name=this.parseName(file.name);upload_manager .insertElement({file_name_short:parsed_name.name.truncate(30),file_name_long:par sed_name.name,file_upload_id:this.widget_dom_id+'_file_'+file.index});upload_man ager.onQueue();this.upload_manager_by_file_id[file.id]=upload_manager;},parseNam e:function(name){var name_parts=name.split('.');var extension=name_parts.pop();v ar base_name=name_parts.join('.');return{name:base_name,ext:extension};},options ForUploadManager:function(file){var parsed_name=this.parseName(file.name);return {addHTML:this.addFileHTML.bind(this),auto_submit_to_facebook:this.auto_submit_to _facebook,cancelListener:this.cancelUpload.bind(this,file),file_template_element _id:this.upload_template_dom_id,filename_base:parsed_name.name,filename_extensio n:parsed_name.ext,isPrivate:this.isPrivate(),upload_source:this.upload_source};} ,newUploadManager:function(options){return new Scribd.scalable_upload_manager(op tions);},fileQueueError:function(file,error_code,msg){var error_msg;switch(error _code){case SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED:error_msg="Too many items in queue.";break;case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:error_msg=" File is too big.";break;case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:error_msg="Fil e appears to be empty.";break;case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE:error_ msg="Invalid File Type.";break;default:error_msg="Unhandled error: "+error_code; this.uploader.debug("queue error: "+error_code+" "+msg);} this.uploadManagerForFile(file).onQueueError(error_msg);this.swf_upload.setButto nDisabled(false);},uploadStart:function(file){this.event_element.fire('Scribd:up load_widget:uploadStart',{file_id:file.id});this.swf_upload.setButtonDisabled(tr ue);},uploadProgress:function(file,bytes_loaded,bytes_total){var percent=Math.ce il(bytes_loaded/bytes_total*100);this.uploadManagerForFile(file).onProgress(perc ent);},uploadError:function(file,error_code,msg){var error_msg;switch(error_code ){case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:error_msg='Upload Cancelled';break; case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:error_msg="Upload Error: "+msg;break;case SWFUpload.UPLOAD_ERROR.MISSING_UPLOAD_URL:error_msg="File destination not found ";break;case SWFUpload.UPLOAD_ERROR.IO_ERROR:error_msg="There may be a problem w

ith the network connection, please try again.";break;case SWFUpload.UPLOAD_ERROR .SECURITY_ERROR:error_msg="Security Error";break;case SWFUpload.UPLOAD_ERROR.UPL OAD_LIMIT_EXCEEDED:error_msg="Upload limit exceeded";break;case SWFUpload.UPLOAD _ERROR.UPLOAD_FAILED:error_msg="Upload Failed";break;case SWFUpload.UPLOAD_ERROR .SPECIFIED_FILE_ID_NOT_FOUND:error_msg="File ID not found";break;case SWFUpload. UPLOAD_ERROR.FILE_VALIDATION_FAILED:error_msg="File validation failed";break;cas e SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:error_msg="Upload stopped";break;case th is.SCRIBD_ERROR.INVALID_JSON:error_msg="There may be a problem with the network connection, please try again.";break;case this.SCRIBD_ERROR.NO_FILE_ID_PRESENT:e rror_msg="No file ID present";break;default:error_msg='Unhandled Error: '+error_ code;this.uploader.debug("upload error: "+error_code+" "+msg);} this.uploadManagerForFile(file).onError("("+new Date().getTime()+"): "+error_msg );this.swf_upload.setButtonDisabled(false);},uploadSuccess:function(file,server_ data,response){var file_info=this.parseServerResponse(file,server_data);if(!file _info)return;this.uploadManagerForFile(file).onSuccess(file_info);var stats=this .swf_upload.getStats();if(stats.files_queued>0){this.startUpload();}else{this.sw f_upload.setButtonDisabled(false);} window.trackEvent('upload',this.track_event_action,this.track_event_label,0);thi s.event_element.fire('Scribd:upload_widget:uploadSuccess',{file_id:file.id,doc_i d:file_info.id,doc_title:file_info.title});this.num_files_successful+=1;},parseS erverResponse:function(file,server_data){var file_info=null;try{file_info=server _data.evalJSON(true);}catch(e){this.invalidJsonError(file,server_data);return nu ll;} if(!this.isValidFileInfo(file_info)){this.invalidFileInfoError(file,server_data) ;return null;} return file_info;},invalidJsonError:function(file,server_data){this.uploadError( file,this.SCRIBD_ERROR.INVALID_JSON,'There may be a problem with the network con nection, please try again.');},isValidFileInfo:function(file_info){return((file_ info)&&(file_info.id)&&(file_info.id>0)&&(file_info.access_key)&&(file_info.acce ss_key.length>0));},invalidFileInfoError:function(file,server_data){this.uploadE rror(file,this.SCRIBD_ERROR.NO_FILE_ID_PRESENT,'Invalid server response: '+serve r_data);},uploadComplete:function(file){var upload_manager=this.uploadManagerFor File(file);upload_manager.onComplete();this.num_files_completed+=1;if(this.num_f iles_completed==this.num_files_selected){if(this.num_files_successful==this.num_ files_selected){this.event_element.fire("Scribd:upload_widget:allFilesSuccessful ");}else{this.event_element.fire("Scribd:upload_widget:someFilesUnsuccessful");} } this.event_element.fire('Scribd:upload_widget:uploadComplete',{file_id:file.id}) ;},enforceCopyrightWarning:function($super){if(window.copyright_message_seen){re turn window.copyright_agreed_to;}else{window.copyright_message_seen=true;return $super();}},isPrivate:function(){return this.is_private;},startUploadOrCreateAno nymousUser:function(){if(this.upload_url){this.startUpload();}else{new Ajax.Requ est(this.user_creation_url,{asynchronous:true,evalScripts:true,parameters:{from: this.user_creation_source},onSuccess:this.anonymousUserCreated.bind(this),onFail ure:this.anonymousUserCreationFailed.bind(this)});}},anonymousUserCreated:functi on(transport){var data=transport.responseText.evalJSON();var upload_url=data.upl oad_url;if(upload_url&&!upload_url.blank()){this.upload_url=upload_url;this.swf_ upload.setUploadURL(upload_url);this.startUpload();}else{this.anonymousUserCreat ionFailed(transport);}},anonymousUserCreationFailed:function(transport){var rawT ext=transport.responseText;this.uploader.setButtonDisabled(true);this.upload_man ager_by_file_id.each(function(item){var upload_manager=item.value;upload_manager .onError('Registration failed.');});this.showAnonymousUserCreationFailed(rawText );},showAnonymousUserCreationFailed:function(rawText){$$('.uw_anonymous_user_cre ation_failed').each(function(e){e.show();});},startUpload:function(){this.setPos tParam('override_cookies',this.getBrowserCookies());this.setPostParam('override_ uuid',this.getBrowserUuid());this.setPostParam('private_flag',this.isPrivate()); this.setPostParam('source',this.upload_source);this.swf_upload.startUpload();},g etBrowserUuid:function(){return Scribd.getBrowserUuid();},getBrowserCookies:func tion(){return document.cookie;},addFileHTML:function(dom_element){var upload_sta tus_dom=$(this.upload_status_dom_id);upload_status_dom.insert({top:dom_element})

;},cancelUpload:function(file){this.swf_upload.cancelUpload(file.id,false);},set PostParam:function(key,value){this.swf_upload.removePostParam(key);this.swf_uplo ad.addPostParam(key,value);},uploadManagerForFile:function(file){return this.upl oad_manager_by_file_id[file.id];}}); /* app/views/layouts/footer/language_selector.js @ 1319142721 */ Scribd.init('Scribd','Layouts','Footer');Scribd.Layouts.Footer.LanguageSelector= Class.create(Scribd.Shared.JavascriptWidget,{initialize:function($super,options) {$super(options);this.open=false;},onDomLoaded:function($super,event){$super(eve nt);this.widget_dom.select('.top_row .language').invoke('observe','click',functi on(e){e.stop();if(this.open){this.widget_dom.down('.top_row .language').removeCl assName('active');this.widget_dom.down('.language_selector').hide();this.open=fa lse;}else{this.widget_dom.down('.top_row .language').addClassName('active');this .widget_dom.down('.language_selector').show();this.open=true;window.scrollTo(0,d ocument.body.scrollHeight);} return false;}.bind(this));var set_lang=function(){this.widget_dom.select('.top_ row .language a').invoke('update',Scribd.Smartling.currentLanguage.name);this.wi dget_dom.select('.language_selector li[data-id='+Scribd.Smartling.currentLanguag e.id+'] a').invoke('addClassName','active');}.bind(this);if(Scribd.Smartling){se t_lang();}else{document.observe('Scribd:language_detected',set_lang);}}}); /* app/views/solr/base.js @ 1319142721 */ Scribd.init('Scribd','Search');Scribd.Search.active=Scribd.Search.active false; Scribd.Search.showDuplicates=Scribd.Search.showDuplicates false;Scribd.Search.A syncContent={initialize:function(){if(!Scribd.Search.active){return;} $$('[data-content-uri]').each(function(el){var uri=el.readAttribute('data-conten t-uri'),spinner=el.down('.content_pending'),placeholder=el.down('.segment_conten t');new Ajax.Request(uri,{method:'get',onSuccess:function(trans){var content=tra ns.responseJSON.content;if(content===null){el.slideUp({duration:0.4});}else{plac eholder.update(content);}},onFailure:function(){el.slideUp({duration:0.4});},onC omplete:function(){spinner.hide();document.fire('Scribd:dom_updated');}});});}}; document.observe('dom:loaded',Scribd.Search.AsyncContent.initialize.bind(Scribd. Search.AsyncContent));Scribd.Search.Duplicates={initialize:function(){if(!Scribd .Search.showDuplicates){return;} var results=$$('.document_result').inject($H(),function(m,el){m.set(el.readAttri bute('data-document-id'),el);return m;});if(results.size()===0){return;} var docIdsParam=results.keys().inject([],function(m,id){m.push('document_ids[]=' +id);return m;}).join("&");new Ajax.Request('/duplicates.json'+'?'+docIdsParam,{ method:'get',onSuccess:function(trans){$H(trans.responseJSON).each(function(pair ){var el=results.get(pair.key),drawer=el.down('.duplicate_drawer'),note=el.down( '.duplicates_note');note.update(pair.value.heading).appear().observe('click',fun ction(e){e.stop();if(note.hasClassName('open')){note.removeClassName('open');}el se{note.addClassName('open');} Effect.toggle(drawer,'slide',{duration:0.4});});drawer.update(pair.value.content );});}});}};document.observe('dom:loaded',Scribd.Search.Duplicates.initialize.bi nd(Scribd.Search.Duplicates)); /* app/views/premium/purchases/facebook_reauth.js @ 1319142721 */ Scribd.init('Scribd','Premium','Purchases');Scribd.Premium.Purchases.FacebookRea uth=Class.create(Scribd.Shared.JavascriptWidget,{initialize:function($super,opti ons){$super(options);this.next_url=options.next_url;this.use_redirect=options.us e_redirect;},onDomLoaded:function($super,event){$super(event);var widget=this;va r login_function=function(){var link=widget.widget_dom.down('.fb_login');link.ob serve('click',function(event){FB.login(function(response){var authResponse=respo

nse.authResponse;if(authResponse){if(widget.use_redirect){window.location=widget .next_url;}else{Scribd.Lightbox.secureIframeOpen('premium_credit_card_flow',widg et.next_url,{},{style:'tight'});}}});});};Scribd.Facebook.ensureInit(function(){ if(FB.getAuthResponse()){FB.logout(login_function);}else{login_function();}});}} ); /* app/views/shared/buttons/add_to_collections.js @ 1319142721 */ Scribd.init('Scribd','CollectionsButton');Scribd.CollectionsButton.Handler={init ialize:function(){this.click('.add_to_collections');},click:function(selector){d ocument.observe('click',function(e){var el=e.findElement(selector);if(!el){retur n;} e.stop();Scribd.DocumentCollectionsManager.addToCollectionsEventHandler(parseInt (el.readAttribute('data-document-id')),e);});}};document.observe('dom:loaded',Sc ribd.CollectionsButton.Handler.initialize.bind(Scribd.CollectionsButton.Handler) ); /* app/views/premium/purchases/gate_components/payment_options_b.js @ 1319142721 */ Scribd.init('Scribd','Premium','Purchases','GateComponents');Scribd.Premium.Purc hases.GateComponents.PaymentOptionsB=Class.create(Scribd.Shared.JavascriptWidget ,{initialize:function($super,options){$super(options);this.parent_dom_id=options .parent_dom_id;this.chargify_disabled=options.chargify_disabled;this.credit_card _disabled=options.credit_card_disabled;this.paypal_disabled=options.paypal_disab led;},onDomLoaded:function($super,event){$super(event);var payment_options=this; var widget_dom=this.widget_dom;widget_dom.down('#button_credit_card').observe('c lick',function(e){e.stop();if(!this.hasClassName('disabled'))payment_options.sub mitButtonPressed('credit_card');});widget_dom.down('#button_paypal').observe('cl ick',function(e){e.stop();if(!this.hasClassName('disabled'))payment_options.subm itButtonPressed('paypal');});if(this.credit_card_disabled)widget_dom.down('#butt on_text_credit_card').textContent='Not Available';if(this.paypal_disabled)widget _dom.down('#button_text_paypal').textContent='Not Available';},parentJavascriptW idget:function(){return $(this.parent_dom_id).javascript_widget;},planSelectedHa ndler:function(plan){var widget_dom=this.widget_dom;if(this.chargify_disabled&&! this.credit_card_disabled){if(plan.recurring){widget_dom.down('#button_credit_ca rd').addClassName('disabled');}else{widget_dom.down('#button_credit_card').remov eClassName('disabled');}}},submitButtonPressed:function(method){this.submitUIHan dler();this.parentJavascriptWidget().submitHandler(method,this.reverseSubmitUIHa ndler.bind(this));},submitUIHandler:function(){var buttons=this.widget_dom.down( '#buttons_tr');var buttons_text=this.widget_dom.down('#buttons_text_tr');var spi nner=this.widget_dom.down('#spinner_tr');spinner.show();buttons.hide();buttons_t ext.hide();},reverseSubmitUIHandler:function(){var buttons=this.widget_dom.down( '#buttons_tr');var buttons_text=this.widget_dom.down('#buttons_text_tr');var spi nner=this.widget_dom.down('#spinner_tr');spinner.hide();buttons.show();buttons_t ext.show();this.parentJavascriptWidget().planSelected();}}); /* app/views/login/_fb_reauthorize.js @ 1319142721 */ Scribd.init('Scribd','Login','FbReauthorize');Scribd.Login.FbReauthorize=Class.c reate(Scribd.Shared.JavascriptWidget,{initialize:function($super,options){$super (options);this.next_url=options.next_url;},onDomLoaded:function($super,event){$s uper(event);var widget=this;var login_function=function(){var link=widget.widget _dom.down('.fb_login');link.observe('click',function(event){FB.login(function(re sponse){var authResponse=response.authResponse;if(authResponse){new Ajax.Request (widget.next_url);}});});};if(FB.getAuthResponse()){FB.logout(login_function);}e lse{login_function();}}});

/* app/views/upload/_feed_upload_button_widget.js @ 1319142721 */ if(!Scribd)Scribd=new Object();if(!Scribd.Upload)Scribd.Upload=new Object();Scri bd.Upload.FeedUploadButtonWidget=Class.create(Scribd.Upload.UploadButtonWidget,{ initialize:function($super,options){$super(options);},newUploadManager:function( options){var FeedUploadManager=Class.create(Scribd.scalable_upload_manager,{init ialize:function($super,parameters){$super(parameters);},showMetadataForm:functio n($super){$super();},startConversionChecker:function($super){$super();this.eleme nt.down('.su_document_thumbnail_background').setStyle({'background':'#fff url('+ Scribd.cdn_path+'images/spinner_large_mac_white.gif) no-repeat 44px 60px'});},sh owPublishAnimation:function($super){this.element.down('.file_name').show();this. element.down('.su_upload_status_text').hide();$super();}});return new FeedUpload Manager(options);}}); /* app/views/premium_research/accounts/_promo.js @ 1319142721 */ Scribd.init('Scribd','PremiumResearch','Accounts');Scribd.PremiumResearch.Accoun ts.Promo={init:function(options){this.options=options;this.options.container=$(t his.options.container);this.options.container.down('.no_thanks').observe('click' ,function(e){e.stop();new Ajax.Request(this.options.opt_out_url,{});Scribd.Alert s.success(this.options.container.down('.inner_content'),"Okay, you won't see thi s anymore.");this.options.container.down('.inner_content').removeClassName('inne r_content');}.bind(this));}} /* app/views/upload/_gdocs_upload_widget.js @ 1319142721 */ if(!Scribd)Scribd=new Object();if(!Scribd.Upload)Scribd.Upload=new Object();Scri bd.Upload.GdocsUploadWidget=Class.create(Scribd.Upload.BaseUploadWidget,{initial ize:function($super,options){$super(options);this.upload_template_dom_id=options .upload_template_dom_id;this.googleDocsUrl=options.google_docs_url;this.importBa seUrl=options.import_base_url;this.privacyCheckbox=options.privacy_checkbox;this .googleLoginUrl=options.google_login_url;},onWidgetsLoaded:function($super,event ){$super(event);this.registerLoadingDisplay();this.registerGoogleDocLoader(this. googleDocsUrl);},importGoogleDocument:function(uploadWidgetContainer,title,exten sion,url,privateFlag,message){var isPrivate=privateFlag.checked;Scribd.Alerts.pr ogress(message,"Beginning import...");new Ajax.Request(isPrivate?(url+'&private= true'):url,{onSuccess:function(response){try{message.remove();if(!window.uploadM anagers)window.uploadManagers=[];var addHtml=function(dom_element){uploadWidgetC ontainer.insert({top:dom_element});};var uploadManager=new Scribd.scalable_uploa d_manager({filename_base:title,filename_extension:extension,isPrivate:isPrivate, file_template_element_id:this.upload_template_dom_id,addHTML:addHtml,cancelListe ner:function(){}});window.uploadManagers.push(uploadManager);uploadManager.onFil eAlreadyUploaded({file_upload_id:'upload_'+window.uploadManagers.length},{id:res ponse.responseJSON.document.id,access_key:response.responseJSON.document.access_ key,secret_password:response.responseJSON.document.secret_password});}catch(e){a lert("AJAX error: "+e.description);}}.bind(this),onFailure:function(response){tr y{if(response.responseJSON.retry){Scribd.Alerts.error(message,"Error: "+response .responseJSON.error+" I will retry again in a moment...");this.importGoogleDocum ent.bind(this).delay(5,uploadWidgetContainer,title,extension,url,privateFlag,mes sage);} else{Scribd.Alerts.error(message,"Error: "+response.responseJSON.error);}}catch( e){alert("AJAX error: "+e.description);}}.bind(this)});},registerGoogleDocLoader :function(url){var otherDocs=$('other_docs');new Ajax.Request(url,{method:'GET', onSuccess:function(response){try{$('gdocs_account_info').update(response.respons eJSON.account.email+' ');$('gdocs_account_info').insert(new Element('a',{href:th is.googleLoginUrl}).update("not you?"));var table=new Element('table',{cellspaci

ng:0,cellpadding:0});$H(response.responseJSON.other_documents).each(function(pai r){var document=pair[1];document.googleId=pair[0];var topRow=new Element('tr').a ddClassName("file_row");var leftTd=new Element('td').addClassName("import_file_n ame");var rightTd=new Element('td').addClassName("import_button");var bottomRow= new Element('tr',{colspan:2});bottomRow.hide();var bottomTd=new Element('td');le ftTd.insert(new Element('a',{href:document.url}).update(document.title));var upl oadStatus=new Element('div');var uploadMessage=new Element('p');var privateFlag= $(this.privacyCheckbox).down('.private_flag input');var importImage=new Element( 'img',{src:'/images/upload/import-up.gif'}).addClassName('import-button');import Image.observe('mousedown',function(e){importImage.src='/images/upload/import-dow n.gif'});importImage.observe('mouseup',function(e){importImage.src='/images/uplo ad/import-up.gif'});var importLink=new Element('a',{href:"#"});importLink.insert (importImage);var uploadUrl=this.importBaseUrl+$H({google_id:document.googleId,t itle:document.title,url:document.download_url}).toQueryString();importLink.obser ve('click',function(e){bottomRow.show();this.importGoogleDocument(uploadStatus,d ocument.title,this.extensionForGoogleId(document.googleId),uploadUrl,privateFlag ,uploadMessage);e.stop();}.bind(this));rightTd.insert(importLink);bottomTd.inser t(uploadStatus);bottomTd.insert(uploadMessage);topRow.insert(leftTd);topRow.inse rt(rightTd);bottomRow.insert(bottomTd);table.insert(topRow);table.insert(bottomR ow)}.bind(this));otherDocs.update();otherDocs.removeClassName('loading');otherDo cs.insert(table);}catch(e){alert("AJAX error: "+e.description);}}.bind(this),onF ailure:function(response){try{if(response.responseJSON.retry){Scribd.Alerts.erro r($('other_docs_loading'),"Error: "+response.responseJSON.error+" I will try aga in in a moment...");this.registerGoogleDocLoader.bind(this).delay(5,url);}else{S cribd.Alerts.error($('other_docs_loading'),"Error: "+response.responseJSON.error );}}catch(e){alert("AJAX error: "+e.description);}}.bind(this)});},registerLoadi ngDisplay:function(){Scribd.Alerts.progress($('other_docs_loading'),"Asking Goog le for a list of your Google Docs...");},extensionForGoogleId:function(googleId) {var schema=googleId.split(':')[0];if(schema=='document')return'doc';if(schema== 'presentation')return'ppt';if(schema=='pdf')return'pdf';if(schema=='spreadsheet' )return'xls';else return'txt';}}); /* app/views/shared/timed_popup_button_widget.js @ 1319142721 */ if(!Scribd)Scribd=new Object();if(!Scribd.Upload)Scribd.Upload=new Object();Scri bd.Shared.TimedPopupButtonWidget=Class.create(Scribd.Shared.JavascriptWidget,{in itialize:function($super,options){$super(options);this.button_class=options.butt on_class;this.fade_in_duration=options.fade_in_duration;this.fade_out_delay=opti ons.fade_out_delay;this.fade_out_duration=options.fade_out_duration;this.popup_c lass=options.popup_class;this.popup_offset_x=options.popup_offset_x;this.popup_o ffset_y=options.popup_offset_y;this.widget_dom_id=options.widget_dom_id;},onWidg etsLoaded:function(event){var widget=this;widget.buttons().each(function(button) {button.observe('mouseover',widget.showPopup.bind(widget));button.observe('mouse out',widget.hidePopup.bind(widget));});},showPopup:function(event){var widget=th is;widget.popups().each(function(popup){if(!popup.visible()){var x=event.pointer X()+widget.popup_offset_x;var y=event.pointerY()+widget.popup_offset_y;popup.set Style('left: '+x+'px; top: '+y+'px');popup.appear({duration:widget.fade_in_durat ion});} widget.cancelPopupTimer();});},hidePopup:function(event){var widget=this;widget. popups().each(function(popup){widget.cancelPopupTimer();var fade_out=function(){ popup.fade({duration:widget.fade_out_duration,from:1,to:0})};widget.timer=fade_o ut.delay(widget.fade_out_delay);});},cancelPopupTimer:function(){if(this.timer){ window.clearTimeout(this.timer);this.timer=null;}},popups:function(){return this .select(this.popup_class);},buttons:function(){return this.select(this.button_cl ass);},select:function(css_class){var widget_dom=$(this.widget_dom_id);return wi dget_dom.select('.'+css_class);}}); /* app/views/shared/utilities/color_picker.js @ 1319142721 */

Scribd.init('Scribd','Utilities','ColorPicker');Scribd.Utilities.ColorPicker.ins tantiateColorSwatch=function(swatch,field,customOnChangedCallback){if(!Scribd.Ut ilities.ColorPicker.instance !Scribd.Utilities.ColorPicker.instance.opened){var options={mode:'popup',imgPath:Scribd.cdn_path+'images/procolor/procolor_win_',i nput:$(field),onOpened:function(_this,b){_this.opened=true;},onClosed:function(_ this,b){_this.opened=false;},onChanged:function(_this,b){if(customOnChangedCallb ack){customOnChangedCallback();}else{var background_color=$(field).getValue();$( swatch).setStyle({backgroundColor:background_color});}}};Scribd.Utilities.ColorP icker.instance=new ProColor(options);}else{Scribd.Utilities.ColorPicker.instance .close();}}; /* app/views/premium/purchases/gate_components/payment_options_d.js @ 1319142721 */ Scribd.init('Scribd','Premium','Purchases','GateComponents');Scribd.Premium.Purc hases.GateComponents.PaymentOptionsD=Class.create(Scribd.Shared.JavascriptWidget ,{initialize:function($super,options){$super(options);this.parent_dom_id=options .parent_dom_id;this.chargify_disabled=options.chargify_disabled;this.credit_card _disabled=options.credit_card_disabled;this.paypal_disabled=options.paypal_disab led;},onDomLoaded:function($super,event){$super(event);var payment_options=this; var widget_dom=this.widget_dom;if(!this.credit_card_disabled)widget_dom.down('#b utton_credit_card').observe('click',function(e){e.stop();if(!this.hasClassName(' disabled'))payment_options.submitButtonPressed('credit_card');});if(!this.paypal _disabled)widget_dom.down('#button_paypal').observe('click',function(e){e.stop() ;if(!this.hasClassName('disabled'))payment_options.submitButtonPressed('paypal') ;});},parentJavascriptWidget:function(){return $(this.parent_dom_id).javascript_ widget;},planSelectedHandler:function(plan){var widget_dom=this.widget_dom;if(th is.chargify_disabled&&!this.credit_card_disabled){if(plan.recurring){widget_dom. down('#button_credit_card').addClassName('disabled');}else{widget_dom.down('#but ton_credit_card').removeClassName('disabled');}}},submitButtonPressed:function(m ethod){this.submitUIHandler(method);this.parentJavascriptWidget().submitHandler( method,this.reverseSubmitUIHandler.bind(this,method));},submitUIHandler:function (method){var buttons=$$('.payment_button a');var spinner=$('button_'+method).dow n('.loading');buttons.invoke('addClassName','disabled');spinner.show();},reverse SubmitUIHandler:function(method){var buttons=$$('.payment_button a');var spinner =$('button_'+method).down('.loading');spinner.hide();buttons.invoke('removeClass Name','disabled');this.parentJavascriptWidget().planSelected();}}); /* app/views/accounts/accounts_base.js @ 1319142721 */ if(!window.Scribd)var Scribd=new Object();if(!window.Scribd.Accounts)Scribd.Acco unts=new Object();if(!window.Scribd.Accounts.Tabs)Scribd.Accounts.Tabs=new Objec t();Scribd.Accounts.Tabs.Base=Class.create({alert_handler:function(container,req ){$(container).show();['notice','error','red_notice','blue_notice'].each(functio n(flash_type){var flash_message=req.responseJSON.flash[flash_type];if(flash_mess age){switch(flash_type){case'notice':Scribd.Alerts.success(container,flash_messa ge);break;case'error':Scribd.Alerts.error(container,flash_message);break;case're d_notice':Scribd.Alerts.success_red(container,flash_message);break;case'blue_not ice':Scribd.Alerts.success_blue(container,flash_message);break;}}});},add_form_a jax:function(form_id){var klass=this;var form=$(form_id);var cancel_changes=$(fo rm_id+'_cancel_changes');var saving=$(form_id+'_saving_changes');var default_err or_alert='Sorry, but Scribd was unable to save that change. Try refreshing the page.' Event.observe(form,'submit',Scribd.Remote.Form.bindAsEventListener(form,{onLoadi ng:function(req){cancel_changes.hide();saving.show();},onComplete:function(req){ saving.hide();form.select('input, textarea, select, .text_field').invoke('enable ');},onFailure:function(req){saving.hide();Scribd.Alerts.error(form_id+'_alerts'

,default_error_alert);},onSuccess:function(req){cancel_changes.show();klass.aler t_handler(form_id+'_alerts',req);}}));}});Scribd.chooseColorSwatch=function(swat ch,field){if(!Scribd.colorpicker !Scribd.colorpicker.opened){var options={mode: 'popup',imgPath:Scribd.cdn_path+'images/procolor/procolor_win_',input:$(field),o nOpened:function(_this,b){_this.opened=true;},onClosed:function(_this,b){_this.o pened=false;},onChanged:function(_this,b){Scribd.setProfilePreview();}};Scribd.c olorpicker=new ProColor(options);}else{Scribd.colorpicker.close();}};Scribd.setP rofilePreview=function(){var preview=$('profile_header');var bg_color=$F('bg_col or_field');var txt_color=$F('txt_color_field');var color=Scribd.calculateSeconda ryColor(txt_color);$('bg_color_swatch').setStyle({backgroundColor:bg_color});$(' txt_color_swatch').setStyle({backgroundColor:txt_color});preview.down('.profile_ image').setStyle({borderColor:txt_color});$('secondary_txt_color').value=color;p review.setStyle({backgroundColor:bg_color});var links=preview.select('.links a') ;links.invoke('setStyle',{color:txt_color});links.find(function(a){return a.matc h('#profile_header .current a')}).setStyle({'color':color});};Scribd.calculateSe condaryColor=function(color){var hsb=Scribd.colorpicker.RGBtoHSB(Scribd.colorpic ker.decodeHexColor(color));var new_color={hue:hsb.hue,sat:hsb.sat,brt:(hsb.brt>2 0)?hsb.brt-20:0};var rgb=Scribd.colorpicker.HSBtoRGB(new_color);var hex_color='# '+(rgb.r.toColorPart()+rgb.g.toColorPart()+rgb.b.toColorPart()).toUpperCase();re turn hex_color;} /* app/views/accounts/_tab_general.js @ 1319142721 */ Scribd.Accounts.Tabs.General=Class.create(Scribd.Accounts.Tabs.Base,{initialize: function(options){var self=this;var social_services=options.social_services;var ajax_forms=options.ajax_forms;document.observe("dom:loaded",function(){social_se rvices.each(function(service){self.unlink_social_account(service);});ajax_forms. each(function(form){self.add_form_ajax(form);});self.toggle_password();});},togg le_password:function(){$('change_password_link').observe('click',function(event) {$('change_password').hide();$('password_form').show();});$('password_form_cance l_changes').observe('click',function(event){$('password_form').hide();$('change_ password').show();$$('#password_form .text_field').invoke('clear');});},unlink_s ocial_account:function(service){var service_unlink=$(service+'_unlink');var klas s=this;Event.observe(service_unlink,'click',Scribd.Remote.Link.bindAsEventListen er(service_unlink,{url:service_unlink.href,method:'delete',onLoading:function(re q){$(service+'_service_actions').hide();$(service+'_action_unlinking').show();}, onComplete:function(req){$(service+'_action_unlinking').hide();$(service+'_linke d').hide();$(service+'_unlinked').show();klass.alert_handler(service+'_unlink_al erts',req);}}));}}); /* app/views/shared/sharing/dialog.js @ 1319142721 */ if(!window.Scribd)var Scribd=new Object();if(!Scribd.Readcast)Scribd.Readcast={} ;Scribd.Readcast.Dialog={Animations:{standard:{show_popup:function(){if(this.sho wing)return;this.showing=true;this.element.show();Scribd.Readcast.trackEvent("di alog","show");new Effect.Morph(this.element,{style:'margin-left: 5px',duration:0 .4,queue:{position:'front',scope:'readcastControls'},afterFinish:Scribd.Readcast .Control.showControls});},hide_popup:function(e){e.stop();Scribd.Readcast.trackE vent("dialog","close");this.element.blindUp({duration:0.2});}},blank:{show_popup :function(){if(this.showing)return;this.showing=true;this.element.show();Scribd. Readcast.trackEvent("blankdialog","show");new Effect.Morph(this.element,{style:' margin-left: 5px',duration:0.4,queue:{position:'front',scope:'readcastControls'} });},hide_popup:function(e){e.stop();Scribd.Readcast.trackEvent("blankdialog","c lose");this.element.blindUp({duration:0.2});}},fourgen:{shown:false,show_popup:f unction(e){if(!Scribd.Readcast.Dialog.Animations.fourgen.shown){Scribd.Readcast. Dialog.Animations.fourgen.shown=true;Scribd.Toolbar.actions.readcast(e);}},hide_ popup:function(e){Scribd.Toolbar.actions.readcast(e);}}},initialize:function(){v ar that=this;if(Scribd.Readcast.Dialog.animation==='fourgen'){this.show_popup=Sc

ribd.Readcast.Dialog.Animations.fourgen.show_popup;this.hide_popup=Scribd.Readca st.Dialog.Animations.fourgen.hide_popup;}else{this.show_popup=Scribd.Readcast.Di alog.Animations.standard.show_popup;this.hide_popup=Scribd.Readcast.Dialog.Anima tions.standard.hide_popup;} document.observe(Scribd.Readcast.Event.AutoShare.EVENTS.ready,function(e){if(Scr ibd.Readcast.readingDisabled()){return;} if(Scribd.Toolbar&&Scribd.Toolbar.openPopups&&Scribd.Toolbar.openPopups.size!=0) {return;} if(!Scribd.Readcast.no_initial_popup()){that.show_popup.bind(that)(e);}});this.l oadTwitterName();this.element=$('readcast_popup_outer');this.element.down('.clos e_button').observe('click',this.hide_popup.bind(this));var alt=this.element.down ('.alternate_link');if(alt){alt.observe('click',this.hide_popup.bind(this));}},l oadTwitterName:function(){var placeholders=$$('.twitter_placeholder');if(placeho lders.length<1)return;new Ajax.Request("/twitter_link/info.json",{method:'get',e valJSON:'force',onSuccess:function(trans){try{var name=trans.responseJSON.info.s creen_name;if(name===undefined)return;placeholders.each(function(element){elemen t.update("@"+name);});}catch(e){}}});}};Scribd.Readcast.active=function(){if($$( '.readcast_popup').size()>0)return true;return false;};Scribd.Readcast.blank_act ive=function(){if($$('.blank_readcast_popup').size()>0)return true;return false; };Scribd.Readcast.trackEvent=function(action,label){window.trackEvent("Readcast" ,action,label);};Scribd.Readcast.readingDisabled=function(){if($$('.readcast_pop up.disabled_reading').size()>0)return true;return false;};Scribd.Readcast.no_ini tial_popup=function(){if($$('.readcast_popup.no_initial_popup').size()>0)return true;return false;};(function(){function initDialog(){if(!Scribd.Readcast.active ())return;Scribd.Readcast.Dialog.initialize();} document.observe('dom:loaded',initDialog);document.observe(Scribd.Facebook.EVENT S.transition,initDialog);})(); /* app/views/shared/sharing/preferences.js @ 1319142721 */ if(!window.Scribd)var Scribd=new Object();if(!Scribd.Readcast)Scribd.Readcast={} ;Scribd.Readcast.Status={initialize:function(){this.element=$('readcast_status') ;},set:function(type,msg){this.element.writeAttribute('class',type);this.element .update('<p>'+msg+'</p>');this.element.show();setTimeout(this.hide.bind(this),40 00);},hide:function(){this.element.fade(2000);},success:function(msg){this.set(' success',msg);},warn:function(msg){this.set('warn',msg);},error:function(msg){th is.set('error',msg);}};Scribd.Readcast.Preferences={initialize:function(){var th at=this;$$('.advanced_preferences').each(function(a){a.observe('click',that.open Advanced);});that.checkUnlinked();},checkUnlinked:function(){$$('.pref_container ').each(function(el){var not_linked=el.down('.not_linked');if(not_linked&&not_li nked.style.display!=='none'){el.select('input[type=radio]').each(Form.Element.di sable)}else{el.select('input[type=radio]').each(Form.Element.enable)}});},openAd vanced:function(e){e.stop();Scribd.Readcast.trackEvent("preferences","open advan ced");window.open("/account/edit#sharing");}};Scribd.Readcast.Permissions={Faceb ook:{ensurePublish:function(callback){var that=this;FB.api({method:'users.hasApp Permission',ext_perm:'publish_stream'},function(response){if(!(response==1)){tha t.askForPublish(callback);}else{callback.call(this);}});},askForPublish:function (callback){var permissions="email,publish_stream,read_stream,offline_access";Scr ibd.Readcast.trackEvent("permissions","facebook stream publish prompt");FB.login (function(response){var authResponse=response.authResponse;if(authResponse&&Scri bd.Facebook.Permissions.hasAllPermissions(response.perms,permissions)){callback. call(this);}else{Scribd.Readcast.Status.error('Readcast not sent');}},{scope:per missions});}}};Scribd.Readcast.Form={initialize:function(){this.form=$('sharing_ prefs');$('save_changes_button').observe('click',this.submit);this.form.reset(); this.cancelChanges=$('cancel_changes');$H(Scribd.Readcast.sharingPrefs).each(fun ction(pair){$('options_event_settings_reading_'+pair.key+'_'+pair.value).checked =true;});$('header_button_on').observe('click',Scribd.Readcast.Form.toggleContro ls('on'));$('header_button_ask').observe('click',Scribd.Readcast.Form.toggleCont rols('ask'));},turnOn:function(networks){$H(networks).each(function(pair){$('opt

ions_event_settings_reading_'+pair.key+'_on').checked=pair.value;$('options_even t_settings_reading_'+pair.key+'_ask').checked=!pair.value;});},toggleControls:fu nction(state){return function(e){e.preventDefault();Scribd.Readcast.trackEvent(" preferences","header click "+state);$$('div.sharing_option input.'+state).each(f unction(el){el.checked=true;});};},optionName:function(network){return"options[e vent_settings][reading]["+network+"]";},updatePrefs:function(){var that=this;Scr ibd.Readcast.sharingPrefs=$H(Scribd.Readcast.sharingPrefs).keys().inject({},func tion(m,network){m[network]=$$('input:checked[type="radio"][name="'+that.optionNa me(network)+'"]').pluck('value');return m;});},submit:function(e){e.stop();Scrib d.Readcast.trackEvent("preferences","save");Scribd.Readcast.Form.doSubmit(true); },doSubmit:function(slideUp,status){new Ajax.Request(Scribd.Readcast.Form.form.a ction,{method:'put',parameters:Form.serialize(Scribd.Readcast.Form.form),onSucce ss:function(response){Scribd.Readcast.Form.updatePrefs();if(status){Scribd.Readc ast.Status.success(status);}else{Scribd.Readcast.Form.cancelChanges.update('Pref erences saved');Scribd.Readcast.Status.success('Preferences saved');} if(slideUp){new Effect.toggle('readcast_preferences','slide',{delay:0.5,duration :0.3,afterFinish:function(effect){Scribd.Readcast.Form.cancelChanges.update('Can cel');}});}},onFailure:function(response){Scribd.Readcast.Status.error('Unable t o save');Scribd.Readcast.Form.cancelChanges.update('Unable to save');}});}};(fun ction(){function initPreferences(){if(!Scribd.Readcast.active())return;Scribd.Re adcast.Preferences.initialize();} document.observe('dom:loaded',initPreferences);document.observe(Scribd.Facebook. EVENTS.transition,initPreferences);})(); /* app/views/word/embed.js @ 1319142724 */ if(!window.Scribd)var Scribd=new Object();Scribd.embedCodePreviewManager=Class.c reate({initialize:function(options){this.options=Object.extend({num_pages:null,d oc_url:'',title:'',doc_id:0,access_key:'',secret_password:null,prevew_fnction:fu nction(){},aspect_ratio:null,disable_flash:false},options {});this.form=$('embe d-customize') this.preview_url="/word/embed/"+this.options.doc_id;this.auto_value='(auto)';thi s.title_toggle=this.form.down('#include_title') this.width_input=this.form.down('#embed_width');this.auto_width_input=this.form. down('#auto_width');this.height_input=this.form.down('#embed_height');this.heigh t_container=this.form.down('.height_container');this.page_input=this.form.down(' #start_page');this.mode_input=this.form.down('.view_mode');this.flash_code_input =$('flash_embed_code');this.html5_code_input=$('html5_embed_code');this.preview_ flash=$('preview_flash_embed');this.preview_html5=$('preview_html5_embed');this. embed_preview=$('embed-preview');this.generator=new Scribd.embedCodeGenerator({d oc_url:this.options.doc_url,title:this.options.title,doc_id:this.options.doc_id, access_key:this.options.access_key});this.html_generator=new Scribd.HTML5EmbedCo deGenerator({doc_url:this.options.doc_url,title:this.options.title,doc_id:this.o ptions.doc_id,access_key:this.options.access_key,secret_password:this.options.se cret_password,aspect_ratio:this.options.aspect_ratio});this.updatePrevious();thi s.width_input.disable();this.updateEmbedCode(true);new PeriodicalExecuter(this.u pdateEmbedCode.bind(this),1);this.setEvents();if(this.preview_html5){this.embed_ preview.update(this.html5_code_input.value);}else if(this.options.disable_flash= ==false){this.embed_preview.update(this.flash_code_input.value);}},setEvents:fun ction(){if(this.options.disable_flash===false){this.preview_flash.observe('click ',function(e){if(this.options.disable_flash===false){this.embed_preview.update(t his.flash_code_input.value);}}.bindAsEventListener(this));} if(this.preview_html5){this.preview_html5.observe('click',function(e){this.embed _preview.update(this.html5_code_input.value);}.bindAsEventListener(this));} this.width_input.up().observe('click',function(e){var el=e.element();if(el==this .width_input&&this.auto_width_input.checked){this.uncheck_auto_width();}}.bindAs EventListener(this));this.height_input.observe('click',function(e){var el=e.elem ent();if($F(el)==this.auto_value){this.height_input.select();}}.bindAsEventListe ner(this));this.auto_width_input.observe('click',function(e){if(e.element().chec

ked){this.width_input.disable();this.width_input.value=this.auto_value;}else{thi s.uncheck_auto_width();}}.bindAsEventListener(this));this.page_input.observe('bl ur',function(e){var val=parseInt($F(this.page_input));if(val<1 isNaN(val)){this .page_input.value='1';}else if(this.options.num_pages!=null&&val>parseInt(this.o ptions.num_pages)){this.page_input.value=this.options.num_pages;}}.bindAsEventLi stener(this));this.width_input.observe('blur',function(e){var el=e.element();var val=$F(el);if(val==this.auto_value val=="100%")return;if(val==""){el.value=thi s.generator.defaultWidth;}else if(parseInt($F(el))>this.generator.maxWidth){el.v alue=this.generator.maxWidth;}else if(parseInt($F(el))<this.generator.minWidth){ el.value=this.generator.minWidth;}}.bindAsEventListener(this));this.height_input .observe('blur',function(e){var el=e.element();var val=$F(el);if(val==this.auto_ value)return;if(val==""){el.value=this.generator.defaultHeight;}else if(parseInt ($F(el))>this.generator.maxHeight){el.value=this.generator.maxHeight;}else if(pa rseInt($F(el))<this.generator.minHeight){el.value=this.generator.minHeight;}}.bi ndAsEventListener(this));this.mode_input.observe('change',function(e){var el=e.e lement();var val=$F(el);if(val=='slideshow' val=='book'){this.height_input.valu e=this.auto_value;this.height_input.disable();}else{if(this.height_input.value== this.auto_value){this.height_input.value=this.generator.defaultHeight;this.heigh t_input.enable();}} this.updateEmbedCode();}.bindAsEventListener(this));this.form.select('.embed_for m input').invoke('observe','keypress',this.restrictToNumbers.bindAsEventListener (this));this.form.select('.embed_form input').invoke('observe','change',this.upd ateEmbedCode.bindAsEventListener(this));},uncheck_auto_width:function(){this.wid th_input.enable();this.width_input.value=this.generator.defaultWidth;this.auto_w idth_input.checked=false;},updateEmbedCode:function(force){if(this.valuesChanged () (force===true)){var params={width:this.width_input.value,height:this.height_ input.value,page:this.page_input.value,mode:$F(this.mode_input),show_title:this. title_toggle.checked,auto_width:this.auto_width_input.checked,auto_height:this.h eight_input.value==this.auto_value};if(this.options.disable_flash===false){this. flash_code_input.value=this.generator.render(params);} if(this.html5_code_input){this.html5_code_input.value=this.html_generator.render (params);} this.updatePrevious();}},updatePrevious:function(){this.previous_width=this.widt h_input.value;this.previous_height=this.height_input.value;this.previous_page=th is.page_input.value;this.previous_mode=this.mode_input.value;this.previous_title =this.title_toggle.checked;this.previous_auto_width=this.auto_width_input.checke d;},valuesChanged:function(){return(this.previous_width!=this.width_input.value this.previous_height!=this.height_input.value this.previous_page!=this.page_in put.value this.previous_mode!=this.mode_input.value this.previous_title!=this. title_toggle.checked this.previous_auto_width!=this.auto_width_input.checked);} ,restrictToNumbers:function(e){if(!e)var e=window.event;if(e.keyCode)code=e.keyC ode;else if(e.which)code=e.which;var character=String.fromCharCode(code);if(code ==27){this.blur();return false;} if(!e.ctrlKey&&code!=9&&code!=8&&code!=36&&code!=37&&code!=38&&(code!=39)&&code! =40&&code!=46){if(character.match(/[0-9]/g)){return true;}else{e.stop();}}}}); /* app/views/shared/status_bar.js @ 1319142721 */ Scribd.init('Scribd','StatusBar');Scribd.StatusBar=Class.create({initialize:func tion(){if(typeof window['$status']!=='undefined'){return;} this.errorElement=$('status_bar_error');this.errorMessageElement=this.errorEleme nt.down('.message');this.noticeElement=$('status_bar_notice');this.noticeMessage Element=this.noticeElement.down('.message');this.allElements=[this.errorElement, this.noticeElement];this.timeoutID=null;},error:function(msg){this.errorMessageE lement.update(msg);this.showStatus(this.errorElement);},notice:function(msg){thi s.noticeMessageElement.update(msg);this.showStatus(this.noticeElement);},effectQ ueue:{scope:'statusBar',position:'end'},hideAll:function(el){clearTimeout(this.t imeoutID);this.allElements.invoke('hide');},showStatus:function(el){this.hideAll ();new Effect.SlideDown(el,{queue:this.effectQueue,duration:0.3,transition:Effec

t.Transitions.sinoidal});this.hideStatus(el);},hideStatus:function(el){var that= this;that.timeoutID=setTimeout(function(){new Effect.SlideUp(el,{duration:0.1,qu eue:that.effectQueue,transition:Effect.Transitions.sinoidal});},4000);}}); /* app/views/upload/redesign_phase3.js @ 1319142722 */ if(!Scribd)Scribd=new Object();if(!Scribd.Upload)Scribd.Upload=new Object();Scri bd.Upload.RedesignPhase3=Class.create(Scribd.Shared.JavascriptWidget,{initialize :function($super,options){$super(options);this.email_capture_url=options.email_c apture_url;this.force_email_capture=options.force_email_capture;this.force_login =options.force_login;this.login_fallback_url=options.login_fallback_url;this.log in_source=options.login_source;this.user_logged_in_url=options.user_logged_in_ur l;},onWidgetsLoaded:function($super,event){$super(event);this.selectRadioFromHas h(this.widget_dom);if(this.force_login){this.registerLoginLightbox(this,this.wid get_dom);}else{this.registerUploadTypeSelector(this,this.widget_dom);this.regist erEmailCapture(this,this.widget_dom);}},registerLoginLightbox:function(widget,wi dget_dom){widget_dom.observe('click',this.makeUserLogIn.bind(this));},makeUserLo gIn:function(event){Scribd.login.open({context:'upload',fallback_url:this.login_ fallback_url,next_url_js:this.user_logged_in_url});new Ajax.Request(this.url_aja x,{parameters:{element_id:'login_lb',source_page:this.login_source}});event.stop ();},registerUploadTypeSelector:function(widget,widget_dom){var initialized=fals e;widget_dom.select('.selector').each(function(div){if(div.down('input.radio_sel ector').getValue()){widget.setSelected(div);initialized=true;} div.observe('click',function(event){widget.setSelected(div);});});if(!initialize d){var selector=$$('.selector').first();widget.setSelected(selector);}},setSelec ted:function(div){this.widget_dom.select('.selector').each(function(d){d.removeC lassName('selected');});div.addClassName('selected');var radioBtn=div.down('.rad io_selector');radioBtn.checked=true;window.location.hash=radioBtn.readAttribute( 'label');if(div.hasClassName('selector_upload_type_sell')){this.showCaptcha(div) ;}},showCaptcha:function(selector_div){var captcha_widget_div=selector_div.down( '.autogen_class_views_shared_captcha_widget');if(captcha_widget_div){var captcha _widget=captcha_widget_div.javascript_widget;if(captcha_widget) captcha_widget.renderCaptcha();}},registerEmailCapture:function(widget,widget_do m){if(widget.force_email_capture){document.observe('Scribd:upload_widget:allFile sSuccessful',function(e){(function(){window.location=widget.email_capture_url}). delay(3);});document.observe('Scribd:upload_widget:uploadStart',function(e){widg et_dom.select('.wait_while_uploading').invoke('show');});}},selectRadioFromHash: function(widget_dom){if(!window.location.hash)return;widget_dom.select(".selecto r").each(function(selector){var radioBtn=selector.down(".radio_selector");if(('# '+radioBtn.readAttribute('label'))==window.location.hash)this.setSelected(select or);}.bind(this));}}); /* app/views/timeline_events/shared/_reply.js @ 1319142721 */ Scribd.init('Scribd','Timeline');Scribd.Timeline.Comments={initialize:function() {this.setupDefaultText('.event .comment_input');this.setupEmphasis('.event .comm ents');this.setupForm.bind(this)('.event .submit_reply');},/*<sl:translate>*/ defaultReplyText:"Add a reply...",/*</sl:translate>*/ setupDefaultText:function(selector){var defaultText=function(){$$(selector).each (function(el){Scribd.addDefaultTextEvents(el,this.defaultReplyText);}.bind(this) );}.bind(this);defaultText();document.observe('Scribd:dom_updated',defaultText); },setupEmphasis:function(selector){if($$(selector).length>0){document.observe('m ousemove',function(e){var el=e.findElement(selector);if(!el){return;} el.addClassName('emph');});document.observe('mouseleave',function(e){var el=e.fi ndElement(selector);if(!el){return;} el.removeClassName('emph');});}},setupForm:function(selector){document.observe(' click',function(e){var el=e.findElement(selector);if(!el){return;} e.stop();this.submitComment.bind(this)(el.up('.event'));}.bind(this));},submitCo

mment:function(el){var form=el.down('.add_form form'),ipt=form.down('input.comme nt_input'),user_thumb=form.down('.feed_large_thumbnail'),spinner=form.down('.com ment_spinner'),old_reply_link=el.down('.reply_link_wrapper'),add_container=el.do wn('.add_form'),comment_container=el.down('.comment.expanded'),text=$F(ipt);if(t ext===this.defaultReplyText text===''){return;} new Ajax.Request(form.action,{method:'post',parameters:Scribd.CSRF.paramsWithTok en(Form.serialize(form,true)),onSuccess:function(trans){var insertion=add_contai ner.up('.event').down('.comments .add_form');var status_container=add_container. up('.event').down('.status');var event_container=add_container.up('.timeline_eve nt_content_container');add_container.hide();insertion.insert({before:trans.respo nseText});if(status_container){Scribd.Timeline.Comment.removeCommentActiveClass( status_container);var comment_link_wrapper=status_container.down('.comment_link_ wrapper');if(comment_link_wrapper){comment_link_wrapper.remove();}} if(old_reply_link){old_reply_link.remove()};if(comment_container){comment_contai ner.removeClassName('expanded');comment_container.removeClassName('add_control') ;} if(event_container){if(event_container.hasClassName('without_comments')){event_c ontainer.removeClassName('without_comments');event_container.addClassName('with_ comments');add_container.remove();}}},onCreate:function(){user_thumb.hide();spin ner.show();},onComplete:function(){ipt.value='';ipt.focus();ipt.blur();spinner.h ide();user_thumb.show();}});}};document.observe('dom:loaded',Scribd.Timeline.Com ments.initialize.bind(Scribd.Timeline.Comments));Scribd.Timeline.Reply={initiali ze:function(){this.setupBinding('.reply_link');},setupBinding:function(selector) {document.observe('click',function(e){var el=e.findElement(selector);if(!el){ret urn;} e.stop();if(!Scribd.requireLogin()){return;} var container=el.up('.comment'),controls=container.up('.autogen_class_views_time line_events_shared_reply').next('.add_form');if(container.hasClassName('expanded ')){controls.blindUp({duration:0.1,afterFinish:function(){container.removeClassN ame('expanded');controls.removeClassName('expanded');}});return;} container.addClassName('expanded');controls.addClassName('expanded');controls.bl indDown({duration:0.2});});}};document.observe('dom:loaded',Scribd.Timeline.Repl y.initialize.bind(Scribd.Timeline.Reply)); /* app/views/people/readforacause.js @ 1319142721 */ document.observe('dom:loaded',function(){var r4c_control=$('r4c_control'),r4c_de tails=$('r4c_details');if(r4c_control&&r4c_details){r4c_control.observe('click', function(e){e.stop();r4c_control.hide();r4c_details.show();});}}); /* app/views/shared/document_collections/form.js @ 1319142721 */ if(!window.Scribd)var Scribd=new Object();Scribd.enableDocumentCollectionForm=fu nction(){var M=Scribd.DocumentCollectionsManager;Scribd.ajaxDocumentCollectionFo rm({form:'new_document_collection',reveal:true,params:function(){var params={for mat:'json',document_id:$('lightbox_document_collections').down('.document_collec tions_container').retrieve('document_id')} return params;},success:function(json,params){var doc_id=params.document_id;var new_collection=new Element('div').update(M.collection_template.evaluate(M.render ingCollectionAttributes(doc_id,json.document_collection))).down('li.document_col lection');M.storeCollections(doc_id,[json.document_collection]);M.attachEvent(do c_id,new_collection);$$('.manage_collection .add_to_my_collections').each(functi on(container){container.insert({'top':new_collection});});}});M.addPaginationEve nt();};Scribd.ajaxDocumentCollectionForm=function(options){var form=$(options.fo rm);var spinner=spinner form.down('.spinner');var error_container=$(error_conta iner) form.down('.error');var form_container=options.form_container form.up(); var success_message=options.success_message;var method=options.method 'post';va r clickable_header=$(options.clickable_header) form_container.down('.form_heade

r');var name_input=form.down('#document_collection_name');/*<sl:translate>*/ var new_name_message="Ingrese un nombre para su nueva coleccin...";/*</sl:translat e>*/ function reset(){form.reset();if(form_container&&options.reveal){name_input.setV alue(new_name_message);} form_container&&form_container.removeClassName('document_collection_form_contain er_open');error_container&&error_container.update('');} if($('dynamic_privacy_explanation')){explanationTextContainer=$('dynamic_privacy _explanation');explanationSelector=$('document_collection_combined_privacy_type' );explanationTextContainer.innerHTML=getExplanation(explanationSelector);explana tionSelector.observe('change',function(e){e.stop();explanationTextContainer.inne rHTML=getExplanation(this);});} function getExplanation(explanationSelector){/*<sl:translate>*/ switch(explanationSelector.value){case"pblico - privado":return"(Solo usted puede agregar contenido a esta coleccin, pero otras personas pueden verla)";case"pblico moderado":return"(Otras personas pueden agregar contenido a esta coleccin, pero us ted puede aceptar o rechazar lo que agregan)";case"privado":return"(Solo usted p uede agregar contenido a esta coleccin, y solo usted podr verla)";default:return"";} /*</sl:translate>*/} form.observe('submit',function(e){e.stop();var params=Object.isFunction(options. params)?options.params(form):options.params;if(options.reveal&&name_input.getVal ue()===new_name_message){name_input.setValue('');} form.request({'method':method,parameters:(params),onCreate:function(){form.disab le();spinner&&spinner.show();},onComplete:function(){form.enable();spinner&&spin ner.hide();},onSuccess:function(response){var json=response.responseJSON;switch( json.status){case'ok':success_message&&success_message.show();options.success&&o ptions.success(json,params) options.reset?options.reset(form):reset();return;case'error':options.error&&opti ons.error(json,params);error_container&&Scribd.Alerts.error(error_container,json .message)}}});});var cancel=form.down('a.cancel');if(cancel){cancel.observe('cli ck',function(e){e.stop();options.reset?options.reset(form):reset();})} if(form_container&&options.reveal){name_input.setValue(new_name_message);name_in put.observe('focus',function(e){form_container.addClassName('document_collection _form_container_open');if(name_input.getValue()===new_name_message){name_input.s etValue('');}});name_input.observe('blur',function(e){if(name_input.getValue().s trip()===''){name_input.setValue(new_name_message);}});} if(clickable_header){clickable_header.observe('click',function(){form_container. toggleClassName('document_collection_form_container_open');});}}; /* app/views/shared/analytics/_tracker.js @ 1319142721 */ if(!window.Scribd){var Scribd={};} Scribd.Tracker={run:function(doc_id,viewType){var trackImg=new Image();trackImg. src=this.imgSrc(doc_id,viewType);},imgSrc:function(doc_id,viewType){var date=new Date(),rand=Math.floor(Math.random()*1000000);return"/images/tracker.gif?doc_id ="+doc_id+"&type="+viewType+"&timestamp="+date.getTime()+"&rand="+rand;}}; /* app/views/documents/lightbox/print.js @ 1319142721 */ if(!window.Scribd)var Scribd=new Object();Scribd.printLightboxManager4Gen=Class. create({initialize:function(options){this.options=Object.extend({secret_password :'',extension_sizes:{},logged_in:false,show_gate:false},options {});this.downlo ad_query=$H({secret_password:this.options.secret_password});this.autodown_query= $H({secret_password:this.options.secret_password});this.download_query.set('exte nsion','pdf');this.autodown_query.set('autodown','pdf');if($('high_quality_print ')){$('high_quality_print').down('button').observe('click',function(e){if(this.o ptions.logged_in){trackEvent('Print','Download and Print');window.location=this. downloadUrl();Scribd.Lightbox.close('lightbox_print');}else{trackEvent('Print','

Download and Print','Login');if(this.options.show_gate){Scribd.login.open({conte xt:'download',document_id:this.options.document_id,extension:'pdf',next_url:'/do c/'+this.options.document_id+'#open_download'});}else{Scribd.login.open({context :'download',document_id:this.options.document_id,extension:'pdf',next_url:this.a utodownUrl()});}}}.bind(this));}},downloadUrl:function(){return this.options.bas e_url+'?'+this.download_query.toQueryString();},autodownUrl:function(){return th is.options.autodown_base_url+'?'+this.autodown_query.toQueryString();}}); /* app/views/shared/readcast/lightbox.js @ 1319142721 */ Scribd.init('Scribd','RC');Scribd.init('Scribd','RC','Events');Scribd.RC.Network Control=Class.create({initialize:function(network,el){this.network=network;this. container=el;this.checkBox=this.container.down('input[type=checkbox]');this.done Symbol=this.container.down('.done');this.finished=false;this.setupBindings();thi s.setupObservers();},setupBindings:function(){this.checkBox.observe('click',this .checkBoxClick.bind(this));},isActive:function(){return this.container.hasClassN ame('activated');},reset:function(){this.finished=false;this.deactivatedCallback ();this.doneSymbol.hide();},transitionToDone:function(){if(this.finished){return ;} if(!this.isActive()){return;} this.finished=true;this.doneSymbol.appear(this.effectOptions);},networkEventName :function(type){return Scribd.RC.Events.forType(type,this.network);},activatedEv ent:function(){return this.networkEventName('activated');},deactivatedEvent:func tion(){return this.networkEventName('deactivated');},doneEvent:function(){return this.networkEventName('done');},effectOptions:{},commitCallback:function(e){thi s.transitionToDone();},activatedCallback:function(e){this.checkBox.checked=true; this.container.addClassName('activated');},deactivatedCallback:function(e){this. checkBox.checked=null;this.container.removeClassName('activated');},doneCallback :function(e){},setupObservers:function(){document.observe(Scribd.RC.Events.forTy pe('commit'),this.commitCallback.bind(this));document.observe(Scribd.RC.Events.f orType('done'),this.doneCallback.bind(this));document.observe(this.activatedEven t(),this.activatedCallback.bind(this));document.observe(this.deactivatedEvent(), this.deactivatedCallback.bind(this));document.observe(this.doneEvent(),this.done Callback.bind(this));},checkBoxClick:function(e){this.checkBox.checked=!this.che ckBox.checked;if(this.checkBox.checked){document.fire(this.deactivatedEvent());d ocument.fire(Scribd.RC.Events.forType('deactivated'));}else{document.fire(this.a ctivatedEvent());document.fire(Scribd.RC.Events.forType('activated'));}}});Scrib d.RC.ControlManager=Class.create({initialize:function(widget){this.widget=widget ;this.commitButton=this.widget.container.down('.commit');this.setupNetworks();th is.bindCommit();},setupNetworks:function(){this.networks=this.widget.container.s elect('[data-readcast-network]').inject($H(),function(m,el){var network=el.readA ttribute('data-readcast-network');m.set(network,new Scribd.RC.NetworkControl(net work,el));return m;});},reset:function(){this.networks.each(function(network){ne twork.value.reset();});},hasMessage:function(){return!!this.widget.getMessage(); },bindCommit:function(){this.commitButton.observe('mouseup',this.commitButtonCli ck.bind(this));},commitButtonClick:function(e){if(!e.isLeftClick()){return;} e.stop();var memo={};if(this.hasMessage()){memo.message=this.widget.getMessage() ;} document.fire(Scribd.RC.Events.forType('commit'),memo);}});Scribd.RC.Widget=Clas s.create({initialize:function(el){this.container=el;this.controlManager=new Scri bd.RC.ControlManager(this);this.messageInput=this.container.down('.rc_message'); this.defaultText="add a comment (optional)";this.sampleContainer=el.down('#sampl e_content');document.observe(Scribd.RC.Events.forType('contentChanged'),this.con tentChangedCallback.bind(this));this.setupMessageInput();},contentChangedCallbac k:function(e){$readcast.sampleTemplate.renderTo(this.sampleContainer,$readcast.c ontentData);},reset:function(){this.controlManager.reset();this.setNotReady();}, setReady:function(){if(this.container.hasClassName('ready')){return;} this.container.addClassName('ready');},setSubmitting:function(){this.container.a ddClassName('submitting');},setComplete:function(){this.container.removeClassNam

e('submitting');this.container.addClassName('complete');},setNotReady:function() {this.container.removeClassName('ready');},setupMessageInput:function(){Scribd.a ddDefaultTextEvents(this.messageInput,this.defaultText);},getMessage:function(){ var text=$F(this.messageInput);if(text.strip()===this.defaultText){return;} return text;},activeNetworks:function(){return this.controlManager.networks.inje ct([],function(m,pair){if(pair.value.isActive()){m.push(pair.key);} return m;});}});Scribd.RC.Events.ShareManager=Class.create({initialize:function( networks){this.networks=networks;this.registerNetworks();},registerNetworks:func tion(){this.eventsByNetwork=this.networks.inject($H(),function(m,network){m.set( network,new Scribd.RC.Events.Share(network));return m;});},networkParams:functio n(){var allNetworks=this.networks,activeNetworks=$readcast.activeNetworks();retu rn allNetworks.inject($H(),function(m,network){if(activeNetworks.include(network )){m.set(network,true);}else{m.set(network,false);} return m;});},markNetworksSubmitted:function(){var that=this,allNetworks=this.ne tworks,activeNetworks=$readcast.activeNetworks();return allNetworks.each(functio n(network){if(activeNetworks.include(network)){that.eventsByNetwork.get(network) .submitted=true;}});},eventParams:function(){return this.networkParams().merge({ content_id:$readcast.contentId,message:$readcast.message}).inject({},function(m, pair){m['readcast_event['+pair.key+']']=pair.value;return m;});},quickParams:fun ction(){return{content_id:$readcast.contentId};},readcastURL:"http://www.float.c om/readcast_events.json",quickURL:"http://www.float.com/readcast_events/quick",s ubmit:function(){var that=this;new Ajax.Request(that.readcastURL,{method:'post', parameters:Scribd.CSRF.paramsWithToken(that.eventParams()),onSuccess:function(tr ans){document.fire(Scribd.RC.Events.forType('done'),{response:trans.responseText });$readcast.setComplete();},onException:function(req,ex){Scribd.log(ex);}});ret urn this;},quickSubmit:function(successCallBack){var that=this;new Ajax.Request( that.quickURL,{method:'post',parameters:Scribd.CSRF.paramsWithToken(that.quickPa rams()),onSuccess:function(trans){successCallBack&&successCallBack();document.fi re(Scribd.RC.Events.forType('quickDone'));document.fire(Scribd.RC.Events.forType ('done'),{response:trans.responseText});$readcast.setComplete();},onException:fu nction(req,ex){Scribd.log(ex);}});return this;}});Scribd.RC.Events.Share=Class.c reate({initialize:function(network){this.network=network;this.submitted=false;}} );Object.extend(Scribd.RC.Events,{delay:10,forType:function(type,network){var na me="scribd:readcast:"+type;if(network){name=name+":"+network;} return name;}});Scribd.RC.Base=Class.create({initialize:function(){if(window['$r eadcast']){return;} window['$readcast']=this;this.message=null;this.shareManager=new Scribd.RC.Event s.ShareManager(this.networks);this.widgets=[];this.sampleTemplate=Scribd.Templat es.get('shared/readcast/sample');this.setupObservers();},networks:["scribd","fac ebook","twitter"],addWidget:function(el){var w=new Scribd.RC.Widget(el);this.wid gets.push(w);},reset:function(){this.widgets.each(function(widget){widget.reset( );});},setupObservers:function(){var that=this;document.observe(Scribd.RC.Events .forType('commit'),function(e){if(!that.activeNetworks.call(that).any()){e.stop( );return;} var message=e.memo.message;if(message){that.message=message;} that.setSubmitting();that.shareManager.submit();}.bind(this));document.observe(S cribd.RC.Events.forType('quickCommit'),function(e){that.shareManager.quickSubmit ();});document.observe(Scribd.RC.Events.forType('deactivated'),function(){if(!th at.activeNetworks.call(that).any()){that.setNotReady();}}.bind(this));document.o bserve(Scribd.RC.Events.forType('activated'),function(){that.setReady();}.bind(t his));document.observe('scribd:accountLink:facebook:linked',function(){$$('.face book_pref').each(function(el){el.addClassName('available');el.down('.checkbox'). show();});}.bind(this));document.observe('scribd:accountLink:twitter:linked',fun ction(){$$('.twitter_pref').each(function(el){el.addClassName('available');el.do wn('.checkbox').show();});}.bind(this));document.observe('scribd:accountLink:fac ebook:unlinked',function(){$$('.facebook_pref').each(function(el){el.removeClass Name('available');el.down('.checkbox').hide();});}.bind(this));document.observe( 'scribd:accountLink:twitter:unlinked',function(){$$('.twitter_pref').each(functi on(el){el.removeClassName('available');el.down('.checkbox').hide();});}.bind(thi s));document.observe('scribd:accountLink:facebook:name',function(e){$$('.faceboo

k_pref .network_name').invoke('update','<span>'+e.memo.name+'</span>');}.bind(th is));document.observe('scribd:accountLink:twitter:name',function(e){$$('.twitter _pref .network_name').invoke('update','<span>'+e.memo.name+'</span>');}.bind(thi s));},setReady:function(){this.widgets.each(function(widget){widget.setReady();} );},setNotReady:function(){this.widgets.each(function(widget){widget.setNotReady ();});},setSubmitting:function(){this.widgets.each(function(widget){widget.setSu bmitting();});},setComplete:function(){this.widgets.each(function(widget){widget .setComplete();});},setContentId:function(contentId){if(!contentId){return;} this.contentId=contentId;this.updateContentData();},setContentData:function(data ){this.contentData=data;document.fire(Scribd.RC.Events.forType('contentChanged') );},updateContentData:function(){var that=this;that.setContentData(Float.BB.Mode ls.Content.store.get(that.contentId).toJSON());},isArticle:function(){return!!th is.articleId;},isDocument:function(){return!!this.documentId;},hasMessage:functi on(){return!!this.message;},activeNetworks:function(){return this.widgets.first( ).activeNetworks();}}); /* app/views/word/document/_action_badge.js @ 1319142724 */ if(!window.Scribd)var Scribd={};Scribd.ActionBadgeManager=Class.create({initiali ze:function(container,options){this.options=Object.extend({current_message:'',me ssages:[],message_text_hidden_field:null,preview_text_container:null},options { });this.no_badge_radio=container.down('.should_show_badge_no');this.yes_badge_ra dio=container.down('.should_show_badge_yes');this.action_badge_inputs=container. down('.action_badge_inputs');this.message_radios=this.action_badge_inputs.select ('.button_message');this.message_custom_radio=this.action_badge_inputs.down('.bu tton_message_custom_radio');this.message_custom_input=this.action_badge_inputs.d own('.button_message_custom_input');this.link_url_input=container.down('.link_ur l');if(this.options.current_message.blank()){this.no_badge_radio.checked=true;th is.message_radios.first().checked=true;}else{this.yes_badge_radio.checked=true;i f(this.options.messages.indexOf(this.options.current_message)!=-1){this.message_ radios.each(function(radio){if(radio.value==this.options.current_message) radio.checked=true;}.bind(this));this.message_custom_input.clear();}else{this.me ssage_custom_input.value=this.options.current_message;this.message_custom_radio. checked=true;}} this.updatePreview();this.setupEvents();new PeriodicalExecuter(this.setMetadataH iddenTextField.bind(this),1);new PeriodicalExecuter(this.updatePreview.bind(this ),1);},setupEvents:function(){this.message_custom_radio.observe('click',function (e){this.message_custom_input.focus();}.bind(this));this.message_custom_input.ob serve('focus',function(e){this.message_custom_radio.checked=true;}.bind(this));t his.action_badge_inputs.select('input').invoke('observe','click',function(e){thi s.yes_badge_radio.checked=true;}.bind(this));this.action_badge_inputs.select('in put').invoke('observe','change',function(e){this.updatePreview();this.setMetadat aHiddenTextField();}.bind(this));this.message_custom_input.observe('keypress',fu nction(e){this.updatePreview();this.setMetadataHiddenTextField();}.bind(this));t his.link_url_input.observe('blur',function(e){if(!this.value.startsWith('http:// ')&&!this.value.startsWith('https://')&&!this.value.blank()) this.value='http://'+this.value;});},setMetadataHiddenTextField:function(){if(th is.no_badge_radio.checked){this.options.message_text_hidden_field.value='';}else {this.options.message_text_hidden_field.value=this.getMessageSetting();}},update Preview:function(){this.options.preview_text_container.down('h4').update(this.ge tMessageSetting());},getMessageSetting:function(){var value='';if(this.message_c ustom_radio.checked){value=this.message_custom_input.value;}else{this.message_ra dios.each(function(radio){if(radio.checked) value=radio.value;}.bind(this));} return value;}}); /* app/views/user_document_collections/manage.js @ 1319142722 */

Scribd.init('Scribd','UserDocumentCollections','Manage');Scribd.UserDocumentColl ections.Manage=Class.create({initialize:function(options){this.widget_dom_id=opt ions.widget_dom_id;this.widget_dom=$(this.widget_dom_id);this.collectings_contai ner_id=options.collectings_container_id;this.collectings_container=$(this.collec tings_container_id);this.on_reorder_url=options.on_reorder_url;this.authenticity _token=options.authenticity_token;this.last_modified_collecting=null;this.last_t op_collecting=this.topCollecting();document.observe('dom:loaded',function(){this .initializeSortable();this.initializeCollectingsContainerEvents();this.initializ eCollectionImages();}.bind(this));},initializeSortable:function(){Sortable.creat e(this.collectings_container_id,{elements:this.collectingContainers(),handles:th is.collectingMoveHandles(),only:'document_collecting_container',tag:'div',handle :'move_link',onChange:this.updateLastModifiedCollecting.bind(this),onUpdate:this .onReorder.bind(this,{onLoading:function(){this.updateTopCollecting();this.updat eZebraStripes();this.last_modified_collecting.down('.move_link').hide();this.las t_modified_collecting.down('.spinner').show();}.bind(this),onComplete:function() {this.last_modified_collecting.down('.spinner').hide();this.last_modified_collec ting.down('.move_link').show();}.bind(this)})});},initializeCollectingsContainer Events:function(){this.collectings_container.observe('click',function(e){e.stop( );var clicked=e.element();if(clicked.hasClassName('send_to_top_link')){this.send ToTop(clicked);}}.bindAsEventListener(this));},initializeCollectionImages:functi on(){this.collection_image=this.widget_dom.down('.document_collection_summary .s helf_document .thumbnail img');if(this.collection_image){this.initializeCollecti onImageSpinner();this.collection_image_spinner=this.widget_dom.down('.document_c ollection_summary .shelf_document .thumbnail img.collection_image_spinner');}},i nitializeCollectionImageSpinner:function(){var spinner=new Element('img',{'class ':'collection_image_spinner',src:'/images/spinner_trans_gray.gif',style:'display :none;'});this.collection_image.insert({after:spinner});},highlightLastModifiedC ollecting:function(){this.last_modified_collecting.highlight({startcolor:'#eaffd 5',duration:1.2,afterFinish:function(effect){effect.element.setStyle({background Color:''});}});},updateLastModifiedCollecting:function(collecting_container){thi s.last_modified_collecting=collecting_container;},updateLastTopCollecting:functi on(){this.last_top_collecting=this.topCollecting();},lastModifiedCollectingIsTop :function(){return(this.last_modified_collecting==this.topCollecting());},lastMo difiedCollectingWasTop:function(){return(this.last_modified_collecting==this.las t_top_collecting);},topCollecting:function(){return this.collectings_container.d own('.document_collecting_container');},collectingContainers:function(){return $ $('#'+this.collectings_container_id+' div.document_collecting_container');},coll ectingMoveHandles:function(){return $$('#'+this.collectings_container_id+' div.d ocument_collecting_container div.collecting_move a.move_link');},sendToTop:funct ion(sent_link){var sent=sent_link.up('.document_collecting_container');var link= sent.down('.collecting_send_to_top').down('.send_to_top_link');var spinner=sent. down('.collecting_send_to_top').down('.spinner');link.hide();spinner.show();this .updateLastModifiedCollecting(sent);this.onReorder({collectings_order:this.postS entToTopSortableSerialize(sent),onLoading:function(){this.updatingCollectionImag e();}.bind(this),onComplete:function(){sent.remove();var collectings=this.collec tings_container;collectings.insert({top:sent});spinner.hide();link.show();this.u pdateTopCollecting();this.updateZebraStripes();}.bind(this)});},postSentToTopSor tableSerialize:function(sent){var current_ordering=Sortable.serialize(this.colle ctings_container_id);var sent_collecting_id=sent.id.gsub(/\D/,'');var sent_regex p=new RegExp(this.collectings_container_id+"\\[\\]="+sent_collecting_id+'&?');va r ordering_minus_sent=current_ordering.sub(sent_regexp,'');var post_sent_orderin g=this.collectings_container_id+'[]='+sent_collecting_id+'&'+ordering_minus_sent ;return post_sent_ordering;},onReorder:function(options){var collectings_order=o ptions.collectings_order Sortable.serialize(this.collectings_container_id);var onLoadingCallback=function(){this.disableUI();if(this.lastModifiedCollectingIsTo p() this.lastModifiedCollectingWasTop())this.updatingCollectionImage();if(optio ns.onLoading)options.onLoading();} var onCompleteCallback=function(response){if(options.onComplete)options.onComple te();if(response.responseJSON&&response.responseJSON.collection_image_url){this. updateCollectionImage(response.responseJSON.collection_image_url);}

this.updateLastTopCollecting();this.highlightLastModifiedCollecting();this.enabl eUI();} this.updateServerOrder(collectings_order,onLoadingCallback,onCompleteCallback);} ,updateServerOrder:function(collectings_order,onLoadingCallback,onCompleteCallba ck){new Ajax.Request(this.on_reorder_url,{asynchronous:true,evalScripts:true,met hod:'put',parameters:collectings_order+'&authenticity_token='+encodeURIComponent (this.authenticity_token),onLoading:onLoadingCallback.bind(this),onComplete:onCo mpleteCallback.bind(this)});},updateTopCollecting:function(){var old_top=this.co llectings_container.down('.top_document_collecting_container');var new_top=this. collectings_container.down('.document_collecting_container');old_top.removeClass Name('top_document_collecting_container');new_top.addClassName('top_document_col lecting_container');},updatingCollectionImage:function(){if(this.collection_imag e){this.collection_image.hide();this.collection_image_spinner.show();}},updateCo llectionImage:function(new_url){if(this.collection_image){this.collection_image. src=new_url this.collection_image_spinner.hide();this.collection_image.show();}},updateZebra Stripes:function(){var containers=this.collectingContainers();var partitioned=co ntainers.partition(function(container,index){return index%2==1});var light=parti tioned[0];var dark=partitioned[1];light.invoke('addClassName','light_stripe');li ght.invoke('removeClassName','dark_stripe');dark.invoke('addClassName','dark_str ipe');dark.invoke('removeClassName','light_stripe');},disableUI:function(){var c over=new Element('div',{'class':'disabled_cover'});cover.clonePosition(this.coll ectings_container,{setLeft:false,setTop:false});this.collectings_container.inser t(cover);},enableUI:function(){this.collectings_container.down('.disabled_cover' ).remove();}}); /* app/views/facebook/_login_button.rb:14 @ 1319142721 */ if(!window.Scribd)var Scribd=new Object();if(!window.Scribd.Facebook)Scribd.Face book=new Object();Scribd.Facebook.LoginButton=Class.create(Scribd.Shared.Javascr iptWidget,{initialize:function($super,options){$super(options);},onWidgetsLoaded :function($super,event){$super(event);var buttonClickedFunction=this.buttonClick ed.bind(this);this.widget_dom.select('.fb_button').each(function(button){button. observe('click',buttonClickedFunction);});this.posted_form=this.widget_dom.down( '.posted_form');},buttonClicked:function(event){Event.stop(event);this.in_proces s=true;this.showSpinnerIfStillProcessing.bind(this).delay(0);FB.login(this.fbLog inReturned.bind(this),{scope:"email,publish_stream,read_stream,offline_access"}) ;},fbLoginReturned:function(response){var authResponse=response.authResponse;if( authResponse){var session_elements_div=this.posted_form.down(".facebook_session_ elements");if(session_elements_div){var cookies=document.cookie;var regexp=new R egExp("(fbs_[a-f0-9]*)\s*=\s*([^;]+)");var match=regexp.exec(cookies);if(match){ var fbs_cookie_name=match[1];var fbs_cookie=match[2];match=new RegExp("^\"(.*)\" $").exec(fbs_cookie);if(match){fbs_cookie=match[1];} session_elements_div.insert("<input type='hidden' name='fbs_cookie' value='"+fbs _cookie+"' />");session_elements_div.insert("<input type='hidden' name='fbs_cook ie_name' value='"+fbs_cookie_name+"' />");}else{session_elements_div.insert("<in put type='hidden' name='fbs_cookie' value='none' />");} for(var name in authResponse){var value=authResponse[name];session_elements_div. insert("<input type='hidden' name='facebook_session["+name+"]' value='"+value+"' />");}} this.userIsLoggedInToFacebook(response);}else{this.userCancelledFacebookLogin(re sponse);}},userIsLoggedInToFacebook:function(response){if(this.options.trackEven t){eval(this.options.trackEvent);}else if(this.options.google_analytics_event){t rackEvent("Facebook",this.options.google_analytics_event);} this.loggedInCallback();},userCancelledFacebookLogin:function(response){this.in_ process=false;this.invokeOnInProcess(function(e){e.hide();});},showSpinnerIfStil lProcessing:function(){if(this.in_process){this.invokeOnInProcess(function(e){e. show();});}},invokeOnInProcess:function(f){this.widget_dom.select(".in_process") .each(f);},loggedInCallback:function(){this.posted_form.submit();}});

/* app/views/themes/edit.js @ 1319142721 */ Scribd.init('Scribd','Themes','Edit');Scribd.Themes.Edit=Class.create({initializ e:function(options){this.widget_dom_id=options.widget_dom_id;this.images_updated =options.images_updated;this.images_loaded={};this.theme_image_status_url=option s.theme_image_status_url;this.background_image_preview_container=options.backgro und_image_preview_container;this.background_image_url=options.background_image_u rl;this.banner_preview_container=options.banner_preview_container;this.banner_ur l=options.banner_url;document.observe('dom:loaded',function(){this.loadReadyImag es();if(this.images_updated)this.onImagesUpdated(0);}.bind(this));},loadReadyIma ges:function(){if(!this.images_updated !this.images_updated.include('background '))this.loadBackgroundImage(this.background_image_url);if(!this.images_updated !this.images_updated.include('banner'))this.loadBannerImage(this.banner_url);},o nImagesUpdated:function(attempt){new Ajax.Request(this.theme_image_status_url,{m ethod:'get',onSuccess:function(response){var image_status=response.responseJSON; this.loadImagesOnImageStatus(image_status);if(!image_status.all_ready&&attempt<1 0)this.onImagesUpdated.bind(this,attempt+1).delay(attempt);}.bind(this)});},load ImagesOnImageStatus:function(image_status){if(image_status.background&&image_sta tus.background.ready)this.loadBackgroundImage(image_status.background.edit_previ ew.url);if(image_status.banner&&image_status.banner.ready)this.loadBannerImage(i mage_status.banner.edit_preview.url);},loadBackgroundImage:function(background_i mage_url){if(background_image_url&&!this.images_loaded.background){this.backgrou nd_image_preview_container.down('.preview_loaded .theme_body_container').setStyl e({backgroundImage:"url('"+background_image_url+"')"});this.images_loaded.backgr ound=true;var loading_container=this.background_image_preview_container.down('.p review_loading');var loaded_container=this.background_image_preview_container.do wn('.preview_loaded');if(loading_container.visible()){loading_container.fade();l oaded_container.appear();}}},loadBannerImage:function(banner_url){if(banner_url& &!this.images_loaded.banner){var banner_image=new Element('img',{'class':'banner _image',src:banner_url});this.banner_preview_container.down('.theme_banner').upd ate(banner_image);this.images_loaded.banner=true;var loading_container=this.bann er_preview_container.down('.preview_loading');var loaded_container=this.banner_p review_container.down('.preview_loaded');if(loading_container.visible()){loading _container.fade();loaded_container.appear();}}}}); /* app/views/user_document_collections/widget.js @ 1319142722 */ Scribd.chooseCollectionWidgetColor=function(swatch,field){if(!Scribd.colorpicker !Scribd.colorpicker.opened){var options={mode:'popup',imgPath:Scribd.cdn_path+ 'images/procolor/procolor_win_',input:$(field),onOpened:function(_this,b){_this. opened=true;},onClosed:function(_this,b){_this.opened=false;},onChanged:function (_this,b){$(swatch).setStyle({backgroundColor:_this.color});}};Scribd.colorpicke r=new ProColor(options);}else{Scribd.colorpicker.close();Scribd.colorpicker=null ;}}; /* app/views/embeds/content.js @ 1319142721 */ Scribd.init('Scribd','Embeds','Content');Scribd.Embeds.Content=Class.create({ifr ame:null,docManager:null,defaultWidth:null,view_modes:['scroll','slideshow'],col lapsed:false,initialize:function(options){window.onIframeLoad=this.onIframeLoad. bind(this);this.options=options;document.observe('dom:loaded',function(e){if(thi s.options.branded_logo) $('document_content').setStyle({top:'35px'});this.sizeToolbar();}.bind(this));Ev ent.observe(document.onresize?document:window,"resize",function(e){this.sizeTool bar();this.sizeDocument();}.bind(this));},onIframeLoad:function(){var self=this; this.iframe=window.frames['document_iframe'];window.docManager=this.iframe.docMa

nager;this.docManager=this.iframe.docManager;if(this.options.from_jsapi){this._s ocket=new easyXDM.Socket({onMessage:function(message,origin){if(message){message =message.split(':');if(message[0]==='page'){self.docManager.gotoPage(message[1]) ;} if(message[0]==='zoom'){self.docManager._currentViewManager.resetZoom();self.doc Manager._currentViewManager.zoom(message[1]);}}}});} if($$("[data-action=share]").length){this.shareWidget=new Scribd.Embeds.Share(th is.options.document);} this.docManager.options.extrasWidth=0;this.iframe.$('document_container').show() ;self.setViewMode(this.options.view_mode);self.setArrowStates();this.docManager. addEvent('expectedFirstPageChanged',function(){$('current_page').setValue(self.d ocManager.currentPageNum());if(self._socket){self._socket.postMessage("page:"+se lf.docManager.currentPageNum());} self.setArrowStates();});this.docManager.addEvent('zoomed',function(){if(self._s ocket){self._socket.postMessage("zoom:"+self.docManager._currentViewManager._cur rentZoomMultiplier);}});$('current_page').setValue(this.docManager.currentPageNu m());$('current_page').observe('change',this.events.pageNumberChange.bind(this)) ;$$('.pages form').invoke('observe','submit',this.events.pageNumberChange.bind(t his));$$('select[name=view_mode]').invoke('observe','change',function(e){trackEv ent('html5_embed','toolbar_click','view_mode');self.setViewMode(e.element().valu e);});$$('[data-action=download]').invoke('observe','click',function(e){trackEve nt('html5_embed','toolbar_click','download');});[$$("[data-action=down]"),self.i frame.$$('#right_hotspot')].each(function(selector){selector.invoke('observe','c lick',function(e){trackEvent('html5_embed','toolbar_click','down_right');e.stop( );self.docManager.gotoNextPage();return false;});});[$$("[data-action=up]"),self .iframe.$$('#left_hotspot')].each(function(selector){selector.invoke('observe',' click',function(e){trackEvent('html5_embed','toolbar_click','up_left');e.stop(); self.docManager.gotoPreviousPage();return false;});});$$("[data-action=zoom_in]" ).invoke('observe','click',function(e){trackEvent('html5_embed','toolbar_click', 'zoom_in');e.stop();self.docManager.zoom(1.25);return false;});$$("[data-action= zoom_out]").invoke('observe','click',function(e){trackEvent('html5_embed','toolb ar_click','zoom_out');e.stop();self.docManager.zoom(0.8);return false;});$$("[da ta-action=share]").invoke('observe','click',function(e){trackEvent('html5_embed' ,'toolbar_click','share');e.stop();self.shareWidget.toggle();});$$('[data-action =fullscreen]').invoke('observe','click',function(e){trackEvent('html5_embed','to olbar_click','fullscreen');});$$('[data-action=exit_fullscreen]').invoke('observ e','click',function(e){trackEvent('html5_embed','toolbar_click','exit_fullscreen ');history.go(-1);});[$(document.body),this.iframe.document.body].invoke('observ e',"keydown",function(e){if(self.docManager.viewMode()=='slideshow'){if(e.keyCod e==39){self.docManager.gotoNextPage();} if(e.keyCode==37){self.docManager.gotoPreviousPage();}}});if(this.options.start_ page&&this.options.start_page!=1){this.docManager.gotoPage(this.options.start_pa ge);} if(this._socket){this._socket.postMessage('docReady');} trackEvent('html5_embed','view');},events:{pageNumberChange:function(e){e.stop() ;var page_num=parseInt($('current_page').getValue());page_num=Math.max(page_num, 1);page_num=Math.min(page_num,this.docManager.maximumPageNumber());this.docManag er.gotoPage(page_num);return false;}},setArrowStates:function(){if(this.docManag er.currentPageNum()==1){$$('[data-action=up]').invoke('addClassName','inactive') ;}else{$$('[data-action=up]').invoke('removeClassName','inactive');} if(this.docManager.currentPageNum()==this.options.page_count){$$('[data-action=d own]').invoke('addClassName','inactive');}else{$$('[data-action=down]').invoke(' removeClassName','inactive');}},setViewMode:function(view_mode){this.docManager. setViewManager(view_mode);this.sizeDocument();this.docManager.zoom(1);if(view_mo de=='slideshow'){this.iframe.$('left_hotspot').show();this.iframe.$('right_hotsp ot').show();}else{this.iframe.$('left_hotspot').hide();this.iframe.$('right_hots pot').hide();}},sizeToolbar:function(){var width=$(document.body).getWidth();if( width<620){if(!this.collapsed){$$('ul .expandable_button').invoke('addClassName' ,'collapsed');this.collapsed=true;}}else{if(this.collapsed){$$('ul .expandable_b utton').invoke('removeClassName','collapsed');this.collapsed=false;}}

if(width<430){if(!this.logo_collapse){$$('#toolbar .logo').invoke('addClassName' ,'collapsed');this.logo_collapse=true;}}else{if(this.logo_collapse){$$('#toolbar .logo').invoke('removeClassName','collapsed');this.logo_collapse=false;}} if(width<390){if(!this.pages_collapse){$$('ul .pages .of').invoke('hide');$$('ul .pages .total').invoke('hide');this.pages_collapse=true;}}else{if(this.pages_co llapse){$$('ul .pages .of').invoke('show');$$('ul .pages .total').invoke('show') ;this.pages_collapse=false;}} $$('ul .expandable_button').invoke('show');if(window.location.pathname.indexOf(' fullscreen')===1){$$('ul #fullscreen').invoke('hide');}else{$$('ul #exit_fullscr een').invoke('hide');}},sizeDocument:function(){var marginWidthCompensate=(Proto type.Browser.IE7 Prototype.Browser.IE6)?56:52;var marginHeightCompensate=(Proto type.Browser.IE)?55:45;if(this.options.view_mode=='slideshow'){var target_width; var current_page=this.docManager.pages[this.docManager.currentPageNum()];var rat io=current_page.origHeight/current_page.origWidth;var page_width=$(document.body ).getWidth();var page_height=$('document_content').getHeight();var expected_heig ht=ratio*page_width;if(expected_height>page_height){target_width=(1/ratio)*(page _height-marginHeightCompensate);}else{target_width=page_width-marginWidthCompens ate;} this.defaultWidth=target_width;}else{this.defaultWidth=$(document.body).getWidth ()-marginWidthCompensate;} this.docManager.setDefaultWidth(this.defaultWidth);}}); /* app/views/people/_user_controls.js @ 1319142721 */ function setupReportControls(controls){var report_section=controls.down('.report _section'),report_link=report_section.down('.flag_user_link'),report_confirm=rep ort_section.down('.report_confirm'),report_submit=report_confirm.down('button'), cancel_link=report_confirm.down('.cancel_link');report_link.observe('click',func tion(e){e.stop();Effect.toggle(report_confirm,'slide',{duration:0.3});});report_ submit.observe('click',function(e){e.stop();new Ajax.Request(report_link.href,{m ethod:'post',onSuccess:function(){report_section.update('<span class="confirmed" >Thank you.</span>');}});});cancel_link.observe('click',function(e){e.stop();rep ort_confirm.slideUp({duration:0.3});});} function setupBlockControls(controls){var block_section=controls.down('.block_se ction');var block_link=block_section.down('.block_user_link');var unblock_link=b lock_section.down('.unblock_user_link');var block_confirm=block_section.down('.b lock_confirm');if(typeof(block_confirm)!='undefined'){var cancel_link=block_conf irm.down('.cancel_link');} if(unblock_link){unblock_link.observe('click',function(e){e.stop();new Ajax.Requ est(unblock_link.href,{method:'delete',onSuccess:function(){unblock_link.up('.co ntrols').update('<span class="confirmed">This user is no longer blocked.</span>' );}});});return;} var block_submit=block_confirm.down('button');block_link.observe('click',functio n(e){e.stop();Effect.toggle(block_confirm,'slide',{duration:0.3});});block_submi t.observe('click',function(e){e.stop();new Ajax.Request(block_link.href,{method: 'post',onSuccess:function(){block_section.update('<span class="confirmed">This u ser is blocked.</span>');}});});cancel_link.observe('click',function(e){e.stop() ;block_confirm.slideUp({duration:0.3});});} document.observe('dom:loaded',function(){$$('.user_controls').each(function(cont rols){setupReportControls(controls);setupBlockControls(controls);});}); /* app/views/upload/_timeline_upload_button_widget.js @ 1319142722 */ if(!Scribd)Scribd=new Object();if(!Scribd.Upload)Scribd.Upload=new Object();Scri bd.Upload.TimelineUploadButtonWidget=Class.create(Scribd.Upload.UploadButtonWidg et,{initialize:function($super,options){$super(options);},newUploadManager:funct ion(options){var TimelineUploadManager=Class.create(Scribd.scalable_upload_manag er,{initialize:function($super,parameters){$super(parameters);},showMetadataForm

:function($super){$super();},startConversionChecker:function($super){$super();th is.element.down('.su_document_thumbnail_background').setStyle({'background':'#ff f url('+Scribd.cdn_path+'images/spinner_large_mac_white.gif) no-repeat 30px 47px '});},showPublishAnimation:function($super){this.element.down('.file_name').show ();this.element.down('.su_upload_status_text').hide();$super();}});return new Ti melineUploadManager(options);}}); /* app/views/partners/apply.js @ 1319142721 */ if(!window.Scribd){var Scribd={};} if(!Scribd.Partner){Scribd.Partner={};} Scribd.Partner.onPaymentChange=function(index){var showpaypal=(index==1) if(showpaypal){$('paypal_email').show()}else{$('paypal_email').hide()}} /* app/views/shared/sharing/blank_dialog.js @ 1319142721 */ if(!window.Scribd)var Scribd=new Object();if(!Scribd.Readcast)Scribd.Readcast={} ;Scribd.Readcast.BlankDialog={initialize:function(){var that=this;that.element=$ ('readcast_popup_outer');that.element.down('.close_button').observe('click',that .hide_popup.bind(that));that.element.down('.readcast_now_button').observe('click ',that.show_login_lb.bind(that));var alt=that.element.down('.alternate_link');if (alt){alt.observe('click',that.hide_popup.bind(this));}},show_popup:function(e){ if(Scribd.Readcast.Dialog.animation==='fourgen'){Scribd.Readcast.Dialog.Animatio ns.fourgen.show_popup.call(this,e);}else{Scribd.Readcast.Dialog.Animations.blank .show_popup.call(this,e);}},hide_popup:function(e){if(Scribd.Readcast.Dialog.ani mation==='fourgen'){Scribd.Readcast.Dialog.Animations.fourgen.hide_popup.call(th is,e);}else{Scribd.Readcast.Dialog.Animations.blank.hide_popup.call(this,e);}},s how_login_lb:function(e){e.stop();Scribd.Readcast.trackEvent("readcast this logi n");Scribd.login.open({context:'readcast'});}};Scribd.Readcast.trackEvent=functi on(action,label){window.trackEvent("Readcast",action,label);};document.observe(S cribd.Readcast.Event.BlankReadcast.EVENTS.ready,function(e){Scribd.Readcast.Blan kDialog.show_popup();});(function(){function initDialog(){if(!Scribd.Readcast.bl ank_active())return;Scribd.Readcast.BlankDialog.initialize();} document.observe('dom:loaded',initDialog);document.observe(Scribd.Facebook.EVENT S.auto_logged_out,initDialog);})(); /* app/views/paid/_header.js @ 1319142721 */ Scribd.init('Scribd','Paid');Scribd.Paid.Header=Class.create(Scribd.Shared.Javas criptWidget,{initialize:function($super,options){$super(options);this.back_to_li ghtbox=options.back_to_lightbox;this.button_class=options.button_class;},onDomLo aded:function($super,event){$super(event);if(this.widget_dom.down('.'+this.butto n_class)){this.widget_dom.down('.'+this.button_class).observe('click',function(e ){switch(this.button_class){case'back_button':if(parent.transport){parent.transp ort.postMessage('open '+this.back_to_lightbox);}else{Scribd.Lightbox.open(this.b ack_to_lightbox,75);} break;case'close_button':case'subtle_close_button':if(parent.transport){parent.t ransport.postMessage('close');}else{Scribd.Lightbox.close();} break;default:}}.bind(this));}}}); /* app/views/shared/carousel_base.js @ 1319142721 */ if(!window.Scribd)var Scribd=new Object();Scribd.SharedCarouselManager=Class.cre ate({initialize:function(options){this.options=Object.extend({},options {});thi s.container=this.options.container;this.current_page=1;this.last_page=false;this .pages=this.options.pages;this.left_arrow=this.container.down('.left_arrow');thi

s.right_arrow=this.container.down('.right_arrow');this.carousel=new Scribd.carou sel(this.options.carousel_dom_id,$(this.options.carousel_dom_id).select('li'),th is.options.container.select('.arrows a'),{circular:false,duration:0,wheel:false} );Scribd.carouselLazyLoad(this.carousel);this.setupEvents();},setupEvents:functi on(){this.left_arrow.addClassName('left_arrow_disabled');this.container.down('.l eft_arrow').observe('click',function(e){this.right_arrow.removeClassName('right_ arrow_disabled');if(this.current_page==2) this.left_arrow.addClassName('left_arrow_disabled');if(this.current_page!=1) this.current_page-=1;}.bind(this));this.container.down('.right_arrow').observe(' click',function(e){this.left_arrow.removeClassName('left_arrow_disabled');if(thi s.current_page==this.pages-1) this.right_arrow.addClassName('right_arrow_disabled');if(this.current_page!=this .pages) this.current_page+=1;}.bind(this));}});Scribd.SharedDocumentsCarouselManager=Scr ibd.SharedCarouselManager; /* app/views/upload/_text_upload_widget.js @ 1319142722 */ if(!Scribd)Scribd=new Object();if(!Scribd.Upload)Scribd.Upload=new Object();Scri bd.Upload.TextUploadWidget=Class.create(Scribd.Upload.BaseUploadWidget,{initiali ze:function($super,options){$super(options);this.default_document_body_text=opti ons.default_document_body_text;this.upload_template_dom_id=options.upload_templa te_dom_id;this.event_element=document;},onWidgetsLoaded:function($super,event){$ super(event);var widget=this;var widget_dom=this.widget_dom;this.registerTextUpl oadForm(widget,widget_dom);this.registerTextUploadTextArea(widget,widget_dom);}, registerTextUploadForm:function(widget,widget_dom){var upload_text_form=widget_d om.down('.upload_text_form');upload_text_form.observe('submit',function(event){e vent.stop();if(widget.isValidDocumentBody()&&widget.enforceCopyrightWarning()){v ar error_message_div=widget_dom.down('.text_error_message');upload_text_form.req uest({onCreate:function(request){widget_dom.select('.text_error_message').invoke ('hide')},onLoading:function(request){widget_dom.select('.text_submit_spinner'). invoke('show')},onLoaded:function(request){widget_dom.select('.text_submit_spinn er').invoke('hide')},onSuccess:function(request){widget.newNonSwfUploadDocumentU ploaded(request,error_message_div)},onFailure:function(request){widget.newNonSwf UploadDocumentFailedUpload(request,error_message_div)}});}});},registerTextUploa dTextArea:function(widget,widget_dom){var textarea=widget_dom.down('.document_bo dy');textarea.observe('focus',function(event){if(textarea.value.strip()==widget. default_document_body_text){textarea.value='';}});textarea.observe('blur',functi on(event){if(textarea.value.strip()==''){textarea.value=widget.default_document_ body_text;}});},isValidDocumentBody:function(){var document_body=this.widget_dom .down('.document_body');var string=document_body.getValue().strip();return strin g!=''&&string!=this.options.default_document_body_text;},newNonSwfUploadDocument Uploaded:function(ajax_request,error_message_div){var widget=this;var data;try{d ata=ajax_request.responseText.evalJSON();}catch(e){} if(data&&data.document_id){var add_html=function(dom_element){var text_status_di splay=widget.widget_dom.down('.text_status_display');text_status_display.insert( {top:dom_element});} if(!window.uploadManagers){window.uploadManagers=[];} var upload_manager=new Scribd.scalable_upload_manager({filename_base:data.filena me_base,filename_extension:data.filename_extension,isPrivate:data.is_private,fil e_template_element_id:this.upload_template_dom_id,addHTML:add_html,cancelListene r:function(){;}});window.uploadManagers.push(upload_manager);upload_manager.onFi leAlreadyUploaded({file_upload_id:'upload_'+window.uploadManagers.length},{id:da ta.document_id,access_key:data.access_key,secret_password:data.secret_password}) ;var document_body=this.widget_dom.down('.document_body');document_body.clear(); this.event_element.fire("Scribd:upload_widget:allFilesSuccessful");}else{error_m essage_div.update('Failed upload: No document was created.');error_message_div.s how();}},newNonSwfUploadDocumentFailedUpload:function(ajax_request,error_message _div){error_message_div.update('Failed upload.');error_message_div.show();}});

/* app/views/premium/purchases/trialgate.js @ 1319142721 */ Scribd.init('Scribd','Premium','Purchases');Scribd.Premium.Purchases.Trialgate=C lass.create(Scribd.Shared.JavascriptWidget,{initialize:function($super,options){ $super(options);this.credit_card_url=options.credit_card_url;this.document_id=op tions.document_id;this.download_plan=options.download_plan;this.paypal_buttons=o ptions.paypal_buttons;this.xhr=options.xhr;},onDomLoaded:function($super,event){ $super(event);var gate=this;var widget_dom=this.widget_dom;widget_dom.down('#but ton_credit_card').observe('click',function(e){e.stop();gate.submitHandler('credi t_card');});widget_dom.down('#button_paypal').observe('click',function(e){e.stop ();gate.submitHandler('paypal');});widget_dom.down('.close_button').observe('cli ck',function(){Scribd.Lightbox.close();});},submitHandler:function(method){var b uttons=this.widget_dom.down('#buttons_tr');var buttons_text=this.widget_dom.down ('#buttons_text_tr');var spinner=this.widget_dom.down('#spinner_tr');spinner.sho w();buttons.hide();buttons_text.hide();var hide_function=function(){spinner.hide ();buttons.show();buttons_text.show();};hide_function.delay(5);var plan=this.dow nload_plan;switch(method){case'credit_card':var url=this.credit_card_url.updateQ ueryParams({abstract_buyable_id:plan.abstract_buyable_id,doc:this.document_id}); if(this.xhr){Scribd.Lightbox.secureIframeOpen('premium_credit_card_flow',url.upd ateQueryParams({layout:'dynamic_iframe'}),{},{style:'tight'});}else{window.locat ion=url;} break;case'paypal':$('paypal_form_container_'+plan.id).down('form').submit();bre ak;}}}); /* app/views/account/pictures/pictures_base.js @ 1319142721 */ if(!window.Scribd)var Scribd=new Object();if(!window.Scribd.Account)Scribd.Accou nt=new Object();if(!window.Scribd.Account.Pictures)Scribd.Account.Pictures=new O bject();Scribd.Account.Pictures.Base=Class.create({editPicture:function(event,el ement){event.stop();this.editPictureUpdater(element.href);},editPictureUpdater:f unction(url){var content=$('edit_picture_lightbox').down('.content');content.upd ate("<img alt='Spinner_mac_white' src='/images/spinner_mac_white.gif' style='top :auto' /> Loading...");Scribd.Lightbox.open('edit_picture_lightbox');new Ajax.Up dater(content,url,{asynchronous:true,evalScripts:true,method:'get',onComplete:fu nction(){var pictures_base=new Scribd.Account.Pictures.Base;$('delete_this_pictu re').observe('click',pictures_base.deletePicture);document.getElementById('curre nt_photo').onload=function(){var cropper=new Scribd.Account.Pictures.PhotoCroppe r('current_photo','/account/picture');cropper.loadImageCropper('current_photo'); }}});},applyPicture:function(e){e.stop();var url=this.href;$('current_profile_im age_container').update("<div class='profile_image dashboard_image'><img alt='Spi nner_mac_white' src='/images/spinner_mac_white.gif' style='top:auto' /> Applying ...</div>");new Ajax.Updater('upload_picture',url,{method:'put',evalScripts:true ,onFailure:function(){Scribd.Alerts.error('profile_picture_alerts','An error occ urred! Please try again later.');},onComplete:function(){$('upload_picture').fir e('Scribd:dom_updated');}});},deletePicture:function(e){e.stop();if(confirm('Are you sure you want to delete this picture?')==true){var url=this.href;new Ajax.U pdater('upload_picture',url,{asynchronous:true,evalScripts:true,method:'delete'} );}}});Scribd.Account.Pictures.PhotoCropper=Class.create({initialize:function(im g,url){this.img=$(img);this.url=url;this.coords=null;this.dimensions=null;this.c ropper=null;this.cropped=false;this.original_width=null;this.event_delegate=this .eventDelegate.bind(this);$('upload_picture').observe('click',this.event_delegat e);$('upload_picture').down('button').observe('click',function(e){e.stop();this. saveCroppedImage(e.findElement('button'));}.bind(this));},saveCropCoords:functio n(coords,dimensions){this.coords=coords;this.dimensions=dimensions;},eventDelega te:function(e){var target=e.element();switch(target.id){case'edit_picture_form_c ancel_changes':case'close_edit_picture_lightbox':e.stop();this.cancelCrop(target );break;default:}},loadImageCropper:function(target){this.img=$(this.img.id);thi

s.original_width=$('current_photo').getStyle('width');this.cropper=new Cropper.I mg(this.img,{previewWrap:'preview_wrap',ratioDim:{x:1,y:1},minWidth:48,minHeight :48,autoIncludeCSS:false,onloadCoords:{x1:((this.img.getWidth()/2)-50),y1:((this .img.getHeight()/2)-50),x2:((this.img.getWidth()/2)+50),y2:((this.img.getHeight( )/2)+50)},displayOnInit:true,onEndCrop:this.saveCropCoords.bind(this)});},saveCr oppedImage:function(target){if(this.coords&&this.dimensions){Form.Element.disabl e(target);target.addClassName('disabled');$('edit_picture_form_cancel_changes'). hide();$('edit_picture_form_saving_changes').show();var id=this.img.readAttribut e('rel');new Ajax.Updater('upload_picture',this.url+'?'+$H({id:id,x:this.coords. x1,y:this.coords.y1,w:this.dimensions.width,h:this.dimensions.height}).toQuerySt ring(),{method:'put',evalScripts:true,onSuccess:this.cropWin.bind(this),onFailur e:this.cropFail.bind(this)});}},cropWin:function(req){this.cropped=true;this.can celCrop(null);},cropFail:function(req){this.cancelCrop(null);},cancelCrop:functi on(target){if(this.cropper){this.cropper.remove();this.cropper=null;$('upload_pi cture').stopObserving('click',this.event_delegate);} Scribd.Lightbox.close('edit_picture_lightbox');}}); /* app/views/shared/sharing/readcast_confirmations.js @ 1319142721 */ if(!window.Scribd)var Scribd=new Object();Scribd.ReadCaster=Class.create({initia lize:function(options){this.event_type=options.event_type;this.submit_button=opt ions.submit_button;this.confirmations=options.confirm_checkboxes;this.permission s=options.permissions;this.doc=options.doc;this.doc_collection=options.doc_colle ction;this.linked_sites=options.linked_sites;this.submit_button.observe('click', this.handleReadcastEvents.bind(this));this.after=options.after;this.stop_event=o ptions.stop_event;},handleReadcastEvents:function(e){if(this.stop_event){e.stop( );} if(Object.isFunction(this.after)){this.after.call(this);} this.submitReadcastEvents();},submitReadcastEvents:function(params){var that=thi s;this.linked_sites.each(function(linked_site){if(Scribd.ReadCaster.shouldSubmit ForSite(linked_site,that.permissions,that.confirmations)){var klass=that.eventCl ass(linked_site);var klass_params={event_type:that.event_type,service_type:linke d_site};var extraInfo="";if(that.doc){extraInfo=" on doc";klass_params=Object.ex tend(klass_params,{doc:that.doc});}else if(that.doc_collection){extraInfo=" on d oc collection";klass_params=Object.extend(klass_params,{doc_collection:that.doc_ collection,auto_submit:false});} Scribd.Readcast.trackEvent(that.event_type+" submit"+extraInfo,linked_site);var new_event=new klass(Object.extend(params {},klass_params));new_event.submit();} });},eventClass:function(site){if(site==='facebook'){return Scribd.Readcast.Even t.FacebookAutoShare;}else{return Scribd.Readcast.Event.AutoShare;}}});Scribd.Rea dCaster.shouldSubmitForSite=function(linked_site,permissions,confirmations){if(p ermissions[linked_site]==='on'){return true;} if(confirmations){return confirmations.detect(function(confirmation){var site=co nfirmation.className;return(site===linked_site&&confirmation.getValue()==='1');} );}};Scribd.ScribbleReadCaster=Class.create(Scribd.ReadCaster,{initialize:functi on($super,options){$super(options);this.scribble_text_field=options.scribble_tex t_field;this.docReload=options.doc_reload;},handleReadcastEvents:function(e){if( Object.isFunction(this.docReload)){this.doc=this.docReload.call(this);} if(this.scribble_text_field&&this.scribble_text_field.value.length>0){this.submi tReadcastEvents({scribble_text:this.scribble_text_field.value});}},eventClass:fu nction(site){if(site==='facebook'){return Scribd.Readcast.Event.FacebookScribble AutoShare;}else{return Scribd.Readcast.Event.AutoShare;}}});Scribd.EventBasedRea dCaster=Class.create({initialize:function(options){this.event_type=options.event _type;this.permissions=options.permissions;this.linked_sites=options.linked_site s;var that=this;document.observe(options.observes 'Scribd:EventBasedReadCaster: ready',function(e){var confirmations=e.memo.confirmations;var doc=e.memo.doc;tha t.linked_sites.each(function(linked_site){if(Scribd.ReadCaster.shouldSubmitForSi te(linked_site,that.permissions,confirmations)){var extraInfo="";if(doc){extraIn fo=" on doc";}

Scribd.Readcast.trackEvent(that.event_type+" submit"+extraInfo,linked_site);var klass=Scribd.EventBasedReadCaster.eventClass(linked_site);var new_event=new klas s({'doc':doc,event_type:that.event_type,service_type:linked_site});new_event.sub mit();}});});}});Scribd.EventBasedReadCaster.eventClass=function(site){if(site== ='facebook'){return Scribd.Readcast.Event.FacebookAutoShare;}else{return Scribd. Readcast.Event.AutoShare;}};Scribd.EventBasedReadCaster.fire=function(memo){docu ment.fire('Scribd:EventBasedReadCaster:ready',memo);};Scribd.ReadCaster.observin g_confirmations=false;Scribd.ReadCaster.observeConfirmations=function(){if(!Scri bd.ReadCaster.observing_confirmations){Scribd.ReadCaster.observing_confirmations =true;document.observe('click',function(e){var element=e.findElement();var conta iner=Scribd.ReadCaster.findReadcastConfirmation(element);if(!container){containe r=Scribd.ReadCaster.findReadcastConfirmation(element.up());} if(container){var checkbox=container.down('input');if(container.hasClassName('di sabled')){container.removeClassName('disabled');checkbox.checked=true;}else{cont ainer.addClassName('disabled');checkbox.checked=false;}}});}};Scribd.ReadCaster. isReadcastConfirmation=function(element){return element&&element.hasClassName&&e lement.hasClassName('readcast_confirmation');};Scribd.ReadCaster.findReadcastCon firmation=function(element){return Scribd.ReadCaster.isReadcastConfirmation(elem ent)?element:null;}; /* app/views/shared/sharing/control.js @ 1319142721 */ if(!window.Scribd)var Scribd=new Object();if(!Scribd.Readcast)Scribd.Readcast={} ;Scribd.Readcast.Control={initialize:function(){var that=this;that.begun=that.ch eckBox($$('.network_input').first())?false:true;if(that.begun){var any_on=false; $$('.network_input').each(function(el){if(el.down('.check').style.display!=='non e'){any_on=true;return;} if(!el.down('.link_account')){that.toSend(el);}});if(any_on){$$('.readcast_compl ete').invoke('show');}else{$$('.send_to_readcast').invoke('show');}}},begin:func tion(button){this.begun=true;var that=this;button.hide();var checked=$$('.networ k_input input:checked');if(checked.length>0){var on_networks=[];checked.each(fun ction(el){on_networks.push(that.extractNetwork(el.up('.pref_item')));});var netw orks=$H(Scribd.Readcast.sharingPrefs).keys().inject({},function(m,network){m[net work]=on_networks.include(network);return m;});Scribd.Readcast.Form.toggleContro ls('ask');Scribd.Readcast.Form.doSubmit(false,"Readcasted & Saved");$$('.readcas t_complete').invoke('show');}else{$$('.send_to_readcast').invoke('show');} that.bindInputs();},bindInputs:function(){var that=this;$$('.network_input').eac h(function(el){if(el.down('input:checked')){var control=el.up('.pref_item');Scri bd.Readcast.trackEvent("checkbox submit",that.extractNetwork(control));that.subm itEvent(control);}else{var link=el.down('.link_account');if(!link link.style.di splay==='none'){that.toSend(el);}}});},toCheckbox:function(el){this.checkBox(el) .appear(this.appearOpts);this.checkSymbol(el).hide();this.sendButton(el).hide(); },toDone:function(el){this.checkSymbol(el).appear(this.appearOpts);this.sendButt on(el).hide();var check=this.checkBox(el);if(check)check.hide();},toSend:functio n(el){this.sendButton(el).appear(this.appearOpts);this.checkSymbol(el).hide();va r check=this.checkBox(el);if(check)check.hide();this.bindSend(el);},appearOpts:{ delay:0.4,duration:0.5,queue:{position:'end',scope:'readcastControls'}},bindSend :function(el){var that=this;that.sendButton(el).observe('click',function(e){e.st op();var control=el.up('.pref_item');Scribd.Readcast.trackEvent("send button sub mit",that.extractNetwork(control));that.submitEvent(control);});},submitEvent:fu nction(el){var that=this;var network=that.extractNetwork(el),ev=Scribd.Readcast. active_events[network];if(ev){if(ev.submitted){that.toDone(el);}else{ev.submit(f unction(){that.toDone(el);});}}},afterLink:function(el,cb){if(this.begun){this.t oSend(el);}else{this.toCheckbox(el);} if(typeof cb==='function')cb();},extractNetwork:function(el){return el.id.match( /(\w+)_pref/)[1];},sendButton:function(el){return el.down('.send');},checkSymbol :function(el){return el.down('.check');},checkBox:function(el){return el.down('i nput[type="checkbox"]');},showControls:function(){$$('.network_input').each(func tion(el){el.appear({duration:0.4,queue:{position:'end',scope:'readcastControls'}

});});}};Scribd.Readcast.Control.setup=function(){Scribd.Readcast.Control.initia lize();Scribd.Readcast.Form.initialize();$$('.readcast_now_button').each(functio n(button){button.observe('click',function(e){e.preventDefault();Scribd.Readcast. Control.begin(button);});});$$('.edit_preferences').each(function(button){button .observe('click',function(e){e.preventDefault();Scribd.Readcast.trackEvent("pref erences","edit click");new Effect.toggle('readcast_preferences','slide',{duratio n:0.3});});});$$('.first_time .readcast_now_button').each(function(button){butto n.observe('click',function(e){e.preventDefault();Scribd.Readcast.trackEvent("rea dcast this click");var el=$('readcast_preferences');if(el.style.display!=='none' )return;el.slideDown({duration:0.3,queue:{position:'end',scope:'readcastControls '}});});});Scribd.Readcast.Status.initialize();$$('#readcast_popup .twitter_link _account').each(function(el){new Scribd.Twitter.Account(el,{onSuccess:function() {Scribd.Readcast.trackEvent("link account","twitter");el.hide();Scribd.Readcast. Control.afterLink(el.up('.network_input'),Scribd.Readcast.Preferences.checkUnlin ked);}});});$$('#readcast_popup .facebook_link_account').each(function(el){new S cribd.Facebook.Account(el,{onSuccess:function(){Scribd.Readcast.trackEvent("link account","facebook");el.hide();Scribd.Readcast.Control.afterLink(el.up('.networ k_input'),Scribd.Readcast.Preferences.checkUnlinked);}});});};document.observe(' dom:loaded',function(){if(!Scribd.Readcast.active())return;Scribd.Readcast.Contr ol.setup();});document.observe(Scribd.Facebook.EVENTS.transition,function(){if(! Scribd.Readcast.active())return;Scribd.Readcast.Control.setup();}); /* app/views/paypal_transactions/show.js @ 1319142721 */ if(!window.Scribd)var Scribd=new Object();if(!window.Scribd.PaypalTransactions)S cribd.PaypalTransactions=new Object();if(!window.Scribd.PaypalTransactions.Show) Scribd.PaypalTransactions.Show=new Object();Scribd.PaypalTransactions.Show=Class .create(Scribd.Shared.JavascriptWidget,{initialize:function($super,options){$sup er(options);this.updateURL=options.update_url;this.transactionID=options.transac tion_id;},onDomLoaded:function($super,event){$super(event);this.periodic=new Per iodicalExecuter(function(){this.periodicRefresh()}.bind(this),5);},periodicRefre sh:function(){new Ajax.Request(this.updateURL,{method:'get',onSuccess:function(t ransport){var transaction=transport.responseJSON.transaction;var purchase_id=tra nsport.responseJSON.purchase_id;switch(transaction.status){case'Completed':case' Fulfilled':if(purchase_id){Scribd.Alerts.success('problems',"Payment complete! R edirecting you now...");this.periodic.stop();window.location=transaction.next_ur l;} break;case'Pending':if(purchase_id){Scribd.Alerts.success('problems',"Payment pe nding. Redirecting you now...");this.periodic.stop();window.location=transaction .next_url;} break;case'Expired':this.handleError("Unable to complete payment -- the bank too k to long and the authorization expired.",{userShouldRetry:true});break;case'Fai led':this.handleError("Unable to complete payment -- something went wrong on Pay Pal's end.",{userShouldRetry:true});break;case'In-Progress':case null:break;defa ult:this.handleError("Unable to complete payment ("+transaction.status+").");bre ak;}}.bind(this),onFailure:function(transport){if(transport.status==404)this.han dleError("Your PayPal transaction was unexpectedly deleted.",{hasBeenCharged:tru e});else this.handleError("Scribd is temporarily unavailable ("+transport.status +").",{stop:false});}.bind(this)});},handleError:function(string,options){option s=Object.extend({userShouldRetry:false,hasBeenCharged:false,stop:true},options {});if(options.hasBeenCharged)string+=" Your purchase did not complete -- you sh ould visit PayPal.com and verify that your credit card has not been charged.";if (options.userShouldRetry)string+=" You can retry your purchase later if you wish .";if(options.stop)string+=" If you need to contact Customer Support, please pro vide them the transaction ID #"+this.transactionID+".";else string+=" Trying aga in...";Scribd.Alerts.error('problems',string);if(options.stop)this.periodic.stop ();}});

/* app/views/word/view/_toolbar_download.js @ 1319142724 */ if(!window.Scribd)var Scribd=new Object();Scribd.downloadLightboxManager=Class.c reate({initialize:function(options){this.options=Object.extend({secret_password: '',extension_sizes:{},logged_in:false,show_premium:false,premium_lightbox:false} ,options {});this.container=options.container;this.radios=this.container.down(' .download_icons');this.download_section=this.container.down('.download_section') ;this.current_extension=options.initial_extension;this.loaded_upload_js=false;th is.download_query=$H({secret_password:this.options.secret_password});this.autodo wn_query=$H({secret_password:this.options.secret_password});this.updateExtension (this.current_extension);this.setupEvents();},setupEvents:function(){this.radios .select('img').invoke('observe','click',function(e){var input=e.element().up('td ').down('input');input.checked=true;this.updateExtension(input.value);}.bind(thi s));this.radios.select('input').invoke('observe','click',function(e){this.update Extension(e.element().value);}.bind(this));var handler=this.options.show_premium ?this.premiumDownloadHandler:this.downloadHandler;this.download_section.down('.d ownload_button').observe('click',handler.bind(this));},downloadHandler:function( e){if(this.options.logged_in){window.open(this.downloadUrl());}else{Scribd.login .open({context:'download',document_id:this.options.document_id,extension:this.cu rrent_extension,next_url:this.autodownUrl()});}},premiumDownloadHandler:function (){var path="/premium/purchases/gate".updateQueryParams({doc:this.options.docume nt_id,extension:this.current_extension});if(this.options.logged_in){if(this.opti ons.premium_lightbox){Scribd.Lightbox.remoteOpen('premium_download',path,{},{sty le:'tight',width:'600'});}else{window.location=path;}}else{var callback_string=t his.options.premium_lightbox?"Scribd.Lightbox.remoteOpen('premium_download', '"+ path.updateQueryParams({format:'json'})+"', {}, { style: 'tight' });":"window.lo cation = "+path;Scribd.login.open({context:'download',document_id:this.options.d ocument_id,extension:this.current_extension,callback:"Scribd.Lightbox.remoteOpen ('premium_download', '"+path+"', {}, { style: 'tight' });"});}},updateExtension: function(extension){var filename_append_text=extension;if(this.options.extension _sizes[extension]) filename_append_text+=' - '+this.options.extension_sizes[extension];this.downloa d_section.down('.download_extension').update(filename_append_text);this.current_ extension=extension;this.download_query.set('extension',extension);this.autodown _query.set('autodown',extension);},downloadUrl:function(){return this.options.ba se_url+'?'+this.download_query.toQueryString();},autodownUrl:function(){return t his.options.autodown_base_url+'?'+this.autodown_query.toQueryString();}}); /* app/views/shared/buy_this.js @ 1319142721 */ if(!window.Scribd){var Scribd={};} if(!Scribd.BuyThis){Scribd.BuyThis=new Object();} Scribd.BuyThis.close=function(buy_this){buy_this.hide();Scribd.BuyThis.visible=f alse;} Scribd.BuyThis.load=function(){Scribd.log('loading buythis');Scribd.BuyThis.visi ble=true;if(!!(document.all&&(/msie 6./i).test(navigator.appVersion)&&window.Act iveXObject)){Scribd.BuyThis.visible=false;} if(!Scribd.BuyThis.visible){return;} if(!Scribd.Toolbar){$('buy_this_widget').show();return;} var buy_this=$('buy_this_widget').up();buy_this.remove();Element.insert(document .body,{'top':buy_this}) $('buy_this_widget').show();Scribd.log('showed buythis');Scribd.StickyElement('b uy_this_widget',function(buy_this){if(document.viewport.getWidth()<1000 !Scribd .BuyThis.visible){return;} buy_this=buy_this.up();buy_this.setStyle({position:'fixed',top:'0px',left:($$('. outer_page:first').first().cumulativeOffset()[0]+$$('.outer_page:first').first() .up().offsetWidth-buy_this.offsetWidth-10)+"px"});},function(buy_this){if(!Scrib d.BuyThis.visible){return;} buy_this=buy_this.up();buy_this.setStyle({position:'absolute',top:$$('.outer_pag

e:first').first().cumulativeOffset()[1]+'px',left:($$('.outer_page:first').first ().cumulativeOffset()[0]+$$('.outer_page:first').first().up().offsetWidth-buy_th is.offsetWidth)+"px"});buy_this.style.left=($$('.outer_page:first').first().cumu lativeOffset()[0]+$$('.outer_page:first').first().up().offsetWidth-buy_this.offs etWidth-10)+"px";buy_this.style.top=($$('.outer_page:first').first().cumulativeO ffset()[1]+10)+'px';},function(){return document.viewport.getScrollOffsets()[1]> ($$('.outer_page:first').first().cumulativeOffset()[1]+10);},function(buy_this){ if(!Scribd.BuyThis.visible){return;} if(buy_this==null){return;} if(docManager.viewMode()=="scroll"){buy_this.show();}else{buy_this.hide();}});} /* app/views/shared/facebook/_like_button.js @ 1319142721 */ if(!window.Scribd)var Scribd=new Object();Scribd.switchFBUser=function(){FB.logo ut(function(){FB.login(function(resp){if(resp.session){new Ajax.Request('/facebo ok_session',{asynchronous:true,evalScripts:true,method:'post'});}});});}; /* app/views/premium/purchases/hybrid_gate.js @ 1319142721 */ Scribd.init('Scribd','Premium','Purchases');Scribd.Premium.Purchases.HybridGate= Class.create(Scribd.Shared.JavascriptWidget,{initialize:function($super,options) {$super(options);this.credit_card_url=options.credit_card_url;this.credit_card_u psell_url=options.credit_card_upsell_url;this.facebook_reauth_url=options.facebo ok_reauth_url;this.paypal_upsell_url=options.paypal_upsell_url;this.reauth_type_ url=options.reauth_type_url;this.document_id=options.document_id;this.download_p lans=options.download_plans;this.paypal_buttons=options.paypal_buttons;this.xhr= options.xhr;},onDomLoaded:function($super,event){$super(event);var gate=this;var widget_dom=this.widget_dom;Event.observe(document,'Scribd:upload_widget:uploadS tart',function(e){widget_dom.down('.gate_upload_spinner_container').show();});Ev ent.observe(document,'Scribd:upload_widget:uploadComplete',function(e){widget_do m.down('.gate_upload_spinner_container').hide();widget_dom.down('.archive_flow') .blindUp();Effect.SlideDown('purchase_gate_upload_success',{scaleFrom:0,scaleTo: 100});});},onWidgetsLoaded:function($super,event){$super(event);this.plansJavasc riptWidget().selectDefaultPlan();},plansJavascriptWidget:function(){return this. widget_dom.down('#archive_gate_plans').javascript_widget;},paymentOptionsJavascr iptWidget:function(){return this.widget_dom.down('#archive_gate_payment_options' ).javascript_widget;},planSelected:function(){var plan=this.plansJavascriptWidge t().selectedPlan();this.paymentOptionsJavascriptWidget().planSelectedHandler(pla n);},submitHandler:function(method,onCompleteCallback){var plan=this.plansJavasc riptWidget().selectedPlan();var self=this;var next=function(url){if(self.options .xhr){Scribd.Lightbox.remoteOpen('premium_credit_card_flow',url,{},{style:'tight '});}else{window.location=url;}};var secureNext=function(url){if(self.options.xh r){Scribd.Lightbox.secureIframeOpen('premium_credit_card_flow',url.updateQueryPa rams({layout:'dynamic_iframe'}),{height:"750"},{style:'tight'});}else{window.loc ation=url;}};switch(method){case'credit_card':if(plan.has_ad_free_download_plan& &plan.do_upsell){var credit_card_url=this.credit_card_upsell_url.updateQueryPara ms({abstract_buyable_id:plan.abstract_buyable_id,doc:this.document_id,layout:'dy namic_iframe'});}else{var credit_card_url=this.credit_card_url.updateQueryParams ({abstract_buyable_id:plan.abstract_buyable_id,doc:this.document_id,layout:'dyna mic_iframe'});} new Ajax.Request(this.reauth_type_url,{onComplete:function(response){onCompleteC allback();},onSuccess:function(response){if(response.responseJSON.reauth_type==' facebook'){var reauth_url=this.facebook_reauth_url.updateQueryParams({next_url:c redit_card_url});next(reauth_url);}else{secureNext(credit_card_url);}}.bind(this ),onFailure:function(response){Scribd.Lightbox.open('premium_download');}});brea k;case'paypal':if(plan.has_ad_free_download_plan&&plan.do_upsell){var url=this.p aypal_upsell_url.updateQueryParams({abstract_buyable_id:plan.abstract_buyable_id ,doc:this.document_id,layout:'dynamic_iframe'});next(url);onCompleteCallback();}

else{$('paypal_form_container_'+plan.id).down('form').submit();} break;}}}); /* app/views/people/info.js @ 1319142721 */ document.observe('dom:loaded',function(){$$('.info_section').each(function(secti on){var control=section.down('h3'),content=section.down('.section_content');cont rol.observe('click',function(e){e.stop();if(section.hasClassName('closed')){cont ent.blindDown({duration:0.3,afterFinish:function(){document.fire('scribd:dom_hei ght_changed');document.fire('scribd:info_section:on');}});section.removeClassNam e('closed');}else{content.blindUp({duration:0.3,afterFinish:function(){document. fire('scribd:dom_height_changed');document.fire('scribd:info_section:off');}});s ection.addClassName('closed');}})});}); /* app/views/shared/analytics/_doc_view_pingback.js @ 1319142721 */ if(!window.Scribd){var Scribd={};} Scribd.Pingback={run:function(url){var data={};if(document.referrer){data['refer er']=document.referrer;} new Ajax.Request(url,{method:'post',parameters:data});}}; /* app/views/upload/with_privacy_checkbox/_upload_button_widget.js @ 1319142722 */ if(!Scribd)Scribd=new Object();if(!Scribd.Upload)Scribd.Upload=new Object();if(! Scribd.Upload.WithPrivacyCheckbox)Scribd.Upload.WithPrivacyCheckbox=new Object() ;Scribd.Upload.WithPrivacyCheckbox.UploadButtonWidget=Class.create(Scribd.Upload .UploadButtonWidget,{initialize:function($super,options){$super(options);this.pr ivacy_field_dom_id=options.privacy_field_dom_id;},isPrivate:function(){return!!$ F(this.privacy_field_dom_id);}}); /* app/views/everywhere/_upload_button_widget.js @ 1319142721 */ if(!Scribd)Scribd=new Object();if(!Scribd.Everywhere)Scribd.Everywhere=new Objec t();Scribd.Everywhere.UploadButtonWidget=Class.create(Scribd.Upload.UploadButton Widget,{initialize:function($super,options){$super(options);this.document_collec tion_id=options.document_collection_id;this.post_params.document_collection_id=t his.document_collection_id;}}); /* app/views/shared/sharing/readcast_pro.js @ 1319142721 */ if(!window.Scribd)var Scribd=new Object();if(!Scribd.Readcast)Scribd.Readcast={} ;Scribd.Readcast.Pro={initialize:function(){var that=this;button=$('readcast_pro ').down('.readcast_now_button_pro');button.observe('click',this.submit_readcast. bind(this));$$('#readcast_pro .twitter_link_account').each(function(el){new Scri bd.Twitter.Account(el,{onSuccess:function(){Scribd.Readcast.trackEvent("link acc ount","twitter");el.hide();that.afterLink(el.up('.network_input_pro'),Scribd.Rea dcast.Preferences.checkUnlinked);}});});$$('#readcast_pro .facebook_link_account ').each(function(el){new Scribd.Facebook.Account(el,{onSuccess:function(){Scribd .Readcast.trackEvent("link account","facebook");el.hide();that.afterLink(el.up(' .network_input_pro'),Scribd.Readcast.Preferences.checkUnlinked);}});});},afterLi nk:function(el,cb){this.toCheckbox(el);if(typeof cb==='function')cb();},toCheckb ox:function(el){this.checkBox(el).appear();this.checkSymbol(el).hide();},submit_ readcast:function(e){e.preventDefault();var checked=$$('.network_input_pro input :checked');if(checked.length>0){checked.each(function(el){Scribd.Readcast.Pro.su

bmitEvent(el.up('.pref_item'));});$$('.readcast_complete_pro').invoke('show');}} ,submitEvent:function(el){var that=this;var network=that.extractNetwork(el),ev=S cribd.Readcast.active_events[network];if(ev){if(ev.submitted){that.toDone(el);}e lse{ev.submit(function(){that.toDone(el);});}}},appearOpts:{delay:0.4,duration:0 .5,queue:{position:'end',scope:'readcastControls'}},extractNetwork:function(el){ return el.id.match(/(\w+)_pref/)[1];},checkSymbol:function(el){return el.down('. check');},sendButton:function(el){return el.down('.send');},checkBox:function(el ){return el.down('input[type="checkbox"]');},toDone:function(el){this.checkSymbo l(el).appear(this.appearOpts);var check=this.checkBox(el);if(check)check.hide(); }}; /* app/views/premium/purchases/gate_components/plans_b.js @ 1319142721 */ Scribd.init('Scribd','Premium','Purchases','GateComponents');Scribd.Premium.Purc hases.GateComponents.PlansB=Class.create(Scribd.Shared.JavascriptWidget,{initial ize:function($super,options){$super(options);this.download_plans=options.downloa d_plans;this.parent_dom_id=options.parent_dom_id;},onDomLoaded:function($super,e vent){$super(event);var gate=this;var widget_dom=this.widget_dom;this.payment_ra dios=widget_dom.down('#package_plans').select('input[type="radio"]');widget_dom. down('#one-day-target').observe('click',function(){gate.clickPrice('day');});wid get_dom.down('#monthly-target').observe('click',function(){gate.clickPrice('mont h');});widget_dom.down('#annual-target').observe('click',function(){gate.clickPr ice('year');});$('package_option_day').observe('click',function(){gate.clickPric e('day');});$('package_option_month').observe('click',function(){gate.clickPrice ('month');});$('package_option_year').observe('click',function(){gate.clickPrice ('year');});widget_dom.down('#one-day-picture').observe('click',function(){gate. clickPrice('day');});if($('one-month-picture')){widget_dom.down('#one-month-pict ure').observe('click',function(){gate.clickPrice('month');});} if($('monthly-recurring-picture')){widget_dom.down('#monthly-recurring-picture') .observe('click',function(){gate.clickPrice('month');});} widget_dom.down('#one-year-picture').observe('click',function(){gate.clickPrice( 'year');});if($('billed_monthly')){$('billed_monthly').observe('change',function (){$('one-month-picture').toggle();$('monthly-recurring-picture').toggle();if($( 'monthly-subscription').textContent=='1 Month Pass') $('monthly-subscription').textContent='Monthly Subscription';else $('monthly-subscription').textContent='1 Month Pass';gate.clickPrice('month');}) ;}},parentJavascriptWidget:function(){return $(this.parent_dom_id).javascript_wi dget;},clickPrice:function(duration){var radio=this.widget_dom.down('#package_op tion_'+duration);if(radio&&!radio.disabled)radio.checked=true;var billed_monthly =$('billed_monthly');if(billed_monthly){var container=$('billed_monthly_option') ;if(duration=='month'){billed_monthly.enable();container.removeClassName('disabl ed');}else{billed_monthly.disable();container.addClassName('disabled');}} this.parentJavascriptWidget().planSelected();},selectDefaultPlan:function(){retu rn this.clickPrice('month');},selectedDuration:function(){return this.payment_ra dios.detect(function(radio){return radio.checked;}).value;},selectedPlan:functio n(){var duration=this.selectedDuration();var recurring=false;if(duration=='month '){var billed_monthly=$('billed_monthly');if(billed_monthly){recurring=billed_mo nthly.getValue()=='on';}} var plan=this.download_plans.detect(function(plan){return(plan.duration==duratio n&&plan.recurring==recurring)});return plan;}}); /* app/views/documents/ads_below_sideboard.js @ 1319142721 */ document.observe('dom:loaded',function(){var pinned_ad=$('pinned_ad');var contai ner=$('pinned_ad_container');var page_container=$$('.outer_page_container')[0];v ar is_ie6=!!(document.all&&(/msie 6./i).test(navigator.appVersion)&&window.Activ eXObject);if(!pinned_ad !container) return;var pin,unpin;if(is_ie6){pin=function(){pinned_ad.addClassName('ie_fixed'

);pinned_ad.setStyle({top:(document.viewport.getScrollOffsets().top-50)+'px'});} ;unpin=function(){pinned_ad.removeClassName('ie_fixed');pinned_ad.setStyle({top: '0px'});};}else{pin=function(){pinned_ad.addClassName('fixed');};unpin=function( ){pinned_ad.removeClassName('fixed');};} var update_pinning=function(){if(container.viewportOffset().top+pinned_ad.getHei ght()>page_container.viewportOffset().top+page_container.getHeight()){unpin();re turn;} if(container.viewportOffset().top<0) pin();else unpin();};var repin=function(){unpin();update_pinning();};Event.observe(window,' scroll',update_pinning);docManager.addEvent('zoomed',repin);docManager.addEvent( 'enteredFullscreen',unpin);docManager.addEvent('exitedFullscreen',repin);}); /* app/views/shared/_captcha_widget.js @ 1319142721 */ if(!window.Scribd)var Scribd=new Object();if(!window.Scribd.Shared)Scribd.Shared =new Object();Scribd.Shared.CaptchaWidget=Class.create(Scribd.Shared.JavascriptW idget,{initialize:function($super,options){$super(options);this.recaptcha_public _key=options.recaptcha_public_key;this.recaptcha_options=options.recaptcha_optio ns;this.skip_render=options.skip_render;this.is_rendered=false;},renderCaptcha:f unction(){if(!this.is_rendered){Recaptcha.create(this.recaptcha_public_key,this. widget_dom_id,this.recaptcha_options);this.is_rendered=true;}},onDomLoaded:funct ion($super,event){$super(event);if(!this.skip_render){this.renderCaptcha();}}}); /* app/views/timeline_events/events.js @ 1319142721 */ Scribd.init('Scribd','Timeline');Scribd.Timeline.Paginator=Class.create({initial ize:function(options){this.url=options.url;this.event_observer=$(options.event_o bserver document);this.current_page=options.page 1;this.per_page=options.per_p age;this.method=this.method 'GET';this.loading=false;this.user_id=options.user_ id;this.event_id=options.event_id;this.timestamp=options.timestamp;},gotoNextPag e:function(){this.gotoPage(this.current_page+1);},gotoPage:function(page){page=p age this.current_page;var that=this;var previous_page=that.current_page;this._f etchPage(page,function(){that.event_observer.fire('scribd:timeline:paginator:pag e_loading',{current_page:that.current_page,next_page:page});},function(resp){var json=resp.responseJSON;that.current_page=page;that.event_id=json.event_id;that. timestamp=json.timestamp;var items_count=json.items_count?parseInt(json.items_co unt):0;that.event_observer.fire('scribd:timeline:paginator:page_loaded',{current _page:that.current_page,previous_page:previous_page,page_content:json.page_conte nt,items_count:items_count,more_pages:items_count>0});},function(){that.event_ob server.fire('scribd:timeline:paginator:page_load_failed',{current_page:that.curr ent_page,previous_page:previous_page});});},_fetchPage:function(page,startCallba ck,successCallback,failCallback){var that=this;if(!this.loading){new Ajax.Reques t(this.url,{parameters:this._requestParams(),method:this.method,onCreate:functio n(resp){that.loading=true;startCallback(resp);},onComplete:function(){that.loadi ng=false;},onSuccess:successCallback,onFailure:failCallback,onException:function (request,exception){Scribd.logError('Ajax Exeception in Scribd.Timeline.Paginato r#_fetchPage',exception);}});}},_requestParams:function(page){var params={'page' :page,format:'json'};if(this.event_id)params.event_id=this.event_id;if(this.time stamp)params.timestamp=this.timestamp;if(this.user_id)params.user_id=this.user_i d;if(this.per_page)params.per_page=this.per_page;return params;}}); /* app/views/shared/facebook/session.js @ 1319142721 */ if(!window.Scribd)var Scribd=new Object();Scribd.FacebookSession={getUserId:func tion(){var authResponse=FB.getAuthResponse();if(authResponse){return authRespons e.userID;}},correct:function(){if(!facebookUser (typeof facebookUserId==='undef

ined'))return false;return this.getUserId()==facebookUserId;},verifyExec:functio n(fn,force){if(!facebookUser)return;var that=this;if(!that.correct()){if(force){ FB.getLoginStatus(function(response){var authResponse=response.authResponse;if(a uthResponse){FB.logout(function(response){FB.login(function(response){that.withV alid(fn);});});}else{FB.login(function(response){that.withValid(fn);});}});}}els e{fn();}},ensureValid:function(fn){this.verifyExec(fn,true);},withValid:function (fn){this.verifyExec(fn,false);}}; /* app/views/shared/share_bar/share_bar.js @ 1319142721 */ Scribd.init('Scribd','ShareBar');Scribd.ShareBar.Status={initialize:function(opt ions){if(options===undefined options===null){options.maxLength=400;} this.options=options;this.container=$(options.container);this.charCount=this.con tainer.down('.count .number');this.textarea=this.container.down('.input_wrap tex tarea');var ta=$$('.share_bar_container .input_wrap textarea').first();if(!ta){r eturn;} this.setupDefaultText.bind(this)(ta);this.setupBindings.bind(this)(ta);},setupDe faultText:function(el){Scribd.addDefaultTextEvents(el,this.defaultText,this.upda teCharCount.bind(this));},/*<sl:translate>*/ defaultText:"Comparta lo que est leyendo...",doneText:'Readcast completo!',/*</sl:tr anslate>*/ setupBindings:function(el){var wrap=el.up('.input_wrap');el.observe('focus',func tion(e){new Effect.Morph(wrap,{style:'height: 105px;',duration:0.5});new Effect. Morph(el,{style:'height: 3em;',duration:0.3});this.updateCharCount();}.bind(this ));function maybeCollapse(){var value=$F(el);if(value===this.defaultText value= ==this.doneText value===''){new Effect.Morph(wrap,{style:'height: 19px;',durati on:0.3});new Effect.Morph(el,{style:'height: 1.1em;',duration:0.3});}} document.observe('click',function(e){if(e.findElement('.input_wrap')){return;} maybeCollapse.bind(this)();}.bind(this));document.observe('Scribd:collapseShare' ,maybeCollapse.bind(this));$('submit_status').observe('click',this.handleSubmit. bind(this));this.textarea.observe('change',this.updateCharCount.bind(this));this .textarea.observe('keyup',this.updateCharCount.bind(this));this.updateCharCount( );},updateCharCount:function(e){var val=$F(this.textarea);var left=this.options. maxLength-val.length;if(left<0){this.textarea.setValue(val.slice(0,this.options. maxLength));left=0;} this.charCount.update(left);},handleSubmit:function(e){e.stop();var that=this,sp inner=$('status_spinner'),ipt=$('status_text'),form=$('status_form'),wrap=ipt.up ('.input_wrap'),text=$F(ipt).strip();if(text===that.defaultText text===that.don eText text===''){return;} function readcastComplete(){ipt.addClassName('inactive');ipt.value=that.doneText ;document.fire('Scribd:collapseShare');new Effect.Morph(wrap,{style:'backgroundcolor: #eaffd5;',duration:0.8});setTimeout(function(){new Effect.Morph(wrap,{sty le:'background-color: #f2faff;',duration:0.6});ipt.value=that.defaultText;},2000 );} new Ajax.Request(form.action,{method:'post',parameters:Form.serialize(form,true) ,onSuccess:function(trans){var container=$$('.timeline').first();container.inser t({top:trans.responseText});readcastComplete();document.fire('Scribd:dom_updated ');var new_event=container.down('.event');setTimeout(function(){new_event.appear ({duration:1,queue:'end'});},1200);},onFailure:function(){},onCreate:function(){ spinner.show();},onComplete:function(){spinner.hide();}});}};Scribd.ShareBar.Upl oad={initialize:function(){this.setupBindings();},setupBindings:function(){var b utton=$('share_bar_upload_button');if(!button){return;} button.observe('mousemove',function(){button.addClassName('hover');});button.obs erve('mouseleave',function(){button.removeClassName('hover');});button.observe(' mousedown',function(){button.removeClassName('hover');button.addClassName('activ e');});button.observe('mouseup',function(){button.removeClassName('active');});d ocument.observe('mousemove',function(e){if(e.findElement('#share_bar_upload_butt on')){return;} button.removeClassName('active');});}};

/* app/views/conversion_feedback/new.js @ 1319142721 */ if(!window.Scribd)var Scribd=new Object();Scribd.ConversionFeedback=Class.create ({initialize:function(options){var widget_dom_id=options.widget_dom_id;var alert _success_id=widget_dom_id+"_alert_success";var alert_warning_id=widget_dom_id+"_ alert_warning";document.observe("dom:loaded",function(){new Form.Observer('new_c onversion_feedback',0.3,function(form,value){$('conversion_feedback_description' ).disabled=$('conversion_feedback_inaccuracies_false').checked});Event.observe(d ocument.forms['new_conversion_feedback'],'submit',function(event){event.stop();v ar description=($('conversion_feedback_description').getValue() '').strip();var inaccuracies=$('conversion_feedback_inaccuracies_true').checked;if(inaccuracies &&description.empty()){Scribd.Alerts.error(alert_warning_id,"Please describe wha t the document should look like.");}else{var form=$('new_conversion_feedback').r equest({onComplete:function(req){Scribd.Alerts.success(alert_success_id,"Thanks! ",{"element_to_fade":widget_dom_id,"duration":1,"delay":2});}});};});});}}); /* app/views/shared/people/search_box.js @ 1319142721 */ Scribd.init('Scribd','Shared','People');Scribd.Shared.People.SearchBox=Class.cre ate(Scribd.Shared.JavascriptWidget,{/*<sl:translate>*/ defaultTexts:{profile:'Explorar este perfil...',content:'Explorar mi contenido.. .'},/*</sl:translate>*/ initialize:function($super,options){$super(options);this.text=this.defaultTexts[ options.default_text_type] this.defaultTexts['profile'];},onDomLoaded:function( $super,event){$super(event);searchInput=this.widget_dom.select('.search_input'). first();if(!searchInput){return;} var val=$F(searchInput);if(val&&val!==this.text){return;} Scribd.addDefaultTextEvents(searchInput,this.text);}}); /* app/views/user_collections/manage.js @ 1319142722 */ Scribd.init('Scribd','UserCollections','Manage');Scribd.UserCollections.Manage=C lass.create({initialize:function(options){this.widget_dom_id=options.widget_dom_ id;this.widget_dom=$(this.widget_dom_id);this.collectings_container_id=options.c ollectings_container_id;this.collectings_container=$(this.collectings_container_ id);this.on_reorder_url=options.on_reorder_url;this.authenticity_token=options.a uthenticity_token;this.last_modified_collecting=null;this.last_top_collecting=th is.topCollecting();document.observe('dom:loaded',function(){this.initializeSorta ble();this.initializeCollectingsContainerEvents();}.bind(this));},initializeSort able:function(){Sortable.create(this.collectings_container_id,{elements:this.col lectingContainers(),handles:this.collectingMoveHandles(),only:'collecting_contai ner',tag:'div',handle:'move_link',onChange:this.updateLastModifiedCollecting.bin d(this),onUpdate:this.onReorder.bind(this,{onLoading:function(){this.updateTopCo llecting();this.updateZebraStripes();this.last_modified_collecting.down('.move_l ink').hide();this.last_modified_collecting.down('.spinner').show();}.bind(this), onComplete:function(){this.last_modified_collecting.down('.spinner').hide();this .last_modified_collecting.down('.move_link').show();}.bind(this)})});},initializ eCollectingsContainerEvents:function(){this.collectings_container.observe('click ',function(e){e.stop();var clicked=e.element();if(clicked.hasClassName('send_to_ top_link')){this.sendToTop(clicked);}}.bindAsEventListener(this));},highlightLas tModifiedCollecting:function(){this.last_modified_collecting.highlight({startcol or:'#eaffd5',duration:1.2,afterFinish:function(effect){effect.element.setStyle({ backgroundColor:''});}});},updateLastModifiedCollecting:function(collecting_cont ainer){this.last_modified_collecting=collecting_container;},updateLastTopCollect ing:function(){this.last_top_collecting=this.topCollecting();},lastModifiedColle ctingIsTop:function(){return(this.last_modified_collecting==this.topCollecting()

);},lastModifiedCollectingWasTop:function(){return(this.last_modified_collecting ==this.last_top_collecting);},topCollecting:function(){return this.collectings_c ontainer.down('.collecting_container');},collectingContainers:function(){return $$('#'+this.collectings_container_id+' div.collecting_container');},collectingMo veHandles:function(){return $$('#'+this.collectings_container_id+' div.collectin g_container div.collecting_move a.move_link');},sendToTop:function(sent_link){va r sent=sent_link.up('.collecting_container');var link=sent.down('.collecting_sen d_to_top').down('.send_to_top_link');var spinner=sent.down('.collecting_send_to_ top').down('.spinner');link.hide();spinner.show();this.updateLastModifiedCollect ing(sent);this.onReorder({collectings_order:this.postSentToTopSortableSerialize( sent),onComplete:function(){sent.remove();var collectings=this.collectings_conta iner;collectings.insert({top:sent});spinner.hide();link.show();this.updateTopCol lecting();this.updateZebraStripes();}.bind(this)});},postSentToTopSortableSerial ize:function(sent){var current_ordering=Sortable.serialize(this.collectings_cont ainer_id);var sent_collecting_id=sent.id.gsub(/\D/,'');var sent_regexp=new RegEx p(this.collectings_container_id+"\\[\\]="+sent_collecting_id+'&?');var ordering_ minus_sent=current_ordering.sub(sent_regexp,'');var post_sent_ordering=this.coll ectings_container_id+'[]='+sent_collecting_id+'&'+ordering_minus_sent;return pos t_sent_ordering;},onReorder:function(options){var collectings_order=options.coll ectings_order Sortable.serialize(this.collectings_container_id);var onLoadingCa llback=function(){this.disableUI();if(options.onLoading)options.onLoading();} var onCompleteCallback=function(response){if(options.onComplete)options.onComple te();this.updateLastTopCollecting();this.highlightLastModifiedCollecting();this. enableUI();} this.updateServerOrder(collectings_order,onLoadingCallback,onCompleteCallback);} ,updateServerOrder:function(collectings_order,onLoadingCallback,onCompleteCallba ck){new Ajax.Request(this.on_reorder_url,{asynchronous:true,evalScripts:true,met hod:'put',parameters:collectings_order+'&authenticity_token='+encodeURIComponent (this.authenticity_token),onLoading:onLoadingCallback.bind(this),onComplete:onCo mpleteCallback.bind(this)});},updateTopCollecting:function(){var old_top=this.co llectings_container.down('.top_collecting_container');var new_top=this.collectin gs_container.down('.collecting_container');old_top.removeClassName('top_collecti ng_container');new_top.addClassName('top_collecting_container');},updateZebraStr ipes:function(){var containers=this.collectingContainers();var partitioned=conta iners.partition(function(container,index){return index%2==1});var light=partitio ned[0];var dark=partitioned[1];light.invoke('addClassName','light_stripe');light .invoke('removeClassName','dark_stripe');dark.invoke('addClassName','dark_stripe ');dark.invoke('removeClassName','light_stripe');},disableUI:function(){var cove r=new Element('div',{'class':'disabled_cover'});cover.clonePosition(this.collect ings_container,{setLeft:false,setTop:false});this.collectings_container.insert(c over);},enableUI:function(){this.collectings_container.down('.disabled_cover').r emove();}}); /* app/views/credit_cards/new_iframe.js @ 1319142721 */ Scribd.init('Scribd','CreditCards');Scribd.CreditCards.NewIframe={init:function( el){this.el=$(el);if($('billing_address_country')){if($('billing_address_country ').value!='United States'){$('credit_card_zip_label').innerHTML="Postal Code";$( 'credit_card_state_section').hide();$('billing_address_state').value='';} $('billing_address_country').observe('change',function(){var country=$('billing_ address_country').value;if(country=='United States'){$('credit_card_zip_label'). innerHTML="Zip Code";$('credit_card_state_section').show();} else{$('credit_card_zip_label').innerHTML="Postal Code";$('credit_card_state_sec tion').hide();$('billing_address_state').value='';}});} this.el.down('.submit_section input').observe('click',function(e){this.el.down(' .submit_section .spinner').show();}.bind(this));}}; /* app/views/premium/purchases/gate_components/plans_d.js @ 1319142721 */

Scribd.init('Scribd','Premium','Purchases','GateComponents');Scribd.Premium.Purc hases.GateComponents.PlansD=Class.create(Scribd.Shared.JavascriptWidget,{initial ize:function($super,options){$super(options);this.download_plans=options.downloa d_plans;this.default_duration=options.default_duration;this.parent_dom_id=option s.parent_dom_id;},onDomLoaded:function($super,event){$super(event);this.payment_ radios=this.widget_dom.down('#package_plans').select('input[type="radio"]');var plans=this;$$('.package_container').each(function(c){c.observe('click',function( ){plans.selectPlan(c.readAttribute('duration'));});});},parentJavascriptWidget:f unction(){return $(this.parent_dom_id).javascript_widget;},selectPlan:function(d uration){var radio=this.widget_dom.down('#package_option_'+duration);if(radio&&! radio.disabled)radio.checked=true;this.parentJavascriptWidget().planSelected();} ,selectDefaultPlan:function(){return this.selectPlan(this.default_duration);},se lectedDuration:function(){return this.payment_radios.detect(function(radio){retu rn radio.checked;}).value;},selectedPlan:function(){var duration=this.selectedDu ration();var plan=this.download_plans.detect(function(plan){return(plan.duration ==duration)});return plan;}}); /* app/views/shared/user_collections/form.js @ 1319142721 */ if(!window.Scribd)var Scribd=new Object();Scribd.enableUserCollectionForm=functi on(){var M=Scribd.UserCollectionsManager;Scribd.ajaxUserCollectionForm({form:'ne w_user_collection',reveal:true,params:function(){var params={format:'json',user_ id:$('lightbox_user_collections').down('.user_collections_container').retrieve(' user_id')} return params;},success:function(json,params){var user_id=params.user_id;var new _collection=new Element('div').update(M.collection_template.evaluate(M.rendering CollectionAttributes(user_id,json.user_collection))).down('li.user_collection'); M.storeCollections(user_id,[json.user_collection]);M.attachEvent(user_id,new_col lection);$$('.manage_collection .add_to_my_collections').each(function(container ){container.insert({'top':new_collection});});}});M.addPaginationEvent();};Scrib d.ajaxUserCollectionForm=function(options){var form=$(options.form);var spinner= spinner form.down('.spinner');var error_container=$(error_container) form.down ('.error');var form_container=options.form_container form.up();var method=optio ns.method 'post';var clickable_header=$(options.clickable_header) form_contain er.down('.form_header');var name_input=form.down('#user_collection_name');var ne w_name_message="Enter a name for your new group..." function reset(){form.reset();if(form_container&&options.reveal){name_input.setV alue(new_name_message);} form_container&&form_container.removeClassName('user_collection_form_container_o pen') error_container&&error_container.update('');} if($('dynamic_privacy_explanation')){explanationTextContainer=$('dynamic_privacy _explanation');explanationSelector=$('user_collection_combined_privacy_type');ex planationTextContainer.innerHTML=getExplanation(explanationSelector);explanation Selector.observe('change',function(e){e.stop();explanationTextContainer.innerHTM L=getExplanation(this);});} function getExplanation(explanationSelector){switch(explanationSelector.value){c ase"public - locked":return"Only you can add to this group, but others can view it";case"public - moderated":return"Others can add to this group, but you approv e or reject additions";case"private":return"Only you can add to this group, and only you will be able to view it";default:return"";}} form.observe('submit',function(e){e.stop();var params=Object.isFunction(options. params)?options.params(form):options.params;if(options.reveal&&name_input.getVal ue()===new_name_message){name_input.setValue('');} form.request({'method':method,parameters:(params),onCreate:function(){form.disab le();spinner&&spinner.show();},onComplete:function(){form.enable();spinner&&spin ner.hide();},onSuccess:function(response){var json=response.responseJSON;switch( json.status){case'ok':options.success&&options.success(json,params)

options.reset?options.reset(form):reset();return;case'error':options.error&&opti ons.error(json,params);error_container&&Scribd.Alerts.error(error_container,json .message)}}});});var cancel=form.down('a.cancel');if(cancel){cancel.observe('cli ck',function(e){e.stop();options.reset?options.reset(form):reset();})} if(form_container&&options.reveal){name_input.setValue(new_name_message);name_in put.observe('focus',function(e){form_container.addClassName('user_collection_for m_container_open');if(name_input.getValue()===new_name_message){name_input.setVa lue('');}});name_input.observe('blur',function(e){if(name_input.getValue().strip ()===''){name_input.setValue(new_name_message);}});} if(clickable_header){clickable_header.observe('click',function(){form_container. toggleClassName('user_collection_form_container_open');});}};

Вам также может понравиться