/* 
   Simple JQuery Accordion menu.
   HTML structure to use:

   <ul id="menu">
     <li><a href="#">Sub menu heading</a>
     <ul>
       <li><a href="http://site.com/">Link</a></li>
       <li><a href="http://site.com/">Link</a></li>
       <li><a href="http://site.com/">Link</a></li>
       ...
       ...
     </ul>
     <li><a href="#">Sub menu heading</a>
     <ul>
       <li><a href="http://site.com/">Link</a></li>
       <li><a href="http://site.com/">Link</a></li>
       <li><a href="http://site.com/">Link</a></li>
       ...
       ...
     </ul>
     ...
     ...
   </ul>

Copyright 2007 by Marco van Hylckama Vlieg

web: http://www.i-marco.nl/weblog/
email: marco@i-marco.nl

Free for non-commercial use
*/

function initMenu() {
  $('#menu ul').hide();
  $('#menu ul:first').show();
  $('#menu li a').click(
    function() {
      var checkElement = $(this).next();
      if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
        return false;
        }
      if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
        $('#menu ul:visible').slideUp('normal');
        checkElement.slideDown('normal');
        return false;
        }
      }
    );
  }
$(document).ready(function() {initMenu();});

/*
 * 	Easy Slider 1.5 - jQuery plugin
 *	written by Alen Grakalic	
 *	http://cssglobe.com/post/4004/easy-slider-15-the-easiest-jquery-plugin-for-sliding
 *
 *	Copyright (c) 2009 Alen Grakalic (http://cssglobe.com)
 *	Dual licensed under the MIT (MIT-LICENSE.txt)
 *	and GPL (GPL-LICENSE.txt) licenses.
 *
 *	Built for jQuery library
 *	http://jquery.com
 *
 */
 
/*
 *	markup example for $("#slider").easySlider();
 *	
 * 	<div id="slider">
 *		<ul>
 *			<li><img src="images/01.jpg" alt="" /></li>
 *			<li><img src="images/02.jpg" alt="" /></li>
 *			<li><img src="images/03.jpg" alt="" /></li>
 *			<li><img src="images/04.jpg" alt="" /></li>
 *			<li><img src="images/05.jpg" alt="" /></li>
 *		</ul>
 *	</div>
 *
 */

(function($) {

	$.fn.easySlider = function(options){
	  
		// default configuration properties
		var defaults = {			
			prevId: 		'prevBtn',
			prevText: 		'',
			nextId: 		'nextBtn',	
			nextText: 		'',
			controlsShow:	true,
			controlsBefore:	'',
			controlsAfter:	'',	
			controlsFade:	true,
			firstId: 		'firstBtn',
			firstText: 		'First',
			firstShow:		false,
			lastId: 		'lastBtn',	
			lastText: 		'Last',
			lastShow:		false,				
			vertical:		false,
			speed: 			1400,
			auto:			false,
			pause:			3000,
			continuous:		false
		}; 
		
		var options = $.extend(defaults, options);  
				
		this.each(function() {  
			var obj = $(this); 				
			var s = $("li", obj).length;
			var w = $("li", obj).width(); 
			var h = $("li", obj).height(); 
			obj.width(w); 
			obj.height(h); 
			obj.css("overflow","hidden");
			var ts = s-1;
			var t = 0;
			$("ul", obj).css('width',s*w);			
			if(!options.vertical) $("li", obj).css('float','left');
			
			if(options.controlsShow){
				var html = options.controlsBefore;
				if(options.firstShow) html += '<span id="'+ options.firstId +'"><a href=\"javascript:void(0);\">'+ options.firstText +'</a></span>';
				html += ' <span id="'+ options.prevId +'"><a href=\"javascript:void(0);\">'+ options.prevText +'</a></span>';
				html += ' <span id="'+ options.nextId +'"><a href=\"javascript:void(0);\">'+ options.nextText +'</a></span>';
				if(options.lastShow) html += ' <span id="'+ options.lastId +'"><a href=\"javascript:void(0);\">'+ options.lastText +'</a></span>';
				html += options.controlsAfter;						
				$(obj).after(html);										
			};
	
			$("a","#"+options.nextId).click(function(){		
				animate("next",true);
			});
			$("a","#"+options.prevId).click(function(){		
				animate("prev",true);				
			});	
			$("a","#"+options.firstId).click(function(){		
				animate("first",true);
			});				
			$("a","#"+options.lastId).click(function(){		
				animate("last",true);				
			});		
			
			function animate(dir,clicked){
				var ot = t;				
				switch(dir){
					case "next":
						t = (ot>=ts) ? (options.continuous ? 0 : ts) : t+1;						
						break; 
					case "prev":
						t = (t<=0) ? (options.continuous ? ts : 0) : t-1;
						break; 
					case "first":
						t = 0;
						break; 
					case "last":
						t = ts;
						break; 
					default:
						break; 
				};	
				
				var diff = Math.abs(ot-t);
				var speed = diff*options.speed;						
				if(!options.vertical) {
					p = (t*w*-1);
					$("ul",obj).animate(
						{ marginLeft: p }, 
						speed
					);				
				} else {
					p = (t*h*-1);
					$("ul",obj).animate(
						{ marginTop: p }, 
						speed
					);					
				};
				
				if(!options.continuous && options.controlsFade){					
					if(t==ts){
						$("a","#"+options.nextId).hide();
						$("a","#"+options.lastId).hide();
					} else {
						$("a","#"+options.nextId).show();
						$("a","#"+options.lastId).show();					
					};
					if(t==0){
						$("a","#"+options.prevId).hide();
						$("a","#"+options.firstId).hide();
					} else {
						$("a","#"+options.prevId).show();
						$("a","#"+options.firstId).show();
					};					
				};				
				
				if(clicked) clearTimeout(timeout);
				if(options.auto && dir=="next" && !clicked){;
					timeout = setTimeout(function(){
						animate("next",false);
					},diff*options.speed+options.pause);
				};
				
			};
			// init
			var timeout;
			if(options.auto){;
				timeout = setTimeout(function(){
					animate("next",false);
				},options.pause);
			};		
		
			if(!options.continuous && options.controlsFade){					
				$("a","#"+options.prevId).hide();
				$("a","#"+options.firstId).hide();				
			};				
			
		});
	  
	};

})(jQuery);

/**
 *
 * Zoomimage
 * Author: Stefan Petre www.eyecon.ro
 * 
 */
(function($){
	var EYE = window.EYE = function() {
		var _registered = {
			init: []
		};
		return {
			init: function() {
				$.each(_registered.init, function(nr, fn){
					fn.call();
				});
			},
			extend: function(prop) {
				for (var i in prop) {
					if (prop[i] != undefined) {
						this[i] = prop[i];
					}
				}
			},
			register: function(fn, type) {
				if (!_registered[type]) {
					_registered[type] = [];
				}
				_registered[type].push(fn);
			}
		};
	}();
	$(EYE.init);
})(jQuery);

/**
 *
 * Utilities
 * Author: Stefan Petre www.eyecon.ro
 * 
 */
(function($) {
EYE.extend({
	getPosition : function(e, forceIt)
	{
		var x = 0;
		var y = 0;
		var es = e.style;
		var restoreStyles = false;
		if (forceIt && jQuery.curCSS(e,'display') == 'none') {
			var oldVisibility = es.visibility;
			var oldPosition = es.position;
			restoreStyles = true;
			es.visibility = 'hidden';
			es.display = 'block';
			es.position = 'absolute';
		}
		var el = e;
		if (el.getBoundingClientRect) { // IE
			var box = el.getBoundingClientRect();
			x = box.left + Math.max(document.documentElement.scrollLeft, document.body.scrollLeft) - 2;
			y = box.top + Math.max(document.documentElement.scrollTop, document.body.scrollTop) - 2;
		} else {
			x = el.offsetLeft;
			y = el.offsetTop;
			el = el.offsetParent;
			if (e != el) {
				while (el) {
					x += el.offsetLeft;
					y += el.offsetTop;
					el = el.offsetParent;
				}
			}
			if (jQuery.browser.safari && jQuery.curCSS(e, 'position') == 'absolute' ) {
				x -= document.body.offsetLeft;
				y -= document.body.offsetTop;
			}
			el = e.parentNode;
			while (el && el.tagName.toUpperCase() != 'BODY' && el.tagName.toUpperCase() != 'HTML') 
			{
				if (jQuery.curCSS(el, 'display') != 'inline') {
					x -= el.scrollLeft;
					y -= el.scrollTop;
				}
				el = el.parentNode;
			}
		}
		if (restoreStyles == true) {
			es.display = 'none';
			es.position = oldPosition;
			es.visibility = oldVisibility;
		}
		return {x:x, y:y};
	},
	getSize : function(e)
	{
		var w = parseInt(jQuery.curCSS(e,'width'), 10);
		var h = parseInt(jQuery.curCSS(e,'height'), 10);
		var wb = 0;
		var hb = 0;
		if (jQuery.curCSS(e, 'display') != 'none') {
			wb = e.offsetWidth;
			hb = e.offsetHeight;
		} else {
			var es = e.style;
			var oldVisibility = es.visibility;
			var oldPosition = es.position;
			es.visibility = 'hidden';
			es.display = 'block';
			es.position = 'absolute';
			wb = e.offsetWidth;
			hb = e.offsetHeight;
			es.display = 'none';
			es.position = oldPosition;
			es.visibility = oldVisibility;
		}
		return {w:w, h:h, wb:wb, hb:hb};
	},
	getClient : function(e)
	{
		var h, w;
		if (e) {
			w = e.clientWidth;
			h = e.clientHeight;
		} else {
			var de = document.documentElement;
			w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
			h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight;
		}
		return {w:w,h:h};
	},
	getScroll : function (e)
	{
		var t=0, l=0, w=0, h=0, iw=0, ih=0;
		if (e && e.nodeName.toLowerCase() != 'body') {
			t = e.scrollTop;
			l = e.scrollLeft;
			w = e.scrollWidth;
			h = e.scrollHeight;
		} else  {
			if (document.documentElement) {
				t = document.documentElement.scrollTop;
				l = document.documentElement.scrollLeft;
				w = document.documentElement.scrollWidth;
				h = document.documentElement.scrollHeight;
			} else if (document.body) {
				t = document.body.scrollTop;
				l = document.body.scrollLeft;
				w = document.body.scrollWidth;
				h = document.body.scrollHeight;
			}
			if (typeof pageYOffset != 'undefined') {
				t = pageYOffset;
				l = pageXOffset;
			}
			iw = self.innerWidth||document.documentElement.clientWidth||document.body.clientWidth||0;
			ih = self.innerHeight||document.documentElement.clientHeight||document.body.clientHeight||0;
		}
		return { t: t, l: l, w: w, h: h, iw: iw, ih: ih };
	},
	getMargins : function(e, toInteger)
	{
		var t = jQuery.curCSS(e,'marginTop') || '';
		var r = jQuery.curCSS(e,'marginRight') || '';
		var b = jQuery.curCSS(e,'marginBottom') || '';
		var l = jQuery.curCSS(e,'marginLeft') || '';
		if (toInteger)
			return {
				t: parseInt(t, 10)||0,
				r: parseInt(r, 10)||0,
				b: parseInt(b, 10)||0,
				l: parseInt(l, 10)
			};
		else
			return {t: t, r: r,	b: b, l: l};
	},
	getPadding : function(e, toInteger)
	{
		var t = jQuery.curCSS(e,'paddingTop') || '';
		var r = jQuery.curCSS(e,'paddingRight') || '';
		var b = jQuery.curCSS(e,'paddingBottom') || '';
		var l = jQuery.curCSS(e,'paddingLeft') || '';
		if (toInteger)
			return {
				t: parseInt(t, 10)||0,
				r: parseInt(r, 10)||0,
				b: parseInt(b, 10)||0,
				l: parseInt(l, 10)
			};
		else
			return {t: t, r: r,	b: b, l: l};
	},
	getBorder : function(e, toInteger)
	{
		var t = jQuery.curCSS(e,'borderTopWidth') || '';
		var r = jQuery.curCSS(e,'borderRightWidth') || '';
		var b = jQuery.curCSS(e,'borderBottomWidth') || '';
		var l = jQuery.curCSS(e,'borderLeftWidth') || '';
		if (toInteger)
			return {
				t: parseInt(t, 10)||0,
				r: parseInt(r, 10)||0,
				b: parseInt(b, 10)||0,
				l: parseInt(l, 10)||0
			};
		else
			return {t: t, r: r,	b: b, l: l};
	},
	traverseDOM : function(nodeEl, func)
	{
		func(nodeEl);
		nodeEl = nodeEl.firstChild;
		while(nodeEl){
			EYE.traverseDOM(nodeEl, func);
			nodeEl = nodeEl.nextSibling;
		}
	},
	getInnerWidth :  function(el, scroll) {
		var offsetW = el.offsetWidth;
		return scroll ? Math.max(el.scrollWidth,offsetW) - offsetW + el.clientWidth:el.clientWidth;
	},
	getInnerHeight : function(el, scroll) {
		var offsetH = el.offsetHeight;
		return scroll ? Math.max(el.scrollHeight,offsetH) - offsetH + el.clientHeight:el.clientHeight;
	},
	getExtraWidth : function(el) {
		if($.boxModel)
			return (parseInt($.curCSS(el, 'paddingLeft'))||0)
				+ (parseInt($.curCSS(el, 'paddingRight'))||0)
				+ (parseInt($.curCSS(el, 'borderLeftWidth'))||0)
				+ (parseInt($.curCSS(el, 'borderRightWidth'))||0);
		return 0;
	},
	getExtraHeight : function(el) {
		if($.boxModel)
			return (parseInt($.curCSS(el, 'paddingTop'))||0)
				+ (parseInt($.curCSS(el, 'paddingBottom'))||0)
				+ (parseInt($.curCSS(el, 'borderTopWidth'))||0)
				+ (parseInt($.curCSS(el, 'borderBottomWidth'))||0);
		return 0;
	},
	isChildOf: function(parentEl, el, container) {
		if (parentEl == el) {
			return true;
		}
		if (!el || !el.nodeType || el.nodeType != 1) {
			return false;
		}
		if (parentEl.contains && !$.browser.safari) {
			return parentEl.contains(el);
		}
		if ( parentEl.compareDocumentPosition ) {
			return !!(parentEl.compareDocumentPosition(el) & 16);
		}
		var prEl = el.parentNode;
		while(prEl && prEl != container) {
			if (prEl == parentEl)
				return true;
			prEl = prEl.parentNode;
		}
		return false;
	},
	centerEl : function(el, axis)
	{
		var clientScroll = EYE.getScroll();
		var size = EYE.getSize(el);
		if (!axis || axis == 'vertically')
			$(el).css(
				{
					top: clientScroll.t + ((Math.min(clientScroll.h,clientScroll.ih) - size.hb)/2) + 'px'
				}
			);
		if (!axis || axis == 'horizontally')
			$(el).css(
				{
					left: clientScroll.l + ((Math.min(clientScroll.w,clientScroll.iw) - size.wb)/2) + 'px'
				}
			);
	}
});
if (!$.easing.easeout) {
	$.easing.easeout = function(p, n, firstNum, delta, duration) {
		return -delta * ((n=n/duration-1)*n*n*n - 1) + firstNum;
	};
}
	
})(jQuery);

/* Copyright (c) 2006 Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
 * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
 *
 * $LastChangedDate: 2007-12-14 23:57:10 -0600 (Fri, 14 Dec 2007) $
 * $Rev: 4163 $
 *
 * Version: 3.0
 * 
 * Requires: $ 1.2.2+
 */
(function($){$.event.special.mousewheel={setup:function(){var handler=$.event.special.mousewheel.handler;if($.browser.mozilla)$(this).bind('mousemove.mousewheel',function(event){$.data(this,'mwcursorposdata',{pageX:event.pageX,pageY:event.pageY,clientX:event.clientX,clientY:event.clientY});});if(this.addEventListener)this.addEventListener(($.browser.mozilla?'DOMMouseScroll':'mousewheel'),handler,false);else
this.onmousewheel=handler;},teardown:function(){var handler=$.event.special.mousewheel.handler;$(this).unbind('mousemove.mousewheel');if(this.removeEventListener)this.removeEventListener(($.browser.mozilla?'DOMMouseScroll':'mousewheel'),handler,false);else
this.onmousewheel=function(){};$.removeData(this,'mwcursorposdata');},handler:function(event){var args=Array.prototype.slice.call(arguments,1);event=$.event.fix(event||window.event);$.extend(event,$.data(this,'mwcursorposdata')||{});var delta=0,returnValue=true;if(event.wheelDelta)delta=event.wheelDelta/120;if(event.detail)delta=-event.detail/3;if($.browser.opera)delta=-event.wheelDelta;event.data=event.data||{};event.type="mousewheel";args.unshift(delta);args.unshift(event);return $.event.handle.apply(this,args);}};$.fn.extend({mousewheel:function(fn){return fn?this.bind("mousewheel",fn):this.trigger("mousewheel");},unmousewheel:function(fn){return this.unbind("mousewheel",fn);}});})(jQuery);

/**
 * jquery.scrollable 1.0.2. Put your HTML scroll.
 * 
 * Copyright (c) 2009 Tero Piirainen
 * http://flowplayer.org/tools/scrollable.html
 *
 * Dual licensed under MIT and GPL 2+ licenses
 * http://www.opensource.org/licenses
 *
 * Launch  : March 2008
 * Version : 1.0.2 - Tue Feb 24 2009 10:52:04 GMT-0000 (GMT+00:00)
 */
(function($){function fireEvent(opts,name,self,arg){var fn=opts[name];if($.isFunction(fn)){try{return fn.call(self,arg);}catch(error){if(opts.alert){alert("Error calling scrollable."+name+": "+error);}else{throw error;}return false;}}return true;}var current=null;function Scrollable(root,conf){var self=this;if(!current){current=self;}var horizontal=!conf.vertical;var wrap=$(conf.items,root);var index=0;var navi=root.siblings(conf.navi).eq(0);var prev=root.siblings(conf.prev).eq(0);var next=root.siblings(conf.next).eq(0);var prevPage=root.siblings(conf.prevPage).eq(0);var nextPage=root.siblings(conf.nextPage).eq(0);$.extend(self,{getVersion:function(){return[1,0,1];},getIndex:function(){return index;},getConf:function(){return conf;},getSize:function(){return self.getItems().size();},getPageAmount:function(){return Math.ceil(this.getSize()/conf.size);},getPageIndex:function(){return Math.ceil(index/conf.size);},getRoot:function(){return root;},getItemWrap:function(){return wrap;},getItems:function(){return wrap.children();},seekTo:function(i,time,fn){time=time||conf.speed;if($.isFunction(time)){fn=time;time=conf.speed;}if(i<0){i=0;}if(i>self.getSize()-conf.size){return self;}var item=self.getItems().eq(i);if(!item.length){return self;}if(fireEvent(conf,"onBeforeSeek",self,i)===false){return self;}if(horizontal){var left=-(item.outerWidth(true)*i);wrap.animate({left:left},time,conf.easing,fn?function(){fn.call(self);}:null);}else{var top=-(item.outerHeight(true)*i);wrap.animate({top:top},time,conf.easing,fn?function(){fn.call(self);}:null);}if(navi.length){var klass=conf.activeClass;var page=Math.ceil(i/conf.size);page=Math.min(page,navi.children().length-1);navi.children().removeClass(klass).eq(page).addClass(klass);}if(i===0){prev.add(prevPage).addClass(conf.disabledClass);}else{prev.add(prevPage).removeClass(conf.disabledClass);}if(i>=self.getSize()-conf.size){next.add(nextPage).addClass(conf.disabledClass);}else{next.add(nextPage).removeClass(conf.disabledClass);}current=self;index=i;fireEvent(conf,"onSeek",self,i);return self;},move:function(offset,time,fn){var to=index+offset;if(conf.loop&&to>(self.getSize()-conf.size)){to=0;}return this.seekTo(to,time,fn);},next:function(time,fn){return this.move(1,time,fn);},prev:function(time,fn){return this.move(-1,time,fn);},movePage:function(offset,time,fn){return this.move(conf.size*offset,time,fn);},setPage:function(page,time,fn){var size=conf.size;var index=size*page;var lastPage=index+size>=this.getSize();if(lastPage){index=this.getSize()-conf.size;}return this.seekTo(index,time,fn);},prevPage:function(time,fn){return this.setPage(this.getPageIndex()-1,time,fn);},nextPage:function(time,fn){return this.setPage(this.getPageIndex()+1,time,fn);},begin:function(time,fn){return this.seekTo(0,time,fn);},end:function(time,fn){return this.seekTo(this.getSize()-conf.size,time,fn);},reload:function(){return load();},click:function(index,time,fn){var item=self.getItems().eq(index);var klass=conf.activeClass;if(!item.hasClass(klass)&&(index>=0||index<this.getSize())){self.getItems().removeClass(klass);item.addClass(klass);var delta=Math.floor(conf.size/2);var to=index-delta;if(to>self.getSize()-conf.size){to--;}if(to!==index){return this.seekTo(to,time,fn);}}return self;}});if($.isFunction($.fn.mousewheel)){root.bind("mousewheel.scrollable",function(e,delta){var step=$.browser.opera?1:-1;self.move(delta>0?step:-step,50);return false;});}prev.addClass(conf.disabledClass).mouseover(function(){self.prev();});next.mouseover(function(){self.next();});prev.addClass(conf.disabledClass).click(function(){self.prev();});next.click(function(){self.next();});nextPage.click(function(){self.nextPage();});prevPage.addClass(conf.disabledClass).click(function(){self.prevPage();});if(conf.keyboard){$(window).unbind("keypress.scrollable").bind("keypress.scrollable",function(evt){var el=current;if(!el){return;}if(horizontal&&(evt.keyCode==37||evt.keyCode==39)){el.move(evt.keyCode==37?-1:1);return evt.preventDefault();}if(!horizontal&&(evt.keyCode==38||evt.keyCode==40)){el.move(evt.keyCode==38?-1:1);return evt.preventDefault();}return true;});}function load(){navi.each(function(){var nav=$(this);if(nav.is(":empty")||nav.data("me")==self){nav.empty();nav.data("me",self);for(var i=0;i<self.getPageAmount();i++){var item=$("<"+conf.naviItem+"/>").attr("href",i).click(function(e){var el=$(this);el.parent().children().removeClass(conf.activeClass);el.addClass(conf.activeClass);self.setPage(el.attr("href"));return e.preventDefault();});if(i===0){item.addClass(conf.activeClass);}nav.append(item);}}else{var els=nav.children();els.each(function(i){var item=$(this);item.attr("href",i);if(i===0){item.addClass(conf.activeClass);}item.click(function(){nav.find("."+conf.activeClass).removeClass(conf.activeClass);item.addClass(conf.activeClass);self.setPage(item.attr("href"));});});}});if(conf.clickable){self.getItems().each(function(index,arg){var el=$(this);if(!el.data("set")){el.bind("click.scrollable",function(){self.click(index);});el.data("set",true);}});}if(conf.hoverClass){self.getItems().hover(function(){$(this).addClass(conf.hoverClass);},function(){$(this).removeClass(conf.hoverClass);});}return self;}load();var timer=null;function setTimer(){timer=setInterval(function(){self.next();},conf.interval);}if(conf.interval>0){root.hover(function(){clearInterval(timer);},function(){setTimer();});setTimer();}}jQuery.prototype.scrollable=function(conf){var api=this.eq(typeof conf=='number'?conf:0).data("scrollable");if(api){return api;}var opts={size:5,vertical:false,clickable:true,loop:false,interval:0,speed:400,keyboard:true,activeClass:'active',disabledClass:'disabled',hoverClass:null,easing:'swing',items:'.items',prev:'.prev',next:'.next',prevPage:'.prevPage',nextPage:'.nextPage',navi:'.navi',naviItem:'a',onBeforeSeek:null,onSeek:null,alert:true};$.extend(opts,conf);this.each(function(){var el=new Scrollable($(this),opts);$(this).data("scrollable",el);});return this;};})(jQuery);

/* select */
(function($){var l={preloadImg:true};var m=false;var n=function(a){a=a.replace(/^url\((.*)\)/,'$1').replace(/^\"(.*)\"$/,'$1');var b=new Image();b.src=a.replace(/\.([a-zA-Z]*)$/,'-hover.$1');var c=new Image();c.src=a.replace(/\.([a-zA-Z]*)$/,'-focus.$1')};var o=function(a){var b=$(a.get(0).form);var c=a.next();if(!c.is('label')){c=a.prev();if(c.is('label')){var d=a.attr('id');if(d){c=b.find('label[for="'+d+'"]')}}}if(c.is('label')){return c.css('cursor','pointer')}return false};var p=function(b){var c=$('.jqTransformSelectWrapper ul:visible');c.each(function(){var a=$(this).parents(".jqTransformSelectWrapper:first").find("select").get(0);if(!(b&&a.oLabel&&a.oLabel.get(0)==b.get(0))){$(this).hide()}})};var q=function(a){if($(a.target).parents('.jqTransformSelectWrapper').length===0){p($(a.target))}};var r=function(){$(document).mousedown(q)};var s=function(f){var a;$('.jqTransformSelectWrapper select',f).each(function(){a=(this.selectedIndex<0)?0:this.selectedIndex;$('ul',$(this).parent()).each(function(){$('a:eq('+a+')',this).click()})});$('a.jqTransformCheckbox, a.jqTransformRadio',f).removeClass('jqTransformChecked');$('input:checkbox, input:radio',f).each(function(){if(this.checked){$('a',$(this).parent()).addClass('jqTransformChecked')}})};$.fn.jqTransInputButton=function(){return this.each(function(){$(this).replaceWith('<button id="'+this.id+'" name="'+this.name+'" type="'+this.type+'" class="'+this.className+' jqTransformButton"><span><span>'+$(this).attr('value')+'</span></span>')})};$.fn.jqTransInputText=function(){return this.each(function(){var a=$.browser.safari;var b=$(this);if(b.hasClass('jqtranformdone')||!b.is('input')){return}b.addClass('jqtranformdone');var c=o($(this));c&&c.bind('click',function(){b.focus()});var d=b.width();if(b.attr('size')){d=b.attr('size')*10;b.css('width',d)}b.addClass("jqTransformInput").wrap('<div class="jqTransformInputWrapper"><div class="jqTransformInputInner"><div></div></div></div>');var e=b.parent().parent().parent();e.css("width",d+10);b.focus(function(){e.addClass("jqTransformInputWrapper_focus")}).blur(function(){e.removeClass("jqTransformInputWrapper_focus")}).hover(function(){e.addClass("jqTransformInputWrapper_hover")},function(){e.removeClass("jqTransformInputWrapper_hover")});a&&e.addClass('jqTransformSafari');a&&b.css('width',e.width()+16);this.wrapper=e})};$.fn.jqTransCheckBox=function(){return this.each(function(){var b=$(this);var c=this;if(b.hasClass('jqTransformHidden')){return}var d=o(b);b.addClass('jqTransformHidden').wrap('<span class="jqTransformCheckboxWrapper"></span>');var e=b.parent();var f=$('<a href="#" class="jqTransformCheckbox"></a>');e.prepend(f);f.click(function(){var a=$(this);if(c.checked===true){c.checked=false;a.removeClass('jqTransformChecked')}else{c.checked=true;a.addClass('jqTransformChecked')}c.onchange&&c.onchange();return false});d&&d.click(function(){f.trigger('click')});this.checked&&f.addClass('jqTransformChecked')})};$.fn.jqTransRadio=function(){return this.each(function(){var b=$(this);var c=this;if(b.hasClass('jqTransformHidden')){return}oLabel=o(b);b.addClass('jqTransformHidden').wrap('<span class="jqTransformRadioWrapper"></span>');var d=b.parent();var e=$('<a href="#" class="jqTransformRadio" rel="'+this.name+'"></a>');d.prepend(e);e.each(function(){this.radioElem=c;$(this).click(function(){var a=$(this).addClass('jqTransformChecked');c.checked=true;$('a.jqTransformRadio[rel="'+a.attr('rel')+'"]',c.form).not(a).each(function(){$(this).removeClass('jqTransformChecked');this.radioElem.checked=false});c.onchange&&c.onchange();return false})});oLabel&&oLabel.click(function(){e.trigger('click')});c.checked&&e.addClass('jqTransformChecked')})};$.fn.jqTransTextarea=function(){return this.each(function(){var a=$(this);if(a.hasClass('jqtransformdone')){return}a.addClass('jqtransformdone');oLabel=o(a);oLabel&&oLabel.click(function(){a.focus()});var b='<table cellspacing="0" cellpadding="0" border="0" class="jqTransformTextarea">';b+='<tr><td id="jqTransformTextarea-tl">&nbsp;</td><td id="jqTransformTextarea-tm">&nbsp;</td><td id="jqTransformTextarea-tr">&nbsp;</td></tr>';b+='<tr><td id="jqTransformTextarea-ml">&nbsp;</td><td id="jqTransformTextarea-mm"><div></div></td><td id="jqTransformTextarea-mr">&nbsp;</td></tr>';b+='<tr><td id="jqTransformTextarea-bl">&nbsp;</td><td id="jqTransformTextarea-bm">&nbsp;</td><td id="jqTransformTextarea-br">&nbsp;</td></tr>';b+='</table>';var c=$(b).insertAfter(a).hover(function(){!c.hasClass('jqTransformTextarea-focus')&&c.addClass('jqTransformTextarea-hover')},function(){c.removeClass('jqTransformTextarea-hover')});a.focus(function(){c.removeClass('jqTransformTextarea-hover').addClass('jqTransformTextarea-focus')}).blur(function(){c.removeClass('jqTransformTextarea-focus')}).appendTo($('#jqTransformTextarea-mm div',c));this.oTable=c;if($.browser.safari){$('#jqTransformTextarea-mm',c).addClass('jqTransformSafariTextarea').find('div').css('height',a.height()).css('width',a.width())}})};$.fn.jqTransSelect=function(){return this.each(function(b){var c=$(this);if(c.hasClass('jqTransformHidden')){return}var d=o(c);c.addClass('jqTransformHidden').wrap('<div class="jqTransformSelectWrapper"></div>');var e=c.parent().css({zIndex:10-b});e.prepend('<div><span></span><a href="#" class="jqTransformSelectOpen"></a></div><ul></ul>');var f=$('ul',e).css('width',c.width());$('option',this).each(function(i){var a=$('<li><a href="#" index="'+i+'">'+$(this).html()+'</a></li>');f.append(a)});f.hide().find('a').click(function(){$('a.selected',e).removeClass('selected');$(this).addClass('selected');if(c[0].selectedIndex!=$(this).attr('index')&&c[0].onchange){c[0].selectedIndex=$(this).attr('index');c[0].onchange()}c[0].selectedIndex=$(this).attr('index');$('span:eq(0)',e).html($(this).html());f.hide();return false});$('a:eq('+this.selectedIndex+')',f).click();$('span:first',e).click(function(){$("a.jqTransformSelectOpen",e).trigger('click')});d&&d.click(function(){$("a.jqTransformSelectOpen",e).trigger('click')});this.oLabel=d;var g=$('a.jqTransformSelectOpen',e).click(function(){if(f.css('display')=='none'){p()}f.slideToggle('normal',function(){var a=($('a.selected',f).offset().top-f.offset().top);f.animate({scrollTop:a})});return false});var h=c.width();var j=$('span:first',e);var k=(h>j.innerWidth())?h+g.outerWidth():e.width();e.css('width',k);f.css('width',k-2);j.css('width',h)})};$.fn.jqTransform=function(h){var i=this;var j=$.browser.safari;var k=$.extend({},l,h);return this.each(function(){var b=$(this);if(b.hasClass('jqtransformdone')){return}b.addClass('jqtransformdone');$('input:submit, input:reset, input[type="button"]',this).jqTransInputButton();$('input:text, input:password',this).jqTransInputText();$('input:checkbox',this).jqTransCheckBox();$('input:radio',this).jqTransRadio();$('textarea',this).jqTransTextarea();if($('select',this).jqTransSelect().length>0){r()}b.bind('reset',function(){var a=function(){s(this)};window.setTimeout(a,10)});if(k.preloadImg&&!m){m=true;var c=$('input:text:first',b);if(c.length>0){var d=c.get(0).wrapper.css('background-image');n(d);var e=$('div.jqTransformInputInner',$(c.get(0).wrapper)).css('background-image');n(e)}var f=$('textarea',b);if(f.length>0){var g=f.get(0).oTable;$('td',g).each(function(){var a=$(this).css('background-image');n(a)})}}})}})(jQuery);

var pictures = new Array(40);
var i;

function ch_f_page()
{
	$('a.change_files_page').click(function() {
		$('.srod_normal').fadeOut(100);
		$('.srod_normal').load(this.href,{x: 0},function(){
			$('.srod_normal').fadeIn(100);
			ch_f_page();
		});
		
		return false;
	});
}

function ch_a_page()
{
	$('a.change_archive_page').click(function() {
		$('.srodek_part1a').load(this.href,{x: 0},function(){
			$('.srodek_part1a').fadeOut(100);
			$('.srodek_part1a').fadeIn(100);
			archive_list_animations();
			ch_a_page();
		});
		
		return false;
	});
}


function ch_p_page()
{
	$('a.change_products_page').click(function() {
		$('.srodek').fadeOut(100);
		$('.srodek').load(this.href,{x: 0},function(){
			$('.srodek').fadeIn(100);
			load_products_images();
			show_screenshot(300, 250);
			show_tip();
			show_product_details();
			ch_p_page();
		});
		
		return false;
	});
}

function ch_m_page()
{
	$('.jqTransformSelectWrapper ul a').click(function() {
		$('.srodek').fadeOut(100);
		$('.srodek').load($('#change_products_modes').attr('action') + '/' + $('#products_modes').val() + '/true',{x: 0},function(){
			$('.srodek').fadeIn(100);
			load_products_images();
			show_screenshot(300, 250);
			show_tip();
			show_product_details();
			ch_m_page();
			ch_p_page();
		});
		
		return false;
	});
}

function show_screenshot(iwidth, iheight)
{
	var xOffset = 150;
	var yOffset = 10;
	var windowHeight = 0, windowWidth = 0;
	var tWidth, xWidth;
	var tHeight, xHeight;
	var tTitle;
	
	$("a.screenshot").hover(function(e){
		for ( var j = 0; j < i; ++j )
		{
			if ( pictures[j].src == this.rel )
			{
				tWidth = pictures[j].width;
				tHeight = pictures[j].height;
			}
		}
		
		this.t = this.title;
		if ( this.t == "undefined" )
		{
			this.t = "";
		}
		this.title = "";	
		var c = (this.t != "") ? "<br />" + this.t : "";
		
		if ( parseInt(iwidth) > 0 && parseInt(tWidth) > 0 )
		{
			xWidth = tWidth / iwidth;
			if ( xWidth > 1 )
			{
				tWidth = Math.round(tWidth / xWidth);
				tHeight = Math.round(tHeight / xWidth);
			}
		}
		else {
			tWidth = 0;
		}
		
		if ( parseInt(iheight) > 0 && parseInt(tHeight) > 0 )
		{
			xHeight = tHeight / iheight;
			if ( xHeight > 1 )
			{
				tHeight = Math.round(tHeight / xHeight);
				tWidth = Math.round(tWidth / xHeight);
			}
		}
		else {
			tHeight = 0;
		}
		
		$("body").append("<p id=\"screenshot\"><img src=\""+ this.rel +"\" alt=\"Wczytywanie fotografii...\"" + ( tWidth > 0 && tHeight > 0 ? " style=\"width: " + tWidth + "px; height: " + tHeight + "px;\"" : " style=\"width: " + iwidth + "px; height: " + iheight + "px;\"" ) + " />"+ c +"</p>");					
		windowHeight = Math.max(
        	$(document).height(),
        	$(window).height(),
        	document.documentElement.clientHeight
    	);
		
		windowWidth = Math.max(
        	$(document).width(),
        	$(window).width(),
        	document.documentElement.clientWidth
    	);

    	tHeight += 50;
		tWidth += 50;
		$("#screenshot")
			.css("top",( windowHeight < (e.pageY - xOffset + tHeight) ? (windowHeight - tHeight) : (e.pageY - xOffset) ) + "px")
			.css("left",( windowWidth < (e.pageX + yOffset + tWidth) ? (windowWidth - tWidth) : (e.pageX + yOffset) ) + "px")
			.fadeIn("fast");						
    },
	function(){
		this.title = this.t;	
		$("#screenshot").remove();
    });	

	$("a.screenshot").mousemove(function(e){		
		$("#screenshot")
			.css("top",( windowHeight < (e.pageY - xOffset + tHeight) ? (windowHeight - tHeight) : (e.pageY - xOffset) ) + "px")
			.css("left",( windowWidth < (e.pageX + yOffset + tWidth) ? (windowWidth - tWidth) : (e.pageX + yOffset) ) + "px")	
	});		
}

function show_tip()
{
	var productsmenu = $('.p2_pozycja');
	$('.p_mini2').css({'opacity': .5});
	
	$('.p_mini2').each(function(i) {
		$(this).mouseover(function() {
			$(productsmenu[i]).children('a').css({
				backgroundPosition: '0px 0px'
			});
			$(this).stop().animate({
				opacity: .9
			}, 500);
			$(productsmenu[i]).stop().animate({
				opacity: 1
			}, 500);
			$(productsmenu[i]).children('a').children('span').stop().animate({
				paddingLeft: '30px'
			}, 500);
		}).mouseout(function(){
			$(productsmenu[i]).children('a').css({
				backgroundPosition: '-261px 0px'
			});
			$(this).stop().animate({
				opacity: .5
			}, 500);
			$(productsmenu[i]).stop().animate({
				opacity: .5
			}, 500);
			$(productsmenu[i]).children('a').children('span').stop().animate({
				paddingLeft: '10px'
			}, 500);
		});
	});
}

function load_products_images()
{
	i = 0;
	$("a.screenshot").each(function() {
		if ( i < 40 )
		{
			pictures[i] = new Image();
			pictures[i].src = this.rel;
		}
		++i;
	});
}

function show_product_details()
{
	$('a.screenshot').click(function() {
		$('.srodek_bezpodzialow').fadeOut('slow');
		$('.srodek_na2').fadeIn('slow').load(this.href,{x: 0},function(){
			$(".produkt_biel").easySlider({
				auto: true,
				continuous: true 
			});
			$('.top_zak3').html('<a href="http://www.bossini.pl/products">&nbsp;</a>');
			$("#screenshot").remove();
		});
		
		return false;
	});
}

var lasthref;
var imgactive;
var imgpassive;
var start;
	
function archive_menu()
{
	if ( start == 1 )
	{
		lasthref = $(".akt_kmiesiac2").children('a').attr('href')
		imgactive = $('.akt_kmiesiac').children('img').attr('src')
		imgpassive = $('.akt_kmiesiac2').children('img').attr('src')
		$(".akt_kmiesiac2").children('a').replaceWith('<span>' + $(".akt_kmiesiac2").text() + '</span>');
		start = 0;
	}
	
	$(".akt_kmiesiac").click(function(){
		if ( $(this).attr('class') == 'akt_kmiesiac akt_kmiesiac2')
		{
			return false;
		}
		
		$(".akt_kmiesiac2").children('img').attr({src: imgactive});
		$(".akt_kmiesiac2").children('span').replaceWith('<a href="' + lasthref + '">' + $(".akt_kmiesiac2").text() + '</a>');
		
		lasthref = $(this).children('a').attr('href');
		
		$(this).children('a').removeAttr('href');
		$(this).children('img').attr({src: imgpassive});
		$(this).children('a').replaceWith('<span>' + $(this).text() + '</span>');
		
		$(".akt_kmiesiac2").addClass('akt_kmiesiac3');
		$(".akt_kmiesiac3").removeClass('akt_kmiesiac2');
		$(".akt_kmiesiac3").addClass('akt_kmiesiac');
		$(".akt_kmiesiac").removeClass('akt_kmiesiac3');
		
		$(this).toggleClass('akt_kmiesiac2');
		
		$('.srodek_part1a').load(lasthref,{x: 0},function(){
			$('.srodek_part1a').hide();
			$('.srodek_part1a').show();
			archive_list_animations();
			ch_a_page();
		});
		
		archive_menu();
	});
}

function archive_list_animations()
{
	$('.aktual1').click(function (){
		$(this).hide();
		$(this).next('.aktual2').fadeIn(1000);
	})
	
	$('.aktual2').click(function (){
		$(this).hide();
		$(this).prev('.aktual1').fadeIn(1000);
	})
}

$(window).load(function() {
	load_products_images();
});

$().ready(function() {
	var productsmenu = $('.p2_pozycja');
	var productsthumbs = $('.p_mini');
	var productsthumbs2 = $('.p_mini2');
	
	$('.p2_pozycja').css({'opacity': .5, 'backgroundPosition': '-261px 0px'});
	$('.p_mini').css('opacity', .5);
	$('.p_mini2').css('opacity', .5);
	
	$('.p_mini').each(function(i) {
		$(this).mouseover(function() {
			$(productsmenu[i]).children('a').css({
				backgroundPosition: '0px 0px'
			});
			$(this).stop().animate({
				opacity: .9
			}, 500);
			$(productsmenu[i]).stop().animate({
				opacity: 1
			}, 500);
			$(productsmenu[i]).children('a').children('span').stop().animate({
				paddingLeft: '30px'
			}, 500);
		}).mouseout(function(){
			$(productsmenu[i]).children('a').css({
				backgroundPosition: '-261px 0px'
			});
			$(this).stop().animate({
				opacity: .5
			}, 500);
			$(productsmenu[i]).stop().animate({
				opacity: .5
			}, 500);
			$(productsmenu[i]).children('a').children('span').stop().animate({
				paddingLeft: '10px'
			}, 500);
		});
	});
	
	show_tip();
	
	$('.p2_pozycja').each(function(i) {
		$(this).mouseover(function() {
			$(this).children('a').css({
				backgroundPosition: '0px 0px'
			});
			$(this).stop().animate({
				opacity: 1
			}, 500);
			$(this).children('a').children('span').stop().animate({
				paddingLeft: '30px'
			}, 500);
			$(productsthumbs[i]).stop().animate({
				opacity: .9
			}, 500);
			$(productsthumbs2[i]).stop().animate({
				opacity: .9
			}, 500);
		}).mouseout(function(){
			$(this).children('a').css({
				backgroundPosition: '-261px 0px'
			});
			$(this).stop().animate({
				opacity: .5
			}, 500);
			$(this).children('a').children('span').stop().animate({
				paddingLeft: '10px'
			}, 500);
			$(productsthumbs[i]).stop().animate({
				opacity: .5
			}, 500);
			$(productsthumbs2[i]).stop().animate({
				opacity: .9
			}, 500);
		});
	});
	
	show_product_details();
	
	$("div.scrollable").scrollable({
		size: 9,
		next: 'div.next', 
    	prev: 'div.prev' 
	});

	$('form#change_products_modes').jqTransform();
	
	ch_f_page();
	ch_p_page();
	ch_m_page();
	ch_a_page();
	
	$(".produkt_biel").easySlider({
		auto: true,
		continuous: true 
	});
	
	initMenu();
	
	$(".akt_rok").next().hide();
	
	$(".akt_rok").click(function(){
		$(this).next().slideToggle(500);
		$(this).toggleClass('akt_rok2');
	});
	
	$(".akt_rok2").click(function(){
		$(this).next().slideToggle(500);
		$(this).toggleClass('akt_rok');
	});
	
	start = 1;	
	archive_menu();

	archive_list_animations();
	
	show_screenshot(300, 250);
});