var CurrentDisplayIndex=0;

function get_updir (uplevel) {
var updir = '';

  if (uplevel == "0") updir='';
  if (uplevel == "1") updir='../';
  if (uplevel == "2") updir='../../';
  if (uplevel == "3") updir='../../../';
  if (uplevel == "4") updir='../../../';
  return (updir);	

}


  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-11111111-1']);
  _gaq.push(['_trackPageview']);

function trackGA()
{	
	
    if (document.domain.indexOf("agwebsite") != -1)
	{
		//called from www.agwebsitedev.com 
		//document.write ('domain name is ' + document.domain);
	}
	else
	{
		trackGA_NCWSS();
	}

}

function trackGA_NCWSS()
{	
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
}

function showDiv(div)
{
	document.getElementById(div).style.display = 'inline';
}

function hideDiv(div)
{
	document.getElementById(div).style.display = 'none';
}

function checkSubmit(e)
{
   if(e && e.keyCode == 13)
   {
      document.forms[0].submit();
   }
}

function disableEnterKey(e)
{
     var key;     
     if(window.event)
          key = window.event.keyCode; //IE
     else
          key = e.which; //firefox     
     return (key != 13);
}


function hide(id) {
   document.getElementById(id).style.display = 'none';
}

function show(id) {
   document.getElementById(id).style.display = 'block';
}

function displaySpotlightNext(curr,displayMax)
{
	if (CurrentDisplayIndex==0) {CurrentDisplayIndex=curr;}
	currTag = 'ssl' + CurrentDisplayIndex;
	hide(currTag);
	if (CurrentDisplayIndex >= displayMax) 
	{
		CurrentDisplayIndex = 1;
	}
	else
	{
		CurrentDisplayIndex++;
	}
	currTag = 'ssl' + CurrentDisplayIndex;
	show(currTag);
}

function displaySpotlightPrev(curr,displayMax)
{
	if (CurrentDisplayIndex==0) {CurrentDisplayIndex=curr;}
	currTag = 'ssl' + CurrentDisplayIndex;
	hide(currTag);
	if (CurrentDisplayIndex <= 1) 
	{
		CurrentDisplayIndex = displayMax;
	}
	else
	{
		CurrentDisplayIndex--;
	}
	currTag = 'ssl' + CurrentDisplayIndex;
	show(currTag);
}

function displaySpotlight(display,displayMax)
{
	var currTag = "";
	for (var i=1; i<=displayMax; i++)
	{	
    	currTag = 'ssl' + i;
		hide(currTag);
	}
	currTag = 'ssl' + display;
	show(currTag);
}


	
function showCents(val){
	var num = new Number(val);
	return num.toFixed(2);
}

function roundVal(val){
	var dec = 2;
	var result = Math.round(val*Math.pow(10,dec))/Math.pow(10,dec);
	return result;
}


function IsNumeric(sText)

{
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
   
   }
   
   	function calcCost()
	{
		with (document.purchase)
		{
			amount.value = showCents(amount.value);	
		}
	}
	
   

function verify_nonmember_form(thisform)
{
	
	with (thisform)
	{
		function validate(field,alerttxt)
		{	
			if (field.value==null||field.value==""||field.value==0){alert(alerttxt);return false;}  else {return true;}
		}	

		if (!validate(os0, "The attendees first name is required")) { os0.focus();return false; }
		if (!validate(os1, "The attendees last name is required")) { os1.focus();return false; }
		if (!validate(custom, "The attendees affiliation is required")) { custom.focus();return false; }
		// setup the hidden field for name  
		
	}

}


var	photos2011 = new Array (
		["","","",""],
		["images/photos/Let-the-Games-Begin.jpg", "Let the Games Begin!", "images/photos/thumbs/Let-the-Games-Begin.jpg", "1"],
		["images/photos/Calibration-Event.jpg", "Calibration Event", "images/photos/thumbs/Calibration-Event.jpg", "2"],
		["images/photos/NCWSS-1st-Place-Overall-Grad-Jason-Parrish-Ohio-State.jpg", "1st place overall Graduate Jason Parrish of Ohio State", "images/photos/thumbs/NCWSS-1st-Place-Overall-Grad-Jason-Parrish-Ohio-State.jpg", "3"],
		["images/photos/NCWSS-1st-Place-Undergrad-Ohio-State-Univ-Team-1.jpg", "1st place undergrad Ohio State - Team 1", "images/photos/thumbs/NCWSS-1st-Place-Undergrad-Ohio-State-Univ-Team-1.jpg", "4"],
		["images/photos/NCWSS-2nd-Place-overall-Grad-Indiv-Terry-Ryan-Purdue-Univ.jpg", "2nd place overall graduate individual Terry Ryan of Purdue University", "images/photos/thumbs/NCWSS-2nd-Place-overall-Grad-Indiv-Terry-Ryan-Purdue-Univ.jpg", "5"],
		["images/photos/NCWSS-2nd-Place-Undergrad-Ohio-State-Univ-Team-2.jpg", "2nd place undergrad Ohio State - Team 2", "images/photos/thumbs/NCWSS-2nd-Place-Undergrad-Ohio-State-Univ-Team-2.jpg", "6"],
		["images/photos/NCWSS-3rd-Place-Grad--Overall-Indiv-Tye-Shauck-Univ-of-Missouri.jpg", "3rd place graduate and overall individual Tye Shauck of University of Missouri", "images/photos/thumbs/NCWSS-3rd-Place-Grad--Overall-Indiv-Tye-Shauck-Univ-of-Missouri.jpg", "7"],
		["images/photos/NCWSS-3rd-Place-Grad-Team-Ohio-State-Team-2.jpg", "3rd place graduate team Ohio State - Team 2", "images/photos/thumbs/NCWSS-3rd-Place-Grad-Team-Ohio-State-Team-2.jpg", "8"],
		["images/photos/NCWSS-Grad-Team-1st-Place-Purdue-Univ-and-overall-Weed-Olympic-winners.jpg", "1st place graduate team and overall Weed Olympic winners - Purdue University", "images/photos/thumbs/NCWSS-Grad-Team-1st-Place-Purdue-Univ-and-overall-Weed-Olympic-winners.jpg", "9"],
		["images/photos/NCWSS-President-Mark-Wrucke-(right)-and-Univ-of-Missouri-Coach-Kevin-Bradley.jpg", "NCWSS President Mark Wrucke (right) and University of Missouri Coach Kevin Bradley", "images/photos/thumbs/NCWSS-President-Mark-Wrucke-(right)-and-Univ-of-Missouri-Coach-Kevin-Bradley.jpg", "10"],
		["images/photos/NCWSS-Under-grad-Indiv-winners-1st-Michelle-Shepherd-2nd-Christine-Shannon-3rd-Beverly-Lennartz-all-Ohio-State-Univ.jpg", "Undergrade winners 1st Michelle-Shepherd, 2nd Christine Shannon, 3rd Beverly Lennartz,<br /> all from Ohio State University", "images/photos/thumbs/NCWSS-Under-grad-Indiv-winners-1st-Michelle-Shepherd-2nd-Christine-Shannon-3rd-Beverly-Lennartz-all-Ohio-State-Univ.jpg", "11"],
		["images/photos/Weed-ID.jpg", "Weed ID", "images/photos/thumbs/Weed-ID.jpg", "12"],
		["images/photos/Weed-Olympic-Sponsors.jpg", "Weed Olympic Sponsors", "images/photos/thumbs/Weed-Olympic-Sponsors.jpg", "13"]
		);


var gpicnum;
var gpicnummin;
var gpicnummax;
var gpicstate = 'ms';
	
function ReplaceImage(name, state)
{
	for (i = 0; i < imgCounter; i++) {
		if (document.images[ImageList[i][NameIndex]] != null) {
			if ((name == ImageList[i][NameIndex]) && (ImageList[i][state] != null))
				document.images[name].src = ImageList[i][state].src;
		}
	}
}

function displayThumb(picnum) 
{ 
	gpicnum = picnum;
	thumb = "";
	//var fullsrc = gpicstate + '_' + gpicnum + '.jpg';
	if (photos2011[gpicnum])
	{
		var thumb = photos2011[gpicnum][2];
	}
  	document.write('<img src="'+thumb+'" border="0" vspace="3">');
}


function initPicNum(picstate, picnum, picmin, picmax) 
{ 
	gpicstate = picstate;
	gpicnum = picnum;
	gpicnummin = picmin;
	gpicnummax = picmax;
}

function setPic(x) 
{ 
	gpicnum = x;
	//var fullsrc = gpicstate + '_' + gpicnum + '.jpg';
	var fullsrc = photos2011[gpicnum][0];
   eval("self.document.images.bigpic.src= [fullsrc]");
//   hide("caption");
   if (document.getElementById("caption"))
   {document.getElementById("caption").innerHTML = photos2011[gpicnum][1];}
//   show("caption");
 
}

function setPicNext() 
{ 
	var newpicnum = gpicnum;
	newpicnum++;
	if (newpicnum > gpicnummax) {newpicnum = gpicnummin;}
	setPic(newpicnum);
}

function setPicPrev() 
{ 
	var newpicnum = gpicnum;
	newpicnum--;
	if (newpicnum < gpicnummin) {newpicnum = gpicnummax;}
	setPic(newpicnum);
}



