
/*...............................................................................................................
	@code to make the horizontal accordion work
		szNormal	-	size of the accordion items when they are normal			-	When four containers are at its normal state
		szSmall  	-	size of the accordion items when they are small				-	When three are shrinked and one is expanded then three which are small will take this size
		szFull   	-	size of the accordion items when they are at its full size 	-	The one which is expanded will take this size..
				These calculations are to be made keeping in mind the width of the parent width
 ................................................................................................................*/
		

window.addEvent('domready', function(){
	 var szNormal = 94, szSmall  = 94, szFull   = 570;
	if(document.getElementById('kwicks'))
	{
		var corner = $$("#accordian_inner_middle_main .accordian_inner_middle");
		var content = $$("#accordian_inner_middle .kwick_content");
		var kwicks = $$("#kwicks .kwick");

		var fx = new Fx.Elements(kwicks, {wait:false, duration:200, transition: Fx.Transitions.Quad.easeOut});
		
		fx.start(
			{
				'3': { /*	let's change the first element's opacity and width	*/
					'width': [94,570]
				}
			}
		);

		kwicks.each(function(kwick, i) {

			$(kwick.id).addEvent("mouseenter", function(event) {
					var k = {};
				k[i] = {width: [kwick.getStyle("width").toInt(), szFull]}
				
				kwicks.each(function(other, j) {
					if(i != j) {
						var w = $(other.id).getStyle("width").toInt();
						if(w != szSmall) k[j] = {width: [w, szSmall]};
						/*$(corner[0].id).setAttribute('class','set_corner');*/
						$(corner[0].id).className = 'set_corner';
						$(content[0].id).setStyle('width', 229);
					}
						fx.start(k).chain(function(){
						});
				});
			});
		});
		 
		$("kwicks").addEvent("mouseleave", function(event) {
			var k = {};
			kwicks.each(function(kwick, i) {
				/*$(corner[0].id).setAttribute('class','accordian_inner_middle');*/
				$(corner[0].id).className = 'accordian_inner_middle';
				k[i] = {width: [$(kwick.id).getStyle("width").toInt(), szNormal]}
				
			});
			fx.start(k).chain(function(){
			});
		});
	}
}); 

