// Copyright Acro Media Inc. 1998-2003, www.acromediainc.com
graphicsDir = dirDepth+"graphics/nav/";
dirDepth = dirDepth+"";

// Copyright Acro Media Inc. 1998-2005, www.acromediainc.com

var hasFlash = 0;

// check with objects first
if(navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"] && navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin){
	if(navigator.plugins && navigator.plugins["Shockwave Flash"]){
		hasFlash = 1;
	}
}

// check with IE objects
else if (navigator.userAgent && (navigator.userAgent.indexOf("MSIE")>=0)){
	if((navigator.userAgent.indexOf("Windows 95") != -1) || (navigator.userAgent.indexOf("Windows 98") != -1) || (navigator.userAgent.indexOf("Windows NT") != -1)) {
		with(document){
			writeln('<SCRIPT LANGUAGE=VBScript\>');
			writeln('on error resume next');
			writeln('hasFlash = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash")))');
			writeln('<\/SCRIPT\>');
		}
	}
	// give Macs one last chance - Mac IE 4.5 cannot detect flash, but is guaranteed to have it.
	else if((navigator.userAgent.indexOf("Mac") != -1) && (parseFloat(navigator.appVersion) >= 4)){
		hasFlash = 1;
	}
}


// Setup global variables and Style settings for VER 4+ browsers
var imageNames;
var imageOver;
preloaded = 0;

NS4 = (document.layers) ? true : false;
IE4 = (document.all && !document.getElementById) ? true : false;
IE5 = (document.all && document.getElementById) ? true : false;
NS6 = (!document.all && document.getElementById) ? true : false;

isDom = (NS6 || IE5) ? true : false;

NS3 = (!NS4 && !IE4 && document.images) ? true : false;
IE3 = (!NS4 && !IE4 && !NS3 && (navigator.userAgent.indexOf("MSIE") != -1)) ? true : false;
NS2 = (!NS4 && !IE4 && !NS3 && !IE3 && !document.images) ? true : false;
isMac = (navigator.appVersion.indexOf("Mac") != -1) ? true : false;

isGo = 0;
doc = (NS4) ? "document" : "document.all";
sty = (NS4) ? "" : ".style";

if(NS4 || isDom || (IE4 && !isMac)){
	defaultStyle = "<STYLE TYPE='text/css'>"
	+ ".obj {"
	+ "position:absolute;"
	+ "visibility:hidden;"
	+ "width:10;"
	+ "height:10;"
	+ "}"
	+ "</STYLE>";

	document.write(defaultStyle);
}

if (document.images) {
	imageNames = new initArray("button1", "button2", "button3", "button4", "button5", "button6");
	imageOver = new initArray("b_home_02.gif", "b_services_02.gif", "b_about_02.gif", "b_news_02.gif", "b_tips_02.gif", "b_contact_02.gif");
}


function preloadImages(){
	if(document.images){
		var i, temp;

		for(i=0; i<imageNames.length; i++){
			document.images[imageNames[i]].offsrc = document.images[imageNames[i]].src;
		}

		for(i=0; i<imageNames.length; i++){
			temp = new Image();
			temp.src = graphicsDir + imageOver[i];
			document.images[imageNames[i]].oversrc = temp.src;
		}
		preloaded = true;
	}
}

function initArray(){
      if (document.images) {
      this.length = initArray.arguments.length;
      for (var i=0;i<= this.length; i++)
         this[i] = initArray.arguments[i];
   }
}

function mouseOver(imageID) {
	if (document.images && preloaded) {
		document.images[imageNames[imageID]].src = document.images[imageNames[imageID]].oversrc;
		hideMenu = 0;
		eval("show('menu"+imageID+"')");
	}
}

function mouseOut(imageID) {
	if (document.images && preloaded){
		document.images[imageNames[imageID]].src = document.images[imageNames[imageID]].offsrc;
		eval("hide('menu"+imageID+"')");
	}
}

if(NS4 || IE4) document.write("<SCRIPT LANGUAGE='JavaScript' SRC='"+dirDepth+"menuinfo.js'><\/SCRIPT>");
if(NS4 || IE4 || isDom) document.write("<SCRIPT LANGUAGE='JavaScript' SRC='"+dirDepth+"menuinfo.js'><\/SCRIPT>");
if(NS4){
	document.write("<SCRIPT LANGUAGE='JavaScript' SRC='"+dirDepth+"ns_menus.js'><\/SCRIPT>");
}
else if(IE4){
	document.write("<SCRIPT LANGUAGE='JavaScript' SRC='"+dirDepth+"ie_menus.js'><\/SCRIPT>");
}
else if(isDom){
	document.write("<SCRIPT LANGUAGE='JavaScript' SRC='"+dirDepth+"dom_menus.js'><\/SCRIPT>");
}

// Copyright Acro Media Inc. 1998-2005, www.acromediainc.com
// random advertisment

function initArray(){
  if (document.images) {
  this.length = initArray.arguments.length;
  for (var i=0;i<= this.length; i++)
 this[i] = initArray.arguments[i];
   }
}


//-- Generate a random number between 1 and 12.
var rNum=NaN
while (isNaN(rNum)) {
	rNum=Math.floor(Math.random()*(12))
}
rNum += 1;

//-- Generates a random number between 1 and sizeIn - 1
var gNum=NaN;
function getRandom(sizeIn){
	var gNum=NaN
	while (isNaN(gNum)){
		gNum=Math.floor(Math.random()*(sizeIn - 1));
	}
	gNum += 1;

	return gNum;
}



// Copyright Acro Media Inc. 1998-2005, www.acromediainc.com
var newWin;

function openUp(windowURL, windowWidth, windowHeight) {
  var topPos = "";
  var leftPos = "";
  if(!windowWidth) windowWidth = 0;
  if(!windowHeight) windowHeight = 0;
  if(windowWidth == 0){
    if(screen){
      windowWidth = screen.availWidth -10;
    }
    else{
      windowWidth = 790;
    }
    leftPos = ",left=0";
  }
  if(windowHeight == 0){
    if(screen){
      windowHeight = screen.availHeight -30;
    }
    else{
      windowHeight = 790;
    }
    topPos = ",top=0";
  }

  newWin = window.open(windowURL,"acromedia","toolbar=no,menubar=0,width="+windowWidth+",height="+windowHeight+topPos+leftPos+",scrollbars=no,resizable=no");

  if(javascript_version > 1.0){
    setTimeout('newWin.focus();',100);
  }
}


function copyrightYear(){
	if(document.getElementById('insertYear')) document.getElementById('insertYear').innerHTML = new Date().getFullYear();
}

function siteOnLoad () {
	preloadImages();
	copyrightYear();
}

function addLoadEvent(func){
	var oldOnLoad = window.onload;
	if(typeof window.onload != 'function'){
		window.onload = func;
	}
	else{
		window.onload = function(){
			oldOnLoad();
			func();
		}
	}
}


addLoadEvent(siteOnLoad);
