preload_image = new Image(); 
preload_image.src = "/images/loading.gif";

preload_image2 = new Image(); 
preload_image2.src = "/images/loading2.gif";

function start_nav(o,cl)
{
	var rel_pos = $(o).getLeft() - $('nav').getLeft();
	var ul = $(o).parentNode.getElementsByTagName('ul')[0];
	
	ul.style.left = '-' + rel_pos.toString() + 'px';
	ul.style.display = 'block';
	
	$(o).className = 'navON '+ cl +'ON';
	
	$(o).onmouseout = function()
	{
		ul.onmouseover = function()
		{
			$(o).className = 'navON '+ cl +'ON';
			ul.style.display = 'block';
		}
		ul.onmouseout = function()
		{
			ul.style.display = 'none';
			$(o).className = cl;			
		}
		
		ul.style.display = 'none';
		$(o).className = cl;			

	}
}

function mark_menu(o)
{
	
}

function banner(id)
{
	var o1 = $('banner_' + id + '_anc');
	var o2 = o1.parentNode;

	o1.style.width = o2.offsetWidth + 'px';
	o1.style.height = o2.offsetHeight + 'px';
}

function clean_if_changed(o, txt, tp)
{
	if ( o.value == txt )
	{
		o.value = '';
		o.type = 'text';
	}
	
	o.onblur = function()
	{
		if ( o.value == '' )
		{
			o.value = txt;
			o.type = 'text';
		}
	}
	
	o.onkeypress = function()
	{
		o.type = tp;
	}
}

function ajax_send_form(id, up)
{
	$(id).send({ update: up, method: 'post', async: true, evalScripts: true });
}

function ajax_update(url, up)
{
	new Ajax(url,{ method: 'get', async: true, update: up }).request();
}

function expand_box(id, min, max, act)
{
	coo = $(id).getCoordinates();
	
	var fx = $(id).effects({duration: 400, transition: Fx.Transitions.sineIn});
 
	if (act == 'open')
	{
		if ( coo.height < max )
		{
			fx.start({'height': [coo.height, max]});
		}
	}
	else if (act == 'close')
	{
		if ( coo.height > max )
		{ 
			fx.start({'height': [coo.height, min]});
		}
	}
	else
	{
  		if ( coo.height < max )
		{
			fx.start({'height': [coo.height, max]});
		}
		else if ( coo.height > max ) 
		{
			fx.start({'height': [coo.height, min]});
		}
	}
}

function show_login()
{
	$('form_login_top').style.display = 'block';
	$('box_nao_logado').style.display = 'none';
}

var lock_clipboard;

function start_lock_clipboard()
{
/*	
	lock_clipboard = window.setInterval( function() {
		
		try
		{
			window.clipboardData.clearData();	
		}
		catch(e)
		{
		}
		
	}, 1000);
*/
}

function stop_lock_clipboard()
{
	lock_clipboard = window.clearInterval(scrolltimer);	
}

function get_head()
{
	return window.document.getElementsByTagName('head')[0];
}

function screen_resolution_fix()
{
	if(screen.width >= 1024)
	{
		var link = document.createElement("link");
		
		with (link)
		{
		    setAttribute("rel", "stylesheet");
		    setAttribute("href", "/stylesheets/1024.css");
		    setAttribute("type", "text/css");
		}
		
		get_head().appendChild(link);
	}
}

function pop_ensaio(url)
{
	window.open(url,'ensaio','width=1024,height=768,scrollbars=yes,resizable=no,toolbar=no,location=no,status=no');
}

//screen_resolution_fix();