function touchrollcounter(id)
{
	jQuery("body iframe#rollcounterframe").remove();
	jQuery("body").prepend('<iframe style="position:absolute; width:1px; height:1px; left:-100px; top:-100px" id="rollcounterframe" src="/counters/' + id + '/"></iframe>');
}

function togglerollplace(id, a)
{
	if (jQuery("[id^='rollitem_']:visible").length > 0)
	{
		if (jQuery('#rollitem_'+id).is(":visible"))
		{
			jQuery('#rollplace').hide("fast");
			jQuery('#roller .con').hide("fast");
			jQuery("#rollplacedump").show("slow");
			jQuery(a).removeClass("selected");
		}
		else
		{
			touchrollcounter(id);		
			td = jQuery(a).parent().parent();
			td.siblings().removeClass("hit");
			td.prev().addClass("hit");
			td.addClass("hit");
			td.next().addClass("hit");
			td.prevAll(".earup").removeClass("earup").addClass("eardown");
			td.prev(".eardown").removeClass("eardown").addClass("earup");
			td.nextAll(".earup").removeClass("earup").addClass("eardown");
			jQuery(".rollitem[id!='rollitem_"+id+"']").css("display", "none");
			jQuery('#rollitem_'+id).show(1);
			jQuery("#ears a.selected").removeClass("selected");
			jQuery(a).addClass("selected");
		}
	}
	else
	{
		touchrollcounter(id);		
		td = jQuery(a).parent().parent();
		td.siblings().removeClass("hit");
		td.prev().addClass("hit");
		td.addClass("hit");
		td.next().addClass("hit");
		td.prevAll(".earup").removeClass("earup").addClass("eardown");
		td.prev(".eardown").removeClass("eardown").addClass("earup");
		td.nextAll(".earup").removeClass("earup").addClass("eardown");
		jQuery(".rollitem[id!='rollitem_"+id+"']").css("display", "none");
		jQuery('#rollitem_'+id).show(1);
		jQuery('#rollplace').show("fast");
		if (!(jQuery.browser.msie && jQuery.browser.version == '6.0')) { jQuery('#roller .con').show("fast"); }
		jQuery("#rollplacedump").hide("slow");
		jQuery(a).addClass("selected");
	}
}
