/*************************************************************
The following function has been adapted from code at:
http://www.webapplikations.com/pages/html_js/image_examples/OpenThumbnailImageFullSize.html
That code is copyrighted to webapplikations.com inc
*************************************************************/

/* megan changed width and height from 18 to 40 */
function ShowImage(ImageSrc) {
   var newImg = new Image();
   newImg.src = ImageSrc;
   newImg.style.border="0px";
   var winProps = "left=0, top=125, width="+(newImg.width+18)+", height="+(newImg.height+18)+", scrollbars=yes, toolbar=no, directories=no, menu bar=no, resizable=yes, status=no";
 
   newWin=window.open("","newWin",winProps);
   newWin.document.open();
   newWin.document.write('<html><head><title>TDOC Screen Shot - Please close after review</title><link rel="shortcut icon" href="TDOC_FAV.ico"></head>');

   newWin.document.write('<body onBlur="javascript:window.close();">');  

   newWin.document.write('<IMG id="TDOCImg" src="'+newImg.src+'" alt="Loading TDOC Sreen shot"/>');
   newWin.document.write('</body></html>')
   newWin.document.close();
   newWin.focus();
}

/*************** end of image display code *************/


function move_up() {
scroll_clipper.scrollTop = 0;
}

var menuids=new Array("verticalmenu") //Enter id(s) of UL menus, separated by commas
var submenuoffset=-2 //Offset of submenus from main menu. Default is -2 pixels.

function createcssmenu(){
for (var i=0; i<menuids.length; i++){
  var ultags=document.getElementById(menuids[i]).getElementsByTagName("ul")
    for (var t=0; t<ultags.length; t++){
    var spanref=document.createElement("span")
		spanref.className="arrowdiv"
		spanref.innerHTML="&nbsp;&nbsp;"
		ultags[t].parentNode.getElementsByTagName("a")[0].appendChild(spanref)
    ultags[t].parentNode.onmouseover=function(){
    this.getElementsByTagName("ul")[0].style.left=this.parentNode.offsetWidth+submenuoffset+"px"
    this.getElementsByTagName("ul")[0].style.display="block"
    }
    ultags[t].parentNode.onmouseout=function(){
    this.getElementsByTagName("ul")[0].style.display="none"
    }
    }
  }
}


if (window.addEventListener)
window.addEventListener("load", createcssmenu, false)
else if (window.attachEvent)
window.attachEvent("onload", createcssmenu)

var loadedobjects=""
var rootdomain="http://"+window.location.hostname

function ajaxpage(url, containerid){
var page_request = false
if (window.XMLHttpRequest) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
}
catch (e){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false
page_request.onreadystatechange=function(){
loadpage(page_request, containerid)
}
page_request.open('GET', url, true)
page_request.send(null)
}

function loadpage(page_request, containerid){
if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
document.getElementById(containerid).innerHTML=page_request.responseText
}

function isDemoOk(){     IsOk=true;     bver=Math.round(parseFloat(navigator.appVersion) * 1000);     if (navigator.appName.substring(0,8) == "Netscape")     {         if ((bver<5000) && (navigator.appVersion.indexOf("Mac")> 0))             IsOk=false;         else if (bver<4060)             IsOk=false;     }	 if (navigator.appName.substring(0,9) == "Microsoft")     {         if(bver<4000)             IsOk=false;     }     plugins=navigator.plugins;     if (plugins!=null && IsOk==false)     {         for(i=0;i!=plugins.length;i++)              if((plugins[i].name.indexOf("1.0")<0) && (plugins[i].name.indexOf("Java Plug-in")>=0))                  IsOk=true;     }     return IsOk;}

function openDemo(htmlFile,htmlWidth,htmlHeight){var bua = navigator.userAgent;     s = 'resizable=1,toolbar=0,menubar=0,scrollbars=0,status=0,location=0,directory=0';     if(!isDemoOk())     {          open("Rolling_error.html",'',s);     }     else     {     if (bua.indexOf("Opera")!= -1)       {          window.open(htmlFile+".htm",'','width='+htmlWidth+',height='+htmlHeight+',top=10,left=10');      }     else      {          window.open(htmlFile+".htm",'','width='+htmlWidth+',height='+htmlHeight+',top=10,left=10');      }      }}

/*************************************************************************
  This code is from Dynamic Web Coding at http://www.dyn-web.com/
*************************************************************************/

function changeContent(id,shtml) {
   if (document.getElementById || document.all) {
      var el = document.getElementById? document.getElementById(id): document.all[id];
      if (el && typeof el.innerHTML != "undefined") el.innerHTML = shtml;
   }

}

/*message arrays for the scroller*/

var pausecontent=new Array()
pausecontent[0]='Revolutionising Document Control Since 1990'
pausecontent[1]='Handles both Paper & Electronic Documents'
pausecontent[2]='Version 5 released August 2007'
pausecontent[3]='Powerful, Cost Effective, and Easy to Use'
pausecontent[4]='First in the market - Still the leader'
pausecontent[5]='Continuous Development driven by Users'
pausecontent[6]='Transmittals on Paper or CD, Email or FTP'
pausecontent[7]='TQ / RFIs handled per industry standard'
pausecontent[8]='Tracks Phone Calls, Notes, and Emails'
pausecontent[9]='Email by Outlook, Groupwise, Lotus Notes, or SMTP'
pausecontent[10]='Includes Record Diary, Snagging, & Meetings'
pausecontent[11]='Handles Time Allocation Sheets'
pausecontent[12]='Record Actual, Current, & Planned Key Event Dates'
pausecontent[13]='With a full SDRS link to planning'
pausecontent[14]='Unique keyword mechanism for Contract Claims'
pausecontent[14]='No Job too small, or Project too large'
pausecontent[15]='Make it EASY for others to communicate with you'
pausecontent[16]='Single or Multi User on LAN, WAN or VPN'
pausecontent[17]='Quick and Easy to install and configure'
pausecontent[18]=''

function pausescroller(content, divId, divClass, delay){
this.content=content //message array content
this.tickerid=divId //ID of ticker div to display information
this.delay=delay //Delay between msg change, in miliseconds.
this.mouseoverBol=0 //Boolean to indicate whether mouse is currently over scroller (and pause it if it is)
this.hiddendivpointer=1 //index of message array for hidden div
document.write('<div id="'+divId+'" class="'+divClass+'" style="position: relative; overflow: hidden"><div class="innerDiv" style="position: absolute; width: 100%" id="'+divId+'1">'+content[0]+'</div><div class="innerDiv" style="position: absolute; width: 100%; visibility: hidden" id="'+divId+'2">'+content[1]+'</div></div>')
var scrollerinstance=this
if (window.addEventListener) //run onload in DOM2 browsers
window.addEventListener("load", function(){scrollerinstance.initialize()}, false)
else if (window.attachEvent) //run onload in IE5.5+
window.attachEvent("onload", function(){scrollerinstance.initialize()})
else if (document.getElementById) //if legacy DOM browsers, just start scroller after 0.5 sec
setTimeout(function(){scrollerinstance.initialize()}, 500)
}

// -------------------------------------------------------------------
// initialize()- Initialize scroller method.
// -Get div objects, set initial positions, start up down animation
// -------------------------------------------------------------------

pausescroller.prototype.initialize=function(){
this.tickerdiv=document.getElementById(this.tickerid)
this.visiblediv=document.getElementById(this.tickerid+"1")
this.hiddendiv=this.hiddendiv=document.getElementById(this.tickerid+"2")
this.visibledivtop=parseInt(pausescroller.getCSSpadding(this.tickerdiv))
//set width of inner DIVs to outer DIV's width minus padding (padding assumed to be top padding x 2)
this.visiblediv.style.width=this.hiddendiv.style.width=this.tickerdiv.offsetWidth-(this.visibledivtop*2)+"px"
this.getinline(this.visiblediv, this.hiddendiv)
this.hiddendiv.style.visibility="visible"
var scrollerinstance=this
document.getElementById(this.tickerid).onmouseover=function(){scrollerinstance.mouseoverBol=1}
document.getElementById(this.tickerid).onmouseout=function(){scrollerinstance.mouseoverBol=0}
if (window.attachEvent) //Clean up loose references in IE
window.attachEvent("onunload", function(){scrollerinstance.tickerdiv.onmouseover=scrollerinstance.tickerdiv.onmouseout=null})
setTimeout(function(){scrollerinstance.animateup()}, this.delay)
}


// -------------------------------------------------------------------
// animateup()- Move the two inner divs of the scroller up and in sync
// -------------------------------------------------------------------

pausescroller.prototype.animateup=function(){
var scrollerinstance=this
if (parseInt(this.hiddendiv.style.top)>(this.visibledivtop+5)){
this.visiblediv.style.top=parseInt(this.visiblediv.style.top)-5+"px"
this.hiddendiv.style.top=parseInt(this.hiddendiv.style.top)-5+"px"
setTimeout(function(){scrollerinstance.animateup()}, 50)
}
else{
this.getinline(this.hiddendiv, this.visiblediv)
this.swapdivs()
setTimeout(function(){scrollerinstance.setmessage()}, this.delay)
}
}

// -------------------------------------------------------------------
// swapdivs()- Swap between which is the visible and which is the hidden div
// -------------------------------------------------------------------

pausescroller.prototype.swapdivs=function(){
var tempcontainer=this.visiblediv
this.visiblediv=this.hiddendiv
this.hiddendiv=tempcontainer
}

pausescroller.prototype.getinline=function(div1, div2){
div1.style.top=this.visibledivtop+"px"
div2.style.top=Math.max(div1.parentNode.offsetHeight, div1.offsetHeight)+"px"
}

// -------------------------------------------------------------------
// setmessage()- Populate the hidden div with the next message before it's visible
// -------------------------------------------------------------------

pausescroller.prototype.setmessage=function(){
var scrollerinstance=this
if (this.mouseoverBol==1) //if mouse is currently over scoller, do nothing (pause it)
setTimeout(function(){scrollerinstance.setmessage()}, 100)
else{
var i=this.hiddendivpointer
var ceiling=this.content.length
this.hiddendivpointer=(i+1>ceiling-1)? 0 : i+1
this.hiddendiv.innerHTML=this.content[this.hiddendivpointer]
this.animateup()
}
}

pausescroller.getCSSpadding=function(tickerobj){ //get CSS padding value, if any
if (tickerobj.currentStyle)
return tickerobj.currentStyle["paddingTop"]
else if (window.getComputedStyle) //if DOM2
return window.getComputedStyle(tickerobj, "").getPropertyValue("padding-top")
else
return 0
}

/***********************************************
* Pausing up-down scroller- © Dynamic Drive (www.dynamicdrive.com)
***********************************************/
