// Auto-JavaScript Copyright ©2001 Silicon Graffiti
// All rights reserved. Reproduction in whole or in part, or alteration without written consent of
// any part or the entirety of this copyrighted material is expressly forbidden and subject to the
//penalties laid out in the Berne Convention on intenational copyrights.

document.debug = 0;

document.initLyr = 'ctntoplyr'

function detect() {
   bName = navigator.appName
   bVer = navigator.appVersion
   ns4 = false
   ie4 = false
   ie5 = false
   ie6 = false
   ns5 = false
   if (bVer.indexOf('MSIE') != -1) {
      bNumber = bVer.indexOf('MSIE')+5
      bVersion = parseFloat(bVer.substr(bNumber,3))
      bText = bVersion.toString()
      bSet = 'ie'+bText.substr(0,1)
      eval(bSet+' = true;')
   }
   else if (bName.indexOf('Netscape') != -1) {
      bNumber = parseFloat(bVer.substr(0,4))
      bText = bNumber.toString()
      bSet = 'ns'+bText.substr(0,1)
      eval(bSet+' = true;')
   }
   else {
      bSet = 'other'
   }
   if (ie4 || ie5 || ie6) {
     window.onresize = build
   }
}
mmgrh = window.location.toString();
if (mmgrh.indexOf('classes') != -1) {
   imagepath="../images/"
}
else {
   imagepath="images/"
}

function up() {
   if (arguments.length == 1) {
      if (document.images) {
         document.images[arguments[0]].src = imagepath+arguments[0]+'_on.gif'
      }
   }
   else if (arguments.length > 1) {
      //alert(arguments.length)
      for (i=0;i<=arguments.length-1;i++) {
	     if (arguments[i].indexOf('&') != -1) {
		    argList = arguments[i].split('&')
			document.images[argList[0]].src = imagepath+argList[1]
	     }
		 else {
	        document.images[arguments[i]].src = imagepath+arguments[i]+'_on.gif'
	     }
	  }
   }
   else if (arguments.length <= 0) {
      alert('Invalid number of arguments for mouseover script!')
   }
}

function lyrSwp(img,par) {
  if (par == 'up') {
    if (ns4) {
	  document.layers['ctnbottomlyr'].document.images[img].src = 'images/lblue.gif'
	}
	else if (ie4 || ie5 || ie6 || ns5) {
	  document.images[img].src = 'images/lblue.gif'
	}
  }
  else if (par == 'dwn') {
    if (ns4) {
	  document.layers['ctnbottomlyr'].document.images[img].src = 'images/dblue.gif'
	}
	else if (ie4 || ie5 || ie6 || ns5) {
	  document.images[img].src = 'images/dblue.gif'
	}
  }
}
 
function dwn() {
   if (arguments.length == 1) {
      if (document.images) {
         document.images[arguments[0]].src = imagepath+arguments[0]+'_off.gif'
      }
   }
   else if (arguments.length > 1) {
      for (i=0;i<=arguments.length-1;i++) {
	     if (arguments[i].indexOf('&') != -1) {
		    argList = arguments[i].split('&')
			document.images[argList[0]].src = imagepath+argList[1]
	     }
		 else {
	        document.images[arguments[i]].src = imagepath+arguments[i]+'_off.gif'
	     }
	  }
   }
   else if (arguments.length <= 0) {
      alert('Invalid number of arguments for mouseout script!')
   }
}

function preload(img,imgObj) {
   eval(img+' = new Image()')
   eval(img+'.src = \"'+imagepath+imgObj+'\"')
   if (document.debug == 1) {
      alert('autoPreload debug: Preloaded '+imagepath+imgObj+' into '+img)
   }
   if (img=='' || imgObj=='') {
      if (document.debug == 1) {
	     alert('blank image')
	  }
   }
}

function autoPreload() {
   outStr = ''
   for (i=0; i<=document.images.length-1; i++) {
      if (document.images[i].name != '') {
	     outStr+=document.images[i].name+','
	  }
   }
   //alert(outStr)
   outStr = outStr.substr(0,outStr.length-1)
   namedImages = outStr.split(',')
   for (i=0; i<=namedImages.length-1; i++) {
      //alert('preload(\''+namedImages[i]+'_on\',\''+namedImages[i]+'_on.gif\')')
	  preload(namedImages[i]+'_on',namedImages[i]+'_on.gif')
   }
}

function getFocus() {
   window.self.focus()
}

function build() {
   if (ns4) {
      x = window.innerWidth
	  //y = window.innerHeight
	  x2 = (x/2)-388
	  x3 = (x/2)+20
	  y2 = 178
	  q = document.layers.length-1
	  for (i=0; i<=q; i++) {
	     m = document.layers[i].name
		 if (m.indexOf('ctn') != -1) {
		    document.layers[i].left = x2
			//s = parseInt(document.layers[i].top)
			document.layers[i].top = y2
         }
		 if (m.indexOf('crr') != -1) {
		    document.layers[i].left = x3+37
			document.layers[i].top = 46
			//alert('Redid '+m)
	     }
      }
   }
   else if (ie4 || ie5 || ie6) {
      x = document.body.clientWidth
	  //y = document.body.clientHeight
	  x2 = (x/2)-380
	  x3 = (x/2)+63
	  y2 = 178
	  q = document.body.all.tags('DIV')
	  q2 = q.length-1
	  for (i=0; i<=q2; i++) {
	     m = q[i].id
		 if (m.indexOf('ctn') != -1) {
		    q[i].style.left = x2
			q[i].style.top = y2
	     }
		 if (m.indexOf('crr') != -1) {
		    q[i].style.left = x3
		    q[i].style.top = 54
			//alert('Redid '+m)
         }
      }
   }
   else if (ns5) {
      x = window.innerWidth
	  y = window.innerHeight
	  x2 = (x/2)-381
	  x3 = (x/2)+20
	  y2 = 178
	  q = document.getElementsByTagName('DIV')
	  q2 = q.length-1
	  for (i=0; i<=q2; i++) {
	     m = q[i].id
		 if (m.indexOf('ctn') != -1) {
		    q[i].style.left = x2
			q[i].style.top = y2
	     }
		 if (m.indexOf('crr') != -1 ) {
		    q[i].style.left = x3+39
			q[i].style.top = 46
			//alert('Redid '+m)
         }
      }
   }
   showLyr(document.initLyr)
}

function showLyr(lyr) {
   if (ns4) {
      document.layers[lyr].visibility = 'show'
   }
   else if (ie4 || ie5 || ie6) {
      document.all[lyr].style.visibility = 'visible'
   }
   else if (ns5) {
      q = document.getElementsByTagName('DIV')
	  q[lyr].style.visibility = 'visible'
   }
}

function getUniPopA() {
  UniformWindow = window.open('uniform_popup_a.html','UniformWindow','width=560,height=405,status=no,toolbars=no,location=no,scrolling=no,scrollbars=no,resizable=no')
}

function getUniPopB() {
  UniformWindow = window.open('uniform_popup_b.html','UniformWindow','width=560,height=405,status=no,toolbars=no,location=no,scrolling=no,scrollbars=no,resizable=no')
}

function getRules() {
  RulesWindow = window.open('rules.html','RulesWindow','width=560,height=405,status=no,toolbar=yes,location=no,scrolling=yes,scrollbars=yes,resizable=yes')
}

function getCalendar(str) {
  CalendarWindow = window.open('calendar/'+str+'.htm','CalendarWindow','width=760,height=580,status=no,toolbar=no,location=no,scrolling=yes,scrollbars=yes,resizable=yes')
}