//Specify the slider's slide speed (larger is slower)

var numSlides = 13;
var lastSlide = numSlides - 1;

var slidespeed = 3;
var slidesteps = 126 / slidespeed;

var hex = 255;

var sideImgOpac = 35;

window.onload = PageLoad;

var index = new Array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);


var slides = new Array();
slides[0] = "images/portfolio/Becley_thumb.png";
slides[1] = "images/portfolio/INPEA_thumb.png";
slides[2] = "images/portfolio/garcia_thumb.png";
slides[3] = "images/portfolio/Otology_thumb.png";
slides[4] = "images/portfolio/Eve_thumb.png";
slides[5] = "images/portfolio/finances_thumb.png";
slides[6] = "images/portfolio/Image08_thumb.jpg";
slides[7] = "images/portfolio/Image02_thumb.jpg";
slides[8] = "images/portfolio/Image03_thumb.jpg";
slides[9] = "images/portfolio/Image04_thumb.jpg";
slides[10] = "images/portfolio/Image01_thumb.jpg";
slides[11] = "images/portfolio/Image09_thumb.jpg";
slides[12] = "images/portfolio/Image11_thumb.png";



var bigImages = new Array();
bigImages[0] = "images/portfolio/Becley.png";
bigImages[1] = "images/portfolio/INPEA.png";
bigImages[2] = "images/portfolio/garcia.png";
bigImages[3] = "images/portfolio/otology.jpg";  
bigImages[4] = "images/portfolio/Eve.jpg";  
bigImages[5] = "images/portfolio/finances.png";	
bigImages[6] = "images/portfolio/Image08_main.jpg";
bigImages[7] = "images/portfolio/Image02_main.jpg";
bigImages[8] = "images/portfolio/Image03_main.jpg";
bigImages[9] = "images/portfolio/Image04_main.jpg";
bigImages[10] = "images/portfolio/Image01_main.jpg";
bigImages[11] = "images/portfolio/Image09_main.jpg";
bigImages[12] = "images/portfolio/Image11_main.jpg";


var txtArray = new Array();
txtArray[0] = "Coming Soon";
txtArray[1] = "Coming Soon";
txtArray[2] = "<b>Garcia Construction:</b> The Garcia Construction Group, based out of Indianapolis IN & San Antonio TX, has been a very beneficial project for the Fellows. The new site contains a majority of the already existing information, with the addition of a content management system (CMS) in order to allow the client to make changes to the text and pictures held on the site, with the addition of a built in blog. After finishing this project, and being able to work with the national respect and legendary reputation that the 22 year old firm holds, it has given us great pride that we have been able to work with this client.<p><p><a target='_blank' href=\"http://garciaconstructiongroup.net/\">Visit their site</a>";
txtArray[3] = "<b>Michael H. Fritsh:</b> Dr. Michael H. Fritsch, M.D., FACS, who is currently a Professor of Otolaryngology at the IU School of Medicine, has been a great project for the Fellows. The layout is similar to his current webpage, with the addition of a few extra pages and video implementation, which adds a creative edge to the web design. Thanks to Dr. Fritsch’s well standing reputation, the Fellows are tremendously proud to have left its fingerprints upon this unique web design.<p><p><a target='_blank' href=\"http://eardoc.us/\">Visit his site</a>";
txtArray[4] = "<b>Eve Earley:</b> Dr. Eve Earley DC, CST, is a certified CranioSacral Therapist, and developing her site has been a great project for the Fellows team. Dr. Earley, located in central Indiana, has been successful in helping her patients recover from many issues with the spine and nervous system. She needed a site that had a simple but appealing, crisp look and would allow patients to locate and contact her. The site includes a blog where Dr. Earley periodically posts updates, and links to Facebook and LinkedIn.<p><p><a target='_blank' href=\"http://www.drevechiro.com/\">Visit her site</a>";
txtArray[5] = "Coming Soon";
txtArray[6] = "<b>The Masters Study</b> The Master’s Study is a classical home school program located on the north side of Indianapolis, Indiana that studies the liberal arts from a historically Christian perspective. The new site features a complete redesign with fresh colors as well as bringing a more personal feel to the site with prominent pictures of the students.<p><p><a target='_blank' href=\"http://www.themastersstudy.org/index.html\">Visit The Master's Study Site</a>";
txtArray[7] = "<b>FOSA (Fairfield Outreach and Sponsorship Association)</b> is a non-profit outreach sponsorship group which supports a children\'s center in Zimbabwe, Africa. The organization had an existing Web site but desired an improved design along with several other additional points of functionality. The new site features an online donation form, detailed information about the children and staff, and a more user-friendly system for supporting children.<p><p><a target='_blank' href=\"http://\www.fosakids.org\">Visit The FOSA Site</a>";
txtArray[8] = "<b>Families Preventing Birth Defects</b> is a non-profit organization which seeks to notify individuals of birth defects and methods of prevention. Last summer, the organization lacked a Web presence so the project objective was to create an online location for information about birth defects to be made public. The Families Preventing Birth Defects site was the first project completed by the Fellows.<p><p><a target='_blank' href=\"http://fpbd.org\">Visit The FPBD Site</a>";
txtArray[9] = "<b>Indiana Crop Improvement Association</b> is an organization that performs quality assurance, lab testing, and field services for customers in the seed, grain, food, and related industries.  The company was searching for a new and improved site which would display updated content in a more organized and visually appealing format. The site also contains more information about their products for user viewing. The main objective of the site was to improve the marketing aspect of the business with information more readily available for users.<p><p>Indiana Crop Site Coming Soon!";
txtArray[10] = "<b>Benjamin Hunter</b> was elected to the Indianapolis City/County Council last November and was seeking a new site which would display the purpose of his term in office was well as key issues he is seeking to address. The site also includes a spreadsheet for users to submit their complaints and concerns for Ben's notification. The main purpose of the site is to keep Indiana residents informed about key government issues throughout Ben\'s term in office.<p><p><a target='_blank' href=\"http://\www.benjaminhunter.org/main/index.html\">Visit Benjamin Hunter's Site</a>";
txtArray[11] = "<b>The Ambassador House and Gardens, Inc</b> is an organization dedicated to the preservation and restoration of the Ambassador House and Gardens in the Fishers area.  The goal of the Ambassador House organization is to create an educational center and museum that serves as a way for visitors to learn about the history of Fishers.  The house was seeking a Web site to inform readers about the restoration work on their historic landmark. <p><p><a target='_blank' href=\"http://\www.ambassadorhouse.org/\">Visit The Ambassador House and Gardens, Inc Site</a>";
txtArray[12] = "Coming Soon";

function CacheImage(ImageSource)
{
	var ImageObject = new Image();
	ImageObject.src = ImageSource;
}

function SetSliderHTML()
{
    var sliderHTML;
    var cross_slide = document.getElementById("slider");

    cross_slide.style.left = "-126px";
    
    sliderHTML = "<nobr>";
    for (i = 0; i < numSlides; i++) {
        sliderHTML += '<img id="thumb' + i + '" src="' + slides[index[i]] + '" border="0" />';
    }
    
    sliderHTML += "</nobr>";
    
    cross_slide.innerHTML = sliderHTML;
}

function PageLoad()
{
    SetSliderHTML();

    changeOpac(sideImgOpac, 'thumb1');
    changeOpac(100, 'thumb2');
    changeOpac(sideImgOpac, 'thumb3');

	for (i = 0; i < numSlides; i++) {
		CacheImage(bigImages[i]);
	}

    SetMainImage();
}

function FadeText()
{
    document.getElementById('txtbox').innerHTML = txtArray[index[2]];

    if(hex > 0) { //If color is not black yet
        hex -= 11; // increase color darkness
        document.getElementById('txtbox').style.color = "rgb("+hex+","+hex+","+hex+")";
        setTimeout("FadeText()", 20); 
    }
    else
        hex=255 //reset hex value
}

//change the opacity for different browsers 
function changeOpac(opacity, id) { 
    var object = document.getElementById(id).style; 

    object.opacity = (opacity / 100); 
    object.MozOpacity = (opacity / 100); 
    object.KhtmlOpacity = (opacity / 100); 
    object.filter = "alpha(opacity=" + opacity + ")"; 
}

//Main Image and Text
function SetMainImage() { 
    var opacStart = 0;
    var opacEnd = 100;
    var speed = 5;      //Change speed to control fading speed - larger number means slower
    var timer = 0; 
    
    changeOpac(50, 'bigimg');
    document.images['bigimg'].src = bigImages[index[2]];

    //determine the direction for the blending, if start and end are the same nothing happens 
    for(i = opacStart; i <= opacEnd; i++) { 
        setTimeout("changeOpac(" + i + ",'bigimg')",(timer * speed)); 
        timer++; 
    }
    
    FadeText();
} 

function MoveSlideLeft()
{
    var cross_slide = document.getElementById("slider");
    cross_slide.style.left=parseInt(cross_slide.style.left)-slidespeed+"px";
}

function SlideLeft()
{
    var i = 0;
    var tmpIndex = index[0];

    SetSliderHTML();

    changeOpac(sideImgOpac, 'thumb1');
    changeOpac(sideImgOpac, 'thumb2');
    changeOpac(100, 'thumb3');
    changeOpac(sideImgOpac, 'thumb4');
    
    for (i = 0; i < slidesteps; i++) {
        lefttime=setTimeout("MoveSlideLeft()",20*i);
        if (i < lastSlide) {
            index[i] = index[i+1];
        }
    }
    
    index[lastSlide] = tmpIndex;
    
    SetMainImage();
}

function MoveSlideRight()
{
    var cross_slide = document.getElementById("slider");
    cross_slide.style.left=parseInt(cross_slide.style.left)+slidespeed+"px";
}

function SlideRight()
{
    var i = 0;
    var tmpIndex = index[lastSlide];

    SetSliderHTML();

    changeOpac(sideImgOpac, 'thumb0');
    changeOpac(100, 'thumb1');
    changeOpac(sideImgOpac, 'thumb2');
    changeOpac(sideImgOpac, 'thumb3');

    for (i = 0; i < slidesteps; i++) {
        lefttime=setTimeout("MoveSlideRight()",20*i);
        if (i < lastSlide) {
            index[lastSlide-i] = index[lastSlide-1-i];
        }
    }
    
    index[0] = tmpIndex;
    
    SetMainImage();
}

