


function getCookie (name) {
    var prefix = name + '=';
    var c = document.cookie;
    var nullstring = '';
    var cookieStartIndex = c.indexOf(prefix);
    if (cookieStartIndex == -1)
        return nullstring;
    var cookieEndIndex = c.indexOf(";", cookieStartIndex + prefix.length);
    if (cookieEndIndex == -1)
        cookieEndIndex = c.length;
    return unescape(c.substring(cookieStartIndex + prefix.length, cookieEndIndex));
}

function setCookie (name, value, expires, path, domain, secure) {
    var curCookie = name + "=" + escape(value) + (expires ? "; expires=" + expires : "") +
        (path ? "; path=" + path : "") + (domain ? "; domain=" + domain : "") + (secure ? "; secure;" : ";");
    document.cookie = curCookie;
}

function rememberMe (f,v) {
    var now = new Date();
    fixDate(now);
    now.setTime(now.getTime() + 365 * 24 * 60 * 60 * 1000);
    now = now.toGMTString();
    setCookie(f, v, now, '/', 'meganiste.com', '');
}

function fixDate (date) {
    var base = new Date(0);
    var skew = base.getTime();
    if (skew > 0)
        date.setTime(date.getTime() - skew);
}

function deleteCookie (name, path, domain) {
    if (getCookie(name))
        document.cookie = name + "=" + ((path) ? "; path=" + path : "") +
            ((domain) ? "; domain=" + domain : "") + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
}

function hideDocumentElement(id) {
    var el = document.getElementById(id);
    if (el) el.style.display = 'none';
}

function showDocumentElement(id) {
    var el = document.getElementById(id);
    if (el) el.style.display = 'block';
}

function SH(varA1, varB1, varC1)
{
  if ( varC1 == 1 ) {
    document.getElementById(varA1).style.display = "none";
    document.getElementById(varB1).style.display = "block";
  } else {
    document.getElementById(varA1).style.display = "block";
    document.getElementById(varB1).style.display = "none";
  }
}

function Adjust(w,v)
{
	var wwidth = getCookie(w);
	wwidth++;wwidth--;
	if (wwidth < 1) {wwidth = 200;}
	wwidth = wwidth + v;
	if (wwidth < 60) {wwidth = 60;}
	if (wwidth > 400) {wwidth = 400;}
	rememberMe(w, wwidth);
	document.getElementById(w+'0').height = wwidth;
	document.getElementById(w+'1').height = wwidth;
	document.getElementById(w+'2').height = wwidth;
	document.getElementById(w+'3').height = wwidth;
	document.getElementById(w+'4').height = wwidth;
}

function wWide(w)
{
	var wwidth = getCookie(w);
	wwidth++;wwidth--;
	if (wwidth < 1) {wwidth = 200;}
	wwidth = wwidth + 20;
	if (wwidth > 400) {wwidth = 400;}
	rememberMe(w, wwidth);
	document.getElementById(w).height = wwidth;
}

function wNarrow(w)
{
	var wwidth = getCookie('mwiki_'+w);
	wwidth++;wwidth--;
	if (wwidth < 1) {wwidth = 200;}
	wwidth = wwidth - 20;
	if (wwidth < 60) {wwidth = 60;}
	rememberMe('mwiki_'+w, wwidth);
	document.getElementById(w).height = wwidth;
}

