﻿// MENUTEXT VARS, ANI
textfront1 = 'Frontpage';
textfront2 = 'A yummy grabbag o\' design goodies';
textabout1 = 'About';
textabout2 = 'FAQ\'s, background, contact info';
textissues1 = 'Issues';
textissues2 = 'Tasty treats in all shapes and forms';
textforums1 = 'Forums';
textforums2 = 'Needs a description ...';
textstore1 = 'Store';
textstore2 = 'Shop smart, shop K-Mart';
textspecials1 = 'Specials';
textspecials2 = 'Bitesize nuggets of community fun';
textmyk10k1 = 'MyK10k';
textmyk10k2 = 'Your one-stop customization central';

textmatchmaker1 = 'Matchmaker';
textmatchmaker2 = 'Allows you to share your projects with other people';
textbiznitz1 = 'Biznitz';
textbiznitz2 = 'Free job posting service for companies';
textondisplay1 = 'On Display';
textondisplay2 = 'An exhibition of computer desktops';
textphotopacks1 = 'Photo Packs';
textphotopacks2 = 'Photographic evidence of events all over the world';
textpixelpatterns1 = 'Pixel Patterns';
textpixelpatterns2 = 'An exhibition of pixellated patterns';

textnewsletter1 = 'Newsletter';
textnewsletter2 = 'Sign me up, Scotty';
textresize1 = 'Resize';
textresize2 = 'Set browser window to K10k friendly size';


// MENUTEXT VARS, NON-ANI
textnewsletter1 = 'Newsletter';
textnewsletter2 = 'Sign me up, Scotty';
textresize1 = 'Resize';
textresize2 = 'Set browser window to K10k friendly size';


// CHECKS FOR STATIC OR ANIMATED SECTION
function checkSection(thisSection) {
    if ((thisSection == 'front') || (thisSection == 'about') || (thisSection != 'issues') || (thisSection != 'forums') || (thisSection != 'store') || (thisSection != 'specials') || (thisSection != 'myk10k')) {
        return true;
    } else {
        return false;
    }
}

// NON-ANIMATED ICONS
function noAniMouseover(id,param) {
    if (preloadFlag) {
        if (currentsection != id) {
            changeImage(null,id,id+param);
        }
    }
}

// RESIZES BROWSER WINDOW
function resizeK10k(noAlert) {
    if (self.screen.height > 870) {
        resizeBrowser(1007,708);
    } else {
        resizeBrowser(1007,582);
    }
}

// THE ISSUE DROPDOWN
function issueWarp(dropdown) {
    var URL = dropdown.options[dropdown.selectedIndex].value;
    if (URL != "") {
        top.document.location.href='/issues/'+URL+'/';
    }
}

// MENU TEXT FUNCTIONS
// For more info check out http://www.bosrup.com/web/overlib/
var textLayerHtml;
var dontShowTextLayer = 1;
var showTimer = null;

function menuTextOn(thisSection) {
    if (browserName != "Opera") {
        thisText1 = eval('text' + thisSection + '1');
        thisText2 = eval('text' + thisSection + '2');
        if (thisSection == currentsection) {
            textLayerHtml = "<span class=\"menulgt\">You are here. Oh, well, you probably are ...</span>";
        } else {
            textLayerHtml = "<span class=\"menudrk\">" + thisText1 + "</span><span class=\"menulgt\"> | " + thisText2 + "</span>";
        }
        rewriteTextLayer(textLayerHtml, 'menutxtover');
        hide('menutxtoff');
        window.clearTimeout(showTimer);
        dontShowTextLayer = 1;
        show('menutxtover');
        self.status = '.: ' + eval('text' + thisSection + '1') + ' :.';
    }
}

function rewriteTextLayer(txt, id) {
    txt += "\n";
    // NS6
    if (browserNew && browserName == "NS") {
        botOver = document.getElementById(id);
        range = document.createRange();
        range.setStartBefore(botOver);
        domfrag = range.createContextualFragment(txt);
        while (botOver.hasChildNodes()) {
            botOver.removeChild(botOver.lastChild);
        }
        botOver.appendChild(domfrag);
    }
    // IE 4+
    else {
        document.all[id].innerHTML = txt;
    }
}

function menuTextOff() {
    if (browserName != "Opera") {
        dontShowTextLayer = 0;
        hide('menutxtover');
        self.status = '';
        showTimer = setTimeout("showNormalBottom()", 3000);
    }
}

function showNormalBottom() {
    if (dontShowTextLayer == 0) {
        show('menutxtoff');
    }
}

// MENU ANIMATION FUNCTIONS
function clipMover(section,num) {
    newTop = 41 - (num * 21);
    if (browserNew) {
        obj = document.getElementById(section);
        obj.style.top = newTop+"px";
    } else {
        obj = document.all[section].style;
        obj.top = newTop+"px";
    }
}

function startpeelup(section) {
    if (section != currentsection) {
        startpeeldown(lastover);
        lastover = section;
        peelingup[section] = 1;
        peelingdown[section] = 0;
        peelup(section);
    }
}

function startpeeldown(section) {
    if (section != currentsection) {
        peelingdown[section] = 1;
        peelingup[section] = 0;
        peeldown(section);
    }
}

function peelup(section) {
    if (section != currentsection) {
        if (! peelingdown[section]) {
            if (counter[section] < 8) {
                clipMover(section,counter[section]);
                if (counter[section] < 7) {
                    counter[section] = counter[section] + 1;
                    setTimeout("peelup('" + section + "')",delay);
                }
            }
        }
    }
}

function peeldown(section) {
    if (section != currentsection) {
        if (! peelingup[section]) {
            if (counter[section] > -1) {
                clipMover(section,counter[section]);
                if (counter[section] > 0) {
                    counter[section] = counter[section] - 1;
                    setTimeout("peeldown('" + section + "')",delay);
                }
            }
        }
    }
}

function setsection(section) {
    if (preloadFlag) {
        if (section != currentsection) {
            oldsection = currentsection;
            currentsection = section;
            if (browserName != "Opera") {
                rewriteTextLayer('<span class=\'menudrk\'>' + eval('text' + section + '1') + '</span><span class=\'menulgt\'> | ' + eval('text' + section + '2') + '</span>', 'menutxtoff');
            }
            hide('menutxtover');
            show('menutxtoff');
            if (checkSection(oldsection)) {
                startpeeldown(oldsection);
            } else {
                changeImage(null,oldsection,oldsection + 'off');
            }
            if (checkSection(section)) {
                clipMover(section,7);
            } else {
                changeImage(null,section,section + 'click');
            }
        }
    }
}
