function pop( popName, url ) {
		var page;
		var name;
		var w;
		var h;
		
		switch (popName) {
		
			case "imprimir":
				page = url;
				name = popName;
				w = 780;
				h = 530;
				break;
			case "proposta":
				page = url;
				name = popName;
				w = 780;
				h = 380;
				break;
			case "email":
				page = url;
				name = popName;
				w = 780;
				h = 530;
				break;
			case "desconto":
				page = url;
				name = popName;
				w = 780;
				h = 530;
				break;
			case "popTwitter":
				page = url;
				name = popName;
				w = 780;
				h = 530;
				break;
				
		}
		
		var winl = (screen.width-w)/2;
		var wint = (screen.height-h)/2;
		if (winl < 0) winl = 0;
		if (wint < 0) wint = 0;
		var settings = 'height=' + h + ',';
		settings += 'width=' + w + ',';
		settings += 'top=' + wint + ',';
		settings += 'left=' + winl + ',';
		settings += 'resizable=0, toolbar=0, location=0, directories=0, status=0, menubar=0, scrollbars=1';
		
		var win = window.open(page,name,settings);
		if(window.focus){
			win.focus();
		}
}

function twitterCallback( screenName )
{
	$('#flashcontent').get(0).twitterCallback(screenName);
}

function track( action, tag ){	
	if( action == "page" ){
		pageTracker._trackPageview( "idea-2011-"+tag );
	} else {
		pageTracker._trackEvent( "idea-2011", action, "idea-2011-"+tag );
	}
}

function setPageHeight( value )
{	
	forcesize.setHeight( value );
}


function openMoreInfo(action){
	var container = $('#more_info'), flag = 0;

	function open(){
		container.animate({height: '650px'}, 1000, function(){
			var p = $('#more_info').offset().top;
			$(this).css({height: 'auto'});
			flag = 1;
			window.setTimeout(
				function(){
					$("html:not(:animated),body:not(:animated)").animate({scrollTop: p-70}, 1000);
				}, 150
			);
		});
	}

	function close(){
		container.animate({height: 0}, 1000, function(){
			$(this).html('');
		});
	}

	if(action=='open' && flag==0){
		$.ajax({
			url: 'mais.html',
			complete: function(){ window.setTimeout(open, 100); },
			success: function(data){ container.append(data); }
		});
	}else if(action=='open' && flag==1){
		open();
	}else if(action=='close'){
		close();
	}

	return false;
}

function servicesAcordion(){
	$('#servicos dt').each(function(i){
		$(this).find('a').click(function(){
			$('#servicos dd').hide();
			$('#servicos dt a').removeClass('open');
			$(this).addClass('open').parent().next('dd').show();
			return false;
		});
	})
}

function forceResizeFooter(){
	console.log('asasas');

	window.setTimeout(function(){
		var h_body   = $('html')[0].scrollHeight;
			h_iframe = $('iframe:eq(0)').height(),
			h_flash  = $('#flashcontent').height(),
			h_footer = $('#bottom').height();

		if( (h_flash+h_footer) < h_body ){
			$('#bottom').height( h_footer + ( h_body - (h_flash + h_footer) - h_iframe ) );
		};
	}, 50);	
}





