openwidth=400; //width of open cell

if(totslider==3) closedwidth=275;
else if(totslider==4) closedwidth=182; //width of closed cell
else if(totslider==5) closedwidth=135; //width of closed cell
else if(totslider==6) closedwidth=107; //width of closed cell

//((totslider-1)*5)+(closedwidth*(totslider-1))+openwidth=960;

//alert(totslider);
openid=0;
bdrwidth=5;
var openx=Array();
for(i=0;i<totslider;i++){
	openx[i]=Array();
	cox=0;
	for(o=0;o<totslider;o++){
		openx[i][o]=cox;
		if(o==openid) cox=cox+openwidth+bdrwidth; else cox=cox+closedwidth+bdrwidth;
	}
	openid++;
}


var action='';
$("#slider-holder").find(".slider-cell").mouseover(function () {
	
	$(".slider-cell").stop(true,false);
	$(this).find(".slider-img").stop(true,false);
	
	sliderid=$(".slider-cell").index(this);
	
	if($.browser.msie) {
		$(this).find(".slider-img").css("display","block");
	}else{
		$(this).find(".slider-img").animate({opacity:1}, 500, "swing");
	}
	
	$(this).animate({marginLeft:openx[sliderid][sliderid]+"px",width:openwidth+"px",opacity:1}, 300, "swing");
	
	$('.slider-cell').each(function(index) {
		
		if(index!=sliderid){

			if($.browser.msie) {
				$(this).find(".slider-img").css("display","none");
			}else{
				$(this).find(".slider-img").animate({opacity:0}, 100, "swing");
			}
			
			$(this).animate({marginLeft:openx[sliderid][index]+"px",width:closedwidth+"px",opacity:0.8}, 300, "swing");
		
		}
	
	});
	
});

$("#slider-holder").find(".slider-cell").css("opacity",0);

$(window).load(function () {

	$('.slider-cell').each(function(index) {
			
			if(index!=sliderid){

				if($.browser.msie) {
					$(this).find(".slider-img").css("display","none");
				}else{
					$(this).find(".slider-img").css("opacity",0);
				}
				
				$(this).animate({marginLeft:openx[sliderid][index]+"px",width:closedwidth+"px",opacity:0.8}, 300, "swing");

				
			}else{
				
				if($.browser.msie) {
					$(this).find(".slider-img").css("display","block");
				}else{
					$(this).find(".slider-img").css("opacity",1);
				}
				
				$(this).animate({marginLeft:openx[sliderid][index]+"px",width:openwidth+"px",opacity:1}, 300, "swing");
				
			}
		
	});

});

