// Copyright Acro Media Inc. 1998-2003, www.acromediainc.com

preloaded = 0;
var imageNames;
var imageOver;
graphicsDir = dirDepth+"graphics/toolbar/";

if (document.images) {
	imageNames = new initArray("home", "products", "tech", "questions", "contact", "checkout", "affiliate");
	imageOver = new initArray("b_home_02.gif", "b_products_02.gif", "b_tech_02.gif", "b_questions_02.gif", "b_contact_02.gif", "b_checkout_02.gif", "b_affiliate_02.gif");

}

entryPoint = document.referrer;
entryPoint.toLowerCase();
if(entryPoint.indexOf("airzonerecreation") == -1){
	var expires = new Date();
	expires.setTime(expires.getTime() + 3E11);   // about 10 years = "forever"
	setCookie("entryPoint", document.referrer, expires);
}

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 = 1;
	}
}

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;
	}
}

function mouseOut(imageID) {
	if (document.images && preloaded){
		document.images[imageNames[imageID]].src = document.images[imageNames[imageID]].offsrc;
	}
}

function toolover(tip){
	document.images["featuretip"].src = "../../graphics/products/m_"+tip+".gif";
}

function toolout(){
	document.images["featuretip"].src = "../../graphics/products/m_main.gif";
}

function setCookie(name, value, expires, path, domain, secure) {
	var curCookie = name + "=" + escape(value) +
			((expires) ? "; expires=" + expires.toGMTString() : "") +
			((path) ? "; path=" + path : "") +
			((domain) ? "; domain=" + domain : "") +
			((secure) ? "; secure" : "");
        document.cookie = curCookie;
}

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;
	}
}

function setCookie(name, value, expires, path, domain, secure) {
	var curCookie = name + "=" + escape(value) +
			((expires) ? "; expires=" + expires.toGMTString() : "") +
			((path) ? "; path=" + path : "") +
			((domain) ? "; domain=" + domain : "") +
			((secure) ? "; secure" : "");
        document.cookie = curCookie;
}



function playSound(){
	if(getCookie("playhomepagemusic") == 'no'){
		return 0;
	}
	else{
		setCookie("playhomepagemusic", 'no');
		return 1;
	}
}

pageName = "feedback";
formName = "contactForm";
requiredVars = new initArray("SHOW_2_Last_Name", "SHOW_3_Email");
requiredNames = new initArray("Last Name", "Email Address");

function checkRequired(){
	var formVar;
	var message;
	var comma;
	message = "";
	comma = "";
	for(i=0;i<requiredVars.length; i++){
		formVar = eval("document."+formName+"."+requiredVars[i]+".value");
		if(formVar == ""){
			message = requiredNames[i] + comma + message;
			if(comma == ""){
				comma = " and ";
			}
			else{
				comma = ", ";
			}
		}
	}
	if(message != ""){
		alert("Sorry, could not send "+pageName+" without all of the required information.\n\nPlease supply information for "+message+".");
		return false;
	}
	else{
		eval("document."+formName+".submit()");	
	}
}

entryPoint = document.referrer;
entryPoint.toLowerCase();
if(entryPoint.indexOf("airzonerecreation") == -1){
	var expires = new Date();
	expires.setTime(expires.getTime() + 3E11);   // about 10 years = "forever"
	setCookie("entryPoint", document.referrer, expires);
}

function setCookie(name, value, expires, path, domain, secure) {
	var curCookie = name + "=" + escape(value) +
			((expires) ? "; expires=" + expires.toGMTString() : "") +
			((path) ? "; path=" + path : "") +
			((domain) ? "; domain=" + domain : "") +
			((secure) ? "; secure" : "");
        document.cookie = curCookie;
}


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);
  }
}

entryPoint = document.referrer;
entryPoint.toLowerCase();
if(entryPoint.indexOf("airzonerecreation") == -1){
	var expires = new Date();
	expires.setTime(expires.getTime() + 3E11);   // about 10 years = "forever"
	setCookie("entryPoint", document.referrer, expires);
}

function setCookie(name, value, expires, path, domain, secure) {
	var curCookie = name + "=" + escape(value) +
			((expires) ? "; expires=" + expires.toGMTString() : "") +
			((path) ? "; path=" + path : "") +
			((domain) ? "; domain=" + domain : "") +
			((secure) ? "; secure" : "");
        document.cookie = curCookie;
}
