<!--

function openProjects()
{
        var url = "projects.html";
        var winName = "projectsWIn";
        var attribs = "width=486,height=550,resizable=1,scrollbars=0,left=50,top=50,screenX=50,screenY=50";
        projectsWin = window.open(url, winName, attribs);
        projectsWin.focus();
}


function openAbout()
{
        var url = "about.html";
        var winName = "aboutWIn";
        var attribs = "width=486,height=400,resizable=0,scrollbars=1,left=100,top=100,screenX=100,screenY=100";
        aboutWin = window.open(url, winName, attribs);
        aboutWin.focus();
}


function openContact()
{
        var url = "contact.html";
        var winName = "ContactWIn";
        var attribs = "width=486,height=170,resizable=0,scrollbars=0,left=75,top=75,screenX=75,screenY=75";
        contactWin = window.open(url, winName, attribs);
        contactWin.focus();
}

function openPress()
{
        var url = "press.html";
        var winName = "pressWIn";
        var attribs = "width=486,height=637,resizable=1,scrollbars=0,left=50,top=50,screenX=50,screenY=50";
        projectsWin = window.open(url, winName, attribs);
        projectsWin.focus();
}


var isIE = (document.all)? true : false;
var isDOM = (document.getElementById && !document.all)? true : false;

//returns reference to an object with the option of accessing the 'style' properties or not
function buildObjRef(objID, useStyle)
{
        if (!document.getElementById(objID)) return false;

    if (useStyle == 1)
    {
        var ref = (isIE)? document.all[objID].style : document.getElementById(objID).style;
        return ref;  
    }
    else if (useStyle == 0)
    {
        var ref = (isIE)? document.all[objID] : document.getElementById(objID);
    }
    
      
}


//array of divs holding nav and project descriptions
var divArray = new Array("project1","project2","project3", "project4", "project5", "project6", "project7", "project8", "project9", "project10", "project11", "project12", "project13", "project14", "project15", "project16", "project17", "project18", "project19");


//arrays containg the project descriptions
var textArray1 = new Array("project1Text1","project1Text2");
var textArray2 = new Array("project2Text1","project2Text2","project2Text3","project2Text4","project2Text5","project2Text6","project2Text7","project2Text8");
var textArray3 = new Array("project3Text1","project3Text2","project3Text3");
var textArray4 = new Array("project4Text1");
var textArray5 = new Array("project5Text1");
var textArray6 = new Array("project6Text1", "project6Text2");
var textArray7 = new Array("project7Text1", "project7Text2", "project7Text3");
var textArray8 = new Array("project8Text1", "project8Text2", "project8Text3", "project8Text4");
var textArray9 = new Array("project9Text1", "project9Text2");
var textArray10 = new Array("project10Text1", "project10Text2");
var textArray11 = new Array("project11Text1","project11Text2","project11Text3","project11Text4","project11Text5","project11Text6","project11Text7");
var textArray12 = new Array("project12Text1", "project12Text2");
var textArray13 = new Array("project13Text1", "project13Text2", "project13Text3", "project13Text4", "project13Text5");
var textArray14 = new Array("project14Text1", "project14Text2", "project14Text3");


//loop through divArray and turn em off
function hideAllDivs()
{
    for(i=0; i<divArray.length; i++)
    {
        var obj = buildObjRef(divArray[i], 1);
        if(obj)obj.display = "none";
    }
}

//loop through text divs and turn em off
function hideTextDivs(whichArray)
{
    for(i=0; i<whichArray.length; i++)
    {
        var obj = buildObjRef(whichArray[i], 1);
        obj.display = "none";
    }
}


//sets a div display to block
function showDiv(whichDiv)
{    
    var obj = buildObjRef(whichDiv, 1);
    obj.display = "block";
}




//replace image place holder with supplied image name
function swapImage(imgName)
{

    if (document.images)
    {
        document.placeholder.src = "project_images/" + imgName + ".jpg";
    }
}


function swapPress(imgName, aspectRatio)
{
        var largePicDiv = document.getElementById("pressImage");

        if ( hasChildImgs( largePicDiv ) )
        {
                removeChildImgs( largePicDiv );
        }
        
        
        //set vertical or horizontal image width with the aspectRatio flag
        
        //horizontal
        if ( aspectRatio == 0 )
        {
                 var imgWidth = 486;
                 var imgHeight = 334;
                 var myImgClass = "none";
        }
        // vertical
        else if ( aspectRatio == 1 )
        {
                var imgWidth = 334;
                var imgHeight = 486;
                var myImgClass = "centerImg";
        }
        
        var myPic = document.createElement("img");
        var imgPath = "project_images/" + imgName + ".jpg";       
        myPic.setAttribute("id", "placeholder");        
        myPic.setAttribute("src", imgPath);        
        myPic.setAttribute("width", imgWidth);
        myPic.setAttribute("height", imgHeight);
        myPic.className = myImgClass;
        largePicDiv.appendChild(myPic);
                
          
}


function removeChildImgs( myObj )
{      
        var divImages = myObj.getElementsByTagName("img");

        for(i = 0; i < divImages.length; i++)
        {
               myObj.removeChild( divImages[i] );
        }
        
}


function hasChildImgs( myObj )
{      
        var divImages = myObj.getElementsByTagName("img");
         
        if ( divImages.length > 0 )
        {
               
                 return true;        
        }
        else
        {        
                return false;
        }
        
}


function hidePicDiv( theObj )
{
        var myObj = document.getElementById(theObj);
        myObj.style.display = "none";
}








//picked up from www.dhtmlnirvana
// modified it to include .all collection as well as getElementById

var selected_id_view = null; 
var selected_id_link = null; 


function swapViewClass(id, newclass) 
{           
        if (isDOM) 
        { 
                if(selected_id_view != id) 
                { 
                        document.getElementById(id).className = newclass; 
                } 
        }
        else if (isIE) 
        { 
                if(selected_id_view != id) 
                { 
                        document.all[id].className = newclass; 
                } 
        }  
} 

function persistViewClass (id,oldclass,newclass)
{ 
         
         if (isDOM)        
        { 
                if(selected_id_view != null) 
                { 
                        document.getElementById(selected_id_view).className = oldclass; 
                } 
                
                document.getElementById(id).className = newclass;         
        }
        else if (isIE)        
        { 
                if(selected_id_view != null) 
                { 
                        document.all[selected_id_view].className = oldclass; 
                } 
                
                document.all[id].className = newclass;         
        }
        
        selected_id_view = id; 
}




function swapLinkClass(id, newclass) 
{           
        if (isDOM) 
        { 
                if(selected_id_link != id) 
                { 
                        document.getElementById(id).className = newclass; 
                } 
        }
        else if (isIE) 
        { 
                if(selected_id_link != id) 
                { 
                        document.all[id].className = newclass; 
                } 
        }  
} 

function persistLinkClass (id,oldclass,newclass)
{ 
         
         if (isDOM)        
        { 
                if(selected_id_link != null) 
                { 
                        document.getElementById(selected_id_link).className = oldclass; 
                } 
                
                document.getElementById(id).className = newclass;         
        }
        else if (isIE)        
        { 
                if(selected_id_link != null) 
                { 
                        document.all[selected_id_link].className = oldclass; 
                } 
                
                document.all[id].className = newclass;         
        }
        
        selected_id_link = id; 
}



//TURN OFF DOTTED LINE FOCUS
function unblur() 
{
        this.blur();
}

function blurLinks() 
{
        if (!document.getElementById) {return;}
        theLinks = document.getElementsByTagName("a");
        for(i=0; i<theLinks.length; i++) 
        { 
                theLinks[i].onfocus = unblur;
        }
}



//-->