(function($){$.gaTrack=function(code,opts){opts=jQuery.extend({download:'/downloads/',extensions:['pdf','doc','xls','csv','jpg','gif','mp3','swf','txt','ppt','zip','gz','dmg','xml'],cd_active:false,cd_domainname:"none"},opts);function addTracking(){var pageTracker=_gat._getTracker(code);if(opts.cd_active){pageTracker._setDomainName(opts.cd_domainname);if(opts.cd_domainname=="none"){pageTracker._setAllowLinker(true)}else if(opts.cd_domainname.substr(0,1)=="."){pageTracker._setAllowHash(false)}};pageTracker._initData();pageTracker._trackPageview();$('a').each(function(){var _self=$(this);var u=$(this).attr('href');var isDownload=false;if(typeof(u)!='undefined'){if(u.indexOf("?")!=-1){uext=u.substring(0,u.lastIndexOf("?"))}else{uext=u};var ext=uext.split('.')[uext.split('.').length-1];var exts=opts.extensions;for(i=0;i<exts.length;i++){if(ext==exts[i]){_self.click(function(){pageTracker._trackPageview(opts.download+cleanURL(_self.attr('href')))});isDownload=true;break}};if(!isDownload&&opts.cd_active&&(opts.cd_domainname=="none")){$(this).click(function(){pageTracker._link(u);return false})}}})};function cleanURL(link_href){return link_href.replace(/..\//g,"")};function initGA(){try{var gaURL=(location.href.indexOf('https')==0?'https://ssl':'http://www');gaURL+='.google-analytics.com/ga.js';$.getScript(gaURL,function(){addTracking()})}catch(err){console.log('Failed to load Google Analytics:'+err)}};initGA()}})(jQuery);
(function($){$.fn.center=function(options){var pos={top:function(){return window.pageYOffset||document.documentElement&&document.documentElement.scrollTop||document.body.scrollTop},height:function(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body.clientHeight}};return this.each(function(index){if(index==0){var $this=$(this);var height=$this.height();var top=pos.top()+(pos.height()/2)-(height/2);$this.css({position:'absolute',marginTop:'0',top:top})}})}})(jQuery);
function Pager(target){var $target=jQuery(target+' .content ul');var $count=jQuery(target+' .count');var $pager=jQuery(target+' .pager');var view=$target.parent().height();var count=1;normal=$target.height()/view;fixed=parseInt(normal.toFixed(0));var delimeter=0;if(normal>fixed)delimeter=fixed+1;else delimeter=fixed;$count.attr('class','count '+'number-'+delimeter);function number(index){jQuery(target+' .index').attr('class','index '+'number-'+index)}bind();function bind(){$pager.find('a').bind('click',binded)}function unbind(){$pager.find('a').unbind('click',binded)}function active(action){if(action=='prev')if((count)==1)return false;if(action=='next')if((count)==delimeter)return false;return true}function move(action,$self){$self.attr('class','');if(action=='prev'){count--;if(count==1)$self.attr('class','prev-end')}if(action=='next'){count++;if(count==delimeter)$self.attr('class','next-end')}position=(count-1)*view;number(count);$target.animate({'marginTop':-position},300)}function binded(){var name=jQuery(this).attr('class');var $parent=jQuery(this).parent();switch(name){case'prev':if(active('prev'))move('prev',$parent);break;case'next':if(active('next'))move('next',$parent)}return false}}
function Loader(image,target){var oimage=new Image();var ration;oimage.onload=function(){var width=oimage.width;var height=oimage.height;if(width>height){if(width>980){height=height/(width/980);width=980}}if(height>width){if(height>500){width=width/(height/500);height=500}}var $image=jQuery(target).find('.image');jQuery('#layer a').attr('href',image.href);$image.attr('title',image.title);var $source=jQuery('<img src="'+image.src+'" />');$source.attr('width',width).attr('height',height).appendTo($image);resize(width,height);oimage.onload=function(){}};oimage.src=image.src;function resize(wwidth,wheight){var left=wwidth/2;var top=wheight/6;var top=((wheight-333))/2;jQuery(target).animate({width:wwidth,height:wheight+0,marginLeft:-left,marginTop:-top,left:'50%',opacity:1},300,function(){})}}
function Close(){jQuery('#overlay, #layer a').click(function(){jQuery('#layer').fadeOut('120',function(){jQuery('#overlay').fadeOut('60',function(){jQuery('#layer').remove();jQuery('#overlay').remove()})});return false})};
function Windows(){var container='#window';var overlay='#overlay';var curent=this;this.handler;this.editor;this.closeAction;this.openAction;this.closeElement;this.openElement;this.init=function(content){var values={'height':jQuery('body').height(),'width':jQuery('body').width()};jQuery('<div id="overlay"></div>').animate({opacity:0},0).prependTo('body').css(values).animate({opacity:0.6},180,function(){jQuery(content).animate({opacity:0},0).prependTo('body').animate({opacity:1},260,function(){if(jQuery.browser.msie)this.style.removeAttribute('filter');curent.openAction();curent.prepareClose()}).center()})};this.open=function(element,request,action){if(typeof action==='function'){curent.openAction=function(){action()}}else{curent.openAction=function(){return true}}curent.requestAction=function(){request()};jQuery(element).live('click',function(){curent.openElement=this;return openEach(this)})};var openEach=function(element){curent.handler=jQuery(element).attr('rel');curent.requestAction();return false};this.close=function(element,action){if(typeof action==='function'){curent.closeAction=function(){action()}}else{curent.closeAction=function(){return true}}curent.prepareClose=function(){jQuery(element+', '+overlay).bind('click',function(){curent.closeElement=this;return closeEach()})}};var closeEach=function(){curent.closeAction();jQuery(container).fadeOut(130,function(){jQuery(container).remove();jQuery(overlay).fadeOut(90,function(){jQuery(overlay).remove()})});return false};this.terminate=function(){closeEach()};this.projection=function(){curent.requestAction()}}

