//determine the tallest div function
var d = document;
var listHt;

function getHeightTop(){
	h = d.getElementById("gsList").offsetHeight;
	//alert(h);
	listHt = h - 731;
	d.getElementById("bgrtcolumn").style.height = listHt +"px"; 
}

function imgSwap(oImg)
{
   var strOver  = "_on"    // image to be used with mouse over
   var strOff = "_off"     // normal image
   var strImg = oImg.src
   if (strImg.indexOf(strOver) != -1) 
      oImg.src = strImg.replace(strOver,strOff)
   else
      oImg.src = strImg.replace(strOff,strOver)
}

function showCustomPopUp(thisUrl,thisName,theseParams)
{
	remote = open(thisUrl, thisName, theseParams);
}

function emailCheck(val)
{
var EmailOk  = true
var Temp     = val;
var AtSym    = Temp.indexOf('@')
var Period   = Temp.lastIndexOf('.')
var Space    = Temp.indexOf(' ')
var Length   = Temp.length - 1   	   // Array is from 0 to length-1
	
	//Joe Damico 7-12-06
	//updated by Munz
	//makes so domain name is validated so there is no characters such as #
	if (Period > AtSym) {
		var domainName = Temp.substring(AtSym+1,Period);
		var filter  = /^([a-zA-Z0-9\-])$/;
		for (var i=0; i<domainName.length; i++) {
			var tmp = domainName.charAt(i);
			if (!filter.test(tmp) || (tmp == "-" && domainName.charAt(i - 1) == "-")) {
				return false;
			}
		}
	}
	
	
	if ((AtSym < 1) ||                 // '@' cannot be in first position
    (Period <= AtSym+1) ||             // Must be atleast one valid char btwn '@' and '.'
    (Period == Length ) ||             // Must be atleast one valid char after '.'
    (Space  != -1))                    // No empty spaces permitted
 	{
    	  return false;
 	}
	
   	return true;
}

function valForm(frm)
{
	if(!emailCheck(frm.emailAddress.value))
	{
		alert("Please enter a valid email address.");
		if(!document.layers)
		{
			document.getElementById("emailAddress").style.backgroundColor = "f9c755";
		}
		frm.emailAddress.focus();
		return false;
	}
	frm.submit();
}

function loadSky()
{
	var currentTime = new Date();
	currentTime = currentTime.getHours();
	if (currentTime == 6){ //6am to 7am
		$('top').className = 'bg1';
	} else if (currentTime == 7 || currentTime == 8){ //7am to 9am
		$('top').className = 'bg2';
	} else if (currentTime == 9){ //9am to 10am
		$('top').className = 'bg3';
	} else if (currentTime == 10 || currentTime == 11){ //10am to 12pm
		$('top').className = 'bg4';
	} else if (currentTime == 12 || currentTime == 13){ //12pm to 2pm
		$('top').className = 'bg5';
	} else if (currentTime == 14){ //2pm to 3pm
		$('top').className = 'bg6';
	} else if (currentTime == 15){ //3pm to 4pm
		$('top').className = 'bg7';
	} else if (currentTime == 16 || currentTime == 17){ //4pm to 6pm
		$('top').className = 'bg8';
	} else if (currentTime == 18){ //6pm to 7pm
		$('top').className = 'bg9';
	} else if (currentTime == 19){ //7pm to 8pm
		$('top').className = 'bg10';
	} else {
		$('top').className = 'bg11';//8pm to 6am
	}
	
}

function displayBrands(num)
{
	var yOffset = 405; //bubble spacing from top of page
	var homeBanner = $('homeBanner');
	if(homeBanner.style.display == 'none'){
		yOffset -= 48 //subtract 48px if the homebanner isn't displayed
		document.body.style.backgroundImage = 'url(../images/bg2.jpg)';
	} 
	
	var brand1 = $('brand1');
	var brand2 = $('brand2');
	var brand3 = $('brand3');
	var brand4 = $('brand4');
	var brand5 = $('brand5');
	var brand6 = $('brand6');
	var brand7 = $('brand7');
	
	brand1.appendChild(Wizzle.box({dataElement:'brandInnerTable1', className:'box2'}))
	brand2.appendChild(Wizzle.box({dataElement:'brandInnerTable2', className:'box2'}))
	brand3.appendChild(Wizzle.box({dataElement:'brandInnerTable3', className:'box2'}))
	brand4.appendChild(Wizzle.box({dataElement:'brandInnerTable4', className:'box2'}))
	brand5.appendChild(Wizzle.box({dataElement:'brandInnerTable5', className:'box2'}))
	brand6.appendChild(Wizzle.box({dataElement:'brandInnerTable6', className:'box2'}))
	brand7.appendChild(Wizzle.box({dataElement:'brandInnerTable7', className:'box2'}))
	
	brand1.onmouseover = function(){this.style.display = 'block';}
	brand1.onmouseout = function(){this.style.display = 'none';}
	brand2.onmouseover = function(){this.style.display = 'block';}
	brand2.onmouseout = function(){this.style.display = 'none';}
	brand3.onmouseover = function(){this.style.display = 'block';}
	brand3.onmouseout = function(){this.style.display = 'none';}
	brand4.onmouseover = function(){this.style.display = 'block';}
	brand4.onmouseout = function(){this.style.display = 'none';}
	brand5.onmouseover = function(){this.style.display = 'block';}
	brand5.onmouseout = function(){this.style.display = 'none';}
	brand6.onmouseover = function(){this.style.display = 'block';}
	brand6.onmouseout = function(){this.style.display = 'none';}
	brand7.onmouseover = function(){this.style.display = 'block';brand7.style.width = screen.availWidth + 'px';}
	brand7.onmouseout = function(){this.style.display = 'none';brand7.style.width = 'auto';}
	
	if(num==1){
		$('Nikegolf').onmouseover = function(){
			brand1.style.display = 'block';
			//brand1.style.top = '339px';
			brand1.style.left = '-65px';
			var brandInnerTable1 = $('brandInnerTable1')
			brand1.style.top = parseInt(yOffset - brandInnerTable1.offsetHeight) + 'px';
		}
		$('Nikegolf').onmouseout = function(){
			brand1.style.display = 'none';
		}
		$('Coleman').onmouseover = function(){
			brand2.style.display = 'block';
			brand2.style.left = '80px';
			var brandInnerTable2 = $('brandInnerTable2')
			brand2.style.top = parseInt(yOffset - brandInnerTable2.offsetHeight) + 'px';
		}
		$('Coleman').onmouseout = function(){
			brand2.style.display = 'none';
		}
		$('Columbia').onmouseover = function(){
			brand3.style.display = 'block';
			brand3.style.left = '210px';
			var brandInnerTable3 = $('brandInnerTable3');
			brand3.style.top = parseInt(yOffset - brandInnerTable3.offsetHeight) + 'px';
		}
		$('Columbia').onmouseout = function(){
			brand3.style.display = 'none';
		}
		$('Thule').onmouseover = function(){
			brand4.style.display = 'block';
			brand4.style.left = '330px';
			var brandInnerTable4 = $('brandInnerTable4');
			brand4.style.top = parseInt(yOffset - brandInnerTable4.offsetHeight) + 'px';
		}
		$('Thule').onmouseout = function(){
			brand4.style.display = 'none';
		}
		$('Carhartt').onmouseover = function(){
			brand5.style.display = 'block';
			//brand5.style.top = '342px';
			brand5.style.left = '445px';
			var brandInnerTable5 = $('brandInnerTable5');
			brand5.style.top = parseInt(yOffset - brandInnerTable5.offsetHeight) + 'px';
		}
		$('Carhartt').onmouseout = function(){
			brand5.style.display = 'none';
		}
		$('UnderArmour').onmouseover = function(){
			brand6.style.display = 'block';
			brand6.style.left = '526px';
			var brandInnerTable6 = $('brandInnerTable6');
			brand6.style.top = parseInt(yOffset - brandInnerTable6.offsetHeight) + 'px';
		}
		$('UnderArmour').onmouseout = function(){
			brand6.style.display = 'none';
		}
		$('MountainHardwear').onmouseover = function(){
			brand7.style.display = 'block';
			brand7.style.width = screen.availWidth + 'px';	
			brand7.style.left = '609px';
			var brandInnerTable7 = $('brandInnerTable7');
			brand7.style.top = parseInt(yOffset - brandInnerTable7.offsetHeight) + 'px';			
		}
		$('MountainHardwear').onmouseout = function(){
			brand7.style.display = 'none';
			brand7.style.width = 'auto';		
		}
	} else if (num==2) {
		$('Nikegolf').onmouseover = function(){
			brand1.style.display = 'block';
			//brand1.style.top = '342px';
			brand1.style.left = '-55px';
			var brandInnerTable1 = $('brandInnerTable1')
			brand1.style.top = parseInt(yOffset - brandInnerTable1.offsetHeight) + 'px';
		}
		$('Nikegolf').onmouseout = function(){
			brand1.style.display = 'none';
		}
		$('Oregon').onmouseover = function(){
			brand2.style.display = 'block';
			brand2.style.left = '70px';
			var brandInnerTable2 = $('brandInnerTable2')
			brand2.style.top = parseInt(yOffset - brandInnerTable2.offsetHeight) + 'px';
		}
		$('Oregon').onmouseout = function(){
			brand2.style.display = 'none';
		}
		$('Garmin').onmouseover = function(){
			brand3.style.display = 'block';
			brand3.style.left = '178px';
			var brandInnerTable3 = $('brandInnerTable3');
			brand3.style.top = parseInt(yOffset - brandInnerTable3.offsetHeight) + 'px';			
		}
		$('Garmin').onmouseout = function(){
			brand3.style.display = 'none';
		}
		$('Columbia').onmouseover = function(){
			brand4.style.display = 'block';
			brand4.style.left = '295px';
			var brandInnerTable4 = $('brandInnerTable4');
			brand4.style.top = parseInt(yOffset - brandInnerTable4.offsetHeight) + 'px';				
		}
		$('Columbia').onmouseout = function(){
			brand4.style.display = 'none';
		}
		$('Carhartt').onmouseover = function(){
			brand5.style.display = 'block';
			//brand5.style.top = '340px';
			brand5.style.left = '400px';
			var brandInnerTable5 = $('brandInnerTable5')
			brand5.style.top = parseInt(yOffset - brandInnerTable5.offsetHeight) + 'px';
		}
		$('Carhartt').onmouseout = function(){
			brand5.style.display = 'none';
		}
		$('Northface').onmouseover = function(){
			brand6.style.display = 'block';
			brand6.style.left = '497px';
			var brandInnerTable6 = $('brandInnerTable6');
			brand6.style.top = parseInt(yOffset - brandInnerTable6.offsetHeight) + 'px';
		}
		$('Northface').onmouseout = function(){
			brand6.style.display = 'none';
		}
		$('Taylormade').onmouseover = function(){
			brand7.style.display = 'block';
			brand7.style.width = screen.availWidth + 'px';	
			brand7.style.left = '600px';
			var brandInnerTable7 = $('brandInnerTable7');
			brand7.style.top = parseInt(yOffset - brandInnerTable7.offsetHeight) + 'px';		
		}
		$('Taylormade').onmouseout = function(){
			brand7.style.display = 'none';
			brand7.style.width = 'auto';		
		}	
	} else if (num==3){
		$('Bowflex').onmouseover = function(){
			brand1.style.display = 'block';
			//brand1.style.top = '340px';
			brand1.style.left = '-80px';
			var brandInnerTable1 = $('brandInnerTable1')
			brand1.style.top = parseInt(yOffset - brandInnerTable1.offsetHeight) + 'px';
		}
		$('Bowflex').onmouseout = function(){
			brand1.style.display = 'none';
		}
		$('Asics').onmouseover = function(){
			brand2.style.display = 'block';
			brand2.style.left = '29px';
			var brandInnerTable2 = $('brandInnerTable2')
			brand2.style.top = parseInt(yOffset - brandInnerTable2.offsetHeight) + 'px';
		}
		$('Asics').onmouseout = function(){
			brand2.style.display = 'none';
		}
		$('Leatherman').onmouseover = function(){
			brand3.style.display = 'block';
			//brand3.style.top = '339px';
			brand3.style.left = '144px';
			var brandInnerTable3 = $('brandInnerTable3')
			brand3.style.top = parseInt(yOffset - brandInnerTable3.offsetHeight) + 'px';
		}
		$('Leatherman').onmouseout = function(){
			brand3.style.display = 'none';
		}
		$('MountainHardwear').onmouseover = function(){
			brand4.style.display = 'block';
			brand4.style.left = '264px';
			var brandInnerTable4 = $('brandInnerTable4');
			brand4.style.top = parseInt(yOffset - brandInnerTable4.offsetHeight) + 'px';
		}
		$('MountainHardwear').onmouseout = function(){
			brand4.style.display = 'none';
		}
		$('UnderArmour').onmouseover = function(){
			brand5.style.display = 'block';
			brand5.style.left = '349px';
			var brandInnerTable5 = $('brandInnerTable5');
			brand5.style.top = parseInt(yOffset - brandInnerTable5.offsetHeight) + 'px';
		}
		$('UnderArmour').onmouseout = function(){
			brand5.style.display = 'none';
		}
		$('Yakima').onmouseover = function(){
			brand6.style.display = 'block';
			brand6.style.left = '444px';
			var brandInnerTable6 = $('brandInnerTable6');
			brand6.style.top = parseInt(yOffset - brandInnerTable6.offsetHeight) + 'px';
		}
		$('Yakima').onmouseout = function(){
			brand6.style.display = 'none';
		}
		$('Nikegolf').onmouseover = function(){
			brand7.style.display = 'block';
			brand7.style.width = screen.availWidth + 'px';	
			brand7.style.left = '570px';
			var brandInnerTable7 = $('brandInnerTable7');
			brand7.style.top = parseInt(yOffset - brandInnerTable7.offsetHeight) + 'px';		
		}
		$('Nikegolf').onmouseout = function(){
			brand7.style.display = 'none';
			brand7.style.width = 'auto';		
		}	
	} else {
		$('Garmin').onmouseover = function(){
			brand1.style.display = 'block';
			//brand1.style.top = '340px';
			brand1.style.left = '-66px';
			var brandInnerTable1 = $('brandInnerTable1')
			brand1.style.top = parseInt(yOffset - brandInnerTable1.offsetHeight) + 'px';
		}
		$('Garmin').onmouseout = function(){
			brand1.style.display = 'none';
		}
		$('Swarovski').onmouseover = function(){
			brand2.style.display = 'block';
			brand2.style.left = '44px';
			var brandInnerTable2 = $('brandInnerTable2')
			brand2.style.top = parseInt(yOffset - brandInnerTable2.offsetHeight) + 'px';
		}
		$('Swarovski').onmouseout = function(){
			brand2.style.display = 'none';
		}
		$('Sevylor').onmouseover = function(){
			brand3.style.display = 'block';
			//brand3.style.top = '339px';
			brand3.style.left = '161px';
			var brandInnerTable3 = $('brandInnerTable3')
			brand3.style.top = parseInt(yOffset - brandInnerTable3.offsetHeight) + 'px';
		}
		$('Sevylor').onmouseout = function(){
			brand3.style.display = 'none';
		}
		$('UnderArmour').onmouseover = function(){
			brand4.style.display = 'block';
			brand4.style.left = '256px';
			var brandInnerTable4 = $('brandInnerTable4');
			brand4.style.top = parseInt(yOffset - brandInnerTable4.offsetHeight) + 'px';
		}
		$('UnderArmour').onmouseout = function(){
			brand4.style.display = 'none';
		}
		$('Adidas').onmouseover = function(){
			brand5.style.display = 'block';
			brand5.style.left = '340px';
			var brandInnerTable5 = $('brandInnerTable5');
			brand5.style.top = parseInt(yOffset - brandInnerTable5.offsetHeight) + 'px';
		}
		$('Adidas').onmouseout = function(){
			brand5.style.display = 'none';
		}
		$('Crocs').onmouseover = function(){
			brand6.style.display = 'block';
			brand6.style.left = '450px';
			var brandInnerTable6 = $('brandInnerTable6');
			brand6.style.top = parseInt(yOffset - brandInnerTable6.offsetHeight) + 'px';
		}
		$('Crocs').onmouseout = function(){
			brand6.style.display = 'none';
		}
		$('Nikegolf').onmouseover = function(){
			brand7.style.display = 'block';
			brand7.style.width = screen.availWidth + 'px';	
			brand7.style.left = '566px';
			var brandInnerTable7 = $('brandInnerTable7');
			brand7.style.top = parseInt(yOffset - brandInnerTable7.offsetHeight) + 'px';		
		}
		$('Nikegolf').onmouseout = function(){
			brand7.style.display = 'none';
			brand7.style.width = 'auto';		
		}	
	}
}

