function toggleDisplay(arg_prefix, arg_id)
{
	$item_to_toggle = document.getElementById(arg_prefix + arg_id);
	
	$display_val = getComputedStyleMb($item_to_toggle, 'display', 'display');
	if($display_val == 'none')
	{
		$item_to_toggle.style.display = 'block';
	}
	else
	{
		$item_to_toggle.style.display = 'none';
	}
}

function toggleCommentsDisplay(arg_prefix, arg_id)
{
	toggleDisplay(arg_prefix, arg_id);
	if( document.getElementById(arg_prefix + arg_id).display != 'none' )
	{
		wrapper		= document.getElementById('comment_wrapper');
		comment_text	= document.getElementById('txt_comment');
		ypos 		= findPosY(wrapper);
		window.scrollTo(1,ypos);
		comment_text.focus();
	}
}	

function findPosX(obj)
{
    var curleft = 0;
    if(obj.offsetParent)
        while(1) 
        {
          curleft += obj.offsetLeft;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.x)
        curleft += obj.x;
    return curleft;
}

function findPosY(obj)
{
    var curtop = 0;
    if(obj.offsetParent)
        while(1)
        {
          curtop += obj.offsetTop;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.y)
        curtop += obj.y;
    return curtop;
}


function taskOver(arg_item)
{
	$item_to_highlight = arg_item;
	$item_to_highlight.style['backgroundColor'] = '#FFAAAA';
}

function taskOut(arg_item)
{
	$item_to_highlight = arg_item;
	$item_to_highlight.style['backgroundColor'] = '#ECECEC';
}

function getComputedStyleMb(el, cssproperty, csspropertyNS)
{
	if (el.currentStyle)
	{
		//if IE
		return el.currentStyle[cssproperty]
	}
	else if (window.getComputedStyle)
	{ 	//if NS6+
		var elstyle=window.getComputedStyle(el, "")
		return elstyle.getPropertyValue(csspropertyNS)
	}
}

function calendarSearch(arg_year, arg_month, arg_day)
{
	window.location.replace('http://www.miamiclubs.com/events.php?s[year]=' + arg_year + ';s[month]=' + arg_month + ';s[day]=' + arg_day);
}

function loadDateTimePicker(arg_ref_id, arg_show_time)
{
	ref_id 	= arg_ref_id;
	cd_url 	= 'calendar_display.php';
	if( arg_show_time )
	{
		cd_url = cd_url + '?show_time=1';
	}
        var load 	= window.open(cd_url,'','scrollbars=yes,menubar=no,height=350,width=260,resizable=yes,toolbar=no,location=no,status=no');
}

function isset(varname)  {
  if( varname != "undefined") return true;
  else return false;
}
