function checkboxes(e)
{
	var img = document.getElementById(e + '_checkbox');
	var checkbox = document.getElementById(e);

	if (img.src.substring(img.src.lastIndexOf('.') - 9, img.src.lastIndexOf('.')) == 'unchecked')
	{
		img.src = '/img/checked.gif';
		checkbox.checked = true;
	}
	else
	{
		img.src = '/img/unchecked.gif';
		checkbox.checked = false;
	}
}

function popitup(url, name, width, height, scrolling)
{
	newwindow=window.open(url,name,'width='+width+',height='+height+',toolbar=0,scrollbars='+scrolling+',location=0,statusbar=1,menubar=0,resizable=0,top=300,left=300');
	if (window.focus) {newwindow.focus()}
	return false;
}

function ICJ_browserWindowSize() {
		var r = new Array();
		r['width'] = 0;
		r['height'] = 0;
		if(typeof(window.innerWidth) == 'number' ) {
		//Non-IE
		r['width'] = window.innerWidth;
		r['height'] = window.innerHeight;
		}
		else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
		//IE 6+ in 'standards compliant mode'
		r['width'] = document.documentElement.clientWidth;
		r['height'] = document.documentElement.clientHeight;
		}
		else if(document.body && (document.body.clientWidth || document.body.clientHeight)) {
		//IE 4 compatible
		r['width'] = document.body.clientWidth;
		r['height'] = document.body.clientHeight;
		}
		return r;
}

function FitPic() {
var window_size = ICJ_browserWindowSize();
window.resizeBy(document.images[0].width - window_size['width'], document.images[0].height - window_size['height']);
self.focus();
}


function newwindow(url, name, width, height)
{
	newwindow=window.open(url,name,'width='+width+',height='+height+',toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,top=300,left=300');
	if (window.focus) {newwindow.focus()}
	return false;
}

function exists(v)
{
	return ( typeof(v) != "undefined" );
}

function getElementsByClass(searchClass,node,tag) {
	var classElements = new Array();
	if ( node == null )
		node = document;
	if ( tag == null )
		tag = '*';
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
	for (i = 0, j = 0; i < elsLen; i++) {
		if ( pattern.test(els[i].className) ) {
			classElements[j] = els[i];
			j++;
		}
	}
	return classElements;
}

function hideFlash()
{
	if ( typeof(document.all['flashMessage']) == 'object' )
		document.getElementById('flashMessage').style.display='none';
}

function num_imagenes(numero) {
	if (isNaN(numero))
		num = 0;

	for(x = 1; x <= 30; x++)
	{
		if ((obj = document.getElementById('adj_image_' + x)) != null)
			if(parseInt(numero) >= x)
				obj.style.display = '';
			else
				obj.style.display = 'none';
	}			
}

function num_planos(numero) {
	if (isNaN(numero))
		num = 0;

	for(x = 1; x <= 30; x++)
	{
		if ((obj = document.getElementById('adj_plano_' + x)) != null)
			if(parseInt(numero) >= x)
				obj.style.display = '';
			else
				obj.style.display = 'none';
	}			
}


