function presets(){
    var bod = document.body, shades = ["rich", "blck", "pale", "gray"];
    bod.removeChild(document.getElementById('browser')); bod.style.overflow="hidden";
    
    particleWrap = document.getElementById('particles');
    
    for(var pW=0;pW<75;pW++){
        particleWrap.innerHTML+="<span class='"+shades[Math.floor(Math.random()*4)]+"'></span>";}
  
    startBees();
  
    function specFont(obj, prop){
        var s = "", tar = document.getElementById(obj);
        if(document.defaultView && document.defaultView.getComputedStyle){
        s = document.defaultView.getComputedStyle(tar, "").getPropertyValue(prop);}
        else if(tar.currentStyle){prop = prop.replace(/\-(\w)/g, function (strMatch, pr){
            return pr.toUpperCase(); }); s = tar.currentStyle[prop]; } return s; }
    
    if(parseInt(specFont("tf1","width")) != parseInt(specFont("tf2","width"))){
        if(document.styleSheets[0].cssRules){ att = document.styleSheets[0].cssRules; }
        else if(document.styleSheets[0].rules){ att = document.styleSheets[0].rules; }
        
        for(a=6;a<11;a++){att[a].style.fontFamily="inherit";}
        
        att[6].style.fontStyle="italic"; //i
        att[7].style.fontWeight="400"; //b
        att[8].style.fontWeight="400"; att[8].style.fontStyle="italic"; //b i
        att[9].style.fontWeight="600"; /*strong*/ 
        att[11].style.fontWeight="100"; att[11].style.fontFamily="Futura, Futura Std,"+
        "AmericanTypewriter, American Typewriter, ITC American Typewriter, ITC American Typewriter Std,"+
        "HelveticaNeue, Helvetica Neue, sans-serif"; att[11].style.fontSizeAdjust="0.5"; //body
    }

    receive();
    
}

function startBees(){
    var particles = particleWrap.getElementsByTagName('span'), qPart = particles.length;
    particalize = setInterval(deviate,500);
    function deviate(){ for(var p=0;p<qPart;p++){
        particles[p].style.top=Math.random()*100+"%"; particles[p].style.left=Math.random()*100+"%";}
    }
}

function stopBees(){clearInterval(particalize);}
    
function receive(){
    
    var doc = document, itemKids = doc.getElementById('items').getElementsByTagName('div'),
        projs = [], p=0, itemLen = itemKids.length, cov = doc.getElementById('cover'), seen = 0; 
    
    for(i=0;i<itemLen;i++){if(itemKids[i].className=="base"){projs[p++] = p-1;}}
    
    function slide(dir,a,b,c){
        var wrap = doc.getElementById('infoWrap'), box = doc.getElementById('infoBox'), pLen = projs.length,
            optA = ["iLeft", "iRight"], optB = ["dontCare", "curious"], optC = ["icon iconHide", "icon"];
            
        if(a){wrap.setAttribute('class',optA[dir]);}
        if(b){box.setAttribute('class',optB[dir]);}
        if(c){for(im=0;im<pLen;im++){
            doc.getElementById('I'+projs[im]).setAttribute('class',optC[dir]);}} 
    }
    
    for(var pj=0;pj<projs.length;pj++){
		(function(pj){
            var selID = doc.getElementById('E'+pj), descID = doc.getElementById('D'+pj),
                infos = ["vt info", "bug info", "adventure info", "math info"], projInf = infos[pj],
                wrap = doc.getElementById('wrapper');
                
            selID.onmouseover=function(){descID.setAttribute('class','eDesc dFin');}
			
            selID.onclick=function(){
                for(x=0;x<projs.length;x++){
                    var title = doc.getElementById('E'+projs[x]), desc = doc.getElementById('D'+projs[x]);
                    if(pj!=x){desc.setAttribute('class','eDesc dInit');
                    title.setAttribute('class','eTitle transparent');}
                }
                    
                descID.setAttribute('class','eDesc dLimbo');
                
                if(seen<1){
                    var bubDir = doc.getElementById('bubDir');
                    descID.appendChild(bubDir); setTimeout(firstScreening,1250);
                    setTimeout(function(){descID.removeChild(bubDir);},4250);
                    setTimeout(everyScreening,5250);
                    }
                
                else{slide(1,1,0,0); setTimeout(function(){slide(0,1,0,1); everyScreening();},1000);}
                
                wrap.setAttribute('class','wPres'); cov.setAttribute('class','limbo'); seen++;
                doc.getElementById('wrapHot').onmouseover=function(){slide(1,1,0,1);}
            }
            
            doc.getElementById('I'+pj).onclick=function(){if(wrap.className=="wPres"){everyScreening();}}
            
            function everyScreening(){
                var screenings = ["vt","iambug","adventure","ilovemath"]; cov.setAttribute('class','active');
                cov.innerHTML="<iframe id='screenFrame' src='"+screenings[pj]+
                "' width='100%' height='100%' frameborder='0' border='0' cellspacing='0' "+
                "style='border-style:none;'> </iframe>";
                doc.getElementById('infoCont').innerHTML=projInf;
                descID.setAttribute('class','eDesc dInit');
                doc.getElementById('metamorphDesc').removeAttribute('class','opaque');
                for(x=0;x<projs.length;x++){
                    doc.getElementById('E'+projs[x]).setAttribute('class','eTitle');}
                stopBees();
            }
            
		}) (pj);
	}
    
    doc.getElementById('meta').onmouseover=function(){
        doc.getElementById('metamorphDesc').setAttribute('class','opaque');}
    doc.getElementById('infoHot').onclick=function(){slide(1,0,1,0);}
    doc.getElementById('exBox').onclick=function(){slide(0,0,1,0);}
    doc.getElementById('exBar').onclick=function(){slide(0,1,1,1);}
    
    doc.getElementById('quitHot').onclick=function(){
        startBees(); doc.getElementById('wrapHot').onmouseover=null;
        slide(0,1,1,1); doc.getElementById('wrapper').removeAttribute('class','wPres');
        setTimeout(function(){cov.setAttribute('class','hidden'); cov.innerHTML="";},500);
        
        }
        
    function firstScreening(){
        var PM = document.getElementById('pointerMouse');
        PM.setAttribute('class','mouseFin'); //mouse hovers over sidebar
        setTimeout(function(){PM.setAttribute('class','mouseInit'); slide(1,1,1,0);},1500); //sb slides out
        setTimeout(function(){slide(0,1,1,1);},3000); //sb slides in
    }
}
