/* PAGE WIDTH SWITCH - th[eZ]+jk[eZ]20070125 */

var fixedSize;

function init()
{
	document.fixedSize = ( getCookie( 'width' ) == 'dynamic' )? false: true;
    if ( document.fixedSize )
    {
        YAHOO.util.Dom.addClass('page', 'fixed');
    	YAHOO.util.Dom.removeClass('page', 'dynamic'); 
		YAHOO.util.Dom.removeClass("fixed", "hide"); 
    }
    else
    {
        YAHOO.util.Dom.addClass('page', 'dynamic');
    	YAHOO.util.Dom.removeClass('page', 'fixed'); 
		YAHOO.util.Dom.removeClass("dynamic", "hide"); 
    }
} 
YAHOO.util.Event.onDOMReady(init); 


function setWidth( )
{
    if ( document.fixedSize )
    {
        YAHOO.util.Dom.addClass('page', 'dynamic');
    	YAHOO.util.Dom.removeClass('page', 'fixed'); 
    	YAHOO.util.Dom.removeClass("dynamic", "hide");
    	YAHOO.util.Dom.addClass("fixed", "hide");
    	document.fixedSize = false;
    }
    else
    {
        YAHOO.util.Dom.addClass('page', 'fixed');
    	YAHOO.util.Dom.removeClass('page', 'dynamic'); 
    	YAHOO.util.Dom.removeClass("fixed", "hide");
    	YAHOO.util.Dom.addClass("dynamic", "hide");
    	document.fixedSize = true;
    }
    setCookie( 'width', ( document.fixedSize )? 'fixed': 'dynamic' );
}

function getCookie( name )
{
    if ( !document.cookie )
	return '';

    var cookie = document.cookie;
    firstChar = document.cookie.indexOf(name);
    if ( firstChar != -1 )
    {
        firstChar += name.length + 1;
        lastChar = cookie.indexOf( ';', firstChar );
        if ( lastChar == -1 )
            lastChar = cookie.length;
         var value = unescape( cookie.substring( firstChar, lastChar ) );
         return value;
    }
    return '';
}

function setCookie( name, value )
{
    var expiration = new Date();
    expiration.setTime( expiration.getTime() + 10000 * 60 * 60 * 24 * 365 );
    document.cookie = name + '=' + escape( value ) + '; expires=' + expiration.toGMTString() + '; path=/';
}
