//Random Image Script

//each time new images are added, the contents of 'dailyImage.txt' should be deleted.
//var dailyLinks = new Array("port_d3dv.php?fileName=addygoldtrophy","port_d3dv.php?fileName=addysilvercrystal","port_d3dv.php?fileName=alien","port_d3dv.php?fileName=artery","port_d3dv.php?fileName=baryetigercompare","port_d3dv.php?fileName=benfranklincrystal","port_d3dv.php?fileName=bentfork","port_d3dv.php?fileName=bikeseat","port_d3dv.php?fileName=bracelet","port_d3dv.php?fileName=controlstick","port_d3dv.php?fileName=cttemplate","port_d3dv.php?fileName=duck","port_d3dv.php?fileName=earstone","port_d3dv.php?fileName=ferrari","port_d3dv.php?fileName=frame","port_d3dv.php?fileName=franklinbust","port_d3dv.php?fileName=glasses","port_d3dv.php?fileName=hand","port_d3dv.php?fileName=headsculpture","port_d3dv.php?fileName=helix","port_d3dv.php?fileName=libertybell","port_d3dv.php?fileName=libertybellcrack","port_d3dv.php?fileName=machinedcover","port_d3dv.php?fileName=morfin","port_d3dv.php?fileName=normandylibertybell","port_d3dv.php?fileName=pkdandroid","port_d3dv.php?fileName=preen","port_d3dv.php?fileName=racingtruck","port_d3dv.php?fileName=richmondmonument","port_d3dv.php?fileName=silverdollar","port_d3dv.php?fileName=skullimplant","port_d3dv.php?fileName=spacesuit","port_d3dv.php?fileName=surgicaltemplate","port_d3dv.php?fileName=teethmold","port_d3dv.php?fileName=tomb","port_d3dv.php?fileName=turbineblade","port_d3dv.php?fileName=unrealmark","port_d3dv.php?fileName=usluge","port_d3dv.php?fileName=virtualmoulding","port_d3dv.php?fileName=wrightpropeller");
//var dailyImages = new Array("d3dv_addygoldtrophy.jpg","d3dv_addysilvercrystal.jpg","d3dv_alien.jpg","d3dv_artery","d3dv_baryetigercompare","d3dv_benfranklincrystal","d3dv_bentfork","d3dv_bikeseat","d3dv_bracelet","d3dv_controlstick","d3dv_cttemplate","d3dv_duck","d3dv_earstone","d3dv_ferrari","d3dv_frame","d3dv_franklinbust","d3dv_glasses","d3dv_hand","d3dv_headsculpture","d3dv_helix","d3dv_libertybell","d3dv_libertybellcrack","d3dv_machinedcover","d3dv_morfin","d3dv_normandylibertybell","d3dv_pkdandroid","d3dv_preen","d3dv_racingtruck","d3dv_richmondmonument","d3dv_silverdollar","d3dv_skullimplant","d3dv_spacesuit","d3dv_surgicaltemplate","d3dv_teethmold","d3dv_tomb","d3dv_turbineblade","d3dv_unrealmark","d3dv_usluge","d3dv_virtualmoulding","d3dv_wrightpropeller"); 
//var dailyAltTags = new Array("ADDY Gold Trophy","ADDY Silver Crystal","Alien","Artery","Barye Tiger Compare","Ben Franklin Crystal","Bent Fork","Bike Seat","Bracelet","Control Stick","CT Template","Duck","Ear Stone","Ferrari","Frame","Franklin Bust","Glasses","Hand","Head Sculpture","Helix","Liberty Bell","Liberty Bell Crack","Machined Cover","Mor-Fin","Normandy Liberty Bell","P.K.D. Android","Preen Neckpiece","Racing Truck","Richmond Monument","Silver Dollar","Skull Implant","Space Suit","Surgical Template","Teeth Mold","Tomb","Turbine Blade","Unreal Mark","US Luge","Virtual Moulding","Wright Propeller");

var arrHeaderOptions = new Array(
"home_airbag",
"home_apartment",
"home_atrium",
"home_awakening",
"home_bus",
"home_c5actual",
"home_c5surphaser",
"home_cockpit",
"home_drill",
"home_druidhill",
"home_f15b",
"home_face",
"home_ferrari",
"home_flywheel",
"home_fortpike",
"home_genius",
"home_imout",
"home_lbcollage",
"home_lion",
"home_ls",
"home_monument",
"home_pkdandroid",
"home_plane",
"home_radome",
"home_reaircraftoml",
"home_reservoir3",
"home_rosettastone",
"home_teeth",
"home_tomb",
"home_tomblaser",
"home_trackerwindtunnel",
"home_utmark",
"home_valleyforge",
"home_windtunnel"
);

var arrHeaderAltTags = new Array(
"Mars Rover Airbags - Testing",
"Apartment (Wireframe View) - Direct 3Dview Environment",
"Atrium - Direct 3Dview Environment",
"Awakening - Large Sculpture Installation Rendering",
"Bus Front - Surface Model",
"C-5 - Interior Long-Range Scanning",
"C-5 - Captured Surphaser 3D Point Data",
"Cockpit - Virtual Simulation",
"Drill - Polygonal Model",
"Druid Hill - Surface Model",
"F-15b Aircraft - Large-Volume Laser Scanning",
"Face - Skin/Bone Comparison",
"Ferrari - Colored 3D Scan Passes",
"Flywheel - Front/Back Color Deviation Analysis",
"Fort Pike - Aligned Large-Volume 3D Scan Data",
"Historic Sculpture - Laser Scanning",
"iMOUT - Virtual Urban Environment",
"Liberty Bell Collage - Real Bell, 3D Scan Data, Final Polygonal Model",
"Lion Sculpture - Laser Scanning",
"FARO Laser Scanner LS - Lens Detail",
"Richmond Monument Urn Detail - Marble Restoration",
"P.K.D. Android - Final Rapid NURBS Models",
"Plane - Constructing Surfaces",
"Radome - Final Surface Model",
"Reverse Engineering Aircraft OML - Surface Model",
"Reservoir 3 - Raw Point Cloud Data",
"Rosetta Stone Replica - Final Polygonal Model",
"Teeth - Polygonal Model",
"Tomb of the Unknowns - Laser Scanning",
"Tomb of the Unknowns - Scanning Detail",
"FARO Tracker - Scanning a Wind Tunnel Interior",
"Custom Video Game Character - Visualization",
"Valley Forge - Large-Volume Scanning",
"Wind Tunnel - Holding a Reflective Sphere for Taking Interior Measurements"
);

function RandomImage() {

var x = Math.round(arrHeaderOptions.length * Math.random())-1;
  x < 0 ? x = 0 : x = x;
 
  strHeaderImg ="";
  document.write("<img src=\"images/home/");
  document.write(arrHeaderOptions[x]);
  document.write(".jpg\" ");
  document.write("width=\"500\" border=\"0\" name=\"header\" alt=\"");
  document.write(arrHeaderAltTags[x]);
  document.write("\">");
  document.write("<p style='margin:0 0 0 0; text-align:right; width:100%; font-size:7pt; color:#0c1c47;'>"+arrHeaderAltTags[x]+"</p>");
}

//Get Date Script

function GetDate() {
d = new Date();
dateText = "";
dayValue = d.getDay();
if (dayValue == 0)
    dateText += "Sunday";
else if (dayValue == 1)
    dateText += "Monday";
else if (dayValue == 2)
    dateText += "Tuesday";
else if (dayValue == 3)
    dateText += "Wednesday";
else if (dayValue == 4)
    dateText += "Thursday";
else if (dayValue == 5)
    dateText += "Friday";
else if (dayValue == 6)
    dateText += "Saturday";

monthValue = d.getMonth();
dateText += " "
if (monthValue == 0)
    dateText += "January";
if (monthValue == 1)
    dateText += "February";
if (monthValue == 2)
    dateText += "March";
if (monthValue == 3)
    dateText += "April";
if (monthValue == 4)
    dateText += "May";
if (monthValue == 5)
    dateText += "June";
if (monthValue == 6)
    dateText += "July";
if (monthValue == 7)
    dateText += "August";
if (monthValue == 8)
    dateText += "September";
if (monthValue == 9)
    dateText += "October";
if (monthValue == 10)
    dateText += "November";
if (monthValue == 11)
    dateText += "December";

if (navigator.appName.indexOf('Microsoft') != -1)
dateText += " " + d.getDate() + ", " + (0000 + d.getYear());
else if (navigator.appName.indexOf('Netscape') != -1)
dateText += " " + d.getDate() + ", " + (1900 + d.getYear());
else dateText += " " + d.getDate() + ", " + (1900 + d.getYear());

document.open();
document.write(dateText);
}

// -------------------------------------------------------------------
// Advanced RSS Ticker (Ajax invocation) core file
// Author: Dynamic Drive (http://www.dynamicdrive.com)
// -------------------------------------------------------------------

//Relative URL syntax:
var lastrssbridgeurl="rss_bridge.php"

//Absolute URL syntax. Uncomment below line if you wish to use an absolute reference:
//var lastrssbridgeurl="http://"+window.location.hostname+"/lastrss/bridge.php"

////////////No need to edit beyond here//////////////

function createAjaxObj(){
var httprequest=false
if (window.XMLHttpRequest){ // if Mozilla, Safari etc
httprequest=new XMLHttpRequest()
if (httprequest.overrideMimeType)
httprequest.overrideMimeType('text/xml')
}
else if (window.ActiveXObject){ // if IE
try {
httprequest=new ActiveXObject("Msxml2.XMLHTTP");
} 
catch (e){
try{
httprequest=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e){}
}
}
return httprequest
}

// -------------------------------------------------------------------
// Main RSS Ticker Object function
// rssticker_ajax(RSS_id, cachetime, divId, divClass, delay, optionallogicswitch)
// -------------------------------------------------------------------

function rssticker_ajax(RSS_id, cachetime, divId, divClass, delay, logicswitch){
this.RSS_id=RSS_id //Array key indicating which RSS feed to display
this.cachetime=cachetime //Time to cache feed, in minutes. 0=no cache.
this.tickerid=divId //ID of ticker div to display information
this.delay=delay //Delay between msg change, in miliseconds.
this.logicswitch=(typeof logicswitch!="undefined")? logicswitch : ""
this.mouseoverBol=0 //Boolean to indicate whether mouse is currently over ticker (and pause it if it is)
this.pointer=0
this.opacitysetting=0.2 //Opacity value when reset. Internal use.
this.title=[], this.link=[], this.description=[], this.pubdate=[] //Arrays to hold each component of an RSS item
this.ajaxobj=createAjaxObj()
document.write('<div id="'+divId+'" class="'+divClass+'" >Loading RSS Feed...</div>')
if (window.getComputedStyle) //detect if moz-opacity is defined in external CSS for specified class
this.mozopacityisdefined=(window.getComputedStyle(document.getElementById(this.tickerid), "").getPropertyValue("-moz-opacity")==1)? 0 : 1
this.getAjaxcontent()
}

// -------------------------------------------------------------------
// getAjaxcontent()- Makes asynchronous GET request to "bridge.php" with the supplied parameters
// -------------------------------------------------------------------

rssticker_ajax.prototype.getAjaxcontent=function(){
if (this.ajaxobj){
var instanceOfTicker=this
var parameters="id="+encodeURIComponent(this.RSS_id)+"&cachetime="+this.cachetime+"&bustcache="+new Date().getTime()
this.ajaxobj.onreadystatechange=function(){instanceOfTicker.initialize()}
this.ajaxobj.open('GET', lastrssbridgeurl+"?"+parameters, true)
this.ajaxobj.send(null)
}
}

// -------------------------------------------------------------------
// initialize()- Initialize ticker method.
// -Gets contents of RSS content and parse it using JavaScript DOM methods 
// -------------------------------------------------------------------

rssticker_ajax.prototype.initialize=function(){ 
if (this.ajaxobj.readyState == 4){ //if request of file completed
if (this.ajaxobj.status==200){ //if request was successful
var xmldata=this.ajaxobj.responseXML
if(xmldata.getElementsByTagName("item").length==0){ //if no <item> elements found in returned content
document.getElementById(this.tickerid).innerHTML="Error Loading RSS Feed!<br />"+this.ajaxobj.responseText
return
}
var instanceOfTicker=this
this.feeditems=xmldata.getElementsByTagName("item")
//Cycle through RSS XML object and store each peice of an item inside a corresponding array
for (var i=0; i<this.feeditems.length; i++){
this.title[i]=this.feeditems[i].getElementsByTagName("title")[0].firstChild.nodeValue
this.link[i]=this.feeditems[i].getElementsByTagName("link")[0].firstChild.nodeValue
this.description[i]=this.feeditems[i].getElementsByTagName("description")[0].firstChild.nodeValue
this.pubdate[i]=this.feeditems[i].getElementsByTagName("pubDate")[0].firstChild.nodeValue
}
document.getElementById(this.tickerid).onmouseover=function(){instanceOfTicker.mouseoverBol=1}
document.getElementById(this.tickerid).onmouseout=function(){instanceOfTicker.mouseoverBol=0}
this.rotatemsg()
}
}
}

// -------------------------------------------------------------------
// rotatemsg()- Rotate through RSS messages and displays them
// -------------------------------------------------------------------

rssticker_ajax.prototype.rotatemsg=function(){
var instanceOfTicker=this
if (this.mouseoverBol==1) //if mouse is currently over ticker, do nothing (pause it)
setTimeout(function(){instanceOfTicker.rotatemsg()}, 100)
else{ //else, construct item, show and rotate it!
var tickerDiv=document.getElementById(this.tickerid)
var linktitle='<div class="rsstitle"><a href="'+this.link[this.pointer]+'">'+this.title[this.pointer]+'</a></div>'
var description='<div class="rssdescription">'+this.description[this.pointer]+'</div>'
var feeddate='<div class="rssdate">'+this.pubdate[this.pointer]+'</div>'
if (this.logicswitch.indexOf("description")==-1) description=""
if (this.logicswitch.indexOf("date")==-1) feeddate=""
var tickercontent=linktitle+feeddate+description //STRING FOR FEED CONTENTS 
this.fadetransition("reset") //FADE EFFECT- RESET OPACITY
tickerDiv.innerHTML=tickercontent
this.fadetimer1=setInterval(function(){instanceOfTicker.fadetransition('up', 'fadetimer1')}, 100) //FADE EFFECT- PLAY IT
this.pointer=(this.pointer<this.feeditems.length-1)? this.pointer+1 : 0
setTimeout(function(){instanceOfTicker.rotatemsg()}, this.delay) //update container every second
}
}

// -------------------------------------------------------------------
// fadetransition()- cross browser fade method for IE5.5+ and Mozilla/Firefox
// -------------------------------------------------------------------

rssticker_ajax.prototype.fadetransition=function(fadetype, timerid){
var tickerDiv=document.getElementById(this.tickerid)
if (fadetype=="reset")
this.opacitysetting=0.2
if (tickerDiv.filters && tickerDiv.filters[0]){
if (typeof tickerDiv.filters[0].opacity=="number") //IE6+
tickerDiv.filters[0].opacity=this.opacitysetting*100
else //IE 5.5
tickerDiv.style.filter="alpha(opacity="+this.opacitysetting*100+")"
}
else if (typeof tickerDiv.style.MozOpacity!="undefined" && this.mozopacityisdefined){
tickerDiv.style.MozOpacity=this.opacitysetting
}
if (fadetype=="up")
this.opacitysetting+=0.2
if (fadetype=="up" && this.opacitysetting>=1)
clearInterval(this[timerid])
}
