﻿function GetSrc()
{
    if (window.XMLHttpRequest)
    {
        xhttp=new XMLHttpRequest()
    }
    else
    {
        xhttp=new ActiveXObject("Microsoft.XMLHTTP")
    }
    xhttp.open("GET","http://www.olympic.edu/ocmcms/js/newtemp/rotate.xml",false);
    xhttp.send("");
    xmlDoc=xhttp.responseXML;
    
    var img1 = xmlDoc.getElementsByTagName("filename")[4].childNodes[0].nodeValue;
    
    document.getElementById('SlideShowImage').setAttribute("src","http://www.olympic.edu/ocmcms/Images/newtemp/banners/"+img1);
}

if (window.XMLHttpRequest)
{
    xhttp=new XMLHttpRequest()
}
else
{
    xhttp=new ActiveXObject("Microsoft.XMLHTTP")
}
xhttp.open("GET","http://www.olympic.edu/ocmcms/js/newtemp/rotate.xml",false);
xhttp.send("");
xmlDoc=xhttp.responseXML;

var img1 = xmlDoc.getElementsByTagName("filename")[4].childNodes[0].nodeValue;
var img2 = xmlDoc.getElementsByTagName("filename")[3].childNodes[0].nodeValue;
var img3 = xmlDoc.getElementsByTagName("filename")[2].childNodes[0].nodeValue;
var img4 = xmlDoc.getElementsByTagName("filename")[1].childNodes[0].nodeValue;
var img5 = xmlDoc.getElementsByTagName("filename")[0].childNodes[0].nodeValue;
var lnk1 = xmlDoc.getElementsByTagName("hyperlink")[4].childNodes[0].nodeValue;
var lnk2 = xmlDoc.getElementsByTagName("hyperlink")[3].childNodes[0].nodeValue;
var lnk3 = xmlDoc.getElementsByTagName("hyperlink")[2].childNodes[0].nodeValue;
var lnk4 = xmlDoc.getElementsByTagName("hyperlink")[1].childNodes[0].nodeValue;
var lnk5 = xmlDoc.getElementsByTagName("hyperlink")[0].childNodes[0].nodeValue;

// Set slideShowSpeed (milliseconds)
var slideShowSpeed = 7000;
// Duration of crossfade (milliseconds)
var crossFadeDuration = 15;
// Specify the image files
var Pic = new Array();
// to add more images, just continue
// the pattern, adding to the array below
/*Pic[0] = 'http://www.olympic.edu/ocmcms/images/newtemp/banners/1.jpg'
Pic[1] = 'http://www.olympic.edu/ocmcms/images/newtemp/banners/2.jpg'
Pic[2] = 'http://www.olympic.edu/ocmcms/images/newtemp/banners/3.jpg'
Pic[3] = 'http://www.olympic.edu/ocmcms/images/newtemp/banners/4.jpg'
Pic[4] = 'http://www.olympic.edu/ocmcms/images/newtemp/banners/5.jpg'*/

Pic[0] = 'http://www.olympic.edu/ocmcms/images/newtemp/banners/'+img1
Pic[1] = 'http://www.olympic.edu/ocmcms/images/newtemp/banners/'+img2
Pic[2] = 'http://www.olympic.edu/ocmcms/images/newtemp/banners/'+img3
Pic[3] = 'http://www.olympic.edu/ocmcms/images/newtemp/banners/'+img4
Pic[4] = 'http://www.olympic.edu/ocmcms/images/newtemp/banners/'+img5



var Link = new Array();

/*Link[0] = 'http://www.olympic.edu/Students/Registration'
Link[1] = 'http://apps.olympic.edu/classschedule'
Link[2] = 'http://www.olympic.edu/OCCalendar'
Link[3] = 'http://www.olympic.edu/Alerts'
Link[4] = 'http://www.olympic.edu/StudentEmail'*/

Link[0] = lnk1
Link[1] = lnk2
Link[2] = lnk3
Link[3] = lnk4
Link[4] = lnk5

// do not edit anything below this line
var t;
var j = 0;
var p = Pic.length;
var preLoad = new Array();

for (i = 0; i < p; i++) 
{
    preLoad[i] = new Image();
    preLoad[i].src = Pic[i];
}
window.onload=runSlideShow;

function runSlideShow() 
{
    if (document.all)
    {
        document.getElementById('SlideShowImage').style.filter="blendTrans(duration=2)";
        document.getElementById('SlideShowImage').style.filter="blendTrans(duration=crossFadeDuration)";
        document.getElementById('SlideShowImage').filters.blendTrans.Apply();
    }
    document.getElementById('SlideShowImage').src = preLoad[j].src;
    document.getElementById('SlideShowLink').href = Link[j];
    if (document.all) 
    {
        document.getElementById('SlideShowImage').filters.blendTrans.Play();
    }
    j = j + 1;
    if (j > (p - 1)) j = 0;
    t = setTimeout('runSlideShow()', slideShowSpeed);
}
