function initTimeline(){

	$("#mycarousel li a").bind("click",function(){

		ano = $(this).attr("href");

		$.ajax({
			type: "GET",
			url: "/empresa/historia_conteudo.aspx",
			data: {"ano":ano},
			success: function(data){
				$(".content_historico").empty().append(data);
			}
		});

		return false

	});

}

function startClipping(){
	$(".lista_clipping dt a").bind("click",function(){
		$(".lista_clipping dt").show();
		$(this).parent().hide();
		$(".lista_clipping dd").hide();
		$(this).parent().next().show();
		return false;
	});
}


function getItemGaleria(){
	$('#mycarousel').jcarousel();
	$("#mycarousel li a").bind("click",function(){

		var obj;
		
		$("#mycarousel li a img").removeClass("on");
		$(this).find("img").addClass("on");

		$(".content_galeria #item").empty();

		if($(this).attr("rel")=="youtube"){
			urlVideo = $(this).attr("href") + "?fs=1&amp;hl=pt_BR";
			var so = new SWFObject(urlVideo, "mymovie", "438", "255", "10", "");
			so.addParam("quality", "high");
			so.addParam("wmode", "transparent");
			so.write("item");
		}else{
			obj = "<img src='"+$(this).attr("href")+"' />";
			$(".content_galeria #item").append($(obj));
		}
		
		return false;
	});
	
	$("#mycarousel li a").eq(0).click()
}

// copyHeight
function copyHeight(obj){
	hMax = $(obj).eq(0).height();
	for (i=0; i<$(obj).length; i++){
		if(hMax < $(obj).eq(i).height()){
			hMax = $(obj).eq(i).height();
		}
	}
	$(obj).height(hMax);
}


// centralizeElement
function centralizeElement(obj){
	var obj = obj;
	if ($("body").height() > $(obj).height()) {
		$(obj).css({top: '50%', marginTop: -($(obj).height()/2) + 'px'});
	}else {
		$(obj).css({marginTop: '0px', top: '0px'});
	}
	if ($("body").width() > $(obj).width()) {
		$(obj).css({left: '50%', marginLeft: -($(obj).width()/2) + 'px'});
	}else {
		$(obj).css({marginLeft: '0px', left: '0px'});
	}
}


// Return GET params
function returnParam(url,paramName){
	for(var qs = url.split("&"), i=0; i < qs.length; i++)
		if(qs[i].indexOf(paramName)>=0)
			return qs[i].split("=")[1];
	return false;
}


// Flash Calls
function openLink(url) {
	if(!url.match('http')) {
		switch(url) {
			case "example": window.location = 'http://www.example.com.br/'; break;
			case "exampl2": doSomething(); return true; break;
			default: return false;
		}
	}else
		window.location = url;
	return true;
}



// Popup handler
function openPopup(u,n,w,h,o,c) {
	var l = t = 18;
	if (c) {
		l = (screen.availWidth-w) / 2;
		t = (screen.availHeight-h) / 2;
	}
	p=window.open(u,'pop_'+n,'left='+l+',top='+t+',width='+w+',height='+h+''+((o)?','+o:''));
}

function comunicadoPop(url){
	openPopup(url,'Comunicado',415,350,'scrollbars=1',true);
}

function goToUrl(url){
    window.open(url);
}

