
$('.closeBigCard').bind({
						click: function() {
							$('.bigCardLayout').hide(500);
							$('.bigCardCon').fadeOut(500);
							$(".cardsLine").animate({'top':0}, 367).slideUp(123).css({'top':400});
							$(".bigImageCon IMG").fadeOut(500, function(){ $(this).attr("src", '' ); });
							}
						
						});

function animatoring(myObject, myDelay)
	{
		var myRand = Math.floor(Math.random()*11);
		myObject.
		animate({'margin-left':'+=50', 'margin-top':'+=10'}, 2200+((2200/100)*myDelay*3*myRand), 'linear').
		animate({'margin-left':'+=40', 'margin-top':'+=20'}, 2200+((2200/100)*myDelay*3*myRand), 'linear').
		animate({'margin-left':'+=30', 'margin-top':'+=30'}, 2200+((2200/100)*myDelay*3*myRand), 'linear').
		animate({'margin-left':'+=20', 'margin-top':'+=40'}, 2200+((2200/100)*myDelay*3*myRand), 'linear').
		animate({'margin-left':'+=10', 'margin-top':'+=50'}, 2200+((2200/100)*myDelay*3*myRand), 'linear').
		animate({'margin-left':'-=30', 'margin-top':'+=30'}, 1800+((1800/100)*myDelay*3*myRand), 'linear').
		animate({'margin-left':'-=50', 'margin-top':'+=50'}, 2000+((2000/100)*myDelay*3*myRand), 'linear').
		
		animate({'margin-left':'-=50', 'margin-top':'-=10'}, 2200+((2200/100)*myDelay*3*myRand), 'linear').
		animate({'margin-left':'-=40', 'margin-top':'-=20'}, 2200+((2200/100)*myDelay*3*myRand), 'linear').
		animate({'margin-left':'-=30', 'margin-top':'-=30'}, 2200+((2200/100)*myDelay*3*myRand), 'linear').
		animate({'margin-left':'-=20', 'margin-top':'-=40'}, 2200+((2200/100)*myDelay*3*myRand), 'linear').
		animate({'margin-left':'-=10', 'margin-top':'-=50'}, 2200+((2200/100)*myDelay*3*myRand), 'linear').
		animate({'margin-left':'+=30', 'margin-top':'-=30'}, 1800+((1800/100)*myDelay*3*myRand), 'linear').
		animate({'margin-left':'+=50', 'margin-top':'-=50'}, 2000+((2000/100)*myDelay*3*myRand), 'linear').
		
		
		queue(function(){
						  		animatoring(myObject, myDelay);
						  		$(this).dequeue();
								});
	}

$(".cardsOut .card").each( function(index){
						  var myRand = Math.floor((Math.random()*11)/2);

						  $(this).attr({'startLeft':$(this).css('margin-left'), 'startTop':$(this).css('margin-top'), 'myIndex':$(this).css('z-index')}).delay($(this).attr('cof')*myRand).queue(function(){
						  		animatoring($(this), index);
						  		$(this).dequeue();
								});
						  
						  $(this).bind({
									   mouseenter: function(){ $(this).css({'z-index':999}).stop(true, false).children('IMG').animate({'width':'+=14'}, 700); },
									   mouseleave: function(){ $(this).css({'z-index':$(this).attr('myIndex')}).animate({'margin-top':$(this).attr('startTop'), 'margin-left':$(this).attr('startLeft')}, 1600).delay(1000).queue(function(){
						  		animatoring($(this), index);
						  		$(this).dequeue();
								}).children('IMG').animate({'width':'-=14'}, 400); },
									   
									   click: function() { 
									   $(".bigCardCon").fadeTo(789, 0.6);
									   $(".bigCardLayout").show(789);
									   $(".cardsLine").slideDown(123).animate({'top':730}, 567);
									   $(".bigImageCon IMG").attr("src", '/img/' + $(this).attr('id') + 'Big.jpg' ).fadeIn(500);
									   if($(this).attr("expr"))
						  					{
												var target = '_self';
											}
											else
											{
												var target = '_blank';
											}
									   if($(this).attr("target"))
									   {
										   	if($(".bigImageCon A").length > 0)
													{
														$(".bigImageCon IMG").unwrap();
													}
											$(".bigImageCon IMG").wrap("<A href='"+$(this).attr("target")+"' target='"+ target +"'></A>");
									   }
									   else
									   {
											   if($(".bigImageCon A").length > 0)
													{
														$(".bigImageCon IMG").unwrap();
													}
									   }
									   $(".activeCardCon").css({ "background":"url(/img/"+$(this).attr('id')+"Active.png) no-repeat", "margin-left":(($(".cardsPad IMG[uid='"+$(this).attr('id')+"']").position().left)/1)-20 });
									   }
									   
									   });
						  });

$(".cardsPad IMG").bind({
						click: function() { 
						$(".activeCardCon").css({ "background":"url(/img/"+$(this).attr('uid')+"Active.png) no-repeat" }).animate({"margin-left":(($(".cardsPad IMG[uid='"+$(this).attr('uid')+"']").position().left)/1)-20}, 134);
						
						 if($("#"+$(this).attr("uid")).attr("target"))
									   {
										   var aLength = $(".bigImageCon").length;
										   	if($(".bigImageCon A").length > 0 || navigator.userAgent.indexOf ('MSIE') != -1 && aLength > 1)
													{
														$(".bigImageCon IMG").unwrap();
													}
											
											
											if($("#"+$(this).attr("uid")).attr("expr"))
						  					{
												var target = '_self';
											}
											else
											{
												var target = '_blank';
											}
											$(".bigImageCon IMG").wrap("<A href='"+$("#"+$(this).attr("uid")).attr("target")+"' target='"+ target +"'></A>");
									   }
									   else
									   {
											   if($(".bigImageCon A").length > 0)
													{
														$(".bigImageCon IMG").unwrap();
													}
									   }
						
						
						$(".bigImageCon IMG").attr("src", '/img/' + $(this).attr('uid') + 'Big.jpg' ).fadeIn(500);
						
						}
						});








