﻿/*  Title    : DMS Group Static Web Site Script
    Author   : David Goddard, WinWin Solutions Inc
    Written  : 15 June 2006
    Purpose  : This script file contains all the javascipt code usede
               for the Static part of the DMS Group website  */

// Global variables

var oLastBtn=0
var strTDColor = '#3366CC'
var g_RolledTD = new Object

function body_onload() {
    copyrightNotice()
    path = location.pathname
    pos = path.lastIndexOf("/")
    
    //alert("pos = " + pos)
    switch(pos) {
        case -1:
            page = path
            break
        case 0:
            page = path
            break
        default:
            page = path.substring(pos)
            break
    }
    
    pos = page.lastIndexOf(".")        
    switch(pos) {
        case -1:
            break
        case 0:
            break
        default:
            page = page.substring(1,pos)
   }     
   
   if (page=="/") {
   	page = "default"
   }
   	
   //alert("page is " + page)
   //document.getElementById(page).className = "LeftNavChosen"
   //document.getElementById(page).style.color = "#291084"
   document.getElementById(page).style.color = "red"
   document.getElementById(page).style.backgroundColor = "white"
    

}    
	
function RaiseButton(){
	window.event.cancelBubble=true;
	oBtn = window.event.srcElement;
	var bChosen = false;
	if(oLastBtn && oLastBtn != oBtn){
		HideButton();
	}
	if(oBtn.buttontype){
		oBtn.className = oBtn.buttontype + "Up";
		oLastBtn=oBtn;
		}
	else {
	oLastBtn = 0;
	}
}

function DepressButton(){
	window.event.cancelBubble=true;
	oBtn = window.event.srcElement;
	if(oBtn.buttontype){
		oBtn.className = oBtn.buttontype + "Down"; 
		if (oBtn.className == "LeftNavChosenDown") {
		oBtn.className = "LeftNavDown";
		}
	}
}

function HideButton(){
	if ((oLastBtn.buttontype == "LeftNavChosen") || (oLastBtn.buttontype == "LeftNavSubChosen")) {
		oLastBtn.className = oLastBtn.buttontype;
	}
	else {
	oLastBtn.className = oLastBtn.buttontype + "Off";
	}
}

function textRoll(strTextColor) {
	window.event.srcElement.style.color = strTextColor;
	window.event.cancelBubble = true;
}

function TDUnRoll() {    
	g_RolledTD.bgColor = strTDColor;	
}

function TDRoll(strTDColor) {
	window.event.srcElement.bgColor = strTDColor;
	g_RolledTD = window.event.srcElement;
	window.event.cancelBubble = true;
}

function copyrightNotice() {
    // This function is used to update
    // the copyright notice at the bottom of each page
    // so that the current year is displayed.
    // it updates an element named copyright year.
    // Call this on load of the page

    var now = new Date()
	var Year = now.getYear()
	copyrightYear.innerHTML = Year
}
					
document.onClick = TDUnRoll;
document.onmouseover = TDUnRoll;

function reportsMoreInfo(type) {
    // DMS More info box
	// Start a dialogbox and load the quote wizard page
	var args = new Object()
    args.type = type
    var list = "dialogHeight : 600px; dialogWidth : 800px; center: yes; resizable: no; status: no; help: no"
    url = "reportscontents.htm#" + type
    rtnValue = window.showModalDialog(url,args,list)
}        
