/**
	URCA - Produtos (GTEXBRASIL) v: 1.0
	Developer(s):
		+ Fernando Basilio (fluibasilio@gmail.com)
*/


// 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);
}
