// JavaScript Document
var singleWidth = 628;
var openWidth = 628;
var closeWidth
var currentButton = null;
var inBetween=false;

$(document).ready(function() {		
	
	closeWidth =($('#banner').width()-singleWidth)/3;
	
	$('#banner').find('.banner1').each(function(n){
												
												  $(this).attr('id','ban_'+n);
												  $(this).css('-webkit-box-shadow','-2px -2px 30px #000000');
												  $(this).css('-moz-box-shadow','-2px -2px 30px #000000');
												  $(this).css('cursor','pointer')
												  
												   });
	$('#banner').find('.banner1').css("width",closeWidth);
	$('#banner').find('.banner1').bind('mouseover',openDiv);
	
	
	inBetween = true;
	cn = $('#banner').find('.banner1').eq(0);
	cn.animate({width:openWidth},300,function(){inBetween = false;});
	cn.find('.banner_text_bg').eq(0).css('opacity',0.7);
	currentButton = cn

});

function openDiv(e){
if(!inBetween){
		
		
	inBetween = true;
	var sameDiv = false;
	
	
	 
	
	if(currentButton!=null){
		
		var thisID = $(this).attr('id');
	    var currentButton_id = currentButton.attr('id');
	    if(thisID==currentButton_id){sameDiv=true;}
		if(!sameDiv){
		currentButton.animate({width:closeWidth},350);
		currentButton.find('.banner_text_bg1').eq(0).css('opacity',0.7);
		currentButton.find('.banner_text_bg').eq(0).css('opacity',0.7);
		}
	}
		
	$(this).animate({width:openWidth},350,function(){inBetween = false;});
	$(this).find('.banner_text_bg1').eq(0).css('opacity',0.9);
	$(this).find('.banner_text_bg').eq(0).css('opacity',0.9);
	currentButton = $(this)
	
	
	
}
}
