/*
 * Ajaxify - jQuery Plugin
 * version: 2.00 (11/12/2008)
 * Created by: MaX
 * Examples and documentation at: http://max.jsrhost.com/ajaxify/
 * licensed under and GPL licenses:
 * http://www.gnu.org/licenses/gpl.html
 */
(function($){jQuery.AjaxifyDefaults={event:'click',link:false,target:'#container',animateOut:false,animateIn:false,animateOutSpeed:'normal',animateInSpeed:'normal',method:'GET',tagToload:false,loading_txt:'',loading_img:"images/loading.gif",loading_target:false,loading_fn:function(options){jQuery.ajaxifyLoading(options);},loadHash:false,title:false,forms:false,params:'ajax=true',timeout:false,contentType:"application/x-www-form-urlencoded",dataType:'html',cache:false,username:false,password:false,onStart:function(op){},onError:function(op){jQuery.ajaxifyManip(op,"<font style='color: #CC0000'>Error: </font> Couldn't open the page.");},onSuccess:function(op){},onComplete:function(op){}};jQuery.AjaxifyFirstLoad=true;jQuery.AjaxifyhistorySet=new Object();jQuery.AjaxifyPageTitle=document.title;jQuery.AjaxifyDebug=false;jQuery.fn.ajaxify=function(options){if(!jQuery(this).size()){jQuery.ajaxifylog('Error: No matched element/s for your ajaxify selector " '+jQuery(this).selector+' ".');return false;}
var ver=jQuery.fn.jquery.split('.');if(ver[0]<1||ver[1]<2||ver[2]<6){jQuery.ajaxifylog('Error: Your jQuery version is old. Version 1.2.6 or newer is required.');return false;}
return this.each(function(){var current=jQuery.extend({},jQuery.AjaxifyDefaults,options);if(jQuery.metadata){current=jQuery.extend(current,jQuery(this).metadata());}
if(current.event){jQuery(this).bind(current.event,function(){jQuery(this).ajaxifyAnalyse(current);if(!current.hash)
jQuery.ajaxifyLoad(current);else{jQuery.ajaxifyHash(current);}
if(jQuery(this).is('a')||jQuery(this).is('form'))return false;});}else{jQuery(this).ajaxifyAnalyse(current);jQuery.ajaxifyLoad(current);}
if(current.loadHash&&jQuery.AjaxifyFirstLoad){jQuery(this).ajaxifyAnalyse(current);if(document.location.hash.replace(/^#/,'')==current.hash&&current.hash){jQuery.ajaxifyHash(current);jQuery.AjaxifyFirstLoad=false;}}});};jQuery.fn.ajaxifyAnalyse=function(current){current.object=this;if(jQuery(this).is('a')){if(jQuery(this).attr('href')){var link=jQuery(this).attr('href').replace(/^#/,"");current.link=link||current.link;}else
current.link;if(typeof current.tagToload!='object')
if(jQuery(this).attr('target'))
current.target=jQuery(this).attr('target');else
current.target;else
current.target=current.loading_target||'#AjaxifyTemp';}
if(!current.loading_target)
current.loading_target=current.target;if(current.forms){var text=jQuery(current.forms).serialize();current.paramres=text;}
if(typeof current.params=='function')
var params=current.params(current);else
var params=current.params;if(typeof params=='string'){if(text)
current.paramres+='&'+params;else
current.paramres=params;}
var len=current.target.length-1;if(typeof current.tagToload!='object')
if(current.target.charAt(len)=='+'||current.target.charAt(len)=='-'){current.manip=current.target.charAt(len);current.target=current.target.substr(0,len);}
if(current.loadHash){if(!jQuery.historyInit){jQuery.ajaxifylog('Error: loadHash is enabled but history plugin couldn\'t be found.');return false;}
if(current.loadHash===true){jQuery.ajaxifylog('Info: It seemes you are upgrading from v1.0. Please see the new documentation about loadHash. "attr:href" will be used instead of "true".');current.loadHash="attr:href";}
if(current.loadHash.toLowerCase()=='attr:href'||current.loadHash.toLowerCase()=='attr:rel'||current.loadHash.toLowerCase()=='attr:title'){current.loadHash=current.loadHash.toLowerCase();current.hash=jQuery(this).attr(current.loadHash.replace('attr:',''));if(jQuery.browser.opera){current.hash=current.hash.replace('?','%3F');current.hash=current.hash.replace('&','%26');current.hash=current.hash.replace('=','%3D');}}else
current.hash=current.loadHash;if(!current.hash)
jQuery.ajaxifylog('Warning: You have specified loadHash, but its empty or attribute couldn\'t be found.');}
if(!jQuery(current.target).size()&&typeof current.tagToload!='object')
jQuery.ajaxifylog('Warning: Target " '+current.target+' " couldn\'t be found.');};jQuery.ajaxifyLoading=function(options){var html="<div id='AjaxifyLoading'><img src='"+options.loading_img+"' alt='Loading...' title='Loading...' >"+options.loading_txt+"</div>";if(options.loading_target)
jQuery.ajaxifyManip(options.loading_target,html);else
jQuery.ajaxifyManip(options,html);}
jQuery.ajaxifyHash=function(current){var ob=new Object();jQuery.each(current,function(key,value){ob[key]=value;});jQuery.AjaxifyhistorySet[ob.hash]=ob;location.hash=ob.hash;jQuery.historyInit(jQuery.ajaxifyHistory);jQuery.AjaxifyFirstLoad.history=false;};jQuery.ajaxifyLoad=function(current){jQuery.ajaxSetup({global:false});jQuery.ajax({type:current.method,url:current.link,dataType:current.dataType,data:current.paramres,contentType:current.contentType,processData:true,timeout:current.timeout,cache:current.cache,username:current.username,password:current.password,complete:function(){current.onComplete(current)},beforeSend:function(){current.onStart(current);if(current.animateOut){if(current.loading_target!=current.target);current.loading_fn(current);jQuery(current.target).animate(current.animateOut,current.animateOutSpeed,function(){if(!current.loading_target)
current.loading_fn(current);});}else
current.loading_fn(current);},success:function(data){jQuery(current.target).stop();jQuery('#AjaxifyLoading').remove();if(current.title)
document.title=current.title;else if(document.title!=jQuery.AjaxifyPageTitle)
document.title=jQuery.AjaxifyPageTitle;if(current.tagToload){data='<div>'+data+'</div>';if(typeof current.tagToload=='string'){jQuery.ajaxifyManip(current,jQuery(data).find(current.tagToload));}else if(typeof current.tagToload=='object'){jQuery.each(current.tagToload,function(tag,target){if(jQuery(data).find(tag).size())
jQuery.ajaxifyManip(target,jQuery(data).find(tag));else
jQuery.ajaxifylog('Warning: Tag "'+tag+'" couldn\'t be found.');});}}else{jQuery.ajaxifyManip(current,data);}
current.onSuccess(current,data);if(current.animateIn)
jQuery(current.target).animate(current.animateIn,current.animateInSpeed);},error:function(msg){jQuery(current.target).stop();current.onError(current,msg);if(current.animateIn)
jQuery(current.target).animate(current.animateIn,current.animateInSpeed);}});};jQuery.ajaxifylog=function(message){if(jQuery.AjaxifyDebug)
if(window.console){console.debug(message);}else{alert(message);}};jQuery.ajaxifyHistory=function(hash){if(hash){if(jQuery.browser.safari){var options=jQuery.AjaxifyhistorySet[location.hash.replace(/^#/,'')];}else
var options=jQuery.AjaxifyhistorySet[hash];if(options)
jQuery.ajaxifyLoad(options);else
jQuery.ajaxifylog('History Fired. But I couldn\'t find hash. Most propabley, the hash is empty. If so, its normal.');}};jQuery.ajaxifyManip=function(current,data){if(typeof current!='object'){var target=current;var current=new Object;var len=target.length-1;if(target.charAt(len)=='+'||target.charAt(len)=='-'){current.manip=target.charAt(len);current.target=target.substr(0,len);}
else{current.manip='';current.target=target;}
if(!jQuery(current.target).size())
jQuery.ajaxifylog('Warning: Target "'+current.target+'" couldn\'t be found.');}
if(current.manip=='+')
jQuery(current.target).append(data);else if(current.manip=='-')
jQuery(current.target).prepend(data);else
jQuery(current.target).html(data);};})(jQuery);

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}('(4($){$.K($.7,{3:4(b,c,d){9 e=2,q;5($.L(b))d=c,c=b,b=z;$.h($.3.j,4(i,a){5(e.8==a.8&&e.g==a.g&&b==a.k&&(!c||c.$6==a.7.$6)&&(!d||d.$6==a.o.$6))l(q=a)&&u});q=q||T $.3(2.8,2.g,b,c,d);q.v=u;q.p();l 2},U:4(b,c,d){9 e=2;5($.L(b))d=c,c=b,b=z;$.h($.3.j,4(i,a){5(e.8==a.8&&e.g==a.g&&(!b||b==a.k)&&(!c||c.$6==a.7.$6)&&(!d||d.$6==a.o.$6)&&!2.v)$.3.w(a.M)});l 2}});$.3=4(a,b,c,d,e){2.8=a;2.g=b||N;2.k=c;2.7=d;2.o=e;2.s=[];2.v=u;2.M=$.3.j.F(2)-1;d.$6=d.$6||$.3.G++;5(e)e.$6=e.$6||$.3.G++;l 2};$.3.t={w:4(){9 b=2;5(2.k)2.s.V(2.k,2.7);A 5(2.o)2.s.h(4(i,a){b.o.x(a)});2.s=[];2.v=O},p:4(){5(2.v)l;9 b=2;9 c=2.s,y=$(2.8,2.g),H=y.W(c);2.s=y;5(2.k){H.X(2.k,2.7);5(c.B>0)$.h(c,4(i,a){5($.C(a,y)<0)$.Y.P(a,b.k,b.7)})}A{H.h(4(){b.7.x(2)});5(2.o&&c.B>0)$.h(c,4(i,a){5($.C(a,y)<0)b.o.x(a)})}}};$.K($.3,{G:0,j:[],m:[],D:u,E:Z,Q:4(){5($.3.D&&$.3.m.B){9 a=$.3.m.B;10(a--)$.3.j[$.3.m.11()].p()}},12:4(){$.3.D=u},R:4(){$.3.D=O;$.3.p()},S:4(){$.h(I,4(i,n){5(!$.7[n])l;9 a=$.7[n];$.7[n]=4(){9 r=a.x(2,I);$.3.p();l r}})},p:4(b){5(b!=z){5($.C(b,$.3.m)<0)$.3.m.F(b)}A $.h($.3.j,4(a){5($.C(a,$.3.m)<0)$.3.m.F(a)});5($.3.E)13($.3.E);$.3.E=14($.3.Q,15)},w:4(b){5(b!=z)$.3.j[b].w();A $.h($.3.j,4(a){$.3.j[a].w()})}});$.3.S(\'16\',\'17\',\'18\',\'19\',\'1a\',\'1b\',\'1c\',\'1d\',\'1e\',\'1f\',\'1g\',\'P\');$(4(){$.3.R()});9 f=$.t.J;$.t.J=4(a,c){9 r=f.x(2,I);5(a&&a.8)r.g=a.g,r.8=a.8;5(1h a==\'1i\')r.g=c||N,r.8=a;l r};$.t.J.t=$.t})(1j);',62,82,'||this|livequery|function|if|lqguid|fn|selector|var|||||||context|each||queries|type|return|queue||fn2|run|||elements|prototype|false|stopped|stop|apply|els|undefined|else|length|inArray|running|timeout|push|guid|nEls|arguments|init|extend|isFunction|id|document|true|remove|checkQueue|play|registerPlugin|new|expire|unbind|not|bind|event|null|while|shift|pause|clearTimeout|setTimeout|20|append|prepend|after|before|wrap|attr|removeAttr|addClass|removeClass|toggleClass|empty|typeof|string|jQuery'.split('|'),0,{}))
/***** GROUP STUFF ****/
/*$(document).ready(function() { 
	  		$('.ajaxify').ajaxify({
		   		loadHash:'attr:rel',
				animateOut:{opacity:'0'},
				animateOutSpeed:300,
				animateIn:{opacity:'1'},
				animateInSpeed:300
	   		});
	     });

$('#forms').ajaxify({
		 target:'#results',
   		 link:'example.php?action=forms',
   		 forms:'#testform',
   		 animateIn:{'height':'210px'},
      });


 
*/
$(document).ready(function () {
	$('.ajaxify').livequery(function(){
		$(this).ajaxify({
			loadHash:'attr:rel',
			animateOut:{opacity:'0'},
			animateOutSpeed:300,
			animateIn:{opacity:'1'},
			animateInSpeed:300
        });
	});
	$('a.adv[rel*=shadowbox]').livequery('click', function(event) {
    	Shadowbox.open(this);
        return false;
    });
});
