//document.domain="localhost";

function setCookie(name,value,expires) { 
document.cookie=name + "=" + escape(value) + ((expires == null)? "" : (" ; expires=" + expires.toGMTString())) + "; path=/; domain=localhost";
}

function getCookie(name) { var arg = name + "="; var alen = arg.length; var clen = document.cookie.length; var i = 0; while(i< clen) { var j = i + alen; if(document.cookie.substring(i,j)==arg){ var end = document.cookie.indexOf(";",j); if(end == -1) end = document.cookie.length; return unescape(document.cookie.substring(j,end)); } i=document.cookie.indexOf(" ",i)+1; if (i==0) break; } return null; }
function getFontCookie() { 
    var fontSize = getCookie("font_size");
    try {
    if ( fontSize == null ) return 12; 
    if ( fontSize.length ) return parseInt(fontSize); 
    else return 12; 
    } catch (e) {
        return 12;
    }
}

var fontSize = getFontCookie();

function scaleFont(val) {
    var content, lineHeight;     
    content = document.getElementById("id_contentBody"); 
    if (val > 0) { 
        if (fontSize <= 20) { 
            fontSize = fontSize + val; lineHeight = fontSize+Math.round(1.1*fontSize); 
            content.style.fontSize = fontSize + "px"; 
        }
   } else { 
        if (fontSize > 10) { 
            fontSize = fontSize + val; lineHeight = fontSize+Math.round(1.1*fontSize); 
            content.style.fontSize = fontSize + "px";
        } else {
            lineHeight = fontSize+Math.round(1.1*fontSize);
            content.style.fontSize = fontSize + "px";
        }
    } 
    var mydate = new Date; 
    mydate.setDate(mydate.getDate()+1000); 
    setCookie("font_size", fontSize, mydate); 
}

function initMenu()
{
	$('id_content').addEvent('mouseover', function(){
    	$('id_content').setStyles({
			cursor:'hand',
			color:'Blue'
		});    
    });
	$('id_content').addEvent('mouseleave', function(){
        
		$('id_content').setStyles({
			cursor:'pointer',
			color:''
		});
    });
	$("id_content").addEvent('click', function(){
        document.location='content.html';
    });
	$('id_scaleUp').addEvent('mouseover', function(){
    	$('id_scaleUp').setStyles({
			cursor:'hand',
			color:'Blue'
		});    
    });
	$('id_scaleUp').addEvent('mouseleave', function(){
        
		$('id_scaleUp').setStyles({
			cursor:'pointer',
			color:''
		});
    });
    $("id_scaleUp").addEvent('click', function(){
        scaleFont(1);
    });
	$('id_scaleDown').addEvent('mouseover', function(){
    	$('id_scaleDown').setStyles({
			cursor:'hand',
			color:'Blue'
		});    
    });
	$('id_scaleDown').addEvent('mouseleave', function(){
        
		$('id_scaleDown').setStyles({
			cursor:'pointer',
			color:''
		});
    });
    $("id_scaleDown").addEvent('click', function(){
        scaleFont(-1);
    });
}
