	var firstView = false;

	// SETS TIMER FOR AUTO ROTATE OF IMAGES
	var t;
	var timer_is_on = 0; 
	
	function timerCount() {
		t = setTimeout("timerCount()", 6000);
		forward();
		}
	function doTimer() {
		if (!timer_is_on) { timer_is_on=1; timerCount(); }
		}
			
	function init() {                        
        goNews('noTrack');					    
		if (document.images) {
			titleNews = newImage("../images/titles/title_news.png");
			titleProjects = newImage("../images/titles/title_projects.png");							
			titlePeople = newImage("../images/titles/title_people.png");
			titleAbout = newImage("../images/titles/title_about.png");
			titleContact = newImage("../images/titles/title_contact.png");								
			preloadFlag = true;

			var preloadedimages=new Array()
			for (i=0;i<photos.length;i++){
				preloadedimages[i]=new Image()
				preloadedimages[i].src=photos[i]
				}
			}
		}
		
	function newImage(arg) {
		if (document.images) {
			rslt = new Image();
			rslt.src = arg;
			return rslt;
			}
		}

	var _gaq = _gaq || [];
	_gaq.push(['_setAccount', 'UA-2660129-2']);
	_gaq.push(['_trackPageview']);
	
	(function() {
		var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
		ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
		var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
		})();	
 
 
    // SETS CONTENT AREA WIDTH PER BROWSER WINDOW DIMENSIONS
    function setRightColumnProperties(specifiedWidth, content) {
	var rightColumnWidth = 450;
		// SETS RIGHT COLUMN WIDTH    
		if (typeof window.innerWidth != 'undefined') {
				viewportWidth = window.innerWidth,
				viewportHeight = window.innerHeight
                rightColumnWidth = viewportWidth - specifiedWidth - 100;
                }
//      if (content == "contact" || content == "people") {
        if (content == "contact") {
                rightColumnWidth = 340;
                }
        document.getElementById('rightColumn').style.width = rightColumnWidth + "px";

        // SETS WIDTH OF TEXT AREA WITHIN COLUMN AND ADDS PADDING TO POSITION VERTICAL SCROLLBAR
		if (rightColumnWidth > 600) { contentWidth = 600; }
		if (rightColumnWidth <= 599) { contentWidth = rightColumnWidth - 30; }
		if (content == "projects") { contentID = "projectList"; }
		else { contentID = content + "Text"; }
		document.getElementById(contentID).style.width = contentWidth + "px";
		document.getElementById(contentID).style.paddingRight = rightColumnWidth - contentWidth - 18 + "px";

		// CHANGES SECTION TITLE
		document.getElementById('rightColumnTitle').style.backgroundImage = "url(../images/titles/title_" + content + ".png)";
		}
 
//    function setTextWidth() {
//        if (typeof window.innerWidth != 'undefined') {
//            viewportWidth = window.innerWidth;
//            }
//		textBlockWidth = document.getElementById("rightColumn").offsetWidth;
//        return textBlockWidth - 20; 
//        }
                 
 
	function highlightProject(rolloverObject) {
        projectNames = document.getElementsByName('projectName');
        for (k in projectNames) {
            if (projectNames[k].parentNode.id == rolloverObject.id) { projectNames[k].style.color="#fff"; break; }
            }
        projectDetails = document.getElementsByName('projectDetail');
        for (l in projectDetails) {
            if (projectDetails[l].parentNode.id == rolloverObject.id) { projectDetails[l].style.opacity="1"; break; }
            }
        projectYears = document.getElementsByName('projectYear');
        for (m in projectYears) {
            if (projectYears[m].parentNode.id == rolloverObject.id) { projectYears[m].style.color="#dcdcd2"; break; }
            }
        projectImages = document.getElementsByName('projectThumbnail');
        for (j in projectImages) {
            if (projectImages[j].id != rolloverObject.id) { projectImages[j].style.opacity=".3"; }
            if (projectImages[j].id == rolloverObject.id) { projectImages[j].style.opacity="1"; }
            }
		_gaq.push(['_setAccount', 'UA-2660129-2']);
		_gaq.push(['_trackEvent', 'Projects ', 'rollover', rolloverObject.id]);
		}


    function clearProject(rolloverObject) {
        projectNames = document.getElementsByName('projectName');
        for (k in projectNames) {
            if (projectNames[k].parentNode.id == rolloverObject.id) { projectNames[k].style.color="#78786e"; break; }
            }
        projectDetails = document.getElementsByName('projectDetail');
        for (l in projectYears) {
            if (projectDetails[l].parentNode.id == rolloverObject.id) { projectDetails[l].style.opacity="0"; break; }
            }
        projectYears = document.getElementsByName('projectYear');
        for (m in projectYears) {
            if (projectYears[m].parentNode.id == rolloverObject.id) { projectYears[m].style.color="#44443a"; break; }
            }
        projectImages = document.getElementsByName('projectThumbnail');
        for (j in projectImages) {
            if (projectImages[j].id != rolloverObject.id) {	projectImages[j].style.opacity=".7"; }
            if (projectImages[j].id == rolloverObject.id) {	projectImages[j].style.opacity=".7"; }
            }
        }
               
	function setProjectLineItemsPerColumnWidth() {
		// SETS 'projectDetail' SPAN TO EITHER DISPLAY OR HIDE, PER BROWSER WIDTH    
		if (typeof window.innerWidth != 'undefined') {
			viewportWidth = window.innerWidth,
			viewportHeight = window.innerHeight
			}
	
		projectSet = document.getElementsByName('projectDetail');
		for (k=0;k<=projectSet.length-1;k++) {
			kName = projectSet[k].previousSibling.previousSibling.offsetWidth;
			kDetail = projectSet[k].offsetWidth;
			kYear = projectSet[k].nextSibling.nextSibling.offsetWidth;
			rightColumnWidth = document.getElementById('rightColumn').offsetWidth;
			kWidth = rightColumnWidth - kName - kYear - 55;
			if (kWidth - kDetail < 0) { projectSet[k].style.display="none"; }  
			if (kWidth - kDetail >= 0 && kDetail != 0) { projectSet[k].style.display="block"; }  
			}    	
    	}
    	

    function showNews() {
		document.getElementById("news").style.opacity=1;
		document.getElementById("news").style.display="block";
    	document.getElementById("newsText").style.opacity=1;
    	document.getElementById("newsText").style.display="block"; }

    function showProjects() {
		document.getElementById("projects").style.opacity=1;
		document.getElementById("projects").style.display="block";
    	document.getElementById("projectList").style.opacity=1;
    	document.getElementById("projectList").style.display="block"; }

    function showPeople() {
    	document.getElementById("people").style.opacity=1;
	   	document.getElementById("people").style.display="block";
//    	document.getElementById("news").style.opacity=1;
//    	document.getElementById("news").style.display="block";
    	document.getElementById("peopleText").style.opacity=1;
    	document.getElementById("peopleText").style.display="block"; }
        
    function showAbout() {
    	document.getElementById("about").style.opacity=1;
    	document.getElementById("about").style.display="block";
    	document.getElementById("aboutText").style.opacity=1;
    	document.getElementById("aboutText").style.display="block"; }

    function showContact() {
//    	document.getElementById("contact").style.opacity=1;
    	document.getElementById("news").style.opacity=1;
    	document.getElementById("news").style.display="block";
    	document.getElementById("contactContents").style.opacity=1;
    	document.getElementById("contactContents").style.display="block"; }

    function hideNews() {
		document.getElementById("news").style.opacity=0;
		document.getElementById("news").style.display="none";
		document.getElementById("newsText").style.opacity=0;
		document.getElementById("newsText").style.display="none"; }

    function hideProjects() {
		document.getElementById("projects").style.opacity=0;
    	document.getElementById("projects").style.display="none";
        document.getElementById("projectList").style.display="none";
		document.getElementById("projectList").style.opacity=0; }

    function hidePeople() {
    	document.getElementById("people").style.opacity=0;
		document.getElementById("people").style.display="none";
//		document.getElementById("news").style.opacity=0;
//		document.getElementById("news").style.display="none";
		document.getElementById("peopleText").style.opacity=0;
		document.getElementById("peopleText").style.display="none";}

    function hideAbout() {
    	document.getElementById("about").style.opacity=0;
		document.getElementById("about").style.display="none";
		document.getElementById("aboutText").style.opacity=0;
		document.getElementById("aboutText").style.display="none";}

    function hideContact() {
//    	document.getElementById("contact").style.opacity=0;
		document.getElementById("news").style.opacity=0;
		document.getElementById("news").style.display="none";
		document.getElementById("contactContents").style.opacity=0;
		document.getElementById("contactContents").style.display="none"; }

    function goNews() {
            setRightColumnProperties(695, "news");
            hideProjects();
            hidePeople();
            hideAbout();
            hideContact();
            showNews(695);
			if (firstView == true) {
                _gaq.push(['_setAccount', 'UA-2660129-2']);
                _gaq.push(['_trackEvent', 'Nav Buttons', 'clicked', 'News']);
			firstView = false; }
            setTimeout("doTimer()", 6000);

 		}
	
    function goProjects() {
            setRightColumnProperties(860, "projects");
            hideNews();
            hidePeople();
            hideAbout();
            hideContact();
            showProjects();
			setTimeout("setProjectLineItemsPerColumnWidth()",400);
			_gaq.push(['_setAccount', 'UA-2660129-2']);
			_gaq.push(['_trackEvent', 'Nav Buttons', 'clicked', 'Projects']);
        }
        
    function goAbout() {
            setRightColumnProperties(550, "about");
            hideNews();
            hideProjects();
            hidePeople();
            hideContact();
            showAbout();
			_gaq.push(['_setAccount', 'UA-2660129-2']);
			_gaq.push(['_trackEvent', 'Nav Buttons', 'clicked', 'About']);
        }
        
    function goPeople() {
            setRightColumnProperties(695, "people");
            hideNews();
            hideProjects();
            hideAbout();
            hideContact();
            showPeople(695);
			_gaq.push(['_setAccount', 'UA-2660129-2']);
			_gaq.push(['_trackEvent', 'Nav Buttons', 'clicked', 'People']);
        }        
        
    function goContact() {
            setRightColumnProperties(1003, "contact");
			hideNews();
            hideProjects();
            hidePeople();
            hideAbout();
            showContact();
			_gaq.push(['_setAccount', 'UA-2660129-2']);
			_gaq.push(['_trackEvent', 'Nav Buttons', 'clicked', 'Contact']);
        }
    

    function fetchContent(project) {
        window.open('projects/'+project.id+'/index.html','_blank', "fullscreen=yes");
		_gaq.push(['_setAccount', 'UA-2660129-2']);
		_gaq.push(['_trackEvent', 'Projects', 'clicked', project])
    }
    
    function fetchPDFresume(URL) {
        window.open(URL,"_blank","resizable=yes, directories=no, status=no, width=925");
    }	
