function $(obj) {
	return document.getElementById(obj);
}

String.prototype.trim = function(  ) {
	return (this.replace(/^[\s\xA0]+/, "").replace(/[\s\xA0]+$/, ""));
}


function openPanel(){
	$('deixeRecado').style.display = 'block';
	$('fundoTransp').style.display = 'block';
	$('fundoTransp').style.height = $('top').clientHeight + $('menu').clientHeight + $('leftContent').clientHeight + $('footer').clientHeight + 40 + 'px';

	if(document.body)
	$('fundoTransp').style.height = $('master').clientHeight + document.body.scrollTop;
}

function closePanel(){
	$('deixeRecado').style.display = 'none';
	$('fundoTransp').style.display = 'none';
}

function scrollCanvas(dir, id){
	window["gal"+id].scrollBy(dir,0);
	timer = setTimeout('scrollCanvas('+dir+', '+id+')', 20);
}

function stopScroll(){
	clearTimeout(timer);
}

function changeImage(data, id){
	$("imgLoading"+id).style.display = "block";
	$('imgGd'+id).src = data.name;
	$('imgGd'+id).onload = function()
	{
		$("imgLoading"+id).style.display = "none";
	}
}

function isEmpty(field)
{
	var sText = document.getElementById(field).value.trim();
	return (sText == "" || sText == null || sText.charAt(0) == ' ');
}

function isEmail(field)
{
	var x = document.getElementById(field).value.trim();
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	return filter.test(x);
}

function GB_showSizeSet(set, start_index, callback_fn)
{
	var options = {
		type: 'page',
		fullscreen: false,
		center_win: true,
		show_loading: false,
		width: 420,
		height: 300
	}
	var gb_sets = new GB_Sets(options, set);
	gb_sets.addCallback(callback_fn);
	gb_sets.showSet(start_index-1);
	return false;
}

/*function centerLayer(obj) {
alert($(obj).offsetHeight);
return false;

$(obj).style.top = "50%";
$(obj).style.left = "50%";
$(obj).style.marginTop = (-($(obj).offsetHeight/2)) + "px";
$(obj).style.marginLeft = (-($(obj).offsetWidth/2)) + "px";
}

window.onscroll = alert("MDF");
window.onscroll = centerLayer('gene');*/
