/**
 * Alley Club
 * @author cleo47@gmail.com
 * Maio 2009
 */

$(function() {

//============================================================================= Cufon
Cufon.replace('span.title span');

//============================================================================= Boxes
$('a.shadow').tooltip({
	track:true,
	showURL:false
});

//ClickTaleExec("$('a.shadow').tooltip({track:true,showURL:false});");

var timeDesalinha = 2500;
var timeAlinha = 2000;

function home_imgs(){

	function desalinha(){

		$('div#home22').stop().animate({backgroundPosition:'30px 50px', opacity:'0.3'},timeDesalinha,'easeOutElastic');
		$('div#home33').stop().animate({backgroundPosition:'-50px -50px', opacity:'0.3'},timeDesalinha,'easeOutElastic');
		$('div#home4').stop().animate({backgroundPosition:'20px 20px', opacity:'0.3'},timeDesalinha,'easeOutElastic');
		$('div#home6').stop().animate({backgroundPosition:'-15px -15px', opacity:'0.3'},timeDesalinha,'easeOutElastic');
		$('div#home8').stop().animate({backgroundPosition:'75px 35px', opacity:'0.3'},timeDesalinha,'easeOutElastic');

	};


	function alinha(){

	//$('div.bg_home').stop().animate({opacity:'1'}, timeAlinha);

		$('div#home22').stop().animate({backgroundPosition:'1px 1px', opacity:'1'},timeAlinha,'easeOutElastic');
		$('div#home33').stop().animate({backgroundPosition:'1px 1px', opacity:'1'},timeAlinha,'easeOutElastic');
		$('div#home4').stop().animate({backgroundPosition:'1px 1px', opacity:'1'},timeAlinha,'easeOutElastic');
		$('div#home6').stop().animate({backgroundPosition:'1px 1px', opacity:'1'},timeAlinha,'easeOutElastic');
		$('div#home8').stop().animate({backgroundPosition:'1px 1px', opacity:'1'},timeAlinha,'easeOutElastic');

	};


	desalinha();

	
	//stripes
	$('div.home_hover')
		.mouseover(function(){
			$('div.box_home_deco').stop().css({top:'0', height:'0', opacity:'0'}).animate({height:'100%', opacity:'1'},200, 'easeOutCirc', function(){
			$('div.box_home_deco').stop().animate({opacity:'0'},250, 'easeInCirc');
			});
			
			alinha();
		})
		.mouseout(function(){
			desalinha();
		});
	
	
	//shadowbox
		
		$('a.shadow').click(function(){
			
			Shadowbox.open({
					        //content:    '/imgsize.php?w=625&img='+$(this).attr('href'),
							content:    $(this).attr('href'),
							player:     "img",
					        handleOversize:     'drag',
							handleUnsupported:  'remove'
					    });
						
			return false;
		});
		
	
	
	//text background
	$('div#home11, div#home55, div#home77')
		.mouseover(function(){
			$(this).stop().animate({backgroundColor:'#6e2c90;'},200);
			})
		.mouseout(function(){
			$(this).stop().animate({backgroundColor:'#424242;'},1000);
		});
		

		
	//============================== Flickr
/*
	$.getJSON("http://api.flickr.com/services/feeds/photos_public.gne?id=38541870@N07&tags=flyer&lang=en-us&format=json&jsoncallback=?", function(data){

		$.each(data.items, function(i,item){

		var totalItems = data.items.length;

		if(i==0){
			var item0 = item.media.m;
			var strLen = item0.length;
			var myStr = item0.slice(0,strLen-6); 
			var myImg = myStr + '.jpg';
			$('div.bg_home').attr('style', 'background:url("'+myImg+'"); background-attachment:fixed;');
			$('div.home_hover a').attr('href',''+myImg+'');
			$('ul#barra_menu li#programacao a').attr('href',''+myImg+'');
		}
		
		});// .each
	
	
		function preloadFlickrResize(){
			var flickr = $('a.shadow').eq(1).attr('href');
			$('<div id="js_php" style="display:none;"><img width="1" height="1" src="/imgsize.php?w=625&img='+ flickr +'" /></div>').insertAfter($('#rodape'));
		}
		setTimeout(preloadFlickrResize,4000);

	
	// .getjson
	});
*/
}//home_imgs()

//setTimeout('ClickTaleExec("home_imgs()")',3000);

home_imgs();


	//============================== Nome na lista
	$('#lista').click(function(){
		
		//ClickTaleExec('$("#lista").click(function(){Shadowbox.open({content:"cupom/index.php",player:"iframe",height:325,width:355});})')
		
			Shadowbox.open({
					        content:    'cupom/index.php',
							//content:    '/imgsize.php?w=625&img='+$(this).children('a').attr('href'),
							player:     "iframe",
							height:		325,
							width:		355
					    });		
	});
		

//=============================================================================Shadowbox
/*
//shadobox
Shadowbox.init({
	handleOversize:     'drag',
	handleUnsupported:  'remove'
});


    Shadowbox.setup("a.shadow", {
        title:      "Alley Club"

    });
*/

//________________________________________________________________________.
});
/*
//shadowbox
Shadowbox.init({
	handleOversize:     'drag',
	handleUnsupported:  'remove'
});



window.onload = function(){

    // set up all anchor elements with a "movie" class to work with Shadowbox
    Shadowbox.setup("a.shadow", {
        title:            "Alley Club"
      });

};
*/