function goTo( url ) 
{
	document.location.href=url;
}

function change_menu_class(id)
{
	el = document.getElementById(id);
	if( el==null )
		return;
		
	if ( el.className.slice(-2)=='_a' )
		el.className = el.className.slice(0,el.className.length-2);
	else
		el.className = el.className + '_a';
}

function setCookie(c_name,value,expiredays)
{
	var exdate=new Date();
	exdate.setDate( exdate.getDate() + expiredays );
	document.cookie=c_name + "=" +escape(value) + ((expiredays==null) ? "" : ";expires="+exdate);
}


function getCookie(c_name)
{
	if (document.cookie.length>0)
	{
		c_start = document.cookie.indexOf(c_name + "=");
		if (c_start!=-1)
		{ 
			c_start = c_start + c_name.length+1 ;
			c_end = document.cookie.indexOf(";", c_start);
			if (c_end==-1) 
				c_end=document.cookie.length;
			return unescape(document.cookie.substring(c_start,c_end));
		} 
	}
	return null;
}

function locate_footers_and_set_margins()
{
	var viewportHeight = document.viewport.getHeight();
	var contentHolderHeight = $('contentHolder').getHeight();
	var contentHeight = $('content').getHeight();
	var footerHeight = $('footer').getHeight();
	var bottomMargin = 100;
	var topMargin = 125;
	var menuHeight = $('menu').getHeight() + 20 + 58 - 8;
	
	if ( menuHeight>contentHeight )
		contentHeight = menuHeight;
		
	var footerTopMargin = viewportHeight - topMargin - contentHeight - footerHeight - bottomMargin;
	
	if ( footerTopMargin<0 )
		footerTopMargin = 0;
		
	$('footer').style.marginTop = footerTopMargin + 'px';
	
	if ( footerTopMargin==0 )
	{
		var contentHolderBottomMargin = viewportHeight - topMargin - contentHeight - footerHeight;
		if ( contentHolderBottomMargin<0 )
			contentHolderBottomMargin = 0;
		$('contentHolder').style.marginBottom = contentHolderBottomMargin + 'px';
	}
}
