//Kwix, A Javascript Menu. Copyright (c) 2007 YourHead Software, <http://www.yourhead.com>
// ver 1.0 -- compressed with JSMin Conservative

function Kwix(small,medium,large,height,edgeWidth,marginTop,marginBottom,marginLeft,marginRight,wrapperId,imageName,format,bgCount,imagePosition,textPosition,backgroundSpeed,foregroundSpeed,transition){$(wrapperId).setStyle('display','none');this.small=small;this.medium=medium;this.large=large;this.height=height;this.edgeWidth=edgeWidth;this.marginTop=marginTop;this.marginBottom=marginBottom;this.marginLeft=marginLeft;this.marginRight=marginRight;this.wrapperId=wrapperId;this.imageName=imageName;this.format=format;this.bgCount=bgCount;this.imagePosition=imagePosition;this.textPosition=textPosition;this.backgroundSpeed=backgroundSpeed;this.foregroundSpeed=foregroundSpeed;this.items=$ES('li',wrapperId);this.image_items=$ES('li img',wrapperId);this.image_anchors=$ES('li h3 a',wrapperId);this.item_titles=$ES('li h3',wrapperId);this.n=this.items.length;this.errorWidth=edgeWidth;if(this.errorWidth<4)
	this.errorWidth=4;var totalWidth=((this.n)*(medium+edgeWidth));var mainWrapper=new Element('div',{'class':'kwix-inside','id':wrapperId+'_main'}).injectBefore($(wrapperId));this.baseStyle(mainWrapper);mainWrapper.setStyle('position','relative');mainWrapper.setStyle('margin-left','auto');mainWrapper.setStyle('margin-right','auto');mainWrapper.setStyle('overflow','hidden');mainWrapper.setStyle('width',totalWidth+2*this.errorWidth+'px');var bigWrapper=new Element('div',{'class':'kwix-inner-wrapper'}).injectBefore($(wrapperId));this.baseStyle(bigWrapper);bigWrapper.setStyle('position','relative');bigWrapper.setStyle('overflow','hidden');bigWrapper.setStyle('height',height+'px');bigWrapper.setStyle('width',totalWidth-edgeWidth+'px');bigWrapper.adopt($(mainWrapper));var wrapperWrapper=new Element('div',{'class':'kwix-outer-wrapper'}).injectBefore(bigWrapper);this.baseStyle(wrapperWrapper);wrapperWrapper.setStyle('position','relative');wrapperWrapper.setStyle('margin-left','auto');wrapperWrapper.setStyle('margin-right','auto');wrapperWrapper.setStyle('overflow','hidden');wrapperWrapper.setStyle('height',height+'px');wrapperWrapper.setStyle('width',totalWidth+'px');wrapperWrapper.adopt(bigWrapper);var farRight=new Element('div',{'class':'kwix-farRight'}).inject(wrapperWrapper);this.baseStyle(farRight);farRight.setStyle('position','absolute');farRight.setStyle('top','0px');farRight.setStyle('right','0px');farRight.setStyle('height',height+'px');farRight.setStyle('width',edgeWidth+'px');farRight.setStyle('background-position',edgeWidth+'px 0px');farRight.setStyle('background-image',this.bgName(this.n-1));if(yhBlankImg!=""){var slicename='url("'+imageName+'-slice-'+(this.n-1)%bgCount+'_1.'+format+'")';farRight.setStyle('background-image',slicename);}
	this.items.each(function(item,i){item.setStyle('display','none');this.image_items[i].remove();this.styleItems(item,i,mainWrapper);}.bind(this));this.items=$ES('.kwix-item',wrapperId+'_main');this.text_items=$ES('.kwix-text',wrapperId+'_main');var t=Fx.Transitions.Quad.easeOut;if(transition==1)
		t=Fx.Transitions.Bounce.easeOut;if(transition==2)
			t=Fx.Transitions.Elastic.easeOut;this.fxItem=new Fx.Elements(this.items,{wait:false,duration:this.backgroundSpeed,transition:t});this.fxText=new Fx.Elements(this.text_items,{wait:false,duration:this.foregroundSpeed,transition:Fx.Transitions.Quad.easeOut});this.fxImage=new Fx.Elements(this.image_items,{wait:false,duration:this.foregroundSpeed,transition:Fx.Transitions.Quad.easeOut});this.items.each(function(item,i){item.index=i;item.addEvent("mouseenter",function(){this.expandThis(item);}.bind(this));}.bind(this));$(mainWrapper).addEvent("mouseleave",function(event){this.idleState(event);}.bind(this));}
Kwix.prototype.baseStyle=function(e){e.setStyle('display','block');e.setStyle('padding','0px');e.setStyle('margin','0px');e.setStyle('border','0px');e.setStyle('background','0');}
Kwix.prototype.bgName=function(index){return'url("'+this.imageName+'-'+index%this.bgCount+'_1.'+this.format+'")';}
Kwix.prototype.styleItems=function(item,i,wrapper){var mainItem=new Element('div',{'class':'kwix-item'}).inject(wrapper);this.baseStyle(mainItem);mainItem.setStyle('position','relative');mainItem.setStyle('float','left');mainItem.setStyle('overflow','hidden');mainItem.setStyle('height',this.height+'px');mainItem.setStyle('width',this.medium+'px');mainItem.setStyle('background-position','left 0px');mainItem.setStyle('background-image',this.bgName(i));mainItem.setStyle('cursor','pointer');mainItem.addEvent("click",function(){if(this.image_anchors[i].getProperty('rel')!='external')
																																																																																																																															  window.location=this.image_anchors[i].getProperty('href');else
																																																																																																																															  window.open(this.image_anchors[i].getProperty('href'),'_blank').focus();}.bind(this));if(i<this.n-1){var right=new Element('div',{'class':'kwix-right'}).injectAfter(mainItem);this.baseStyle(right);right.setStyle('position','relative');right.setStyle('float','left');right.setStyle('overflow','hidden');right.setStyle('height',this.height+'px');right.setStyle('width',this.edgeWidth+'px');right.setStyle('background-position',this.edgeWidth+'px 0px');right.setStyle('background-image',this.bgName(i));if(yhBlankImg!=""){var slicename='url("'+this.imageName+'-slice-'+i%this.bgCount+'_1.'+this.format+'")';right.setStyle('background-image',slicename);}}else{mainItem.setStyle('width',this.medium+this.errorWidth+'px');}
var itemContent=new Element('div',{'class':'kwix-content'}).inject(mainItem);this.baseStyle(itemContent);itemContent.setStyle('position','absolute');itemContent.setStyle('top','0px');itemContent.setStyle('left','0px');itemContent.setStyle('width',this.large+'px');itemContent.setStyle('height',this.height+'px');this.styleText(item,i,itemContent);this.styleImages(item,i,itemContent);}
Kwix.prototype.styleText=function(item,i,itemContent){inside=new Element('div',{'class':'kwix-text'});this.baseStyle(inside);var rawTitle=this.image_anchors[i].innerHTML;this.item_titles[i].setHTML(rawTitle);inside.setHTML(item.innerHTML);item.setHTML('');inside.inject(itemContent);inside.setStyle('padding-top',this.marginTop+'px');inside.setStyle('padding-bottom',this.marginBottom+'px');inside.setStyle('padding-left',this.marginLeft+'px');inside.setStyle('padding-right',this.marginRight+'px');inside.setStyle('position','absolute');inside.setStyle('top','0px');inside.setStyle('left','0px');inside.setStyle('height','75px');inside.setStyle('width','75px');inside.setStyle('left','0px');inside.setStyle('text-align','center');if(this.textPosition==0){inside.setStyle('display','none');}
	if(this.textPosition==1){inside.setStyle('width',(this.medium-this.marginLeft-this.marginRight-this.edgeWidth)+'px');inside.setStyle('left',this.edgeWidth+'px');}
	if(this.textPosition==2){inside.setStyle('width',(this.large-this.marginLeft-this.marginRight-this.edgeWidth)+'px');inside.setStyle('left',this.edgeWidth+'px');}
if(this.textPosition==3){inside.setStyle('width',(this.large-this.medium-this.edgeWidth-this.marginLeft-this.marginRight)+'px');inside.setStyle('left',(this.medium+this.edgeWidth)+'px');}}
Kwix.prototype.imageLeft=function(imageWidth){if(this.imagePosition==0)
	return"0px";if(this.imagePosition==1)
		return((this.medium+this.edgeWidth-imageWidth)/2).toInt()+'px';if(this.imagePosition==2)
			return((this.large+this.edgeWidth-imageWidth)/2).toInt()+'px';if(this.imagePosition==3){return((this.large+this.edgeWidth-this.medium)/2).toInt()+this.medium-(imageWidth/2).toInt()+'px';}}
Kwix.prototype.styleImages=function(item,i,itemContent){this.image_items[i].inject(itemContent);var imageWidth=this.image_items[i].getStyle("width").toInt();var imageHeight=this.image_items[i].getStyle("height").toInt();if((imageHeight<5)||(imageWidth<5)){this.image_items[i].remove();this.image_items[i].setStyle('display','none');return;}
	this.image_items[i].setStyle('top',((this.height-imageHeight)/2).toInt()+'px');this.image_items[i].setStyle('position','absolute');this.image_items[i].setStyle('display','block');if(this.imagePosition==0){this.image_items[i].setStyle('display','none');}
this.image_items[i].setStyle('left',this.imageLeft(imageWidth));}
Kwix.prototype.expandThisItem=function(item){var fxParam={};this.items.each(function(other,j){if(item.index==j){if(j==this.n-1)
																			fxParam[item.index]={width:[item.getStyle("width").toInt(),this.large+this.errorWidth]};else
																			fxParam[item.index]={width:[item.getStyle("width").toInt(),this.large]};}else{var currentWidth=other.getStyle("width").toInt();if(currentWidth!=this.small){if(j==this.n-1)
																			fxParam[j]={width:[currentWidth,this.small+this.errorWidth]};else
																			fxParam[j]={width:[currentWidth,this.small]};}}}.bind(this));this.fxItem.start(fxParam);}
Kwix.prototype.expandThisText=function(item){var fxParam={};this.items.each(function(other,j){if(item.index==j){fxParam[item.index]={width:[this.text_items[item.index].getStyle("width").toInt(),this.medium-this.marginLeft-this.marginRight-this.edgeWidth]};}else{var currentWidth=this.text_items[j].getStyle("width").toInt();var small=this.small-this.marginLeft-this.marginRight-this.edgeWidth;if(currentWidth!=small)
																			fxParam[j]={width:[currentWidth,small]};}}.bind(this));this.fxText.start(fxParam);}
Kwix.prototype.expandThisImage=function(item){var fxParam={};this.items.each(function(other,j){var imageWidth=this.image_items[j].getSize()['size']['y'];if(item.index==j){fxParam[item.index]={left:[this.image_items[item.index].getStyle("left").toInt(),this.imageLeft(imageWidth)]};}else{var currentLeft=this.image_items[j].getStyle("left").toInt();var smallLeft=((this.small+this.edgeWidth-imageWidth)/2).toInt();if(currentLeft!=smallLeft)
																			 fxParam[j]={left:[currentLeft,smallLeft]};}}.bind(this));this.fxImage.start(fxParam);}
Kwix.prototype.expandThis=function(item){this.expandThisItem(item);if(this.textPosition==1)
	this.expandThisText(item);if(this.imagePosition==1)
		this.expandThisImage(item);}
Kwix.prototype.idleItem=function(){var fxParam={};this.items.each(function(item,i){if(i==this.n-1)
																  fxParam[i]={width:[item.getStyle("width").toInt(),this.medium+this.errorWidth]};else
																  fxParam[i]={width:[item.getStyle("width").toInt(),this.medium]};}.bind(this));this.fxItem.start(fxParam);}
Kwix.prototype.idleText=function(){var fxParam={};this.items.each(function(item,i){fxParam[i]={width:[this.text_items[i].getStyle("width").toInt(),this.medium-this.marginLeft-this.marginRight-this.edgeWidth]};}.bind(this));this.fxText.start(fxParam);}
Kwix.prototype.idleImage=function(){var fxParam={};this.items.each(function(item,i){var imageWidth=this.image_items[i].getSize()['size']['y'];fxParam[i]={left:[this.image_items[i].getStyle("left").toInt(),this.imageLeft(imageWidth)]};}.bind(this));this.fxImage.start(fxParam);}
Kwix.prototype.idleState=function(event){this.idleItem();if(this.textPosition==1)
	this.idleText();if(this.imagePosition==1)
		this.idleImage();}