/**
 * Compact labels plugin
 */
(function($){$.fn.compactize=function(){return this.each(function(){var label=$(this),input=$('#'+label.attr('for'));input.focus(function(){label.hide();}).blur(function(){if(input.val()===''){label.show();}});window.setTimeout(function(){if(input.val()!==''){label.hide();}},50);});};})(jQuery);

/*
 * hrefID jQuery extention - returns a valid #hash string from link href attribute in Internet Explorer
 */
(function($){$.fn.extend({hrefId:function(){return $(this).attr('href').substr($(this).attr('href').indexOf('#'));}});})(jQuery);

/**
 * jCarouselLite - jQuery plugin to navigate images/any content in a carousel style widget.
 * @requires jQuery v1.2 or above
 *
 * http://gmarwaha.com/jquery/jcarousellite/
 *
 * Copyright (c) 2007 Ganeshji Marwaha (gmarwaha.com)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 * Version: 1.0.1
 * Note: Requires jquery 1.2 or above from version 1.0.1
 */
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}('(6($){$.1o.1q=6(o){o=$.1r({q:k,u:k,M:k,Q:t,L:k,O:1u,11:k,n:t,r:14,C:3,s:0,c:1,I:k,K:k},o||{});9 y.17(6(){m B=t,p=o.n?"16":"D",J=o.n?"w":"x";m l=$(y),a=$("a",l),E=$("8",a),15=E.Y(),v=o.C;7(o.r){a.1t(E.A(15-v-1+1).10()).1v(E.A(0,v).10());o.s+=v}m 8=$("8",a),g=8.Y(),4=o.s;l.5("1b","C");8.5({T:"R",1a:o.n?"U":"D"});a.5({19:"0",1c:"0",18:"1g","1f-1e-1h":"U","z-W":"1"});l.5({T:"R","z-W":"2"});m h=o.n?w(8):x(8);m V=h*g;m 13=h*v;8.5({x:8.x(),w:8.w()});a.5(J,V+"F").5(p,-(4*h));l.5(J,13+"F");7(o.q)$(o.q).H(6(){9 j(4-o.c)});7(o.u)$(o.u).H(6(){9 j(4+o.c)});7(o.M)$.17(o.M,6(i,P){$(P).H(6(){9 j(o.r?o.C+i:i)})});7(o.Q&&l.S)l.S(6(e,d){9 d>0?j(4-o.c):j(4+o.c)});7(o.L)1i(6(){j(4+o.c)},o.L+o.O);6 N(){9 8.A(4).A(0,v)};6 j(f){7(!B){7(o.I)o.I.X(y,N());7(o.r){7(f<=o.s-v-1){a.5(p,-((g-(v*2))*h)+"F");4=f==o.s-v-1?g-(v*2)-1:g-(v*2)-o.c}G 7(f>=g-v+1){a.5(p,-((v)*h)+"F");4=f==g-v+1?v+1:v+o.c}G 4=f}G{7(f<0||f>g-v)9;G 4=f}B=14;a.1j(p=="D"?{D:-(4*h)}:{16:-(4*h)},o.O,o.11,6(){7(o.K)o.K.X(y,N());B=t});7(!o.r){$(o.q+","+o.u).1n("Z");$((4-o.c<0&&o.q)||(4+o.c>g-v&&o.u)||[]).1p("Z")}}9 t}})};6 5(b,12){9 1m($.5(b[0],12))||0};6 x(b){9 b[0].1k+5(b,\'1l\')+5(b,\'1w\')};6 w(b){9 b[0].1x+5(b,\'1d\')+5(b,\'1s\')}})(1y);',62,97,'||||curr|css|function|if|li|return|ul|el|scroll|||to|itemLength|liSize||go|null|div|var|vertical||animCss|btnPrev|circular|start|false|btnNext||height|width|this||slice|running|visible|left|tLi|px|else|click|beforeStart|sizeCss|afterEnd|auto|btnGo|vis|speed|val|mouseWheel|hidden|mousewheel|overflow|none|ulSize|index|call|size|disabled|clone|easing|prop|divSize|true|tl|top|each|position|margin|float|visibility|padding|marginTop|style|list|relative|type|setInterval|animate|offsetWidth|marginLeft|parseInt|removeClass|fn|addClass|jCarouselLite|extend|marginBottom|prepend|200|append|marginRight|offsetHeight|jQuery'.split('|'),0,{}))

/*
 * Scripts
 *
 */
jQuery(function($) {

	var Engine = {
		utils : {
			links : function(){
				$('a[rel*=external]').click(function(e){
					e.preventDefault();
					window.open($(this).attr('href'));
				});
			},
			mails : function(){
				$('a[href^=mailto:]').each(function(){
					var mail = $(this).attr('href').replace('mailto:','');
					var replaced = mail.replace('/at/','@');
					$(this).attr('href','mailto:'+replaced);
					if($(this).text() == mail) {
						$(this).text(replaced);
					}
				});
			}
		},
		enhancements : {
			randomQuote : function() {
				var quotes = $('.quotes li'),
					array = [],
					index = 0,
					i = 0;

				var showRandomQuote = function() {
					i++;
					if(i == array.length) {
						i = 0;
					}

					index = array[i];
					quotes.filter(':visible').fadeOut(350, function() {
						quotes.filter(':eq(' + index + ')').fadeIn(500);
					});
				};

				quotes.each(function(index){
				    array.push(index);
				});

				array.sort(function() {return 0.5 - Math.random()});
				quotes.hide().filter(':eq(' + array[0] + ')').fadeIn(500);

				setInterval(function() {
					showRandomQuote();
				}, 15000);
			},
			rotator : function() {
				var products = $('.products'),	
					opacity = $.browser.msie ? 0.8 : 1;

				$('<p>', {
					'html': '<button class="prev">&larr;</button><button class="next">&rarr;</button>'
				}).appendTo(products);

			    $('> div', products).jCarouselLite({
			        btnNext: '.next',
			        btnPrev: '.prev',
			        visible: 12
			    });
			    

			    $('li', products)
			    	.find('p').css('opacity', 0).show().end()
			    	.find('img, p').hover(
				    	function(){
				    		$(this).closest('li').find('p').stop().animate({ opacity: opacity }, 350);
				    	},
				    	function(){
				    		$(this).closest('li').find('p').stop().animate({ opacity: 0 }, 350);
				    	}
			    )

			}
		}
	};

	Engine.utils.links();
	Engine.utils.mails();
	Engine.enhancements.randomQuote();
	Engine.enhancements.rotator();
});
