$(document).ready(function() {
	// Ajax forms
	var options = {
		beforeSerialize	: beforeSerialize,
		success			: formResponse,
		dataType		: 'json',
		url				: '/_src/account.php'
	};
	if($('#frmAccount').length)$('#frmAccount').ajaxForm(options);
	if($('#frmPass').length)$('#frmPass').ajaxForm(options);
	if($('#frmEletter').length)$('#frmEletter').ajaxForm(options);

	// Superfish menu
	if($('.sf-menu').length){
		$('ul.sf-menu').supersubs({
			minWidth:    10,
			maxWidth:    15,
			extraWidth:  2
		}).superfish({
			animation: {opacity:'show',height:'show'},
			delay:	200,
			speed:	'fast'
		});
	}

	// PrettyPhoto
	$("a[rel^='lightbox']").prettyPhoto({
		theme:'facebook',
		animationSpeed: 'fast',
		opacity: '0.8'
	});
});

/* Required */
(function(d){var e,o="";var a;var c=[];var s;var r=0;var q=false;var i=[];var j=jQuery.fn.css;jQuery.fn.css=function(w,y){var x=o+"display";var v=o+"position";var u=false,B=false;if(y){if(w==x&&y.indexOf('"')!=-1){u=true}else{if(w==v&&y.length==1){B=true}else{return j.apply(this,arguments)}}var A=this;var z;d.each(a,function(D,C){if(u){if(A.is(D)){z=D}}else{d.each(C.chars,function(E,F){if(A.is(F.selector)){z=F.selector}})}});d.each(i,function(C,D){if(D.selector==z){if(u){D.properties[x]=y}else{if(B){D.properties[v]=y}}}});b(i);k()}else{return j.apply(this,arguments)}};d.templateLayoutShowOnReady=function(){document.write("<style> body {visibility:hidden} </style>");q=true};d.setTemplateLayout=function(v,u){if(l()){p();return false}setTimeout(function(){d(window).resize(k)},100);if(typeof v=="string"){v={file:v}}if(u){v.prefix=u}if(v){if(v.prefix){o="-"+v.prefix+"-"}if(v.delay){r=v.delay}if(v.fallback){d("."+v.fallback).remove()}}if(!v){n()}else{e="";if(v.text){e=v.text;d("head").append("<style>"+e+"</style>")}if(v.file){d.get(v.file,function(w){e+=w;k()})}if(!v.file&&!e){n();return false}if(e){k()}}};d.redoTemplateLayout=k;function p(){if(q){d("body").css("visibility","visible");q=false}}function n(){var u=d("style");if(!u.length){return}if(u.text()){e=u.text();k()}else{d.get(document.location.href,function(w){var v=w.match(/<style.*?>([\s\S]*?)<\/style>/);e=v?v[1]:"";k()})}}function f(){e=e.replace(/\/\*[\s\S]*?\*\//g,"");var u=e.split("}");d.each(u,function(){var x=d.trim(this);if(!x){return}var v=h(x);if(!v){return}if(v.selector.indexOf(",")!=-1){var w=v.selector.split(",");d.each(w,function(y,z){i.push({selector:d.trim(z),properties:v.properties})})}else{i.push(v)}});return i}function h(y){if(y.indexOf("@")===0||y.indexOf("{")==-1){return false}var x=y.split("{");var w=d.trim(x[0]);var u=x[1].split(";");var v={};d.each(u,function(){var A=this.split(":");var z=d.trim(A[0]).toLowerCase();var B=d.trim(A[1]);v[z]=B});return{selector:w,properties:v}}function g(F){var C=F.replace(/\n|\r/g," ");var D=C.split('"');var I=[];var w=[];var z={};for(var y=2,x=D.length;y<x;y+=2){var u=D[y];var H="auto";if(u.indexOf("/")!=-1){var E=u.match(/\/\s*(\S+)(.*)/);H=d.trim(E[1])}if(d.trim(u)&&y==x-1){var G=d.trim(D[x-1]).replace(/^\/\s*\S+\s*/,"");if(G&&G.indexOf("/")==-1){if(G.indexOf("(")!=-1){var v=G.match(/minmax(\(.*?\))/g);d.each(v,function(K,J){var L=J.replace(/\s*/g,"");G=G.replace(J,L)})}G=G.replace(/\(\)/,"");w=G.split(/\s+/)}}var B=D[y-1].replace(/[^a-z@\.]/gi,"");B=d.trim(B).split("");d.each(B,function(){z[this]=true});if(H.indexOf("-")==0){return false}I.push({chars:B,height:H})}var A=I[0].chars.length;while(w.length>A){w.pop()}while(w.length<A){w.push("*")}return{rows:I,widths:w,chars:z}}function b(y){var x={};var v={};var u=0;var w=[];d.each(y,function(z,K){var I=K.properties;var D=K.selector;var A=o+"display";var C=o+"position";var G=false;if(D.indexOf("::slot(")!=-1){var H=D.match(/slot\((.)\)/);if(H&&H.length>1){var B=H[1];var J=D.split("::slot")[0];var F={};d.each(I,function(M,N){if(M.indexOf("background")==0||M.indexOf("overflow")!=-1||M.indexOf("vertical-align")!=-1){F[M]=N}});v[J+"|"+B]=F}}if(I[C]&&I[C].length==1){var E=I[C];x[D]={chr:E,props:I};G=true}else{if(I[C]=="same"){c.push(D)}}if(I[A]&&I[A].indexOf('"')!=-1){var L=g(I[A]);if(!L){return}w.push({sel:D,rows:L.rows,widths:L.widths,chars:L.chars,properties:I,pseudo_props:{},num:u,slotEl:G});u++}});w.sort(function(A,z){return !z.slotEl});d.each(w,function(A,z){a[z.sel]=z});d.each(x,function(D,F){var B=false;var E=false;d.each(a,function(G,I){if(G==D){x[G].tplEl=true}if(!I.chars[F.chr]){return}var H=d(D).parents();if(H.is(G)){var K;var J=0;H.each(function(){if(H[J]==d(G)[0]){K=J}J++});if(B===false||K<B){B=K;E=G}}});var z=F.tplEl||false;if(E){var A=E+"|"+F.chr;var C=v[A]||false;a[E].chars[F.chr]={selector:D,props:F.props,pseudo_props:C,tplEl:z,cur_sel:E}}})}function l(){var x='"@"';var w=d("<p></p>");var u=true;try{w.get(0).style.display=x}catch(v){u=false}u=(w.css("display")==x);w.remove();return u}function t(R,O){var Q=R.widths;var D=R.rows;var G=R.properties;var E=[],P=[];var x=d(O);var F=R.chars;d.each(F,function(S,T){if(T!==true){T.slot_w=1;T.slot_h=1}});R.margins=0;function K(V,U){var S=[];d.each(F,function(Y,Z){var X=Z.props.width||"auto";if(Z.col==V&&Z.slot_w==1){var W=A({width:X,top:"auto",left:"auto"},Z.el.clone()).w;S.push(W)}});var T=U.split("-")[0];return Math[T].apply({},S)}function A(V,T){var S=d("<div></div>");S.css({visibility:"hidden",margin:0,padding:0,position:"absolute"});if(T){S.append(T)}if(V){S.css(V)}x.append(S);var U={w:S.width(),h:S.height()};S.remove();return U}function H(V,T,X){var U="auto",S="auto";if(V=="h"){S=T}else{U=T;if(U=="min-content"||U=="max-content"){return K(X,U)}}var W=A({height:S,width:U});return W[V]}function I(V){var T=0;for(var U=V.row;U<V.slot_h+V.row&&U<P.length;U++){T+=P[U]}var S=parseInt(V.el.css("margin-top"));if(S<0){T-=S}return T}function M(T,S,V){var W=F[S].props[T]+"";var U=W;if(W.indexOf("%")!=-1&&T=="width"){U=V*parseInt(W)/100}return U}function y(X){var W=0;for(var T=X.col;T<X.slot_w+X.col;T++){W+=E[T]}var V=X.el.outerWidth(true)-X.el.width();if(V){W-=V}if(X.tplEl){if(D[X.row].height&&D[X.row].height!="*"){a[X.selector].properties.height=D[X.row].height}a[X.selector].properties.width=W;var U=new t(a[X.selector],X.selector);var S=U.make();X.genHeight=S.height;return S.width}return W}function w(T){var S=T.css("border-top-width");var U=T.clone();U.each(function(){d(this).css("position","static")});return A(0,U).h}function C(){if(R.slotEl){G.height=x.height()}if(G.height){x.height(G.height);var S=x.height()}else{var U=0}var V=0;var T=[];d.each(D,function(Y,Z){var X=0;d.each(F,function(ad,ae){if(ae.row==Y){if(ae.props.height){ae.el.height(ae.props.height)}else{ae.el.height("auto")}if(!T[Y]){T[Y]=0}var ac;if(ae.genHeight){ac=ae.genHeight}else{if(ae.slot_h==1){ac=w(ae.el)}else{var ab=w(ae.el)/ae.slot_h;for(var aa=Y;aa<ae.slot_h;aa++){T[aa]=ab}}}if(X<T[Y]){X=T[Y]}if(X<ac){X=ac}}});if(G.height&&G.height!="auto"){V++;X=0}else{if(Z.height!="*"&&Z.height!="auto"){X=H("h",Z.height)}}P[Y]=X;U+=X});if(V){var W=S/V;d.each(D,function(X,Y){if(Y.height=="*"||Y.height=="auto"){P[X]=W}})}else{x.height(U)}}function L(){var W=0;var V=0;if(R.slotEl){x.width(x.width())}x.width(G.width||"100%");var U=x.width();E=[];var T=0;d.each(Q,function(aa,Y){if(Y=="fit-content"){Y=Q[aa]="minmax(min-content,max-content)"}if(Y=="*"||Y=="auto"){V++;W=0}else{if(Y.indexOf("minmax")===0){var ab=Y.match(/\((.*?),(.*?)\)/);var Z=ab[1];var X=ab[2];W=H("w",X,aa);U-=W}else{W=H("w",Y,aa);U-=W}}E.push(W);T+=W});if(U<0){d.each(Q,function(aa,Y){if(Y.indexOf("minmax")!=-1){var ab=Y.match(/\((.*?),(.*?)\)/);var Z=ab[1];var X=ab[2];min_pixels=H("w",Z,aa);E[aa]+=U;U=0;if(E[aa]<min_pixels){E[aa]=min_pixels}}})}var S=U/V;d.each(Q,function(Y,X){if(X=="*"||X=="auto"){E[Y]=S}})}function v(V,U){var S=U||0;var T=V.row;if(F["@"]&&!V.isHolder){S=-1*H("h",x.css("top"))}d.each(P,function(W){if(W<T){S+=this}});return S}function N(U){var T=U.col;var S=0;if(F["@"]&&!U.isHolder){S=-1*H("w",x.css("left"))}d.each(E,function(V){if(V<T){S+=this}});return S}function u(S){d.each(c,function(T,V){var U=d(V);U.each(function(){var X=d(this);var W=false;S.el.each(function(){var Y=d(this);if(!W){W=Y}else{W[W.length++]=Y[0]}if(Y.next()[0]==X[0]){W[W.length++]=X[0]}});if(W.length>1){S.el=W;S.multi=true}})})}function z(){var S=false;var U={};if(x.is("body")){return}d.each(G,function(X,Y){if(X.indexOf("background")===0){S=true;U[X]=Y}});if(!S){return}var W="jq_tpl_bg-"+R.num;var V=x.offset();var T=d("#"+W);if(!T.length){T=d('<div id="'+W+'"></div>');T.css(U)}T.css({"z-index":-2,position:"absolute",top:V.top,left:V.left,width:x.width(),height:x.height()});d("body").append(T)}function B(V,aa){if(aa.pseudo_props){var U=aa.el.offset();var T="jq_tpl"+R.num+"_slot-"+V;var ab=d("#"+T);var X=aa.pseudo_props;if(!ab.length){ab=d('<div id="'+T+'"></div>');d("body").append(ab)}var ac=aa.el.outerWidth(true);var W=I(aa);ab.css({display:"block",position:"absolute","z-index":(R.num-10),top:U.top,left:U.left,width:ac,height:W});if(d("body").is(O)){if(!R.margins){var S=d('<p style="position:static;margin:0;display:block;visibility:hidden;"></p>');x.append(S);R.margins=S.offset();R.margins.left-=parseFloat(x.css("padding-left"));R.margins.top-=parseFloat(x.css("padding-top"));S.remove()}ab.css("left",U.left-R.margins.left);ab.css("top",U.top-R.margins.top)}ab.css(X);if(X["vertical-align"]){var Z=0;var Y=X["vertical-align"];switch(Y){case"middle":Z=W/2-aa.el.height()/2;break;case"bottom":Z=W-aa.el.height();break;case"baseline":Z=W-aa.el.height();break;default:break}aa.el.css("top",v(aa)+Z)}}}function J(){d.each(D,function(S,T){d.each(T.chars,function(U,V){if(V=="."){return}if(V=="@"){F["@"]={selector:O,isHolder:true}}var W=F[V];W.el=d(W.selector);if(U>0&&T.chars[U-1]==V){if(W.slot_h==1){W.slot_w++}}if(S>0&&D[S-1].chars[U]==V){W.slot_h++}if(isNaN(W.row)){W.row=S}if(isNaN(W.col)){W.col=U}if(!W.el.parents().is(O)&&!W.el.is(O)){delete W;return}if(W.el.length>1){W.multi=true}u(W)})});delete F["."]}this.make=function(){x.css("position","relative");J();L();if(F["@"]){F["@"].el.css("left",N(F["@"]))}d.each(F,function(U,V){var T=V.el;var S=y(V);if(V.props.width){S=M("width",U,S)}T.css({display:"block",position:"absolute",width:S});T.css("left",N(V))});C();if(F["@"]){F["@"].el.css("top",v(F["@"]))}d.each(F,function(U,X){if(X.tplEl){a[X.selector].genTop=v(X)}var T=v(X);var W=I(X);var S=T;var V=false;if(X.pseudo_props){if(X.pseudo_props.overflow=="hidden"){V=true}}X.el.each(function(Y){if(Y>0){S+=X.el.eq(Y-1).outerHeight(true)}d(this).css("top",S);if(X.props.height){W=M("height",U,W);d(this).height(W)}if(V){var Z=W-S+T;var ab=(S-T>W);var aa=(X.el.height()+S-T>W);if(ab||aa){d(this).height(ab?0:Z);d(this).css("overflow","hidden")}}});if(X.tplEl){X.el.height(I(X))}B(U,X)});z();if(R.genTop&&F["@"]){F["@"].el.css("top",v(F["@"],R.genTop))}return{height:x.height(),width:x.width()}}}function m(w,u){var v=new t(u,w);v.make()}function k(){if(!a){a={};i=f();var u={};b(i)}setTimeout(function(){d.each(a,m);p()},r);r=0}})(jQuery);

function alertMsg(text,width,height){$.prettyPhoto.open('/_src/alert.php?msg='+text+'&iframe=true&width='+width+'&height='+height+'');}function beforeSerialize($jqForm,options){$('#'+$jqForm.attr('id')+' button').attr("disabled",true);$('#'+$jqForm.attr('id')+' input[title]').each(function(){if($(this).val()==$(this).attr('title'))$(this).val('');});}function formResponse(responseText,statusText,jqForm){$('button').attr("disabled",false);if(statusText=="success"){$("form *").removeClass('form-error');if(responseText["response"]=="error"){for(i in responseText["error"]){if(i==0)$("#"+responseText["error"][i]).focus();$("#"+responseText["error"][i]).addClass('form-error');if($("#"+responseText["error"][i]+"_error").length)$("#"+responseText["error"][i]+"_error").addClass('form-error');}}if(responseText["alert"].length>0){alertMsg(responseText["alert"],300,100);}if(responseText["response"]=="success"){if(responseText["js"]){$('#signup').val('');$('#email').val('');eval(responseText["js"]);}else{if(responseText["redir"]=="reload"){document.location.reload();}else if(responseText["redir"]=="parent.reload"){parent.document.location.reload();}else{document.location=responseText["redir"];}}}}}function in_array(needle,haystack,argStrict){var key='',strict=!!argStrict;if(strict){for(key in haystack){if(haystack[key]===needle){return true;}}}else{for(key in haystack){if(haystack[key]==needle){return true;}}}return false;}jQuery.cookie=function(name,value,options){if(typeof value!='undefined'){options=options||{};if(value===null){value='';options.expires=-1;}var expires='';if(options.expires&&(typeof options.expires=='number'||options.expires.toUTCString)){var date;if(typeof options.expires=='number'){date=new Date();date.setTime(date.getTime()+(options.expires*24*60*60*1000));}else{date=options.expires;}expires='; expires='+date.toUTCString();}var path=options.path?'; path='+(options.path):'';var domain=options.domain?'; domain='+(options.domain):'';var secure=options.secure?'; secure':'';document.cookie=[name,'=',encodeURIComponent(value),expires,path,domain,secure].join('');}else{var cookieValue=null;if(document.cookie&&document.cookie!=''){var cookies=document.cookie.split(';');for(var i=0;i<cookies.length;i++){var cookie=jQuery.trim(cookies[i]);if(cookie.substring(0,name.length+1)==(name+'=')){cookieValue=decodeURIComponent(cookie.substring(name.length+1));break;}}}return cookieValue;}};
/* jQuery Nivo Slider */
eval(function(p,a,c,k,e,d){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--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[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}('(9($){$.1f.1q=9(1X){b 3=$.2i({},$.1f.1q.2c,1X);I g.E(9(){b 4={f:0,t:\'\',U:0,o:\'\',N:m,1k:m,1N:m};b 5=$(g);5.1S(\'7:4\',4);5.e(\'2h\',\'2g\');5.1n(\'1q\');b d=5.2j();d.E(9(){b j=$(g);b 1p=\'\';6(!j.K(\'B\')){6(j.K(\'a\')){j.1n(\'7-2k\');1p=j}j=j.1g(\'B:1s\')}b 1c=j.w();6(1c==0)1c=j.s(\'w\');b 1d=j.x();6(1d==0)1d=j.s(\'x\');6(1c>5.w()){5.w(1c)}6(1d>5.x()){5.x(1d)}6(1p!=\'\'){1p.e(\'P\',\'1h\')}j.e(\'P\',\'1h\');4.U++});6(3.1a>0){6(3.1a>=4.U)3.1a=4.U-1;4.f=3.1a}6($(d[4.f]).K(\'B\')){4.t=$(d[4.f])}n{4.t=$(d[4.f]).1g(\'B:1s\')}6($(d[4.f]).K(\'a\')){$(d[4.f]).e(\'P\',\'1w\')}5.e(\'W\',\'V(\'+4.t.s(\'D\')+\') R-Y\');2b(b i=0;i<3.h;i++){b G=X.27(5.w()/3.h);6(i==3.h-1){5.J($(\'<C z="7-c"></C>\').e({21:(G*i)+\'13\',w:(5.w()-(G*i))+\'13\'}))}n{5.J($(\'<C z="7-c"></C>\').e({21:(G*i)+\'13\',w:G+\'13\'}))}}5.J($(\'<C z="7-H"><p></p></C>\').e({P:\'1h\',y:3.1Y}));6(4.t.s(\'16\')!=\'\'){$(\'.7-H p\',5).1y(4.t.s(\'16\'));$(\'.7-H\',5).1x(3.q)}b l=0;6(!3.1i&&d.1j>1){l=1v(9(){F(5,d,3,m)},3.1m)}6(3.T){5.J(\'<C z="7-T"><a z="7-2a">2f</a><a z="7-29">2m</a></C>\');6(3.2d){$(\'.7-T\',5).24();5.25(9(){$(\'.7-T\',5).2l()},9(){$(\'.7-T\',5).24()})}$(\'a.7-2a\',5).1J(\'1I\',9(){6(4.N)I m;S(l);l=\'\';4.f-=2;F(5,d,3,\'1C\')});$(\'a.7-29\',5).1J(\'1I\',9(){6(4.N)I m;S(l);l=\'\';F(5,d,3,\'1A\')})}6(3.M){b 1b=$(\'<C z="7-M"></C>\');5.J(1b);2b(b i=0;i<d.1j;i++){6(3.20){b j=d.1B(i);6(!j.K(\'B\')){j=j.1g(\'B:1s\')}6(3.1Q){1b.J(\'<a z="7-1l" 11="\'+i+\'"><B D="\'+j.s(\'11\')+\'" 28="" /></a>\')}n{1b.J(\'<a z="7-1l" 11="\'+i+\'"><B D="\'+j.s(\'D\').2n(3.1R,3.1P)+\'" 28="" /></a>\')}}n{1b.J(\'<a z="7-1l" 11="\'+i+\'">\'+i+\'</a>\')}}$(\'.7-M a:1B(\'+4.f+\')\',5).1n(\'1o\');$(\'.7-M a\',5).1J(\'1I\',9(){6(4.N)I m;6($(g).2e(\'1o\'))I m;S(l);l=\'\';5.e(\'W\',\'V(\'+4.t.s(\'D\')+\') R-Y\');4.f=$(g).s(\'11\')-1;F(5,d,3,\'1l\')})}6(3.1M){$(2q).2A(9(1L){6(1L.1Z==\'2C\'){6(4.N)I m;S(l);l=\'\';4.f-=2;F(5,d,3,\'1C\')}6(1L.1Z==\'2D\'){6(4.N)I m;S(l);l=\'\';F(5,d,3,\'1A\')}})}6(3.1T){5.25(9(){4.1k=Q;S(l);l=\'\'},9(){4.1k=m;6(l==\'\'&&!3.1i){l=1v(9(){F(5,d,3,m)},3.1m)}})}5.2E(\'7:Z\',9(){4.N=m;$(d).E(9(){6($(g).K(\'a\')){$(g).e(\'P\',\'1h\')}});6($(d[4.f]).K(\'a\')){$(d[4.f]).e(\'P\',\'1w\')}6(l==\'\'&&!4.1k&&!3.1i){l=1v(9(){F(5,d,3,m)},3.1m)}3.1U.1z(g)})});9 F(5,d,3,19){b 4=5.1S(\'7:4\');6((!4||4.1N)&&!19)I m;3.1W.1z(g);6(!19){5.e(\'W\',\'V(\'+4.t.s(\'D\')+\') R-Y\')}n{6(19==\'1C\'){5.e(\'W\',\'V(\'+4.t.s(\'D\')+\') R-Y\')}6(19==\'1A\'){5.e(\'W\',\'V(\'+4.t.s(\'D\')+\') R-Y\')}}4.f++;6(4.f==4.U){4.f=0;3.1V.1z(g)}6(4.f<0)4.f=(4.U-1);6($(d[4.f]).K(\'B\')){4.t=$(d[4.f])}n{4.t=$(d[4.f]).1g(\'B:1s\')}6(3.M){$(\'.7-M a\',5).2F(\'1o\');$(\'.7-M a:1B(\'+4.f+\')\',5).1n(\'1o\')}6(4.t.s(\'16\')!=\'\'){6($(\'.7-H\',5).e(\'P\')==\'1w\'){$(\'.7-H p\',5).22(3.q,9(){$(g).1y(4.t.s(\'16\'));$(g).1x(3.q)})}n{$(\'.7-H p\',5).1y(4.t.s(\'16\'))}$(\'.7-H\',5).1x(3.q)}n{$(\'.7-H\',5).22(3.q)}b i=0;$(\'.7-c\',5).E(9(){b G=X.27(5.w()/3.h);$(g).e({x:\'O\',y:\'0\',W:\'V(\'+4.t.s(\'D\')+\') R-Y -\'+((G+(i*G))-G)+\'13 0%\'});i++});6(3.k==\'1t\'){b 10=2G 2B("1K","14","1F","17","1E","12","1D","1r");4.o=10[X.26(X.1t()*(10.1j+1))];6(4.o==2y)4.o=\'1r\'}6(3.k.2o(\',\')!=-1){b 10=3.k.2r(\',\');4.o=$.2z(10[X.26(X.1t()*10.1j)])}4.N=Q;6(3.k==\'2p\'||3.k==\'1K\'||4.o==\'1K\'||3.k==\'14\'||4.o==\'14\'){b u=0;b i=0;b h=$(\'.7-c\',5);6(3.k==\'14\'||4.o==\'14\')h=$(\'.7-c\',5).1e();h.E(9(){b c=$(g);c.e(\'1G\',\'O\');6(i==3.h-1){L(9(){c.A({x:\'r%\',y:\'1.0\'},3.q,\'\',9(){5.18(\'7:Z\')})},(r+u))}n{L(9(){c.A({x:\'r%\',y:\'1.0\'},3.q)},(r+u))}u+=1u;i++})}n 6(3.k==\'2t\'||3.k==\'1F\'||4.o==\'1F\'||3.k==\'17\'||4.o==\'17\'){b u=0;b i=0;b h=$(\'.7-c\',5);6(3.k==\'17\'||4.o==\'17\')h=$(\'.7-c\',5).1e();h.E(9(){b c=$(g);c.e(\'23\',\'O\');6(i==3.h-1){L(9(){c.A({x:\'r%\',y:\'1.0\'},3.q,\'\',9(){5.18(\'7:Z\')})},(r+u))}n{L(9(){c.A({x:\'r%\',y:\'1.0\'},3.q)},(r+u))}u+=1u;i++})}n 6(3.k==\'1E\'||3.k==\'2u\'||4.o==\'1E\'||3.k==\'12\'||4.o==\'12\'){b u=0;b i=0;b v=0;b h=$(\'.7-c\',5);6(3.k==\'12\'||4.o==\'12\')h=$(\'.7-c\',5).1e();h.E(9(){b c=$(g);6(i==0){c.e(\'1G\',\'O\');i++}n{c.e(\'23\',\'O\');i=0}6(v==3.h-1){L(9(){c.A({x:\'r%\',y:\'1.0\'},3.q,\'\',9(){5.18(\'7:Z\')})},(r+u))}n{L(9(){c.A({x:\'r%\',y:\'1.0\'},3.q)},(r+u))}u+=1u;v++})}n 6(3.k==\'1D\'||4.o==\'1D\'){b u=0;b i=0;$(\'.7-c\',5).E(9(){b c=$(g);b 1H=c.w();c.e({1G:\'O\',x:\'r%\',w:\'O\'});6(i==3.h-1){L(9(){c.A({w:1H,y:\'1.0\'},3.q,\'\',9(){5.18(\'7:Z\')})},(r+u))}n{L(9(){c.A({w:1H,y:\'1.0\'},3.q)},(r+u))}u+=1u;i++})}n 6(3.k==\'1r\'||4.o==\'1r\'){b i=0;$(\'.7-c\',5).E(9(){$(g).e(\'x\',\'r%\');6(i==3.h-1){$(g).A({y:\'1.0\'},(3.q*2),\'\',9(){5.18(\'7:Z\')})}n{$(g).A({y:\'1.0\'},(3.q*2))}i++})}}};$.1f.1q.2c={k:\'1t\',h:15,q:2x,1m:2w,1a:0,T:Q,2d:Q,M:Q,20:m,1Q:m,1R:\'.1O\',1P:\'2v.1O\',1M:Q,1T:Q,1i:m,1Y:0.8,1W:9(){},1U:9(){},1V:9(){}};$.1f.1e=[].1e})(2s);',62,167,'|||settings|vars|slider|if|nivo||function||var|slice|kids|css|currentSlide|this|slices||child|effect|timer|false|else|randAnim||animSpeed|100|attr|currentImage|timeBuff||width|height|opacity|class|animate|img|div|src|each|nivoRun|sliceWidth|caption|return|append|is|setTimeout|controlNav|running|0px|display|true|no|clearInterval|directionNav|totalSlides|url|background|Math|repeat|animFinished|anims|rel|sliceUpDownLeft|px|sliceDownLeft||title|sliceUpLeft|trigger|nudge|startSlide|nivoControl|childWidth|childHeight|reverse|fn|find|none|manualAdvance|length|paused|control|pauseTime|addClass|active|link|nivoSlider|fade|first|random|50|setInterval|block|fadeIn|html|call|next|eq|prev|fold|sliceUpDown|sliceUpRight|top|origWidth|click|live|sliceDownRight|event|keyboardNav|stop|jpg|controlNavThumbsReplace|controlNavThumbsFromRel|controlNavThumbsSearch|data|pauseOnHover|afterChange|slideshowEnd|beforeChange|options|captionOpacity|keyCode|controlNavThumbs|left|fadeOut|bottom|hide|hover|floor|round|alt|nextNav|prevNav|for|defaults|directionNavHide|hasClass|Prev|relative|position|extend|children|imageLink|show|Next|replace|indexOf|sliceDown|window|split|jQuery|sliceUp|sliceUpDownRight|_thumb|3000|500|undefined|trim|keypress|Array|37|39|bind|removeClass|new'.split('|'),0,{}));
/* hoverIntent */
(function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:4,interval:5,timeout:0};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY;};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))<cfg.sensitivity){$(ob).unbind("mousemove",track);ob.hoverIntent_s=1;return cfg.over.apply(ob,[ev]);}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=0;return cfg.out.apply(ob,[ev]);};var handleHover=function(e){var p=(e.type=="mouseover"?e.fromElement:e.toElement)||e.relatedTarget;while(p&&p!=this){try{p=p.parentNode;}catch(e){p=this;}}if(p==this){return false;}var ev=jQuery.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);}if(e.type=="mouseover"){pX=ev.pageX;pY=ev.pageY;$(ob).bind("mousemove",track);if(ob.hoverIntent_s!=1){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}}else{$(ob).unbind("mousemove",track);if(ob.hoverIntent_s==1){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob);},cfg.timeout);}}};return this.mouseover(handleHover).mouseout(handleHover);};})(jQuery);
/* Superfish v1.4.8 - jQuery menu widget - (c) 2008 Joel Birch */
  ;(function($){$.fn.superfish=function(op){var sf=$.fn.superfish,c=sf.c,$arrow=$(['<span class="',c.arrowClass,'"> &#187;</span>'].join('')),over=function(){var $$=$(this),menu=getMenu($$);clearTimeout(menu.sfTimer);$$.showSuperfishUl().siblings().hideSuperfishUl();},out=function(){var $$=$(this),menu=getMenu($$),o=sf.op;clearTimeout(menu.sfTimer);menu.sfTimer=setTimeout(function(){o.retainPath=($.inArray($$[0],o.$path)>-1);$$.hideSuperfishUl();if(o.$path.length&&$$.parents(['li.',o.hoverClass].join('')).length<1){over.call(o.$path);}},o.delay);},getMenu=function($menu){var menu=$menu.parents(['ul.',c.menuClass,':first'].join(''))[0];sf.op=sf.o[menu.serial];return menu;},addArrow=function($a){$a.addClass(c.anchorClass).append($arrow.clone());};return this.each(function(){var s=this.serial=sf.o.length;var o=$.extend({},sf.defaults,op);o.$path=$('li.'+o.pathClass,this).slice(0,o.pathLevels).each(function(){$(this).addClass([o.hoverClass,c.bcClass].join(' ')).filter('li:has(ul)').removeClass(o.pathClass);});sf.o[s]=sf.op=o;$('li:has(ul)',this)[($.fn.hoverIntent&&!o.disableHI)?'hoverIntent':'hover'](over,out).each(function(){if(o.autoArrows)addArrow($('>a:first-child',this));}).not('.'+c.bcClass).hideSuperfishUl();var $a=$('a',this);$a.each(function(i){var $li=$a.eq(i).parents('li');$a.eq(i).focus(function(){over.call($li);}).blur(function(){out.call($li);});});o.onInit.call(this);}).each(function(){var menuClasses=[c.menuClass];if(sf.op.dropShadows&&!($.browser.msie&&$.browser.version<7))menuClasses.push(c.shadowClass);$(this).addClass(menuClasses.join(' '));});};var sf=$.fn.superfish;sf.o=[];sf.op={};sf.IE7fix=function(){var o=sf.op;if($.browser.msie&&$.browser.version>6&&o.dropShadows&&o.animation.opacity!=undefined)this.toggleClass(sf.c.shadowClass+'-off');};sf.c={bcClass:'sf-breadcrumb',menuClass:'sf-js-enabled',anchorClass:'sf-with-ul',arrowClass:'sf-sub-indicator',shadowClass:'sf-shadow'};sf.defaults={hoverClass:'sfHover',pathClass:'overideThisToUse',pathLevels:1,delay:800,animation:{opacity:'show'},speed:'normal',autoArrows:true,dropShadows:true,disableHI:false,onInit:function(){},onBeforeShow:function(){},onShow:function(){},onHide:function(){}};$.fn.extend({hideSuperfishUl:function(){var o=sf.op,not=(o.retainPath===true)?o.$path:'';o.retainPath=false;var $ul=$(['li.',o.hoverClass].join(''),this).add(this).not(not).removeClass(o.hoverClass).find('>ul').hide().css('visibility','hidden');o.onHide.call($ul);return this;},showSuperfishUl:function(){var o=sf.op,sh=sf.c.shadowClass+'-off',$ul=this.addClass(o.hoverClass).find('>ul:hidden').css('visibility','visible');sf.IE7fix.call($ul);o.onBeforeShow.call($ul);$ul.animate(o.animation,o.speed,function(){sf.IE7fix.call($ul);o.onShow.call($ul);});return this;}});})(jQuery);
/* Superfish supersubs */
;(function($){$.fn.supersubs=function(options){alert(0);var opts=$.extend({},$.fn.supersubs.defaults,options);return this.each(function(){var $$=$(this);var o=$.meta?$.extend({},opts,$$.data()):opts;var fontsize=$('<li id="menu-fontsize">&#8212;</li>').css({'padding':0,'position':'absolute','top':'-999em','width':'auto'}).appendTo($$).width();$('#menu-fontsize').remove();$ULs=$$.find('ul');$ULs.each(function(i){var $ul=$ULs.eq(i);var $LIs=$ul.children();var $As=$LIs.children('a');var liFloat=$LIs.css('white-space','nowrap').css('float');var emWidth=$ul.add($LIs).add($As).css({'float':'none','width':'auto'}).end().end()[0].clientWidth/fontsize;emWidth+=o.extraWidth;if(emWidth>o.maxWidth){emWidth=o.maxWidth;}else if(emWidth<o.minWidth){emWidth=o.minWidth;}emWidth+='em';$ul.css('width',emWidth);$LIs.css({'float':liFloat,'width':'100%','white-space':'normal'}).each(function(){var $childUl=$('>ul',this);var offsetDirection=$childUl.css('left')!==undefined?'left':'right';$childUl.css(offsetDirection,emWidth);});});});};$.fn.supersubs.defaults={minWidth:9,maxWidth:25,extraWidth:0};})(jQuery);
/* $ AlphaNumeric */
eval(function(p,a,c,k,e,d){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--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[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}('(2($){$.c.f=2(p){p=$.d({g:"!@#$%^&*()+=[]\\\\\\\';,/{}|\\":<>?~`.- ",4:"",9:""},p);7 3.b(2(){5(p.G)p.4+="Q";5(p.w)p.4+="n";s=p.9.z(\'\');x(i=0;i<s.y;i++)5(p.g.h(s[i])!=-1)s[i]="\\\\"+s[i];p.9=s.O(\'|\');6 l=N M(p.9,\'E\');6 a=p.g+p.4;a=a.H(l,\'\');$(3).J(2(e){5(!e.r)k=o.q(e.K);L k=o.q(e.r);5(a.h(k)!=-1)e.j();5(e.u&&k==\'v\')e.j()});$(3).B(\'D\',2(){7 F})})};$.c.I=2(p){6 8="n";8+=8.P();p=$.d({4:8},p);7 3.b(2(){$(3).f(p)})};$.c.t=2(p){6 m="A";p=$.d({4:m},p);7 3.b(2(){$(3).f(p)})}})(C);',53,53,'||function|this|nchars|if|var|return|az|allow|ch|each|fn|extend||alphanumeric|ichars|indexOf||preventDefault||reg|nm|abcdefghijklmnopqrstuvwxyz|String||fromCharCode|charCode||alpha|ctrlKey||allcaps|for|length|split|1234567890|bind|$|contextmenu|gi|false|nocaps|replace|numeric|keypress|which|else|RegExp|new|join|toUpperCase|ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('|'),0,{}));
;(function($){$.fn.supersubs=function(options){var opts=$.extend({},$.fn.supersubs.defaults,options);return this.each(function(){var $$=$(this);var o=$.meta?$.extend({},opts,$$.data()):opts;var fontsize=$('<li id="menu-fontsize">&#8212;</li>').css({'padding':0,'position':'absolute','top':'-999em','width':'auto'}).appendTo($$).width();$('#menu-fontsize').remove();$ULs=$$.find('ul');$ULs.each(function(i){var $ul=$ULs.eq(i);var $LIs=$ul.children();var $As=$LIs.children('a');var liFloat=$LIs.css('white-space','nowrap').css('float');var emWidth=$ul.add($LIs).add($As).css({'float':'none','width':'auto'}).end().end()[0].clientWidth/fontsize;emWidth+=o.extraWidth;if(emWidth>o.maxWidth){emWidth=o.maxWidth}else if(emWidth<o.minWidth){emWidth=o.minWidth}emWidth+='em';$ul.css('width',emWidth);$LIs.css({'float':liFloat,'width':'100%','white-space':'normal'}).each(function(){var $childUl=$('>ul',this);var offsetDirection=$childUl.css('left')!==undefined?'left':'right';$childUl.css(offsetDirection,emWidth)})})})};$.fn.supersubs.defaults={minWidth:9,maxWidth:25,extraWidth:0}})(jQuery);
/* Masked Input (c) 2007-2009 Josh Bush (digitalbush.com) - Version: 1.2.2 */
(function(a){var c=(a.browser.msie?"paste":"input")+".mask";var b=(window.orientation!=undefined);a.mask={definitions:{"9":"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"}};a.fn.extend({caret:function(e,f){if(this.length==0){return}if(typeof e=="number"){f=(typeof f=="number")?f:e;return this.each(function(){if(this.setSelectionRange){this.focus();this.setSelectionRange(e,f)}else{if(this.createTextRange){var g=this.createTextRange();g.collapse(true);g.moveEnd("character",f);g.moveStart("character",e);g.select()}}})}else{if(this[0].setSelectionRange){e=this[0].selectionStart;f=this[0].selectionEnd}else{if(document.selection&&document.selection.createRange){var d=document.selection.createRange();e=0-d.duplicate().moveStart("character",-100000);f=e+d.text.length}}return{begin:e,end:f}}},unmask:function(){return this.trigger("unmask")},mask:function(j,d){if(!j&&this.length>0){var f=a(this[0]);var g=f.data("tests");return a.map(f.data("buffer"),function(l,m){return g[m]?l:null}).join("")}d=a.extend({placeholder:"_",completed:null},d);var k=a.mask.definitions;var g=[];var e=j.length;var i=null;var h=j.length;a.each(j.split(""),function(m,l){if(l=="?"){h--;e=m}else{if(k[l]){g.push(new RegExp(k[l]));if(i==null){i=g.length-1}}else{g.push(null)}}});return this.each(function(){var r=a(this);var m=a.map(j.split(""),function(x,y){if(x!="?"){return k[x]?d.placeholder:x}});var n=false;var q=r.val();r.data("buffer",m).data("tests",g);function v(x){while(++x<=h&&!g[x]){}return x}function t(x){while(!g[x]&&--x>=0){}for(var y=x;y<h;y++){if(g[y]){m[y]=d.placeholder;var z=v(y);if(z<h&&g[y].test(m[z])){m[y]=m[z]}else{break}}}s();r.caret(Math.max(i,x))}function u(y){for(var A=y,z=d.placeholder;A<h;A++){if(g[A]){var B=v(A);var x=m[A];m[A]=z;if(B<h&&g[B].test(x)){z=x}else{break}}}}function l(y){var x=a(this).caret();var z=y.keyCode;n=(z<16||(z>16&&z<32)||(z>32&&z<41));if((x.begin-x.end)!=0&&(!n||z==8||z==46)){w(x.begin,x.end)}if(z==8||z==46||(b&&z==127)){t(x.begin+(z==46?0:-1));return false}else{if(z==27){r.val(q);r.caret(0,p());return false}}}function o(B){if(n){n=false;return(B.keyCode==8)?false:null}B=B||window.event;var C=B.charCode||B.keyCode||B.which;var z=a(this).caret();if(B.ctrlKey||B.altKey||B.metaKey){return true}else{if((C>=32&&C<=125)||C>186){var x=v(z.begin-1);if(x<h){var A=String.fromCharCode(C);if(g[x].test(A)){u(x);m[x]=A;s();var y=v(x);a(this).caret(y);if(d.completed&&y==h){d.completed.call(r)}}}}}return false}function w(x,y){for(var z=x;z<y&&z<h;z++){if(g[z]){m[z]=d.placeholder}}}function s(){return r.val(m.join("")).val()}function p(y){var z=r.val();var C=-1;for(var B=0,x=0;B<h;B++){if(g[B]){m[B]=d.placeholder;while(x++<z.length){var A=z.charAt(x-1);if(g[B].test(A)){m[B]=A;C=B;break}}if(x>z.length){break}}else{if(m[B]==z[x]&&B!=e){x++;C=B}}}if(!y&&C+1<e){r.val("");w(0,h)}else{if(y||C+1>=e){s();if(!y){r.val(r.val().substring(0,C+1))}}}return(e?B:i)}if(!r.attr("readonly")){r.one("unmask",function(){r.unbind(".mask").removeData("buffer").removeData("tests")}).bind("focus.mask",function(){q=r.val();var x=p();s();setTimeout(function(){if(x==j.length){r.caret(0,x)}else{r.caret(x)}},0)}).bind("blur.mask",function(){p();if(r.val()!=q){r.change()}}).bind("keydown.mask",l).bind("keypress.mask",o).bind(c,function(){setTimeout(function(){r.caret(p(true))},0)})}p()})}})})(jQuery);

//a menu staat uit
/*
jQuery.fn.initMenu = function() {  
    return this.each(function(){
        var theMenu = $(this).get(0);
        $('.acitem', this).hide();
        $('li.expand > .acitem', this).show();
        $('li.expand > .acitem', this).prev().addClass('active');
        $('li a', this).click(
            function(e) {
                e.stopImmediatePropagation();
                var theElement = $(this).next();
                var parent = this.parentNode.parentNode;
                if($(parent).hasClass('noaccordion')) {
                    if(theElement[0] === undefined) {
                        window.location.href = this.href;
                    }
                    $(theElement).slideToggle('normal', function() {
                        if ($(this).is(':visible')) {
                            $(this).prev().addClass('active');
                        }
                        else {
                            $(this).prev().removeClass('active');
                        }    
                    });
                    return false;
                }
                else {
                    if(theElement.hasClass('acitem') && theElement.is(':visible')) {
                        if($(parent).hasClass('collapsible')) {
                            $('.acitem:visible', parent).first().slideUp('normal', 
                            function() {
                                $(this).prev().removeClass('active');
                            }
                        );
                        return false;  
                    }
                    return false;
                }
                if(theElement.hasClass('acitem') && !theElement.is(':visible')) {         
                    $('.acitem:visible', parent).first().slideUp('normal', function() {
                        $(this).prev().removeClass('active');
                    });
                    theElement.slideDown('normal', function() {
                        $(this).prev().addClass('active');
                    });
                    return false;
                }
            }
        }
    );
});
};

$(document).ready(function() {$('.menu').initMenu();});
*/

/**
 * jQuery.ScrollTo
 * Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
 * Dual licensed under MIT and GPL.
 * Date: 5/25/2009
 *
 * @projectDescription Easy element scrolling using jQuery.
 * http://flesler.blogspot.com/2007/10/jqueryscrollto.html
 * Works with jQuery +1.2.6. Tested on FF 2/3, IE 6/7/8, Opera 9.5/6, Safari 3, Chrome 1 on WinXP.
 *
 * @author Ariel Flesler
 * @version 1.4.2
 *
 * @id jQuery.scrollTo
 * @id jQuery.fn.scrollTo
 * @param {String, Number, DOMElement, jQuery, Object} target Where to scroll the matched elements.
 *	  The different options for target are:
 *		- A number position (will be applied to all axes).
 *		- A string position ('44', '100px', '+=90', etc ) will be applied to all axes
 *		- A jQuery/DOM element ( logically, child of the element to scroll )
 *		- A string selector, that will be relative to the element to scroll ( 'li:eq(2)', etc )
 *		- A hash { top:x, left:y }, x and y can be any kind of number/string like above.
*		- A percentage of the container's dimension/s, for example: 50% to go to the middle.
 *		- The string 'max' for go-to-end. 
 * @param {Number} duration The OVERALL length of the animation, this argument can be the settings object instead.
 * @param {Object,Function} settings Optional set of settings or the onAfter callback.
 *	 @option {String} axis Which axis must be scrolled, use 'x', 'y', 'xy' or 'yx'.
 *	 @option {Number} duration The OVERALL length of the animation.
 *	 @option {String} easing The easing method for the animation.
 *	 @option {Boolean} margin If true, the margin of the target element will be deducted from the final position.
 *	 @option {Object, Number} offset Add/deduct from the end position. One number for both axes or { top:x, left:y }.
 *	 @option {Object, Number} over Add/deduct the height/width multiplied by 'over', can be { top:x, left:y } when using both axes.
 *	 @option {Boolean} queue If true, and both axis are given, the 2nd axis will only be animated after the first one ends.
 *	 @option {Function} onAfter Function to be called after the scrolling ends. 
 *	 @option {Function} onAfterFirst If queuing is activated, this function will be called after the first scrolling ends.
 * @return {jQuery} Returns the same jQuery object, for chaining.
 *
 * @desc Scroll to a fixed position
 * @example $('div').scrollTo( 340 );
 *
 * @desc Scroll relatively to the actual position
 * @example $('div').scrollTo( '+=340px', { axis:'y' } );
 *
 * @dec Scroll using a selector (relative to the scrolled element)
 * @example $('div').scrollTo( 'p.paragraph:eq(2)', 500, { easing:'swing', queue:true, axis:'xy' } );
 *
 * @ Scroll to a DOM element (same for jQuery object)
 * @example var second_child = document.getElementById('container').firstChild.nextSibling;
 *			$('#container').scrollTo( second_child, { duration:500, axis:'x', onAfter:function(){
 *				alert('scrolled!!');																   
 *			}});
 *
 * @desc Scroll on both axes, to different values
 * @example $('div').scrollTo( { top: 300, left:'+=200' }, { axis:'xy', offset:-20 } );
 */
;(function( $ ){
	
	var $scrollTo = $.scrollTo = function( target, duration, settings ){
		$(window).scrollTo( target, duration, settings );
	};

	$scrollTo.defaults = {
		axis:'xy',
		duration: parseFloat($.fn.jquery) >= 1.3 ? 0 : 1
	};

	// Returns the element that needs to be animated to scroll the window.
	// Kept for backwards compatibility (specially for localScroll & serialScroll)
	$scrollTo.window = function( scope ){
		return $(window)._scrollable();
	};

	// Hack, hack, hack :)
	// Returns the real elements to scroll (supports window/iframes, documents and regular nodes)
	$.fn._scrollable = function(){
		return this.map(function(){
			var elem = this,
				isWin = !elem.nodeName || $.inArray( elem.nodeName.toLowerCase(), ['iframe','#document','html','body'] ) != -1;

				if( !isWin )
					return elem;

			var doc = (elem.contentWindow || elem).document || elem.ownerDocument || elem;
			
			return $.browser.safari || doc.compatMode == 'BackCompat' ?
				doc.body : 
				doc.documentElement;
		});
	};

	$.fn.scrollTo = function( target, duration, settings ){
		if( typeof duration == 'object' ){
			settings = duration;
			duration = 0;
		}
		if( typeof settings == 'function' )
			settings = { onAfter:settings };
			
		if( target == 'max' )
			target = 9e9;
			
		settings = $.extend( {}, $scrollTo.defaults, settings );
		// Speed is still recognized for backwards compatibility
		duration = duration || settings.speed || settings.duration;
		// Make sure the settings are given right
		settings.queue = settings.queue && settings.axis.length > 1;
		
		if( settings.queue )
			// Let's keep the overall duration
			duration /= 2;
		settings.offset = both( settings.offset );
		settings.over = both( settings.over );

		return this._scrollable().each(function(){
			var elem = this,
				$elem = $(elem),
				targ = target, toff, attr = {},
				win = $elem.is('html,body');

			switch( typeof targ ){
				// A number will pass the regex
				case 'number':
				case 'string':
					if( /^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(targ) ){
						targ = both( targ );
						// We are done
						break;
					}
					// Relative selector, no break!
					targ = $(targ,this);
				case 'object':
					// DOMElement / jQuery
					if( targ.is || targ.style )
						// Get the real position of the target 
						toff = (targ = $(targ)).offset();
			}
			$.each( settings.axis.split(''), function( i, axis ){
				var Pos	= axis == 'x' ? 'Left' : 'Top',
					pos = Pos.toLowerCase(),
					key = 'scroll' + Pos,
					old = elem[key],
					max = $scrollTo.max(elem, axis);

				if( toff ){// jQuery / DOMElement
					attr[key] = toff[pos] + ( win ? 0 : old - $elem.offset()[pos] );

					// If it's a dom element, reduce the margin
					if( settings.margin ){
						attr[key] -= parseInt(targ.css('margin'+Pos)) || 0;
						attr[key] -= parseInt(targ.css('border'+Pos+'Width')) || 0;
					}
					
					attr[key] += settings.offset[pos] || 0;
					
					if( settings.over[pos] )
						// Scroll to a fraction of its width/height
						attr[key] += targ[axis=='x'?'width':'height']() * settings.over[pos];
				}else{ 
					var val = targ[pos];
					// Handle percentage values
					attr[key] = val.slice && val.slice(-1) == '%' ? 
						parseFloat(val) / 100 * max
						: val;
				}

				// Number or 'number'
				if( /^\d+$/.test(attr[key]) )
					// Check the limits
					attr[key] = attr[key] <= 0 ? 0 : Math.min( attr[key], max );

				// Queueing axes
				if( !i && settings.queue ){
					// Don't waste time animating, if there's no need.
					if( old != attr[key] )
						// Intermediate animation
						animate( settings.onAfterFirst );
					// Don't animate this axis again in the next iteration.
					delete attr[key];
				}
			});

			animate( settings.onAfter );			

			function animate( callback ){
				$elem.animate( attr, duration, settings.easing, callback && function(){
					callback.call(this, target, settings);
				});
			};

		}).end();
	};
	
	// Max scrolling position, works on quirks mode
	// It only fails (not too badly) on IE, quirks mode.
	$scrollTo.max = function( elem, axis ){
		var Dim = axis == 'x' ? 'Width' : 'Height',
			scroll = 'scroll'+Dim;
		
		if( !$(elem).is('html,body') )
			return elem[scroll] - $(elem)[Dim.toLowerCase()]();
		
		var size = 'client' + Dim,
			html = elem.ownerDocument.documentElement,
			body = elem.ownerDocument.body;

		return Math.max( html[scroll], body[scroll] ) 
			 - Math.min( html[size]  , body[size]   );
			
	};

	function both( val ){
		return typeof val == 'object' ? val : { top:val, left:val };
	};

})( jQuery );
