function send_tip_request(type, tipidfield)
{
	tip = new vB_AJAX_Handler(true);
	if (!tip.is_compatible())
	{
		alert('Leider unterstützt der Browser kein AJAX :(');
		return false;
	}
	
	gettipid = fetch_object(tipidfield).value;
	
	if (!gettipid.length)
	{
		return false;
	}

	show_img();
	
	tip.onreadystatechange(handle_tip_request);
	tip.send('ajax.php?' + SESSIONURL + 'do=tip', 'type=' + PHP.urlencode(type) + '&tipid=' + gettipid);
	
	return false;
}

function handle_tip_request()
{
	if (tip.handler.readyState == 4 && tip.handler.status == 200)
	{
		if (tip.handler.responseXML)
		{
			if (fetch_tags(tip.handler.responseXML, 'error').length)
			{
				alert(tip.fetch_data(fetch_tags(tip.handler.responseXML, 'error')[0]));
			}
			else if (fetch_tags(tip.handler.responseXML, 'tipcontent').length)
			{
				contentobj = fetch_object('tiptext');
				if (contentobj)
				{
					contentobj.innerHTML = tip.fetch_data(fetch_tags(tip.handler.responseXML, 'tipcontent')[0]);
				}
				
				tipidip = fetch_object('tipid');
				if (tipidip)
				{
					tipidip.value = tip.fetch_data(fetch_tags(tip.handler.responseXML, 'tipid')[0]);
				}
			}
			hide_img();
		}
	}
}

function send_hide_tip()
{
	tip = new vB_AJAX_Handler(true);
	if (!tip.is_compatible())
	{
		alert('Leider unterstützt der Browser kein AJAX :(');
		return false;
	}
	
	show_img();
	
	tip.onreadystatechange(handle_hide_tip);
	tip.send('ajax.php?' + SESSIONURL + 'do=hidetip', '');
	
	return false;
}

function handle_hide_tip()
{
	if (tip.handler.readyState == 4 && tip.handler.status == 200)
	{
		if (tip.handler.responseXML)
		{
			if ( fetch_tags(tip.handler.responseXML, 'warning').length)
			{
				hide = confirm(tip.fetch_data(fetch_tags(tip.handler.responseXML, 'warning')[0]));
				if (!hide)
				{
					hide_img();
					return false;
				}
				newtip = new vB_AJAX_Handler(true);
				newtip.onreadystatechange(handle_dohide_tip);
				newtip.send('ajax.php?' + SESSIONURL + 'do=dohidetip', '');
	
				return false;
			}
		}
	}
}

function handle_dohide_tip()
{
	if (newtip.handler.readyState == 4 && newtip.handler.status == 200)
	{
		if (newtip.handler.responseXML)
		{
			if ( fetch_tags(newtip.handler.responseXML, 'warning').length)
			{
				alert(newtip.fetch_data(fetch_tags(newtip.handler.responseXML, 'warning')[0]));
				
				thetipbox = fetch_object('tiptable');
				if (thetipbox)
				{
					thetipbox.style.display = 'none';
				}
				
				hide_img();
				
				return false;
			}
		}
	}
}

function show_img()
{
	tipimg = fetch_object('tipprocimg');
	if (tipimg)
	{
		tipimg.style.display = '';
	}	
}

function hide_img()
{
	tipimg = fetch_object('tipprocimg');
	if (tipimg)
	{
		tipimg.style.display = 'none';
	}	
}