// iframe
$(document).ready(function() {
	$("a.read_map").fancybox({
		type:			'iframe',
		href:			'http://issuu.com/maukoquiroga/docs/valparaisomap2012?mode=embed&viewMode=presentation&layout=http%3A%2F%2Fskin.issuu.com%2Fv%2Fcolor%2Flayout.xml&backgroundColor=36393D&showFlipBtn=true',
		width:			700,
		autoScale:		true,
		overlayColor:	'#000000',
		overlayOpacity:	0.5,
		speedIn:		600,
		speedOut:		300
	});
	$("a.read_magazine").fancybox({
		type:			'iframe',
		href:			'http://issuu.com/maukoquiroga/docs/revista_4vientos_01?mode=embed&viewMode=browsing&layout=http%3A%2F%2Fskin.issuu.com%2Fv%2Fcolor%2Flayout.xml&backgroundColor=36393D&showFlipBtn=true',
		width:			700,
		autoScale:		true,
		overlayColor:	'#000000',
		overlayOpacity:	0.5,
		speedIn:		600,
		speedOut:		300
	});
	$("#email a").fancybox({
		type:			'iframe',
		href:			'http://maukoquiroga.wufoo.com/forms/m7x3k1/',
		width:			635,
		height:			375,
		autoScale:		true,
		scrolling:		'no',
		overlayColor:	'#000000',
		overlayOpacity:	0.5,
		speedIn:		600,
		speedOut:		300
	});
});

// tooltips?
$(function() {
	$(".pirate").tipsy({gravity: 'se', fade: 'true', live: 'true'});
	$("a.download_map").tipsy({gravity: 'n', fade: 'true', live: 'true'});
	$("a.read_map").tipsy({gravity: 'n', fade: 'true', live: 'true'});
	$("a.read_magazine").tipsy({gravity: 'n', fade: 'true', live: 'true'});
	$(".facebook").tipsy({gravity: 's', fade: 'true', live: 'true'});
	$(".email").tipsy({gravity: 's', fade: 'true', live: 'true'});
});

// function to force pdf download
$.download = function(url, data, method){
	if( url && data ){ 
		data = typeof data == 'string' ? data : $.param(data);
		var inputs = '';
		$.each(data.split('&'), function(){ 
			var pair = this.split('=');
			inputs+='<input type="hidden" name="'+ pair[0] +'" value="'+ pair[1] +'" />'; 
		});
		$('<form action="'+ url +'" method="'+ (method||'post') +'">'+inputs+'</form>')
		.appendTo('body').submit().remove();
	};
};

$("a.download_map").live('click', function() {
	$.download("download.php", "download_file=mapa_formato_A4.pdf", 'get');
});

// shadows rotate
var shadows = ["-moz-box-shadow", "-webkit-box-shadow", "box-shadow"]
var mouseenter = "0px 0px 10px rgba(0,0,0,1)"
var mouseleave = "0px 0px 7px rgba(0,0,0,0.7)"

$.each(shadows, function(index, value) {
	$(".mapa").live('mouseenter', function(){
		$(this).css(value, mouseenter);
	});
	$(".mapa").live('mouseleave', function(){
		$(this).css(value, mouseleave);
	});
	$(".revista").live('mouseenter', function(){
		$(this).css(value, mouseenter);
	});
	$(".revista").live('mouseleave', function(){
		$(this).css(value, mouseleave);
	});
	$(".facebook").live('mouseenter', function(){
		$(this).css(value, mouseenter);
	});
	$(".facebook").live('mouseleave', function(){
		$(this).css(value, mouseleave);
	});
});





