/* :asset_packager_compatibility, 'config/asset_packages.yml' @ 1305154393 */
/* public/javascripts/prototype_uncompressed.js @ 1305154393 */

var Prototype={Version:'1.6.1',Browser:(function(){var ua=navigator.userAgent;var 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,SelectorsAPI:!!document.querySelector,ElementExtensions:(function(){var constructor=window.Element||window.HTMLElement;return!!(constructor&&constructor.prototype);})(),SpecificElementExtensions:(function(){if(typeof window.HTMLDivElement!=='undefined')
return true;var div=document.createElement('div');var form=document.createElement('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 Try={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 create(){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=[];if(parent){subclass.prototype=parent.prototype;klass.prototype=new subclass;parent.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=klass;return klass;}
function addMethods(source){var ancestor=this.superclass&&this.superclass.prototype;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],value=source[property];if(ancestor&&Object.isFunction(value)&&value.argumentNames().first()=="$super"){var method=value;value=(function(m){return function(){return ancestor[m].apply(this,arguments);};})(property).wrap(method);value.valueOf=method.valueOf.bind(method);value.toString=method.toString.bind(method);}
this.prototype[property]=value;}
return this;}
return{create:create,Methods:{addMethods:addMethods}};})();(function(){var _toString=Object.prototype.toString;function extend(destination,source){for(var property 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(isElement(object))return;var results=[];for(var property in object){var value=toJSON(object[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.interpret(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:toQueryString,toHTML:toHTML,keys:keys,values:values,clone:clone,isElement:isElement,isArray:isArray,isHash:isHash,isFunction:isFunction,isString:isString,isNumber:isNumber,isUndefined:isUndefined});})();Object.extend(Function.prototype,(function(){var slice=Array.prototype.slice;function update(array,args){var arrayLength=array.length,length=args.length;while(length--)array[arrayLength+length]=args[length];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]))return 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(arguments,1);return function(event){var a=update([event||window.event],args);return __method.apply(context,a);}}
function curry(){if(!arguments.length)return this;var __method=this,args=slice.call(arguments,0);return function(){var a=merge(args,arguments);return __method.apply(this,a);}}
function delay(timeout){var __method=this,args=slice.call(arguments,1);timeout=timeout*1000
return window.setTimeout(function(){return __method.apply(__method,args);},timeout);}
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([__method.bind(this)],arguments);return wrapper.apply(this,a);}}
function methodize(){if(this._methodized)return this._methodized;var __method=this;return this._methodized=function(){var a=update([this],arguments);return __method.apply(null,a);};}
return{argumentNames:argumentNames,bind:bind,bindAsEventListener:bindAsEventListener,curry:curry,delay:delay,defer:defer,wrap:wrap,methodize:methodize}})());Date.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.prototype.test;RegExp.escape=function(str){return String(str).replace(/([.*+?^=!:${}()|[\]\/\\])/g,'\\$1');};var PeriodicalExecuter=Class.create({initialize:function(callback,frequency){this.callback=callback;this.frequency=frequency;this.currentlyExecuting=false;this.registerCallback();},registerCallback:function(){this.timer=setInterval(this.onTimerEvent.bind(this),this.frequency*1000);},execute:function(){this.callback(this);},stop:function(){if(!this.timer)return;clearInterval(this.timer);this.timer=null;},onTimerEvent:function(){if(!this.currentlyExecuting){try{this.currentlyExecuting=true;this.execute();this.currentlyExecuting=false;}catch(e){this.currentlyExecuting=false;throw e;}}}});Object.extend(String,{interpret: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=prepareReplacement(replacement);if(Object.isString(pattern))
pattern=RegExp.escape(pattern);if(!(pattern.length||pattern.source)){replacement=replacement('');return replacement+source.split('').join(replacement)+replacement;}
while(source.length>0){if(match=source.match(pattern)){result+=source.slice(0,match.index);result+=String.interpret(replacement(match));source=source.slice(match.index+match[0].length);}else{result+=source,source='';}}
return result;}
function sub(pattern,replacement,count){replacement=prepareReplacement(replacement);count=Object.isUndefined(count)?1:count;return this.gsub(pattern,function(match){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.isUndefined(truncation)?'...':truncation;return this.length>length?this.slice(0,length-truncation.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(matchAll)||[]).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;').replace(/>/g,'&gt;');}
function unescapeHTML(){return this.stripTags().replace(/&lt;/g,'<').replace(/&gt;/g,'>').replace(/&amp;/g,'&');}
function toQueryParams(separator){var match=this.strip().match(/([^?#]*)(#.*)?$/);if(!match)return{};return match[1].split(separator||'&').inject({},function(hash,pair){if((pair=pair.split('='))[0]){var key=decodeURIComponent(pair.shift());var value=pair.length>1?pair.join('='):pair[0];if(value!=undefined)value=decodeURIComponent(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()+parts[0].substring(1):parts[0];for(var i=1;i<len;i++)
camelized+=parts[i].charAt(0).toUpperCase()+parts[i].substring(1);return camelized;}
function capitalize(){return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase();}
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.specialChar[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.lastIndexOf(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,extractScripts:extractScripts,evalScripts:evalScripts,escapeHTML:escapeHTML,unescapeHTML:unescapeHTML,toQueryParams:toQueryParams,parseQuery:toQueryParams,toArray:toArray,succ:succ,times:times,camelize:camelize,capitalize:capitalize,underscore:underscore,dasherize:dasherize,inspect:inspect,toJSON:toJSON,unfilterJSON:unfilterJSON,isJSON:isJSON,evalJSON:evalJSON,include:include,startsWith:startsWith,endsWith:endsWith,empty:empty,blank:blank,interpolate:interpolate};})());var Template=Class.create({initialize:function(template,pattern){this.template=template.toString();this.pattern=pattern||Template.Pattern;},evaluate:function(object){if(object&&Object.isFunction(object.toTemplateReplacements))
object=object.toTemplateReplacements();return this.template.gsub(this.pattern,function(match){if(object==null)return(match[1]+'');var before=match[1]||'';if(before=='\\')return match[2];var ctx=object,expr=match[3];var pattern=/^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;match=pattern.exec(expr);if(match==null)return before;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.substring('['==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){var 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=this.toArray();if(number<1)return array;while((index+=number)<array.length)
slices.push(array.slice(index,index+number));return slices.collect(iterator,context);}
function all(iterator,context){iterator=iterator||Prototype.K;var result=true;this.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;this.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 results=[];if(Object.isString(filter))
filter=new RegExp(RegExp.escape(filter));this.each(function(value,index){if(filter.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=iterator.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.each(function(value,index){value=iterator.call(context,value,index);if(result==null||value>=result)
result=value;});return result;}
function min(iterator,context){iterator=iterator||Prototype.K;var result;this.each(function(value,index){value=iterator.call(context,value,index);if(result==null||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)?trues:falses).push(value);});return[trues,falses];}
function pluck(property){var results=[];this.each(function(value){results.push(value[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{value:value,criteria:iterator.call(context,value,index)};}).sort(function(left,right){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,invoke:invoke,max:max,min:min,partition:partition,pluck:pluck,reject:reject,sortBy:sortBy,toArray:toArray,entries:toArray,zip:zip,size:size,inspect:inspect,find:detect};})();function $A(iterable){if(!iterable)return[];if('toArray'in Object(iterable))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();return 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(function(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==index||(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.toJSON(object);if(!Object.isUndefined(value))results.push(value);});return'['+results.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 item)){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,clear:clear,first:first,last:last,compact:compact,flatten:flatten,without:without,reverse: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)arrayProto.indexOf=indexOf;if(!arrayProto.lastIndexOf)arrayProto.lastIndexOf=lastIndexOf;})();function $H(object){return new Hash(object);};var Hash=Class.create(Enumerable,(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===value;});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 key+'='+encodeURIComponent(String.interpret(value));}
function toQueryString(){return this.inject([],function(results,pair){var key=encodeURIComponent(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(toQueryPair(key,values));return results;}).join('&');}
function inspect(){return'#<Hash:{'+this.map(function(pair){return pair.map(Object.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:toObject,toTemplateReplacements:toObject,keys:keys,values:values,index:index,merge:merge,update:update,toQueryString:toQueryString,inspect:inspect,toJSON:toJSON,clone:clone};})());Hash.from=$H;Object.extend(Number.prototype,(function(){function toColorPart(){return this.toPaddedString(2,16);}
function succ(){return this+1;}
function times(iterator,context){$R(0,this,true).each(iterator,context);return this;}
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:toPaddedString,toJSON:toJSON,abs:abs,round:round,ceil:ceil,floor:floor};})());function $R(start,end,exclusive){return new ObjectRange(start,end,exclusive);}
var ObjectRange=Class.create(Enumerable,(function(){function initialize(start,end,exclusive){this.start=start;this.end=end;this.exclusive=exclusive;}
function _each(iterator){var value=this.start;while(this.include(value)){iterator(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={getTransport:function(){return Try.these(function(){return new XMLHttpRequest()},function(){return new ActiveXObject('Msxml2.XMLHTTP')},function(){return new ActiveXObject('Microsoft.XMLHTTP')})||false;},activeRequestCount:0};Ajax.Responders={responders:[],_each:function(iterator){this.responders._each(iterator);},register:function(responder){if(!this.include(responder))
this.responders.push(responder);},unregister:function(responder){this.responders=this.responders.without(responder);},dispatch:function(callback,request,transport,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({onCreate:function(){Ajax.activeRequestCount++},onComplete:function(){Ajax.activeRequestCount--}});Ajax.Base=Class.create({initialize:function(options){this.options={method:'post',asynchronous:true,contentType:'application/x-www-form-urlencoded',encoding:'UTF-8',parameters:'',evalJSON:true,evalJS:true};Object.extend(this.options,options||{});this.options.method=this.options.method.toLowerCase();if(Object.isString(this.options.parameters))
this.options.parameters=this.options.parameters.toQueryParams();else if(Object.isHash(this.options.parameters))
this.options.parameters=this.options.parameters.toObject();}});Ajax.Request=Class.create(Ajax.Base,{_complete:false,initialize:function($super,url,options){$super(options);this.transport=Ajax.getTransport();this.request(url);},request:function(url){this.url=url;this.method=this.options.method;var params=Object.clone(this.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.onCreate(response);Ajax.Responders.dispatch('onCreate',this,response);this.transport.open(this.method.toUpperCase(),this.url,this.options.asynchronous);if(this.options.asynchronous)this.respondToReadyState.bind(this).defer(1);this.transport.onreadystatechange=this.onStateChange.bind(this);this.setRequestHeaders();this.body=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=this.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':Prototype.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]<2005)
headers['Connection']='close';}
if(typeof this.options.requestHeaders=='object'){var extras=this.options.requestHeaders;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 status=this.getStatus();return!status||(status>=200&&status<300);},getStatus:function(){try{return this.transport.status||0;}catch(e){return 0}},respondToReadyState:function(readyState){var state=Ajax.Request.Events[readyState],response=new Ajax.Response(this);if(state=='Complete'){try{this._complete=true;(this.options['on'+response.status]||this.options['on'+(this.success()?'Success':'Failure')]||Prototype.emptyFunction)(response,response.headerJSON);}catch(e){this.dispatchException(e);}
var contentType=response.getHeader('Content-type');if(this.options.evalJS=='force'||(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.headerJSON);Ajax.Responders.dispatch('on'+state,this,response,response.headerJSON);}catch(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.protocol,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.responseText||'').unfilterJSON());}catch(e){this.dispatchException(e);}},dispatchException:function(exception){(this.options.onException||Prototype.emptyFunction)(this,exception);Ajax.Responders.dispatch('onException',this,exception);}});Ajax.Request.Events=['Uninitialized','Loading','Loaded','Interactive','Complete'];Ajax.Response=Class.create({initialize:function(request){this.request=request;var transport=this.transport=request.transport,readyState=this.readyState=transport.readyState;if((readyState>2&&!Prototype.Browser.IE)||readyState==4){this.status=this.getStatus();this.statusText=this.getStatusText();this.responseText=String.interpret(transport.responseText);this.headerJSON=this._getHeaderJSON();}
if(readyState==4){var xml=transport.responseXML;this.responseXML=Object.isUndefined(xml)?null:xml;this.responseJSON=this._getResponseJSON();}},status:0,statusText:'',getStatus:Ajax.Request.prototype.getStatus,getStatusText:function(){try{return this.transport.statusText||'';}catch(e){return''}},getHeader:Ajax.Request.prototype.getHeader,getAllHeaders:function(){try{return this.getAllResponseHeaders();}catch(e){return null}},getResponseHeader:function(name){return this.transport.getResponseHeader(name);},getAllResponseHeaders:function(){return this.transport.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 options=this.request.options;if(!options.evalJSON||(options.evalJSON!='force'&&!(this.getHeader('Content-type')||'').include('application/json'))||this.responseText.blank())
return null;try{return this.responseText.evalJSON(options.sanitizeJSON||!this.request.isSameOrigin());}catch(e){this.request.dispatchException(e);}}});Ajax.Updater=Class.create(Ajax.Request,{initialize:function($super,container,url,options){this.container={success:(container.success||container),failure:(container.failure||(container.success?null:container))};options=Object.clone(options);var onComplete=options.onComplete;options.onComplete=(function(response,json){this.updateContent(response.responseText);if(Object.isFunction(onComplete))onComplete(response,json);}).bind(this);$super(url,options);},updateContent:function(responseText){var receiver=this.container[this.success()?'success':'failure'],options=this.options;if(!options.evalScripts)responseText=responseText.stripScripts();if(receiver=$(receiver)){if(options.insertion){if(Object.isString(options.insertion)){var insertion={};insertion[options.insertion]=responseText;receiver.insert(insertion);}
else options.insertion(receiver,responseText);}
else receiver.update(responseText);}}});Ajax.PeriodicalUpdater=Class.create(Ajax.Base,{initialize:function($super,container,url,options){$super(options);this.onComplete=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.onComplete=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);},onTimerEvent:function(){this.updater=new Ajax.Updater(this.container,this.url,this.options);}});function $(element){if(arguments.length>1){for(var i=0,elements=[],length=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(expression,parentElement){var results=[];var query=document.evaluate(expression,$(parentElement)||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_NODE: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,DOCUMENT_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=document.documentElement;elInput.setAttribute("name","test");elForm.appendChild(elInput);root.appendChild(elForm);var isBuggy=elForm.elements?(typeof elForm.elements.test=="undefined"):null;root.removeChild(elForm);elForm=elInput=null;return isBuggy;})();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="'+attributes.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);};Object.extend(global.Element,element||{});if(element)global.Element.prototype=element.prototype;})(this);Element.cache={};Element.idCounter=1;Element.Methods={visible:function(element){return $(element).style.display!='none';},toggle:function(element){element=$(element);Element[Element.visible(element)?'hide':'show'](element);return element;},hide:function(element){element=$(element);element.style.display='none';return element;},show:function(element){element=$(element);element.style.display='';return element;},remove:function(element){element=$(element);element.parentNode.removeChild(element);return element;},update:(function(){var SELECT_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{var 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=null;return isBuggy;}}catch(e){return true;}})();var SCRIPT_ELEMENT_REJECTS_TEXTNODE_APPENDING=(function(){var s=document.createElement("script"),isBuggy=false;try{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);if(content&&content.toElement)
content=content.toElement();if(Object.isElement(content))
return element.update().insert(content);content=Object.toHTML(content);var tagName=element.tagName.toUpperCase();if(tagName==='SCRIPT'&&SCRIPT_ELEMENT_REJECTS_TEXTNODE_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.removeChild(element.firstChild);}
Element._getContentFromAnonymousElement(tagName,content.stripScripts()).each(function(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(content&&content.toElement)content=content.toElement();else if(!Object.isElement(content)){content=Object.toHTML(content);var range=element.ownerDocument.createRange();range.selectNode(element);content.evalScripts.bind(content).defer();content=range.createContextualFragment(content.stripScripts());}
element.parentNode.replaceChild(content,element);return element;},insert:function(element,insertions){element=$(element);if(Object.isString(insertions)||Object.isNumber(insertions)||Object.isElement(insertions)||(insertions&&(insertions.toElement||insertions.toHTML)))
insertions={bottom:insertions};var content,insert,tagName,childNodes;for(var position 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._getContentFromAnonymousElement(tagName,content.stripScripts());if(position=='top'||position=='after')childNodes.reverse();childNodes.each(insert.curry(element));content.evalScripts.bind(content).defer();}
return element;},wrap:function(element,wrapper,attributes){element=$(element);if(Object.isElement(wrapper))
$(wrapper).writeAttribute(attributes||{});else if(Object.isString(wrapper))wrapper=new Element(wrapper,attributes);else wrapper=new Element('div',wrapper);if(element.parentNode)
element.parentNode.replaceChild(wrapper,element);wrapper.appendChild(element);return wrapper;},inspect:function(element){element=$(element);var result='<'+element.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 result+'>';},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(element){return Element.recursivelyCollect(element,'parentNode');},descendants:function(element){return Element.select(element,"*");},firstDescendant:function(element){element=$(element).firstChild;while(element&&element.nodeType!=1)element=element.nextSibling;return $(element);},immediateDescendants:function(element){if(!(element=$(element).firstChild))return[];while(element&&element.nodeType!=1)element=element.nextSibling;if(element)return[element].concat($(element).nextSiblings());return[];},previousSiblings:function(element){return Element.recursivelyCollect(element,'previousSibling');},nextSiblings:function(element){return Element.recursivelyCollect(element,'nextSibling');},siblings:function(element){element=$(element);return Element.previousSiblings(element).reverse().concat(Element.nextSiblings(element));},match:function(element,selector){if(Object.isString(selector))
selector=new Selector(selector);return selector.match($(element));},up:function(element,expression,index){element=$(element);if(arguments.length==1)return $(element.parentNode);var ancestors=Element.ancestors(element);return Object.isNumber(expression)?ancestors[expression]:Selector.findElement(ancestors,expression,index);},down:function(element,expression,index){element=$(element);if(arguments.length==1)return Element.firstDescendant(element);return Object.isNumber(expression)?Element.descendants(element)[expression]:Element.select(element,expression)[index||0];},previous:function(element,expression,index){element=$(element);if(arguments.length==1)return $(Selector.handlers.previousElementSibling(element));var previousSiblings=Element.previousSiblings(element);return Object.isNumber(expression)?previousSiblings[expression]:Selector.findElement(previousSiblings,expression,index);},next:function(element,expression,index){element=$(element);if(arguments.length==1)return $(Selector.handlers.nextElementSibling(element));var nextSiblings=Element.nextSiblings(element);return Object.isNumber(expression)?nextSiblings[expression]:Selector.findElement(nextSiblings,expression,index);},select:function(element){var args=Array.prototype.slice.call(arguments,1);return Selector.findChildElements(element,args);},adjacent:function(element){var args=Array.prototype.slice.call(arguments,1);return Selector.findChildElements(element.parentNode,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);return id;},readAttribute:function(element,name){element=$(element);if(Prototype.Browser.IE){var t=Element._attributeTranslations.read;if(t.values[name])return t.values[name](element,name);if(t.names[name])name=t.names[name];if(name.include(':')){return(!element.attributes||!element.attributes[name])?null:element.attributes[name].value;}}
return element.getAttribute(name);},writeAttribute:function(element,name,value){element=$(element);var attributes={},t=Element._attributeTranslations.write;if(typeof name=='object')attributes=name;else attributes[name]=Object.isUndefined(value)?true:value;for(var attr in attributes){name=t.names[attr]||attr;value=attributes[attr];if(t.values[attr])name=t.values[attr](element,value);if(value===false||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(element).height;},getWidth:function(element){return Element.getDimensions(element).width;},classNames:function(element){return new Element.ClassNames(element);},hasClassName:function(element,className){if(!(element=$(element)))return;var elementClassName=element.className;return(elementClassName.length>0&&(elementClassName==className||new RegExp("(^|\\s)"+className+"(\\s|$)").test(elementClassName)));},addClassName:function(element,className){if(!(element=$(element)))return;if(!Element.hasClassName(element,className))
element.className+=(element.className?' ':'')+className;return element;},removeClassName:function(element,className){if(!(element=$(element)))return;element.className=element.className.replace(new RegExp("(^|\\s+)"+className+"(\\s+|$)"),' ').strip();return element;},toggleClassName:function(element,className){if(!(element=$(element)))return;return Element[Element.hasClassName(element,className)?'removeClassName':'addClassName'](element,className);},cleanWhitespace:function(element){element=$(element);var node=element.firstChild;while(node){var nextNode=node.nextSibling;if(node.nodeType==3&&!/\S/.test(node.nodeValue))
element.removeChild(node);node=nextNode;}
return element;},empty:function(element){return $(element).innerHTML.blank();},descendantOf:function(element,ancestor){element=$(element),ancestor=$(ancestor);if(element.compareDocumentPosition)
return(element.compareDocumentPosition(ancestor)&8)===8;if(ancestor.contains)
return ancestor.contains(element)&&ancestor!==element;while(element=element.parentNode)
if(element==ancestor)return true;return false;},scrollTo:function(element){element=$(element);var pos=Element.cumulativeOffset(element);window.scrollTo(pos[0],pos[1]);return element;},getStyle:function(element,style){element=$(element);style=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');},setStyle:function(element,styles){element=$(element);var elementStyle=element.style,match;if(Object.isString(styles)){element.style.cssText+=';'+styles;return styles.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(elementStyle.styleFloat)?'cssFloat':'styleFloat'):property]=styles[property];return element;},setOpacity:function(element,value){element=$(element);element.style.opacity=(value==1||value==='')?'':(value<0.00001)?0:value;return element;},getDimensions: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.style;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.clientWidth;var originalHeight=element.clientHeight;els.display=originalDisplay;els.position=originalPosition;els.visibility=originalVisibility;return{width:originalWidth,height:originalHeight};},makePositioned:function(element){element=$(element);var pos=Element.getStyle(element,'position');if(pos=='static'||!pos){element._madePositioned=true;element.style.position='relative';if(Prototype.Browser.Opera){element.style.top=0;element.style.left=0;}}
return element;},undoPositioned:function(element){element=$(element);if(element._madePositioned){element._madePositioned=undefined;element.style.position=element.style.top=element.style.left=element.style.bottom=element.style.right='';}
return element;},makeClipping:function(element){element=$(element);if(element._overflow)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=element._overflow=='auto'?'':element._overflow;element._overflow=null;return element;},cumulativeOffset:function(element){var valueT=0,valueL=0;do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;element=element.offsetParent;}while(element);return Element._returnOffset(valueL,valueT);},positionedOffset:function(element){var valueT=0,valueL=0;do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;element=element.offsetParent;if(element){if(element.tagName.toUpperCase()=='BODY')break;var p=Element.getStyle(element,'position');if(p!=='static')break;}}while(element);return Element._returnOffset(valueL,valueT);},absolutize: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);element._originalTop=top-parseFloat(element.style.top||0);element._originalWidth=element.style.width;element._originalHeight=element.style.height;element.style.position='absolute';element.style.top=top+'px';element.style.left=left+'px';element.style.width=width+'px';element.style.height=height+'px';return element;},relativize:function(element){element=$(element);if(Element.getStyle(element,'position')=='relative')return element;element.style.position='relative';var top=parseFloat(element.style.top||0)-(element._originalTop||0);var left=parseFloat(element.style.left||0)-(element._originalLeft||0);element.style.top=top+'px';element.style.left=left+'px';element.style.height=element._originalHeight;element.style.width=element._originalWidth;return element;},cumulativeScrollOffset:function(element){var valueT=0,valueL=0;do{valueT+=element.scrollTop||0;valueL+=element.scrollLeft||0;element=element.parentNode;}while(element);return Element._returnOffset(valueL,valueT);},getOffsetParent:function(element){if(element.offsetParent)return $(element.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;valueL+=element.offsetLeft||0;if(element.offsetParent==document.body&&Element.getStyle(element,'position')=='absolute')break;}while(element=element.offsetParent);element=forElement;do{if(!Prototype.Browser.Opera||(element.tagName&&(element.tagName.toUpperCase()=='BODY'))){valueT-=element.scrollTop||0;valueL-=element.scrollLeft||0;}}while(element=element.parentNode);return Element._returnOffset(valueL,valueT);},clonePosition:function(element,source){var options=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arguments[2]||{});source=$(source);var p=Element.viewportOffset(source);element=$(element);var delta=[0,0];var parent=null;if(Element.getStyle(element,'position')=='absolute'){parent=Element.getOffsetParent(element);delta=Element.viewportOffset(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(options.setWidth)element.style.width=source.offsetWidth+'px';if(options.setHeight)element.style.height=source.offsetHeight+'px';return element;}};Object.extend(Element.Methods,{getElementsBySelector:Element.Methods.select,childElements:Element.Methods.immediateDescendants});Element._attributeTranslations={write:{names:{className:'class',htmlFor:'for'},values:{}}};if(Prototype.Browser.Opera){Element.Methods.getStyle=Element.Methods.getStyle.wrap(function(proceed,element,style){switch(style){case'left':case'top':case'right':case'bottom':if(proceed(element,'position')==='static')return null;case'height':case'width':if(!Element.visible(element))return null;var dim=parseInt(proceed(element,style),10);if(dim!==element['offset'+style.capitalize()])
return dim+'px';var properties;if(style==='height'){properties=['border-top-width','padding-top','padding-bottom','border-bottom-width'];}
else{properties=['border-left-width','padding-left','padding-right','border-right-width'];}
return properties.inject(dim,function(memo,property){var val=proceed(element,property);return val===null?memo:memo-parseInt(val,10);})+'px';default:return proceed(element,style);}});Element.Methods.readAttribute=Element.Methods.readAttribute.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.getOffsetParent.wrap(function(proceed,element){element=$(element);try{element.offsetParent}
catch(e){return $(document.body)}
var position=element.getStyle('position');if(position!=='static')return proceed(element);element.setStyle({position:'relative'});var value=proceed(element);element.setStyle({position:position});return value;});$w('positionedOffset viewportOffset').each(function(method){Element.Methods[method]=Element.Methods[method].wrap(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&&offsetParent.getStyle('position')==='fixed')
offsetParent.setStyle({zoom:1});element.setStyle({position:'relative'});var value=proceed(element);element.setStyle({position:position});return value;});});Element.Methods.cumulativeOffset=Element.Methods.cumulativeOffset.wrap(function(proceed,element){try{element.offsetParent}
catch(e){return Element._returnOffset(0,0)}
return proceed(element);});Element.Methods.getStyle=function(element,style){element=$(element);style=(style=='float'||style=='cssFloat')?'styleFloat':style.camelize();var value=element.style[style];if(!value&&element.currentStyle)value=element.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('display')!='none'))
return element['offset'+style.capitalize()]+'px';return null;}
return value;};Element.Methods.setOpacity=function(element,value){function stripAlpha(filter){return filter.replace(/alpha\([^\)]*\)/gi,'');}
element=$(element);var currentStyle=element.currentStyle;if((currentStyle&&!currentStyle.hasLayout)||(!currentStyle&&element.style.zoom=='normal'))
element.style.zoom=1;var filter=element.getStyle('filter'),style=element.style;if(value==1||value===''){(filter=stripAlpha(filter))?style.filter=filter:style.removeAttribute('filter');return element;}else if(value<0.00001)value=0;style.filter=stripAlpha(filter)+'alpha(opacity='+(value*100)+')';return element;};Element._attributeTranslations=(function(){var classProp='className';var forProp='for';var el=document.createElement('div');el.setAttribute(classProp,'x');if(el.className!=='x'){el.setAttribute('class','x');if(el.className==='x'){classProp='class';}}
el=null;el=document.createElement('label');el.setAttribute(forProp,'x');if(el.htmlFor!=='x'){el.setAttribute('htmlFor','x');if(el.htmlFor==='x'){forProp='htmlFor';}}
el=null;return{read:{names:{'class':classProp,'className':classProp,'for':forProp,'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=element.getAttributeNode(attribute);return node?node.value:"";},_getEv:(function(){var el=document.createElement('div');el.onclick=Prototype.emptyFunction;var value=el.getAttribute('onclick');var f;if(String(value).indexOf('{')>-1){f=function(element,attribute){attribute=element.getAttribute(attribute);if(!attribute)return null;attribute=attribute.toString();attribute=attribute.split('{')[1];attribute=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).hasAttribute(attribute)?attribute:null;},style:function(element){return element.style.cssText.toLowerCase();},title:function(element){return element.title;}}}}})();Element._attributeTranslations.write={names:Object.extend({cellpadding:'cellPadding',cellspacing:'cellSpacing'},Element._attributeTranslations.read.names),values:{checked:function(element,value){element.checked=!!value;},style:function(element,value){element.style.cssText=value?value:'';}}};Element._attributeTranslations.has={};$w('colSpan rowSpan vAlign dateTime accessKey tabIndex '+'encType maxLength readOnly longDesc frameBorder').each(function(attr){Element._attributeTranslations.write.names[attr.toLowerCase()]=attr;Element._attributeTranslations.has[attr.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,onreset:v._getEv,onselect:v._getEv,onchange:v._getEv});})(Element._attributeTranslations.read.values);if(Prototype.BrowserFeatures.ElementExtensions){(function(){function _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(arguments.length==1)return element.firstDescendant();return Object.isNumber(expression)?_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.opacity=(value==1)?0.999999:(value==='')?'':(value<0.00001)?0:value;return element;};}
else if(Prototype.Browser.WebKit){Element.Methods.setOpacity=function(element,value){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);element.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(element.offsetParent==document.body)
if(Element.getStyle(element,'position')=='absolute')break;element=element.offsetParent;}while(element);return Element._returnOffset(valueL,valueT);};}
if('outerHTML'in document.documentElement){Element.Methods.replace=function(element,content){element=$(element);if(content&&content.toElement)content=content.toElement();if(Object.isElement(content)){element.parentNode.replaceChild(content,element);return element;}
content=Object.toHTML(content);var parent=element.parentNode,tagName=parent.tagName.toUpperCase();if(Element._insertionTranslations.tags[tagName]){var nextSibling=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){var div=new Element('div'),t=Element._insertionTranslations.tags[tagName];if(t){div.innerHTML=t[0]+html+t[1];t[2].times(function(){div=div.firstChild});}else div.innerHTML=html;return $A(div.childNodes);};Element._insertionTranslations={before:function(element,node){element.parentNode.insertBefore(node,element);},top:function(element,node){element.insertBefore(node,element.firstChild);},bottom:function(element,node){element.appendChild(node);},after:function(element,node){element.parentNode.insertBefore(node,element.nextSibling);},tags:{TABLE:['<table>','</table>',1],TBODY:['<table><tbody>','</tbody></table>',2],TR:['<table><tbody><tr>','</tr></tbody></table>',3],TD:['<table><tbody><tr><td>','</td></tr></tbody></table>',4],SELECT:['<select>','</select>',1]}};(function(){var tags=Element._insertionTranslations.tags;Object.extend(tags,{THEAD:tags.TBODY,TFOOT:tags.TBODY,TH:tags.TD});})();Element.Methods.Simulated={hasAttribute:function(element,attribute){attribute=Element._attributeTranslations.has[attribute]||attribute;var node=$(element).getAttributeNode(attribute);return!!(node&&node.specified);}};Element.Methods.ByTag={};Object.extend(Element,Element.Methods);(function(div){if(!Prototype.BrowserFeatures.ElementExtensions&&div['__proto__']){window.HTMLElement={};window.HTMLElement.prototype=div['__proto__'];Prototype.BrowserFeatures.ElementExtensions=true;}
div=null;})(document.createElement('div'))
Element.extend=(function(){function checkDeficiency(tagName){if(typeof window.Element!='undefined'){var proto=window.Element.prototype;if(proto){var id='_'+(Math.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 value=methods[property];if(Object.isFunction(value)&&!(property in element))
element[property]=value.methodize();}}
var HTMLOBJECTELEMENT_PROTOTYPE_BUGGY=checkDeficiency('object');if(Prototype.BrowserFeatures.SpecificElementExtensions){if(HTMLOBJECTELEMENT_PROTOTYPE_BUGGY){return function(element){if(element&&typeof element._extendedByPrototype=='undefined'){var t=element.tagName;if(t&&(/^(?:object|applet|embed)$/i.test(t))){extendElementWith(element,Element.Methods);extendElementWith(element,Element.Methods.Simulated);extendElementWith(element,Element.Methods.ByTag[t.toUpperCase()]);}}
return element;}}
return Prototype.K;}
var Methods={},ByTag=Element.Methods.ByTag;var extend=Object.extend(function(element){if(!element||typeof element._extendedByPrototype!='undefined'||element.nodeType!=1||element==window)return element;var methods=Object.clone(Methods),tagName=element.tagName.toUpperCase();if(ByTag[tagName])Object.extend(methods,ByTag[tagName]);extendElementWith(element,methods);element._extendedByPrototype=Prototype.emptyFunction;return element;},{refresh:function(){if(!Prototype.BrowserFeatures.ElementExtensions){Object.extend(Methods,Element.Methods);Object.extend(Methods,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,attribute);};Element.addMethods=function(methods){var F=Prototype.BrowserFeatures,T=Element.Methods.ByTag;if(!methods){Object.extend(Form,Form.Methods);Object.extend(Form.Element,Form.Element.Methods);Object.extend(Element.Methods.ByTag,{"FORM":Object.clone(Form.Methods),"INPUT":Object.clone(Form.Element.Methods),"SELECT":Object.clone(Form.Element.Methods),"TEXTAREA":Object.clone(Form.Element.Methods)});}
if(arguments.length==2){var tagName=methods;methods=arguments[1];}
if(!tagName)Object.extend(Element.Methods,methods||{});else{if(Object.isArray(tagName))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],methods);}
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","TEXTAREA":"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":"TableCol","THEAD":"TableSection","TFOOT":"TableSection","TBODY":"TableSection","TR":"TableRow","TH":"TableCell","TD":"TableCell","FRAMESET":"FrameSet","IFRAME":"IFrame"};if(trans[tagName])klass='HTML'+trans[tagName]+'Element';if(window[klass])return window[klass];klass='HTML'+tagName+'Element';if(window[klass])return window[klass];klass='HTML'+tagName.capitalize()+'Element';if(window[klass])return window[klass];var element=document.createElement(tagName);var proto=element['__proto__']||element.constructor.prototype;element=null;return proto;}
var elementPrototype=window.HTMLElement?HTMLElement.prototype:Element.prototype;if(F.ElementExtensions){copy(Element.Methods,elementPrototype);copy(Element.Methods.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.prototype);}}
Object.extend(Element,Element.Methods);delete Element.ByTag;if(Element.extend.refresh)Element.extend.refresh();Element.cache={};};document.viewport={getDimensions:function(){return{width:this.getWidth(),height:this.getHeight()};},getScrollOffsets:function(){return Element._returnOffset(window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft,window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop);}};(function(viewport){var B=Prototype.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;viewport['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:function(element){if(!(element=$(element)))return;var uid;if(element===window){uid=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,key,value){if(!(element=$(element)))return;if(arguments.length===2){Element.getStorage(element).update(key);}else{Element.getStorage(element).set(key,value);}
return element;},retrieve:function(element,key,defaultValue){if(!(element=$(element)))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 descendants=Element.select(clone,'*'),i=descendants.length;while(i--){descendants[i]._prototypeUID=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();}},shouldUseXPath:(function(){var IS_DESCENDANT_SELECTOR_BUGGY=(function(){var isBuggy=false;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_SNAPSHOT_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;}})(),shouldUseSelectorsAPI:function(){if(!Prototype.BrowserFeatures.SelectorsAPI)return false;if(Selector.CASE_INSENSITIVE_CLASS_NAMES)return false;if(!Selector._div)Selector._div=new Element('div');try{Selector._div.querySelector(this.expression);}catch(e){return false;}
return true;},compileMatcher:function(){var e=this.expression,ps=Selector.patterns,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.handlers, 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.isFunction(c[name])?c[name](m):new Template(c[name]).evaluate(m));e=e.replace(m[0],'');break;}}}
this.matcher.push("return h.unique(n);\n}");eval(this.matcher.join('\n'));Selector._cache[this.expression]=this.matcher;},compileXPathMatcher:function(){var e=this.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;},findElements:function(root){root=root||document;var e=this.expression,results;switch(this.mode){case'selectorsAPI':if(root!==document){var oldId=root.id,id=$(root).identify();id=id.replace(/([\.:])/g,"\\$1");e="#"+id+" "+e;}
results=$A(root.querySelectorAll(e)).map(Element.extend);root.id=oldId;return results;case'xpath':return document._getElementsByXPath(this.xpath,root);default:return this.matcher(root);}},match:function(element){this.tokens=[];var e=this.expression,ps=Selector.patterns,as=Selector.assertions;var le,p,m,len=ps.length,name;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=token[0],matches=token[1];if(!Selector.assertions[name](element,matches)){match=false;break;}}
return match;},toString:function(){return this.expression;},inspect:function(){return"#<Selector:"+this.expression.inspect()+">";}});if(Prototype.BrowserFeatures.SelectorsAPI&&document.compatMode==='BackCompat'){Selector.CASE_INSENSITIVE_CLASS_NAMES=(function(){var div=document.createElement('div'),span=document.createElement('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-name()='"+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].toLowerCase();m[3]=m[5]||m[6];return new Template(Selector.xpath.operators[m[2]]).evaluate(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}) - string-length('#{3}') + 1))='#{3}']",'*=':"[contains(@#{1}, '#{3}')]",'~=':"[contains(concat(' ', @#{1}, ' '), ' #{3} ')]",'|=':"[contains(concat('-', @#{1}, '-'), '-#{3}-')]"},pseudos:{'first-child':'[not(preceding-sibling::*)]','last-child':'[not(following-sibling::*)]','only-child':'[not(preceding-sibling::* or following-sibling::*)]','empty':"[count(*) = 0 and (count(text()) = 0)]",'checked':"[@checked]",'disabled':"[(@disabled) and (@type!='hidden')]",'enabled':"[not(@disabled) 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/).test(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[name]).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 Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ",m);},'nth-last-child':function(m){return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ",m);},'nth-of-type':function(m){return Selector.xpath.pseudos.nth("position() ",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 Selector.xpath.pseudos['nth-of-type'](m);},'last-of-type':function(m){m[6]="1";return 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);},nth: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}) div #{a} >= 0)]";return new Template(predicate).evaluate({fragment:fragment,a:a,b:b});}}}},criteria:{tagName:'n = h.tagName(n, r, "#{1}", c);      c = false;',className:'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";',child:'c = "child";',adjacent:'c = "adjacent";',laterSibling:'c = "laterSibling";'},patterns:[{name:'laterSibling',re:/^\s*~\s*/},{name:'child',re:/^\s*>\s*/},{name:'adjacent',re:/^\s*\+\s*/},{name:'descendant',re:/^\s/},{name:'tagName',re:/^\s*(\*|[\w\-]+)(\b|$)?/},{name:'id',re:/^#([\w\-\*]+)(\b|$)/},{name:'className',re:/^\.([\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|([^'"][^\]]*?)))?\]/}],assertions:{tagName:function(element,matches){return matches[1].toUpperCase()==element.tagName.toUpperCase();},className:function(element,matches){return Element.hasClassName(element,matches[1]);},id:function(element,matches){return element.id===matches[1];},attrPresence:function(element,matches){return Element.hasAttribute(element,matches[1]);},attr:function(element,matches){var nodeValue=Element.readAttribute(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;for(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,propName='_countedByPrototype',value='x'
el[propName]=value;isBuggy=(el.getAttribute(propName)===value);el=null;return isBuggy;})();return PROPERTIES_ATTRIBUTES_MAP?function(nodes){for(var i=0,node;node=nodes[i];i++)
node.removeAttribute('_countedByPrototype');return nodes;}:function(nodes){for(var i=0,node;node=nodes[i];i++)
node._countedByPrototype=void 0;return nodes;}})(),index:function(parentNode,reverse,ofType){parentNode._countedByPrototype=Prototype.emptyFunction;if(reverse){for(var nodes=parentNode.childNodes,i=nodes.length-1,j=1;i>=0;i--){var node=nodes[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++;}},unique: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=Prototype.emptyFunction;results.push(Element.extend(n));}
return Selector.handlers.unmark(results);},descendant:function(nodes){var h=Selector.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++){for(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(node){while(node=node.previousSibling)
if(node.nodeType==1)return node;return null;},tagName:function(nodes,root,tagName,combinator){var uTagName=tagName.toUpperCase();var results=[],h=Selector.handlers;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,combinator){var targetNode=$(id),h=Selector.handlers;if(root==document){if(!targetNode)return[];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=='descendant'){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]:[];},className: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.descendant([root]);var needle=' '+className+' ';for(var i=0,results=[],node,nodeClassName;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)nodes=root.getElementsByTagName("*");if(nodes&&combinator)nodes=this[combinator](nodes);var results=[];for(var i=0,node;node=nodes[i];i++)
if(Element.hasAttribute(node,attr))results.push(node);return results;},attr:function(nodes,root,attr,value,operator,combinator){if(!nodes)nodes=root.getElementsByTagName("*");if(nodes&&combinator)nodes=this[combinator](nodes);var handler=Selector.operators[operator],results=[];for(var i=0,node;node=nodes[i];i++){var nodeValue=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&&combinator)nodes=this[combinator](nodes);if(!nodes)nodes=root.getElementsByTagName("*");return Selector.pseudos[name](nodes,value,root);}},pseudos:{'first-child':function(nodes,value,root){for(var i=0,results=[],node;node=nodes[i];i++){if(Selector.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;results.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){return Selector.pseudos.nth(nodes,formula,root);},'nth-last-child':function(nodes,formula,root){return Selector.pseudos.nth(nodes,formula,root,true);},'nth-of-type':function(nodes,formula,root){return Selector.pseudos.nth(nodes,formula,root,false,true);},'nth-last-of-type':function(nodes,formula,root){return Selector.pseudos.nth(nodes,formula,root,true,true);},'first-of-type':function(nodes,formula,root){return Selector.pseudos.nth(nodes,"1",root,false,true);},'last-of-type':function(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['last-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([],function(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=='even')formula='2n+0';if(formula=='odd')formula='2n+1';var h=Selector.handlers,results=[],indexed=[],m;h.mark(nodes);for(var i=0,node;node=nodes[i];i++){if(!node.parentNode._countedByPrototype){h.index(node.parentNode,reverse,ofType);indexed.push(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]?Number(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,selectorType,m;var exclusions=new Selector(selector).findElements(root);h.mark(exclusions);for(var i=0,results=[],node;node=nodes[i];i++)
if(!node._countedByPrototype)results.push(node);h.unmark(exclusions);return results;},'enabled':function(nodes,value,root){for(var i=0,results=[],node;node=nodes[i];i++)
if(!node.disabled&&(!node.type||node.type!=='hidden'))
results.push(node);return results;},'disabled':function(nodes,value,root){for(var i=0,results=[],node;node=nodes[i];i++)
if(node.disabled)results.push(node);return results;},'checked':function(nodes,value,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){return(' '+nv+' ').include(' '+v+' ');},'|=':function(nv,v){return('-'+(nv||"").toUpperCase()+'-').include('-'+(v||"").toUpperCase()+'-');}},split:function(expression){var expressions=[];expression.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/,function(m){expressions.push(m[1].strip());});return expressions;},matchElements:function(elements,expression){var matches=$$(expression),h=Selector.handlers;h.mark(matches);for(var i=0,results=[],element;element=elements[i];i++)
if(element._countedByPrototype)results.push(element);h.unmark(matches);return results;},findElement:function(elements,expression,index){if(Object.isNumber(expression)){index=expression;expression=false;}
return Selector.matchElements(elements,expression||'*')[index||0];},findChildElements:function(element,expressions){expressions=Selector.split(expressions.join(','));var results=[],h=Selector.handlers;for(var i=0,l=expressions.length,selector;i<l;i++){selector=new Selector(expressions[i].strip());h.concat(results,selector.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;},serializeElements:function(elements,options){if(typeof options!='object')options={hash:!!options};else if(Object.isUndefined(options.hash))options.hash=true;var key,value,submitted=false,submit=options.submit;var data=elements.inject({},function(result,element){if(!element.disabled&&element.name){key=element.name;value=$(element).getValue();if(value!=null&&element.type!='file'&&(element.type!='submit'||(!submitted&&submit!==false&&(!submit||key==submit)&&(submitted=true)))){if(key in result){if(!Object.isArray(result[key]))result[key]=[result[key]];result[key].push(value);}
else result[key]=value;}}
return result;});return options.hash?data:Object.toQueryString(data);}};Form.Methods={serialize:function(form,options){return Form.serializeElements(Form.getElements(form),options);},getElements:function(form){var elements=$(form).getElementsByTagName('*'),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.toLowerCase()])
elements.push(Element.extend(child));return elements;})},getInputs:function(form,typeName,name){form=$(form);var inputs=form.getElementsByTagName('input');if(!typeName&&!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.type!=typeName)||(name&&input.name!=name))
continue;matchingInputs.push(Element.extend(input));}
return matchingInputs;},disable:function(form){form=$(form);Form.getElements(form).invoke('disable');return form;},enable:function(form){form=$(form);Form.getElements(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:elements.find(function(element){return/^(?:input|select|textarea)$/i.test(element.tagName);});},focusFirstElement:function(form){form=$(form);form.findFirstElement().activate();return form;},request:function(form,options){form=$(form),options=Object.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.toQueryParams();Object.extend(options.parameters,params);}
if(form.hasAttribute('method')&&!options.method)
options.method=form.method;return new Ajax.Request(action,options);}};Form.Element={focus:function(element){$(element).focus();return element;},select:function(element){$(element).select();return element;}};Form.Element.Methods={serialize:function(element){element=$(element);if(!element.disabled&&element.name){var value=element.getValue();if(value!=undefined){var pair={};pair[element.name]=value;return Object.toQueryString(pair);}}
return'';},getValue:function(element){element=$(element);var method=element.tagName.toLowerCase();return Form.Element.Serializers[method](element);},setValue:function(element,value){element=$(element);var method=element.tagName.toLowerCase();Form.Element.Serializers[method](element,value);return element;},clear:function(element){$(element).value='';return element;},present:function(element){return $(element).value!='';},activate:function(element){element=$(element);try{element.focus();if(element.select&&(element.tagName.toLowerCase()!='input'||!(/^(?:button|reset|submit)$/i.test(element.type))))
element.select();}catch(e){}
return element;},disable:function(element){element=$(element);element.disabled=true;return element;},enable:function(element){element=$(element);element.disabled=false;return element;}};var Field=Form.Element;var $F=Form.Element.Methods.getValue;Form.Element.Serializers={input:function(element,value){switch(element.type.toLowerCase()){case'checkbox':case'radio':return Form.Element.Serializers.inputSelector(element,value);default:return Form.Element.Serializers.textarea(element,value);}},inputSelector:function(element,value){if(Object.isUndefined(value))return 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{var opt,currentValue,single=!Object.isArray(value);for(var i=0,length=element.length;i<length;i++){opt=element.options[i];currentValue=this.optionValue(opt);if(single){if(currentValue==value){opt.selected=true;return;}}
else opt.selected=value.include(currentValue);}}},selectOne:function(element){var index=element.selectedIndex;return index>=0?this.optionValue(element.options[index]):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).hasAttribute('value')?opt.value:opt.text;}};Abstract.TimedObserver=Class.create(PeriodicalExecuter,{initialize:function($super,element,frequency,callback){$super(callback,frequency);this.element=$(element);this.lastValue=this.getValue();},execute:function(){var value=this.getValue();if(Object.isString(this.lastValue)&&Object.isString(value)?this.lastValue!=value:String(this.lastValue)!=String(value)){this.callback(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:function(){return Form.serialize(this.element);}});Abstract.EventObserver=Class.create({initialize:function(element,callback){this.element=$(element);this.callback=callback;this.lastValue=this.getValue();if(this.element.tagName.toLowerCase()=='form')
this.registerFormCallbacks();else
this.registerCallback(this.element);},onElementEvent:function(){var value=this.getValue();if(this.lastValue!=value){this.callback(this.element,value);this.lastValue=value;}},registerFormCallbacks:function(){Form.getElements(this.element).each(this.registerCallback,this);},registerCallback:function(element){if(element.type){switch(element.type.toLowerCase()){case'checkbox':case'radio':Event.observe(element,'click',this.onElementEvent.bind(this));break;default:Event.observe(element,'change',this.onElementEvent.bind(this));break;}}}});Form.Element.EventObserver=Class.create(Abstract.EventObserver,{getValue:function(){return Form.Element.getValue(this.element);}});Form.EventObserver=Class.create(Abstract.EventObserver,{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 MOUSEENTER_MOUSELEAVE_EVENTS_SUPPORTED='onmouseenter'in docEl&&'onmouseleave'in docEl;var _isButton;if(Prototype.Browser.IE){var buttonMap={0:1,1:4,2:2};_isButton=function(event,code){return event.button===buttonMap[code];};}else if(Prototype.Browser.WebKit){_isButton=function(event,code){switch(code){case 0:return event.which==1&&!event.metaKey;case 1:return event.which==1&&event.metaKey;default:return 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=event.type,currentTarget=event.currentTarget;if(currentTarget&&currentTarget.tagName){if(type==='load'||type==='error'||(type==='click'&&currentTarget.tagName.toLowerCase()==='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(!expression)return element;if(element.ancestors){var elements=[element].concat(element.ancestors());return Selector.findElement(elements,expression,0);}else{return null;}}
function pointer(event){return{x:pointerX(event),y:pointerY(event)};}
function pointerX(event){var docElement=document.documentElement,body=document.body||{scrollLeft:0};return event.pageX||(event.clientX+
(docElement.scrollLeft||body.scrollLeft)-
(docElement.clientLeft||0));}
function pointerY(event){var docElement=document.documentElement,body=document.body||{scrollTop:0};return event.pageY||(event.clientY+
(docElement.scrollTop||body.scrollTop)-
(docElement.clientTop||0));}
function stop(event){Event.extend(event);event.preventDefault();event.stopPropagation();event.stopped=true;}
Event.Methods={isLeftClick:isLeftClick,isMiddleClick:isMiddleClick,isRightClick:isRightClick,element:element,findElement:findElement,pointer:pointer,pointerX:pointerX,pointerY:pointerY,stop:stop};var methods=Object.keys(Event.Methods).inject({},function(m,name){m[name]=Event.Methods[name].methodize();return m;});if(Prototype.Browser.IE){function _relatedTarget(event){var element;switch(event.type){case'mouseover':element=event.fromElement;break;case'mouseout':element=event.toElement;break;default:return null;}
return Element.extend(element);}
Object.extend(methods,{stopPropagation:function(){this.cancelBubble=true},preventDefault:function(){this.returnValue=false},inspect:function(){return'[object Event]'}});Event.extend=function(event,element){if(!event)return false;if(event._extendedByPrototype)return event;event._extendedByPrototype=Prototype.emptyFunction;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.prototype||document.createEvent('HTMLEvents').__proto__;Object.extend(Event.prototype,methods);Event.extend=Prototype.K;}
function _createResponder(element,eventName,handler){var registry=Element.retrieve(element,'prototype_event_registry');if(Object.isUndefined(registry)){CACHE.push(element);registry=Element.retrieve(element,'prototype_event_registry',$H());}
var respondersForEvent=registry.get(eventName);if(Object.isUndefined(respondersForEvent)){respondersForEvent=[];registry.set(eventName,respondersForEvent);}
if(respondersForEvent.pluck('handler').include(handler))return false;var responder;if(eventName.include(":")){responder=function(event){if(Object.isUndefined(event.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=function(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.stopObserving(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 _getDOMEventName=Prototype.K;if(!MOUSEENTER_MOUSELEAVE_EVENTS_SUPPORTED){_getDOMEventName=function(eventName){var translations={mouseenter:"mouseover",mouseleave:"mouseout"};return eventName in translations?translations[eventName]:eventName;};}
function observe(element,eventName,handler){element=$(element);var responder=_createResponder(element,eventName,handler);if(!responder)return element;if(eventName.include(':')){if(element.addEventListener)
element.addEventListener("dataavailable",responder,false);else{element.attachEvent("ondataavailable",responder);element.attachEvent("onfilterchange",responder);}}else{var actualEventName=_getDOMEventName(eventName);if(element.addEventListener)
element.addEventListener(actualEventName,responder,false);else
element.attachEvent("on"+actualEventName,responder);}
return element;}
function stopObserving(element,eventName,handler){element=$(element);var registry=Element.retrieve(element,'prototype_event_registry');if(Object.isUndefined(registry))return element;if(eventName&&!handler){var responders=registry.get(eventName);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.handler);});});return element;}
var responders=registry.get(eventName);if(!responders)return;var responder=responders.find(function(r){return r.handler===handler;});if(!responder)return element;var actualEventName=_getDOMEventName(eventName);if(eventName.include(':')){if(element.removeEventListener)
element.removeEventListener("dataavailable",responder,false);else{element.detachEvent("ondataavailable",responder);element.detachEvent("onfilterchange",responder);}}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.isUndefined(bubble))
bubble=true;if(element==document&&document.createEvent&&!element.dispatchEvent)
element=document.documentElement;var event;if(document.createEvent){event=document.createEvent('HTMLEvents');event.initEvent('dataavailable',true,true);}else{event=document.createEventObject();event.eventType=bubble?'ondataavailable':'onfilterchange';}
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:observe,stopObserving:stopObserving});Element.addMethods({fire:fire,observe:observe,stopObserving:stopObserving});Object.extend(document,{fire:fire.methodize(),observe:observe.methodize(),stopObserving:stopObserving.methodize(),loaded:false});if(window.Event)Object.extend(window.Event,Event);else window.Event=Event;})();(function(){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.stopObserving('readystatechange',checkReadyState);fireContentLoadedEvent();}}
function pollDoScroll(){try{document.documentElement.doScroll('left');}
catch(e){timer=pollDoScroll.defer();return;}
fireContentLoadedEvent();}
if(document.addEventListener){document.addEventListener('DOMContentLoaded',fireContentLoadedEvent,false);}else{document.observe('readystatechange',checkReadyState);if(window==top)
timer=pollDoScroll.defer();}
Event.observe(window,'load',fireContentLoadedEvent);})();Element.addMethods();Hash.toQueryString=Object.toQueryString;var Toggle={display:Element.toggle};Element.Methods.childOf=Element.Methods.descendantOf;var Insertion={Before:function(element,content){return Element.insert(element,{before:content});},Top:function(element,content){return Element.insert(element,{top:content});},Bottom:function(element,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=window.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.offset[1]+element.offsetHeight&&x>=this.offset[0]&&x<this.offset[0]+element.offsetWidth);},withinIncludingScrolloffsets:function(element,x,y){var offsetcache=Element.cumulativeScrollOffset(element);this.xcomp=x+offsetcache[0]-this.deltaX;this.ycomp=y+offsetcache[1]-this.deltaY;this.offset=Element.cumulativeOffset(element);return(this.ycomp>=this.offset[1]&&this.ycomp<this.offset[1]+element.offsetHeight&&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;},cumulativeOffset:Element.Methods.cumulativeOffset,positionedOffset:Element.Methods.positionedOffset,absolutize:function(element){Position.prepare();return Element.absolutize(element);},relativize:function(element){Position.prepare();return Element.relativize(element);},realOffset:Element.Methods.cumulativeScrollOffset,offsetParent:Element.Methods.getOffsetParent,page:Element.Methods.viewportOffset,clone:function(source,target,options){options=options||{};return Element.clonePosition(target,source,options);}};if(!document.getElementsByClassName)document.getElementsByClassName=function(instanceMethods){function iter(name){return name.blank()?null:"[contains(concat(' ', @class, ' '), ' "+name+" ')]";}
instanceMethods.getElementsByClassName=Prototype.BrowserFeatures.XPath?function(element,className){className=className.toString().strip();var cond=/\s/.test(className)?$w(className).map(iter).join(''):iter(className);return cond?document._getElementsByXPath('.//*'+cond,element):[];}:function(element,className){className=className.toString().strip();var elements=[],classNames=(/\s/.test(className)?$w(className):null);if(!classNames&&!className)return elements;var nodes=$(element).getElementsByTagName('*');className=' '+className+' ';for(var i=0,child,cn;child=nodes[i];i++){if(child.className&&(cn=' '+child.className+' ')&&(cn.include(className)||(classNames&&classNames.all(function(name){return!name.toString().blank()&&cn.include(' '+name+' ');}))))
elements.push(Element.extend(child));}
return elements;};return function(className,parentElement){return $(parentElement||document.body).getElementsByClassName(className);};}(Element.Methods);Element.ClassNames=Class.create();Element.ClassNames.prototype={initialize:function(element){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(classNameToAdd){if(this.include(classNameToAdd))return;this.set($A(this).concat(classNameToAdd).join(' '));},remove:function(classNameToRemove){if(!this.include(classNameToRemove))return;this.set($A(this).without(classNameToRemove).join(' '));},toString:function(){return $A(this).join(' ');}};Object.extend(Element.ClassNames.prototype,Enumerable);


/* public/javascripts/effects.js @ 1305154393 */

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(this.length==7)color=this.toLowerCase();}}
return(color.length==7?color:(arguments[0]||this));};Element.collectTextNodes=function(element){return $A($(element).childNodes).collect(function(node){return(node.nodeType==3?node.nodeValue:(node.hasChildNodes()?Element.collectTextNodes(node):''));}).flatten().join('');};Element.collectTextNodesIgnoreClass=function(element,className){return $A($(element).childNodes).collect(function(node){return(node.nodeType==3?node.nodeValue:((node.hasChildNodes()&&!Element.hasClassName(node,className))?Element.collectTextNodesIgnoreClass(node,className):''));}).flatten().join('');};Element.setContentZoom=function(element,percent){element=$(element);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:{name:'ElementDoesNotExistError',message:'The specified DOM element does not exist, but is required for this effect to operate'},Transitions:{linear:Prototype.K,sinoidal: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)+Math.random()/4;return pos>1?1:pos;},wobble:function(pos){return(-Math.cos(pos*Math.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*Math.PI)*Math.exp(-pos*6));},none:function(pos){return 0;},full:function(pos){return 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:relative';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:tagifyStyle}).update(character==' '?String.fromCharCode(160):character),child);});Element.remove(child);}});},multiple:function(element,effect){var elements;if(((typeof element=='object')||Object.isFunction(element))&&(element.length))
elements=element;else
elements=$(element).childNodes;var options=Object.extend({speed:0.1,delay:0.0},arguments[2]||{});var masterDelay=options.delay;$A(elements).each(function(element,index){new effect(element,Object.extend(options,{delay:index*options.speed+masterDelay}));});},PAIRS:{'slide':['SlideDown','SlideUp'],'blind':['BlindDown','BlindUp'],'appear':['Appear','Fade']},toggle:function(element,effect){element=$(element);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,options);}};Effect.DefaultOptions.transition=Effect.Transitions.sinoidal;Effect.ScopedQueue=Class.create(Enumerable,{initialize:function(){this.effects=[];this.interval=null;},_each:function(iterator){this.effects._each(iterator);},add:function(effect){var timestamp=new Date().getTime();var position=Object.isString(effect.options.queue)?effect.options.queue:effect.options.queue.position;switch(position){case'front':this.effects.findAll(function(e){return e.state=='idle'}).each(function(e){e.startOn+=effect.finishOn;e.finishOn+=effect.finishOn;});break;case'with-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.limit||(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){this.effects=this.effects.reject(function(e){return e==effect});if(this.effects.length==0){clearInterval(this.interval);this.interval=null;}},loop:function(){var timePos=new Date().getTime();for(var i=0,len=this.effects.length;i<len;i++)
this.effects[i]&&this.effects[i].loop(timePos);}});Effect.Queues={instances:$H(),get:function(queueName){if(!Object.isString(queueName))return queueName;return this.instances.get(queueName)||this.instances.set(queueName,new Effect.ScopedQueue());}};Effect.Queue=Effect.Queues.get('global');Effect.Base=Class.create({position:null,start:function(options){function codeForEvent(options,eventName){return((options[eventName+'Internal']?'this.options.'+eventName+'Internal(this);':'')+
(options[eventName]?'this.options.'+eventName+'(this);':''));}
if(options&&options.transition===false)options.transition=Effect.Transitions.linear;this.options=Object.extend(Object.extend({},Effect.DefaultOptions),options||{});this.currentFrame=0;this.state='idle';this.startOn=this.options.delay*1000;this.finishOn=this.startOn+(this.options.duration*1000);this.fromToDelta=this.options.to-this.options.from;this.totalTime=this.finishOn-this.startOn;this.totalFrames=this.options.fps*this.options.duration;this.render=(function(){function dispatch(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)+this.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.queue.scope).add(this);},loop:function(timePos){if(timePos>=this.startOn){if(timePos>=this.finishOn){this.render(1.0);this.cancel();this.event('beforeFinish');if(this.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;}}},cancel:function(){if(!this.options.sync)
Effect.Queues.get(Object.isString(this.options.queue)?'global':this.options.queue.scope).remove(this);this.state='finished';},event:function(eventName){if(this.options[eventName+'Internal'])this.options[eventName+'Internal'](this);if(this.options[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.Parallel=Class.create(Effect.Base,{initialize:function(effects){this.effects=effects||[];this.start(arguments[1]);},update:function(position){this.effects.invoke('render',position);},finish:function(position){this.effects.each(function(effect){effect.render(1.0);effect.cancel();effect.event('beforeFinish');if(effect.finish)effect.finish(position);effect.event('afterFinish');});}});Effect.Tween=Class.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(Effect.Base,{initialize:function(){this.start(Object.extend({duration:0},arguments[0]||{}));},update:Prototype.emptyFunction});Effect.Opacity=Class.create(Effect.Base,{initialize:function(element){this.element=$(element);if(!this.element)throw(Effect._elementDoesNotExistError);if(Prototype.Browser.IE&&(!this.element.currentStyle.hasLayout))
this.element.setStyle({zoom:1});var options=Object.extend({from:this.element.getOpacity()||0.0,to:1.0},arguments[1]||{});this.start(options);},update:function(position){this.element.setOpacity(position);}});Effect.Move=Class.create(Effect.Base,{initialize:function(element){this.element=$(element);if(!this.element)throw(Effect._elementDoesNotExistError);var options=Object.extend({x:0,y:0,mode:'relative'},arguments[1]||{});this.start(options);},setup:function(){this.element.makePositioned();this.originalLeft=parseFloat(this.element.getStyle('left')||'0');this.originalTop=parseFloat(this.element.getStyle('top')||'0');if(this.options.mode=='absolute'){this.options.x=this.options.x-this.originalLeft;this.options.y=this.options.y-this.originalTop;}},update:function(position){this.element.setStyle({left:(this.options.x*position+this.originalLeft).round()+'px',top:(this.options.y*position+this.originalTop).round()+'px'});}});Effect.MoveBy=function(element,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._elementDoesNotExistError);var options=Object.extend({scaleX:true,scaleY:true,scaleContent:true,scaleFromCenter:false,scaleMode:'box',scaleFrom:100.0,scaleTo:percent},arguments[2]||{});this.start(options);},setup:function(){this.restoreAfterFinish=this.options.restoreAfterFinish||false;this.elementPositioning=this.element.getStyle('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;var fontSize=this.element.getStyle('font-size')||'100%';['em','px','%','pt'].each(function(fontSizeType){if(fontSize.indexOf(fontSizeType)>0){this.fontSize=parseFloat(fontSize);this.fontSizeType=fontSizeType;}}.bind(this));this.factor=(this.options.scaleTo-this.options.scaleFrom)/100;this.dims=null;if(this.options.scaleMode=='box')
this.dims=[this.element.offsetHeight,this.element.offsetWidth];if(/^content/.test(this.options.scaleMode))
this.dims=[this.element.scrollHeight,this.element.scrollWidth];if(!this.dims)
this.dims=[this.options.scaleMode.originalHeight,this.options.scaleMode.originalWidth];},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});this.setDimensions(this.dims[0]*currentScale,this.dims[1]*currentScale);},finish:function(position){if(this.restoreAfterFinish)this.element.setStyle(this.originalStyle);},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,{initialize:function(element){this.element=$(element);if(!this.element)throw(Effect._elementDoesNotExistError);var options=Object.extend({startcolor:'#ffff99'},arguments[1]||{});this.start(options);},setup:function(){if(this.element.getStyle('display')=='none'){this.cancel();return;}
this.oldStyle={};if(!this.options.keepBackgroundImage){this.oldStyle.backgroundImage=this.element.getStyle('background-image');this.element.setStyle({backgroundImage:'none'});}
if(!this.options.endcolor)
this.options.endcolor=this.element.getStyle('background-color').parseColor('#ffffff');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.options.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.oldStyle,{backgroundColor:this.options.restorecolor}));}});Effect.ScrollTo=function(element){var options=arguments[1]||{},scrollOffsets=document.viewport.getScrollOffsets(),elementOffsets=$(element).cumulativeOffset();if(options.offset)elementOffsets[1]+=options.offset;return new Effect.Tween(null,scrollOffsets.top,elementOffsets[1],options,function(p){scrollTo(scrollOffsets.left,p.round());});};Effect.Fade=function(element){element=$(element);var oldOpacity=element.getInlineOpacity();var options=Object.extend({from:element.getOpacity()||1.0,to:0.0,afterFinishInternal: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 options=Object.extend({from:(element.getStyle('display')=='none'?0.0:element.getOpacity()||0.0),to:1.0,afterFinishInternal:function(effect){effect.element.forceRerendering();},beforeSetup:function(effect){effect.element.setOpacity(effect.options.from).show();}},arguments[1]||{});return new Effect.Opacity(element,options);};Effect.Puff=function(element){element=$(element);var oldStyle={opacity:element.getInlineOpacity(),position:element.getStyle('position'),top:element.style.top,left:element.style.left,width:element.style.width,height:element.style.height};return new Effect.Parallel([new Effect.Scale(element,200,{sync:true,scaleFromCenter:true,scaleContent:true,restoreAfterFinish:true}),new Effect.Opacity(element,{sync: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();var elementDimensions=element.getDimensions();var m=/(.*?)px/.exec(element.getStyle('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},restoreAfterFinish:true,afterFinishInternal:function(effect){effect.element.hide().undoClipping();}},arguments[1]||{}));};Effect.BlindDown=function(element){element=$(element);var elementDimensions=element.getDimensions();return new Effect.Scale(element,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:elementDimensions.height,originalWidth:elementDimensions.width},restoreAfterFinish:true,afterSetup:function(effect){effect.element.makeClipping().setStyle({height:'0px'}).show();},afterFinishInternal:function(effect){effect.element.undoClipping();}},arguments[1]||{}));};Effect.SwitchOff=function(element){element=$(element);var oldOpacity=element.getInlineOpacity();return new Effect.Appear(element,Object.extend({duration:0.4,from:0,transition:Effect.Transitions.flicker,afterFinishInternal: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();},afterFinishInternal:function(effect){effect.element.hide().undoClipping().undoPositioned().setStyle({opacity:oldOpacity});}});}},arguments[1]||{}));};Effect.DropOut=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.Opacity(element,{sync:true,to:0.0})],Object.extend({duration:0.5,beforeSetup:function(effect){effect.effects[0].element.makePositioned();},afterFinishInternal:function(effect){effect.effects[0].element.hide().undoPositioned().setStyle(oldStyle);}},arguments[1]||{}));};Effect.Shake=function(element){element=$(element);var options=Object.extend({distance:20,duration:0.5},arguments[1]||{});var distance=parseFloat(options.distance);var split=parseFloat(options.duration)/10.0;var oldStyle={top:element.getStyle('top'),left:element.getStyle('left')};return new Effect.Move(element,{x:distance,y:0,duration:split,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:-distance*2,y:0,duration:split*2,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:distance*2,y:0,duration:split*2,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:-distance*2,y:0,duration:split*2,afterFinishInternal:function(effect){new Effect.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(oldStyle);}});}});}});}});}});}});};Effect.SlideDown=function(element){element=$(element).cleanWhitespace();var oldInnerBottom=element.down().getStyle('bottom');var elementDimensions=element.getDimensions();return new Effect.Scale(element,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:window.opera?0:1,scaleMode:{originalHeight:elementDimensions.height,originalWidth:elementDimensions.width},restoreAfterFinish:true,afterSetup:function(effect){effect.element.makePositioned();effect.element.down().makePositioned();if(window.opera)effect.element.setStyle({top:''});effect.element.makeClipping().setStyle({height:'0px'}).show();},afterUpdateInternal:function(effect){effect.element.down().setStyle({bottom:(effect.dims[0]-effect.element.clientHeight)+'px'});},afterFinishInternal:function(effect){effect.element.undoClipping().undoPositioned();effect.element.down().undoPositioned().setStyle({bottom:oldInnerBottom});}},arguments[1]||{}));};Effect.SlideUp=function(element){element=$(element).cleanWhitespace();var oldInnerBottom=element.down().getStyle('bottom');var elementDimensions=element.getDimensions();return new Effect.Scale(element,window.opera?0:1,Object.extend({scaleContent:false,scaleX:false,scaleMode:'box',scaleFrom:100,scaleMode:{originalHeight:elementDimensions.height,originalWidth:elementDimensions.width},restoreAfterFinish:true,afterSetup:function(effect){effect.element.makePositioned();effect.element.down().makePositioned();if(window.opera)effect.element.setStyle({top:''});effect.element.makeClipping().show();},afterUpdateInternal:function(effect){effect.element.down().setStyle({bottom:(effect.dims[0]-effect.element.clientHeight)+'px'});},afterFinishInternal:function(effect){effect.element.hide().undoClipping().undoPositioned();effect.element.down().undoPositioned().setStyle({bottom:oldInnerBottom});}},arguments[1]||{}));};Effect.Squish=function(element){return new Effect.Scale(element,window.opera?1:0,{restoreAfterFinish:true,beforeSetup:function(effect){effect.element.makeClipping();},afterFinishInternal:function(effect){effect.element.hide().undoClipping();}});};Effect.Grow=function(element){element=$(element);var options=Object.extend({direction:'center',moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.full},arguments[1]||{});var oldStyle={top:element.style.top,left:element.style.left,height:element.style.height,width:element.style.width,opacity:element.getInlineOpacity()};var dims=element.getDimensions();var initialMoveX,initialMoveY;var moveX,moveY;switch(options.direction){case'top-left':initialMoveX=initialMoveY=moveX=moveY=0;break;case'top-right':initialMoveX=dims.width;initialMoveY=moveY=0;moveX=-dims.width;break;case'bottom-left':initialMoveX=moveX=0;initialMoveY=dims.height;moveY=-dims.height;break;case'bottom-right':initialMoveX=dims.width;initialMoveY=dims.height;moveX=-dims.width;moveY=-dims.height;break;case'center':initialMoveX=dims.width/2;initialMoveY=dims.height/2;moveX=-dims.width/2;moveY=-dims.height/2;break;}
return new Effect.Move(element,{x:initialMoveX,y:initialMoveY,duration:0.01,beforeSetup:function(effect){effect.element.hide().makeClipping().makePositioned();},afterFinishInternal:function(effect){new Effect.Parallel([new Effect.Opacity(effect.element,{sync:true,to:1.0,from:0.0,transition:options.opacityTransition}),new Effect.Move(effect.element,{x:moveX,y:moveY,sync:true,transition:options.moveTransition}),new Effect.Scale(effect.element,100,{scaleMode:{originalHeight:dims.height,originalWidth:dims.width},sync:true,scaleFrom:window.opera?1:0,transition:options.scaleTransition,restoreAfterFinish:true})],Object.extend({beforeSetup:function(effect){effect.effects[0].element.setStyle({height:'0px'}).show();},afterFinishInternal:function(effect){effect.effects[0].element.undoClipping().undoPositioned().setStyle(oldStyle);}},options));}});};Effect.Shrink=function(element){element=$(element);var options=Object.extend({direction:'center',moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.none},arguments[1]||{});var oldStyle={top:element.style.top,left:element.style.left,height:element.style.height,width:element.style.width,opacity:element.getInlineOpacity()};var dims=element.getDimensions();var 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.height;break;case'bottom-right':moveX=dims.width;moveY=dims.height;break;case'center':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 Effect.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.effects[0].element.hide().undoClipping().undoPositioned().setStyle(oldStyle);}},options));};Effect.Pulsate=function(element){element=$(element);var options=arguments[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(effect){effect.element.setStyle({opacity:oldOpacity});}},options),{transition:reverser}));};Effect.Fold=function(element){element=$(element);var oldStyle={top:element.style.top,left:element.style.left,width:element.style.width,height:element.style.height};element.makeClipping();return new Effect.Scale(element,5,Object.extend({scaleContent:false,scaleX:false,afterFinishInternal:function(effect){new Effect.Scale(element,1,{scaleContent:false,scaleY:false,afterFinishInternal:function(effect){effect.element.hide().undoClipping().setStyle(oldStyle);}});}},arguments[1]||{}));};Effect.Morph=Class.create(Effect.Base,{initialize:function(element){this.element=$(element);if(!this.element)throw(Effect._elementDoesNotExistError);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.style);this.style=$H(this.element.getStyles());this.element.removeClassName(options.style);var css=this.element.getStyles();this.style=this.style.reject(function(style){return style.value==css[style.key];});options.afterFinishInternal=function(effect){effect.element.addClassName(effect.options.style);effect.transforms.each(function(transform){effect.element.style[transform.style]='';});};}}
this.start(options);},setup:function(){function parseColor(color){if(!color||['rgba(0, 0, 0, 0)','transparent'].include(color))color='#ffffff';color=color.parseColor();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();unit='color';}else if(property=='opacity'){value=parseFloat(value);if(Prototype.Browser.IE&&(!this.element.currentStyle.hasLayout))
this.element.setStyle({zoom:1});}else if(Element.CSS_LENGTH.test(value)){var components=value.match(/^([\+\-]?[0-9\.]+)(.*)$/);value=parseFloat(components[1]);unit=(components.length==3)?components[2]:null;}
var originalValue=this.element.getStyle(property);return{style:property.camelize(),originalValue:unit=='color'?parseColor(originalValue):parseFloat(originalValue||0),targetValue:unit=='color'?parseColor(value):value,unit:unit};}.bind(this)).reject(function(transform){return((transform.originalValue==transform.targetValue)||(transform.unit!='color'&&(isNaN(transform.originalValue)||isNaN(transform.targetValue))));});},update:function(position){var style={},transform,i=this.transforms.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.options=arguments[1]||{};this.addTracks(tracks);},addTracks:function(tracks){tracks.each(function(track){track=$H(track);var data=track.values().first();this.tracks.push($H({ids:track.keys().first(),effect:Effect.Morph,options:{style:data}}));}.bind(this));return this;},play:function(){return new Effect.Parallel(this.tracks.map(function(track){var ids=track.get('ids'),effect=track.get('effect'),options=track.get('options');var elements=[$(ids)||$$(ids)].flatten();return elements.map(function(e){return new effect(e,Object.extend({sync:true},options))});}).flatten(),this.options);}});Element.CSS_PROPERTIES=$w('backgroundColor backgroundPosition borderBottomColor borderBottomStyle '+'borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth '+'borderRightColor borderRightStyle borderRightWidth borderSpacing '+'borderTopColor borderTopStyle borderTopWidth bottom clip color '+'fontSize fontWeight height left letterSpacing lineHeight '+'marginBottom marginLeft marginRight marginTop markerOffset maxHeight '+'maxWidth minHeight minWidth opacity outlineColor outlineOffset '+'outlineWidth paddingBottom paddingLeft paddingRight paddingTop '+'right textIndent top width wordSpacing zIndex');Element.CSS_LENGTH=/^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/;String.__parseStyleElement=document.createElement('div');String.prototype.parseStyle=function(){var style,styleRules=$H();if(Prototype.Browser.WebKit)
style=new Element('div',{style:this}).style;else{String.__parseStyleElement.innerHTML='<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]);return styleRules;};if(document.defaultView&&document.defaultView.getComputedStyle){Element.getStyles=function(element){var css=document.defaultView.getComputedStyle($(element),null);return Element.CSS_PROPERTIES.inject({},function(styles,property){styles[property]=css[property];return styles;});};}else{Element.getStyles=function(element){element=$(element);var css=element.currentStyle,styles;styles=Element.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.Morph(element,Object.extend({style:style},arguments[2]||{}));return element;},visualEffect:function(element,effect,options){element=$(element);var s=effect.dasherize().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 squish switchOff dropOut').each(function(effect){Effect.Methods[effect]=function(element,options){element=$(element);Effect[effect.charAt(0).toUpperCase()+effect.substring(1)](element,options);return element;};});$w('getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles').each(function(f){Effect.Methods[f]=Element[f];});Element.addMethods(Effect.Methods);


/* public/javascripts/slider.js @ 1305154393 */

if(!Control)var Control={};Control.Slider=Class.create({initialize:function(handle,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||'horizontal';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.spans.map(function(s){return $(s)}):false;this.options.startSpan=$(this.options.startSpan||null);this.options.endSpan=$(this.options.endSpan||null);this.restricted=this.options.restricted||false;this.maximum=this.options.maximum||this.range.end;this.minimum=this.options.minimum||this.range.start;this.alignX=parseInt(this.options.alignX||'0');this.alignY=parseInt(this.options.alignY||'0');this.trackLength=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;this.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=this.endDrag.bindAsEventListener(this);this.eventMouseMove=this.update.bindAsEventListener(this);this.handles.each(function(h,i){i=slider.handles.length-1-i;slider.setValue(parseFloat((Object.isArray(slider.options.sliderValue)?slider.options.sliderValue[i]:slider.options.sliderValue)||slider.range.start),i);h.makePositioned().observe("mousedown",slider.eventMouseDown);});this.track.observe("mousedown",this.eventMouseDown);document.observe("mouseup",this.eventMouseUp);document.observe("mousemove",this.eventMouseMove);this.initialized=true;},dispose:function(){var slider=this;Event.stopObserving(this.track,"mousedown",this.eventMouseDown);Event.stopObserving(document,"mouseup",this.eventMouseUp);Event.stopObserving(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())return(this.allowedValues.max());if(value<=this.allowedValues.min())return(this.allowedValues.min());var offset=Math.abs(this.allowedValues[0]-value);var newValue=this.allowedValues[0];this.allowedValues.each(function(v){var currentOffset=Math.abs(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 this.range.start;return value;},setValue:function(sliderValue,handleIdx){if(!this.active){this.activeHandleIdx=handleIdx||0;this.activeHandle=this.handles[this.activeHandleIdx];this.updateStyles();}
handleIdx=handleIdx||this.activeHandleIdx||0;if(this.initialized&&this.restricted){if((handleIdx>0)&&(sliderValue<this.values[handleIdx-1]))
sliderValue=this.values[handleIdx-1];if((handleIdx<(this.handles.length-1))&&(sliderValue>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||!this.event)this.updateFinished();},setValueBy:function(delta,handleIdx){this.setValue(this.values[handleIdx||this.activeHandleIdx||0]+delta,handleIdx||this.activeHandleIdx||0);},translateToPx:function(value){return Math.round(((this.trackLength-this.handleLength)/(this.range.end-this.range.start))*(value-this.range.start))+"px";},translateToValue: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).min():this.value));if(this.options.endSpan)
this.setSpan(this.options.endSpan,$R(this.values.length>1?this.getRange(this.spans.length-1).max():this.value,this.maximum));},setSpan:function(span,range){if(this.isVertical()){span.style.top=this.translateToPx(range.start);span.style.height=this.translateToPx(range.end-range.start+this.range.start);}else{span.style.left=this.translateToPx(range.start);span.style.width=this.translateToPx(range.end-range.start+this.range.start);}},updateStyles:function(){this.handles.each(function(h){Element.removeClassName(h,'selected')});Element.addClassName(this.activeHandle,'selected');},startDrag:function(event){if(Event.isLeftClick(event)){if(!this.disabled){this.active=true;var handle=Event.element(event);var pointer=[Event.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.offsetX=(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.updateStyles();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)this.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]-=this.offsetX+offsets[0];pointer[1]-=this.offsetY+offsets[1];this.event=event;this.setValue(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);Event.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.event=null;}});


/* public/javascripts/swfobject.js @ 1305154393 */

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(swf,id,w,h,ver,c,useExpressInstall,quality,xiRedirectUrl,redirectUrl,detectKey){if(!document.getElementById){return;}
this.DETECT_KEY=detectKey?detectKey:'detectflash';this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new 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().split(".")));}
this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(c){this.addParam('bgcolor',c);}
var q=quality?quality:'high';this.addParam('quality',q);this.setAttribute('useExpressInstall',useExpressInstall);this.setAttribute('doExpressInstall',false);var xir=(xiRedirectUrl)?xiRedirectUrl:window.location;this.setAttribute('xiRedirectUrl',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];},addParam:function(name,value){this.params[name]=value;},getParams:function(){return this.params;},addVariable:function(name,value){this.variables[name]=value;},getVariable:function(name){return this.variables[name];},getVariables:function(){return 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("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");}
swfNode='<embed type="application/x-shockwave-flash" src="'+this.getAttribute('swf')+'" width="'+this.getAttribute('width')+'" height="'+this.getAttribute('height')+'"';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+='flashvars="'+pairs+'"';}
swfNode+='/>';}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");}
swfNode='<object id="'+this.getAttribute('id')+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+this.getAttribute('width')+'" height="'+this.getAttribute('height')+'">';swfNode+='<param name="movie" value="'+this.getAttribute('swf')+'" />';var params=this.getParams();for(var key in params){swfNode+='<param 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('useExpressInstall')){var expressInstallReqVer=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(expressInstallReqVer)&&!this.installedVer.versionIsValid(this.getAttribute('version'))){this.setAttribute('doExpressInstall',true);this.addVariable("MMredirectURL",escape(this.getAttribute('xiRedirectUrl')));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}
if(this.skipDetect||this.getAttribute('doExpressInstall')||this.installedVer.versionIsValid(this.getAttribute('version'))){var n=(typeof elementId=='string')?document.getElementById(elementId):elementId;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute('redirectUrl')!=""){document.location.replace(this.getAttribute('redirectUrl'));}}
return false;}}
deconcept.SWFObjectUtil.getPlayerVersion=function(){var PlayerVersion=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){PlayerVersion=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");PlayerVersion=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="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("$version").split(" ")[1].split(","));}}
return PlayerVersion;}
deconcept.PlayerVersion=function(arrVersion){this.major=arrVersion[0]!=null?parseInt(arrVersion[0]):0;this.minor=arrVersion[1]!=null?parseInt(arrVersion[1]):0;this.rev=arrVersion[2]!=null?parseInt(arrVersion[2]):0;}
deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major)return false;if(this.major>fv.major)return true;if(this.minor<fv.minor)return false;if(this.minor>fv.minor)return true;if(this.rev<fv.rev)return false;return true;}
deconcept.util={getRequestParameter:function(param){var q=document.location.search||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){return pairs[i].substring((pairs[i].indexOf("=")+1));}}}
return"";}}
deconcept.SWFObjectUtil.cleanupSWFs=function(){if(window.opera||!document.all)return;var objects=document.getElementsByTagName("OBJECT");for(var i=0;i<objects.length;i++){objects[i].style.display='none';for(var x in objects[i]){if(typeof objects[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.cleanupSWFs;}}
if(typeof window.onbeforeunload=='function'){var oldBeforeUnload=window.onbeforeunload;window.onbeforeunload=function(){deconcept.SWFObjectUtil.prepUnload();oldBeforeUnload();}}else{window.onbeforeunload=deconcept.SWFObjectUtil.prepUnload;}
if(Array.prototype.push==null){Array.prototype.push=function(item){this[this.length]=item;return this.length;}}
var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;


/* public/javascripts/util.js @ 1305154393 */

if(!window.Scribd)var Scribd={};Scribd.Remote=(function(){function getElement(e,type){if(e.tagName&&e.tagName==type){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(function(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(options.use_alert)
form.select('.alert').invoke('update');form.request(Object.extend({evalScripts:true,parameters:'form_name='+encodeURIComponent(form.readAttribute('name')),onSuccess:formSendSuccess.bind(options),onFailure:function(){Scribd.Alerts.error('flashes_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('.spinner');if(spinner)
spinner.show();form=null;},Link:function(e,opts){var options=opts||{};var link=getElement(e,'A');var url=link.readAttribute('href');new Ajax.Request(url,Object.extend({method:'GET',evalScripts:true},options));link=null;}};return pub;})();Scribd.dynamicIncluder=(function(){function dispatchCallbacks(status){s.complete(status,loaded,errors);s[status](status=='error'?errors:loaded);clearTimeout(tTimeout);clearTimeout(cssTimeout);};function checkProgress(){if(loaded.length==files.length)Scribd.dynamicIncluder.dispatchCallbacks('success');else if(loaded.length+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();return;};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:scriptload');},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.getElementsByTagName("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.callback(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);}else{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.current_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.bind(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.current_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.current_tab].join('/');new Ajax.Updater(tab,url,{method:'get',onComplete:function(req){var tab=$(this.prefix+'-'+this.current_tab);tab.show();}.bind(this)});}else{tab.show();}
this.selectCurrentTab();},resetTabs:function(){var current_tab_class_name=this.current_tab_class_name;var current=this.tabs.find(function(li){return li.hasClassName(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.options.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=function(){var ua=navigator.userAgent.toLowerCase();return ua.indexOf('safari/')!=-1;};Scribd.addDefaultTextEvents=function(element,default_text,cb){element.addClassName('inactive');element.value=default_text;element.observe('focus',function(e){if(this.value==default_text)
this.value='';this.removeClassName('inactive');if(cb)cb(e);});element.observe('blur',function(e){if($F(element)==''){element.value=default_text;element.addClassName('inactive');}});};Scribd.enforceMaxLength=function(textarea,countDisplay,maxLength){if(textarea&&countDisplay){var updateCharCount=function(e){var val=$F(textarea);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.removeClassName('limit_reached');}
countDisplay.update(left);}
updateCharCount();textarea.observe('focus',updateCharCount);textarea.observe('change',updateCharCount);textarea.observe('keyup',updateCharCount);}};Scribd.JSONCookie=Class.create({initialize:function(name,jar){this.jar=jar||new CookieJar({path:'/',expires:''});this.name=name;var cstring=this.jar.get(name)||"{}";this.store=$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.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(Scribd.usernameRestriction)){return true;}else{e.stop();}}};Scribd.documentTimelineEvents={mouseover:function(e){var delete_button=this.down('.delete_event');if(delete_button)
delete_button.style.visibility='visible';var flag_container=this.down('.flag_container')
if(flag_container)
flag_container.style.visibility='visible';},mouseout:function(e,fromChild){var delete_button=this.down('.delete_event');if(delete_button)
delete_button.style.visibility='hidden';var flag_container=this.down('.flag_container')
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_feed_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=str_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]){console[logger](msg);if(obj)
console[logger](obj);}};Scribd.logError=function(msg,obj){Scribd.log(msg,obj,'error');};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,fontFace:'Arial',fontColor:"#000000",copyText:'',imageUrl:Scribd.cdn_path+'images/buttons/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',function(){this.addClassName('active');Element.removeClassName.delay(2,this,'active');});};var CopyClipboardButton={getCopyText:function(a){var el=$(a);return Try.these(function(){return el.value;},function(){return el.innerText;},function(){return el.textContent;})||"";}};Scribd.BrowserDetect={init:function(){this.browser=this.searchString(this.dataBrowser)||"An unknown browser";this.version=this.searchVersion(navigator.userAgent)||this.searchVersion(navigator.appVersion)||"an unknown version";this.OS=this.searchString(this.dataOS)||"an unknown OS";},searchString:function(data){for(var i=0;i<data.length;i++){var dataString=data[i].string;var dataProp=data[i].prop;this.versionSearchString=data[i].versionSearch||data[i].identity;if(dataString){if(dataString.indexOf(data[i].subString)!=-1)
return data[i].identity;}
else if(dataProp)
return data[i].identity;}},searchVersion:function(dataString){var index=dataString.indexOf(this.versionSearchString);if(index==-1)return;return parseFloat(dataString.substring(index+this.versionSearchString.length+1));},dataBrowser:[{string:navigator.userAgent,subString:"Chrome",identity:"Chrome"},{string:navigator.userAgent,subString:"OmniWeb",versionSearch:"OmniWeb/",identity:"OmniWeb"},{string:navigator.vendor,subString:"Apple",identity:"Safari",versionSearch:"Version"},{prop:window.opera,identity:"Opera"},{string:navigator.vendor,subString:"iCab",identity:"iCab"},{string:navigator.vendor,subString:"KDE",identity:"Konqueror"},{string:navigator.userAgent,subString:"Firefox",identity:"Firefox"},{string:navigator.vendor,subString:"Camino",identity:"Camino"},{string:navigator.userAgent,subString:"Netscape",identity:"Netscape"},{string:navigator.userAgent,subString:"MSIE",identity:"Explorer",versionSearch:"MSIE"},{string:navigator.userAgent,subString:"Gecko",identity:"Mozilla",versionSearch:"rv"},{string:navigator.userAgent,subString:"Mozilla",identity:"Netscape",versionSearch:"Mozilla"}],dataOS:[{string:navigator.platform,subString:"Win",identity:"Windows"},{string:navigator.platform,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.substring(navigator.userAgent.indexOf("MSIE")+5))==7;Prototype.Browser.IE8=Prototype.Browser.IE&&!Prototype.Browser.IE6&&!Prototype.Browser.IE7;Scribd.init=function(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){var val=window["_sbdOptions_"+name];if(typeof val==='undefined'){val=defaultVal;}
return val;};


/* public/javascripts/word.js @ 1305154393 */

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:document.documentElement&&document.documentElement.clientHeight?document.documentElement.clientHeight:document.body!=null?document.body.clientHeight:0;}
function pageWidth(){return document.documentElement&&document.documentElement.offsetWidth?document.documentElement.offsetWidth:document.body!=null?document.body.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";$('graph_tab_2').className="graph_unselected";$('graph_tab_3').className="graph_unselected";$('graph_tab_4').className="graph_unselected";$('graph_tab_5').className="graph_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";refresh_log=(tab_num==4);}
function toggle_analytics(){if(Element.visible('inner_analytics')){$('analytics_switch').innerHTML="Show analytics";$('inner_analytics').hide();}else{$('analytics_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.length;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('highlighted');});}
$$("tr.my_documents_row td.check input").each(function(check){check.checked=turnOn;});}
function getCheckedDocIds(form){var checked_doc_ids=new Array();$$("td.check > input").each(function(check){if(check.checked)
checked_doc_ids.push(check.value);});form.getElementsBySelector('input[name="docs"]')[0].value=checked_doc_ids.join(",");}
function SetAllCheckBoxes(FormName,FieldName,CheckValue)
{if(!document.forms[FormName])
return;var objCheckBoxes=document.forms[FormName].elements[FieldName];if(!objCheckBoxes)
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 false;");}}
function showScribdDiv(link_id,url){var dd=document.getElementById('scribd_inline_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=false;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("+link_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+="style='visibility: visible;' ";code_str+="src='"+(url)+"' width='"+width+"' height='"+height+"'></iframe>";}
dd.innerHTML=code_str;dd.style.display='block';var arrayPageSize=document.viewport.getDimensions();var arrayPageScroll=document.viewport.getScrollOffsets();dd.style.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').removeClassName('hotmail_button_active');$('yahoo').addClassName('yahoo_button');$('gmail').addClassName('gmail_button');$('hotmail').addClassName('hotmail_button');$(provider).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='powerpoint';break;case'xls':base='excel';break;case'odt':case'odp':case'ods':case'odg':case'odf':case'sxw':case'sxc':case'sxi':case'sxd':base='openoffice';break;case'jpg':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.lastIndexOf('.'));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=thumb.getHeight();if(width>maxThumbWidth){width_delta=width-maxThumbWidth;thumb.style.width=maxThumbWidth+"px";thumb.style.height=Math.round((thumb.getWidth()/width)*height)+"px";}};function show_explore(tab){if(tab=='tags'){$('explore_tags').style.display='block';$('explore_categories').style.display='none';$('explore_tab_tags').addClassName('current');$('explore_tab_categories').removeClassName('current');}else{$('explore_tags').style.display='none';$('explore_categories').style.display='block';$('explore_tab_tags').removeClassName('current');$('explore_tab_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');$(id).addClassName('no_clear');$(id).innerHTML='<div class="center">Successfully Removed '+link+' from Group</div>';}
function trackEvent(category,action,label,value){try{_gaq.push(['_trackEvent',category,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).removeClassName('button_disabled');}}
function disableButton(button){if($(button)){$(button).disabled=true;$(button).addClassName('button_disabled');}}
Scribd.carouselLazyLoad=function(carousel){function callback(force){var currentIndex=(this.current)?this.current._index:0;var nextItem=(this.slides.length-1==currentIndex)?(this.options.circular?0:currentIndex):currentIndex+1;var item=(force)?carousel.slides[0]:carousel.slides[nextItem];if(item&&!item.readAttribute('imagesloaded')){item.select('a').each(function(a){var orig=a.readAttribute('orig');if(orig){a.style.backgroundImage='url('+a.readAttribute('orig')+')';a.writeAttribute('orig','');}});item.writeAttribute('imagesloaded','true');}
return true;}
callback.call(carousel,true);carousel.options.beforeMove=callback.bind(carousel,false);}


/* public/javascripts/lightbox.js @ 1305154393 */

if(!window.Scribd)var Scribd=new Object();Scribd.Lightbox=(function(){var scrollHeight=function(){var h=window.pageYOffset||document.body.scrollTop||document.documentElement.scrollTop;return h?h:0;};var center=function(id,topOffset){if(typeof topOffset=="undefined"){topOffset=0;}
if((id=='toolbar_download_lightbox')||(id=='premium_download')||(id=='premium_credit_card_flow')){var container=$('viewer');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';$(id).style.overflow='hidden';};var hideSelects=function(){selects=$$('select');for(i=0;i<selects.length;i++){selects[i].hide();}};var showSelects=function(){selects=$$('select');for(i=0;i<selects.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){iframeShim=options.iframeShim;}else{iframeShim=null;}},create:function(id,options){if($(id))this.destroy(id);var options=Scribd.Options({style:'normal'},options);if(options.style=='tight'){var content_class='content content_tight';}else{var content_class='content';}
document.body.appendChild(new Element('div',{'class':'lightbox',id:id,style:'display:none'}).update('<div class="'+content_class+'"></div><div class="footer"></div>'));},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("Scribd:dom_updated");},open:function(id,topOffset,hideSelects){if(!this.current_open||this.current_open!=id){this.close(this.current_open);center(id,topOffset);this.id=id;$(id).show();if(hideSelects)
hideSelects();this.current_open=id;$(document).fire('lightbox:open');}},remoteOpen:function(id,url,params,create_options){var params=Scribd.Options({lightbox:true},params);var create_options=Scribd.Options({},create_options);this.create(id,create_options);this.update(id,'<div class="spinner_container"><img src="/images/spinner_large_mac_white.gif?1305154393" /></div>');this.open(id,75);new Ajax.Request(url,{parameters:params,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)});},secureIframeOpen:function(id,url,options,create_options){var create_options=Scribd.Options({},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.remoteUrl:(url.protocol()+'//'+url.domain());var intermediaryUrl=remote+'/easyxdm/intermediary.html#url='+encodeURIComponent(url)+'&showLoading='+(options.showLoading?'1':'0');new easyXDM.Socket({remote:intermediaryUrl,remoteHelper:remote+"/easyxdm/name.html",local:"/easyxdm/name.html",container:container,props:{frameborder:0,border:0,scrolling:'no'},onMessage:function(message,origin){var args=message.split(' ');message=args.shift();if(message=='open'){Scribd.Lightbox.open(args[0],75);}else if(message=='close'){this.close();}else if(message=='resize'){container.down('iframe').style.height=args[0]+"px";}else if(options.onMessage){options.onMessage(message,origin);}}.bind(this)});if(options.height)
container.down('iframe').style.height=options.height+'px';this.open(id,75);},close:function(id){var lb=id?$(id):$(this.current_open);if(lb){if(lb.visible()){lb.hide();showSelects();this.current_open=null;document.fire('lightbox:closed',{'lightbox_id':lb.id});}}},toggle:function(id,topOffset){var lb=$(id);if(lb.visible())
this.close(id);else
this.open(id,topOffset);},closeHandler:function(e){e.stop();var lb=e.element().up('.lightbox');if(lb)Scribd.Lightbox.close(lb.id);},destroy:function(id){if($(id)){this.close(id);$(id).remove();}}}})();


/* public/javascripts/lowpro_0_5.js @ 1305154393 */

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.CompatibleWithPrototype+" it may not work as expected with this version ("+Prototype.Version+")");if(!Element.addMethods)
Element.addMethods=function(o){Object.extend(Element.Methods,o)};DOM={};DOM.Builder={tagFunc:function(tag){return function(){var attrs,children;if(arguments.length>0){if(arguments[0].nodeName||typeof arguments[0]=="string")
children=arguments;else{attrs=arguments[0];children=Array.prototype.slice.call(arguments,1);};}
return DOM.Builder.create(tag,attrs,children);};},create:function(tag,attrs,children){attrs=attrs||{};children=children||[];tag=tag.toLowerCase();var el=new Element(tag,attrs);for(var i=0;i<children.length;i++){if(typeof children[i]=='string')
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|thead|tbody|tfoot|pre|code|"+"h1|h2|h3|h4|h5|h6|ul|ol|li|form|input|textarea|legend|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|caption|"+"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;return root.childNodes[0];};Object.extend(Event,{onReady:function(f){if(document.body)f();else document.observe('dom:loaded',f);}});Event.addBehavior=function(rules){var ab=this.addBehavior;Object.extend(ab.rules,rules);if(!ab.responderApplied){Ajax.Responders.register({onComplete:function(){if(Event.addBehavior.reassignAfterAjax)
setTimeout(function(){ab.reload()},10);}});ab.responderApplied=true;}
if(ab.autoTrigger){this.onReady(ab.load.bind(ab,rules));}};Object.extend(Event.addBehavior,{rules:{},cache:[],reassignAfterAjax:true,autoTrigger:true,load:function(rules){for(var selector in rules){var observer=rules[selector];var sels=selector.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.addBehavior.cache.push([element,event,observer]);}else{if(!element.$$assigned||!element.$$assigned.include(observer)){if(observer.attach)observer.attach(element);else 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 ab=Event.addBehavior;ab.unload();ab.load(ab.rules);},_wrapObserver:function(observer){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=(arguments.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(behavior,Class.Methods);Object.extend(behavior,Behavior.Methods);behavior.superclass=parent;behavior.subclasses=[];behavior.instances=[];if(parent){var subclass=function(){};subclass.prototype=parent.prototype;behavior.prototype=new subclass;parent.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.constructor=behavior;return behavior;},Methods:{attach:function(element){return new this(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].bindAsEventListener(bound)));}}};Remote=Behavior.create({initialize:function(options){if(this.element.nodeName=='FORM')new Remote.Form(this.element,options);else new Remote.Link(this.element,options);}});Remote.Base={initialize:function(options){this.options=Object.extend({evaluateScripts:true},options||{});},_makeRequest:function(options){if(options.update)new Ajax.Updater(options.update,options.url,options);else new Ajax.Request(options.url,options);return false;}}
Remote.Link=Behavior.create(Remote.Base,{onclick:function(){var options=Object.extend({url:this.element.href,method:'get'},this.options);return this._makeRequest(options);}});Remote.Form=Behavior.create(Remote.Base,{onclick:function(e){var sourceElement=e.element();if(['input','button'].include(sourceElement.nodeName.toLowerCase())&&sourceElement.type=='submit')
this._submitButton=sourceElement;},onsubmit:function(){var options=Object.extend({url:this.element.action,method:this.element.method||'get',parameters:this.element.serialize({submit:this._submitButton.name})},this.options);this._submitButton=null;return this._makeRequest(options);}});Observed=Behavior.create({initialize:function(callback,options){this.callback=callback.bind(this);this.options=options||{};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.frequency,this.callback):new Form.EventObserver(this.element,this.callback);},_observeField:function(){return(this.options.frequency)?new Form.Element.Observer(this.element,this.options.frequency,this.callback):new Form.Element.EventObserver(this.element,this.callback);}});


/* public/javascripts/analytics.js @ 1305154393 */

var Analytics=function(referrer){this._searchEngine=null;this._searchEngineName='';this._searchEngineQuery='';this._searchEngineKeywords='';if(this._getParam('use_google_view')=='1'&&this._getParam('query')!=''){this._searchEngineName='google';this._searchEngine=this._searchEngines['google'];this._searchEngineQuery=this._getParam('query').replace(/\+/g,' ');this._searchEngineKeywords=this._extractKeywords(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;},getSearchEngineQuery:function(){return this._searchEngineQuery;},getSearchEngineKeywords:function(){return this._searchEngineKeywords;},_searchEngines:{scribd:{param:'query',match:/\.?scribd\.com$/},scribd_seo:{param:'query2',match:/\.?scribd\.com$/},google:{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\.com$/},aol:{param:'query',match:/\.?aol\.com$/}},_parseUri:function(sourceUri){var uriPartNames=['source','protocol','authority','domain','port','path','directoryPath','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._searchEngine.param){this._searchEngineQuery=decodeURIComponent(parts[1].replace(/\+/g,' '));this._searchEngineKeywords=this._extractKeywords(this._searchEngineQuery);break;}}},_getParam:function(name){var regexS="[\\?&]"+name+"=([^&#]*)";var regex=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 @ 1305154393 */

Event.addBehavior({'.dropdowns li > a:click, li.with_dropdown > a:click':function(e){e.stop();var li=e.findElement('li');var dropdown=li.down('.dropdown');if(Scribd.openDropDown&&Scribd.openDropDown!=li){Scribd.openDropDown.removeClassName('open');Scribd.openDropDown=null;}
if(dropdown){if(!li.hasClassName('open')){li.addClassName('open');Scribd.openDropDown=li;}else if(!Scribd.menuOver){li.removeClassName('open');Scribd.openDropDown=null;}}},'.truncated_text .truncated_more:click':function(e){this.up('.truncated_short').hide();this.up('.truncated_short').up('.truncated_text').down('.truncated_long').show();},'.truncated_text .truncated_less:click':function(e){this.up('.truncated_long').hide();this.up('.truncated_long').up('.truncated_text').down('.truncated_short').show();},'.embed_code_title_toggle:click':function(e){if(this.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_containers_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_shared_containers_revealer .revealer:mouseout':function(e){this.down('a').addClassName('plus').removeClassName('plus_active');this.down('.show_more').hide();if(this.down('.see_all_link')){this.down('.see_all_link').hide();}},'.autogen_class_views_shared_containers_revealer .revealer:click':function(e){if(!e.element().hasClassName('see_all_link')){this.hide();this.up('.autogen_class_views_shared_containers_revealer').down('.to_reveal').show();}},'.autogen_class_views_shared_containers_revealer .less:click':function(e){this.up('.to_reveal').hide();},'#homepage_login_tab_link:click':function(e){$('homepage_login').show();$('homepage_signup').hide();$('homepage_signup_tab_link').removeClassName('signup_active');$('homepage_signup_tab_link').addClassName('signup_inactive');$('homepage_login_tab_link').removeClassName('login_inactive');$('homepage_login_tab_link').addClassName('login_active');},'#homepage_signup_tab_link:click':function(e){$('homepage_login').hide();$('homepage_signup').show();$('homepage_signup_tab_link').addClassName('signup_active');$('homepage_signup_tab_link').removeClassName('signup_inactive');$('homepage_login_tab_link').addClassName('login_inactive');$('homepage_login_tab_link').removeClassName('login_active');},'.horizontal_carousel_arrows .left_arrow img:mouseover':function(e){this.src=Scribd.cdn_path+"images/homepage/carousel_arrow_left_active.gif";},'.horizontal_carousel_arrows .left_arrow img:mouseout':function(e){this.src=Scribd.cdn_path+"images/homepage/carousel_arrow_left.gif";},'.horizontal_carousel_arrows .right_arrow img:mouseover':function(e){this.src=Scribd.cdn_path+"images/homepage/carousel_arrow_right_active.gif";},'.horizontal_carousel_arrows .right_arrow img:mouseout':function(e){this.src=Scribd.cdn_path+"images/homepage/carousel_arrow_right.gif";},'.document_event_in_timeline_container:mouseenter,.document_event_container:mouseenter,.event_reply_container:mouseenter':function(e){Scribd.documentTimelineEvents.mouseover.call(this,e);},'.document_event_in_timeline_container:mouseleave,.document_event_container:mouseleave,.event_reply_container:mouseleave':function(e){Scribd.documentTimelineEvents.mouseout.call(this,e,false);},'.document_event_children:mouseleave':function(e){Scribd.documentTimelineEvents.mouseReEnter.call(this,e);},'#select_all_suggested_users:click':function(e){if(document.suggested_users_form)
{count=document.suggested_users_form.elements.length;for(i=0;i<count;i++){checkbox=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_hidden_link:click':function(e){$('related_docs_hidden').hide();$('related_docs_show').show();},'#admin_show_link:click':function(e){$('admin_show').hide();$('admin_hidden').show();},'#admin_hidden_link:click':function(e){$('admin_hidden').hide();$('admin_show').show();},'#related_queries_show_link:click':function(e){$('related_queries_show').hide();$('related_queries_hidden').show();},'#related_queries_hidden_link:click':function(e){$('related_queries_hidden').hide();$('related_queries_show').show();},'#disable_highlighting_link:click':function(e){$('embedded_flash').childElements()[0].disableKeywordHighlighting();$('enable_highlighting').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:mouseover':function(e){this.addClassName('survey_active');},'.survey:mouseout':function(e){this.addClassName('survey_active');},'#uploadButton:click':function(e){FileQueue.upload();return false;},'#uploadButton2:click':function(e){if($('copyright_check')&&$('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:click':function(e){this.removeClassName('purchase_document_button');this.disabled=true;this.addClassName('purchase_document_button_inactive');$('purchase_spinner').show();$('order_form').submit();},'#select_all_contacts:click,#select_all_contacts':function(e){if(document.contact_form)
{count=document.contact_form.elements.length;for(i=0;i<count;i++){checkbox=document.contact_form.elements[i];checkbox.checked=this.checked;}}},'#invite_more_link: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(this.selectedIndex==0){select_email_provider($('yahoo'));}else if(this.selectedIndex==1){select_email_provider($('gmail'));}else{select_email_provider($('hotmail'));}},'.trunc_url:mouseover':function(e){if(e.target.hint){e.target.hint.style.display='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.top-2+'px';el.innerHTML=e.target.title;Event.observe(el,'mouseout',function(e){e.target.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 @ 1305154393 */

if(typeof scribd=="undefined"){var scribd=new Object();scribd.Document=function(){this.__params=[];this.__callQueue=[];this.__listenerLookup={};if(arguments.length==2){this.document_id=arguments[0];this.access_key=arguments[1];return this;}
if(scribd.Document.caller!=scribd.Document.getDoc&&scribd.Document.caller!=scribd.Document.getDocFromUrl&&scribd.Document.caller!=scribd.Document.getDocFromUrlForExtension&&scribd.Document.caller!=undefined){throw new Error("There is no public constructor for scribd.Document.");}}
scribd.Document.getDoc=function(document_id,access_key){scribd_doc=new scribd.Document();scribd_doc.document_id=document_id;scribd_doc.access_key=access_key;return scribd_doc;}
scribd.Document.getDocFromUrl=function(url,publisher_id){scribd_doc=new scribd.Document();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;scribd_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.__listenerExists(eventType,callback))
return;if(this.__listenerLookup[eventType]){this.__listenerLookup[eventType].push(callback);}else{this.__listenerLookup[eventType]=new Array(callback);}},__removeRoutedListener:function(eventType,callback){var listeners=this.__listenerLookup[eventType];for(var i=0;i<listeners.length;i++){if(listeners[i]==callback){listeners.splice(i,1);}}},__listenerExists:function(eventType,callback){var listeners=this.__listenerLookup[eventType]||[];for(var i=0;i<listeners.length;i++){if(listeners[i]==callback)return true;}
return false;},addEventListener:function(eventType,callback,optBubble){if(this.api){if(window.addEventListener){this.api.parentNode.addEventListener(eventType,callback,false);}else{this.__addRoutedListener(eventType,callback);}}else{this.__callQueue.push(["addEventListener",eventType,callback,false]);}},removeEventListener:function(eventType,callback){if(this.api){if(window.addEventListener){this.api.removeEventListener(eventType,callback,false);}else{this.__removeRoutedListener(eventType,callback);}}else{this.__callQueue.push(["removeEventListener",eventType,callback]);}},getElement:function(){return document.getElementsByName(this.__embedName)[0]},addParam:function(name,value){this.__params[name]=value;},grantAccess:function(user_identifier,secure_session_id,signature){this.__params["user_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"]==true);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.__params["width"]&&this.__params["width"]!="parent"){auto_width=this.__params["width"];}
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.documentElement&&document.documentElement.clientHeight?document.documentElement.clientHeight:document.body!=null?document.body.clientHeight:0;page_height-=25;if(auto_height<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["auto_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.__params["width"]+"px";}
if(this.__params["swf_name"]){srcString=this.__params["swf_name"];}
if(this.__params["disable_related_docs"]){flashVars+='&disable_related_docs='+this.__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.__params["current_user_id"];}
if(this.__params["search_query"]){flashVars+='&search_query='+escape(this.__params["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.__params["should_redirect"];}
if(this.__params["secret_password"]){flashVars+='&secret_password='+this.__params["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(this.__params["secure_session_id"]);}
if(this.__params["signature"]){flashVars+='&signature='+this.__params["signature"];}
if(this.__params["docinfo"]){flashVars+='&docinfo='+encodeURIComponent(this.__params["docinfo"]);}
if(this.__params["useIntegratedUi"]){flashVars+='&useIntegratedUi='+this.__params["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.__params["use_ssl"]==true){srcPath="https://s3.amazonaws.com/documents.scribd.com/";flashVars+="&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_reading=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_buttons=true';}
if(this.__params["full_screen_type"]){flashVars+='&full_screen_type='+this.__params["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',protocol+'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0','width',embedWidth,'height',embedHeight,'flashvars',flashVars,'src',srcPath+srcString,'quality','high','pluginspage',protocol+'www.macromedia.com/go/getflashplayer','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',srcPath+srcString,'salign','');var flash_ok=Scribd_AC_RunActiveContent.DetectFlashVer(9,0,0);if(!flash_ok){embedString='<div style="font-size:16px;width:300px;border: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=ShockwaveFlash">get the latest Flash player</a>.  </div>';}
if(quickswitch){container.innerHTML=embedString;if(element.hasChildNodes()){while(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];if(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=callParams.shift();__this[method].apply(__this,callParams);}else{rejectedCalls.push(callParams);}}
__this.__callQueue=rejectedCalls;}}
var oniPaperReady=function(e)
{var e=e||{};var target=e.srcElement||document.getElementsByName(embedName)[0];if(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"){method=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.__addRoutedListener('iPaperReady',oniPaperReady);this.__addRoutedListener('setupJsApi',onSetupJsApi);}}}
var Scribd_AC_RunActiveContent=new function()
{var isIE=(navigator.appVersion.indexOf("MSIE")!=-1)?true:false;var isWin=(navigator.appVersion.toLowerCase().indexOf("win")!=-1)?true:false;var isOpera=(navigator.userAgent.indexOf("Opera")!=-1)?true:false;this.ControlVersion=function()
{var version;var axo;var e;try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");version=axo.GetVariable("$version");}catch(e){}
if(!version)
{try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");version="WIN 6,0,21,0";axo.AllowScriptAccess="always";version=axo.GetVariable("$version");}catch(e){}}
if(!version)
{try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");version=axo.GetVariable("$version");}catch(e){}}
if(!version)
{try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");version="WIN 3,0,18,0";}catch(e){}}
if(!version)
{try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");version="WIN 2,0,0,11";}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 Flash 2.0"]?" 2.0":"";var flashDescription=navigator.plugins["Shockwave Flash"+swVer2].description;var descArray=flashDescription.split(" ");var tempArrayMajor=descArray[2].split(".");var versionMajor=tempArrayMajor[0];var versionMinor=tempArrayMajor[1];var versionRevision=descArray[3];if(versionRevision==""){versionRevision=descArray[4];}
if(versionRevision[0]=="d"){versionRevision=versionRevision.substring(1);}else if(versionRevision[0]=="r"){versionRevision=versionRevision.substring(1);if(versionRevision.indexOf("d")>0){versionRevision=versionRevision.substring(0,versionRevision.indexOf("d"));}}
var flashVer=versionMajor+"."+versionMinor+"."+versionRevision;}}
else if(navigator.userAgent.toLowerCase().indexOf("webtv/2.6")!=-1)flashVer=4;else if(navigator.userAgent.toLowerCase().indexOf("webtv/2.5")!=-1)flashVer=3;else if(navigator.userAgent.toLowerCase().indexOf("webtv")!=-1)flashVer=2;else if(isIE&&isWin&&!isOpera){flashVer=this.ControlVersion();}
return flashVer;};this.DetectFlashVer=function(reqMajorVer,reqMinorVer,reqRevision)
{versionStr=this.GetSwfVer();if(versionStr==-1){return false;}else if(versionStr!=0){if(isIE&&isWin&&!isOpera){tempArray=versionStr.split(" ");tempString=tempArray[1];versionArray=tempString.split(",");}else{versionArray=versionStr.split(".");}
var versionMajor=versionArray[0];var versionMinor=versionArray[1];var versionRevision=versionArray[2];if(versionMajor>parseFloat(reqMajorVer)){return true;}else if(versionMajor==parseFloat(reqMajorVer)){if(versionMinor>parseFloat(reqMinorVer))
return true;else if(versionMinor==parseFloat(reqMinorVer)){if(versionRevision>=parseFloat(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(arguments,".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);return this.Mod_AC_Generateobj(ret.objAttrs,ret.params,ret.embedAttrs);};this.Mod_AC_GetArgs=function(args,ext,srcParamName,classid,mimeType){var ret=new Object();ret.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){case"classid":break;case"pluginspage":ret.embedAttrs[args[i]]=args[i+1];break;case"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":case"onbeforeupdate":case"onblur":case"oncellchange":case"onclick":case"ondblclick":case"ondrag":case"ondragend":case"ondragenter":case"ondragleave":case"ondragover":case"ondrop":case"onfinish":case"onfocus":case"onhelp":case"onmousedown":case"onmouseup":case"onmouseover":case"onmousemove":case"onmouseout":case"onkeypress":case"onkeydown":case"onkeyup":case"onload":case"onlosecapture":case"onpropertychange":case"onreadystatechange":case"onrowsdelete":case"onrowenter":case"onrowexit":case"onrowsinserted":case"onstart":case"onscroll":case"onbeforeeditfocus":case"onactivate":case"onbeforedeactivate":case"ondeactivate":case"type":case"codebase":case"id":ret.objAttrs[args[i]]=args[i+1];break;case"width":case"height":case"align":case"vspace":case"hspace":case"class":case"title":case"accesskey":case"name":case"tabindex":ret.embedAttrs[args[i]]=ret.objAttrs[args[i]]=args[i+1];break;default:ret.embedAttrs[args[i]]=ret.params[args[i]]=args[i+1];}}
ret.objAttrs["classid"]=classid;if(mimeType)ret.embedAttrs["type"]=mimeType;return ret;}
if(typeof scribd_view_callback!="undefined"){scribd_view_callback();}}}


/* public/javascripts/iPaper.js @ 1305154393 */

var vFlashScrollbar;var hFlashScrollbar;var iPaperSearchPlaceholder="Search within document";var iPaperSearchSummaryPlaceholder="Enter a search query below";var iPaperSearchPlaceholderDisplayed=true;var iPaperIsFullscreen=false;var sidebarIsOpen=false;var calculateScrollbarWidth=function(){if(!document.body){if(Prototype.Browser.IE){return 17}
return 15}
var inner=document.createElement('p');inner.style.width="100%";inner.style.height="200px";var outer=document.createElement('div');outer.style.position="absolute";outer.style.top="0px";outer.style.left="0px";outer.style.visibility="hidden";outer.style.width="200px";outer.style.height="150px";outer.style.overflow="hidden";outer.appendChild(inner);document.body.appendChild(outer);var w1=inner.offsetWidth;outer.style.overflow='scroll';var w2=inner.offsetWidth;if(w1==w2)w2=outer.clientWidth;document.body.removeChild(outer);return(w1-w2);};var setViewModeSelected=function(mode)
{switch(mode){case"list":$('view_mode_selector').selectedIndex=0;break;case"book":$('view_mode_selector').selectedIndex=1;break;case"slide":$('view_mode_selector').selectedIndex=2;break;case"tile":$('view_mode_selector').selectedIndex=999;break;}}
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_toolbar').getHeight()).toString()+"px";$('iPaper').style.width=(ipaper_width-scrollBarContainerSize-2).toString()+"px";$('iPaper').style.height=(ipaper_height-scrollBarContainerSize-2).toString()+"px";$('h_scroll_box').style.width=(ipaper_width-scrollBarContainerSize).toString()+"px";$('h_scroll_box').style.height=scrollBarContainerSize.toString()+"px";$('rightScrollBarContainer').style.width=rightScrollBarContainerSize.toString()+"px";$('v_scroll_box').style.width=scrollBarContainerSize.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.width=ipaper_width.toString()+"px";$('ipaper_placeholder').style.height=ipaper_height.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;iPaperSearchPlaceholderDisplayed=true;$('search_results_summary').innerHTML=iPaperSearchSummaryPlaceholder;$('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_container').style.width,10)-iPaperSidebarWidth).toString()+"px";$('ipaper_sidebar_container').style.width="0";$('ipaper_sidebar_container').hide();$('ipaper_toolbar').removeClassName('sidebar_open');$('ipaper_document_toolbar_search').show();$('ipaper_toolbar_search_submit').show();sidebarIsOpen=false;$('ipaper_document_search').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_absolute_container').getWidth()+$('ipaper_sidebar_container').getWidth()).toString()+"px";}
$('ipaper_sidebar_container').style.height=ipaper_height.toString()+"px";$('sidebar_results').style.height=(ipaper_height-($('search_results_summary_container').getHeight())-$('sidebar_footer').getHeight()-1).toString()+"px";$('ipaper_toolbar').addClassName('sidebar_open');$('ipaper_document_search').focus();$('ipaper_document_search').observe("keyup",iPaperCallbacks.onSearchKeyUp.bindAsEventListener(iPaperCallbacks));sidebarIsOpen=true;}
var _updateFullscreenDimensions=function()
{var PADDING=10;var TOP_PADDING=15;var TOOLBAR_HEIGHT=65;var IPAPER_TOOLBAR_HEIGHT=28;var targetWidth=document.viewport.getWidth()-2*PADDING;var targetHeight=document.viewport.getHeight()-(PADDING+TOP_PADDING+TOOLBAR_HEIGHT+IPAPER_TOOLBAR_HEIGHT);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.onPositionUpdateRequested();}},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(iPaperSearchPlaceholderDisplayed)
{$('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=$('ipaper_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 matchIndex=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(selectedMatch.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 "'+query+'"';$('sidebar_results_content').innerHTML=resultString;},onSearchResultClick:function(matchIndex)
{doc.api.highlightSearchMatchByIndex(matchIndex);this.onRepositionScrollbar();},onToolbarSearchClick:function()
{if(!iPaperIsFullscreen){$('ipaper_document_toolbar_search').hide();$('ipaper_toolbar_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.onSearchKeyUp.bindAsEventListener(iPaperCallbacks));doc.api.executeSearchQuery(false);}}},onTextSelectionClick: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_selected');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("slide");break;}},setPaginationLabel:function(curPage,pageCount)
{if(curPage<=0||pageCount<=0)
return;var chars=(curPage.toString()+pageCount.toString()).length+4;$('pagination_label').style.width=(0.47*chars).toString()+"em";$('ipaper_pagination').style.width=(0.47*chars+4).toString()+"em";$('pagination_label').innerHTML=curPage.toString()+" / "+pageCount.toString();},onPageChanged:function(e)
{this.setPaginationLabel(doc.api.getPage(),doc.api.getPageCount());},oniPaperReady:function(e)
{this.setPaginationLabel(doc.api.getPage(),doc.api.getPageCount());},onZoomInClick: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');}},onPrintClick:function(startPage,endPage)
{startPage=startPage||1;endPage=endPage||10;doc.api.interfacePrint(startPage,endPage);},onPrintDisabledClick:function(){alert('Sorry, printing is disabled for this document!');},isPrintSupported:function(){return doc.api.isPrintSupported();},onWindowResize:function(e){updateFullscreenDimensions()},enterFullScreen:function(){if(iPaperIsFullscreen){return;}
var PADDING=10;var TOP_PADDING=15;var TOOLBAR_HEIGHT=65;var xDelta,yDelta;if(sidebarIsOpen){closeSideBar();}
$('ipaper_absolute_container').addClassName("fullscreen");if(window._Scribd_resize)
{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('fullscreen');title.select('.private').invoke('hide');$('ipaper_container').insert({top:ipaper_toolbar});$('ipaper_container').insert({top:title});if($('ipaper_uploader_info')){var uploader_info=$('ipaper_uploader_info').remove().addClassName('fullscreen');$('ipaper_container').insert({top:uploader_info});}
$('ipaper_absolute_container').style.left=PADDING.toString()+"px";$('ipaper_absolute_container').style.top=TOP_PADDING.toString()+"px";updateFullscreenDimensions()
window.iPaperIsFullscreen=true;$('ipaper_placeholder_container').addClassName('fullscreen_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('.private').invoke('show');$('ipaper_title_container').insert({top:title});$('ipaper_top_toolbar_container').insert({top:ipaper_toolbar});if($('ipaper_uploader_info_container')){var uploader_info=$('ipaper_uploader_info').remove().removeClassName('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').style.top="";$('ipaper_absolute_container').removeClassName("fullscreen");$('h_scroll_box').style.display="block";$('v_scroll_box').style.display="block";iPaperSetDimensions();iPaperCallbacks.onResizeScrollbar();window.iPaperIsFullscreen=false;$('ipaper_placeholder_container').removeClassName('fullscreen_mode');clearSearch()
doc.api.setFullscreen(false);}}
var directSetScrollPositions=function(verticalPosition,horizontalPosition)
{vFlashScrollbar.updateScrollPositionDirect(verticalPosition);hFlashScrollbar.updateScrollPositionDirect(horizontalPosition);}
var directDisplaySearchResults=function(results)
{iPaperCallbacks.onFlashSearchResults(results);}
var FlashScrollbar=function(scrollBoxElement,scrollTrackElement,flashElement,isVertical)
{if(!(scrollBoxElement&&scrollTrackElement&&flashElement))
return;this.__isVertical=isVertical;this.__scrollBox=scrollBoxElement;this.__scrollTrack=scrollTrackElement;this.__flash=flashElement;this.__ignoreScrollEvent=false;scrollBoxElement.observe("scroll",this.scrollPositionChanged.bindAsEventListener(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==position)
{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();}},scrollPositionChanged:function()
{if(this.__ignoreScrollEvent)
{this.__ignoreScrollEvent=false;return;}
if(this.__isVertical)
{this.__flash.setVerticalScrollOffset(this.__scrollBox.scrollTop);}
else
{this.__flash.setHorizontalScrollOffset(this.__scrollBox.scrollLeft);}},updateScrollMax:function()
{var scrollTrackMax;var scrollTrackCurrent;if(this.__isVertical)
{scrollTrackMax=this.__flash.getDocumentHeight();scrollTrackCurrent=parseInt(this.__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=scrollTrackMax+"px";}
if(scrollTrackMax<=scrollTrackCurrent)
{if(this.__scrollBox.style.display=="block")
{if(this.__isVertical)
{$('iPaper').style.width=(parseInt($('iPaper').style.width)+scrollBarSize).toString()+"px";}
else
{$('iPaper').style.height=(parseInt($('iPaper').style.height)+scrollBarSize).toString()+"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).toString()+"px";}
else
{$('iPaper').style.height=(parseInt($('iPaper').style.height)-scrollBarSize).toString()+"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.api,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.bindAsEventListener(iPaperCallbacks));doc.addEventListener("pageChanged",iPaperCallbacks.onPageChanged.bindAsEventListener(iPaperCallbacks));doc.addEventListener("iPaperReady",iPaperCallbacks.oniPaperReady.bindAsEventListener(iPaperCallbacks));};


/* public/javascripts/doc_view.js @ 1305154393 */

var ViewPage=Class.create({initialize:function(){this.edge_padding=50;this.top_height=269;this.bottom_padding=40;this.min_ipaper_width=640;this.min_ipaper_height=540;this.view_right_bar=295;this.view_main=this.min_ipaper_width;this.view_container=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.calculate_dimensions();},calculate_dimensions:function(){this.width=1096;this.height=pageHeight();if(this.width>this.view_container){var width_extra=this.width-this.view_container-this.edge_padding*2;if(width_extra>0)
{this.view_main=this.view_main+width_extra;this.view_container=this.view_container+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_container: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=this.view_container+'px';$('embedded_flash').firstDescendant().width=this.view_container;this.full_width_mode=true;}}else{if(this.full_width_mode){this.set_view_main();$('embedded_flash').firstDescendant().width=this.view_main;this.full_width_mode=false;}}}});var wildfire_intialized=false;function update_document_view(docId){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 options={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);enableRating();}}
Scribd.setTitleEditEvents=function(){$('doc_title_text').observe('mouseover',function(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').invoke('observe','click',function(){$('document_description_short').hide();});$('metadata-about').down('.to_reveal .less').observe('click',function(){$('document_description_short').show();$('metadata-about').down('.revealer').show();});}
Scribd.documentEditForm=Class.create({initialize:function(){this.show_edit=$('docinfo_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_description_edit_field','document_tags_edit_form','document_category_edit_form');this.edit_view_containers=$$('#document_description_full > p, #document_tags_view > p, #document_category_view');this.form_footer=$('metadata-about').down('.form_footer');this.spinner=this.form_footer.down('.spinner');this.doc_desc_short=$('document_description_short');this.uneditable=$$('.uneditable');this.doc_edit_open=false;this.cancel_edit.observe('click',this.cancelEdit.bindAsEventListener(this));this.form_footer.down('.cancel_edit').observe('click',this.cancelEdit.bindAsEventListener(this));this.show_edit.observe('click',this.startEdit.bindAsEventListener(this));$('document_edit_form').observe('submit',this.submit.bindAsEventListener(this));},submit:function(e){e.stop();var form=e.element();var params=Form.serializeElements($$('#document_description, #tags'),true);var cats=Form.serializeElements($$('#document_category_edit_form select'),true);if(Object.values(cats).size()>0){var category_id=("document[child_category_id]"in cats)?cats['document[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;this.edit_field_containers=$('document_description_edit_field','document_tags_edit_form','document_category_edit_form');this.edit_view_containers=$$('#document_description_full > p, #document_tags_view > p, #document_category_view');}.bind(this)});},startEdit:function(e){e.stop();[this.to_reveal,this.form_footer,this.cancel_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.edit_view_containers,this.uneditable).invoke('hide');if($('doc_edit_undo'))
$('doc_edit_undo').hide();if(!$('metadata-about').visible()&&!!window.metadata_tabs)
metadata_tabs.activateTab($$('#docinfo_tabs li a[href~=#about]').first());this.doc_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_short,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;Scribd.Remote.Link(e,{method:'get',onComplete:function(req){this.edit_field_containers=$('document_description_edit_field','document_tags_edit_form','document_category_edit_form');this.edit_view_containers=$$('#document_description_full > p, #document_tags_view > p, #document_category_view');}.bind(this)});}});Scribd.getMoreComments=function(e,id,page,extras){var url='/documents/'+id+'/comments?page='+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.referrer.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.indexOf(engines[e])>-1)return true;}}
return false;}
Scribd.showAggressiveAds=function(){return(Prototype.Browser.IE&&(Scribd.referrerIsGoogleSearch()||Scribd.referrerIsOtherSearch()))||(!Prototype.Browser.IE&&Scribd.referrerIsOtherSearch());}
Scribd.showLessAggressiveAds=function(){return!Prototype.Browser.IE&&!(Scribd.referrerIsGoogleSearch()||Scribd.referrerIsOtherSearch());}
Scribd.staticLoadScript=function(url){document.write('<script src="',url,'" type="text/javascript"><\/script>');}
Scribd.showICComplete=function(container,tmpl){container=$(container);var nag_update=function(req){container.insert({top:req.responseText});container.fire('Scribd:dom_updated');Scribd.Facebook.getSharedFriends(container.down('.nag .facebook_friends'),6,tmpl,function(){new Effect.Appear(container.down('.nag'));});container.down('#finish_signup').observe('click',Scribd.Facebook.upgradeAccount);container.down('.dismiss a').observe('click',Scribd.Remote.Link.bindAsEventListener(container.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 @ 1305154393 */

if(typeof Wildfire=='undefined'){Wildfire=new Object();Wildfire.LinkedLoading=true;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:(navigator.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 Flash"].description;if(flashDescription!=null){version=flashDescription.split(" ")[2].split(".")[0];}}}
else if(this.isIE&&this.isWin&&!this.isOpera){try{var axo=new ActiveXObject("ShockwaveFlash.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);return this.AC_Generateobj(ret.objAttrs,ret.params,ret.embedAttrs);},AC_GetArgs:function(args,classid,mimeType){var ret={};ret.embedAttrs={};ret.params={};ret.objAttrs={};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.embedAttrs[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/flash/swflash.cab#version=8,0,0,0';ret.objAttrs["classid"]="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000";ret.embedAttrs["type"]="application/x-shockwave-flash";ret.embedAttrs['pluginspage']='http://www.macromedia.com/go/getflashplayer';return ret;}}
Wildfire.onClose=Wildfire.onPostProfile=Wildfire.onPostComment=Wildfire.onSend=Wildfire.onEmail=function(){};Wildfire.modules=new Object();Wildfire.modulesArray=new Array();Wildfire.initShare=function(partner,targetId,width,height,config){return Wildfire._createJSModule("share",''+partner,targetId,width,height,config,'cssURL,cornerRoundness,initialMessageType,domainForCallback,partner,source,partnerData,width,height,emailTabHidden,customCheckboxVisible,customCheckboxChecked,customCheckboxText,'+'internalColor,frameColor,externalColor,tabTextColor,textColor,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(isnotnull(Wildfire.share))Wildfire.share.applyConfig(config);}
Wildfire._GetFlashModuleXMLConfig=function(targetId){document.getElementById(targetId).style.background='';var pdiv=document.getElementById(targetId+"_progress");if(pdiv!=null){pdiv.innerHTML='&nbsp;';pdiv.style.display="none";pdiv.style.visibility="hidden";}
xs=['config',[],['display',['width','height','showCodeBox','rememberMeVisible','emailImportProviders','networksToShow','networksToHide','bookmarksToShow','bookmarksToHide','bulletinChecked','showEmail','showPost','showBookmark','showDesktop','showCloseButton'],'body',['font=fontType','size=fontSize'],['background',['frame-color=frameColor','background-color=internalColor','corner-roundness=cornerRoundness'],'controls',[],['textboxes',[],['inputs',['color=textInputColor','background-color=textInputBackgroundColor','frame-color=textInputBorderColor']],'snbuttons',['color=tabTextColor|snButtonsTextColor','background-color=snButtonsBackgroundColor','frame-color=snButtonsFrameColor','over-color=tabTextColor|snButtonsOverTextColor','over-background-color=snButtonsOverBackgroundColor','over-frame-color=snButtonsOverFrameColor'],'buttons',['font=fontType|buttonFontType','color=buttonTextColor']],'texts background-color="transparent" ',['color=textColor'],['messages',['color=messageTextColor'],'links',['font=linkFontType','color=linkTextColor'],'privacy',['color=privacyTextColor']]]]];var oConfig=Wildfire._GetFlashModuleConfig(targetId);var s=Wildfire._BuildXMLConfigFromJSON(oConfig,xs);return s;}
Wildfire._GetFlashModuleConfigAttribute=function(targetId,configAttribute,canBeTextareaID,network){document.getElementById(targetId).style.background='';var pdiv=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.config[configAttribute];if(typeof AttribValue=='undefined')return null;if(typeof AttribValue=='function')return AttribValue(configAttribute,network);if(canBeTextareaID==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){alert('Wildfire has no modules yet');}
var module=Wildfire.modules[targetId];if(module!=null){var res=module.config;return 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]]!='undefined'){s[s.length]=key+'="';s[s.length]=(''+oConfig[arrKeys[ikey]]).replace('&','&amp;').replace('"','&quot;').replace('<','&lt;').replace('>','&gt;');s[s.length]='" ';break;}}}
if(i+2==xs.length){s[s.length]='/>';}
else{if(typeof xs[i+2]!='string'){s[s.length]='>';s[s.length]=Wildfire._BuildXMLConfigFromJSON(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,config,getParams)
{try{config.location=document.location.href;}catch(err){}
config.partner=partner;config.width=width;config.height=height;if(undef(moduleType)||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.ready=false;module.type=moduleType;module.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";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(Wildfire._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._createTextareaModule=function(width,height,config,targetId){var str='';var defaultContent=config.defaultContent;if(document.getElementById(defaultContent)!=null){defaultContent=document.getElementById(defaultContent).value;}
if(!(config.UIConfig&&(config.UIConfig.indexOf('showCodeBox="false"')!=-1||config.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,config)
{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){blnRecreate=true;document.getElementById(targetId).innerHTML='&nbsp;';idxInArray=this.modules[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(moduleType)||undef(partner)||undef(targetId)||undef(width)||undef(height)||undef(config))return;var module=new Wildfire._FlashModule();this.modulesArray[idxInArray]=this[targetId]=this.modules[targetId]=module;module.idxInArray=idxInArray;module.copyConfig(config);module.queued=false;module.ready=false;module.type=moduleType;module.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.visibility="visible";var pdiv=document.getElementById(moduleId+"_progress");if(pdiv!=null)pdiv.style.display="none";this.modules[moduleId].UIFrame.style.visibility="visible";this.modules[moduleId].applyConfig();this.modules[moduleId].ready=true;setTimeout("Wildfire._raiseModulesUpdate()",1500);};Wildfire._addQSParam=function(module,pName){if(def(typeof module.config)&&def(module.config[pName])){module.qsParams[module.qsParams.length]=pName+'='+Wildfire._URLEncode(module.config[pName]);}};Wildfire._URLEncode=function(s){if(encodeURIComponent){return encodeURIComponent(s);}
else{es=escape(s);return es.replace(/\+/g,'%2b').replace(/%20/g,'+').replace(/[\/]/g,'%2f').replace(/%3D/g,'%3d');}};Wildfire._onCallback=Wildfire._raiseEvent=function(WFEvent){try{switch(WFEvent.type)
{case'send':if(isnotnull(Wildfire.onSend))
Wildfire.onSend(WFEvent);break;case'postComment':if(isnotnull(Wildfire.onPostComment))
Wildfire.onPostComment(WFEvent);break;case'postProfile':if(isnotnull(Wildfire.onPostProfile))
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(isnotnull(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);}}}catch(err){}};Wildfire._Module=function(){}
Wildfire._JSModule=function(){this.formsContainer=null;this.pingTimeout=null;}
Wildfire._JSModule.prototype=new Wildfire._Module();Wildfire._FlashModule=function(){}
Wildfire._FlashModule.prototype=new Wildfire._Module();Wildfire._JSModule.prototype.pingOK=function(ok){window.clearTimeout(this.pingTimeout);this.config.safeMode=!ok;this.init(false);}
Wildfire._FlashModule.prototype.init=function(checkPing){var html='';if((''+this.config.isApply)!='true'&&this.config.hideProgress!=true){document.getElementById(this.id).style.background='url('+this.config.progressImageSrc+') no-repeat center 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_'+this.id,'name','wfmodule_'+this.id,'width',this.config.width,'height',this.config.height,'movie',swf,'quality','high','align','middle','play','true','loop','true','scale','showall','wmode',wmode,'devicefont','false','bgcolor',((this.config.nowmode&&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;visibility:hidden' />";Wildfire._pixeIframeCreated=true;}
this._injectWFCode(html);window['wfmodule_'+this.id]=document.getElementById('wfmodule_'+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+'_UIFrame';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);this.pingTimeout=window.setTimeout("Wildfire.modules['"+id+"'].pingOK(false)",10000);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.getSafeModeURL();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' frameborder=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(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' frameborder=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(\""+id+"\")' id="+uifid+" style='visibility:hidden;width:"+cfg.width+"px;height:"+cfg.height+"px;' src='"+UIURL+"' frameborder=0 scrolling=no></iframe>";html+='<iframe id="IFREndlessActivityBugFix" style="display:none;width:100px;height:10px"></iframe>';html+=this._createCBFrame();formsHTML+="<form id='"+id+"_postForm' action='"+wfroot+"/WFHandler.ashx?cmd=config' method='POST' target='"+id+"_postTargetFrame' style='display:none'></form>";formsHTML+="<form id='"+id+"_sysEventForm' action='"+wfroot+"/WFHandler.ashx?cmd=sysEvent' method='POST' target='"+id+"_sysEventFrame' 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.getElementById(id+"_postForm");this.sysEventForm=document.getElementById(id+"_sysEventForm");if(cfg.simple||cfg.safeMode)this.applyConfig();}
Wildfire._JSModule.prototype._createCBFrame=function()
{if(def(this.config.domainForCallback)&&document.getElementById(this.id+'_wfCBDiv')==null)
{try{document.domain=this.config.domainForCallback;return"<iframe name='"+this.id+"_wfCBFrame' style='visibility:hidden;width:0px;height:0px;' src='http://wildfire."+this.config.domainForCallback+"/wildfire/WFHandler.ashx?domain="+escape(this.config.domainForCallback)+"'></iframe>";}catch(ex){return"";}}else{return"";}}
Wildfire._FlashModule.prototype.copyConfig=Wildfire._JSModule.prototype.copyConfig=function(config)
{if(config!=null){this.config={};for(var key in config)this.config[key]=config[key];}
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")return"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.parentNode);if(el!=null){this.container.innerHTML=html;this.formsContainer=document.createElement('div');this.formsContainer.style.display='none';el.parentNode.insertBefore(this.formsContainer,el);this.formsContainer.innerHTML=formsHTML;}else
{this.container.innerHTML=html+formsHTML;}};Wildfire._FlashModule.prototype._injectWFCode=function(html){this.container.innerHTML=html;};Wildfire._JSModule.prototype.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!='function'&&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=function(conf){conf.isApply="true";return Wildfire._createFlashModule(this.type,this.partner,this.id,this.width,this.height,conf);};Wildfire._JSModule.prototype.applyConfig=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=document.location.href;}catch(err){}}
cfg.partner=this.partner;cfg.width=this.width;cfg.height=this.height;postContent=['default','myspace','hi5','friendster','xanga','livejournal','freewebs','facebook','bebo','blogger','tagged','typepad','blackplanet'];for(var pci=0;pci<postContent.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(shareTemplates[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();',1000);};Wildfire._EndlessActivityBugFix=function(){var ifr=document.getElementById('IFREndlessActivityBugFix');if(ifr!=null){ifr.src='http://cdn.gigya.com/wildfire/i/n.gif';}};Wildfire._JSModule.prototype._getTemplate=function(key){if(isnotnull(this.config[key])){try{if(isnotnull(document.getElementById(this.config[key])))
this.config[key]=document.getElementById(this.config[key]).value;}catch(e){}}};Wildfire._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(++queueSpace*2>=queue.length){for(var i=queueSpace;i<queue.length;i++)queue[i-queueSpace]=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;var 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=['iframe'];}
else{tags=['embed','iframe'];}
for(var itag=0;itag<tags.length;itag++){tagname=tags[itag];elements=document.getElementsByTagName(tagname);for(var i=0;i<elements.length;i++){var el=elements[i];if(el.style.visibility!='hidden'&&container.childNodes[0]!=el){var epos=Wildfire._GetElementPos(el);var etop=epos.top;var eleft=epos.left;var elcs=(document.defaultView)?document.defaultView.getComputedStyle(el,""):el.currentStyle;var eright=eleft+parseInt(elcs.getPropertyValue?elcs.getPropertyValue('width'):elcs.width);var ebottom=etop+parseInt(elcs.getPropertyValue?elcs.getPropertyValue('height'):elcs.height);if(!((etop>cbottom)||(ebottom<ctop)||(eleft>cright)||(eright<cleft))){var isNonGigyaIframe=(tagname=='iframe')&&((el.id+'          ').substr(0,10)!='gigya_ifr_');if(((tagname=='embed')&&((el.getAttribute('wmode')==null)||(el.getAttribute('wmode')=='')||(el.getAttribute('wmode')=='window')))||isNonGigyaIframe){if(blnHide&&(container.id!='coreDiv')){el.style.visibility='hidden';if(container.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.position='absolute';ifrel.style.width='1px';ifrel.style.height='1px';if(ifrel.style.zIndex!=null){ifrel.style.zIndex=Wildfire._NextZIndex++;}}
var el=document.createElement('div');el.style.position='absolute';if(el.style.zIndex!=null){el.style.zIndex=Wildfire._NextZIndex++;}
var html='';el.innerHTML=html;el.id=id;el.swfLoaded=false;if(document.body){if(document.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<elementsToShowOnClose.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')params.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_button.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["showPost"]="false";break;case'post':params.conf["showEmail"]="true";params.conf["showBookmark"]="true";default:altText='Post to my social network or blog';}
switch(params['theme']){case'1':params.conf['UIConfig']='<config><display showEmail="true" useTransitions="true" showBookmark="true"></display><body corner-roundness="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 gradient-color-begin="E9F0F3" gradient-color-end="E9F0F3"></inputs><dropdowns list-item-over-color="#1B0D6D" gradient-color-begin="E9F0F3" gradient-color-end="E9F0F3" list-item-over-gradient-color-end="#28516D"></dropdowns></textboxes><buttons gradient-color-begin="#0099FF" gradient-color-end="#223276" color="#FFFFFF" corner-roundness="0;8;0;8" font="arial" size="11" bold="true" over-gradient-color-begin="#0099FF" over-gradient-color-end="#0099FF"></buttons><servicemarker gradient-color-begin="Transparent" gradient-color-end="#0098FE"></servicemarker></controls><texts color="#FFFFFF" bold="true"><privacy color="#AAAAAA"></privacy><labels color="C1D7E5"></labels><messages color="#F4F4F4" background-color="#1B366D" bold="true"></messages><links color="E9F0F3" underline="false" over-color="#ADC8FF"></links></texts></body></config>';break;case'2':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" gradient-color-begin="#353535" gradient-color-end="#606060" corner-roundness="8;8;8;8"></background><controls size="11" bold="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="Transparent"></more></snbuttons><textboxes frame-color="#000000" color="#AAAAAA" corner-roundness="0;0;0;0" gradient-color-begin="#202020" gradient-color-end="#0B0B0B" font="Arial" bold="false"><codeboxes color="#EAEAEA" frame-color="#8A8A8A" gradient-color-begin="#000000" font="Arial" bold="false"></codeboxes><inputs frame-color="#6D0000"></inputs><dropdowns frame-color="#6D0000" handle-gradient-color-begin="#B60000" handle-gradient-color-end="#6D0000" handle-over-gradient-color-begin="#FF0000" handle-over-gradient-color-end="#DA0000" handle-down-gradient-color-begin="#FF0000" handle-down-gradient-color-end="#6D0000" background-color="#6D0000" gradient-color-begin="#000000" font="Arial" bold="false"></dropdowns></textboxes><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" down-gradient-color-begin="#910000" over-gradient-color-end="#DA0000" down-gradient-color-end="#FF0000" over-color="#F4F4F4"><post-buttons gradient-color-begin="#FF4949" gradient-color-end="#6D0000"></post-buttons></buttons><listboxes corner-roundness="5"></listboxes><checkboxes down-corner-roundness="0"></checkboxes><servicemarker gradient-color-begin="#DA0000" gradient-color-end="#DA0000"></servicemarker></controls><texts color="#FFFFFF" font="Arial" size="10"><privacy color="#959595" size="11"></privacy><headers size="11" bold="true"></headers><labels size="11" bold="true"></labels><messages color="#D5D5D5" frame-thickness="0" corner-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;case'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" gradient-color-begin="#DA0000" gradient-color-end="#FFC8AD" corner-roundness="8;8;8;8"></background><controls size="11" bold="true"><snbuttons type="textUnder" frame-color="#DA0000" background-color="#FFFFFF" over-frame-color="#F4F4F4" over-background-color="#FFFFFF" color="#6D0000" corner-roundness="0;8;8;8" gradient-color-begin="#6D0000" gradient-color-end="#6D0000" font="Arial" size="11" bold="true" down-frame-color="#6D0000" over-gradient-color-begin="#FFAD9F" down-gradient-color-begin="#910000" over-gradient-color-end="#6D0D1B" down-gradient-color-end="#FFAD9F" over-color="#F4F4F4" down-color="#000000"><more frame-color="#AAAAAA" over-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="#FF5B40" gradient-color-end="#6D0D1B" down-frame-color="6D0000" down-background-color="DBDBDB" over-gradient-color-begin="#910000" down-gradient-color-begin="FF5B40" 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-begin="#EAEAEA" gradient-color-end="#F4F4F4" font="Arial" bold="false"></codeboxes><inputs frame-color="#B60000" color="#606060" gradient-color-begin="#DFDFDF" gradient-color-end="#DFDFDF"></inputs><dropdowns list-item-over-color="#FF2424" frame-color="#B60000" handle-gradient-color-begin="#AEC8F7" handle-gradient-color-end="#6D0000" handle-over-gradient-color-begin="#AEC8F7" handle-over-gradient-color-end="#AEC8F7" handle-down-gradient-color-begin="#FF0000" handle-down-gradient-color-end="#6D0000" background-color="#EAEAEA" color="#4A4A4A" gradient-color-begin="#EAEAEA" gradient-color-end="#EAEAEA" font="Arial" bold="false" list-item-over-gradient-color-end="#F4F4F4"></dropdowns></textboxes><buttons frame-color="#DA0000" gradient-color-begin="#FF0000" gradient-color-end="#910000" color="#F4F4F4" corner-roundness="0;8;8;8" font="Arial" size="10" bold="true" over-frame-color="#DA0000" down-frame-color="#F4F4F4" over-gradient-color-begin="#DA0000" down-gradient-color-begin="#910000" over-gradient-color-end="#910000" down-gradient-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-end="#555555"></servicemarker></controls><texts color="#FFFFFF" font="Arial" size="10" bold="true"><privacy color="#910000" size="11" bold="false"></privacy><headers 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="false" size="11" bold="true" over-color="#FFFFFF"></links></texts></body></config>';break;case'4':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" gradient-color-begin="#A4DA52" gradient-color-end="#6D9136" corner-roundness="8"></background><controls size="11" bold="true"><snbuttons type="textUnder" frame-color="#6D9136" background-color="#FFFFFF" over-frame-color="#D5D5D5" over-background-color="#FFFFFF" color="#1B6D0D" corner-roundness="0;8;0;8" gradient-color-begin="#88B644" gradient-color-end="#000000" font="Arial" size="11" bold="true" over-gradient-color-begin="#88B644" down-gradient-color-begin="#DADA6D" over-gradient-color-end="#000000" down-gradient-color-end="#6D9136" over-color="#F4F4F4" down-color="#000000"><more frame-color="#BABABA" gradient-color-begin="#516D28" gradient-color-end="#516D28" bold="true"></more><previous frame-color="#BABABA" gradient-color-begin="#516D28" gradient-color-end="#516D28"></previous></snbuttons><textboxes frame-color="#000000" color="#AAAAAA" corner-roundness="0;8;0;8" gradient-color-begin="#6D5128" gradient-color-end="#6D5128" font="Verdana" corner-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><inputs frame-color="#6D1B0D" color="#FFFFC8" gradient-color-begin="#919148" gradient-color-end="#919148" font="Arial"></inputs><dropdowns list-item-over-color="6D1B0D" frame-color="#6D1B0D" handle-gradient-color-begin="#FFFFC8" handle-gradient-color-end="#DADA6D" handle-over-gradient-color-begin="#FFFFC8" handle-over-gradient-color-end="#FFFFB6" handle-down-gradient-color-begin="#DADA6D" handle-down-gradient-color-end="#DADA6D" background-color="#FFFFC8" color="#FFFFC8" gradient-color-begin="#919148" gradient-color-end="#919148" font="Arial" bold="false" list-item-over-gradient-color-end="#FFFFC8"></dropdowns></textboxes><buttons frame-color="6D1B0D" gradient-color-begin="#FFFFC8" gradient-color-end="#B6B65B" corner-roundness="0;8;8;8" font="Arial" size="11" bold="true" over-frame-color="#6D1B0D" down-frame-color="#F4F4F4" over-gradient-color-begin="#FFFFC8" down-gradient-color-begin="#F4F4F4" over-gradient-color-end="#DADA6D" down-gradient-color-end="#FFFF92" over-color="#28516D"><post-buttons frame-color="#6D1B0D" background-color="#FFFFC8" gradient-color-begin="#FFFFC8" gradient-color-end="B6B65B"></post-buttons></buttons><listboxes corner-roundness="5;5;5;5" bold="false"></listboxes><checkboxes down-corner-roundness="0"></checkboxes><servicemarker gradient-color-begin="#A4DA52" gradient-color-end="#516D28"></servicemarker></controls><texts 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>';break;case'5':params.conf['UIConfig']='<config><display showEmail="true" useTransitions="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" corner-roundness="0;10;0;10" size="11" bold="false" over-color="#0D1B6D"></snbuttons><textboxes><codeboxes color="#6A6A6A" frame-color="#1B366D" background-color="#F4F4F4"></codeboxes></textboxes><buttons gradient-color-begin="#0099FF" gradient-color-end="#223276" color="#FFFFFF" corner-roundness="0;8;0;8" font="arial" size="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"><privacy color="#AAAAAA"></privacy><labels color="#1B366D"></labels><messages color="#F4F4F4" background-color="#1B366D" bold="true"></messages><links color="#376DDA" underline="false" over-color="#1B366D"></links></texts></body></config>';break;case'6':params.conf['UIConfig']='<config><display showEmail="true" useTransitions="true" showBookmark="true" codeBoxHeight="auto" showCodeBox="true" showCloseButton="false" networksWithCodeBox=""></display><body><background frame-color="#BFBFBF" background-color="#FFFFFF" gradient-color-begin="#ffffff" gradient-color-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-frame-color="#60BFFF" color="#808080" gradient-color-begin="#FFFFFF" gradient-color-end="d4d6d7" size="10" bold="false" down-frame-color="#60BFFF" down-gradient-color-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" gradient-color-end="#BBE4FF" over-gradient-color-begin="#A4DBFF" over-gradient-color-end="#F4F4F4"></more><previous frame-color="#BBE4FF" over-frame-color="#A4DBFF" gradient-color-begin="#FFFFFF" gradient-color-end="#A4DBFF" over-gradient-color-begin="#A4DBFF" over-gradient-color-end="#F4F4F4"></previous></snbuttons><textboxes frame-color="#CACACA" color="#757575" gradient-color-begin="#ffffff" bold="false"><codeboxes color="#757575" frame-color="#DFDFDF" background-color="#FFFFFF" gradient-color-begin="#ffffff" gradient-color-end="#FFFFFF" size="10"></codeboxes><inputs frame-color="#CACACA" color="#757575" gradient-color-begin="#F4F4F4" gradient-color-end="#ffffff"></inputs><dropdowns frame-color="#CACACA" list-item-over-color="#52A4DA" ></dropdowns></textboxes><buttons frame-color="#8DD1FF" gradient-color-end="#BBE4FF" color="#202020" bold="false" over-gradient-color-begin="#BBE4FF" down-gradient-color-begin="#BBE4FF" over-gradient-color-end="#FFFFFF" down-gradient-color-end="#ffffff"><post-buttons frame-color="#8DD1FF" gradient-color-end="#BBE4FF"></post-buttons></buttons><listboxes frame-color="#CACACA" corner-roundness="4;4;4;4" gradient-color-begin="#F4F4F4" gradient-color-end="#FFFFFF"></listboxes><checkboxes checkmark-color="#00B600" frame-color="#D5D5D5" corner-roundness="3;3;3;3" gradient-color-begin="#F4F4F4" gradient-color-end="#FFFFFF"></checkboxes><servicemarker gradient-color-begin="#ffffff" gradient-color-end="#D5D5D5"></servicemarker><tooltips color="#6D5128" gradient-color-begin="#FFFFFF" gradient-color-end="#FFE4BB" size="10" frame-color="#FFDBA4"></tooltips></controls><texts color="#202020"><headers color="#202020"></headers><messages color="#202020"></messages><links color="#52A4DA" underline="false" over-color="#353535" down-color="#353535" down-bold="false"></links></texts></body></config>';break;}
params.conf.showCloseButton=true;params.conf.wmodeType='opaque';params.conf.cornerRoundness=0;params.conf.onClose=Wildfire._hideWildfirePopup;params.conf.onRenderDone=function(o){var popDiv=document.getElementById(o.ModuleID);popDiv.style.visibility="";Wildfire._GetContainer(o.ModuleID+'Progress').style.visibility="hidden";popDiv.style.zIndex=Wildfire._NextZIndex++;}
Wildfire._popupConfigs.push(params.conf);var configID=Wildfire._popupConfigs.length-1;var html='<img id="Wildfire_Button'+configID+'" src="'+params.btnurl+'" style="cursor: pointer" border=0 alt="'+altText+'" title="'+altText+'" />';if(params.button_divID){document.getElementById(params.button_divID).innerHTML=html}else{document.write(html);}
var btn=document.getElementById('Wildfire_Button'+configID);btn.openWildfirePopup=function(){btn.mouseIsOut=true;Wildfire._showWildfirePopup(params.partner,params.w,params.h,configID);}
btn.onmouseout=function(){btn.mouseIsOut=true;}
if(typeof Wildfire.buttonsData=='undefined')Wildfire.buttonsData={};switch(params.b.toLowerCase()){case'mouseover':btn.configID=configID;Wildfire.buttonsData[configID]=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.getElementById('gigya_ifr_'+id);if(wfDiv){var elementsToShowOnClose=wfDiv.elementsToShowOnClose;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.removeChild(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(typeof(window.pageYOffset)=='number'){scrOfY=window.pageYOffset;scrOfX=window.pageXOffset;}else if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){scrOfY=document.body.scrollTop;scrOfX=document.body.scrollLeft;}else if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){scrOfY=document.documentElement.scrollTop;scrOfX=document.documentElement.scrollLeft;}
return[scrOfX,scrOfY];}
Wildfire._GetContainer=function(id){if(id=='')return null;var el=document.getElementById(id);if(typeof(el)=='Array'){return el[el.length];}
return el;}
Wildfire._preparePopup=function(w,h,id,btnDiv,progressImageSrc){var wfDiv=Wildfire._CreateContainer(id);var progressDiv=Wildfire._CreateContainer(id+'Progress',true);var dst;dst=wfDiv.style;var vph;var vpw;var de=document.documentElement;vph=de.clientHeight;vpw=de.clientWidth;if(typeof vph=='undefined'||vph==0){vph=document.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=Wildfire._GetElementPos(btnDiv);if(btnPos.top>middlePointTop){dst.top=''+(btnPos.top-h)+'px';}else{dst.top=''+(btnPos.top+btnDiv.height)+'px';}
if(btnPos.left>middlePointLeft){dst.left=''+(btnPos.left+btnDiv.width-w)+'px';}else{dst.left=''+btnPos.left+'px';}
dst.width=''+w+'px';dst.height=''+h+'px';progressDiv.style.position='absolute';progressDiv.style.background='url('+progressImageSrc+') no-repeat center center';progressDiv.style.width=dst.width;progressDiv.style.height=dst.height;progressDiv.style.top=dst.top;progressDiv.style.left=dst.left;var ifrel=document.getElementById('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='wildfire_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,width,height,Wildfire._popupConfigs[configID]);}}
Wildfire.revealDiv=function(divID,maxHeight){var div=document.getElementById(divID);var nextHeight=parseInt(div.style.height.replace('px',''))+20;if(nextHeight<maxHeight){var ifrel=document.getElementById('gigya_ifr_'+divID);div.style.height=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')==null&&document.body!=null){var cimp=document.createElement('div');cimp.id='wildfire_cimp';cimp.width=1;cimp.height=1;cimp.style.display='none';cimp.style.visibility='hidden';cimp.style.position='absolute';cimp.innerHTML='<img src="http://cdn.gigya.com/wildfire/i/CIMP.gif?CXNID=2000002.0NXC" />';document.body.insertBefore(cimp,document.body.firstChild);}}
if(typeof WildfireBtn!='undefined'&&typeof WildfireBtn.pendingButtons!='undefined'){for(var i=0;i<WildfireBtn.pendingButtons.length;i++){Wildfire.drawWildfireButton(WildfireBtn.pendingButtons[i]);}}


/* public/javascripts/starbox.js @ 1305154393 */

var Starboxes={options:{buttons:5,className:'default',color:false,duration:0.6,effect:{mouseover:false,mouseout:(window.Effect&&Effect.Morph)},hoverColor:false,hoverClass:'hover',ghostColor:false,ghosting:false,identity:false,indicator:false,inverse:false,locked:false,max:5,onRate:Prototype.emptyFunction,rated:false,ratedClass:'rated',rerate:false,overlay:'default_gradient.png',overlayImages:Scribd.cdn_path+'images/starbox/',stars:5,total:0}};eval(function(p,a,c,k,e,r){e=function(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=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(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}2N{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.23==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.18(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|function|var|setStyle|new|rated|Starboxes|return|average|px|element|Element|total|effect|div||insert|bind|left||colorbar|src|max|scope|rating|buildQueue|each|height|width|mouseout|identity|buttons|absolute|ghost|Object|identify|mouseover|locked|boxWidth|position|addClassName|className|background|setBarPosition|Effect||indicator|Prototype|starbox|starbar|starWidth|starHeight|buttonWidth|getBarPosition|status|extend|window|push|processBuildQueue|imageInfo|click|Browser|IE|on|buttonRating|top|hover|rerated|hoverClass|require|overlayImages|imageSource|else|convertVersionString|_|parseInt|times|arguments|imagecache|getCachedImage|buildBatch|useEvent|rerate|_cached|starSrc|stars|base|wrapper|Morph|color|inputs|updateIndicator|activeEffect_|abs|fire|hovered|hoverColor|load|counter|find|replace|REQUIRED_|Starbox|fixIE|false|id|queueBuild|batchLoading|true|cacheBuildBatch|overlay|fullsrc|build|capture|observe|enable|capitalize|invoke|cursor|disable|zeroPosition|maxPosition|relative|star|container|hidden|ghosting|ghostColor|inverse|update|value|updateAverage|duration|onMouseout|REQUIRED_Prototype|REQUIRED_Scriptaculous|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|isElement|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|sizingMethod|scale|input|type|name|Template|evaluate|round|ceil|floor|Queues|get|remove|getStyle|toFixed|style|queue|end|limit|onClick|onRate|removeClassName|onMouseover|changed'.split('|'),0,{}));


/* public/javascripts/cookiejar.js @ 1305154393 */

var CookieJar=Class.create();CookieJar.prototype={appendString:"__CJ_",initialize:function(options){this.options={expires:3600,path:'',domain:'',secure:''};Object.extend(this.options,options||{});if(this.options.expires!=''){var date=new Date();date=new Date(date.getTime()+(this.options.expires*1000));this.options.expires='; 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.options.secure='';}},put:function(name,value){name=this.appendString+name;cookie=this.options;var type=typeof value;switch(type){case'undefined':case'function':case'unknown':return false;case'boolean':case'string':case'number':value=String(value.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 false;}
return true;},remove:function(name){name=this.appendString+name;cookie=this.options;try{var date=new Date();date.setTime(date.getTime()-(3600*1000));var expires='; expires='+date.toGMTString();document.cookie=name+"="+expires+cookie.path+cookie.domain+cookie.secure;}catch(e){return false;}
return true;},get:function(name){name=this.appendString+name;var cookies=document.cookie.match(name+'=(.*?)(;|$)');if(cookies){return(unescape(cookies[1])).evalJSON();}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=this.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.cookie;CJRe=new RegExp("^"+this.appendString);while((match=keyRe.exec(str))!=undefined){if(CJRe.test(match[0].strip())){keys.push(match[0].strip().gsub("^"+this.appendString,""));}}
return keys;}};


/* public/javascripts/login.js @ 1305154393 */

if(!window.Scribd)var Scribd=new Object();Scribd.loginManager=Class.create({initialize:function(options){this.hasFBCallback=false;this.options=options||{};this.explanations={premium_reader:'',follow:'to Subscribe to this user',comment:'to Scribble a Comment',readcast:'to Readcast',download:'to Download a Document',discussion:'to Participate in This Discussion',add_to_collections:'to Add This Document to Your Collections',join:'',upload:'to Publish Your Documents',view_purchased_document:'to View Your Purchased Document',status_reply:'to Reply Status Messages',comment_reply:'to Reply to this Comment',rate:'to Rate this Document',trial:'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('.global_login_form');this.signup_form=login_lb.down('.global_signup_form');this.login_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_toggle=login_lb.down('.signup_toggle');this.login_toggle=login_lb.down('.login_toggle');this.setEvents();},setEvents:function(){$$('#login_lb .lightbox_form').invoke('observe','submit',this.sendForm.bindAsEventListener(this));$('login_lb').select('.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.element();Scribd.Remote.Form(form);},checkField:function(url,el){var name=Element.readAttribute(el,'name');var name_parsed=name.match(/\[([a-z_]+)\]/i);if(name_parsed.length>1)
name=name_parsed[1];var value=$F(el);if(value)
new Ajax.Request(url,{asynchronous:true,evalScripts:true,parameters:name+'='+escape(value)});},open:function(options){if(this.login_form){if(options.context=='join'){this.login_toggle.hide();}else{this.login_toggle.show();}
this.login_form.down('.hidden').update('');this.signup_form.down('.hidden').update('');$H(options).each(function(pair){var input=new Element('input',{'type':'hidden','value':pair.value,'name':'login_params['+pair.key+']'});this.login_form.down('.hidden').appendChild(input);this.signup_form.down('.hidden').appendChild(input.cloneNode(true));$('login_lb').select('.login_add_hidden_form_fields_for_options').each(function(e){e.appendChild(input.cloneNode(true));});}.bind(this));if(options.fallback_url&&$('openid_form')){var input=new Element('input',{'type':'hidden','value':options.fallback_url,'name':"login_params[next_url]"});$('openid_form').appendChild(input);}
if(this.login_header){var exp=this.explanations[options.context];if(exp){this.login_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{var url=this.after_facebook_login_url;}
new Ajax.Request(url,{method:'post',parameters:options,asynchronous:true,evalScripts: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.reload();}}});


/* public/javascripts/generic_form_handler.js @ 1305154393 */

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_element;}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));this.form.scribd_handler=this;},submit:function(){this.formSubmitted(null);},formSubmitted:function(e){if(e){Event.stop(e);}
if(this.isSubmittable()){this.outer_element.select(".gfh_pre_submit").invoke("hide");new Ajax.Request(this.form.action,{asynchronous:true,evalScripts:true,method:'post',parameters:Form.serialize(this.form),onLoading:this.onLoading.bind(this),onLoaded:this.onLoaded.bind(this),onSuccess:this.onSuccess.bind(this),onFailure:this.onFailure.bind(this)});}},onLoading:function(ajax_request){this.loading();},loading:function(){this.outer_element.select('.gfh_loading').invoke('show');this.outer_element.select(".gfh_success").invoke("hide");this.outer_element.select(".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_detail: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);}}catch(e){this.clientFailed(e);}},onFailure:function(ajax_request){var data=this.parseResponse(ajax_request);if(!data){return;}
try{this.failed(data);}catch(e){this.clientFailed(e);}},onComplete:function(succeeded){this.outer_element.select(".gfh_pre_complete").invoke("hide");this.outer_element.select(".gfh_pre_complete_"+(succeeded?"success":"failure")).invoke("hide");},succeeded:function(data){this.bindData(data,true,true);this.onComplete(true);},failed:function(data){this.bindData(data,false,false);this.onComplete(false);},clientFailed:function(exception){this.bindData({failure_message:"Client failed",failure_debugging_detail:exception.toString()},false);},bindData:function(object,isSuccess,throwOnMissing){if(isSuccess){this.outer_element.select(".gfh_success").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_href"];var elementsToBind=[];bindClasses.each(function(i){elementsToBind=elementsToBind.concat(theElement.select("."+i));});elementsToBind.each(function(sub_element){sub_element.classNames().each(function(class_name){if(bindClasses.include(class_name)||class_name=="gfh_bind_required"){}else{var results=class_name.match(/^gfh_bind_(.*)$/i);if(results){var desiredValueName=results[1];var actualValue=object[desiredValueName];if((!actualValue)&&(sub_element.hasClassName("gfh_bind_required"))&&throwOnMissing){throw"Server did not return required data '"+desiredValueName+"'";}
if(actualValue){if(sub_element.hasClassName("gfh_bind_text")){sub_element.update(actualValue);}else if(sub_element.hasClassName("gfh_bind_href")){sub_element.href=actualValue;}}}}});});}});


/* public/javascripts/anonymous.js @ 1305154393 */

if(!window.Scribd)var Scribd=new Object();if(!window.Scribd.uploads)window.Scribd.uploads=new Object();Scribd.uploads.anonymous={setClaimHandlers:function(enclosingDivName,entireUiDivName,claimHandlersOptions){var func=function(){var enclosingDiv=$(enclosingDivName);if(!enclosingDiv){throw"No enclosing div: "+enclosingDivName;}
var entireUiDiv=$(entireUiDivName);if(!entireUiDiv){throw"No entire-UI div: "+entireUiDivName;}
var newEmailHandler=Class.create(Scribd.common.genericFormHandler,{isSubmittable:function(){var emailInput=this.form.down("input[name='email']");return(!emailInput.getValue().blank());},failed:function($super,data){enclosingDiv.down('.anonymous_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("input[name='email']").getValue();enclosingDiv.down('.anonymous_merge_accounts').blindDown();}else{$super(data);}},loading:function($super){$super();enclosingDiv.down('.anonymous_claim_other').hide();},succeeded:function($super,data){$super(data);if(window.setPrivate){window.setPrivate(false);}
if(claimHandlersOptions['reload_on_signup']){this.doReload.delay(2);}},doReload:function(){window.location.reload(true);}});new newEmailHandler(enclosingDiv.down(".anonymous_claim_new_email"));var mergeAccountsLink=enclosingDiv.down('.anonymous_merge_accounts_link');if(!mergeAccountsLink){throw"No mergeAccountsLink";}
Event.observe(mergeAccountsLink,'click',function(e){Event.stop(e);var elem=enclosingDiv.down('.anonymous_merge_accounts');if(elem.visible()){elem.hide();}else{elem.show();}});var mergeAccountsHandler=Class.create(Scribd.common.genericFormHandler,{isSubmittable:function(){return((!this.form.down("input[name='email']").getValue().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(".anonymous_merge_accounts").down(".reset_password_form").hide();if(claimHandlersOptions['reload_on_signup']){this.doReload.delay(2);}else{(function(){entireUiDiv.blindUp();}).delay(4);}},doReload:function(){window.location.reload(true);}});var mergeAccountsDiv=enclosingDiv.down('.anonymous_merge_accounts');new mergeAccountsHandler(mergeAccountsDiv.down(".merge_accounts_form"));var resetPasswordHandler=Class.create(Scribd.common.genericFormHandler,{isSubmittable:function(){var email=mergeAccountsDiv.down(".merge_accounts_form").down("input[name='email']").getValue();if(email.blank()){var pleaseEnterEmail=this.outer_element.down(".please_enter_email");pleaseEnterEmail.show();new Effect.Fade(pleaseEnterEmail,{duration:2});return false;}else{this.form.down("input[name='email']").value=email;return true;}}});var resetPasswordForm=enclosingDiv.down(".reset_password_form");new resetPasswordHandler(resetPasswordForm);var resetPasswordLink=mergeAccountsDiv.down("a.reset_password");Event.observe(resetPasswordLink,'click',function(e){resetPasswordForm.scribd_handler.submit();});var disclaimDiv=enclosingDiv.down(".anonymous_disclaim");if(disclaimDiv){var disclaimHandler=Class.create(Scribd.common.genericFormHandler,{isSubmittable:function(){return confirm("Are you sure these documents aren't yours? You won't be able to delete them, make them public or private, or change them in any way.");},succeeded:function($super,data){$super(data);Effect.BlindUp(entireUiDiv.id);}});new disclaimHandler(disclaimDiv);Event.observe(disclaimDiv.down('a'),'click',function(e){Event.stop(e);enclosingDiv.down('.anonymous_disclaim').scribd_handler.submit();})}}
if(claimHandlersOptions['lightbox']){func();}else{Event.observe(window,'load',func);}}};


/* public/javascripts/comment.js @ 1305154393 */

if(!window.Scribd)var Scribd=new Object();Scribd.commentManager=Class.create({initialize: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.page_num=1;this.input_selector='textarea';},deleteEvent:function(event_id,url){var 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 Effect.Fade(item,{duration:0.5});});(function(){ev.className='';Scribd.Alerts.success_red(ev,'Entry Deleted');}).delay(0.5);},flagEvent:function(event_id,url,container){var ev=$('document_event_container_'+event_id);new Ajax.Request(url,{asynchronous:true,evalScripts:true,method:'post'});var flag_container=container.up('.flag_container');msg=new Element('span').update('You have successfully reported this item!').addClassName('flag');flag_container.insert(msg).removeClassName('flag_container');container.remove();},getMoreTimeline:function(link,url,page){$(link).hide();$('timeline_spinner').show();trackEvent('Timeline Feed',page,'View More - 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).empty()){$('document_event_reply_spinner_'+event_id).show();var after=function(){$('document_event_reply_spinner_'+event_id).hide();$('document_event_reply_container_'+event_id).down('.event_reply_fields '+that.input_selector).focus();};new Ajax.Request(url,{evalScripts:true,method:'get',onComplete:after});}else{$('document_event_reply_container_'+event_id).toggle();if($('document_event_reply_container_'+event_id).style.display!='none'){$('document_event_reply_container_'+event_id).down('.event_reply_fields '+that.input_selector).focus();}}},submitCommentEvent:function(e){var form=e.element();e.stop();this.submitComment(form);},displayComment: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,{onComplete:function(req){form.down(that.input_selector).value='';form.down(that.input_selector).removeClassName('taller');if(form.down('.spinner'))form.down('.spinner').hide();form.enable();var comment=$('document_activity').select('.document_event_container').first();that.displayComment(comment);$('document_activity').fire('Scribd:dom_updated');}});}});Scribd.scribbleComment=function(el){el.observe('focus',function(e){this.addClassName('taller')});el.observe('blur',function(e){if(!$F(this))this.removeClassName('taller')});}


/* public/javascripts/status_updater.js @ 1305154393 */

var StatusUpdater=Class.create({tracking:false,textLimit:400,currentDocId:0,docLock:false,manualSelection:false,initialMessage:"... or scribble what you're reading!",initialize:function(container,id,post_url){this.postUrl=post_url;this.objectId=id;this.opened=false;this.container=container;this.statusFormElement=this.container.down('form');this.statusTextarea=this.container.down('.status_update_textarea');this.submitButton=this.container.down('.status_submit');this.statusForm=this.container.down('.status_updater_form');this.statusSpinner=this.container.down('.status_spinner');this.isReply=(this.submitButton.getAttribute('data-is-reply')=='true');if(trackEvent)
this.tracking=true;this.setupEvents();},setupEvents:function(){if(!this.isReply&&this.statusForm){if(this.statusTextarea.value==''){var dt=new Element('div',{'class':'default_text'}).update(this.initialMessage);var d=$(this.statusTextarea).positionedOffset();dt.setStyle({top:d.top+'px',left:d.left+'px'});this.statusForm.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));this.statusTextarea.observe('blur',function(e){if(this.statusTextarea.value==''){var 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){this.statusTextarea.focus();}.bindAsEventListener(this));this.statusFormElement.observe('submit',function(e){e.stop();this.submit();}.bindAsEventListener(this))}
this.statusTextarea.observe('keyup',this.truncateText.bind(this));},submit:function(){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,evalScripts:true,onComplete:function(request){this.submitButton.removeClassName('button_disabled');this.statusTextarea.value='';this.statusSpinner.hide();this.clearDocument();this.submitButton.disabled=false;if(this.isReply){this.container.up('.autogen_class_views_events_base_feed_item').replace(request.responseText);}else{var status=$('timeline').down('.autogen_class_views_events_base_feed_item');if(status&&!status.visible()){status.setOpacity(0);new Effect.BlindDown(status,{transition: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.value.length>this.textLimit){this.statusTextarea.value=this.statusTextarea.value.substring(0,this.textLimit);}},enableSubmitButton:function(e){if(((this.statusTextarea.value.length==0)&&(this.currentDocId==0))){this.submitButton.disabled=true;this.submitButton.addClassName('button_disabled');}else{this.submitButton.disabled=false;this.submitButton.removeClassName('button_disabled');}}});


/* public/javascripts/pcarousel.js @ 1305154393 */

Carousel=Class.create(Abstract,{initialize:function(scroller,slides,controls,options){this.scrolling=false;this.scroller=$(scroller);this.slides=slides;this.controls=controls;this.options=Object.extend({duration:1,auto:false,frequency:3,visibleSlides:1,controlClassName:'carousel-control',jumperClassName:'carousel-jumper',disabledClassName:'carousel-disabled',selectedClassName:'carousel-selected',circular: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){this.controls.invoke('observe','click',this.click.bind(this));}
if(this.options.wheel){this.scroller.observe('mousewheel',this.wheel.bindAsEventListener(this)).observe('DOMMouseScroll',this.wheel.bindAsEventListener(this));;}
if(this.options.auto){this.start();}
if(this.options.initial){var initialIndex=this.slides.indexOf($(this.options.initial));if(initialIndex>(this.options.visibleSlides-1)&&this.options.visibleSlides>1){if(initialIndex>this.slides.length-(this.options.visibleSlides+1)){initialIndex=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.disabledClassName)){if(element.hasClassName(this.options.controlClassName)){eval("this."+element.rel+"()");}else if(element.hasClassName(this.options.jumperClassName)){this.moveTo(element.rel);if(this.options.selectedClassName){this.controls.invoke('removeClassName',this.options.selectedClassName);element.addClassName(this.options.selectedClassName);}}}
this.deactivateControls();event.stop();},moveTo:function(element){if(this.options.beforeMove&&(typeof this.options.beforeMove=='function')){this.options.beforeMove();}
this.previous=this.current?this.current:this.slides[0];this.current=$(element);var scrollerOffset=this.scroller.cumulativeOffset();var elementOffset=this.current.cumulativeOffset();if(this.scrolling){this.scrolling.cancel();}
switch(this.options.effect){case'fade':this.scrolling=new Effect.Opacity(this.scroller,{from:1.0,to:0,duration:this.options.duration,afterFinish:(function(){this.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){this.activateControls();}
if(this.options.afterMove&&(typeof this.options.afterMove=='function')){this.options.afterMove();}}).bind(this)});}).bind(this)});break;case'scroll':default:var transition;switch(this.options.transition){case'spring':transition=Effect.Transitions.spring;break;case'sinoidal':default:transition=Effect.Transitions.sinoidal;break;}
this.scrolling=new Effect.SmoothScroll(this.scroller,{duration:this.options.duration,x:(elementOffset[0]-scrollerOffset[0]),y:(elementOffset[1]-scrollerOffset[1]),transition:transition,afterFinish:(function(){if(this.controls){this.activateControls();}
if(this.options.afterMove&&(typeof this.options.afterMove=='function')){this.options.afterMove();}
this.scrolling=false;}).bind(this)});break;}
return false;},prev:function(){if(this.current){var currentIndex=this.current._index;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().getWidth();this.scroller.scrollTop=(this.slides.length-1)*this.slides.first().getHeight();prevIndex=this.slides.length-2;}
this.moveTo(this.slides[prevIndex]);},next:function(){if(this.current){var currentIndex=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.scroller.scrollLeft=0;this.scroller.scrollTop=0;nextIndex=1;}
if(nextIndex>this.slides.length-(this.options.visibleSlides+1)){nextIndex=this.slides.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:function(){if(this.previous){this.moveTo(this.slides[this.previous._index]);}else{return false;}},stop:function(){if(this.timer){clearTimeout(this.timer);}},start:function(){this.periodicallyUpdate();},pause:function(){this.stop();this.activateControls();},resume:function(event){if(event){var related=event.relatedTarget||event.toElement;if(!related||(!this.slides.include(related)&&!this.slides.any(function(slide){return related.descendantOf(slide);}))){this.start();}}else{this.start();}},periodicallyUpdate:function(){if(this.timer!=null){clearTimeout(this.timer);this.next();}
this.timer=setTimeout(this.periodicallyUpdate.bind(this),this.options.frequency*1000);},wheel:function(event){event.cancelBubble=true;event.stop();var delta=0;if(!event){event=window.event;}
if(event.wheelDelta){delta=event.wheelDelta/120;}else if(event.detail){delta=-event.detail/3;}
if(!this.scrolling){this.deactivateControls();if(delta>0){this.prev();}else{this.next();}}
return Math.round(delta);},deactivateControls:function(){this.controls.invoke('addClassName',this.options.disabledClassName);},activateControls:function(){this.controls.invoke('removeClassName',this.options.disabledClassName);}});Effect.SmoothScroll=Class.create();Object.extend(Object.extend(Effect.SmoothScroll.prototype,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){this.element.cleanWhitespace();this.element._ext=true;this.element.appendChild(this.element.firstChild);}
this.originalLeft=this.element.scrollLeft;this.originalTop=this.element.scrollTop;if(this.options.mode=='absolute'){this.options.x-=this.originalLeft;this.options.y-=this.originalTop;}},update:function(position){this.element.scrollLeft=this.options.x*position+this.originalLeft;this.element.scrollTop=this.options.y*position+this.originalTop;}});Scribd.carousel=Class.create(Carousel,{periodicallyUpdate:function($super){if(this.timer!=null){clearTimeout(this.timer);var currentIndex=(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;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);}
this.moveTo(this.slides[prevIndex]);},next:function(){if(this.current){var currentIndex=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.slides.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.periodicallyUpdate.bind(this),this.options.frequency*1000);}.bind(this));}},reload:function(){this.slides.each(function(slide,index){slide._index=index;});this.first();},click:function($super,event){if(!event.element().hasClassName(this.options.disabledClassName)){$super(event);this.activateControls();}}});Scribd.carouselUtil={disableButton:function(carousel_name){var _this=Scribd[carousel_name];if(!_this.current||_this.current._index==0){var btn=_this.controls.find(function(el){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.readAttribute('rel')=='next'});if(btn)
btn.addClassName(_this.options.disabledClassName);}}};


/* public/javascripts/document_collections_manager.js @ 1305154393 */

Scribd.DocumentCollectionsManager={docs_in_collections:{},docs:{},loadPageForDocument:function(doc_id,page,collections_container,progress_indicator){progress_indicator.show();var M=Scribd.DocumentCollectionsManager;if(!M.docs_in_collections[doc_id]){M.docs_in_collections[doc_id]={}};M.getCollectionsForDocument(doc_id,page,{onSuccess:function(data){M.storeCollections(doc_id,data.collections);collections_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_indicator&&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(response.responseJSON);}});},storeCollections:function(doc_id,collections){var M=Scribd.DocumentCollectionsManager;collections=$A(collections);collections.select(function(collection){return collection.selected=='1';}).each(function(collection){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);});},attachEvent:function(doc_id,container){var M=Scribd.DocumentCollectionsManager;var collection_id=container.getAttribute('data-document_collection_id');var checkbox=container.down('input');var loader=container.down('.status_loader');container.observe('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:{document_id:doc_id},method:http_method,onCreate:function(){loader.show();checkbox.hide();},onComplete:function(){loader.hide();checkbox.show();},onSuccess:function(response){var result=response.responseJSON;if(result&&result.added){checkbox.checked=true;M.docs_in_collections[doc_id][collection_id]=true;}else{checkbox.checked=false;delete M.docs_in_collections[doc_id][collection_id];}}});});},renderCollectionsIn:function(doc_id,data){var M=Scribd.DocumentCollectionsManager;var rendered_collections=$A(data.collections).map(function(collection){var transformed_collection=M.renderingCollectionAttributes(doc_id,collection);return M.collection_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,pagination_control:M.renderPagination(data.page,data.per_page,data.total),'doc_id':doc_id});},renderPagination:function(page,per_page,total,window_size){var num_of_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_page=num_of_pages;var prev_page=next_page=page;for(var i=1;i<=window_size;i++){if(prev_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="',next_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>');},renderingCollectionAttributes:function(doc_id,collection){var transformed_collection={'id':collection.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.findElement();var lightbox=$$('#lightbox_document_collections').first();if(lightbox.visible())
Scribd.Lightbox.toggle('lightbox_document_collections',0);lightbox.down('.private').hide();var manager_container=lightbox.down('.manage_collection');var collections_container=manager_container.down('.document_collections_container');if(collections_container.retrieve('document_id')!==doc_id){collections_container.store('document_id',doc_id);M.renderDoc(doc_id);collections_container.update('');var spinner=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=$$('#lightbox_document_collections .manage_collection').first();var collections_container=manager_container.down('.document_collections_container');var spinner=manager_container.down('img');collections_container.observe('click',function(e){var clicker=e.findElement();if(clicker.getAttribute('data-page')){e.stop();var doc_id=collections_container.retrieve('document_id');M.loadPageForDocument(doc_id,clicker.getAttribute('data-page'),collections_container,spinner);}});},renderDoc:function(doc_id){var M=Scribd.DocumentCollectionsManager;var doc=M.docs[doc_id];var document_container=$$('#lightbox_document_collections .document_container').first();if(doc){document_container.update(new Scribd.DocumentCell(doc).render('collection_old'));if(doc['private'])
document_container.parentNode.down('.private').show();}else{document_container.update('');new Ajax.Request("/documents/"+doc_id+'.json',{method:'get',onSuccess:function(response){if(response.responseJSON){M.docs[doc_id]=response.responseJSON;M.renderDoc(doc_id);}}});}}}
Scribd.DocumentCollectionsManager.Paginator=Class.create({initialize:function(options){this.total=options.total,this.per_page=options.per_page||10,this.window_size=options.window_size;this.url=options.url,this.params=options.params;}});Scribd.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?1305154393" class="status_loader" alt="Loader_black_on_white" style="display:none;">\
        <input type="checkbox" value="#{id}" name="document_collection_id" #{checked}/>\
    </span>\
    <label>#{name}</label>\
    <span class="privacy #{privacy_type}"> #{combined_privacy_type} </span>\
</li>');


/* public/javascripts/perf_analytics.js @ 1305154393 */

function trackPerfAnalytics(pageTracker,perfStart,perfEnd,total){var category=total?'Page Load':'DOM Load';var perfTime=perfEnd.getTime()-perfStart.getTime();var 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.search)
path+=document.location.search;try{if(pageTracker){pageTracker._trackEvent(category,range,path,Math.round(perfTime/100));}else{_gaq.push(['pageTrackerPerf._trackEvent',category,range,path,Math.round(perfTime/100)]);}}catch(err){}}


/* public/javascripts/doc_cell.js @ 1305154393 */

Scribd.DocumentCell=Class.create({initialize:function(data){this.doc=data;},render:function(template){var template_name_and_control=template.split('.');var template_name=template_name_and_control[0];var control=template_name_and_control[1];return Scribd.DocumentCell.templates[template_name].template.evaluate(this[template_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_page_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_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,user_login:this.doc.user.login,doc_price:this.doc.price&&('<li class="price"><span class="price">'+this.doc.price+'</span></li>'),doc_readcasts:this.doc.readcasts,control:Scribd.DocumentCell.templates.collection.controls[control]});},collection_old_template_data:function(control){return({doc_id:this.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,user_login:this.doc.user.login,doc_price:this.doc.price&&('<li class="price"><span class="price">'+this.doc.price+'</span></li>'),control:Scribd.DocumentCell.templates.collection_old.controls[control]});}});Scribd.DocumentCell.templates={collection:{controls:{add_document:'<a href="#" class="add_document"> </a>',remove_document:'<a href="#" class="subtle_close_button destroy"> </a>'},template:new Template('\
<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:new 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="#{doc_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_created_on}\
                    </li>\
                    <li class="views">\
                        <span class="metadata_label">Reads:</span> #{doc_views}\
                    </li>\
                    #{doc_category}\
                </div>\
            </ul>\
        </div>\
    </div>\
</div>\
')}};


/* public/javascripts/prototip/prototip.js @ 1305154393 */

var Prototip={Version:'2.2.0.2'};var Tips={options:{paths:{images:'/images/prototip/',javascript:'../../javascripts/prototip/'},zIndex:6000}};Prototip.Styles={'default':{border:6,borderColor:'#c7c7c7',className:'default',closeButton:false,hideAfter:false,hideOn:'mouseleave',hook:false,radius:6,showOn:'mousemove',stem:{height:12,width:15}},'protoblue':{className:'protoblue',border:6,borderColor:'#116497',radius:6,stem:{height:12,width:15}},'darkgrey':{className:'darkgrey',border:6,borderColor:'#363636',radius:6,stem:{height:12,width:15}},'creamy':{className:'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,offset:{x:0,y:-2},stem:{position:'bottomMiddle',width:9,height:5},hook:{target:'topMiddle',tip:'bottomMiddle'}},'black_trans_bottom':{className:'black_trans_bottom',border:0,radius:0,offset:{x:0,y:-2},stem:{position:'topMiddle',width:9,height:5},hook:{target:'bottomMiddle',tip:'topMiddle'}}};eval(function(p,a,c,k,e,r){e=function(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=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(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.4U),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.28(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.1U=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.1g.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.36).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.12||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.4b)}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.2E){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.4d){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.31.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)}.1d(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.2w()){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*11.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.1l.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.1D,{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|show|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|content|hideAfter|stemInverse|tip|mouse|delay|margin|bindAsEventListener|stopObserving|javascript|viewport|orientation|clearTimer|src|prototip|remove|invoke|mouseleave|fixed|visibility|stemImage|backgroundColor|auto|eventToggle|hideTargets|pointerX|pointerY|length|middle|arguments|for|mouseHook|getDimensions|style|click|showDelayed|setPngBackground|borderFrame|borderTop|prototip_Corner|toolbar|canvas|match|paths|_inverse|push|null|clone|none|close||positionStem|fakePointer|script|Styles|ns_vml|default|initialize|zIndexTop|raise|cumulativeOffset|getScrollOffsets|isString|mousemove|toLowerCase|capitalize|hidden|display|png|build|clearfix|prototip_CornerWrapper|padding|addClassName|eventPosition|eventCheckDelay|cancelHideAfter|ajaxHideEvent|ajaxContentLoading|float|iframeShimDimensions|Event|support|Prototype|_|path|replace|add|loaded|url|window|unload|convertVersionString|toggleInt|right|inverseStem|WebKit419|removeVisible|isElement|borderColor|onComplete|getStyle|wrap|ajaxShow|_build|body|stemWrapper|li|borderRow|borderMiddle|borderCenter|select|_update|100|eventShow|mouseover|mouseout|hideElement|mouseenter|activityEnter|activityLeave|getPositionWithinViewport|repeat|sizingMethod|Methods|getContext|insertScript|type|text|start|require|js|https|test|styles|namespaces|VML|dom|REQUIRED_|throw|removeAll|deactivate|without|_stemTranslation|parseFloat|parentNode|_highest|addVisibile|hideAll|cumulativeScrollOffset|in|switch|create|hideOthers|include|fixSafari2|setup|activate|9500px|_isBuilding|stemBox|toUpperCase|prototip_Between|borderBottom|each|createCorner|prototip_Fill|update|getWidth|eventHide|toggle|On|buttonEvent|ajaxHide|ajaxContentLoaded|Timer|fire|afterHide|relative|block|absolute|charAt|fillRect|outerHTML|align|hold|REQUIRED_Prototype|createElement|try|write|catch|head|find|documentMode|urn|schemas|microsoft|com|vml|createStyleSheet|cssText|behavior|typeof|undefined|Version|requires|parseInt|times|indexOf|abs|RegExp|MSIE|exec|navigator|userAgent|Browser|WebKit|evaluate|topRight|rightTop|topMiddle|rightMiddle|bottomLeft||leftBottom|bottomRight|rightBottom|bottomMiddle|leftMiddle|Tip|Class|not|available|cannot|000000|closeButtons|endsWith|member|emptyFunction|9500|iframe|frameBorder|opacity|prototipLoader|gif|prototip_Stem|prototip_StemWrapper|prototip_StemBox|prototip_StemImage|MIDDLE|inline|ul|prototip_CornerWrapperTopLeft|prototip_BetweenCorners|prototip_CornerWrapperTopRight|prototip_CornerWrapperBottomLeft|cloneNode|prototip_CornerWrapperBottomRight|tl|tr|bl|br|isNumber|close_hover|event|Action|hideAction|findElement|blur|stop|pointer|responseText|loaderTimer|ajaxTimer|Ajax|Request|showTimer|clearTimeout|shown|hideAfterTimer|marginTop|clear|both|LEFTTOP|TOPLEFT|TOPMIDDLE|TOPRIGHT|RIGHTTOP|RIGHTMIDDLE|RIGHTBOTTOM|BOTTOMRIGHT|BOTTOMMIDDLE|BOTTOMLEFT|LEFTBOTTOM|LEFTMIDDLE|cornerCanvas|fillStyle|arc|Math|PI|fill|overflow|roundrect|fillcolor|strokeWeight|1px|strokeColor|arcSize|toFixed|addMethods|no|scale|filter|progid|DXImageTransform|Microsoft|AlphaImageLoader|background'.split('|'),0,{}));


/* public/javascripts/boomerang/boomerang.js @ 1305154393 */

(function(w){var impl,boomr,k,d=w.document;if(typeof BOOMR==="undefined"){BOOMR={};}
if(BOOMR.version){return;}
BOOMR.version="0.9";impl={beacon_url:"",site_domain:w.location.hostname.replace(/.*?([^.]+\.[^.]+)\.?$/,'$1').toLowerCase(),user_ip:'',ratio:'',ratiocookiename:'boomrsession',events:{"page_ready":[],"page_unload":[],"before_beacon":[]},vars:{},disabled_plugins:{},fireEvent:function(e_name,data){var i,h,e;if(!this.events.hasOwnProperty(e_name)){return false;}
e=this.events[e_name];for(i=0;i<e.length;i++){h=e[i];h[0].call(h[2],data,h[1]);}
return true;},addListener:function(el,sType,fn,capture){if(el.addEventListener){el.addEventListener(sType,fn,(capture));}
else if(el.attachEvent){el.attachEvent("on"+sType,fn);}}};boomr={utils:{getCookie:function(name){if(!name){return null;}
name=' '+name+'=';var i,cookies;cookies=' '+d.cookie+';';if((i=cookies.indexOf(name))>=0){i+=name.length;cookies=cookies.substring(i,cookies.indexOf(';',i));return cookies;}
return null;},setCookie:function(name,subcookies,max_age,path,domain,sec){var value="",k,nameval,c,exp="";if(!name){return false;}
for(k in subcookies){if(subcookies.hasOwnProperty(k)){value+='&'+encodeURIComponent(k)
+'='+encodeURIComponent(subcookies[k]);}}
value=value.replace(/^&/,'');if(max_age){exp=new Date();exp.setTime(exp.getTime()+max_age*1000);exp=exp.toGMTString();}
nameval=name+'='+value;c=nameval+
((max_age)?"; expires="+exp:"")+
((path)?"; path="+path:"")+
((typeof domain!=="undefined")?"; domain="
+(domain!==null?domain:impl.site_domain):"")+
((sec)?"; secure":"");if(nameval.length<4000){d.cookie=c;return(value===this.getCookie(name));}
return false;},getSubCookies:function(cookie){var cookies_a,i,l,kv,cookies={};if(!cookie){return null;}
cookies_a=cookie.split('&');if(cookies_a.length===0){return null;}
for(i=0,l=cookies_a.length;i<l;i++){kv=cookies_a[i].split('=');kv.push("");cookies[decodeURIComponent(kv[0])]=decodeURIComponent(kv[1]);}
return cookies;},removeCookie:function(name){return this.setCookie(name,{},0,"/",null);},pluginConfig:function(o,config,plugin_name,properties){var i,props=0;if(!config||!config[plugin_name]){return false;}
for(i=0;i<properties.length;i++){if(typeof config[plugin_name][properties[i]]!=="undefined"){o[properties[i]]=config[plugin_name][properties[i]];props++;}}
return(props>0);}},init:function(config){var i,k,properties=["beacon_url","site_domain","user_ip","ratio","ratiocookiename"];if(!config){config={};}
for(i=0;i<properties.length;i++){if(typeof config[properties[i]]!=="undefined"){impl[properties[i]]=config[properties[i]];}}
if(typeof config.log!=="undefined"){this.log=config.log;}
if(!this.log){this.log=function(m,l,s){};}
if(impl.ratio!=''){var tc=BOOMR.utils.getSubCookies(BOOMR.utils.getCookie(impl.ratiocookiename));if(tc!=null&&tc.run=="true"){var runRatio=false;}else if(tc!=null&&tc.run=="false"){return false;}else{var runRatio=true;}
if(runRatio){if(!this.randomNess()){BOOMR.utils.setCookie(impl.ratiocookiename,{run:"false"},0,"/",null);return false;}else{BOOMR.utils.setCookie(impl.ratiocookiename,{run:"true"},0,"/",null);}}}
for(k in this.plugins){if(config[k]&&typeof config[k].enabled!=="undefined"&&config[k].enabled===false){impl.disabled_plugins[k]=1;continue;}
else if(impl.disabled_plugins[k]){delete impl.disabled_plugins[k];}
if(this.plugins.hasOwnProperty(k)&&typeof this.plugins[k].init==="function"){this.plugins[k].init(config);}}
if(typeof config.autorun==="undefined"||config.autorun!==false){impl.addListener(w,"load",function(){impl.fireEvent("page_ready");});}
impl.addListener(w,"unload",function(){w=null;});return this;},page_ready:function(){impl.fireEvent("page_ready");return this;},subscribe:function(e_name,fn,cb_data,cb_scope){var i,h,e;if(!impl.events.hasOwnProperty(e_name)){return this;}
e=impl.events[e_name];for(i=0;i<e.length;i++){h=e[i];if(h[0]===fn&&h[1]===cb_data&&h[2]===cb_scope){return this;}}
e.push([fn,cb_data||{},cb_scope||null]);if(e_name==='page_unload'){impl.addListener(w,"unload",function(){if(fn){fn.call(cb_scope,null,cb_data);}
fn=cb_scope=cb_data=null;});impl.addListener(w,"beforeunload",function(){if(fn){fn.call(cb_scope,null,cb_data);}
fn=cb_scope=cb_data=null;});}
return this;},addVar:function(name,value){if(typeof name==="string"){impl.vars[name]=value;}
else if(typeof name==="object"){var o=name,k;for(k in o){if(o.hasOwnProperty(k)){impl.vars[k]=o[k];}}}
return this;},removeVar:function(){var i,params;if(!arguments.length){return this;}
if(arguments.length===1&&Object.prototype.toString.apply(arguments[0])==="[object Array]"){params=arguments[0];}
else{params=arguments;}
for(i=0;i<params.length;i++){if(impl.vars.hasOwnProperty(params[i])){delete impl.vars[params[i]];}}
return this;},sendBeacon:function(){var k,url,img,nparams=0;for(k in this.plugins){if(this.plugins.hasOwnProperty(k)){if(impl.disabled_plugins[k]){continue;}
if(!this.plugins[k].is_complete()){return this;}}}
impl.fireEvent("before_beacon",impl.vars);if(!impl.beacon_url){return this;}
url=impl.beacon_url+'?v='+encodeURIComponent(BOOMR.version);for(k in impl.vars){if(impl.vars.hasOwnProperty(k)){nparams++;url+="&"+encodeURIComponent(k)
+"="+encodeURIComponent(impl.vars[k]);}}
if(nparams){img=new Image();img.src=url;}
return this;},randomNess:function(){var randomnumber=Math.floor((Math.random()*100)+1);if(randomnumber<=impl.ratio){return true;}
else{return false;}}};var make_logger=function(l){return function(m,s){this.log(m,l,"boomerang"+(s?"."+s:""));return this;};};boomr.debug=make_logger("debug");boomr.info=make_logger("info");boomr.warn=make_logger("warn");boomr.error=make_logger("error");if(w.YAHOO&&w.YAHOO.widget&&w.YAHOO.widget.Logger){boomr.log=w.YAHOO.log;}
else if(typeof w.Y!=="undefined"&&typeof w.Y.log!=="undefined"){boomr.log=w.Y.log;}
else if(typeof console!=="undefined"&&typeof console.log!=="undefined"){boomr.log=function(m,l,s){console.log(s+": ["+l+"] ",m);};}
for(k in boomr){if(boomr.hasOwnProperty(k)){BOOMR[k]=boomr[k];}}
BOOMR.plugins=BOOMR.plugins||{};}(window));(function(w){var d=w.document;BOOMR=BOOMR||{};BOOMR.plugins=BOOMR.plugins||{};var impl={complete:false,timers:{},cookie:'RT',cookie_exp:600,strict_referrer:true,start:function(){var t_end,t_start=new Date().getTime();if(!BOOMR.utils.setCookie(impl.cookie,{s:t_start,r:d.URL.replace(/#.*/,'')},impl.cookie_exp,"/",null)){BOOMR.error("cannot set start cookie","rt");return this;}
t_end=new Date().getTime();if(t_end-t_start>50){BOOMR.utils.removeCookie(impl.cookie);BOOMR.error("took more than 50ms to set cookie... aborting: "
+t_start+" -> "+t_end,"rt");}
return this;}};BOOMR.plugins.RT={init:function(config){impl.complete=false;impl.timers={};BOOMR.utils.pluginConfig(impl,config,"RT",["cookie","cookie_exp","strict_referrer"]);BOOMR.subscribe("page_ready",this.done,null,this);BOOMR.subscribe("page_unload",impl.start,null,this);return this;},startTimer:function(timer_name){if(timer_name){impl.timers[timer_name]={start:new Date().getTime()};impl.complete=false;}
return this;},endTimer:function(timer_name,time_value){if(timer_name){impl.timers[timer_name]=impl.timers[timer_name]||{};if(typeof impl.timers[timer_name].end==="undefined"){impl.timers[timer_name].end=(typeof time_value==="number"?time_value:new Date().getTime());}}
return this;},setTimer:function(timer_name,time_delta){if(timer_name){impl.timers[timer_name]={delta:time_delta};}
return this;},done:function(){var t_start,u,r,r2,subcookies,basic_timers={t_done:1,t_resp:1,t_page:1},ntimers=0,t_name,timer,t_other=[],ti,p;if(impl.complete){return this;}
this.endTimer("t_done");u=d.URL.replace(/#.*/,'');r=r2=d.referrer.replace(/#.*/,'');subcookies=BOOMR.utils.getSubCookies(BOOMR.utils.getCookie(impl.cookie));BOOMR.utils.removeCookie(impl.cookie);if(subcookies!==null&&typeof subcookies.s!=="undefined"&&typeof subcookies.r!=="undefined"){r=subcookies.r;if(!impl.strict_referrer||r===r2){t_start=parseInt(subcookies.s,10);}}
if(!t_start){BOOMR.warn("start cookie not set, trying WebTiming API","rt");p=w.performance||w.msPerformance||w.webkitPerformance||w.mozPerformance;if(p&&p.timing){ti=p.timing;}
else if(w.chrome&&w.chrome.csi){ti={requestStart:w.chrome.csi().startE};}
if(ti){t_start=ti.requestStart||ti.fetchStart||ti.navigationStart||undefined;}
else{BOOMR.warn("This browser doesn't support the WebTiming API","rt");}}
BOOMR.removeVar('t_done','t_page','t_resp','u','r','r2');for(t_name in impl.timers){if(!impl.timers.hasOwnProperty(t_name)){continue;}
timer=impl.timers[t_name];if(typeof timer.delta!=="number"){if(typeof timer.start!=="number"){timer.start=t_start;}
timer.delta=timer.end-timer.start;}
if(isNaN(timer.delta)){continue;}
if(basic_timers.hasOwnProperty(t_name)){BOOMR.addVar(t_name,timer.delta);}
else{t_other.push(t_name+'|'+timer.delta);}
ntimers++;}
if(ntimers){BOOMR.addVar({"u":u,"r":r});if(r2!==r){BOOMR.addVar("r2",r2);}
if(t_other.length){BOOMR.addVar("t_other",t_other.join(','));}}
impl.timers={};impl.complete=true;BOOMR.sendBeacon();return this;},is_complete:function(){return impl.complete;}};}(window));(function(w){var d=w.document;BOOMR=BOOMR||{};BOOMR.plugins=BOOMR.plugins||{};var images=[{name:"image-0.png",size:11483,timeout:1400},{name:"image-1.png",size:40658,timeout:1200},{name:"image-2.png",size:164897,timeout:1300},{name:"image-3.png",size:381756,timeout:1500},{name:"image-4.png",size:1234664,timeout:1200},{name:"image-5.png",size:4509613,timeout:1200},{name:"image-6.png",size:9084559,timeout:1200}];images.end=images.length;images.start=0;images.l={name:"image-l.gif",size:35,timeout:1000};var impl={base_url:'images/',timeout:15000,nruns:5,latency_runs:10,user_ip:'',cookie_exp:7*86400,cookie:'BA',results:[],latencies:[],latency:null,runs_left:0,aborted:false,complete:false,running:false,ncmp:function(a,b){return(a-b);},iqr:function(a)
{var l=a.length-1,q1,q3,fw,b=[],i;q1=(a[Math.floor(l*0.25)]+a[Math.ceil(l*0.25)])/2;q3=(a[Math.floor(l*0.75)]+a[Math.ceil(l*0.75)])/2;fw=(q3-q1)*1.5;l++;for(i=0;i<l&&a[i]<q3+fw;i++){if(a[i]>q1-fw){b.push(a[i]);}}
return b;},calc_latency:function()
{var i,n,sum=0,sumsq=0,amean,median,std_dev,std_err,lat_filtered;lat_filtered=this.iqr(this.latencies.sort(this.ncmp));n=lat_filtered.length;BOOMR.debug(lat_filtered,"bw");for(i=1;i<n;i++){sum+=lat_filtered[i];sumsq+=lat_filtered[i]*lat_filtered[i];}
n--;amean=Math.round(sum/n);std_dev=Math.sqrt(sumsq/n-sum*sum/(n*n));std_err=(1.96*std_dev/Math.sqrt(n)).toFixed(2);std_dev=std_dev.toFixed(2);n=lat_filtered.length-1;median=Math.round((lat_filtered[Math.floor(n/2)]+lat_filtered[Math.ceil(n/2)])/2);return{mean:amean,median:median,stddev:std_dev,stderr:std_err};},calc_bw:function()
{var i,j,n=0,r,bandwidths=[],bandwidths_corrected=[],sum=0,sumsq=0,sum_corrected=0,sumsq_corrected=0,amean,std_dev,std_err,median,amean_corrected,std_dev_corrected,std_err_corrected,median_corrected,nimgs,bw,bw_c;for(i=0;i<this.nruns;i++){if(!this.results[i]||!this.results[i].r){continue;}
r=this.results[i].r;nimgs=0;for(j=r.length-1;j>=0&&nimgs<3;j--){if(typeof r[j]==='undefined'){break;}
if(r[j].t===null){continue;}
n++;nimgs++;bw=images[j].size*1000/r[j].t;bandwidths.push(bw);bw_c=images[j].size*1000/(r[j].t-this.latency.mean);bandwidths_corrected.push(bw_c);}}
BOOMR.debug('got '+n+' readings',"bw");BOOMR.debug('bandwidths: '+bandwidths,"bw");BOOMR.debug('corrected: '+bandwidths_corrected,"bw");if(bandwidths.length>3){bandwidths=this.iqr(bandwidths.sort(this.ncmp));bandwidths_corrected=this.iqr(bandwidths_corrected.sort(this.ncmp));}else{bandwidths=bandwidths.sort(this.ncmp);bandwidths_corrected=bandwidths_corrected.sort(this.ncmp);}
BOOMR.debug('after iqr: '+bandwidths,"bw");BOOMR.debug('corrected: '+bandwidths_corrected,"bw");n=Math.max(bandwidths.length,bandwidths_corrected.length);for(i=0;i<n;i++){if(i<bandwidths.length){sum+=bandwidths[i];sumsq+=Math.pow(bandwidths[i],2);}
if(i<bandwidths_corrected.length){sum_corrected+=bandwidths_corrected[i];sumsq_corrected+=Math.pow(bandwidths_corrected[i],2);}}
n=bandwidths.length;amean=Math.round(sum/n);std_dev=Math.sqrt(sumsq/n-Math.pow(sum/n,2));std_err=Math.round(1.96*std_dev/Math.sqrt(n));std_dev=Math.round(std_dev);n=bandwidths.length-1;median=Math.round((bandwidths[Math.floor(n/2)]+bandwidths[Math.ceil(n/2)])/2);n=bandwidths_corrected.length;amean_corrected=Math.round(sum_corrected/n);std_dev_corrected=Math.sqrt(sumsq_corrected/n-Math.pow(sum_corrected/n,2));std_err_corrected=(1.96*std_dev_corrected/Math.sqrt(n)).toFixed(2);std_dev_corrected=std_dev_corrected.toFixed(2);n=bandwidths_corrected.length-1;median_corrected=Math.round((bandwidths_corrected[Math.floor(n/2)]
+bandwidths_corrected[Math.ceil(n/2)])/2);BOOMR.debug('amean: '+amean+', median: '+median,"bw");BOOMR.debug('corrected amean: '+amean_corrected+', '
+'median: '+median_corrected,"bw");return{mean:amean,stddev:std_dev,stderr:std_err,median:median,mean_corrected:amean_corrected,stddev_corrected:std_dev_corrected,stderr_corrected:std_err_corrected,median_corrected:median_corrected};},defer:function(method)
{var that=this;return setTimeout(function(){method.call(that);that=null;},10);},load_img:function(i,run,callback)
{var url=this.base_url+images[i].name
+'?t='+(new Date().getTime())+Math.random(),timer=0,tstart=0,img=new Image(),that=this;img.onload=function(){img.onload=img.onerror=null;img=null;clearTimeout(timer);if(callback){callback.call(that,i,tstart,run,true);}
that=callback=null;};img.onerror=function(){img.onload=img.onerror=null;img=null;clearTimeout(timer);if(callback){callback.call(that,i,tstart,run,false);}
that=callback=null;};timer=setTimeout(function(){if(callback){callback.call(that,i,tstart,run,null);}},images[i].timeout
+Math.min(400,this.latency?this.latency.mean:400));tstart=new Date().getTime();img.src=url;},lat_loaded:function(i,tstart,run,success)
{if(run!==this.latency_runs+1){return;}
if(success!==null){var lat=new Date().getTime()-tstart;this.latencies.push(lat);}
if(this.latency_runs===0){this.latency=this.calc_latency();}
this.defer(this.iterate);},img_loaded:function(i,tstart,run,success)
{if(run!==this.runs_left+1){return;}
if(this.results[this.nruns-run].r[i]){return;}
if(success===null){this.results[this.nruns-run].r[i+1]={t:null,state:null,run:run};return;}
var result={start:tstart,end:new Date().getTime(),t:null,state:success,run:run};if(success){result.t=result.end-result.start;}
this.results[this.nruns-run].r[i]=result;if(i>=images.end-1||typeof this.results[this.nruns-run].r[i+1]!=='undefined'){BOOMR.debug(this.results[this.nruns-run],"bw");if(run===this.nruns){images.start=i;}
this.defer(this.iterate);}else{this.load_img(i+1,run,this.img_loaded);}},finish:function()
{if(!this.latency){this.latency=this.calc_latency();}
var bw=this.calc_bw(),o={bw:bw.median_corrected,bw_err:parseFloat(bw.stderr_corrected,10),lat:this.latency.mean,lat_err:parseFloat(this.latency.stderr,10),bw_time:Math.round(new Date().getTime()/1000)};BOOMR.addVar(o);if(!isNaN(o.bw)){BOOMR.utils.setCookie(this.cookie,{ba:Math.round(o.bw),be:o.bw_err,l:o.lat,le:o.lat_err,ip:this.user_ip,t:o.bw_time},(this.user_ip?this.cookie_exp:0),"/",null);}
this.complete=true;BOOMR.sendBeacon();this.running=false;},iterate:function()
{if(this.aborted){return false;}
if(!this.runs_left){this.finish();}
else if(this.latency_runs){this.load_img('l',this.latency_runs--,this.lat_loaded);}
else{this.results.push({r:[]});this.load_img(images.start,this.runs_left--,this.img_loaded);}},setVarsFromCookie:function(cookies){var ba=parseInt(cookies.ba,10),bw_e=parseFloat(cookies.be,10),lat=parseInt(cookies.l,10)||0,lat_e=parseFloat(cookies.le,10)||0,c_sn=cookies.ip.replace(/\.\d+$/,'0'),t=parseInt(cookies.t,10),p_sn=this.user_ip.replace(/\.\d+$/,'0'),t_now=Math.round((new Date().getTime())/1000);if(c_sn===p_sn&&t>=t_now-this.cookie_exp){this.complete=true;BOOMR.addVar({'bw':ba,'lat':lat,'bw_err':bw_e,'lat_err':lat_e});return true;}
return false;}};BOOMR.plugins.BW={init:function(config){var cookies;BOOMR.utils.pluginConfig(impl,config,"BW",["base_url","timeout","nruns","cookie","cookie_exp"]);if(config&&config.user_ip){impl.user_ip=config.user_ip;}
images.start=0;impl.runs_left=impl.nruns;impl.latency_runs=10;impl.results=[];impl.latencies=[];impl.latency=null;impl.complete=false;impl.aborted=false;BOOMR.removeVar('ba','ba_err','lat','lat_err');cookies=BOOMR.utils.getSubCookies(BOOMR.utils.getCookie(impl.cookie));if(!cookies||!cookies.ba||!impl.setVarsFromCookie(cookies)){BOOMR.subscribe("page_ready",this.run,null,this);}
return this;},run:function(){if(impl.running||impl.complete){return this;}
if(w.location.protocol==='https:'){BOOMR.info("HTTPS detected, skipping bandwidth test","bw");impl.complete=true;return this;}
impl.running=true;setTimeout(this.abort,impl.timeout);impl.defer(impl.iterate);return this;},abort:function(){impl.aborted=true;impl.finish();return this;},is_complete:function(){return impl.complete;}};}(window));


/* public/javascripts/boomerang/dns.js @ 1305154393 */

(function(w){BOOMR=BOOMR||{};BOOMR.plugins=BOOMR.plugins||{};var impl={complete:false,base_url:"",t_start:null,t_dns:null,t_http:null,img:null,gen_url:"",start:function(){var random=Math.floor(Math.random()*(2147483647)).toString(36);this.gen_url=this.base_url.replace(/\*/,random);impl.img=new Image();impl.img.onload=impl.A_loaded;impl.t_start=new Date().getTime();impl.img.src=this.gen_url+"image-l.gif?t="
+(new Date().getTime())+Math.random();},A_loaded:function(){impl.t_dns=new Date().getTime()-impl.t_start;impl.img=new Image();impl.img.onload=impl.B_loaded;impl.t_start=new Date().getTime();impl.img.src=impl.gen_url+"image-l.gif?t="
+(new Date().getTime())+Math.random();},B_loaded:function(){impl.t_http=new Date().getTime()-impl.t_start;impl.img=null;impl.done();},done:function(){var dns=impl.t_dns-impl.t_http;BOOMR.addVar("dns",dns);this.complete=true;BOOMR.sendBeacon();},read_timing_api:function(t){if(typeof t.domainLookupStart==="undefined"||typeof t.domainLookupEnd==="undefined"){return false;}
BOOMR.addVar("dns",t.domainLookupEnd-t.domainLookupStart);impl.complete=true;return true;}};BOOMR.plugins.DNS={init:function(config){BOOMR.utils.pluginConfig(impl,config,"DNS",["base_url"]);if(w.performance&&w.performance.timing){if(impl.read_timing_api(w.performance.timing)){return this;}}
if(!impl.base_url){BOOMR.warn("DNS.base_url is not set.  Cannot run DNS test.","dns");impl.complete=true;return this;}
if(w.location.protocol==='https:'){impl.base_url=impl.base_url.replace(/^http:/,'https:');}
else{impl.base_url=impl.base_url.replace(/^https:/,'http:');}
BOOMR.subscribe("page_ready",impl.start,null,this);return this;},is_complete:function(){return impl.complete;}};}(window));


/* :files, 'public/javascripts/shared', ... @ 1305154393 */
/* public/javascripts/shared/ad_hider.js @ 1305154393 */

Scribd.AdHider=(function(){var hideElement=function(el){try{el.setStyle({visibility:'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).observe(hide_event,function(e){this.AD_CLASSES.each(function(klass){$$(klass).each(function(el){hideElement(el);el.select("iframe").each(hideElement);});});}.bind(this));}.bind(this));this.SHOW_EVENTS.each(function(show_event){$(document).observe(show_event,function(e){this.AD_CLASSES.each(function(klass){$$(klass).each(function(el){showElement(el);el.select("iframe").each(showElement);});});}.bind(this));}.bind(this));}
AdHider.prototype={AD_CLASSES:['.hideable_ad'],HIDE_EVENTS:['lightbox:open'],SHOW_EVENTS:['lightbox:closed']}
return AdHider;})();


/* public/javascripts/shared/alerts.js @ 1305154393 */

if(!window.Scribd)var Scribd=new Object();Scribd.alertsManager=Class.create({initialize:function(){},error:function(el,message,options){var options=Object.extend({auto_fade:false},options||{});this.render('error',el,message,options);},progress:function(el,message,options){var options=Object.extend({auto_fade:false},options||{});this.render('progress',el,message,options);},success:function(el,message,options){this.render('success',el,message,options);},success_blue:function(el,message,options){this.render('success_blue',el,message,options);},success_red:function(el,message,options){this.render('success_red',el,message,options);},render:function(type,el,message,options){var options=Object.extend({auto_fade:true,element_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){(function(){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_class_views_shared_alerts_success autogen_class_views_shared_alerts_base\"><div class=\"inner\">#{message}</div></div>"),success_blue_template:new Template("<div class=\"autogen_class_views_shared_alerts_success_blue autogen_class_views_shared_alerts_base\"><div class=\"inner\">#{message}</div></div>"),success_red_template:new Template("<div class=\"autogen_class_views_shared_alerts_success_red autogen_class_views_shared_alerts_base\"><div class=\"inner\">#{message}</div></div>"),progress_template:new Template("<div class=\"autogen_class_views_shared_alerts_progress autogen_class_views_shared_alerts_base\"><div class=\"inner\"><img src=\"/images/shared/alerts/spinner.gif\" />#{message}</div></div>")});Scribd.Alerts=new Scribd.alertsManager();


/* public/javascripts/shared/buttons.js @ 1305154393 */

if(!window.Scribd)var Scribd=new Object();Scribd.buttonsManager=Class.create({toggle:function(el){var el=$(el);var toggle_button=function(this_el){this_el.classNames().each(function(klass){if(klass.endsWith('_button_selected')){this_el.removeClassName(klass);this_el.addClassName(klass.gsub('_selected',''));}else if(klass.endsWith('_button')){this_el.removeClassName(klass);this_el.addClassName(klass+'_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 @ 1305154393 */

Cohorts=(function(){var Options={debug:false};var GoogleAnalyticsAdapter={nameSpace:'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{throw(" _gaq object not found: It looks like you haven't correctly setup the asynchronous Google Analytics tracking code, and you are using the default GoogleAnalyticsAdapter.");}},onInitialize:function(inTest,testName,cohort){if(inTest){this.trackEvent(this.nameSpace,testName,cohort+' | Total');}},onEvent:function(testName,cohort,eventName){this.trackEvent(this.nameSpace,testName,cohort+' | '+eventName);}};var Test=(function(){var cookieName='_cohorts';var constructor=function(options){this.options=Utils.extend({name:null,cohorts:null,sample:1.0,storageAdapter: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.storageAdapter){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.setCohort(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.keys(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(cohort){if(this.inTest()){return this.getCohort()==cohort;}else{return false;}},getCohort:function(){if(this.inTest()){return this.getCookie('chosen_cohort');}else{return null;}},setCohort:function(cohort){if(this.cohorts.indexOf(cohort)==-1){return false;}else{this.setCookie('chosen_cohort',cohort);return true;}},setCookie:function(name,value){var data=Cookies.get(cookieName)||{};data[this.options.name]=data[this.options.name]||{};data[this.options.name][name]=value;Cookies.set(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(var 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,defaultOptions={expiresAt:null,path:'/',domain:null,secure:false};resolveOptions=function(options)
{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.hoursToLive*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'&&options.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(';'),unparsedValue;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(cookieName)
{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 serialize.');}}
var optionsString=assembleOptionsString(options);document.cookie=cookieName+'='+encodeURIComponent(value)+optionsString;};constructor.prototype.del=function(cookieName,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,testValue);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{Test:Test,Cookies:Cookies,Options:Options};})();


/* public/javascripts/shared/cohorts_adapter.js @ 1305154393 */

if(!window.Scribd)var Scribd=new Object();var _gaq=_gaq||[];Scribd.CohortsAdapter={assignments:{},onInitialize:function(inTest,testName,cohort){if(!inTest)return;this.assignments[testName]=cohort;$rat('cohort.'+testName+'.'+cohort);Scribd.Ads.addAttribute(testName,cohort);},getTestAssignments:function(){return $H(this.assignments).map(function(pair){return pair.key+'='+pair.value;}).join('&');}};


/* public/javascripts/shared/columns.js @ 1305154393 */

if(!window.Scribd)var Scribd=new Object();Scribd.columnManager=Class.create({initialize:function(){this.tallest=0;if(!Prototype.Browser.IE6)
document.observe('dom:loaded',this.equalizeColumnHeights.bind(this));},classesWithBorders:['main1','main3','main5'],equalizeColumnHeights:function(){$$('.scribd_columns').each(function(item){item.childElements().each(function(child){var height=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));},shouldResize:function(el){var hasBorder=false;this.classesWithBorders.each(function(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 @ 1305154393 */

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.param=meta_param.readAttribute('content');this.token=meta_token.readAttribute('content');this.paramsHash[this.param]=this.token;}},paramsWithToken:function(params){return Object.extend(params,this.paramsHash);}};document.observe('dom:loaded',Scribd.CSRF.initialize.bind(Scribd.CSRF));


/* public/javascripts/shared/customEffects.js @ 1305154393 */

Effect.FadeWithCallback=function(element){element=$(element);var oldOpacity=element.getInlineOpacity();var options=Object.extend({from:element.getOpacity()||1.0,to:0.0,callback:function(){},afterFinishInternal:function(effect){effect.options.callback();}},arguments[1]||{});return new Effect.Opacity(element,options);};


/* public/javascripts/shared/embed_code.js @ 1305154393 */

Scribd.genericEmbedCodeGenerator=Class.create({minWidth:400,minHeight:400,maxWidth:1600,maxHeight:1600,defaultWidth:400,defaultHeight:600,defaultPage:1,defaultMode:'list',defaultAutoWidth:true,defaultAutoHeight:false,initialize:function(options){this.options=Object.extend({width:this.defaultWidth,height:this.defaultHeight,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.random()*99999);this.buildTemplates();},render:function(options){this.updateOptions(options);return this.renderTemplates();},updateOptions:function(options){this.options=Object.extend(this.options,options);this.options.width=this.options.width||this.defaultWidth;this.options.height=this.options.height||this.defaultHeight;this.options.page=this.options.page||this.defaultPage;if(this.options.auto_width||this.options.width=="100%"){this.options.width='100%';}else if(parseInt(this.options.width)<this.minWidth){this.options.width=this.minWidth;}
if(this.options.auto_height){this.options.height=this.defaultHeight;}else if(parseInt(this.options.height)<this.minHeight){this.options.height=this.minHeight;}},titleString:function(){if(this.options.show_title){return this.title_tmpl.evaluate({title:this.options.title,doc_url:this.options.doc_url,title_truncated:this.options.title.truncate(110)});}else{return"";}}});Scribd.embedCodeGenerator=Class.create(Scribd.genericEmbedCodeGenerator,{buildTemplates:function(){this.title_tmpl=new Template('<a title="View #{title} on Scribd" href="#{doc_url}" style="margin: 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; display: block; text-decoration: underline;">#{title_truncated}</a> ');this.object_tmpl=new Template('<object id="#{object_id}" name="#{object_id}" height="#{height}" width="#{width}" type="application/x-shockwave-flash" data="http://d1.scribdassets.com/ScribdViewer.swf" style="outline:none;" >\
            <param name="movie" value="http://d1.scribdassets.com/ScribdViewer.swf"> \
            <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=#{access_key}&page=#{page}&viewMode=#{mode}"> \
            <embed id="#{object_id}" name="#{object_id}" src="http://d1.scribdassets.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.titleString()+object_str);}});Scribd.HTML5EmbedCodeGenerator=Class.create(Scribd.genericEmbedCodeGenerator,{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.options.aspect_ratio)*this.options.width)+60;}}
this.options.embed_url="http://www.scribd.com/embeds/"+this.options.doc_id+"/content";this.options.embed_url=this.options.embed_url.updateQueryParams({start_page:this.options.page,view_mode:this.options.mode});if(this.options.access_key&&this.options.access_key.length>0){this.options.embed_url=this.options.embed_url.updateQueryParams({access_key:this.options.access_key});}
if(this.options.secret_password){this.options.embed_url=this.options.embed_url.updateQueryParams({secret_password:this.options.secret_password});}
var object_str=this.iframe_tmpl.evaluate({embed_url:this.options.embed_url,object_id:this.options.object_id,aspect_ratio:this.options.aspect_ratio,width:this.options.width,height:this.options.height,auto_height:!!this.options.auto_width});out=this.titleString()+object_str;if(generate_height_script){out+=this.height_script_tmpl.evaluate({object_id:this.options.object_id});}
return out;},buildTemplates:function(){this.title_tmpl=new Template('<a title="View #{title} on Scribd" href="#{doc_url}" style="margin: 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; display: block; text-decoration: underline;">#{title_truncated}</a>');this.iframe_tmpl=new Template('<iframe class="scribd_iframe_embed" src="#{embed_url}" data-auto-height="#{auto_height}" data-aspect-ratio="#{aspect_ratio}" scrolling="no" id="#{object_id}" width="#{width}" height="#{height}" frameborder="0"></iframe>');this.height_script_tmpl=new Template('<script type="text/javascript">(function() { var scribd = document.createElement("script"); scribd.type = "text/javascript"; scribd.async = true; scribd.src = "http://www.scribd.com/javascripts/embed_code/inject.js"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(scribd, s); })();</script>');}});


/* public/javascripts/shared/facebook.js @ 1305154393 */

if(!window.Scribd)var Scribd=new Object();Scribd.Facebook=function(){var apiKey='1b464203f13e585f17de89797e59bd98';var knobURL='';var loaded=false;var session=null;var cookie=new Scribd.JSONCookie('session_metadata');var transitioned=false;var isReadPage=false;var pageTransitionURL="/session_transition/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}" facebook-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_id}">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></li>\
                    <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 experience on Scribd.</p><a href="http://www.scribd.com/facebookfaq" target="_blank">Learn More</a></div>';function checkSessionState(){if(cookie.get('active_facebook_session')=='false'){Event.fire(document,Scribd.Facebook.EVENTS.inactive_facebook_session);session=false;}
else{FB.getLoginStatus(function(response){if(response.status==='connected'&&response.session){Scribd.log('FB checkSessionState: active fb session');session=response.session;Event.fire(document,Scribd.Facebook.EVENTS.active_facebook_session);}else{Scribd.log('FB checkSessionState: inactive fb session');cookie.set('active_facebook_session','false');cookie.save();session=false;Event.fire(document,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_user_name,fbuid:session.uid,ic_faq:created_by_ic?userUtilInstantConnectFaqHtml:''});Effect.FadeWithCallback('header_login',{callback:function(){var header=$('header_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(pageTransitionURL,{method:'get',evalJSON:'force',onSuccess:function(trans){var content;try{var parts=trans.responseText.split("\n");parts.pop();content=JSON.parse(parts.join("\n"));}catch(e){if(typeof(trans.responseJSON)!="undefined"&&trans.responseJSON){content=trans.responseJSON;}
else{try{content=JSON.parse(trans.responseText);}
catch(e2){}}}
if(Scribd.Facebook.isReadPage){if(isFourgen){updateFourgenUI(content);}else{updateiPaperUI(content);}}else{updateFacebookWelcomeUI(content);}
Scribd.logged_in=true;document.body.fire('Scribd:dom_updated');document.fire(Scribd.Facebook.EVENTS.transition);transitioned=true;}});}
function updateFourgenUI(content){updateFacebookWelcomeUI(content);updateReadCastUI(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);updateReadCastUI(content);}
else{}}
function updateCommentFormUI(content){if(content.comment_form){$('document_comment_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_data;(new Scribd.Readcast.Event.AutoShare({doc:doc_data,auto_submit:content.readcast_settings.prefs['event_settings']['reading']['scribd']=='on',service_type:'scribd',event_type:'read'})).start();(new Scribd.Readcast.Event.AutoShare({doc:doc_data,auto_submit:content.readcast_settings.prefs['event_settings']['reading']['twitter']=='on',service_type:'twitter',event_type:'read'})).start();(new Scribd.Readcast.Event.FacebookAutoShare({doc:doc_data,auto_submit:content.readcast_settings.prefs['event_settings']['reading']['facebook']=='on',event_type:'read'})).start();}}
function updateCollectionsUI(content){var collection_containter=$$('.autogen_class_views_shared_document_collections_lightbox')[0];if(!collection_containter){$$('.toolbar_lightboxes')[0].insert(content.collections);Scribd.Toolbar.switchToLoggedInAction('collections');Scribd.enableDocumentCollectionForm();}}
function updateFacebookWelcomeUI(content){$('wrap').insert({before:content.facebook_top_banner});}
function generateMediaAttachment(doc,type){switch(type){case'flash':return{type:type,imgsrc:doc.imageUrl,swfsrc:'http://d1.scribdassets.com/ScribdViewer.swf?document_id=#{id}&access_key=#{access_key}&page=1&version=1&viewMode=list'.interpolate(doc),width:'100',height:'129',expanded_width:'320',expanded_height:'260'};case'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,attachment:attachment,action_links:[{text:"Upload Your Documents",href:'http://www.scribd.com/upload-document?from=facebook'}]};if(autoPost){FB.api({method:'users.hasAppPermission',ext_perm:'publish_stream'},function(response){if(response==1){FB.api(publish_options,function(response){});}else{FB.ui(Object.extend({display:'popup'},publish_options),function(response){});}});}else{FB.ui(Object.extend({display:'popup'},publish_options),function(response){});}});}
return{scribdSessionActive:false,serverEnableInstantConnect:true,EVENTS:{loaded:'Scribd:Facebook:loaded',active_facebook_session:'Scribd:Facebook:active_facebook_session',inactive_facebook_session:'Scribd:Facebook:inactive_facebook_session',auto_logged_in:'Scribd:Facebook:auto_logged_in',auto_logged_out:'Scribd:Facebook:auto_logged_out',transition:'Scribd:Facebook:transition'},isSessionTransitioned:function(){return transitioned;},getSessionUID:function(){if(!session||!session.uid){return null;}
return session.uid;},ensureInit:function(func){if(loaded){func();}
else{document.observe(Scribd.Facebook.EVENTS.loaded,func);}},beforeFacebookInitialize:function(){Scribd.Facebook.AutoLogin.initialize();},initializeConnect:function(){FB.init({apiKey:apiKey,status:false,cookie:true,xfbml:true});this.session=FB._session;if(Scribd.Facebook.AutoLogin.enabled()){checkSessionState();}
loaded=true;Scribd.log('FacebookManager: Finished initializing FB Connect',this);document.fire(Scribd.Facebook.EVENTS.loaded);},instantConnectFilter:function(knobs){var chance;if(Scribd.Request.controller=="word"&&Scribd.Request.action=="view"){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:knobs.non_facebook_referral;if(Math.random()<chance){this.instantConnect();}},initiateLogin:function(e,onFBSessionInit){Scribd.Facebook.ensureInit(function(){var btn=e.element();if(btn.hasClassName('fb_connect_button_deactivated')||btn.hasClassName('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_deactivated');if(spinner)
spinner.setStyle({visibility:'hidden'});btn=spinner=null;}
FB.login(function(response){if(response.session){onFBSessionInit();}
else{onCancel();}});if(btn.hasClassName('fb_connect_button'))
btn.addClassName('fb_connect_button_deactivated');else if(btn.hasClassName('fb_connect_button_large'))
btn.addClassName('fb_connect_button_large_deactivated');});},setPageTransitionURL:function(url){pageTransitionURL=url;},transitionToLoggedInUI:function(login_info){updateGlobalHeader(login_info.word_user_id,login_info.word_user_name,login_info.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:[generateMediaAttachment(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('session_metadata'),initialize:function(){if(this.enabled()){Event.observe(document,Scribd.Facebook.EVENTS.active_facebook_session,function(e){new Ajax.Request('/facebook_session/instant_connect',{parameters:{facebook_id:Scribd.Facebook.getSessionUID()},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.transitionToLoggedInUI(r.responseJSON);}else if(r.responseJSON.new_user){Scribd.log('FB autoCreate: create response',r.responseJSON);Event.fire(document,Scribd.Facebook.EVENTS.auto_logged_in);Scribd.Facebook.transitionToLoggedInUI(r.responseJSON);}else{Scribd.log(r.responseJSON.success);Scribd.log('FB autoLogin: no existing scribd user');this.loggedOut();this.cookie.set('no_existing_scribd_user','true');this.cookie.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_scribd_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: user forced logout');return false;}
if(!Scribd.Facebook.serverEnableInstantConnect||Scribd.Facebook.scribdSessionActive){Scribd.log('FB autoLogin: disabled server side');return false;}
return true;},loggedOut:function(){Event.fire(document,Scribd.Facebook.EVENTS.auto_logged_out);}};Scribd.Facebook.Permissions={context_permissions:{"toolbar_download":["email","publish_stream"],"homepage":["email","publish_stream"]},all_permissions:["email","publish_stream"],hasPermissionsForContext:function(context){var context_permissions=Scribd.Facebook.Permissions.context_permissions[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 onPermissionsGranted callback";}
if(!callbacks.onPermissionsDenied){throw"You must provide an onPermissionsDenied callback";}
Scribd.Facebook.Permissions.requestFacebookPermissions(context_permissions,callbacks);},hasAllPermissions:function(actualPermissionsString,requiredPermissionsString){if(!actualPermissionsString)return false;var actualPermissionsArray=actualPermissionsString.split(",");var requiredPermissionsArray=requiredPermissionsString.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)return true;if(!facebookUserPermissions)Scribd.Facebook.Permissions.fetchFacebookPermissions();if(Scribd.Facebook.Permissions.hasAllPermissions(facebookUserPermissions,permissions)){return true;}else{return false;}},requestFacebookPermissions:function(permissions,callbacks){Scribd.Facebook.ensureInit(function(){Scribd.Facebook.Permissions.fetchFacebookPermissions();if(Scribd.Facebook.Permissions.hasFacebookPermissions(permissions)){callbacks.onPermissionsGranted();}else{FB.ui({display:'iframe',method:'auth.login',perms:permissions},function(response){if(response.session){if(Scribd.Facebook.Permissions.hasAllPermissions(response.perms,permissions)){Scribd.Facebook.Permissions.updateScribdPermissions(response.perms);callbacks.onPermissionsGranted();}else{callbacks.onPermissionsDenied();}}else{callbacks.onPermissionsDenied();}});}});},fetchFacebookPermissions:function(){Scribd.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(response&&response[0]){var perms=response[0];var perms_granted=[];all_permissions.each(function(perm){if((perms[perm]==1)||(perms[perm]=='1')){perms_granted.push(perm);}});Scribd.Facebook.Permissions.updateScribdPermissions(perms_granted.join(','));}else{facebookUserPermissions='';}});});},updateScribdPermissions:function(permissions){facebookUserPermissions=permissions;new Ajax.Request("/facebook_accounts/set_permissions");}};Scribd.Facebook.getSharedFriends=function(container,max,tmpl,onSuccess){container=$(container);var api_callback=function(response){if(!!response&&response.length>0){response.each(function(id,i){if(i<=max){var pic=tmpl.evaluate({fb_user_id:id});container.insert(pic);}else{throw $break;}});var count_msg=container.down('.friend_count_msg a');if(count_msg){count_msg.update("#{count} friend#{plural}".interpolate({count:response.length,plural:((response.length==1)?'':'s')}));}
container.fire('Scribd:dom_updated');onSuccess();}};Scribd.Facebook.ensureInit(function(){FB.api({method:'Friends.getAppUsers'},api_callback);});};Scribd.Facebook.upgradeAccount=function(e){e.stop();var container=e.element().up('.nag')||e.element().up('.special_nag');Scribd.Facebook.Permissions.requestPermissionsForContext('homepage',{onPermissionsGranted:function(){container.down('.inner').update('<h2 class="first">Thanks, your profile is now complete.</h2>');(function(){Effect.Fade(container);}).delay(3);},onPermissionsDenied:function(){Scribd.log('FB Permissions Request Denied.');}});};Scribd.blueBarUtil={show:function(){},barClosed: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:function(req){trackEvent('Facebook','Blue Bar','No Thanks');(function(){window.location='/logout?return_to='+encodeURIComponent(window.location.pathname);}).delay(1);},on409:function(req){window.location='/account/blocked_from_deletion';}});},onLoadHandler:function(){Scribd.Facebook.ensureInit(function(){if(facebookUser&&Scribd.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,function(){var cookie=FB.Cookie.load();var no_fb_cookie_on_scribd_domain=cookie===undefined;var matching_session=(current_facebook_user_id&&cookie&&(cookie.uid==current_facebook_user_id));if(!Scribd.logged_in||current_facebook_user_id===null||no_fb_cookie_on_scribd_domain||matching_session){container.update('<fb:like href="'+url+'" width="'+width+'" layout="'+layout+'" '+extras+'></fb:like>').show();}});}});


/* public/javascripts/shared/flash_heed.js @ 1305154393 */

var FlashHeed=(function(window){var document=window.document;var gsub=function(string,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+=source,source='';}}
return result;};var heed=function(el){if(el===undefined)var el=document;var objects=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_length=params.length;var embeds=o.getElementsByTagName('embed');var embed=null;if(embeds.length>0)var embed=embeds[0];if(embed){embed.setAttribute('wmode','transparent');var nx=embed.nextSibling,pn=embed.parentNode;pn.removeChild(embed);pn.insertBefore(embed,nx);}
var correct_wmode_found=false;var incorrect_wmode_found=false;for(var j=0;j<params_length;j++){if(params[j].name==='wmode'){if(/transparent/i.test(params[j].value)||/opaque/i.test(params[j].value)){correct_wmode_found=true;}else{incorrect_wmode_found=true;}}}
if(!correct_wmode_found||incorrect_wmode_found){var html=o.outerHTML;var nx=o.nextSibling,pn=o.parentNode;html=gsub(html,/<param name="wmode".*?>/i,'');html=gsub(html,/<\/object>/i,'<PARAM NAME="WMode" VALUE="Transparent"></object>');pn.removeChild(o);var div=document.createElement("div");div.appendChild(o);div.innerHTML='';div.innerHTML=html;pn.insertBefore(div,nx);}}}
return{heed:heed}})(window);


/* public/javascripts/shared/link_account.js @ 1305154393 */

if(!window.Scribd)var Scribd=new Object();if(!Scribd.Facebook)Scribd.Facebook={};if(!Scribd.Twitter)Scribd.Twitter={};Scribd.SocialAccount=Class.create({initialize:function(element,callbacks){this.element=element;if(this.element){this.element.observe('click',this.linkPrompt.bind(this));}
if(callbacks!==undefined){this.onSuccess=callbacks.onSuccess;this.onFailure=callbacks.onFailure;}},success:function(){if(this.onSuccess)this.onSuccess();},failure:function(){if(this.onFailure)this.onFailure();},linkedTemplate:new Template('<span>#{name}</span>')});Scribd.Facebook.Account=Class.create(Scribd.SocialAccount,{linkPrompt:function(e){e.stop();FB.login(this.handleLinkResponse.bind(this));},handleLinkResponse:function(response){if(response.session){new Ajax.Request("/facebook_link",{method:'post',onSuccess:this.linkSuccess.bind(this),onFailure:this.linkFailure.bind(this)});}else{this.linkFailure();}},setGlobalState:function(){var cookie=FB.Cookie.load();if(cookie){facebookUser=true;facebookSessionKey=cookie.session_key;facebookUserId=cookie.uid;}},linkSuccess:function(){this.setGlobalState();this.setName();$$(".facebook_prefs").invoke('hide');Scribd.Alerts.success('flashes_placeholder',"Your facebook account is now linked.",{auto_fade:true});$$('.facebook_not_linked').invoke('hide');this.success();},linkFailure:function(){Scribd.Alerts.error('flashes_placeholder',"Sorry, another Scribd user is already associated with that Facebook account.",{auto_fade:false});this.failure();},replaceLink:function(response){if(response[0]){var span=this.linkedTemplate.evaluate({name:response[0].name});$$('.facebook_unlink_account').invoke('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 WHERE id='+FB.getSession().uid},this.replaceLink.bind(this));}});Scribd.Twitter.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._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._twitterWindow.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(this),onFailure:this.linkFailure.bind(this)});},linkSuccess:function(){$$(".twitter_prefs").invoke('hide');Scribd.Alerts.success('flashes_placeholder',"Your twitter account is now linked.",{auto_fade:true});$$('.twitter_not_linked').invoke('hide');this.success();this.setName();},linkFailure:function(){Scribd.Alerts.error('flashes_placeholder',"We could not link your twitter account.  Please try again.",{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("/twitter_link/info.js",{method:'get',evalJSON:'force',onSuccess:this.replaceLink.bind(this)});}});Scribd.Facebook.UnlinkAccount=Class.create({initialize:function(element){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.handleUnlinkAccountResponse.bind(this)});},handleUnlinkAccountResponse:function(response){$$('.facebook_unlink_account').invoke('hide');$$('.facebook_username').invoke('hide');$$('.facebook_link_account').invoke('show');}});Scribd.Twitter.UnlinkAccount=Class.create({initialize:function(element){this.element=element;if(this.element){this.element.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:function(response){$$('.twitter_unlink_account').invoke('hide');$$('.twitter_username').invoke('hide');$$('.twitter_link_account').invoke('show');}});document.observe(Scribd.Facebook.EVENTS.loaded,function(){if(!Scribd.Readcast.active())return;$$('.facebook_link').each(function(el){new Scribd.Facebook.Account(el);});$$('.twitter_link').each(function(el){new Scribd.Twitter.Account(el);});});


/* public/javascripts/shared/login_required.js @ 1305154393 */

Scribd.requireLogin=function(){if(Scribd.logged_in){return true;}
Scribd.login.open({});return false;};


/* public/javascripts/shared/logoutAlert.js @ 1305154393 */

if(!window.Scribd)var Scribd=new Object();Scribd.logoutAlert=Class.create({message:'You have logged out.',initialize:function(container){var container=$(container);if(container&&Scribd.Alerts&&!Scribd.logged_in){if(window.location.hash=='#logout'){container.addClassName('active').show();Scribd.Alerts.success_blue(container,this.message);window.location.hash='';}}}});Event.observe(window,'load',function(e){new Scribd.logoutAlert('flashes_placeholder');});


/* public/javascripts/shared/options.js @ 1305154393 */

if(!window.Scribd)var Scribd=new Object();Scribd.Options=function(defaults,options){if(options===undefined)var options={};var r=defaults;for(var property in options)
r[property]=options[property];return r;};


/* public/javascripts/shared/premium.js @ 1305154393 */

if(!window.Scribd)var Scribd=new Object();if(!window.Scribd.Premium)Scribd.Premium=new Object();Scribd.Premium.ReadPage={initialize:function(options){this.options=Object.extend({logged_in:false,show_gate:true,extension:'pdf'},options||{});if(!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==="#archive"){if(options.show_gate==true){if(options.logged_in==true){Scribd.Lightbox.remoteOpen('premium_download','/premium/purchases/gate',{doc:this.options.document_id,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(options.show_gate==true){if(options.logged_in==true){Scribd.Lightbox.remoteOpen('premium_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.location});}}}}.bind(this));}};


/* public/javascripts/shared/prototypes/string.js @ 1305154393 */

Object.extend(String.prototype,(function(){var updateQueryParams=function(params){if(this.indexOf('?')==-1){return this+'?'+Object.toQueryString(params);}else{var old_params=this.toQueryParams();var new_params=Object.extend(old_params,params);return this.baseUrl()+'?'+Object.toQueryString(new_params);}};var baseUrl=function(){return this.slice(0,this.indexOf('?'));};var protocol=function(){var matches=/^(.*?:)\/\//.exec(this);return matches?matches[1]:null;};var domain=function(){var matches=/\/\/(.*?)\//.exec(this);return matches?matches[1]:null;};return{updateQueryParams:updateQueryParams,baseUrl:baseUrl,protocol:protocol,domain:domain};})());


/* public/javascripts/shared/readcast.js @ 1305154393 */

Scribd.Readcast=Scribd.Readcast||{};Scribd.Readcast.Event=Scribd.Readcast.Event||{};Scribd.Readcast.active_events={};Scribd.Readcast.Event.Share=Class.create({initialize: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.scribble_text=this.options.scribble_text;},_klass:function(){return Scribd.Readcast.Event.Share;},resubmit:function(cb){this.submitted=false;this.submit(cb);},submit:function(cb){if(this.submitted)return;this.submitToRemote(cb);document.fire(this.events.submitted,{event:this});return this;},submitToRemote:function(cb){this.submitToScribd();if(Object.isFunction(cb))cb.call(this);return this;},submitToScribd:function(params){var that=this;this.submitted=true;if(this.doc&&this.doc.id)
params=Object.extend({document_id:this.doc.id},params);if(this.doc_collection&&this.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){document.fire(that.events.completed,{event:t})}});return this;},readcastURL:function(){return'/readcast/'+this.options.service_type+'/'+this.options.event_type;}});Scribd.Readcast.Event.Share.DEFAULT_OPTIONS={event_type:'read'};Scribd.Readcast.Event.Share.EVENTS={started:'Scribd:Readcast:Share:started',ready:'Scribd:Readcast:Share:ready',submitted:'Scribd:Readcast:Share:submitted',completed:'Scribd:Readcast:Share:completed'};Scribd.Readcast.Event.BlankReadcast=Class.create({initialize:function(options){this.klass=Scribd.Readcast.Event.BlankReadcast;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;},start:function(){var that=this;this.start_timer=setTimeout(function(){document.fire(that.events.ready,{event:that});},this.options.delay*1000);return this;}});Scribd.Readcast.Event.BlankReadcast.EVENTS={ready:'Scribd:Readcast:BlankReadcast:ready'};Scribd.Readcast.Event.BlankReadcast.DEFAULT_OPTIONS={delay: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.ready,{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.options.submit_delay*1000);document.fire(that.events.started,{event:that});}},this.options.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.Readcast.Event.AutoShare.EVENTS={started:'Scribd:Readcast:AutoShare:started',ready:'Scribd:Readcast:AutoShare:ready',submitted:'Scribd:Readcast:AutoShare:submitted',completed:'Scribd:Readcast:AutoShare:completed'};Scribd.Readcast.Event.FacebookAutoShare=Class.create(Scribd.Readcast.Event.AutoShare,{initialize:function($super,options){$super(options);this.options.service_type='facebook';this.comments=this.klass.COMMENTS;},_klass:function(){return Scribd.Readcast.Event.FacebookAutoShare;},submitToRemote:function(cb){var fn=this.sendToFacebook.bind(this)(cb);Scribd.FacebookSession.ensureValid(fn);return this;},sendToFacebook:function(cb){var that=this;return(function(){Scribd.Readcast.Permissions.Facebook.ensurePublish(function(response){FB.api(that.facebookApiParams(),function(response){if(!response||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.doc.url)}];}else{action_links=[{"text":"Readcast","href":Scribd.SharedLink.urlForFacebook(that.doc_collection.url)}];}
return({method:'stream.publish',action_links:action_links,attachment:that.streamAttachment()});},actionComment:function(){return this.klass.ACTION_COMMENTS[this.options.event_type];},streamAttachment:function(){var that=this,props={};if(that.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(),"description":that.doc.description.truncate(190),"href":Scribd.SharedLink.urlForFacebook(that.doc.url),"properties":props,"media":[{"type":"image","src":that.doc.thumbnail_url,"href":Scribd.SharedLink.urlForFacebook(that.doc.url)}]});}else{if(that.doc_collection.author!==undefined){props["By"]={"text":that.doc_collection.author.name,"href":that.doc_collection.author.url};}
return({"name":that.doc_collection.name.truncate(80),"caption":that.actionComment(),"description":that.doc_collection.description.truncate(190),"href":Scribd.SharedLink.urlForFacebook(that.doc_collection.url),"properties":props,"media":[{"type":"image","src":that.doc_collection.thumbnail_url,"href":Scribd.SharedLink.urlForFacebook(that.doc_collection.url)}]});}}});Scribd.Readcast.Event.FacebookAutoShare.DEFAULT_OPTIONS=Object.clone(Scribd.Readcast.Event.AutoShare.DEFAULT_OPTIONS);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:'{*actor*} published this'};Scribd.Readcast.Event.FacebookScribbleAutoShare=Class.create(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){var that=this;return(function(){Scribd.Readcast.Permissions.Facebook.ensurePublish(function(response){FB.api(that.facebookApiParams(),function(response){that.submitToScribd();that.submitted=true;});});});},facebookApiParams:function(){if(this.doc){return({method:'links.post',comment:this.scribble_text,url:Scribd.SharedLink.urlForFacebook(this.doc.url)});}else{return({method:'status.set',status:this.scribble_text});}}});Scribd.Readcast.Event.FacebookScribbleAutoShare.EVENTS=Object.clone(Scribd.Readcast.Event.AutoShare.EVENTS);


/* public/javascripts/shared/shared_link.js @ 1305154393 */

if(!window.Scribd)var Scribd=new Object();Scribd.SharedLink=function(){var source=window.location.hash.match('#source:(.+)');if(source){source=source[1];}
return{trackDocumentLink:function(id){if(source=='facebook'){trackEvent('Facebook','Link Sharing',id);}},urlForSource:function(url,source){return url.split('#')[0]+'#source:'+source;},urlForFacebook:function(url){return this.urlForSource(url,'facebook');}};}();


/* public/javascripts/shared/smartling.js @ 1305154393 */

Scribd.SmartlingManager=Class.create({currentLanguage:null,languages:{"es":{"lcid":"es","english_name":"Spanish","position":1,"name":"Espa\u00f1ol","id":"es","prefix":"es"},"pt":{"lcid":"pt-br","english_name":"Portuguese","position":2,"name":"Portugu\u00eas (Brasil)","id":"pt","prefix":"pt"},"en":{"lcid":"en","english_name":"English","position":0,"name":"English","id":"en","prefix":null}},initialize:function(options){var options=options||{};this.detectLanguage();},detectLanguage:function(){var classNames=$w($$('body').first().className);classNames.each(function(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;window.setTimeout(function(){Event.fire(document,'Scribd:language_detected')},0);}});


/* public/javascripts/shared/sticky_element.js @ 1305154393 */

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;var element=$(id);var new_callback=function(){var new_stickiness=sticky_func();if(new_stickiness!=previous_stickiness){previous_stickiness=new_stickiness;if(new_stickiness){fixed_callback(element);}else{absolute_callback(element);}
update_func(element);}
if(old_callback)
old_callback();};window.onscroll=new_callback;docManager.addEvent('viewmodeChanged',new_callback);docManager.addEvent('enteredFullscreen',new_callback);docManager.addEvent('exitedFullscreen',new_callback);document.observe('scribd:dom_height_changed',function(){previous_stickiness=null;new_callback();});Event.observe(document.onresize?document:window,'resize',new_callback);new_callback();};


/* public/javascripts/shared/tooltip.js @ 1305154393 */

Scribd.Tooltips={initialize:function(){$$('[data-tip]').each(function(el){var txt=el.readAttribute('data-tip').escapeHTML();el.writeAttribute('title',null);el.writeAttribute('data-tip',null);new Tip(el,txt,{style:'black_trans'});});$$('[data-tip-bottom]').each(function(el){var txt=el.readAttribute('data-tip-bottom').escapeHTML();el.writeAttribute('title',null);new Tip(el,txt,{style:'black_trans_bottom'});});}};document.observe('dom:loaded',Scribd.Tooltips.initialize.bind(Scribd.Tooltips));document.observe('Scribd:dom_updated',Scribd.Tooltips.initialize.bind(Scribd.Tooltips));


/* public/javascripts/shared/url.js @ 1305154393 */

Scribd.Url=(function(){var hash=function(){var url=document.location.href;var hash_loc=url.indexOf('#');if(hash_loc==-1){return'';}else{return url.slice(url.indexOf('#')+1);}};return{hash:hash};})();


/* public/javascripts/shared/vendor/easyXDM.js @ 1305154393 */

(function(window,document,location,setTimeout,decodeURIComponent,encodeURIComponent){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])=='object'&&object[property]);}
var on=(function(){if(isHostMethod(window,"addEventListener")){return function(target,type,listener){target.addEventListener(type,listener,false);};}
else{return function(object,sEvent,fpNotify){object.attachEvent("on"+sEvent,fpNotify);};}}());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,fpNotify);};}}());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(/^(http||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(key+"="+parameters[key]);}}
return url+((url.indexOf("?")===-1)?"?":"&")+q.join("&")+hash;}
var _query=(function(){var query={},pair,search=location.search.substring(1).split("&"),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(JSON&&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.stringify=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 cached;}
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=function(){config.onLoad(frame.contentWindow);};on(frame,"load",frame.loadFn);}
if(config.container){frame.border=frame.frameBorder=0;config.container.appendChild(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 item;}
catch(e){}}}());return function(){return new ActiveXObject(item);};}}());function ajax(config){apply(config,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded","X-Requested-With":"XMLHttpRequest"},success:emptyFn,error:function(msg){throw new Error(msg);},data:{},type:"plain"},true);var req=getXhr(),q=[];req.open(config.method,config.url,true);for(var prop in config.headers){if(config.headers.hasOwnProperty(prop)){req.setRequestHeader(prop,config.headers[prop]);}}
req.onreadystatechange=function(){if(req.readyState==4){if(req.status>=200&&req.status<300){var response=req.responseText;if(config.type==="json"){response=getJSON().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 config.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;config.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||"default"+_channelId++;config.secret=Math.random().toString(16).substring(2);if(undef(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,useParent:false,usePolling:false},true);if(config.isHost){if(!config.local){var domain=location.protocol+"//"+location.host,images=document.body.getElementsByTagName("img"),i=images.length,image;while(i--){image=images[i];if(image.src.substring(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.usePolling=true;config.useParent=true;config.local=location.protocol+"//"+location.host+location.pathname+location.search;parameters.xdm_e=encodeURIComponent(config.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:config.useParent?false:config.useResize});}
stackEls=[new easyXDM.stack.HashTransport(config),new easyXDM.stack.ReliableBehavior({timeout:((config.useResize?50:config.interval*1.5)+(config.usePolling?config.interval*1.5:50))}),new easyXDM.stack.QueueBehavior({encode:true,maxLength:4000-config.remote.length}),new easyXDM.stack.VerifyBehavior({initiate:config.isHost})];break;case"1":stackEls=[new easyXDM.stack.PostMessageTransport(config),new easyXDM.stack.QueueBehavior()];break;case"2":stackEls=[new easyXDM.stack.NameTransport(config),new easyXDM.stack.QueueBehavior(),new easyXDM.stack.VerifyBehavior({initiate:config.isHost})];break;case"3":stackEls=[new easyXDM.stack.NixTransport(config),new easyXDM.stack.QueueBehavior()];break;}
return stackEls;}
function chainStack(stackElements){var stackEl,defaults={incoming:function(message,origin){this.up.incoming(message,origin);},outgoing:function(message,recipient){this.down.outgoing(message,recipient);},callback:function(success){this.up.callback(success);},init:function(){this.down.init();},destroy:function(){this.down.destroy();}};for(var i=0,len=stackElements.length;i<len;i++){stackEl=stackElements[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,getJSONObject: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){delete _map[name];}
return fn;}};}());easyXDM.Socket=function(config){var stack=chainStack(prepareTransportStack(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(){stack.destroy();};this.postMessage=function(message){stack.outgoing(message,recipient);};stack.init();};easyXDM.Rpc=function(config,jsonRpcConfig){if(jsonRpcConfig.local){for(var method in jsonRpcConfig.local){if(jsonRpcConfig.local.hasOwnProperty(method)){var member=jsonRpcConfig.local[method];if(typeof member==="function"){jsonRpcConfig.local[method]={method:member};}}}}
var stack=chainStack(prepareTransportStack(config).concat([new easyXDM.stack.RpcBehavior(this,jsonRpcConfig),{callback:function(success){if(config.onReady){config.onReady(success);}}}]));this.destroy=function(){stack.destroy();};stack.init();};easyXDM.stack.PostMessageTransport=function(config){var pub,frame,callerWindow,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==targetOrigin&&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.removeChild(frame);frame=null;}},init:function(){targetOrigin=getLocation(config.remote);if(config.isHost){on(window,"message",function waitForReady(event){if(event.data==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;callerWindow.postMessage(config.channel+"-ready",targetOrigin);setTimeout(function(){pub.up.callback(true);},0);}}});};easyXDM.stack.NixTransport=function(config){var pub,frame,send,targetOrigin,proxy;return(pub={outgoing:function(message,domain,fn){send(message);fn();},destroy:function(){proxy=null;if(frame){frame.parentNode.removeChild(frame);frame=null;}},init:function(){targetOrigin=getLocation(config.remote);if(config.isHost){try{if(!isHostMethod(window,"GetNixProxy")){window.execScript('Class NixProxy\n'+'    Private m_parent, m_child, m_Auth\n'+'\n'+'    Public 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, auth)\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,targetOrigin);},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.protocol+"//"+location.host,xdm_c:config.channel,xdm_s:config.secret,xdm_p:3})});frame=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.secret);};setTimeout(function(){pub.up.callback(true);},0);}}});};easyXDM.stack.NameTransport=function(config){var pub;var isHost,callerWindow,remoteWindow,readyCount,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(true);}}
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(message);},destroy:function(){callerWindow.parentNode.removeChild(callerWindow);callerWindow=null;if(isHost){remoteWindow.parentNode.removeChild(remoteWindow);remoteWindow=null;}},init:function(){isHost=config.isHost;readyCount=0;remoteOrigin=getLocation(config.remote);config.local=resolveUrl(config.local);if(isHost){easyXDM.Fn.set(config.channel,function(message){if(isHost&&message==="ready"){easyXDM.Fn.set(config.channel,_onMessage);_onReady();}});remoteUrl=appendQueryParameters(config.remote,{xdm_e:config.local,xdm_c:config.channel,xdm_p:2});apply(config.props,{src:remoteUrl+'#'+config.channel,name:config.channel});remoteWindow=createFrame(config);}
else{config.remoteHelper=config.remote;easyXDM.Fn.set(config.channel,_onMessage);}
callerWindow=createFrame({props:{src:config.local+"#_4"+config.channel},onLoad:function(){un(callerWindow,"load",callerWindow.loadFn);easyXDM.Fn.set(config.channel+"_load",_onLoad);_onReady();}});}});};easyXDM.stack.HashTransport=function(config){var pub;var me=this,isHost,_timer,pollInterval,_lastMsg,_msgNr,_listenerWindow,_callerWindow;var usePolling,useParent,useResize,_remoteOrigin;function _sendMessage(message){if(!_callerWindow){return;}
var url=config.remote+"#"+(_msgNr++)+"_"+message;if(isHost||!useParent){_callerWindow.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(_lastMsg.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,pollInterval);}
else{on(_listenerWindow,"resize",_onResize);}}
return(pub={outgoing:function(message,domain){_sendMessage(message);},destroy:function(){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.interval;_lastMsg="#"+config.channel;_msgNr=0;usePolling=config.usePolling;useParent=config.useParent;useResize=config.useResize;_remoteOrigin=getLocation(config.remote);if(!isHost&&useParent){_listenerWindow=window;_callerWindow=parent;_attachListeners();pub.up.callback(true);}
else{apply(config,{props:{src:(isHost?config.remote:config.remote+"#"+config.channel),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 tries=0,max=config.delay/50;(function getRef(){if(++tries>max){throw new Error("Unable 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=function(config){var pub,timer,current,next,sendId=0,sendCount=0,maxTries=config.tries||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("_");message=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(message,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,origin: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,queue=[],waiting=true,incoming="",destroying,maxLength=0;function dispatch(){if(waiting||queue.length===0||destroying){return;}
waiting=true;var message=queue.shift();pub.down.outgoing(message.data,message.origin,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:function(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.encode){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=message.substring(0,maxLength);message=message.substring(fragment.length);fragments.push(fragment);}}
else{fragments.push(message);}
while((fragment=fragments.shift())){queue.push({data:fragments.length+"_"+fragment,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=false;function startVerification(){mySecret=Math.random().toString(16).substring(2);pub.down.outgoing(mySecret);}
return(pub={incoming:function(message,origin){var indexOf=message.indexOf("_");if(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.substring(indexOf+1),origin);}}},outgoing:function(message,origin,fn){pub.down.outgoing(mySecret+"_"+message,origin,fn);},callback:function(success){if(config.initiate){startVerification();}}});};easyXDM.stack.RpcBehavior=function(proxy,config){var pub,serializer=config.serializer||getJSON();var _callbackCounter=0,_callbacks={};function _send(data){data.jsonrpc="2.0";pub.down.outgoing(serializer.stringify(data));}
function _createMethod(definition,method){var slice=Array.prototype.slice;return function(){var l=arguments.length,callback,message={method:method};if(l>0&&typeof arguments[l-1]==="function"){if(l>1&&typeof arguments[l-2]==="function"){callback={success:arguments[l-2],error:arguments[l-1]};message.params=slice.call(arguments,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(!undef(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 in config.remote){if(config.remote.hasOwnProperty(method)){proxy[method]=_createMethod(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,decodeURIComponent,encodeURIComponent);


/* :files, 'app/views', ... @ 1305154354 */
/* app/views/accounts/sharing.js @ 1305154351 */

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.observeSwitches();this.observers.observeHeaderControls();},observers:{observeHeaderControls:function(){Scribd.ShareSettings.websites.each(function(website){Scribd.ShareSettings.permissionStates.each(function(permissionState){$('control_button_'+website+'_'+permissionState).observe('click',function(e){e.stop();Scribd.ShareSettings.eventHandlers.toggleControlButtons(permissionState,website);});});});},observeSwitches:function(){$$('a.switch_button').invoke('observe','click',Scribd.ShareSettings.eventHandlers.handleSwitchButtonClick);}},eventHandlers:{setInitialState:function(state){Scribd.ShareSettings.form.reset();$$('td.radio_button_controls input').invoke('enable');$H(state.event_settings).each(function(eventType){$H(eventType.value).each(function(website){var event_type=eventType.key;var website_name=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.ShareSettings.eventHandlers.toggleEventActiveState($('switch_'+eventType));});},handleSwitchButtonClick:function(event){event.stop();Scribd.ShareSettings.eventHandlers.toggleEventActiveState(Event.element(event));},toggleEventActiveState:function(switchButtonElement){var eventType=switchButtonElement.id.split("_")[1];var disableSwitchCheckBox=$('disabled_events_'+eventType);switchButtonElement.toggleClassName("switch_button_off");$$('tr#row_'+eventType+' input').each(function(button){button.disabled=!button.disabled;});$('row_'+eventType).toggleClassName("disabledEventType");disableSwitchCheckBox.checked=!disableSwitchCheckBox.checked;if(disableSwitchCheckBox.checked&&Scribd.ShareSettings.alwaysShared.include(eventType)){Scribd.Alerts.success_blue('sharing_alerts',"Note: "+eventType.capitalize()+" events will always be shared on Scribd.",{auto_fade:true});}},toggleControlButtons:function(state,website){$$('td.'+website+' input.'+state).each(function(button){button.checked=true;});}},submitForm:function(event){event.stop();this.prepareFormStateForSerialization();new Ajax.Request(Scribd.ShareSettings.form.action,{method:'post',parameters:Form.serialize(Scribd.ShareSettings.form),onSuccess:function(response){Scribd.Alerts.success('sharing_alerts',"Preferences saved.",{auto_fade:true});},onFailure:function(response){Scribd.Alerts.error('sharing_alerts',"Error saving preferences. Please try again later.",{auto_fade:true});}});this.restoreFormState();},prepareFormStateForSerialization:function(){$$('input.disabled_control').each(function(checkbox){checkbox.enable();});this.disabledEvents=$$('input.disabled_control').select(function(checkbox){return checkbox.checked;});$$('td.radio_button_controls input').each(function(radioButton){radioButton.enable();});},restoreFormState:function(){this.disabledEvents.each(function(checkbox){$$('tr#row_'+checkbox.value+' td.radio_button_controls input').each(function(radio){radio.disable();});});}};


/* app/views/community/community.js @ 1305154352 */

Scribd.toggle_people_view=function(e){e.stop();if(!this.up().hasClassName('selected')){$$('#grid_listing_buttons, #list_listing_buttons').each(Scribd.Buttons.toggle);var container=$('community_main');var loading=container.down('.loading_overlay');if(loading){loading.show();}else{var csize=container.getDimensions();loading=new Element('div',{'class':'loading_overlay'}).update('<img src="/images/spinner_large_mac_white.gif?1305154393" 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.replace(req.responseText);}});}}


/* app/views/explore/explore.js @ 1305154352 */

Scribd.explore_cookies=new CookieJar({path:'/',expires:(60*60*24*360*10)});Scribd.toggle_doc_row=function(e){var title=this.value||this.rel;var callback=function(){var on=$(title+'_docs').visible();if(this.tagName=='A')
$('cb_'+title).checked=on;var cookie=Scribd.explore_cookies.get('explore_carousels')||{};var rows=cookie['trends_rows']||[];var changed=false;if(on&&rows.include(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_carousels',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(title+'_carousel');}});Scribd.carouselLazyLoad(Scribd[title+'_carousel']);$$('#'+title+'_docs .timespan .pseudoLink').invoke('observe','click',function(e){this.up('.timespan').down('.selected').removeClassName('selected');this.addClassName('selected');var timespan=this.up('li').readAttribute('class');var scrollContainer=$("trending_"+title);var csize=scrollContainer.getDimensions();var loading=new Element('div',{'class':'loading'}).update('<img src="/images/spinner_large_mac_white.gif?1305154393" class="spinner">');loading.setStyle({'width':csize.width+'px','height':csize.height+'px'});loading.clonePosition(scrollContainer,{offsetLeft:scrollContainer.cumulativeScrollOffset().left,offsetTop:document.viewport.getScrollOffsets().top});loading.setOpacity(.75);$(title+'_docs').insert(loading);Scribd[title+'_carousel'].deactivateControls();new Ajax.Updater("trending_"+title,url,{method:'get',parameters:{carousel:title,tl:timespan,offset:0},onComplete:function(){var cname=title+'_carousel';Scribd[cname].slides=$$('#trending_'+title+' li');Scribd[cname].reload();Scribd.carouselLazyLoad(Scribd[cname]);loading.remove();}});});};Scribd.toggle_doc_view=function(e){e.stop();if(!this.up().hasClassName('selected')){$$('#grid_listing_buttons, #list_listing_buttons').each(Scribd.Buttons.toggle);$('docs_overlay').show();new Ajax.Updater('docs',this.href,{method:'get',onComplete:function(){$('docs_overlay').hide();activateScribdLinks();}});}};


/* app/views/home/_index.js @ 1305154352 */

if(!window.Scribd)var Scribd=new Object();Scribd.HomepageManager=Class.create({container_element_id:'template_main_content',loading_element_id:'instant_connect_loading',loggedOutShown:false,instantConnectRedirectStarted:false,facebookTimeout:10,initialize:function(options){this.cookie=new Scribd.JSONCookie('session_metadata');this.container_element=$(this.container_element_id);this.loading_element=$(this.loading_element_id);this.body=$$('body').first();if(!this.container_element){Scribd.log('HomepageInstantConnectManager: Missing container element for: '+this.container_element_id);return;}
if(!this.loading_element){Scribd.log('HomepageInstantConnectManager: Missing loading container: '+this.loading_element_id);return;}
this.body.setStyle({backgroundColor:'#ffffff'});this.container_element.hide();this.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.loggedOutHandler.bind(this));(function(){if(!this.loggedOutShown&&!this.instantConnectRedirectStarted){trackEvent('Facebook','HomepageAutoLogin','TimedOut');Scribd.log('HomepageManager: Facebook timeout, showing logged out homepage');this.loading_element.hide();this.showContent();}}.bind(this)).delay(this.facebookTimeout);trackEvent('Facebook','HomepageAutoLogin','Attempted');}else{this.loading_element.hide();this.showContent();}},loggedInHandler:function(){this.instantConnectRedirectStarted=true;/*<sl:translate>*/
Scribd.log('HomepageManager: Received logged in state - redirecting to logged in homepage');this.loading_element.down('h2').update("Hi there! We're logging you in now.");/*</sl:translate>*/
window.location.reload();},loggedOutHandler:function(){/*<sl:translate>*/
Scribd.log('HomepageManager: Received logged out state - showing logged out homepage');/*</sl:translate>*/
this.loading_element.hide();this.showContent();},showContent:function(){this.loggedOutShown=true;this.container_element.show();this.body.setStyle({backgroundColor:'#161312'});}});


/* app/views/layouts/_boomerang.js @ 1305154353 */

if(!window.Scribd)var Scribd=new Object();if(!window.Scribd.Boomerang)Scribd.Boomerang=new Object();Scribd.Boomerang.install=function(in_development,controller_action,remote_ip,should_autorun,cookie_domain,custom_variables){try{var probability=in_development?1.0:0.0;var sendToGA=false;var sendToScribd=in_development?true:false;if(Scribd.ServerOptions!=null){if((!in_development)&&Scribd.ServerOptions['boomerang_send_to_ga']!=null){sendToGA=Scribd.ServerOptions['boomerang_send_to_ga'];}
if(Scribd.ServerOptions['boomerang_send_to_scribd']!=null){sendToScribd=Scribd.ServerOptions['boomerang_send_to_scribd'];}
if(Scribd.ServerOptions['boomerang_default_probability']!=null){probability=Scribd.ServerOptions['boomerang_default_probability'];}
var action_probability_option_name="boomerang_action_probability_"+controller_action;if(Scribd.ServerOptions[action_probability_option_name]!=null){probability=Scribd.ServerOptions[action_probability_option_name];}}
if((sendToGA||sendToScribd)&&(Math.random()<=probability)){if(remote_ip=='cached_action_remote_ip'){remote_ip="127."+Math.floor(Math.random()*256)+"."+Math.floor(Math.random()*256)+"."+Math.floor(Math.random()*256);}
var initOptions={user_ip:remote_ip,autorun:should_autorun,site_domain:cookie_domain,BW:{base_url:'/images/boomerang/'}};if(!in_development){initOptions['log']=null;}
if(Scribd.ServerOptions&&Scribd.ServerOptions['boomerang_enable_bandwidth_test']!=null){if(!Scribd.ServerOptions['boomerang_enable_bandwidth_test']){initOptions['BW']['enabled']=false;}}
if(sendToScribd){initOptions['beacon_url']="http://www.scribd.com/bb/p";}
BOOMR.init(initOptions);var scribd_boomerang_page_head_to_ready_start=new Date().getTime();var scribd_boomerang_page_head_to_ready_end=null;BOOMR.subscribe('before_beacon',function(o){if(scribd_boomerang_page_head_to_ready_end==null){scribd_boomerang_page_head_to_ready_end=new Date().getTime();}
BOOMR.addVar("scribd_boomerang_page_head_to_ready",scribd_boomerang_page_head_to_ready_end-scribd_boomerang_page_head_to_ready_start);});if(sendToGA){BOOMR.subscribe('before_beacon',function(o){_gaq.push(['_createTracker',"UA-443684-19",'boomr']);if(o.t_done)_gaq.push(['boomr._trackEvent',controller_action,"Time To Load (ms)",custom_variables,o.t_done]);if(o.t_page)_gaq.push(['boomr._trackEvent',controller_action,"Time Head to Ready (ms)",custom_variables,o.t_page]);if(o.bw)_gaq.push(['boomr._trackEvent',controller_action,"Bandwidth (Bps))",custom_variables,o.bw]);if(o.lat)_gaq.push(['boomr._trackEvent',controller_action,"Latency (ms)",custom_variables,o.lat]);});}
$H(custom_variables).each(function(pair){BOOMR.addVar(pair.key,pair.value);});var guid='xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g,function(c){var r=Math.random()*16|0,v=c=='x'?r:(r&0x3|0x8);return v.toString(16);});BOOMR.addVar("scribd_boomerang_request_guid",guid);};}catch(err){if(in_development){console.log("Unable to activate Boomerang! Error is: "+err);}else{}}};


/* app/views/layouts/global_search.js @ 1305154353 */

Scribd.SearchAutoCompleter=(function(){function DataSource(data,category){this.data=data;this.category=category;}
DataSource.prototype={find:function(query){var matches=[];this.data.each(function(element){if(this.category==="documents"){var pos=firstMatchedPosition(element.n,query);element.title=element.n;element.url='/doc/'+element.i;}else if(this.category==="users"||this.category==="publishers"){var pos=firstMatchedPosition(element.un,query);element.title=element.un;if(pos<0){pos=firstMatchedPosition(element.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.category==="document_collections"){element.url='/document_collections/'+element.i;}else{element.url=element.u;}}
element.sanitizedTitle=element.title&&element.title.escapeHTML();element.sanitizedUserName=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;this.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.substr(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();return("<span id='"+this.dom_id+"'>"+template+"</span>").interpolate(this.obj);},element: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.length===0){this.element.hide();return;}
this.element.show();var html=["<h4>"+this.title.gsub('_',' ')+"</h4><ul>"];var that=this;results.each(function(result){var obj=result[0];var pos=result[1];var len=result[2];that.results.push(new Result(obj,pos,len));});this.results.each(function(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=text.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.keyStrokeBufferDelay=keyStrokeBufferDelay||200;Event.observe(window,"keyup",function(e){if((e.keyCode===13||e.keyCode==9)&&this.results.length>0&&this.selectedElement){location.href=this.selectedElement.obj.url;}else if(e.keyCode==38){if(this.selectedElement===null){this.changeSelectedElement(this.results[this.results.length-1]);}else{this.changeSelectedElement(this.selectedElement.prev);}}else if(e.keyCode==40){if(this.selectedElement===null){this.changeSelectedElement(this.results[0]);}else{this.changeSelectedElement(this.selectedElement.next);}}else if(e.keyCode==27){e.stop();this.hide();}}.bind(this));Event.observe(window,"click",function(e){if(e.findElement()!==this.field){this.hide();}}.bind(this));Event.observe(this.field,"keyup",this.bufferedKeyup.bind(this));this.dataSources=[];this.containers={};};SearchAutocompleter.prototype={hide:function(){this.results=[];this.selectedElement=null;$(this.resultsContainerId).hide();this.categories.each(function(category){this.containers[category].clear();}.bind(this));},bufferedKeyup:function(){if(this.bufferedQuery!==this.field.getValue()){window.clearTimeout(this.bufferKeyTimer);this.bufferedQuery=this.field.getValue();var query=normalizeQuery(this.bufferedQuery);var that=this;this.bufferKeyTimer=window.setTimeout(function(){that.service.find(query,{found:function(json){that.initDataSources(json);that.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[category],category);total+=ds.size();this.dataSources.push(ds);}
return total;},init:function(data){this.initDataSources(data);for(var category in data){this.categories.push(category);var sectionId=this.resultsContainerId+"_"+category;if(!$(sectionId)){$(this.resultsContainerId).insert("<div id='#{id}' class='ac_section'></div>".interpolate({id:sectionId}));}
var container=new Container($(sectionId),category);this.containers[category]=container;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='#{sanitizedTitle}' /><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'><span class='label'>From:</span> #{sanitizedUserName}</p></div></li></a>";}}},changeSelectedElement:function(newElement){if(this.selectedElement!==null){var selectedElement=this.selectedElement.element();if(selectedElement){selectedElement.down().removeClassName("highlight");}}
this.selectedElement=newElement;if(newElement!==null){var selectedElement=this.selectedElement.element();if(selectedElement){selectedElement.down().addClassName("highlight");}}},addKeybindings:function(){var that=this;this.results.each(function(result){Event.observe(result.element(),"mouseover",function(e){that.changeSelectedElement(result);});});},find:function(query){this.results=[];this.selectedElement=null;for(var i=0;i<this.dataSources.length;i++){var dataSource=this.dataSources[i];var container=this.containers[dataSource.category];if(container){container.updateWith(dataSource.find(query));this.results=this.results.concat(container.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.results[i-1];}
if(i!==this.results.length-1){this.results[i+1].prev=this.results[i];this.results[i].next=this.results[i+1];}}
this.addKeybindings();}}};var GlobalService=Class.create({initialize:function(url){this.url=url,this.resultCache={},this.executedQueries={},this.bufferedQuery=null;},find:function(query,callbacks){if(this.hasNoResults(query)){callbacks.notFound();}else if(this.hasCache(query)){return callbacks.found(this.resultCache[query]);}else if(query!==this.bufferedQuery){if(!this.isFetching){this.isFetching=true;this._fetch(query,callbacks);}}
this.bufferedQuery=query;},_fetch:function(query,callbacks){this.bufferedQuery=query;this._remoteFetch(query,{q:query},callbacks);},_remoteFetch:function(query,params,callbacks){var that=this;new Ajax.Request(this.url,{method:'get',parameters:params,onSuccess:function(resp){var data=resp.responseJSON;if(data){var totalFound=0;for(var category in data){totalFound+=data[category].length;}
if(that.shouldCache()){that.executedQueries[query]=totalFound;that.resultCache[query]=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:function(){that.isFetching=false;if(query!==that.bufferedQuery){that.find(that.bufferedQuery,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];return(found&&found>0);},shouldCache:function(){return true;},preAlphabetCache:function(){var that=this;new Ajax.Request(this.url,{method:'get',parameters:{prefetch:true},onSuccess:function(resp){var data=resp.responseJSON;if(data){for(var preQuery 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){Scribd.logError(e);}});}});var UserService=Class.create(GlobalService,{initialize:function($super,userId){this.userId=userId;$super('/users/'+userId+'/autocompleter/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='__uactJsonp'+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.triesLoaded++;},_fetch:function(query,callbacks){if(query.length<2){callbacks.notFound();this.isFetching=false;}else{var params={};var found=false;for(var category in this.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 this.triesLoaded===3;}});SearchAutocompleter.GlobalService=GlobalService;SearchAutocompleter.UserService=UserService;SearchAutocompleter.TypesToIDs={documents:0,users:1,publisers:2,document_collections:3,scribd_pages:4};return SearchAutocompleter;})();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.concat(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)){data=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 key 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.indexOf(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');queryFields.each(function(query){query.blur();/*<sl:translate>*/
var defaultText='Search Books, Presentations, Business, Academics...',val=$F(query);/*</sl:translate>*/
if(query.visible()&&(!val||val===defaultText)){Scribd.addDefaultTextEvents(query,defaultText);}});if(Scribd.getOption('GlobalAutoCompleterEnabled')&&$("autocompleter")){var a=new Scribd.SearchAutoCompleter($('query_header'),"autocompleter");a.init({"documents":[],"users":[],"document_collections":[],"publishers":[],"scribd_pages":[]});a.service=new Scribd.SearchAutoCompleter.GlobalService('/autocompleter');}});document.observe('dom:loaded',function(){$$('.search_button').invoke('observe','click',function(e){e.stop();var button=e.findElement(),form=button.up('form');form.submit();});});


/* app/views/people/activity/_admin_header.js @ 1305154353 */

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 @ 1305154354 */

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.active=false;this.timerId=null;this.setupObservers();},controls:function(){return[this.hover_element,this.menu_element];},setupObservers:function(){this.hover_element.observe('mouseenter',this.showMenu.bind(this));this.controls().invoke('observe','mouseenter',this.activate.bind(this));this.controls().invoke('observe','mousemove',this.activate.bind(this));this.controls().invoke('observe','mouseout',this.deactivate.bind(this));document.body.observe('click',function(){this.hover_element.removeClassName('open');}.bind(this));},activate:function(){this.active=true;clearTimeout(this.timerId);this.timerId=this.tryHide.bind(this).delay(1);},deactivate:function(){this.active=false;},tryHide:function(){if(this.active){return false;}
this.hover_element.removeClassName('open');},showMenu:function(){this.hideOthers();this.hover_element.addClassName('open');},hideOthers:function(){$$('.hover_menu').each(function(el){el.removeClassName('open');});}});document.observe('dom:loaded',function(){$$('.hover_menu').each(function(el){new Scribd.HoverMenu(el);});});


/* app/views/shared/rat.js @ 1305154354 */

var RAT_API_VERSION='2';var ratInit=(function(){function getRandomInt(min,max){return Math.floor(Math.random()*(max-min+1))+min;}
var Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(input){var output="";var chr1,chr2,chr3,enc1,enc2,enc3,enc4;var i=0;input=Base64._utf8_encode(input);while(i<input.length){chr1=input.charCodeAt(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(isNaN(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+=String.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.getElementsByTagName('head')[0];var newScript=document.createElement('script');var callbackName='jsonp'+getRandomInt(0,1000000);window[callbackName]=function(data){callback(data[0]);window[callbackName]=undefined;};var newurl=url.replace(/(.*\?.*)(\?)/,'$1'+callbackName);newScript.src=newurl;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.hasOwnProperty(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,false);}else if(el.attachEvent){el.attachEvent('on'+e,f);}}
function removeListener(el,e,f){if(el.removeEventListener){el.removeEventListener(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.numPings=0;this.dhost=this._randHost()+RAT_API_VERSION+'/';}
Rats.prototype.start=function(){var self=this;this._getVid(function(){self._startLP();});addListener(window,'load',function(){self.docLoaded=true;});function unloadf(){if(self.lps){self.lps.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=data.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.numPings+=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=null;this.numPings=0;this._clearFlushTimeout();};Rats.prototype._getUBTC=function(){this._ubtc=this._ubtc||document.cookie.replace(/; */g,'&').parseQuery().scribd_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(useImg){var i=new Image();i.src=this.dhost+this.vid+'/de.png?rand='+getRandomInt(0,100000)+'&'+args;document.body.appendChild(i);}else{jsonp(this.dhost+this.vid+'/de.jsonp?callback=?&'+args,function(data){if(data.status=='success'){if(callback){callback();}}else{self.disable();}});}};Rats.prototype.logEvent=function(e,v){if(this.disabled()){return;}
var n=now();this.lastPing=n;v=v||null;this.es.push(e);this.vs.push(v);this.ts.push(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)*1000.0);};Rats.prototype._clearFlushTimeout=function(){if(this._flushTimeoutId===null){return;}
window.clearTimeout(this._flushTimeoutId);this._flushTimeoutId=null;};Rats.prototype._startLP=function(){var self=this;function startLP(){var i=document.createElement('iframe');i.src=self._randHost('lip.html#'+self.vid);i.style.display='none';document.body.appendChild(i);}
if(this.docLoaded){startLP();}else{addListener(window,'load',startLP);}};Rats.prototype._randHost=function(urlSuffix){urlSuffix=urlSuffix||'';return this.hosts[getRandomInt(0,this.hosts.length-1)]+urlSuffix;};Rats.prototype.disable=function(){this._disabled=true;if(this.unloadf){removeListener(window,'beforeunload',this.unloadf);}};Rats.prototype.disabled=function(){return this._disabled;};Rats.prototype.root=function(){return this;};function makeScope(parent,prefix){function RatScope(e,v){if(prefix){e=prefix+'.'+e;}
parent.logEvent(e,v);}
RatScope.logEvent=RatScope;RatScope.parent=parent;RatScope.root=function(){return parent.root();};RatScope.disable=function(){parent.disable();};RatScope.disabled=function(){return parent.disabled();};RatScope.s=function(prefix){return makeScope(RatScope,prefix);};RatScope.o=function(element,domEvent,logEventNameOrFunction,maxTimes,fireTimeout){maxTimes=maxTimes||-1;fireTimeout=fireTimeout||1000;if(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(logEventNameOrFunction.call(this,e));}else{RatScope.logEvent(logEventNameOrFunction);}
removeListener(element,domEvent,fire);maxTimes-=1;if(maxTimes==-1||maxTimes>0){setTimeout(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 @ 1305154354 */

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').remove();new Ajax.Request(anchor.href,{method:'delete',onSuccess:function(trans){Scribd.Alerts.success('flashes_placeholder','Successfully removed document.');},onFailure:function(){Scribd.Alerts.error('flashes_placeholder','Error removing document.');}});});});}};document.observe('dom:loaded',Scribd.Shelf.DeleteControls.initialize.bind(Scribd.Shelf.DeleteControls));Scribd.Shelf.Documents={initialize:function(){$$('.shelf_document img').each(function(el){el.observe('click',function(e){e.stop();var anchor=el.up('a');window.location=anchor.href;});});}};document.observe('dom:loaded',Scribd.Shelf.Documents.initialize.bind(Scribd.Shelf.Documents));


/* app/views/user_document_collections/cyclic_class.js @ 1305154354 */

if(!window.Scribd)var Scribd=new Object();Scribd.Cyclic={swapClasses:function(container_selector,element_selector,toggle_classes){var toggle_classes=toggle_classes||['on','off'];$$(container_selector).each(function(container){var i=0;container.select(element_selector).each(function(el){var next_i=(i+1)%2;el.addClassName(toggle_classes[i]);el.removeClassName(toggle_classes[next_i]);i=next_i;})});}};


/* app/views/word/view/_ipaper_toolbar.js @ 1305154354 */

if(!window.Scribd)var Scribd=new Object();Scribd.ipaperToolbarManager=Class.create({last_hash:null,initialize:function(options){this.options=Object.extend({},options||{});this.container=this.options.container;this.fullscreen_button=this.container.down('.fullscreen_button');this.document_id=options.document_id;this.logged_in=options.logged_in;this.post_params={id:this.document_id,show_container:true};if(options.secret_password){this.post_params.secret_password=this.options.secret_password;}
this.setupEvents();},setupEvents:function(){this.lb_buttons=this.container.select('.lb_button');this.lbs=this.lb_buttons.map(function(button){return $(button.id+'_lightbox');});this.lb_buttons.invoke('observe','click',function(e){e.stop();var el=e.element();var lb=$(el.id+'_lightbox');this.lbButtonClick(el,lb);}.bindAsEventListener(this));var usePolling=true;if(navigator.appName=='Microsoft Internet Explorer'){var ua=navigator.userAgent;var re=new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");if(re.exec(ua)!=null){usePolling=parseFloat(RegExp.$1)>=8.0;}}
this.fullscreen_button.observe('click',function(e){if(iPaperIsFullscreen){if(usePolling){window.location.hash='#fullscreen:off';}
else{iPaperCallbacks.exitFullScreen();this.removeClassName('exit_fullscreen_button').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=='#fullscreen:on'){iPaperCallbacks.enterFullScreen();this.removeClassName('fullscreen_button').addClassName('exit_fullscreen_button');}
else{iPaperCallbacks.exitFullScreen();this.removeClassName('exit_fullscreen_button').addClassName('fullscreen_button');}
this.last_hash=window.location.hash;}}.bind(this.fullscreen_button),200);}
this.container.select('a').invoke('observe','click',function(e){trackEvent('iPaper Top Toolbar','Button Clicks',e.element().id);});},lbButtonClick:function(el,lb){if(lb.hasClassName('inline_lb')){Scribd.Lightbox.open(lb.id,75);}else{this.lbOpen(lb.id);}},mobileButtonClick:function(){if(this.logged_in){this.toolbarLoginCallback('toolbar_mobile','/device/choose_device',true);}else{Scribd.login.open({callback:"Scribd.ipaperToolbar.toolbarLoginCallback('toolbar_mobile', '/device/choose_device', true)",context:'document_mobile'});}},downloadButtonClick:function(){if(this.logged_in){this.toolbarLoginCallback('toolbar_download','/word/toolbar_download',true);}else{Scribd.login.open({callback:"Scribd.ipaperToolbar.toolbarLoginCallback('toolbar_download', '/word/toolbar_download', true)",context:'download'});}},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.Lightbox.remoteOpen(id,url?url:'/word/'+id.gsub('_lightbox',''),this.post_params);}else{Scribd.Lightbox.toggle(id,75);}}});Scribd.mobileLightboxManager=Class.create({initialize:function(options){this.options=Object.extend({},options||{});this.delivery_radios=$$('input.delivery_methods');this.read_radios=$$('input.read_formats');this.setupEvents();},setupEvents:function(){this.delivery_radios.invoke('observe','click',function(e){this.showDeliveryMethod(e.element().value);}.bind(this));this.delivery_radios.each(function(item){if(item.checked==true){this.showDeliveryMethod(item.value);}}.bind(this));this.read_radios.invoke('observe','click',function(e){this.showReadFormat(e.element().value);}.bind(this));this.read_radios.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{$('download_to_my_device').hide();$('send_to_my_device').show();}},showReadFormat:function(item){$$('div.read_format_blocks').invoke('hide');$('read_format_'+item+'_block').show();}});


/* app/views/word/view/_toolbar_print.js @ 1305154354 */

if(!window.Scribd)var Scribd=new Object();Scribd.printLightboxManager=Class.create({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.autodown_query.set('autodown','pdf');if($('high_quality_print')){$('high_quality_print').down('.download_print_button').observe('click',function(e){if(this.options.logged_in){trackEvent('Print','Download and Print');window.location=this.downloadUrl();Scribd.Lightbox.close('toolbar_print_lightbox');}else{trackEvent('Print','Download and Print','Login');Scribd.login.open({context:'download',document_id:this.options.document_id,extension:'pdf',next_url:this.autodownUrl()});}}.bind(this));}
$('standard_quality_print').down('.print_button').observe('click',function(e){var 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 page 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','Printing...');trackEvent('Print','Print from iPaper');Scribd.Lightbox.close('toolbar_print_lightbox');}.bind(this));},downloadUrl:function(){return this.options.base_url+'?'+this.download_query.toQueryString();},autodownUrl:function(){return this.options.autodown_base_url+'?'+this.autodown_query.toQueryString();}});


/* app/views/word/view/toolbar_share/_embed.js @ 1305154354 */

if(!window.Scribd){var Scribd={};}
Scribd.embedCodeUIManager=Class.create({initialize:function(options){this.options=Object.extend({num_pages:null,doc_url:'',title:'',doc_id:0,access_key:'',secret_password:null,aspect_ratio:null},options||{});this.container=this.options.container;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=this.container.down('.auto_width');this.height_input=this.container.down('.embed_height');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.preview_link=this.container.down('.preview');this.update_link=this.container.down('.update_code');this.embed_params=this.container.down('.embed_params');this.embed_drawer=this.container.down('.embed_drawer');this.generator=new Scribd.embedCodeGenerator({doc_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.HTML5EmbedCodeGenerator({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.updatePrevious();this.width_input.disable();this.updateEmbedCode(true);new PeriodicalExecuter(this.updateEmbedCode.bind(this),1);this.setEvents();},$$:function(selector){return this.container.select(selector);},setEvents:function(){this.auto_width_input.observe('click',function(e){if(e.element().checked){this.width_input.disable();this.width_input.value=this.auto_value;}else{this.uncheck_auto_width();}}.bindAsEventListener(this));this.width_input.observe('blur',function(e){var el=e.element();if($F(el)==this.auto_value||$F(el)=="100%"){return;}
if($F(el)===""){el.value=this.generator.defaultWidth;}else if(parseInt($F(el))>this.generator.maxWidth){el.value=this.generator.maxWidth;}else if(parseInt($F(el))<this.generator.minWidth){el.value=this.generator.minWidth;}}.bindAsEventListener(this));this.preview_link.observe('click',function(e){var url=this.preview_url+"?width="+(this.auto_width_input.checked?this.generator.defaultWidth:this.width_input.value)+"&height="+this.height_input.value+"&view_mode="+$F(this.mode_input)+"&page="+this.page_input.value;if(this.options.secret_password){url=url+'&secret_password='+this.options.secret_password;}
window.open(url);e.stop();}.bind(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();}}.bindAsEventListener(this));this.height_input.observe('click',function(e){var el=e.element();if($F(el)==this.auto_value){el.select();}}.bindAsEventListener(this));this.page_input.observe('blur',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.options.num_pages)){this.page_input.value=this.options.num_pages;}}.bindAsEventListener(this));this.height_input.observe('blur',function(e){var el=e.element();if($F(el)==this.auto_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;}}.bindAsEventListener(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.auto_value;this.height_input.disable();if(this.container.down('.book_height_text')){this.container.down('.book_height_text').show();this.container.down('.embed_height').hide();}}else{if(this.height_input.value==this.auto_value){this.height_input.value=this.generator.defaultHeight;this.height_input.enable();}
if(this.container.down('.book_height_text')){this.container.down('.book_height_text').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','selected');el.addClassName('selected');this.$$('.lb_embed_code_container').invoke('hide');this.$$('[data-content='+el.readAttribute('data-tab')+']').invoke('show');}.bind(this));this.$$('.lb_embed_code_container input').invoke('observe','click',function(e){this.select();});this.$$('.embed_params input').invoke('observe','keypress',this.restrictToNumbers.bindAsEventListener(this));if(this.embed_drawer){this.embed_drawer.down('label').observe('click',function(){this.embed_drawer.toggleClassName('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;this.auto_width_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),auto_width: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.render(params);}
if(this.html5_embed_code){this.html5_embed_code.value=this.html_generator.render(params);}
this.updatePrevious();}},updatePrevious:function(){this.previous_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;},valuesChanged:function(){return(this.previous_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);},restrictToNumbers: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.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/word/view/toolbar_share/_send_to_friend.js @ 1305154354 */

if(!window.Scribd)var Scribd=new Object();Scribd.SendToFriendUIManager=Class.create({initialize:function(options){this.options=Object.extend({logged_in:false},options||{});/*<sl:translate>*/
this.defaultEmailInputText=this.options.logged_in?'email addresses or Scribd usernames':'email addresses of recipients';/*</sl:translate>*/
this.container=this.options.container;this.email_input=this.container.down('.email_input');this.send_form=$('toolbar_share_send_to_friend');this.email_input=this.send_form.down('.email_input');Scribd.addDefaultTextEvents(this.email_input,this.defaultEmailInputText);this.send_form.observe('submit',Scribd.Remote.Form.bindAsEventListener(this.send_form,{onCreate:function(){if(this.email_input.value==this.defaultEmailInputText)
this.email_input.clear();var success_div=this.container.down('.success');if(success_div)
success_div.hide();}.bind(this),onComplete:function(req){var success_div=this.container.down('.success');if(!req.responseJSON.errors){this.send_form.select('.input').invoke('clear');if(!success_div){/*<sl:translate>*/
var str='Successfully sent this document!';/*</sl:translate>*/
var success_div=new Element('div',{'class':'success'}).update(str);this.send_form.insert({before:success_div});}else{success_div.show();}}else{if(success_div)
success_div.hide();}}.bind(this)}));}});


/* :class_inlines, 'app/views', ... @ 1305154354 */
/* app/views/timeline_events/event.js @ 1305154354 */

Scribd.init('Scribd','Timeline');Scribd.Timeline.Reshare={initialize:function(){this.setupBinding('.reshare_link');this.closeBinding('.close_reshare');},setupBinding:function(selector){document.observe('click',function(e){var el=e.findElement(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('reshare_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){return;}
e.stop();var container=el.up('.event').down('.action_container'),reshare_controls=container.down('.reshare_controls');if(container.hasClassName('reshare_activated')){container.removeClassName('reshare_activated');reshare_controls.blindUp({duration:0.1});}});}};document.observe('dom:loaded',Scribd.Timeline.Reshare.initialize.bind(Scribd.Timeline.Reshare));Scribd.Timeline.Comment={initialize:function(){this.setupBinding('.comment_link');this.closeBinding('.close_reply');},setupBinding:function(selector){document.observe('click',function(e){var el=e.findElement(selector);if(!el){return;}
e.stop();if(!Scribd.requireLogin()){return;}
var container=el.up('.event').down('.action_container'),form=el.up('.event').down('.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('.status'));if(container.hasClassName('comment_activated')){form.blindUp({duration:0.1,afterFinish:function(){container.removeClassName('comment_activated');}});return;}
container.addClassName('comment_activated');});},closeBinding:function(selector){document.observe('click',function(e){var el=e.findElement(selector);if(!el){return;}
e.stop();var form=el.up('.event').down('.add_form'),container=el.up('.event').down('.comment_activated, .comment.expanded');if(container){Scribd.Timeline.Comment.removeCommentActiveClass(container.up('.event').down('.status'));form.blindUp({duration:0.1,afterFinish:function(){container.removeClassName('comment_activated');container.removeClassName('expanded');}});}});},toggleCommentActiveClass:function(status_container){if(status_container){if(status_container.hasClassName('comment_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:function(){this.setupBinding('.dismiss');},setupBinding:function(selector){document.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/unnag',{parameters:Scribd.CSRF.paramsWithToken({nag:nag})});}
var container=el.up('.dismissable');if(container){container.hide();}});}};document.observe('dom:loaded',Scribd.Timeline.Dismiss.initialize.bind(Scribd.Timeline.Dismiss));Scribd.Timeline.Controls={initialize:function(){this.deleteBinding('.event .controls .delete');this.dismissBinding('.event .controls .dismiss');},deleteBinding:function(selector){var that=this;document.observe('click',function(e){var link=e.findElement(selector);if(!link){return;}
e.stop();/*<sl:translate>*/
if(!confirm("Are you sure you want to delete this item?")){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:uId}));});},dismissBinding:function(selector){var that=this;document.observe('click',function(e){var link=e.findElement(selector);if(!link){return;}
e.stop();var eventId=parseInt(link.readAttribute('data-event-id'));var uId=parseInt(link.readAttribute('data-uid'));that._request(link,'/events/'+eventId+'/dismiss',Scribd.CSRF.paramsWithToken({}));});},_request:function(link,url,params){var controls=link.up();new Ajax.Request(url,{parameters:params,method:'POST',onCreate: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('.event'),{duration:0.5});},onFailure:function(resp){controls.down('.working').hide();controls.down('.error').update('Sorry, something went wrong.').show();},onException:function(req,e){controls.down('.working').hide();controls.down('.error').update('Sorry, something went wrong.').show();}});}}
document.observe('dom:loaded',Scribd.Timeline.Controls.initialize.bind(Scribd.Timeline.Controls));


/* app/views/people/profile.js @ 1305154353 */

document.observe('dom:loaded',function(){$$('.sidebar_submenu').each(function(section){var subselectors=section.select('a.subselector'),content_panels=section.select('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){subselectors.each(function(el){el.removeClassName("active");});el.addClassName("active");content_panels.each(function(el){el.hide();});var content=$(el.id+"_content");if(content)
content.show();}}});});});


/* app/views/documents/index.js @ 1305154352 */

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');manager.enabledNext=$$('#my_documents .paginator .next');manager.disabledPrevious=$$('#my_documents .paginator .disabled_previous');manager.disabledNext=$$('#my_documents .paginator .disabled_next');manager.enabledPrevious.invoke('observe','click',manager.eventHandlers.previousPage.bind(manager));manager.enabledNext.invoke('observe','click',manager.eventHandlers.nextPage.bind(manager));manager.refreshPagination();},setupToolbar:function(){var manager=Scribd.MyDocsManager.manager;var updateHash=function(e){manager.resetView();manager.setView(e.element().getValue());manager.requestView();};$$('#my_documents select.filter').invoke('observe','change',updateHash);}}


/* app/views/embeds/share.js @ 1305154352 */

Scribd.init('Scribd','Embeds');Scribd.Embeds.Share=Class.create({initialize:function(doc,secret_password){this.doc=doc;this.el=$$('.autogen_class_views_embeds_share .container')[0];this.$$('textarea').invoke('setValue',new Scribd.HTML5EmbedCodeGenerator({doc_url:'http://www.scribd.com/doc/'+doc.id,doc_id:doc.id,title:doc.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',select_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.findElement().getAttribute('doc_id')}).toQueryString(),{method:'post',onSuccess:function(response){$('share_on_scribd_link').hide();$('shared_on_scribd').show();}});});},$$:function(selector){return this.el.select(selector);},open:function(){this.el.show();},close:function(e){if(e)e.stop();this.el.hide();},toggle:function(){this.el.toggle();}});


/* app/views/shared/javascript_widget.js @ 1305154354 */

if(!window.Scribd)var Scribd=new Object();if(!window.Scribd.Shared)Scribd.Shared=new Object();Scribd.Shared.JavascriptWidget=Class.create({initialize:function(options){this.options=options;this.widget_dom_id=options.widget_dom_id;this.is_widget_loaded=false;},onDomLoaded:function(event){this.widget_dom=$(this.widget_dom_id);this.widget_dom.javascript_widget=this;this.on_widgets_loaded=this.onWidgetsLoaded.bind(this);Event.observe(document,'Scribd:widgets_loaded',this.on_widgets_loaded);},onWidgetsLoaded:function(event){Event.stopObserving(document,'Scribd:widgets_loaded',this.on_widgets_loaded);this.is_widget_loaded=true;}});


/* app/views/upload/_base_upload_widget.js @ 1305154354 */

if(!Scribd)Scribd=new Object();if(!Scribd.Upload)Scribd.Upload=new Object();Scribd.Upload.BaseUploadWidget=Class.create(Scribd.Shared.JavascriptWidget,{initialize: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 @ 1305154354 */

if(!Scribd)Scribd=new Object();if(!Scribd.Upload)Scribd.Upload=new Object();Scribd.Upload.UploadButtonWidget=Class.create(Scribd.Upload.BaseUploadWidget,{SCRIBD_ERROR:{INVALID_JSON:1201,NO_FILE_ID_PRESENT:1202},initialize:function($super,options){$super(options);this.auto_submit_to_facebook=options.auto_submit_to_facebook;this.button_height=options.button_height;this.button_width=options.button_width;this.button_image_url=options.button_image_url;this.button_placeholder_id=options.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_upload_limit;this.file_size_limit_mb=options.file_size_limit_mb;this.file_types=options.file_types;this.file_types_description=options.file_types_description;this.flash_url=options.flash_url;this.is_private=options.is_private;this.minimum_flash_version=options.minimum_flash_version;this.post_params=options.post_params;this.prevent_swf_caching=options.prevent_swf_caching;this.track_event_action=options.track_event_action;this.track_event_label=options.track_event_label;this.upload_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_url=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_element=document;this.upload_manager_by_file_id=$H();if(Scribd.override_upload_url){this.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_cursor,button_height:this.button_height,button_width:this.button_width,button_image_url:this.button_image_url,button_placeholder_id:this.button_placeholder_id,button_window_mode:this.button_window_mode,debug:this.debug_swf_upload,file_queue_limit:this.file_queue_limit,file_upload_limit:this.file_upload_limit,file_size_limit_mb:this.file_size_limit_mb+' MB',file_types:this.file_types,file_types_description: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.fileDialogStart.bind(this),file_dialog_complete_handler:this.fileDialogComplete.bind(this),file_queued_handler:this.fileQueued.bind(this),file_queue_error_handler:this.fileQueueError.bind(this),upload_start_handler:this.uploadStart.bind(this),upload_progress_handler:this.uploadProgress.bind(this),upload_error_handler:this.uploadError.bind(this),upload_success_handler:this.uploadSuccess.bind(this),upload_complete_handler:this.uploadComplete.bind(this)};},newSWFUpload:function(options){return new SWFUpload(options);},fileDialogStart:function(){window.copyright_message_seen=false;},fileDialogComplete:function(num_files_selected,num_files_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.enforceCopyrightWarning()){this.startUploadOrCreateAnonymousUser();}},fileQueued:function(file){if(!this.enforceCopyrightWarning())
return;var options=this.optionsForUploadManager(file);var upload_manager=this.newUploadManager(options);var parsed_name=this.parseName(file.name);upload_manager.insertElement({file_name_short:parsed_name.name.truncate(30),file_name_long:parsed_name.name,file_upload_id:this.widget_dom_id+'_file_'+file.index});upload_manager.onQueue();this.upload_manager_by_file_id[file.id]=upload_manager;},parseName:function(name){var name_parts=name.split('.');var extension=name_parts.pop();var base_name=name_parts.join('.');return{name:base_name,ext:extension};},optionsForUploadManager: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_extension:parsed_name.ext,isPrivate:this.isPrivate(),upload_source:this.upload_source};},newUploadManager:function(options){return new Scribd.scalable_upload_manager(options);},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="File 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.setButtonDisabled(false);},uploadStart:function(file){this.event_element.fire('Scribd:upload_widget:uploadStart',{file_id:file.id});this.swf_upload.setButtonDisabled(true);},uploadProgress:function(file,bytes_loaded,bytes_total){var percent=Math.ceil(bytes_loaded/bytes_total*100);this.uploadManagerForFile(file).onProgress(percent);},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 with the network connection, please try again.";break;case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR:error_msg="Security Error";break;case SWFUpload.UPLOAD_ERROR.UPLOAD_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;case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:error_msg="Upload stopped";break;case this.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:error_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.swf_upload.setButtonDisabled(false);}
window.trackEvent('upload',this.track_event_action,this.track_event_label,0);this.event_element.fire('Scribd:upload_widget:uploadSuccess',{file_id:file.id,doc_id:file_info.id,doc_title:file_info.title});this.num_files_successful+=1;},parseServerResponse:function(file,server_data){var file_info=null;try{file_info=server_data.evalJSON(true);}catch(e){this.invalidJsonError(file,server_data);return null;}
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 connection, please try again.');},isValidFileInfo:function(file_info){return((file_info)&&(file_info.id)&&(file_info.id>0)&&(file_info.access_key)&&(file_info.access_key.length>0));},invalidFileInfoError:function(file,server_data){this.uploadError(file,this.SCRIBD_ERROR.NO_FILE_ID_PRESENT,'Invalid server response: '+server_data);},uploadComplete:function(file){var upload_manager=this.uploadManagerForFile(file);upload_manager.onComplete();this.num_files_completed+=1;if(this.num_files_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){return window.copyright_agreed_to;}else{window.copyright_message_seen=true;return $super();}},isPrivate:function(){return this.is_private;},startUploadOrCreateAnonymousUser:function(){if(this.upload_url){this.startUpload();}else{new Ajax.Request(this.user_creation_url,{asynchronous:true,evalScripts:true,parameters:{from:this.user_creation_source},onSuccess:this.anonymousUserCreated.bind(this),onFailure:this.anonymousUserCreationFailed.bind(this)});}},anonymousUserCreated:function(transport){var data=transport.responseText.evalJSON();var upload_url=data.upload_url;if(upload_url&&!upload_url.blank()){this.upload_url=upload_url;this.swf_upload.setUploadURL(upload_url);this.startUpload();}else{this.anonymousUserCreationFailed(transport);}},anonymousUserCreationFailed:function(transport){var rawText=transport.responseText;this.uploader.setButtonDisabled(true);this.upload_manager_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_creation_failed').each(function(e){e.show();});},startUpload:function(){this.setPostParam('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();},getBrowserUuid:function(){return Scribd.getBrowserUuid();},getBrowserCookies:function(){return document.cookie;},addFileHTML:function(dom_element){var upload_status_dom=$(this.upload_status_dom_id);upload_status_dom.insert({top:dom_element});},cancelUpload:function(file){this.swf_upload.cancelUpload(file.id,false);},setPostParam:function(key,value){this.swf_upload.removePostParam(key);this.swf_upload.addPostParam(key,value);},uploadManagerForFile:function(file){return this.upload_manager_by_file_id[file.id];}});


/* app/views/layouts/footer/language_selector.js @ 1305154353 */

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(event);this.widget_dom.select('.top_row .language').invoke('observe','click',function(e){e.stop();if(this.open){this.widget_dom.down('.top_row .language').removeClassName('active');this.widget_dom.down('.language_selector').hide();this.open=false;}else{this.widget_dom.down('.top_row .language').addClassName('active');this.widget_dom.down('.language_selector').show();this.open=true;window.scrollTo(0,document.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.widget_dom.select('.language_selector li[data-id='+Scribd.Smartling.currentLanguage.id+'] a').invoke('addClassName','active');}.bind(this);if(Scribd.Smartling){set_lang();}else{document.observe('Scribd:language_detected',set_lang);}}});


/* app/views/solr/base.js @ 1305154354 */

Scribd.init('Scribd','Search');Scribd.Search.active=Scribd.Search.active||false;Scribd.Search.showDuplicates=Scribd.Search.showDuplicates||false;Scribd.Search.AsyncContent={initialize:function(){if(!Scribd.Search.active){return;}
$$('[data-content-uri]').each(function(el){var uri=el.readAttribute('data-content-uri'),spinner=el.down('.content_pending'),placeholder=el.down('.segment_content');new Ajax.Request(uri,{method:'get',onSuccess:function(trans){var content=trans.responseJSON.content;if(content===null){el.slideUp({duration:0.4});}else{placeholder.update(content);}},onFailure:function(){el.slideUp({duration:0.4});},onComplete: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.readAttribute('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',function(e){e.stop();if(note.hasClassName('open')){note.removeClassName('open');}else{note.addClassName('open');}
Effect.toggle(drawer,'slide',{duration:0.4});});drawer.update(pair.value.content);});}});}};document.observe('dom:loaded',Scribd.Search.Duplicates.initialize.bind(Scribd.Search.Duplicates));


/* app/views/premium/purchases/facebook_reauth.js @ 1305154353 */

Scribd.init('Scribd','Premium','Purchases');Scribd.Premium.Purchases.FacebookReauth=Class.create(Scribd.Shared.JavascriptWidget,{initialize:function($super,options){$super(options);this.next_url=options.next_url;this.use_redirect=options.use_redirect;},onDomLoaded:function($super,event){$super(event);var widget=this;var login_function=function(){var link=widget.widget_dom.down('.fb_login');link.observe('click',function(event){FB.login(function(response){if(response.session){if(widget.use_redirect){window.location=widget.next_url;}else{Scribd.Lightbox.secureIframeOpen('premium_credit_card_flow',widget.next_url,{},{style:'tight'});}}});});};Scribd.Facebook.ensureInit(function(){if(FB.getSession()){FB.logout(login_function);}else{login_function();}});}});


/* app/views/shared/buttons/add_to_collections.js @ 1305154354 */

Scribd.init('Scribd','CollectionsButton');Scribd.CollectionsButton.Handler={initialize:function(){this.click('.add_to_collections');},click:function(selector){document.observe('click',function(e){var el=e.findElement(selector);if(!el){return;}
e.stop();Scribd.DocumentCollectionsManager.addToCollectionsEventHandler(parseInt(el.readAttribute('data-document-id')),e);});}};document.observe('dom:loaded',Scribd.CollectionsButton.Handler.initialize.bind(Scribd.CollectionsButton.Handler));


/* app/views/premium/purchases/gate_components/payment_options_b.js @ 1305154353 */

Scribd.init('Scribd','Premium','Purchases','GateComponents');Scribd.Premium.Purchases.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_disabled;},onDomLoaded:function($super,event){$super(event);var payment_options=this;var widget_dom=this.widget_dom;widget_dom.down('#button_credit_card').observe('click',function(e){e.stop();if(!this.hasClassName('disabled'))payment_options.submitButtonPressed('credit_card');});widget_dom.down('#button_paypal').observe('click',function(e){e.stop();if(!this.hasClassName('disabled'))payment_options.submitButtonPressed('paypal');});if(this.credit_card_disabled)widget_dom.down('#button_text_credit_card').textContent='Not Available';if(this.paypal_disabled)widget_dom.down('#button_text_paypal').textContent='Not Available';},parentJavascriptWidget:function(){return $(this.parent_dom_id).javascript_widget;},planSelectedHandler:function(plan){var widget_dom=this.widget_dom;if(this.chargify_disabled&&!this.credit_card_disabled){if(plan.recurring){widget_dom.down('#button_credit_card').addClassName('disabled');}else{widget_dom.down('#button_credit_card').removeClassName('disabled');}}},submitButtonPressed:function(method){this.submitUIHandler();this.parentJavascriptWidget().submitHandler(method,this.reverseSubmitUIHandler.bind(this));},submitUIHandler:function(){var buttons=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.show();buttons.hide();buttons_text.hide();},reverseSubmitUIHandler:function(){var buttons=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.hide();buttons.show();buttons_text.show();this.parentJavascriptWidget().planSelected();}});


/* app/views/login/_fb_reauthorize.js @ 1305154353 */

Scribd.init('Scribd','Login','FbReauthorize');Scribd.Login.FbReauthorize=Class.create(Scribd.Shared.JavascriptWidget,{initialize:function($super,options){$super(options);this.next_url=options.next_url;},onDomLoaded:function($super,event){$super(event);var widget=this;var login_function=function(){var link=widget.widget_dom.down('.fb_login');link.observe('click',function(event){FB.login(function(response){if(response.session){new Ajax.Request(widget.next_url);}});});};if(FB.getSession()){FB.logout(login_function);}else{login_function();}}});


/* app/views/upload/_feed_upload_button_widget.js @ 1305154354 */

if(!Scribd)Scribd=new Object();if(!Scribd.Upload)Scribd.Upload=new Object();Scribd.Upload.FeedUploadButtonWidget=Class.create(Scribd.Upload.UploadButtonWidget,{initialize:function($super,options){$super(options);},newUploadManager:function(options){var FeedUploadManager=Class.create(Scribd.scalable_upload_manager,{initialize:function($super,parameters){$super(parameters);},showMetadataForm:function($super){$super();},startConversionChecker:function($super){$super();this.element.down('.su_document_thumbnail_background').setStyle({'background':'#fff url('+Scribd.cdn_path+'images/spinner_large_mac_white.gif) no-repeat 44px 60px'});},showPublishAnimation:function($super){this.element.down('.file_name').show();this.element.down('.su_upload_status_text').hide();$super();}});return new FeedUploadManager(options);}});


/* app/views/premium_research/accounts/_promo.js @ 1305154353 */

Scribd.init('Scribd','PremiumResearch','Accounts');Scribd.PremiumResearch.Accounts.Promo={init:function(options){this.options=options;this.options.container=$(this.options.container);this.options.container.down('.no_thanks').observe('click',function(e){e.stop();new Ajax.Request(this.options.opt_out_url,{});Scribd.Alerts.success(this.options.container.down('.inner_content'),"Okay, you won't see this anymore.");this.options.container.down('.inner_content').removeClassName('inner_content');}.bind(this));}}


/* app/views/upload/_gdocs_upload_widget.js @ 1305154354 */

if(!Scribd)Scribd=new Object();if(!Scribd.Upload)Scribd.Upload=new Object();Scribd.Upload.GdocsUploadWidget=Class.create(Scribd.Upload.BaseUploadWidget,{initialize:function($super,options){$super(options);this.upload_template_dom_id=options.upload_template_dom_id;this.googleDocsUrl=options.google_docs_url;this.importBaseUrl=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,extension,url,privateFlag,message){var isPrivate=privateFlag.checked;Scribd.Alerts.progress(message,"Beginning import...");new Ajax.Request(isPrivate?(url+'&private=true'):url,{onSuccess:function(response){try{message.remove();if(!window.uploadManagers)window.uploadManagers=[];var addHtml=function(dom_element){uploadWidgetContainer.insert({top:dom_element});};var uploadManager=new Scribd.scalable_upload_manager({filename_base:title,filename_extension:extension,isPrivate:isPrivate,file_template_element_id:this.upload_template_dom_id,addHTML:addHtml,cancelListener:function(){}});window.uploadManagers.push(uploadManager);uploadManager.onFileAlreadyUploaded({file_upload_id:'upload_'+window.uploadManagers.length},{id:response.responseJSON.document.id,access_key:response.responseJSON.document.access_key,secret_password:response.responseJSON.document.secret_password});}catch(e){alert("AJAX error: "+e.description);}}.bind(this),onFailure:function(response){try{if(response.responseJSON.retry){Scribd.Alerts.error(message,"Error: "+response.responseJSON.error+" I will retry again in a moment...");this.importGoogleDocument.bind(this).delay(5,uploadWidgetContainer,title,extension,url,privateFlag,message);}
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.responseJSON.account.email+' ');$('gdocs_account_info').insert(new Element('a',{href:this.googleLoginUrl}).update("not you?"));var table=new Element('table',{cellspacing:0,cellpadding:0});$H(response.responseJSON.other_documents).each(function(pair){var document=pair[1];document.googleId=pair[0];var topRow=new Element('tr').addClassName("file_row");var leftTd=new Element('td').addClassName("import_file_name");var rightTd=new Element('td').addClassName("import_button");var bottomRow=new Element('tr',{colspan:2});bottomRow.hide();var bottomTd=new Element('td');leftTd.insert(new Element('a',{href:document.url}).update(document.title));var uploadStatus=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');importImage.observe('mousedown',function(e){importImage.src='/images/upload/import-down.gif'});importImage.observe('mouseup',function(e){importImage.src='/images/upload/import-up.gif'});var importLink=new Element('a',{href:"#"});importLink.insert(importImage);var uploadUrl=this.importBaseUrl+$H({google_id:document.googleId,title:document.title,url:document.download_url}).toQueryString();importLink.observe('click',function(e){bottomRow.show();this.importGoogleDocument(uploadStatus,document.title,this.extensionForGoogleId(document.googleId),uploadUrl,privateFlag,uploadMessage);e.stop();}.bind(this));rightTd.insert(importLink);bottomTd.insert(uploadStatus);bottomTd.insert(uploadMessage);topRow.insert(leftTd);topRow.insert(rightTd);bottomRow.insert(bottomTd);table.insert(topRow);table.insert(bottomRow)}.bind(this));otherDocs.update();otherDocs.removeClassName('loading');otherDocs.insert(table);}catch(e){alert("AJAX error: "+e.description);}}.bind(this),onFailure:function(response){try{if(response.responseJSON.retry){Scribd.Alerts.error($('other_docs_loading'),"Error: "+response.responseJSON.error+" I will try again in a moment...");this.registerGoogleDocLoader.bind(this).delay(5,url);}else{Scribd.Alerts.error($('other_docs_loading'),"Error: "+response.responseJSON.error);}}catch(e){alert("AJAX error: "+e.description);}}.bind(this)});},registerLoadingDisplay:function(){Scribd.Alerts.progress($('other_docs_loading'),"Asking Google 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 @ 1305154354 */

if(!Scribd)Scribd=new Object();if(!Scribd.Upload)Scribd.Upload=new Object();Scribd.Shared.TimedPopupButtonWidget=Class.create(Scribd.Shared.JavascriptWidget,{initialize:function($super,options){$super(options);this.button_class=options.button_class;this.fade_in_duration=options.fade_in_duration;this.fade_out_delay=options.fade_out_delay;this.fade_out_duration=options.fade_out_duration;this.popup_class=options.popup_class;this.popup_offset_x=options.popup_offset_x;this.popup_offset_y=options.popup_offset_y;this.widget_dom_id=options.widget_dom_id;},onWidgetsLoaded:function(event){var widget=this;widget.buttons().each(function(button){button.observe('mouseover',widget.showPopup.bind(widget));button.observe('mouseout',widget.hidePopup.bind(widget));});},showPopup:function(event){var widget=this;widget.popups().each(function(popup){if(!popup.visible()){var x=event.pointerX()+widget.popup_offset_x;var y=event.pointerY()+widget.popup_offset_y;popup.setStyle('left: '+x+'px; top: '+y+'px');popup.appear({duration:widget.fade_in_duration});}
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_out.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_class);},select:function(css_class){var widget_dom=$(this.widget_dom_id);return widget_dom.select('.'+css_class);}});


/* app/views/shared/utilities/color_picker.js @ 1305154354 */

Scribd.init('Scribd','Utilities','ColorPicker');Scribd.Utilities.ColorPicker.instantiateColorSwatch=function(swatch,field,customOnChangedCallback){if(!Scribd.Utilities.ColorPicker.instance||!Scribd.Utilities.ColorPicker.instance.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){if(customOnChangedCallback){customOnChangedCallback();}else{var background_color=$(field).getValue();$(swatch).setStyle({backgroundColor:background_color});}}};Scribd.Utilities.ColorPicker.instance=new ProColor(options);}else{Scribd.Utilities.ColorPicker.instance.close();}};


/* app/views/premium/purchases/gate_components/payment_options_d.js @ 1305154353 */

Scribd.init('Scribd','Premium','Purchases','GateComponents');Scribd.Premium.Purchases.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_disabled;},onDomLoaded:function($super,event){$super(event);var payment_options=this;var widget_dom=this.widget_dom;if(!this.credit_card_disabled)widget_dom.down('#button_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(this.chargify_disabled&&!this.credit_card_disabled){if(plan.recurring){widget_dom.down('#button_credit_card').addClassName('disabled');}else{widget_dom.down('#button_credit_card').removeClassName('disabled');}}},submitButtonPressed:function(method){this.submitUIHandler(method);this.parentJavascriptWidget().submitHandler(method,this.reverseSubmitUIHandler.bind(this,method));},submitUIHandler:function(method){var buttons=$$('.payment_button a');var spinner=$('button_'+method).down('.loading');buttons.invoke('addClassName','disabled');spinner.show();},reverseSubmitUIHandler:function(method){var buttons=$$('.payment_button a');var spinner=$('button_'+method).down('.loading');spinner.hide();buttons.invoke('removeClassName','disabled');this.parentJavascriptWidget().planSelected();}});


/* app/views/accounts/accounts_base.js @ 1305154351 */

if(!window.Scribd)var Scribd=new Object();if(!window.Scribd.Accounts)Scribd.Accounts=new Object();if(!window.Scribd.Accounts.Tabs)Scribd.Accounts.Tabs=new Object();Scribd.Accounts.Tabs.Base=Class.create({alert_handler:function(container,req){$(container).show();['notice','error','red_notice','blue_notice'].each(function(flash_type){var flash_message=req.responseJSON.flash[flash_type];if(flash_message){switch(flash_type){case'notice':Scribd.Alerts.success(container,flash_message);break;case'error':Scribd.Alerts.error(container,flash_message);break;case'red_notice':Scribd.Alerts.success_red(container,flash_message);break;case'blue_notice':Scribd.Alerts.success_blue(container,flash_message);break;}}});},add_form_ajax:function(form_id){var klass=this;var form=$(form_id);var cancel_changes=$(form_id+'_cancel_changes');var saving=$(form_id+'_saving_changes');var default_error_alert='Sorry, but Scribd was unable to save that change.  Try refreshing the page.'
Event.observe(form,'submit',Scribd.Remote.Form.bindAsEventListener(form,{onLoading: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.alert_handler(form_id+'_alerts',req);}}));}});Scribd.chooseColorSwatch=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){Scribd.setProfilePreview();}};Scribd.colorpicker=new ProColor(options);}else{Scribd.colorpicker.close();}};Scribd.setProfilePreview=function(){var preview=$('profile_header');var bg_color=$F('bg_color_field');var txt_color=$F('txt_color_field');var color=Scribd.calculateSecondaryColor(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;preview.setStyle({backgroundColor:bg_color});var links=preview.select('.links a');links.invoke('setStyle',{color:txt_color});links.find(function(a){return a.match('#profile_header .current a')}).setStyle({'color':color});};Scribd.calculateSecondaryColor=function(color){var hsb=Scribd.colorpicker.RGBtoHSB(Scribd.colorpicker.decodeHexColor(color));var new_color={hue:hsb.hue,sat:hsb.sat,brt:(hsb.brt>20)?hsb.brt-20:0};var rgb=Scribd.colorpicker.HSBtoRGB(new_color);var hex_color='#'+(rgb.r.toColorPart()+rgb.g.toColorPart()+rgb.b.toColorPart()).toUpperCase();return hex_color;}


/* app/views/accounts/_tab_general.js @ 1305154351 */

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_services.each(function(service){self.unlink_social_account(service);});ajax_forms.each(function(form){self.add_form_ajax(form);});self.toggle_password();});},toggle_password:function(){$('change_password_link').observe('click',function(event){$('change_password').hide();$('password_form').show();});$('password_form_cancel_changes').observe('click',function(event){$('password_form').hide();$('change_password').show();$$('#password_form .text_field').invoke('clear');});},unlink_social_account:function(service){var service_unlink=$(service+'_unlink');var klass=this;Event.observe(service_unlink,'click',Scribd.Remote.Link.bindAsEventListener(service_unlink,{url:service_unlink.href,method:'delete',onLoading:function(req){$(service+'_service_actions').hide();$(service+'_action_unlinking').show();},onComplete:function(req){$(service+'_action_unlinking').hide();$(service+'_linked').hide();$(service+'_unlinked').show();klass.alert_handler(service+'_unlink_alerts',req);}}));}});


/* app/views/shared/sharing/dialog.js @ 1305154354 */

if(!window.Scribd)var Scribd=new Object();if(!Scribd.Readcast)Scribd.Readcast={};Scribd.Readcast.Dialog={Animations:{standard:{show_popup:function(){if(this.showing)return;this.showing=true;this.element.show();Scribd.Readcast.trackEvent("dialog","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.trackEvent("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","close");this.element.blindUp({duration:0.2});}},fourgen:{shown:false,show_popup:function(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(){var that=this;if(Scribd.Readcast.Dialog.animation==='fourgen'){this.show_popup=Scribd.Readcast.Dialog.Animations.fourgen.show_popup;this.hide_popup=Scribd.Readcast.Dialog.Animations.fourgen.hide_popup;}else{this.show_popup=Scribd.Readcast.Dialog.Animations.standard.show_popup;this.hide_popup=Scribd.Readcast.Dialog.Animations.standard.hide_popup;}
document.observe(Scribd.Readcast.Event.AutoShare.EVENTS.ready,function(e){if(Scribd.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.loadTwitterName();this.element=$('readcast_popup_outer');this.element.down('.close_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));}},loadTwitterName:function(){var placeholders=$$('.twitter_placeholder');if(placeholders.length<1)return;new Ajax.Request("/twitter_link/info.js",{method:'get',evalJSON:'force',onSuccess:function(trans){try{var name=trans.responseJSON.info.screen_name;if(name===undefined)return;placeholders.each(function(element){element.update("@"+name);});}catch(e){}}});}};Scribd.Readcast.active=function(){if($$('.readcast_popup').size()>0)return true;return false;};Scribd.Readcast.blank_active=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_popup.disabled_reading').size()>0)return true;return false;};Scribd.Readcast.no_initial_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.EVENTS.transition,initDialog);})();


/* app/views/shared/sharing/preferences.js @ 1305154354 */

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),4000);},hide:function(){this.element.fade(2000);},success:function(msg){this.set('success',msg);},warn:function(msg){this.set('warn',msg);},error:function(msg){this.set('error',msg);}};Scribd.Readcast.Preferences={initialize:function(){var that=this;$$('.advanced_preferences').each(function(a){a.observe('click',that.openAdvanced);});that.checkUnlinked();},checkUnlinked:function(){$$('.pref_container').each(function(el){var not_linked=el.down('.not_linked');if(not_linked&&not_linked.style.display!=='none'){el.select('input[type=radio]').each(Form.Element.disable)}else{el.select('input[type=radio]').each(Form.Element.enable)}});},openAdvanced:function(e){e.stop();Scribd.Readcast.trackEvent("preferences","open advanced");window.open("/account/edit#sharing");}};Scribd.Readcast.Permissions={Facebook:{ensurePublish:function(callback){var that=this;FB.api({method:'users.hasAppPermission',ext_perm:'publish_stream'},function(response){if(!(response==1)){that.askForPublish(callback);}else{callback.call(this);}});},askForPublish:function(callback){var permissions='email,publish_stream';Scribd.Readcast.trackEvent("permissions","facebook stream publish prompt");FB.login(function(response){if(response.session&&Scribd.Facebook.Permissions.hasAllPermissions(response.perms,permissions)){callback.call(this);}else{Scribd.Readcast.Status.error('Readcast not sent');}},{perms:permissions});}}};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(function(pair){$('options_event_settings_reading_'+pair.key+'_'+pair.value).checked=true;});$('header_button_on').observe('click',Scribd.Readcast.Form.toggleControls('on'));$('header_button_ask').observe('click',Scribd.Readcast.Form.toggleControls('ask'));},turnOn:function(networks){$H(networks).each(function(pair){$('options_event_settings_reading_'+pair.key+'_on').checked=pair.value;$('options_event_settings_reading_'+pair.key+'_ask').checked=!pair.value;});},toggleControls:function(state){return function(e){e.preventDefault();Scribd.Readcast.trackEvent("preferences","header click "+state);$$('div.sharing_option input.'+state).each(function(el){el.checked=true;});};},optionName:function(network){return"options[event_settings][reading]["+network+"]";},updatePrefs:function(){var that=this;Scribd.Readcast.sharingPrefs=$H(Scribd.Readcast.sharingPrefs).keys().inject({},function(m,network){m[network]=$$('input:checked[type="radio"][name="'+that.optionName(network)+'"]').pluck('value');return m;});},submit:function(e){e.stop();Scribd.Readcast.trackEvent("preferences","save");Scribd.Readcast.Form.doSubmit(true);},doSubmit:function(slideUp,status){new Ajax.Request(Scribd.Readcast.Form.form.action,{method:'put',parameters:Form.serialize(Scribd.Readcast.Form.form),onSuccess:function(response){Scribd.Readcast.Form.updatePrefs();if(status){Scribd.Readcast.Status.success(status);}else{Scribd.Readcast.Form.cancelChanges.update('Preferences 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('Cancel');}});}},onFailure:function(response){Scribd.Readcast.Status.error('Unable to save');Scribd.Readcast.Form.cancelChanges.update('Unable to save');}});}};(function(){function initPreferences(){if(!Scribd.Readcast.active())return;Scribd.Readcast.Preferences.initialize();}
document.observe('dom:loaded',initPreferences);document.observe(Scribd.Facebook.EVENTS.transition,initPreferences);})();


/* app/views/word/embed.js @ 1305154354 */

if(!window.Scribd)var Scribd=new Object();Scribd.embedCodePreviewManager=Class.create({initialize:function(options){this.options=Object.extend({num_pages:null,doc_url:'',title:'',doc_id:0,access_key:'',secret_password:null,prevew_fnction:function(){},aspect_ratio:null,disable_flash:false},options||{});this.form=$('embed-customize')
this.preview_url="/word/embed/"+this.options.doc_id;this.auto_value='(auto)';this.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.height_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({doc_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.HTML5EmbedCodeGenerator({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.updatePrevious();this.width_input.disable();this.updateEmbedCode(true);new PeriodicalExecuter(this.updateEmbedCode.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:function(){if(this.options.disable_flash===false){this.preview_flash.observe('click',function(e){if(this.options.disable_flash===false){this.embed_preview.update(this.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();}}.bindAsEventListener(this));this.height_input.observe('click',function(e){var el=e.element();if($F(el)==this.auto_value){this.height_input.select();}}.bindAsEventListener(this));this.auto_width_input.observe('click',function(e){if(e.element().checked){this.width_input.disable();this.width_input.value=this.auto_value;}else{this.uncheck_auto_width();}}.bindAsEventListener(this));this.page_input.observe('blur',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.options.num_pages)){this.page_input.value=this.options.num_pages;}}.bindAsEventListener(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=this.generator.defaultWidth;}else if(parseInt($F(el))>this.generator.maxWidth){el.value=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(parseInt($F(el))<this.generator.minHeight){el.value=this.generator.minHeight;}}.bindAsEventListener(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.auto_value;this.height_input.disable();}else{if(this.height_input.value==this.auto_value){this.height_input.value=this.generator.defaultHeight;this.height_input.enable();}}
this.updateEmbedCode();}.bindAsEventListener(this));this.form.select('.embed_form input').invoke('observe','keypress',this.restrictToNumbers.bindAsEventListener(this));this.form.select('.embed_form input').invoke('observe','change',this.updateEmbedCode.bindAsEventListener(this));},uncheck_auto_width:function(){this.width_input.enable();this.width_input.value=this.generator.defaultWidth;this.auto_width_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.height_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.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_title=this.title_toggle.checked;this.previous_auto_width=this.auto_width_input.checked;},valuesChanged:function(){return(this.previous_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_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.keyCode;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/upload/redesign_phase3.js @ 1305154354 */

if(!Scribd)Scribd=new Object();if(!Scribd.Upload)Scribd.Upload=new Object();Scribd.Upload.RedesignPhase3=Class.create(Scribd.Shared.JavascriptWidget,{initialize:function($super,options){$super(options);this.email_capture_url=options.email_capture_url;this.force_email_capture=options.force_email_capture;this.force_login=options.force_login;this.login_fallback_url=options.login_fallback_url;this.login_source=options.login_source;this.user_logged_in_url=options.user_logged_in_url;},onWidgetsLoaded:function($super,event){$super(event);this.selectRadioFromHash(this.widget_dom);if(this.force_login){this.registerLoginLightbox(this,this.widget_dom);}else{this.registerUploadTypeSelector(this,this.widget_dom);this.registerEmailCapture(this,this.widget_dom);}},registerLoginLightbox:function(widget,widget_dom){widget_dom.observe('click',this.makeUserLogIn.bind(this));},makeUserLogIn: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_ajax,{parameters:{element_id:'login_lb',source_page:this.login_source}});event.stop();},registerUploadTypeSelector:function(widget,widget_dom){var initialized=false;widget_dom.select('.selector').each(function(div){if(div.down('input.radio_selector').getValue()){widget.setSelected(div);initialized=true;}
div.observe('click',function(event){widget.setSelected(div);});});if(!initialized){var selector=$$('.selector').first();widget.setSelected(selector);}},setSelected:function(div){this.widget_dom.select('.selector').each(function(d){d.removeClassName('selected');});div.addClassName('selected');var radioBtn=div.down('.radio_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_dom){if(widget.force_email_capture){document.observe('Scribd:upload_widget:allFilesSuccessful',function(e){(function(){window.location=widget.email_capture_url}).delay(3);});document.observe('Scribd:upload_widget:uploadStart',function(e){widget_dom.select('.wait_while_uploading').invoke('show');});}},selectRadioFromHash:function(widget_dom){if(!window.location.hash)return;widget_dom.select(".selector").each(function(selector){var radioBtn=selector.down(".radio_selector");if(('#'+radioBtn.readAttribute('label'))==window.location.hash)this.setSelected(selector);}.bind(this));}});


/* app/views/timeline_events/shared/_reply.js @ 1305154354 */

Scribd.init('Scribd','Timeline');Scribd.Timeline.Comments={initialize:function(){this.setupDefaultText('.event .comment_input');this.setupEmphasis('.event .comments');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('mousemove',function(e){var el=e.findElement(selector);if(!el){return;}
el.addClassName('emph');});document.observe('mouseleave',function(e){var el=e.findElement(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));},submitComment:function(el){var form=el.down('.add_form form'),ipt=form.down('input.comment_input'),user_thumb=form.down('.feed_large_thumbnail'),spinner=form.down('.comment_spinner'),old_reply_link=el.down('.reply_link_wrapper'),add_container=el.down('.add_form'),comment_container=el.down('.comment.expanded'),text=$F(ipt);if(text===this.defaultReplyText||text===''){return;}
new Ajax.Request(form.action,{method:'post',parameters:Scribd.CSRF.paramsWithToken(Form.serialize(form,true)),onSuccess:function(trans){var insertion=add_container.up('.event').down('.comments .add_form');var status_container=add_container.up('.event').down('.status');var event_container=add_container.up('.timeline_event_content_container');add_container.hide();insertion.insert({before:trans.responseText});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_container.removeClassName('expanded');comment_container.removeClassName('add_control');}
if(event_container){if(event_container.hasClassName('without_comments')){event_container.removeClassName('without_comments');event_container.addClassName('with_comments');add_container.remove();}}},onCreate:function(){user_thumb.hide();spinner.show();},onComplete:function(){ipt.value='';ipt.focus();ipt.blur();spinner.hide();user_thumb.show();}});}};document.observe('dom:loaded',Scribd.Timeline.Comments.initialize.bind(Scribd.Timeline.Comments));Scribd.Timeline.Reply={initialize:function(){this.setupBinding('.reply_link');},setupBinding:function(selector){document.observe('click',function(e){var el=e.findElement(selector);if(!el){return;}
e.stop();if(!Scribd.requireLogin()){return;}
var container=el.up('.comment'),controls=container.up('.autogen_class_views_timeline_events_shared_reply').next('.add_form');if(container.hasClassName('expanded')){controls.blindUp({duration:0.1,afterFinish:function(){container.removeClassName('expanded');controls.removeClassName('expanded');}});return;}
container.addClassName('expanded');controls.addClassName('expanded');controls.blindDown({duration:0.2});});}};document.observe('dom:loaded',Scribd.Timeline.Reply.initialize.bind(Scribd.Timeline.Reply));


/* app/views/people/readforacause.js @ 1305154353 */

document.observe('dom:loaded',function(){var r4c_control=$('r4c_control'),r4c_details=$('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 @ 1305154354 */

if(!window.Scribd)var Scribd=new Object();Scribd.enableDocumentCollectionForm=function(){var M=Scribd.DocumentCollectionsManager;Scribd.ajaxDocumentCollectionForm({form:'new_document_collection',reveal:true,params:function(){var params={format:'json',document_id:$('lightbox_document_collections').down('.document_collections_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.renderingCollectionAttributes(doc_id,json.document_collection))).down('li.document_collection');M.storeCollections(doc_id,[json.document_collection]);M.attachEvent(doc_id,new_collection);$$('.manage_collection .add_to_my_collections').each(function(container){container.insert({'top':new_collection});});}});M.addPaginationEvent();};Scribd.ajaxDocumentCollectionForm=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 success_message=options.success_message;var method=options.method||'post';var clickable_header=$(options.clickable_header)||form_container.down('.form_header');var name_input=form.down('#document_collection_name');/*<sl:translate>*/
var new_name_message="Enter a name for your new collection...";/*</sl:translate>*/
function reset(){form.reset();if(form_container&&options.reveal){name_input.setValue(new_name_message);}
form_container&&form_container.removeClassName('document_collection_form_container_open');error_container&&error_container.update('');}
if($('dynamic_privacy_explanation')){explanationTextContainer=$('dynamic_privacy_explanation');explanationSelector=$('document_collection_combined_privacy_type');explanationTextContainer.innerHTML=getExplanation(explanationSelector);explanationSelector.observe('change',function(e){e.stop();explanationTextContainer.innerHTML=getExplanation(this);});}
function getExplanation(explanationSelector){/*<sl:translate>*/
switch(explanationSelector.value){case"public - locked":return"(Only you can add to this collection, but others can view it)";case"public - moderated":return"(Others can add to this collection, but you approve or reject additions)";case"private":return"(Only you can add to this collection, and only you will be able to view it)";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.getValue()===new_name_message){name_input.setValue('');}
form.request({'method':method,parameters:(params),onCreate:function(){form.disable();spinner&&spinner.show();},onComplete:function(){form.enable();spinner&&spinner.hide();},onSuccess:function(response){var json=response.responseJSON;switch(json.status){case'ok':success_message&&success_message.show();options.success&&options.success(json,params)
options.reset?options.reset(form):reset();return;case'error':options.error&&options.error(json,params);error_container&&Scribd.Alerts.error(error_container,json.message)}}});});var cancel=form.down('a.cancel');if(cancel){cancel.observe('click',function(e){e.stop();options.reset?options.reset(form):reset();})}
if(form_container&&options.reveal){name_input.setValue(new_name_message);name_input.observe('focus',function(e){form_container.addClassName('document_collection_form_container_open');if(name_input.getValue()===new_name_message){name_input.setValue('');}});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('document_collection_form_container_open');});}};


/* app/views/shared/analytics/_tracker.js @ 1305154354 */

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 @ 1305154352 */

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.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.autodown_query.set('autodown','pdf');if($('high_quality_print')){$('high_quality_print').down('button').observe('click',function(e){if(this.options.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({context:'download',document_id:this.options.document_id,extension:'pdf',next_url:'/doc/'+this.options.document_id+'#open_download'});}else{Scribd.login.open({context:'download',document_id:this.options.document_id,extension:'pdf',next_url:this.autodownUrl()});}}}.bind(this));}},downloadUrl:function(){return this.options.base_url+'?'+this.download_query.toQueryString();},autodownUrl:function(){return this.options.autodown_base_url+'?'+this.autodown_query.toQueryString();}});


/* app/views/word/document/_action_badge.js @ 1305154354 */

if(!window.Scribd)var Scribd={};Scribd.ActionBadgeManager=Class.create({initialize:function(container,options){this.options=Object.extend({current_message:'',messages:[],message_text_hidden_field:null,preview_text_container:null},options||{});this.no_badge_radio=container.down('.should_show_badge_no');this.yes_badge_radio=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('.button_message_custom_radio');this.message_custom_input=this.action_badge_inputs.down('.button_message_custom_input');this.link_url_input=container.down('.link_url');if(this.options.current_message.blank()){this.no_badge_radio.checked=true;this.message_radios.first().checked=true;}else{this.yes_badge_radio.checked=true;if(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.message_custom_input.value=this.options.current_message;this.message_custom_radio.checked=true;}}
this.updatePreview();this.setupEvents();new PeriodicalExecuter(this.setMetadataHiddenTextField.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.observe('focus',function(e){this.message_custom_radio.checked=true;}.bind(this));this.action_badge_inputs.select('input').invoke('observe','click',function(e){this.yes_badge_radio.checked=true;}.bind(this));this.action_badge_inputs.select('input').invoke('observe','change',function(e){this.updatePreview();this.setMetadataHiddenTextField();}.bind(this));this.message_custom_input.observe('keypress',function(e){this.updatePreview();this.setMetadataHiddenTextField();}.bind(this));this.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(this.no_badge_radio.checked){this.options.message_text_hidden_field.value='';}else{this.options.message_text_hidden_field.value=this.getMessageSetting();}},updatePreview:function(){this.options.preview_text_container.down('h4').update(this.getMessageSetting());},getMessageSetting:function(){var value='';if(this.message_custom_radio.checked){value=this.message_custom_input.value;}else{this.message_radios.each(function(radio){if(radio.checked)
value=radio.value;}.bind(this));}
return value;}});


/* app/views/facebook/_login_button.rb:14 @ 1305154352 */

if(!window.Scribd)var Scribd=new Object();if(!window.Scribd.Facebook)Scribd.Facebook=new Object();Scribd.Facebook.LoginButton=Class.create(Scribd.Shared.JavascriptWidget,{initialize:function($super,options){$super(options);},onWidgetsLoaded:function($super,event){$super(event);var buttonClickedFunction=this.buttonClicked.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_process=true;this.showSpinnerIfStillProcessing.bind(this).delay(0);FB.login(this.fbLoginReturned.bind(this),{perms:'email,publish_stream'});},fbLoginReturned:function(response){if(response.session){var session_elements_div=this.posted_form.down(".facebook_session_elements");if(session_elements_div){var cookies=document.cookie;var regexp=new RegExp("(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_cookie_name' value='"+fbs_cookie_name+"' />");}else{session_elements_div.insert("<input type='hidden' name='fbs_cookie' value='none' />");}
for(var name in response.session){var value=response.session[name];session_elements_div.insert("<input type='hidden' name='facebook_session["+name+"]' value='"+value+"' />");}}
this.userIsLoggedInToFacebook(response);}else{this.userCancelledFacebookLogin(response);}},userIsLoggedInToFacebook:function(response){if(this.options.trackEvent){eval(this.options.trackEvent);}else if(this.options.google_analytics_event){trackEvent("Facebook",this.options.google_analytics_event);}
this.posted_form.submit();},userCancelledFacebookLogin:function(response){this.in_process=false;this.invokeOnInProcess(function(e){e.hide();});},showSpinnerIfStillProcessing:function(){if(this.in_process){this.invokeOnInProcess(function(e){e.show();});}},invokeOnInProcess:function(f){this.widget_dom.select(".in_process").each(f);}});


/* app/views/user_document_collections/manage.js @ 1305154354 */

Scribd.init('Scribd','UserDocumentCollections','Manage');Scribd.UserDocumentCollections.Manage=Class.create({initialize:function(options){this.widget_dom_id=options.widget_dom_id;this.widget_dom=$(this.widget_dom_id);this.collectings_container_id=options.collectings_container_id;this.collectings_container=$(this.collectings_container_id);this.on_reorder_url=options.on_reorder_url;this.authenticity_token=options.authenticity_token;this.last_modified_collecting=null;this.last_top_collecting=this.topCollecting();document.observe('dom:loaded',function(){this.initializeSortable();this.initializeCollectingsContainerEvents();this.initializeCollectionImages();}.bind(this));},initializeSortable:function(){Sortable.create(this.collectings_container_id,{elements:this.collectingContainers(),handles:this.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.updateZebraStripes();this.last_modified_collecting.down('.move_link').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)})});},initializeCollectingsContainerEvents: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));},initializeCollectionImages:function(){this.collection_image=this.widget_dom.down('.document_collection_summary .shelf_document .thumbnail img');if(this.collection_image){this.initializeCollectionImageSpinner();this.collection_image_spinner=this.widget_dom.down('.document_collection_summary .shelf_document .thumbnail img.collection_image_spinner');}},initializeCollectionImageSpinner: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});},highlightLastModifiedCollecting:function(){this.last_modified_collecting.highlight({startcolor:'#eaffd5',duration:1.2,afterFinish:function(effect){effect.element.setStyle({backgroundColor:''});}});},updateLastModifiedCollecting:function(collecting_container){this.last_modified_collecting=collecting_container;},updateLastTopCollecting:function(){this.last_top_collecting=this.topCollecting();},lastModifiedCollectingIsTop:function(){return(this.last_modified_collecting==this.topCollecting());},lastModifiedCollectingWasTop:function(){return(this.last_modified_collecting==this.last_top_collecting);},topCollecting:function(){return this.collectings_container.down('.document_collecting_container');},collectingContainers:function(){return $$('#'+this.collectings_container_id+' div.document_collecting_container');},collectingMoveHandles:function(){return $$('#'+this.collectings_container_id+' div.document_collecting_container div.collecting_move a.move_link');},sendToTop:function(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.postSentToTopSortableSerialize(sent),onLoading:function(){this.updatingCollectionImage();}.bind(this),onComplete:function(){sent.remove();var collectings=this.collectings_container;collectings.insert({top:sent});spinner.hide();link.show();this.updateTopCollecting();this.updateZebraStripes();}.bind(this)});},postSentToTopSortableSerialize:function(sent){var current_ordering=Sortable.serialize(this.collectings_container_id);var sent_collecting_id=sent.id.gsub(/\D/,'');var sent_regexp=new RegExp(this.collectings_container_id+"\\[\\]="+sent_collecting_id+'&?');var ordering_minus_sent=current_ordering.sub(sent_regexp,'');var post_sent_ordering=this.collectings_container_id+'[]='+sent_collecting_id+'&'+ordering_minus_sent;return post_sent_ordering;},onReorder:function(options){var collectings_order=options.collectings_order||Sortable.serialize(this.collectings_container_id);var onLoadingCallback=function(){this.disableUI();if(this.lastModifiedCollectingIsTop()||this.lastModifiedCollectingWasTop())this.updatingCollectionImage();if(options.onLoading)options.onLoading();}
var onCompleteCallback=function(response){if(options.onComplete)options.onComplete();if(response.responseJSON&&response.responseJSON.collection_image_url){this.updateCollectionImage(response.responseJSON.collection_image_url);}
this.updateLastTopCollecting();this.highlightLastModifiedCollecting();this.enableUI();}
this.updateServerOrder(collectings_order,onLoadingCallback,onCompleteCallback);},updateServerOrder:function(collectings_order,onLoadingCallback,onCompleteCallback){new Ajax.Request(this.on_reorder_url,{asynchronous:true,evalScripts:true,method:'put',parameters:collectings_order+'&authenticity_token='+encodeURIComponent(this.authenticity_token),onLoading:onLoadingCallback.bind(this),onComplete:onCompleteCallback.bind(this)});},updateTopCollecting:function(){var old_top=this.collectings_container.down('.top_document_collecting_container');var new_top=this.collectings_container.down('.document_collecting_container');old_top.removeClassName('top_document_collecting_container');new_top.addClassName('top_document_collecting_container');},updatingCollectionImage:function(){if(this.collection_image){this.collection_image.hide();this.collection_image_spinner.show();}},updateCollectionImage:function(new_url){if(this.collection_image){this.collection_image.src=new_url
this.collection_image_spinner.hide();this.collection_image.show();}},updateZebraStripes:function(){var containers=this.collectingContainers();var partitioned=containers.partition(function(container,index){return index%2==1});var light=partitioned[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 cover=new Element('div',{'class':'disabled_cover'});cover.clonePosition(this.collectings_container,{setLeft:false,setTop:false});this.collectings_container.insert(cover);},enableUI:function(){this.collectings_container.down('.disabled_cover').remove();}});


/* app/views/themes/edit.js @ 1305154354 */

Scribd.init('Scribd','Themes','Edit');Scribd.Themes.Edit=Class.create({initialize:function(options){this.widget_dom_id=options.widget_dom_id;this.images_updated=options.images_updated;this.images_loaded={};this.theme_image_status_url=options.theme_image_status_url;this.background_image_preview_container=options.background_image_preview_container;this.background_image_url=options.background_image_url;this.banner_preview_container=options.banner_preview_container;this.banner_url=options.banner_url;document.observe('dom:loaded',function(){this.setupRemoveMouseovers();this.loadReadyImages();if(this.images_updated)this.onImagesUpdated(0);}.bind(this));},setupRemoveMouseovers:function(){$$('#'+this.widget_dom_id+' .row_container').each(function(container){var remove_container=container.down('.remove_attribute_container');if(remove_container){container.observe('mouseover',function(e){e.stop();remove_container.show();});container.observe('mouseout',function(e){e.stop();remove_container.hide();});}});},loadReadyImages: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);},onImagesUpdated:function(attempt){new Ajax.Request(this.theme_image_status_url,{method:'get',onSuccess:function(response){var image_status=response.responseJSON;this.loadImagesOnImageStatus(image_status);if(!image_status.all_ready&&attempt<10)this.onImagesUpdated.bind(this,attempt+1).delay(attempt);}.bind(this)});},loadImagesOnImageStatus:function(image_status){if(image_status.background&&image_status.background.ready)this.loadBackgroundImage(image_status.background.edit_preview.url);if(image_status.banner&&image_status.banner.ready)this.loadBannerImage(image_status.banner.edit_preview.url);},loadBackgroundImage:function(background_image_url){if(background_image_url&&!this.images_loaded.background){this.background_image_preview_container.down('.preview_loaded .theme_body_container').setStyle({backgroundImage:"url('"+background_image_url+"')"});this.images_loaded.background=true;var loading_container=this.background_image_preview_container.down('.preview_loading');var loaded_container=this.background_image_preview_container.down('.preview_loaded');if(loading_container.visible()){loading_container.fade();loaded_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').update(banner_image);this.images_loaded.banner=true;var loading_container=this.banner_preview_container.down('.preview_loading');var loaded_container=this.banner_preview_container.down('.preview_loaded');if(loading_container.visible()){loading_container.fade();loaded_container.appear();}}}});


/* app/views/embeds/content.js @ 1305154352 */

Scribd.init('Scribd','Embeds','Content');Scribd.Embeds.Content=Class.create({iframe:null,docManager:null,defaultWidth:null,view_modes:['scroll','slideshow'],collapsed:false,initialize:function(options){window.onIframeLoad=this.onIframeLoad.bind(this);this.options=options;document.observe('dom:loaded',function(e){if(this.options.branded_logo)
$('document_content').setStyle({top:'35px'});this.sizeToolbar();}.bind(this));Event.observe(document.onresize?document:window,"resize",function(e){this.sizeToolbar();this.sizeDocument();}.bind(this));},onIframeLoad:function(){var self=this;this.iframe=window.frames['document_iframe'];window.docManager=this.iframe.docManager;this.docManager=this.iframe.docManager;if(this.options.from_jsapi){this._socket=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.docManager._currentViewManager.zoom(message[1]);}}}});}
if($$("[data-action=share]").length){this.shareWidget=new Scribd.Embeds.Share(this.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.docManager.currentPageNum());if(self._socket){self._socket.postMessage("page:"+self.docManager.currentPageNum());}
self.setArrowStates();});this.docManager.addEvent('zoomed',function(){if(self._socket){self._socket.postMessage("zoom:"+self.docManager._currentViewManager._currentZoomMultiplier);}});$('current_page').setValue(this.docManager.currentPageNum());$('current_page').observe('change',this.events.pageNumberChange.bind(this));$$('.pages form').invoke('observe','submit',this.events.pageNumberChange.bind(this));$$('select[name=view_mode]').invoke('observe','change',function(e){trackEvent('html5_embed','toolbar_click','view_mode');self.setViewMode(e.element().value);});$$('[data-action=download]').invoke('observe','click',function(e){trackEvent('html5_embed','toolbar_click','download');});[$$("[data-action=down]"),self.iframe.$$('#right_hotspot')].each(function(selector){selector.invoke('observe','click',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','toolbar_click','zoom_out');e.stop();self.docManager.zoom(0.8);return false;});$$("[data-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','toolbar_click','fullscreen');});$$('[data-action=exit_fullscreen]').invoke('observe','click',function(e){trackEvent('html5_embed','toolbar_click','exit_fullscreen');history.go(-1);});[$(document.body),this.iframe.document.body].invoke('observe',"keydown",function(e){if(self.docManager.viewMode()=='slideshow'){if(e.keyCode==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_page);}
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.docManager.gotoPage(page_num);return false;}},setArrowStates:function(){if(this.docManager.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=down]').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_mode=='slideshow'){this.iframe.$('left_hotspot').show();this.iframe.$('right_hotspot').show();}else{this.iframe.$('left_hotspot').hide();this.iframe.$('right_hotspot').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_button').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_collapse){$$('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_fullscreen').invoke('hide');}},sizeDocument:function(){var marginWidthCompensate=(Prototype.Browser.IE7||Prototype.Browser.IE6)?56:52;var marginHeightCompensate=(Prototype.Browser.IE)?55:45;if(this.options.view_mode=='slideshow'){var target_width;var current_page=this.docManager.pages[this.docManager.currentPageNum()];var ratio=current_page.origHeight/current_page.origWidth;var page_width=$(document.body).getWidth();var page_height=$('document_content').getHeight();var expected_height=ratio*page_width;if(expected_height>page_height){target_width=(1/ratio)*(page_height-marginHeightCompensate);}else{target_width=page_width-marginWidthCompensate;}
this.defaultWidth=target_width;}else{this.defaultWidth=$(document.body).getWidth()-marginWidthCompensate;}
this.docManager.setDefaultWidth(this.defaultWidth);}});


/* app/views/people/_user_controls.js @ 1305154353 */

function setupReportControls(controls){var report_section=controls.down('.report_section'),report_link=report_section.down('.flag_user_link'),report_confirm=report_section.down('.report_confirm'),report_submit=report_confirm.down('button'),cancel_link=report_confirm.down('.cancel_link');report_link.observe('click',function(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,{method:'post',onSuccess:function(){report_section.update('<span class="confirmed">Thank you.</span>');}});});cancel_link.observe('click',function(e){e.stop();report_confirm.slideUp({duration:0.3});});}
function setupBlockControls(controls){var block_section=controls.down('.block_section');var block_link=block_section.down('.block_user_link');var unblock_link=block_section.down('.unblock_user_link');var block_confirm=block_section.down('.block_confirm');if(typeof(block_confirm)!='undefined'){var cancel_link=block_confirm.down('.cancel_link');}
if(unblock_link){unblock_link.observe('click',function(e){e.stop();new Ajax.Request(unblock_link.href,{method:'delete',onSuccess:function(){unblock_link.up('.controls').update('<span class="confirmed">This user is no longer blocked.</span>');}});});return;}
var block_submit=block_confirm.down('button');block_link.observe('click',function(e){e.stop();Effect.toggle(block_confirm,'slide',{duration:0.3});});block_submit.observe('click',function(e){e.stop();new Ajax.Request(block_link.href,{method:'post',onSuccess:function(){block_section.update('<span class="confirmed">This user 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(controls){setupReportControls(controls);setupBlockControls(controls);});});


/* app/views/upload/_timeline_upload_button_widget.js @ 1305154354 */

if(!Scribd)Scribd=new Object();if(!Scribd.Upload)Scribd.Upload=new Object();Scribd.Upload.TimelineUploadButtonWidget=Class.create(Scribd.Upload.UploadButtonWidget,{initialize:function($super,options){$super(options);},newUploadManager:function(options){var TimelineUploadManager=Class.create(Scribd.scalable_upload_manager,{initialize:function($super,parameters){$super(parameters);},showMetadataForm:function($super){$super();},startConversionChecker:function($super){$super();this.element.down('.su_document_thumbnail_background').setStyle({'background':'#fff 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 TimelineUploadManager(options);}});


/* app/views/user_document_collections/widget.js @ 1305154354 */

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.colorpicker=new ProColor(options);}else{Scribd.colorpicker.close();Scribd.colorpicker=null;}};


/* app/views/partners/apply.js @ 1305154353 */

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 @ 1305154354 */

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.Animations.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.animation==='fourgen'){Scribd.Readcast.Dialog.Animations.fourgen.hide_popup.call(this,e);}else{Scribd.Readcast.Dialog.Animations.blank.hide_popup.call(this,e);}},show_login_lb:function(e){e.stop();Scribd.Readcast.trackEvent("readcast this login");Scribd.login.open({context:'readcast'});}};Scribd.Readcast.trackEvent=function(action,label){window.trackEvent("Readcast",action,label);};document.observe(Scribd.Readcast.Event.BlankReadcast.EVENTS.ready,function(e){Scribd.Readcast.BlankDialog.show_popup();});(function(){function initDialog(){if(!Scribd.Readcast.blank_active())return;Scribd.Readcast.BlankDialog.initialize();}
document.observe('dom:loaded',initDialog);document.observe(Scribd.Facebook.EVENTS.auto_logged_out,initDialog);})();


/* app/views/paid/_header.js @ 1305154353 */

Scribd.init('Scribd','Paid');Scribd.Paid.Header=Class.create(Scribd.Shared.JavascriptWidget,{initialize:function($super,options){$super(options);this.back_to_lightbox=options.back_to_lightbox;this.button_class=options.button_class;},onDomLoaded:function($super,event){$super(event);if(this.widget_dom.down('.'+this.button_class)){this.widget_dom.down('.'+this.button_class).observe('click',function(e){switch(this.button_class){case'back_button':if(parent.transport){parent.transport.postMessage('open '+this.back_to_lightbox);}else{Scribd.Lightbox.open(this.back_to_lightbox,75);}
break;case'close_button':case'subtle_close_button':if(parent.transport){parent.transport.postMessage('close');}else{Scribd.Lightbox.close();}
break;default:}}.bind(this));}}});


/* app/views/shared/carousel_base.js @ 1305154354 */

if(!window.Scribd)var Scribd=new Object();Scribd.SharedCarouselManager=Class.create({initialize:function(options){this.options=Object.extend({},options||{});this.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');this.right_arrow=this.container.down('.right_arrow');this.carousel=new Scribd.carousel(this.options.carousel_dom_id,$(this.options.carousel_dom_id).select('li'),this.options.container.select('.arrows a'),{circular:false,duration:0,wheel:false});Scribd.carouselLazyLoad(this.carousel);this.setupEvents();},setupEvents:function(){this.left_arrow.addClassName('left_arrow_disabled');this.container.down('.left_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(this.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=Scribd.SharedCarouselManager;


/* app/views/upload/_text_upload_widget.js @ 1305154354 */

if(!Scribd)Scribd=new Object();if(!Scribd.Upload)Scribd.Upload=new Object();Scribd.Upload.TextUploadWidget=Class.create(Scribd.Upload.BaseUploadWidget,{initialize:function($super,options){$super(options);this.default_document_body_text=options.default_document_body_text;this.upload_template_dom_id=options.upload_template_dom_id;this.event_element=document;},onWidgetsLoaded:function($super,event){$super(event);var widget=this;var widget_dom=this.widget_dom;this.registerTextUploadForm(widget,widget_dom);this.registerTextUploadTextArea(widget,widget_dom);},registerTextUploadForm:function(widget,widget_dom){var upload_text_form=widget_dom.down('.upload_text_form');upload_text_form.observe('submit',function(event){event.stop();if(widget.isValidDocumentBody()&&widget.enforceCopyrightWarning()){var error_message_div=widget_dom.down('.text_error_message');upload_text_form.request({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_spinner').invoke('hide')},onSuccess:function(request){widget.newNonSwfUploadDocumentUploaded(request,error_message_div)},onFailure:function(request){widget.newNonSwfUploadDocumentFailedUpload(request,error_message_div)}});}});},registerTextUploadTextArea:function(widget,widget_dom){var textarea=widget_dom.down('.document_body');textarea.observe('focus',function(event){if(textarea.value.strip()==widget.default_document_body_text){textarea.value='';}});textarea.observe('blur',function(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 string!=''&&string!=this.options.default_document_body_text;},newNonSwfUploadDocumentUploaded:function(ajax_request,error_message_div){var widget=this;var data;try{data=ajax_request.responseText.evalJSON();}catch(e){}
if(data&&data.document_id){var add_html=function(dom_element){var text_status_display=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.filename_base,filename_extension:data.filename_extension,isPrivate:data.is_private,file_template_element_id:this.upload_template_dom_id,addHTML:add_html,cancelListener:function(){;}});window.uploadManagers.push(upload_manager);upload_manager.onFileAlreadyUploaded({file_upload_id:'upload_'+window.uploadManagers.length},{id:data.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_message_div.update('Failed upload: No document was created.');error_message_div.show();}},newNonSwfUploadDocumentFailedUpload:function(ajax_request,error_message_div){error_message_div.update('Failed upload.');error_message_div.show();}});


/* app/views/premium/purchases/trialgate.js @ 1305154353 */

Scribd.init('Scribd','Premium','Purchases');Scribd.Premium.Purchases.Trialgate=Class.create(Scribd.Shared.JavascriptWidget,{initialize:function($super,options){$super(options);this.credit_card_url=options.credit_card_url;this.document_id=options.document_id;this.download_plan=options.download_plan;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;widget_dom.down('#button_credit_card').observe('click',function(e){e.stop();gate.submitHandler('credit_card');});widget_dom.down('#button_paypal').observe('click',function(e){e.stop();gate.submitHandler('paypal');});widget_dom.down('.close_button').observe('click',function(){Scribd.Lightbox.close();});},submitHandler:function(method){var buttons=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.show();buttons.hide();buttons_text.hide();var hide_function=function(){spinner.hide();buttons.show();buttons_text.show();};hide_function.delay(5);var plan=this.download_plan;switch(method){case'credit_card':var url=this.credit_card_url.updateQueryParams({abstract_buyable_id:plan.abstract_buyable_id,doc:this.document_id});if(this.xhr){Scribd.Lightbox.secureIframeOpen('premium_credit_card_flow',url.updateQueryParams({layout:'dynamic_iframe'}),{},{style:'tight'});}else{window.location=url;}
break;case'paypal':$('paypal_form_container_'+plan.id).down('form').submit();break;}}});


/* app/views/account/pictures/pictures_base.js @ 1305154351 */

if(!window.Scribd)var Scribd=new Object();if(!window.Scribd.Account)Scribd.Account=new Object();if(!window.Scribd.Account.Pictures)Scribd.Account.Pictures=new Object();Scribd.Account.Pictures.Base=Class.create({editPicture:function(event,element){event.stop();this.editPictureUpdater(element.href);},editPictureUpdater:function(url){var content=$('edit_picture_lightbox').down('.content');content.update("<img alt='Spinner_mac_white' src='/images/spinner_mac_white.gif' style='top:auto' /> Loading...");Scribd.Lightbox.open('edit_picture_lightbox');new Ajax.Updater(content,url,{asynchronous:true,evalScripts:true,method:'get',onComplete:function(){var pictures_base=new Scribd.Account.Pictures.Base;$('delete_this_picture').observe('click',pictures_base.deletePicture);document.getElementById('current_photo').onload=function(){var cropper=new Scribd.Account.Pictures.PhotoCropper('current_photo','/account/picture');cropper.loadImageCropper('current_photo');}}});},applyPicture:function(e){e.stop();var url=this.href;$('current_profile_image_container').update("<div class='profile_image dashboard_image'><img alt='Spinner_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 occurred! Please try again later.');},onComplete:function(){$('upload_picture').fire('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.Updater('upload_picture',url,{asynchronous:true,evalScripts:true,method:'delete'});}}});Scribd.Account.Pictures.PhotoCropper=Class.create({initialize:function(img,url){this.img=$(img);this.url=url;this.coords=null;this.dimensions=null;this.cropper=null;this.cropped=false;this.original_width=null;this.event_delegate=this.eventDelegate.bind(this);$('upload_picture').observe('click',this.event_delegate);$('upload_picture').down('button').observe('click',function(e){e.stop();this.saveCroppedImage(e.findElement('button'));}.bind(this));},saveCropCoords:function(coords,dimensions){this.coords=coords;this.dimensions=dimensions;},eventDelegate:function(e){var target=e.element();switch(target.id){case'edit_picture_form_cancel_changes':case'close_edit_picture_lightbox':e.stop();this.cancelCrop(target);break;default:}},loadImageCropper:function(target){this.img=$(this.img.id);this.original_width=$('current_photo').getStyle('width');this.cropper=new Cropper.Img(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)});},saveCroppedImage:function(target){if(this.coords&&this.dimensions){Form.Element.disable(target);target.addClassName('disabled');$('edit_picture_form_cancel_changes').hide();$('edit_picture_form_saving_changes').show();var id=this.img.readAttribute('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}).toQueryString(),{method:'put',evalScripts:true,onSuccess:this.cropWin.bind(this),onFailure:this.cropFail.bind(this)});}},cropWin:function(req){this.cropped=true;this.cancelCrop(null);},cropFail:function(req){this.cancelCrop(null);},cancelCrop:function(target){if(this.cropper){this.cropper.remove();this.cropper=null;$('upload_picture').stopObserving('click',this.event_delegate);}
Scribd.Lightbox.close('edit_picture_lightbox');}});


/* app/views/shared/sharing/readcast_confirmations.js @ 1305154354 */

if(!window.Scribd)var Scribd=new Object();Scribd.ReadCaster=Class.create({initialize:function(options){this.event_type=options.event_type;this.submit_button=options.submit_button;this.confirmations=options.confirm_checkboxes;this.permissions=options.permissions;this.doc=options.doc;this.doc_collection=options.doc_collection;this.linked_sites=options.linked_sites;this.submit_button.observe('click',this.handleReadcastEvents.bind(this));this.after=options.after;this.stop_event=options.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=this;this.linked_sites.each(function(linked_site){if(Scribd.ReadCaster.shouldSubmitForSite(linked_site,that.permissions,that.confirmations)){var klass=that.eventClass(linked_site);var klass_params={event_type:that.event_type,service_type:linked_site};var extraInfo="";if(that.doc){extraInfo=" on doc";klass_params=Object.extend(klass_params,{doc:that.doc});}else if(that.doc_collection){extraInfo=" on doc 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.Event.FacebookAutoShare;}else{return Scribd.Readcast.Event.AutoShare;}}});Scribd.ReadCaster.shouldSubmitForSite=function(linked_site,permissions,confirmations){if(permissions[linked_site]==='on'){return true;}
if(confirmations){return confirmations.detect(function(confirmation){var site=confirmation.className;return(site===linked_site&&confirmation.getValue()==='1');});}};Scribd.ScribbleReadCaster=Class.create(Scribd.ReadCaster,{initialize:function($super,options){$super(options);this.scribble_text_field=options.scribble_text_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.submitReadcastEvents({scribble_text:this.scribble_text_field.value});}},eventClass:function(site){if(site==='facebook'){return Scribd.Readcast.Event.FacebookScribbleAutoShare;}else{return Scribd.Readcast.Event.AutoShare;}}});Scribd.EventBasedReadCaster=Class.create({initialize:function(options){this.event_type=options.event_type;this.permissions=options.permissions;this.linked_sites=options.linked_sites;var that=this;document.observe(options.observes||'Scribd:EventBasedReadCaster:ready',function(e){var confirmations=e.memo.confirmations;var doc=e.memo.doc;that.linked_sites.each(function(linked_site){if(Scribd.ReadCaster.shouldSubmitForSite(linked_site,that.permissions,confirmations)){var extraInfo="";if(doc){extraInfo=" on doc";}
Scribd.Readcast.trackEvent(that.event_type+" submit"+extraInfo,linked_site);var klass=Scribd.EventBasedReadCaster.eventClass(linked_site);var new_event=new klass({'doc':doc,event_type:that.event_type,service_type:linked_site});new_event.submit();}});});}});Scribd.EventBasedReadCaster.eventClass=function(site){if(site==='facebook'){return Scribd.Readcast.Event.FacebookAutoShare;}else{return Scribd.Readcast.Event.AutoShare;}};Scribd.EventBasedReadCaster.fire=function(memo){document.fire('Scribd:EventBasedReadCaster:ready',memo);};Scribd.ReadCaster.observing_confirmations=false;Scribd.ReadCaster.observeConfirmations=function(){if(!Scribd.ReadCaster.observing_confirmations){Scribd.ReadCaster.observing_confirmations=true;document.observe('click',function(e){var element=e.findElement();var container=Scribd.ReadCaster.findReadcastConfirmation(element);if(!container){container=Scribd.ReadCaster.findReadcastConfirmation(element.up());}
if(container){var checkbox=container.down('input');if(container.hasClassName('disabled')){container.removeClassName('disabled');checkbox.checked=true;}else{container.addClassName('disabled');checkbox.checked=false;}}});}};Scribd.ReadCaster.isReadcastConfirmation=function(element){return element&&element.hasClassName&&element.hasClassName('readcast_confirmation');};Scribd.ReadCaster.findReadcastConfirmation=function(element){return Scribd.ReadCaster.isReadcastConfirmation(element)?element:null;};


/* app/views/shared/sharing/control.js @ 1305154354 */

if(!window.Scribd)var Scribd=new Object();if(!Scribd.Readcast)Scribd.Readcast={};Scribd.Readcast.Control={initialize:function(){var that=this;that.begun=that.checkBox($$('.network_input').first())?false:true;if(that.begun){var any_on=false;$$('.network_input').each(function(el){if(el.down('.check').style.display!=='none'){any_on=true;return;}
if(!el.down('.link_account')){that.toSend(el);}});if(any_on){$$('.readcast_complete').invoke('show');}else{$$('.send_to_readcast').invoke('show');}}},begin:function(button){this.begun=true;var that=this;button.hide();var checked=$$('.network_input input:checked');if(checked.length>0){var on_networks=[];checked.each(function(el){on_networks.push(that.extractNetwork(el.up('.pref_item')));});var networks=$H(Scribd.Readcast.sharingPrefs).keys().inject({},function(m,network){m[network]=on_networks.include(network);return m;});Scribd.Readcast.Form.toggleControls('ask');Scribd.Readcast.Form.doSubmit(false,"Readcasted & Saved");$$('.readcast_complete').invoke('show');}else{$$('.send_to_readcast').invoke('show');}
that.bindInputs();},bindInputs:function(){var that=this;$$('.network_input').each(function(el){if(el.down('input:checked')){var control=el.up('.pref_item');Scribd.Readcast.trackEvent("checkbox submit",that.extractNetwork(control));that.submitEvent(control);}else{var link=el.down('.link_account');if(!link||link.style.display==='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.sendButton(el).hide();var check=this.checkBox(el);if(check)check.hide();},toSend:function(el){this.sendButton(el).appear(this.appearOpts);this.checkSymbol(el).hide();var 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.stop();var control=el.up('.pref_item');Scribd.Readcast.trackEvent("send button submit",that.extractNetwork(control));that.submitEvent(control);});},submitEvent:function(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(function(){that.toDone(el);});}}},afterLink:function(el,cb){if(this.begun){this.toSend(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('input[type="checkbox"]');},showControls:function(){$$('.network_input').each(function(el){el.appear({duration:0.4,queue:{position:'end',scope:'readcastControls'}});});}};Scribd.Readcast.Control.setup=function(){Scribd.Readcast.Control.initialize();Scribd.Readcast.Form.initialize();$$('.readcast_now_button').each(function(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("preferences","edit click");new Effect.toggle('readcast_preferences','slide',{duration:0.3});});});$$('.first_time .readcast_now_button').each(function(button){button.observe('click',function(e){e.preventDefault();Scribd.Readcast.trackEvent("readcast 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.checkUnlinked);}});});$$('#readcast_popup .facebook_link_account').each(function(el){new Scribd.Facebook.Account(el,{onSuccess:function(){Scribd.Readcast.trackEvent("link account","facebook");el.hide();Scribd.Readcast.Control.afterLink(el.up('.network_input'),Scribd.Readcast.Preferences.checkUnlinked);}});});};document.observe('dom:loaded',function(){if(!Scribd.Readcast.active())return;Scribd.Readcast.Control.setup();});document.observe(Scribd.Facebook.EVENTS.transition,function(){if(!Scribd.Readcast.active())return;Scribd.Readcast.Control.setup();});


/* app/views/paypal_transactions/show.js @ 1305154353 */

if(!window.Scribd)var Scribd=new Object();if(!window.Scribd.PaypalTransactions)Scribd.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){$super(options);this.updateURL=options.update_url;this.transactionID=options.transaction_id;},onDomLoaded:function($super,event){$super(event);this.periodic=new PeriodicalExecuter(function(){this.periodicRefresh()}.bind(this),5);},periodicRefresh:function(){new Ajax.Request(this.updateURL,{method:'get',onSuccess:function(transport){var transaction=transport.responseJSON.transaction;var purchase_id=transport.responseJSON.purchase_id;switch(transaction.status){case'Completed':case'Fulfilled':if(purchase_id){Scribd.Alerts.success('problems',"Payment complete! Redirecting you now...");this.periodic.stop();window.location=transaction.next_url;}
break;case'Pending':if(purchase_id){Scribd.Alerts.success('problems',"Payment pending. Redirecting you now...");this.periodic.stop();window.location=transaction.next_url;}
break;case'Expired':this.handleError("Unable to complete payment -- the bank took to long and the authorization expired.",{userShouldRetry:true});break;case'Failed':this.handleError("Unable to complete payment -- something went wrong on PayPal's end.",{userShouldRetry:true});break;case'In-Progress':case null:break;default:this.handleError("Unable to complete payment ("+transaction.status+").");break;}}.bind(this),onFailure:function(transport){if(transport.status==404)this.handleError("Your PayPal transaction was unexpectedly deleted.",{hasBeenCharged:true});else this.handleError("Scribd is temporarily unavailable ("+transport.status+").",{stop:false});}.bind(this)});},handleError:function(string,options){options=Object.extend({userShouldRetry:false,hasBeenCharged:false,stop:true},options||{});if(options.hasBeenCharged)string+=" Your purchase did not complete -- you should 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 provide them the transaction ID #"+this.transactionID+".";else string+=" Trying again...";Scribd.Alerts.error('problems',string);if(options.stop)this.periodic.stop();}});


/* app/views/word/view/_toolbar_download.js @ 1305154354 */

if(!window.Scribd)var Scribd=new Object();Scribd.downloadLightboxManager=Class.create({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;this.download_query=$H({secret_password:this.options.secret_password});this.autodown_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(this));this.radios.select('input').invoke('observe','click',function(e){this.updateExtension(e.element().value);}.bind(this));var handler=this.options.show_premium?this.premiumDownloadHandler:this.downloadHandler;this.download_section.down('.download_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.current_extension,next_url:this.autodownUrl()});}},premiumDownloadHandler:function(){var path="/premium/purchases/gate".updateQueryParams({doc:this.options.document_id,extension:this.current_extension});if(this.options.logged_in){if(this.options.premium_lightbox){Scribd.Lightbox.remoteOpen('premium_download',path,{},{style:'tight'});}else{window.location=path;}}else{var callback_string=this.options.premium_lightbox?"Scribd.Lightbox.remoteOpen('premium_download', '"+path.updateQueryParams({format:'json'})+"', {}, { style: 'tight' });":"window.location = "+path;Scribd.login.open({context:'download',document_id:this.options.document_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.download_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.base_url+'?'+this.download_query.toQueryString();},autodownUrl:function(){return this.options.autodown_base_url+'?'+this.autodown_query.toQueryString();}});


/* app/views/shared/buy_this.js @ 1305154354 */

if(!window.Scribd){var Scribd={};}
if(!Scribd.BuyThis){Scribd.BuyThis=new Object();}
Scribd.BuyThis.close=function(buy_this){buy_this.hide();Scribd.BuyThis.visible=false;}
Scribd.BuyThis.load=function(){Scribd.log('loading buythis');Scribd.BuyThis.visible=true;if(!!(document.all&&(/msie 6./i).test(navigator.appVersion)&&window.ActiveXObject)){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('buy_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(!Scribd.BuyThis.visible){return;}
buy_this=buy_this.up();buy_this.setStyle({position:'absolute',top:$$('.outer_page:first').first().cumulativeOffset()[1]+'px',left:($$('.outer_page:first').first().cumulativeOffset()[0]+$$('.outer_page:first').first().up().offsetWidth-buy_this.offsetWidth)+"px"});buy_this.style.left=($$('.outer_page:first').first().cumulativeOffset()[0]+$$('.outer_page:first').first().up().offsetWidth-buy_this.offsetWidth-10)+"px";buy_this.style.top=($$('.outer_page:first').first().cumulativeOffset()[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 @ 1305154354 */

if(!window.Scribd)var Scribd=new Object();Scribd.switchFBUser=function(){FB.logout(function(){FB.login(function(resp){if(resp.session){new Ajax.Request('/facebook_session',{asynchronous:true,evalScripts:true,method:'post'});}});});};


/* app/views/premium/purchases/hybrid_gate.js @ 1305154353 */

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_upsell_url=options.credit_card_upsell_url;this.facebook_reauth_url=options.facebook_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_plans=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:uploadStart',function(e){widget_dom.down('.gate_upload_spinner_container').show();});Event.observe(document,'Scribd:upload_widget:uploadComplete',function(e){widget_dom.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.plansJavascriptWidget().selectDefaultPlan();},plansJavascriptWidget:function(){return this.widget_dom.down('#archive_gate_plans').javascript_widget;},paymentOptionsJavascriptWidget:function(){return this.widget_dom.down('#archive_gate_payment_options').javascript_widget;},planSelected:function(){var plan=this.plansJavascriptWidget().selectedPlan();this.paymentOptionsJavascriptWidget().planSelectedHandler(plan);},submitHandler:function(method,onCompleteCallback){var plan=this.plansJavascriptWidget().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.xhr){Scribd.Lightbox.secureIframeOpen('premium_credit_card_flow',url.updateQueryParams({layout:'dynamic_iframe'}),{},{style:'tight'});}else{window.location=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.updateQueryParams({abstract_buyable_id:plan.abstract_buyable_id,doc:this.document_id,layout:'dynamic_iframe'});}else{var credit_card_url=this.credit_card_url.updateQueryParams({abstract_buyable_id:plan.abstract_buyable_id,doc:this.document_id,layout:'dynamic_iframe'});}
new Ajax.Request(this.reauth_type_url,{onComplete:function(response){onCompleteCallback();},onSuccess:function(response){if(response.responseJSON.reauth_type=='facebook'){var reauth_url=this.facebook_reauth_url.updateQueryParams({next_url:credit_card_url});next(reauth_url);}else{secureNext(credit_card_url);}}.bind(this),onFailure:function(response){Scribd.Lightbox.open('premium_download');}});break;case'paypal':if(plan.has_ad_free_download_plan&&plan.do_upsell){var url=this.paypal_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 @ 1305154353 */

document.observe('dom:loaded',function(){$$('.info_section').each(function(section){var control=section.down('h3'),content=section.down('.section_content');control.observe('click',function(e){e.stop();if(section.hasClassName('closed')){content.blindDown({duration:0.3,afterFinish:function(){document.fire('scribd:dom_height_changed');document.fire('scribd:info_section:on');}});section.removeClassName('closed');}else{content.blindUp({duration:0.3,afterFinish:function(){document.fire('scribd:dom_height_changed');document.fire('scribd:info_section:off');}});section.addClassName('closed');}})});});


/* app/views/shared/analytics/_doc_view_pingback.js @ 1305154354 */

if(!window.Scribd){var Scribd={};}
Scribd.Pingback={run:function(url){var data={};if(document.referrer){data['referer']=document.referrer;}
new Ajax.Request(url,{method:'post',parameters:data});}};


/* app/views/upload/with_privacy_checkbox/_upload_button_widget.js @ 1305154354 */

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.privacy_field_dom_id=options.privacy_field_dom_id;},isPrivate:function(){return!!$F(this.privacy_field_dom_id);}});


/* app/views/everywhere/_upload_button_widget.js @ 1305154352 */

if(!Scribd)Scribd=new Object();if(!Scribd.Everywhere)Scribd.Everywhere=new Object();Scribd.Everywhere.UploadButtonWidget=Class.create(Scribd.Upload.UploadButtonWidget,{initialize:function($super,options){$super(options);this.document_collection_id=options.document_collection_id;this.post_params.document_collection_id=this.document_collection_id;}});


/* app/views/shared/sharing/readcast_pro.js @ 1305154354 */

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 Scribd.Twitter.Account(el,{onSuccess:function(){Scribd.Readcast.trackEvent("link account","twitter");el.hide();that.afterLink(el.up('.network_input_pro'),Scribd.Readcast.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);}});});},afterLink:function(el,cb){this.toCheckbox(el);if(typeof cb==='function')cb();},toCheckbox: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.submitEvent(el.up('.pref_item'));});$$('.readcast_complete_pro').invoke('show');}},submitEvent:function(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(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.checkSymbol(el).appear(this.appearOpts);var check=this.checkBox(el);if(check)check.hide();}};


/* app/views/premium/purchases/gate_components/plans_b.js @ 1305154353 */

Scribd.init('Scribd','Premium','Purchases','GateComponents');Scribd.Premium.Purchases.GateComponents.PlansB=Class.create(Scribd.Shared.JavascriptWidget,{initialize:function($super,options){$super(options);this.download_plans=options.download_plans;this.parent_dom_id=options.parent_dom_id;},onDomLoaded:function($super,event){$super(event);var gate=this;var widget_dom=this.widget_dom;this.payment_radios=widget_dom.down('#package_plans').select('input[type="radio"]');widget_dom.down('#one-day-target').observe('click',function(){gate.clickPrice('day');});widget_dom.down('#monthly-target').observe('click',function(){gate.clickPrice('month');});widget_dom.down('#annual-target').observe('click',function(){gate.clickPrice('year');});$('package_option_day').observe('click',function(){gate.clickPrice('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-picture').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_widget;},clickPrice:function(duration){var radio=this.widget_dom.down('#package_option_'+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('disabled');}else{billed_monthly.disable();container.addClassName('disabled');}}
this.parentJavascriptWidget().planSelected();},selectDefaultPlan:function(){return this.clickPrice('month');},selectedDuration:function(){return this.payment_radios.detect(function(radio){return radio.checked;}).value;},selectedPlan:function(){var duration=this.selectedDuration();var recurring=false;if(duration=='month'){var billed_monthly=$('billed_monthly');if(billed_monthly){recurring=billed_monthly.getValue()=='on';}}
var plan=this.download_plans.detect(function(plan){return(plan.duration==duration&&plan.recurring==recurring)});return plan;}});


/* app/views/documents/ads_below_sideboard.js @ 1305154352 */

document.observe('dom:loaded',function(){if($('hidden_sideboard_ad')){var isIe6=!!(document.all&&(/msie 6./i).test(navigator.appVersion)&&window.ActiveXObject);var header=$('global_header');var viewBar=$('view_bar');var sideboardAd=$('hidden_sideboard_ad');Event.observe(window,'scroll',function(e){var initialTop=viewBar.getHeight()+header.getHeight()+90;if(!sideboardAd.hasClassName('ie_fixed')&&!sideboardAd.hasClassName('fixed')){initialTop-=sideboardAd.getHeight();}
var scrollTop=document.viewport.getScrollOffsets().top;if(scrollTop>=initialTop){if(isIe6){sideboardAd.addClassName('ie_fixed');sideboardAd.setStyle({top:(scrollTop-50)+'px'});}else{sideboardAd.addClassName('fixed');}}else{if(isIe6){sideboardAd.removeClassName('ie_fixed');sideboardAd.setStyle({top:'0px'});}else{sideboardAd.removeClassName('fixed');}}});}});


/* app/views/shared/_captcha_widget.js @ 1305154354 */

if(!window.Scribd)var Scribd=new Object();if(!window.Scribd.Shared)Scribd.Shared=new Object();Scribd.Shared.CaptchaWidget=Class.create(Scribd.Shared.JavascriptWidget,{initialize:function($super,options){$super(options);this.recaptcha_public_key=options.recaptcha_public_key;this.recaptcha_options=options.recaptcha_options;this.skip_render=options.skip_render;this.is_rendered=false;},renderCaptcha:function(){if(!this.is_rendered){Recaptcha.create(this.recaptcha_public_key,this.widget_dom_id,this.recaptcha_options);this.is_rendered=true;}},onDomLoaded:function($super,event){$super(event);if(!this.skip_render){this.renderCaptcha();}}});


/* app/views/timeline_events/events.js @ 1305154354 */

Scribd.init('Scribd','Timeline');Scribd.Timeline.Paginator=Class.create({initialize:function(options){this.url=options.url;this.event_observer=$(options.event_observer||document);this.current_page=options.page||1;this.per_page=options.per_page;this.method=this.method||'GET';this.loading=false;this.user_id=options.user_id;this.event_id=options.event_id;this.timestamp=options.timestamp;},gotoNextPage:function(){this.gotoPage(this.current_page+1);},gotoPage:function(page){page=page||this.current_page;var that=this;var previous_page=that.current_page;this._fetchPage(page,function(){that.event_observer.fire('scribd:timeline:paginator:page_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_count):0;that.event_observer.fire('scribd:timeline:paginator:page_loaded',{current_page:that.current_page,previous_page:previous_page,page_content:json.page_content,items_count:items_count,more_pages:items_count>0});},function(){that.event_observer.fire('scribd:timeline:paginator:page_load_failed',{current_page:that.current_page,previous_page:previous_page});});},_fetchPage:function(page,startCallback,successCallback,failCallback){var that=this;if(!this.loading){new Ajax.Request(this.url,{parameters:this._requestParams(),method:this.method,onCreate:function(resp){that.loading=true;startCallback(resp);},onComplete:function(){that.loading=false;},onSuccess:successCallback,onFailure:failCallback,onException:function(request,exception){Scribd.logError('Ajax Exeception in Scribd.Timeline.Paginator#_fetchPage',exception);}});}},_requestParams:function(page){var params={'page':page,format:'json'};if(this.event_id)params.event_id=this.event_id;if(this.timestamp)params.timestamp=this.timestamp;if(this.user_id)params.user_id=this.user_id;if(this.per_page)params.per_page=this.per_page;return params;}});


/* app/views/shared/facebook/session.js @ 1305154354 */

if(!window.Scribd)var Scribd=new Object();Scribd.FacebookSession={verify:function(){if(this.mismatch()){this.update();}},mismatch:function(){if(!facebookUser||(typeof facebookSessionKey==='undefined'))return false;var cookieData=FB.Cookie.load();if(!cookieData)return false;return cookieData.session_key!==facebookSessionKey;},correct:function(){if(!facebookUser||(typeof facebookUserId==='undefined'))return false;var cookieData=FB.Cookie.load();if(!cookieData)return false;return cookieData.uid==facebookUserId;},update:function(){new Ajax.Request("/facebook_session.js",{method:'put'});},verifyExec:function(fn,force){if(!facebookUser)return;var that=this;if(!that.correct()){if(force){FB.getLoginStatus(function(response){if(response.session){FB.logout(function(response){FB.login(function(response){that.withValid(fn);});});}else{FB.login(function(response){that.withValid(fn);});}});}}else{fn();}},ensureValid:function(fn){this.verifyExec(fn,true);},withValid:function(fn){this.verifyExec(fn,false);}};document.observe(Scribd.Facebook.EVENTS.loaded,function(){Scribd.FacebookSession.verify();});


/* app/views/shared/share_bar/share_bar.js @ 1305154354 */

Scribd.init('Scribd','ShareBar');Scribd.ShareBar.Status={initialize:function(options){if(options===undefined||options===null){options.maxLength=400;}
this.options=options;this.container=$(options.container);this.charCount=this.container.down('.count .number');this.textarea=this.container.down('.input_wrap textarea');var ta=$$('.share_bar_container .input_wrap textarea').first();if(!ta){return;}
this.setupDefaultText.bind(this)(ta);this.setupBindings.bind(this)(ta);},setupDefaultText:function(el){Scribd.addDefaultTextEvents(el,this.defaultText,this.updateCharCount.bind(this));},/*<sl:translate>*/
defaultText:"Share what you're reading...",doneText:'Readcast Complete!',/*</sl:translate>*/
setupBindings:function(el){var wrap=el.up('.input_wrap');el.observe('focus',function(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;',duration: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,spinner=$('status_spinner'),ipt=$('status_text'),form=$('status_form'),wrap=ipt.up('.input_wrap'),text=$F(ipt).strip();if(text===that.defaultText||text===that.doneText||text===''){return;}
function readcastComplete(){ipt.addClassName('inactive');ipt.value=that.doneText;document.fire('Scribd:collapseShare');new Effect.Morph(wrap,{style:'background-color: #eaffd5;',duration:0.8});setTimeout(function(){new Effect.Morph(wrap,{style:'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.insert({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.Upload={initialize:function(){this.setupBindings();},setupBindings:function(){var button=$('share_bar_upload_button');if(!button){return;}
button.observe('mousemove',function(){button.addClassName('hover');});button.observe('mouseleave',function(){button.removeClassName('hover');});button.observe('mousedown',function(){button.removeClassName('hover');button.addClassName('active');});button.observe('mouseup',function(){button.removeClassName('active');});document.observe('mousemove',function(e){if(e.findElement('#share_bar_upload_button')){return;}
button.removeClassName('active');});}};


/* app/views/conversion_feedback/new.js @ 1305154352 */

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_conversion_feedback',0.3,function(form,value){$('conversion_feedback_description').disabled=$('conversion_feedback_inaccuracies_false').checked});Event.observe(document.forms['new_conversion_feedback'],'submit',function(event){event.stop();var 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 what the document should look like.");}else{var form=$('new_conversion_feedback').request({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 @ 1305154354 */

Scribd.init('Scribd','Shared','People');Scribd.Shared.People.SearchBox=Class.create(Scribd.Shared.JavascriptWidget,{/*<sl:translate>*/
defaultTexts:{profile:'Search this profile...',content:'Search my content...'},/*</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/credit_cards/new_iframe.js @ 1305154352 */

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_section').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 @ 1305154353 */

Scribd.init('Scribd','Premium','Purchases','GateComponents');Scribd.Premium.Purchases.GateComponents.PlansD=Class.create(Scribd.Shared.JavascriptWidget,{initialize:function($super,options){$super(options);this.download_plans=options.download_plans;this.default_duration=options.default_duration;this.parent_dom_id=options.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:function(){return $(this.parent_dom_id).javascript_widget;},selectPlan:function(duration){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);},selectedDuration:function(){return this.payment_radios.detect(function(radio){return radio.checked;}).value;},selectedPlan:function(){var duration=this.selectedDuration();var plan=this.download_plans.detect(function(plan){return(plan.duration==duration)});return plan;}});


/* app/views/shared/user_collections/form.js @ 1305154354 */

if(!window.Scribd)var Scribd=new Object();Scribd.enableUserCollectionForm=function(){var M=Scribd.UserCollectionsManager;Scribd.ajaxUserCollectionForm({form:'new_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.renderingCollectionAttributes(user_id,json.user_collection))).down('li.user_collection');M.storeCollections(user_id,[json.user_collection]);M.attachEvent(user_id,new_collection);$$('.manage_collection .add_to_my_collections').each(function(container){container.insert({'top':new_collection});});}});M.addPaginationEvent();};Scribd.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=options.method||'post';var clickable_header=$(options.clickable_header)||form_container.down('.form_header');var name_input=form.down('#user_collection_name');var new_name_message="Enter a name for your new group..."
function reset(){form.reset();if(form_container&&options.reveal){name_input.setValue(new_name_message);}
form_container&&form_container.removeClassName('user_collection_form_container_open')
error_container&&error_container.update('');}
if($('dynamic_privacy_explanation')){explanationTextContainer=$('dynamic_privacy_explanation');explanationSelector=$('user_collection_combined_privacy_type');explanationTextContainer.innerHTML=getExplanation(explanationSelector);explanationSelector.observe('change',function(e){e.stop();explanationTextContainer.innerHTML=getExplanation(this);});}
function getExplanation(explanationSelector){switch(explanationSelector.value){case"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 approve 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.getValue()===new_name_message){name_input.setValue('');}
form.request({'method':method,parameters:(params),onCreate:function(){form.disable();spinner&&spinner.show();},onComplete:function(){form.enable();spinner&&spinner.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&&options.error(json,params);error_container&&Scribd.Alerts.error(error_container,json.message)}}});});var cancel=form.down('a.cancel');if(cancel){cancel.observe('click',function(e){e.stop();options.reset?options.reset(form):reset();})}
if(form_container&&options.reveal){name_input.setValue(new_name_message);name_input.observe('focus',function(e){form_container.addClassName('user_collection_form_container_open');if(name_input.getValue()===new_name_message){name_input.setValue('');}});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');});}};


/* app/views/user_collections/manage.js @ 1305154354 */

Scribd.init('Scribd','UserCollections','Manage');Scribd.UserCollections.Manage=Class.create({initialize:function(options){this.widget_dom_id=options.widget_dom_id;this.widget_dom=$(this.widget_dom_id);this.collectings_container_id=options.collectings_container_id;this.collectings_container=$(this.collectings_container_id);this.on_reorder_url=options.on_reorder_url;this.authenticity_token=options.authenticity_token;this.last_modified_collecting=null;this.last_top_collecting=this.topCollecting();document.observe('dom:loaded',function(){this.initializeSortable();this.initializeCollectingsContainerEvents();}.bind(this));},initializeSortable:function(){Sortable.create(this.collectings_container_id,{elements:this.collectingContainers(),handles:this.collectingMoveHandles(),only:'collecting_container',tag:'div',handle:'move_link',onChange:this.updateLastModifiedCollecting.bind(this),onUpdate:this.onReorder.bind(this,{onLoading:function(){this.updateTopCollecting();this.updateZebraStripes();this.last_modified_collecting.down('.move_link').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)})});},initializeCollectingsContainerEvents: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));},highlightLastModifiedCollecting:function(){this.last_modified_collecting.highlight({startcolor:'#eaffd5',duration:1.2,afterFinish:function(effect){effect.element.setStyle({backgroundColor:''});}});},updateLastModifiedCollecting:function(collecting_container){this.last_modified_collecting=collecting_container;},updateLastTopCollecting:function(){this.last_top_collecting=this.topCollecting();},lastModifiedCollectingIsTop:function(){return(this.last_modified_collecting==this.topCollecting());},lastModifiedCollectingWasTop:function(){return(this.last_modified_collecting==this.last_top_collecting);},topCollecting:function(){return this.collectings_container.down('.collecting_container');},collectingContainers:function(){return $$('#'+this.collectings_container_id+' div.collecting_container');},collectingMoveHandles:function(){return $$('#'+this.collectings_container_id+' div.collecting_container div.collecting_move a.move_link');},sendToTop:function(sent_link){var sent=sent_link.up('.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.postSentToTopSortableSerialize(sent),onComplete:function(){sent.remove();var collectings=this.collectings_container;collectings.insert({top:sent});spinner.hide();link.show();this.updateTopCollecting();this.updateZebraStripes();}.bind(this)});},postSentToTopSortableSerialize:function(sent){var current_ordering=Sortable.serialize(this.collectings_container_id);var sent_collecting_id=sent.id.gsub(/\D/,'');var sent_regexp=new RegExp(this.collectings_container_id+"\\[\\]="+sent_collecting_id+'&?');var ordering_minus_sent=current_ordering.sub(sent_regexp,'');var post_sent_ordering=this.collectings_container_id+'[]='+sent_collecting_id+'&'+ordering_minus_sent;return post_sent_ordering;},onReorder:function(options){var collectings_order=options.collectings_order||Sortable.serialize(this.collectings_container_id);var onLoadingCallback=function(){this.disableUI();if(options.onLoading)options.onLoading();}
var onCompleteCallback=function(response){if(options.onComplete)options.onComplete();this.updateLastTopCollecting();this.highlightLastModifiedCollecting();this.enableUI();}
this.updateServerOrder(collectings_order,onLoadingCallback,onCompleteCallback);},updateServerOrder:function(collectings_order,onLoadingCallback,onCompleteCallback){new Ajax.Request(this.on_reorder_url,{asynchronous:true,evalScripts:true,method:'put',parameters:collectings_order+'&authenticity_token='+encodeURIComponent(this.authenticity_token),onLoading:onLoadingCallback.bind(this),onComplete:onCompleteCallback.bind(this)});},updateTopCollecting:function(){var old_top=this.collectings_container.down('.top_collecting_container');var new_top=this.collectings_container.down('.collecting_container');old_top.removeClassName('top_collecting_container');new_top.addClassName('top_collecting_container');},updateZebraStripes:function(){var containers=this.collectingContainers();var partitioned=containers.partition(function(container,index){return index%2==1});var light=partitioned[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 cover=new Element('div',{'class':'disabled_cover'});cover.clonePosition(this.collectings_container,{setLeft:false,setTop:false});this.collectings_container.insert(cover);},enableUI:function(){this.collectings_container.down('.disabled_cover').remove();}});
