function getObjectPosition(theobject)
{
	var left = 0;
	var top = 0;
	
	f = $(theobject);

	while (f.offsetParent){
		left += f.offsetLeft;
		top += f.offsetTop;
		f = f.offsetParent;
	}
	
	left += f.offsetLeft;
	top += f.offsetTop;
	
	return {x:left,y:top};
}

function show_area(the_area,the_input) {
	var show_area = $(the_area);
	
	if (!Element.visible(show_area)) {
		Element.show(show_area);
	} else {
		Element.hide(show_area);
		if ($(the_input)) {
			$(the_input).value='';
			document.basket.submit();
		}
		else
		{
			perstype_select('persoption_select','');	
		}
	}
}	

function show_info(obj,type)
{
	//obj is the click obj
	var pos = getObjectPosition(obj);
	Element.setStyle(obj,{cursor:'pointer'});
	Element.setStyle('info_'+type,{position:'absolute',top:(pos.y+15)+'px',left:pos.x+'px'});
	Element.show('info_'+type);
}

function hide_info(type)
{
	Element.hide('info_'+type);
}

function perstype_select(perstype_select) {
	
	var type = perstype_select.value;
	
	$('initials_').hide();
	$('initials_text_').value = '';
	
	$('1_line_').hide();
	$('1_line_text_').value = '';
	
	$('2_lines_').hide();
	$('21_lines_text_').value = '';
	$('22_lines_text_').value = '';
	
	$('3_lines_').hide();
	$('31_lines_text_').value = '';
	$('32_lines_text_').value = '';
	$('33_lines_text_').value = '';

	if( type != '' ) $(type).show();
	
}
