/*
 * SimpleModal 1.3.3 - jQuery Plugin
 * http://www.ericmmartin.com/projects/simplemodal/
 * Copyright (c) 2009 Eric Martin (http://twitter.com/EricMMartin)
 * Dual licensed under the MIT and GPL licenses
 * Revision: $Id: jquery.simplemodal.js 228 2009-10-30 13:34:27Z emartin24 $
 */
;(function($){var ie6=$.browser.msie&&parseInt($.browser.version)==6&&typeof window['XMLHttpRequest']!="object",ieQuirks=null,w=[];$.modal=function(data,options){return $.modal.impl.init(data,options);};$.modal.close=function(){$.modal.impl.close();};$.fn.modal=function(options){return $.modal.impl.init(this,options);};$.modal.defaults={appendTo:'body',focus:true,opacity:50,overlayId:'simplemodal-overlay',overlayCss:{},containerId:'simplemodal-container',containerCss:{},dataId:'simplemodal-data',dataCss:{},minHeight:200,minWidth:300,maxHeight:null,maxWidth:null,autoResize:false,autoPosition:true,zIndex:1000,close:true,closeHTML:'<a class="modalCloseImg" title="Close"></a>',closeClass:'simplemodal-close',escClose:true,overlayClose:false,position:null,persist:false,onOpen:null,onShow:null,onClose:null};$.modal.impl={o:null,d:{},init:function(data,options){var s=this;if(s.d.data){return false;}ieQuirks=$.browser.msie&&!$.boxModel;s.o=$.extend({},$.modal.defaults,options);s.zIndex=s.o.zIndex;s.occb=false;if(typeof data=='object'){data=data instanceof jQuery?data:$(data);if(data.parent().parent().size()>0){s.d.parentNode=data.parent();if(!s.o.persist){s.d.orig=data.clone(true);}}}else if(typeof data=='string'||typeof data=='number'){data=$('<div></div>').html(data);}else{alert('SimpleModal Error: Unsupported data type: '+typeof data);return s;}s.create(data);data=null;s.open();if($.isFunction(s.o.onShow)){s.o.onShow.apply(s,[s.d]);}return s;},create:function(data){var s=this;w=s.getDimensions();if(ie6){s.d.iframe=$('<iframe src="javascript:false;"></iframe>').css($.extend(s.o.iframeCss,{display:'none',opacity:0,position:'fixed',height:w[0],width:w[1],zIndex:s.o.zIndex,top:0,left:0})).appendTo(s.o.appendTo);}s.d.overlay=$('<div></div>').attr('id',s.o.overlayId).addClass('simplemodal-overlay').css($.extend(s.o.overlayCss,{display:'none',opacity:s.o.opacity/100,height:w[0],width:w[1],position:'fixed',left:0,top:0,zIndex:s.o.zIndex+1})).appendTo(s.o.appendTo);s.d.container=$('<div></div>').attr('id',s.o.containerId).addClass('simplemodal-container').css($.extend(s.o.containerCss,{display:'none',position:'fixed',zIndex:s.o.zIndex+2})).append(s.o.close&&s.o.closeHTML?$(s.o.closeHTML).addClass(s.o.closeClass):'').appendTo(s.o.appendTo);s.d.wrap=$('<div></div>').attr('tabIndex',-1).addClass('simplemodal-wrap').css({height:'100%',outline:0,width:'100%'}).appendTo(s.d.container);s.d.data=data.attr('id',data.attr('id')||s.o.dataId).addClass('simplemodal-data').css($.extend(s.o.dataCss,{display:'none'})).appendTo('body');data=null;s.setContainerDimensions();s.d.data.appendTo(s.d.wrap);if(ie6||ieQuirks){s.fixIE();}},bindEvents:function(){var s=this;$('.'+s.o.closeClass).bind('click.simplemodal',function(e){e.preventDefault();s.close();});if(s.o.close&&s.o.overlayClose){s.d.overlay.bind('click.simplemodal',function(e){e.preventDefault();s.close();});}$(document).bind('keydown.simplemodal',function(e){if(s.o.focus&&e.keyCode==9){s.watchTab(e);}else if((s.o.close&&s.o.escClose)&&e.keyCode==27){e.preventDefault();s.close();}});$(window).bind('resize.simplemodal',function(){w=s.getDimensions();s.setContainerDimensions(true);if(ie6||ieQuirks){s.fixIE();}else{s.d.iframe&&s.d.iframe.css({height:w[0],width:w[1]});s.d.overlay.css({height:w[0],width:w[1]});}});},unbindEvents:function(){$('.'+this.o.closeClass).unbind('click.simplemodal');$(document).unbind('keydown.simplemodal');$(window).unbind('resize.simplemodal');this.d.overlay.unbind('click.simplemodal');},fixIE:function(){var s=this,p=s.o.position;$.each([s.d.iframe||null,s.d.overlay,s.d.container],function(i,el){if(el){var bch='document.body.clientHeight',bcw='document.body.clientWidth',bsh='document.body.scrollHeight',bsl='document.body.scrollLeft',bst='document.body.scrollTop',bsw='document.body.scrollWidth',ch='document.documentElement.clientHeight',cw='document.documentElement.clientWidth',sl='document.documentElement.scrollLeft',st='document.documentElement.scrollTop',s=el[0].style;s.position='absolute';if(i<2){s.removeExpression('height');s.removeExpression('width');s.setExpression('height',''+bsh+' > '+bch+' ? '+bsh+' : '+bch+' + "px"');s.setExpression('width',''+bsw+' > '+bcw+' ? '+bsw+' : '+bcw+' + "px"');}else{var te,le;if(p&&p.constructor==Array){var top=p[0]?typeof p[0]=='number'?p[0].toString():p[0].replace(/px/,''):el.css('top').replace(/px/,'');te=top.indexOf('%')==-1?top+' + (t = '+st+' ? '+st+' : '+bst+') + "px"':parseInt(top.replace(/%/,''))+' * (('+ch+' || '+bch+') / 100) + (t = '+st+' ? '+st+' : '+bst+') + "px"';if(p[1]){var left=typeof p[1]=='number'?p[1].toString():p[1].replace(/px/,'');le=left.indexOf('%')==-1?left+' + (t = '+sl+' ? '+sl+' : '+bsl+') + "px"':parseInt(left.replace(/%/,''))+' * (('+cw+' || '+bcw+') / 100) + (t = '+sl+' ? '+sl+' : '+bsl+') + "px"';}}else{te='('+ch+' || '+bch+') / 2 - (this.offsetHeight / 2) + (t = '+st+' ? '+st+' : '+bst+') + "px"';le='('+cw+' || '+bcw+') / 2 - (this.offsetWidth / 2) + (t = '+sl+' ? '+sl+' : '+bsl+') + "px"';}s.removeExpression('top');s.removeExpression('left');s.setExpression('top',te);s.setExpression('left',le);}}});},focus:function(pos){var s=this,p=pos||'first';var input=$(':input:enabled:visible:'+p,s.d.wrap);input.length>0?input.focus():s.d.wrap.focus();},getDimensions:function(){var el=$(window);var h=$.browser.opera&&$.browser.version>'9.5'&&$.fn.jquery<='1.2.6'?document.documentElement['clientHeight']:$.browser.opera&&$.browser.version<'9.5'&&$.fn.jquery>'1.2.6'?window.innerHeight:el.height();return[h,el.width()];},getVal:function(v){return v=='auto'?0:v.indexOf('%')>0?v:parseInt(v.replace(/px/,''));},setContainerDimensions:function(resize){var s=this;if(!resize||(resize&&s.o.autoResize)){var ch=s.getVal(s.d.container.css('height')),cw=s.getVal(s.d.container.css('width')),dh=s.d.data.outerHeight(true),dw=s.d.data.outerWidth(true);var mh=s.o.maxHeight&&s.o.maxHeight<w[0]?s.o.maxHeight:w[0],mw=s.o.maxWidth&&s.o.maxWidth<w[1]?s.o.maxWidth:w[1];if(!ch){if(!dh){ch=s.o.minHeight;}else{if(dh>mh){ch=mh;}else if(dh<s.o.minHeight){ch=s.o.minHeight;}else{ch=dh;}}}else{ch=ch>mh?mh:ch;}if(!cw){if(!dw){cw=s.o.minWidth;}else{if(dw>mw){cw=mw;}else if(dw<s.o.minWidth){cw=s.o.minWidth;}else{cw=dw;}}}else{cw=cw>mw?mw:cw;}s.d.container.css({height:ch,width:cw});if(dh>ch||dw>cw){s.d.wrap.css({overflow:'auto'});}}if(s.o.autoPosition){s.setPosition();}},setPosition:function(){var s=this,top,left,hc=(w[0]/2)-(s.d.container.outerHeight(true)/2),vc=(w[1]/2)-(s.d.container.outerWidth(true)/2);if(s.o.position&&Object.prototype.toString.call(s.o.position)==="[object Array]"){top=s.o.position[0]||hc;left=s.o.position[1]||vc;}else{top=hc;left=vc;}s.d.container.css({left:left,top:top});},watchTab:function(e){var s=this;if($(e.target).parents('.simplemodal-container').length>0){s.inputs=$(':input:enabled:visible:first, :input:enabled:visible:last',s.d.data[0]);if((!e.shiftKey&&e.target==s.inputs[s.inputs.length-1])||(e.shiftKey&&e.target==s.inputs[0])||s.inputs.length==0){e.preventDefault();var pos=e.shiftKey?'last':'first';setTimeout(function(){s.focus(pos);},10);}}else{e.preventDefault();setTimeout(function(){s.focus();},10);}},open:function(){var s=this;s.d.iframe&&s.d.iframe.show();if($.isFunction(s.o.onOpen)){s.o.onOpen.apply(s,[s.d]);}else{s.d.overlay.show();s.d.container.show();s.d.data.show();}s.focus();s.bindEvents();},close:function(){var s=this;if(!s.d.data){return false;}s.unbindEvents();if($.isFunction(s.o.onClose)&&!s.occb){s.occb=true;s.o.onClose.apply(s,[s.d]);}else{if(s.d.parentNode){if(s.o.persist){s.d.data.hide().appendTo(s.d.parentNode);}else{s.d.data.hide().remove();s.d.orig.appendTo(s.d.parentNode);}}else{s.d.data.hide().remove();}s.d.container.hide().remove();s.d.overlay.hide().remove();s.d.iframe&&s.d.iframe.hide().remove();s.d={};}}};})(jQuery);function randomnumber(num1,num2){num1 = parseInt(num1);num2=parseInt(num2);if(num1>=num2){num1=0;num2=10000001;}var generator=Math.random()*(num2-num1);generator=Math.round(num1+generator);return  generator;}
function writeImg(trurl, lid, t){var r=randomnumber(0, 99999999);document.write('<img src="'+trurl+'?id='+lid+'&s='+r+'&t='+t+'" width="1" height="1">');}
var otswstr='';
var afterLoginPage = '';
function showLoginForm() {
    $('#login_form').css('display','block');$('#div_ingresa').css('display','none');$('#subsc_form').css('display','none');
    return false;
}
function doCancelLogin(){
    $('#login_form').css('display','none');$('#div_ingresa').css('display','block');$('#subsc_form').css('display','block');
    return false;
}
function setCommentLoader() {
    xajax.callback.global.onRequest = function() {xajax.$('commentLoading').style.display = 'block';}
    xajax.callback.global.beforeResponseProcessing = function() {xajax.$('commentLoading').style.display='none';}
}
function searchFldClick() {
    var tswstr='Click para buscar en ';
    var tsw=xajax.$('searchword').value;
    otswstr = tsw;
    if(tsw.match("^"+tswstr)==tswstr) {
        xajax.$('searchword').value='';
    }
}
function searchFldBlur() {
    var tsw=xajax.$('searchword').value;
    if(!tsw.length) {
        xajax.$('searchword').value=otswstr;
    }
}
function setXajaxLoader(loaderId) {
    xajax.callback.global.onRequest = function() {xajax.$(loaderId).style.display = 'block';}
    xajax.callback.global.beforeResponseProcessing = function() {xajax.$(loaderId).style.display='none';}
}
function showModalLogin(redirPage) {
    afterLoginPage = redirPage;
    $('#modal_login').modal({maxWidth:280,maxHeight:165});
}

function showModalAddFriend() {
	$('#modal_add_friend').modal({maxWidth:360,maxHeight:200});return false;
}

function showSendFriendMessage() {
	$('#modal_send_friend_message').modal({maxWidth:360,maxHeight:180});return false;return false;
}

function modalLoginSubmit() {
    xajax.$('user_login').value = xajax.$('md_user').value;
    xajax.$('user_pass').value = xajax.$('md_pass').value;
    xajax_doLogin(xajax.getFormValues('uloginfrm'));
    xajax.$('user_login').value = '';
    xajax.$('user_pass').value = '';
}

function loginReloadPage() {
    if(!afterLoginPage)
        window.location.href=window.location.href+'?logged_in';
    else
        window.location.href=afterLoginPage;
}

function checkValidFile() {
	badName=""; 
	allBlank=true; 
	var rgx;
	var fext = 'jpg';
	rgx=new RegExp("[^\.]\."+fext+"\s*$", "i");
	fvalue=xajax.$('avatar_img_file').value;
	if(!fvalue) {
		alert('Por favor escoja una fotografía');
		return false;
	}
	fvalue=fvalue.replace(/^\s+/,'').replace(/\s+$/,'');
	if( fvalue.length ) {
		if( !rgx.test(fvalue) ) {
			alert('Archivo no válido\n\nSólo se permiten imágenes en formato .JPG');
			return false;
		}
	}
	return true;
}


function loadGTranslator() {
	return false;
	var gg_lang;
	if (navigator.userLanguage) // Explorer
		gg_lang = navigator.userLanguage;
	else if (navigator.language) // FF
		gg_lang = navigator.language;
	else
		gg_lang = "en";
	if(gg_lang.match("^"+'es')!='es') {
		new google.translate.TranslateElement({
			pageLanguage: 'es',
			includedLanguages: 'en,fr,de,hi'
			}, 'google_translate_element');
	}
}

(function(D){var A="Lite-1.0";D.fn.cycle=function(E){return this.each(function(){E=E||{};if(this.cycleTimeout){clearTimeout(this.cycleTimeout)}this.cycleTimeout=0;this.cyclePause=0;var I=D(this);var J=E.slideExpr?D(E.slideExpr,this):I.children();var G=J.get();if(G.length<2){if(window.console&&window.console.log){window.console.log("terminating; too few slides: "+G.length)}return }var H=D.extend({},D.fn.cycle.defaults,E||{},D.metadata?I.metadata():D.meta?I.data():{});H.before=H.before?[H.before]:[];H.after=H.after?[H.after]:[];H.after.unshift(function(){H.busy=0});var F=this.className;H.width=parseInt((F.match(/w:(\d+)/)||[])[1])||H.width;H.height=parseInt((F.match(/h:(\d+)/)||[])[1])||H.height;H.timeout=parseInt((F.match(/t:(\d+)/)||[])[1])||H.timeout;if(I.css("position")=="static"){I.css("position","relative")}if(H.width){I.width(H.width)}if(H.height&&H.height!="auto"){I.height(H.height)}var K=0;J.css({position:"absolute",top:0,left:0}).hide().each(function(M){D(this).css("z-index",G.length-M)});D(G[K]).css("opacity",1).show();if(D.browser.msie){G[K].style.removeAttribute("filter")}if(H.fit&&H.width){J.width(H.width)}if(H.fit&&H.height&&H.height!="auto"){J.height(H.height)}if(H.pause){I.hover(function(){this.cyclePause=1},function(){this.cyclePause=0})}D.fn.cycle.transitions.fade(I,J,H);J.each(function(){var M=D(this);this.cycleH=(H.fit&&H.height)?H.height:M.height();this.cycleW=(H.fit&&H.width)?H.width:M.width()});J.not(":eq("+K+")").css({opacity:0});if(H.cssFirst){D(J[K]).css(H.cssFirst)}if(H.timeout){if(H.speed.constructor==String){H.speed={slow:600,fast:200}[H.speed]||400}if(!H.sync){H.speed=H.speed/2}while((H.timeout-H.speed)<250){H.timeout+=H.speed}}H.speedIn=H.speed;H.speedOut=H.speed;H.slideCount=G.length;H.currSlide=K;H.nextSlide=1;var L=J[K];if(H.before.length){H.before[0].apply(L,[L,L,H,true])}if(H.after.length>1){H.after[1].apply(L,[L,L,H,true])}if(H.click&&!H.next){H.next=H.click}if(H.next){D(H.next).bind("click",function(){return C(G,H,H.rev?-1:1)})}if(H.prev){D(H.prev).bind("click",function(){return C(G,H,H.rev?1:-1)})}if(H.timeout){this.cycleTimeout=setTimeout(function(){B(G,H,0,!H.rev)},H.timeout+(H.delay||0))}})};function B(J,E,I,K){if(E.busy){return }var H=J[0].parentNode,M=J[E.currSlide],L=J[E.nextSlide];if(H.cycleTimeout===0&&!I){return }if(I||!H.cyclePause){if(E.before.length){D.each(E.before,function(N,O){O.apply(L,[M,L,E,K])})}var F=function(){if(D.browser.msie){this.style.removeAttribute("filter")}D.each(E.after,function(N,O){O.apply(L,[M,L,E,K])})};if(E.nextSlide!=E.currSlide){E.busy=1;D.fn.cycle.custom(M,L,E,F)}var G=(E.nextSlide+1)==J.length;E.nextSlide=G?0:E.nextSlide+1;E.currSlide=G?J.length-1:E.nextSlide-1}if(E.timeout){H.cycleTimeout=setTimeout(function(){B(J,E,0,!E.rev)},E.timeout)}}function C(E,F,I){var H=E[0].parentNode,G=H.cycleTimeout;if(G){clearTimeout(G);H.cycleTimeout=0}F.nextSlide=F.currSlide+I;if(F.nextSlide<0){F.nextSlide=E.length-1}else{if(F.nextSlide>=E.length){F.nextSlide=0}}B(E,F,1,I>=0);return false}D.fn.cycle.custom=function(K,H,I,E){var J=D(K),G=D(H);G.css({opacity:0});var F=function(){G.animate({opacity:1},I.speedIn,I.easeIn,E)};J.animate({opacity:0},I.speedOut,I.easeOut,function(){J.css({display:"none"});if(!I.sync){F()}});if(I.sync){F()}};D.fn.cycle.transitions={fade:function(F,G,E){G.not(":eq(0)").css("opacity",0);E.before.push(function(){D(this).show()})}};D.fn.cycle.ver=function(){return A};D.fn.cycle.defaults={timeout:4000,speed:1000,next:null,prev:null,before:null,after:null,height:"auto",sync:1,fit:0,pause:0,delay:0,slideExpr:null}})(jQuery);$.fn.extend({find_pos:function(){if(!this.tagName&&this.length){obj=this[0]}else{return[0,0]}
var a=curtop=0;if(obj.offsetParent){a=obj.offsetLeft;curtop=obj.offsetTop;while(obj=obj.offsetParent){a+=obj.offsetLeft;curtop+=obj.offsetTop}}
return[a,curtop]}});function MapTips(o){var p=this;var q=o;this.add_tooltip=function(a,b){a.tooltip=b;GEvent.addListener(a,"mouseover",p.show_tooltip);GEvent.addListener(a,"mouseout",p.hide_tooltip)};this.show_tooltip=function(a){var b=q.fromLatLngToContainerPixel(this.getLatLng());$("body").append('<p id="maptip" style="visibility: hidden;">'+this.tooltip+'</p>');var c=$(q.getContainer()).find_pos();var d=c[0];var e=c[0]+$(q.getContainer()).width();var f=c[1];var g=this.getIcon().iconSize;c[0]+=b.x;c[1]+=b.y-g.height;var h=$("#maptip")[0].offsetWidth/2;var i=$("#maptip")[0].offsetHeight+3;var j=c[0]-h;var k=c[1]-i;var l=c[0]-h;var m=c[0]-h+$("#maptip")[0].offsetWidth;var n=c[1]-i;if(d>=l){j+=d-l+3}else if(e<=m){j-=m-e+3}
if(f>=n){k+=$("#maptip")[0].offsetHeight+g.height+6}
$("#maptip").css("left",j).css("top",k).css("visibility","visible");$("#maptip").fadeIn("medium")};this.hide_tooltip=function(){$("#maptip").remove()}};function GMPoint(){this.latitude=0.0;this.longitude=0.0;this.toolTipHTML='';this.detailsHTML='';this.icon='';this.redirectURL='';this.redirectInNewWindow=false};function GoogleMap(){this.map=null;this.points=new Array();this.coordinates=new Array();this.gmap_div_id='';this.gmap_loader_div='';this.loadedTo=0;this.tooltip='';var h=this;var j=null;this.initGMap=function(a,b,c,d){c=typeof(c)!='undefined'?c:0;d=typeof(d)!='undefined'?d:0;if(GBrowserIsCompatible()){this.gmap_div_id=a;this.gmap_loader_div=b;document.getElementById(this.gmap_loader_div).style.display='block';document.getElementById(this.gmap_div_id).style.display='block';this.map=new GMap2(document.getElementById(this.gmap_div_id));this.map.setCenter(new GLatLng(c,d),10);this.maptips=new MapTips(this.map)}else{this.map=false}};this.addPoint=function(a,b,c,d,e,f,g){var p=new GMPoint();this.points.push(new GLatLng(a,b));d=typeof(d)!='undefined'?d:'';e=typeof(e)!='undefined'?e:'';onClickRedirect=typeof(onClickRedirect)!='undefined'?onClickRedirect:false;f=typeof(f)!='undefined'?f:'';g=typeof(g)!='undefined'?g:false;if(e.length)f='';p.latitude=a;p.longitude=b;p.toolTipHTML=d;p.detailsHTML=e;p.icon=c;p.redirectURL=f;p.redirectInNewWindow=g;this.coordinates.push(p)};this.modalOpen=function(a){a.overlay.fadeIn('fast',function(){a.container.fadeIn('fast',function(){a.data.hide().slideDown('slow')})})};this.createMarker=function(a,b,c){var d=new GMarker(a,b);var e=document.createElement("div");if(c.detailsHTML.length){GEvent.addListener(d,"click",function(){$(c.detailsHTML).modal({onOpen:h.modalOpen})})}else if(c.redirectURL.length){if(c.redirectInNewWindow){GEvent.addListener(d,"click",function(){window.open(c.redirectURL)})}else{GEvent.addListener(d,"click",function(){window.location=c.redirectURL})}};return d};this.plotMap=function(){if(!this.map)return false;var a=null;var b=null;var c='Name';var d=null;var e=this.map.getCurrentMapType().getProjection().fromLatLngToPixel(this.map.getBounds().getSouthWest(),this.map.getZoom());var f=this.map.getDefaultUI();f.controls.scalecontrol=true;f.controls.largemapcontrol3d=true;f.maptypes.hybrid=false;f.maptypes.physical=false;this.map.setUI(f);for(var i=0;i<this.coordinates.length;i++){d=this.coordinates[i];a=new GLatLng(d.latitude,d.longitude);b=new GIcon(G_DEFAULT_ICON);if(d.icon.length)b.image=d.icon;var g=this.createMarker(a,b,d);this.map.addOverlay(g);this.maptips.add_tooltip(g,d.toolTipHTML)};this.fitMap();this.loadedTo=setTimeout(function(){h.checkLoaded()},2500)};this.checkLoaded=function(){if(!this.map){clearTimeout(this.loadedTo);return false};if(this.map.isLoaded()){clearTimeout(this.loadedTo);document.getElementById(this.gmap_loader_div).style.display='none';var a=document.getElementById(this.gmap_div_id).style;a.opacity=1;a.MozOpacity=1;a.KhtmlOpacity=1;a.filter="alpha(opacity="+100+")";a.position='relative';if(typeof onMapLoaded=='function'){onMapLoaded();}}};this.fitMap=function(){if(!this.map)return false;var a=new GLatLngBounds();for(var i=0;i<this.points.length;i++){a.extend(this.points[i])}
this.map.setZoom(this.map.getBoundsZoomLevel(a));this.map.setCenter(a.getCenter())};this.clearOverlays=function(){if(!this.map)return false;while(this.coordinates.length){this.coordinates.pop()}
while(this.points.length){this.points.pop()}
this.map.clearOverlays();return true};this.removeMapType=function(a){if(!this.map)return false;this.map.removeMapType(a)};this.dispose=function(){this.selfObj=null;map=null;GUnload()}};(function($) {
	/*
		jquery.twitter.js v1.5
		Last updated: 08 July 2009

		Created by Damien du Toit
		http://coda.co.za/blog/2008/10/26/jquery-plugin-for-twitter

		Licensed under a Creative Commons Attribution-Non-Commercial 3.0 Unported License
		http://creativecommons.org/licenses/by-nc/3.0/
	*/

	$.fn.getTwitter = function(options) {

		$.fn.getTwitter.defaults = {
			userName: null,
			numTweets: 5,
			loaderText: "Loading tweets...",
			slideIn: true,
			slideDuration: 750,
			showHeading: true,
			headingText: "Latest Tweets",
			showProfileLink: true,
			showTimestamp: true
		};

		var o = $.extend({}, $.fn.getTwitter.defaults, options);

		return this.each(function() {
			var c = $(this);

			// hide container element, remove alternative content, and add class
			c.hide().empty().addClass("twitted");

			// add heading to container element
			if (o.showHeading) {
				c.append("<h2>"+o.headingText+"</h2>");
			}

			// add twitter list to container element
			var twitterListHTML = "<ul id=\"twitter_update_list\"><li></li></ul>";
			c.append(twitterListHTML);

			var tl = $("#twitter_update_list");

			// hide twitter list
			tl.hide();

			// add preLoader to container element
			var preLoaderHTML = $("<p class=\"preLoader\">"+o.loaderText+"</p>");
			c.append(preLoaderHTML);

			// add Twitter profile link to container element
			if (o.showProfileLink) {
				var profileLinkHTML = "<p class=\"profileLink\"><a href=\"http://twitter.com/"+o.userName+"\">http://twitter.com/"+o.userName+"</a></p>";
				c.append(profileLinkHTML);
			}

			// show container element
			c.show();

			$.getScript("http://twitter.com/javascripts/blogger.js");
			$.getScript("http://twitter.com/statuses/user_timeline/"+o.userName+".json?callback=twitterCallback2&count="+o.numTweets, function() {
				// remove preLoader from container element
				$(preLoaderHTML).remove();

				// remove timestamp and move to title of list item
				if (!o.showTimestamp) {
					tl.find("li").each(function() {
						var timestampHTML = $(this).children("a");
						var timestamp = timestampHTML.html();
						timestampHTML.remove();
						$(this).attr("title", timestamp);
					});
				}

				// show twitter list
				if (o.slideIn) {
					// a fix for the jQuery slide effect
					// Hat-tip: http://blog.pengoworks.com/index.cfm/2009/4/21/Fixing-jQuerys-slideDown-effect-ie-Jumpy-Animation
					var tlHeight = tl.data("originalHeight");

					// get the original height
					if (!tlHeight) {
						tlHeight = tl.show().height();
						tl.data("originalHeight", tlHeight);
						tl.hide().css({height: 0});
					}

					tl.show().animate({height: tlHeight}, o.slideDuration);
				}
				else {
					tl.show();
				}

				// add unique class to first list item
				tl.find("li:first").addClass("firstTweet");

				// add unique class to last list item
				tl.find("li:last").addClass("lastTweet");
			});
		});
	};
})(jQuery);

