// Pop-up Window
function flash_window(url) {
	link = window.open(url,"Flash","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=400,height=350,left=10,top=15");
}

// We're bustin' outta dis frameset.
if ( window != top ) { top.location.href=location.href; }

// Fixes irritating Navigator 4 resize glitch.
// Causes JS errors in NN3 without the if (document.layers) line.
function reloadPage(init) {
	if (document.layers) {
	  if (init==true) with (navigator) {
	    if ((appName=="Netscape")&&(parseInt(appVersion==4))) {
	      document.pgW=innerWidth; document.pgH=innerHeight; oneresize=reloadPage; 
	    }
	  } else if (innerWidth!=document.pgW || innerHeight!=document.pgH) {
	    location.reload();
	  }
	}
}

// Prevents Escape key problem in forms in IE.
// Causes error message in NN3.  Not sure how to fix this.  NN3 is not supposed to recognize document.all.
// NN3 is tripping over the function () part.  I guess it doesn't like embedded functions.  Since it doesn't like the syntax, the if (document.all) doesn't help anything.
//if (document.all) {
//  document.onkeydown = function () {
//    return event.keyCode != 27;
//  }
//}

// Prevent double submits in JavaScript. (Primary line of defense.)
function disableSubmits (form) {
  for ( var i = 0; i < form.elements.length; i++ ) {
    if ( form.elements[i].type.toLowerCase() == 'submit' ) {
      form.elements[i].disabled = true;
    }
  }
}

// Call this function to prevent double submits.
function call_disable() {
  if ( this.submitted ) { 
    return false; 
  } else { 
    this.submitted = true; disableSubmits(this); return true; 
  }
}

// All three functions shamelessly stolen from AListApart.com
function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;

function preloadNavImages() {
	if (document.images) {
		howwedoit_o = newImage("../images/nav/main/howwedoit_over.gif");
		whatsnew_o = newImage("../images/nav/main/whatsnew_over.gif");
		whatwedo_o = newImage("../images/nav/main/whatwedo_over.gif");
		whoweare_o = newImage("../images/nav/main/whoweare_over.gif");
		whoweworkwith_o = newImage("../images/nav/main/whoweworkwith_over.gif");
		preloadFlag = true;
	}
}

function preloadBlockImages() {
	if (document.images) {
		banking_o = newImage("../images/splash/rollover_block/banking_12_over.jpg");
		entertainment_o = newImage("../images/splash/rollover_block/entertainment_5_over.jpg");
		highrise_o = newImage("../images/splash/rollover_block/highrise_11_over.jpg");
		hospitality_o = newImage("../images/splash/rollover_block/hospitality_2_over.jpg");
		restaurant_o = newImage("../images/splash/rollover_block/restaurant_7_over.jpg");
		retail_o = newImage("../images/splash/rollover_block/retail_3_over.jpg");
		shopping_o = newImage("../images/splash/rollover_block/shopping_14_over.jpg");
		preloadFlag = true;
	}
}