// JavaScript Document
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

// Validate SEARCH Field
function valid_search(){
  myOption = -1;
  for (i=searchform.searchtype.length-1; i > -1; i--) {
	if (searchform.searchtype[i].checked) {
	myOption = i; i = -1;
	}
  }
  var sText=document.getElementById("searchfield").value;

  if (searchform.searchtype[myOption].value=="loc"){
	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;
			alert("Please enter a valid ZIP Code.");
			document.getElementById("searchfield").focus();
			return false
		}
		return IsNumber
	}
  }
  if (searchform.searchtype[myOption].value=="prd"){
	  window.location='search.php?searchtype=PRODUCTS&search='+sText;
  }
  if (searchform.searchtype[myOption].value=="site"){
	  window.location="search-results.php?q="+sText;
  }
}

// Opens links to photo.php
function PopupPic(sPicURL) { 
	window.open( "photo.php?"+sPicURL, "",  
	"resizable=1,HEIGHT=200,WIDTH=200"); 
} 

// Product video popup script
function pop_up( url, width, height ) {
	if (width > 10) {
		width = 350;
	}
	if (height > 10) {
		height= 150;
	}
	open(url,'popup_window','width=' + width + ',height=' + height + ',menu=no,scrollbars=no,toolbar=no,links=no,resize=no,maximize=no,top=100,left=100');
}

function showStatus(msg) { window.status = msg; return true; }

function openMovie(movieID) {
	if (movieID.length = 5) {
		movieURL = "http://www.tntfireworks.com/video.php?pid="+movieID;
		open(movieURL,movieID,'width=620,height=480');
	}
}


function openPromoMovie() {
	movieURL = "http://www.tntfireworks.com/promotions-video.php";
	open(movieURL,'PastWinners','width=405,height=270');
}


function validateLoc() {
	document.getType.zip.value=document.maplocation.zip.value;
	document.getType.mil.value=document.maplocation.mil.value;
	document.getElementById('chooseType').submit();
}