// general purpose testing variables
	if (document.images) {
	// pre-load the images for the rollovers
	
		var insuranceTitleOff = new Image();
		insuranceTitleOff.src = "/intl/japan/images/insurance_japan.gif";
		
		var insuranceTitleOn = new Image();
		insuranceTitleOn.src = "/intl/japan/images/insurance_japan_rollover.gif";
		
		var investmentsTitleOff = new Image();
		investmentsTitleOff.src = "/intl/japan/images/PIMJ.gif";
		
		var investmentsTitleOn = new Image();
		investmentsTitleOn.src = "/intl/japan/images/PIMJ_rollover.gif";
		
		var advisorTitleOff = new Image();
		advisorTitleOff.src = "/intl/japan/images/advisors_japan.gif";
		
		var advisorTitleOn = new Image();
		advisorTitleOn.src = "/intl/japan/images/advisors_japan_rollover.gif";
		
		var securitiesTitleOff = new Image();
		securitiesTitleOff.src = "/intl/japan/images/securities_japan.gif";
		
		var securitiesTitleOn = new Image();
		securitiesTitleOn.src = "/intl/japan/images/securities_japan_rollover.gif";
		
		var gibraltarTitleOff = new Image();
		gibraltarTitleOff.src = "/intl/japan/images/gibraltar_japan.gif";
		
		var gibraltarTitleOn = new Image();
		gibraltarTitleOn.src = "/intl/japan/images/gibraltar_japan_rollover.gif";
		
		var pricoareloTitleOff = new Image();
		pricoareloTitleOff.src = "/intl/japan/images/PREI.gif";
		
		var pricoareloTitleOn = new Image();
		pricoareloTitleOn.src = "/intl/japan/images/PREI_rollover.gif";  
		
		var pgaTitleOff = new Image();
		pgaTitleOff.src = "/intl/japan/images/pga_japan.gif";
		
		var pgaTitleOn = new Image();
		pgaTitleOn.src = "/intl/japan/images/pga_japan_rollover.gif";  
		
		var pfjTitleOff = new Image();
		pfjTitleOff.src = "/intl/japan/images/pfj_japan.gif";
		
		var pfjTitleOn = new Image();
		pfjTitleOn.src = "/intl/japan/images/pfj_japan_rollover.gif";  
		
		var aigstarTitleOn = new Image();
		aigstarTitleOn.src = "/intl/japan/images/AIGStar_rollover.gif";  
		
		var aigstarTitleOff = new Image();
		aigstarTitleOff.src = "/intl/japan/images/AIGStar.gif";
		
		var aigedisonTitleOn = new Image();
		aigedisonTitleOn.src = "/intl/japan/images/AIGedison_rollover.gif";  
		
		var aigedisonTitleOff = new Image();
		aigedisonTitleOff.src = "/intl/japan/images/AIGedison.gif";
	}
  if(document.layers){origWidth=innerWidth;origHeight=innerHeight;onresize=function(){if(innerWidth!=origWidth||innerHeight!=origHeight)location.reload()}}
	
  function isTextFieldEmpty(field, name) {
    if ( field.value == "" ) {
	  // alert("Please enter a value in the " + name + " field.");
        alert("We're sorry, but we could not complete your request because you did not enter anything in the search box. Please enter text in the search box and then click the Go button.");	
	      field.focus();
	      return true;
    } else {
	      return false;
	  }
	}
	
	function containsBlanks(field, name) {
		for(var i=0; i < field.value.length; i++) {
			var c = field.value.charAt(i);
			if (c != ' ') {
				return false;
				break;
			}
		}
		// alert("Please enter a value in the " + name + " field.");
		alert("We're sorry, but we could not complete your request because you did not enter anything in the search box. Please enter text in the search box and then click the Go button.");
		field.focus();
		field.value="";
		return true;
	}
	function validateForm(theform) {
		with (theform) {
			if ( isTextFieldEmpty(NewQuery, "input") || containsBlanks(NewQuery, "input") ) {
				return false;
			} else {
				return true;
			}
		}
	}
var isNS = navigator.appName == "Netscape";
var isIE = navigator.appName.lastIndexOf("Microsoft") != -1;

function activate( imageName ) {
	if ( document.images ) {
		document[imageName].src = eval( imageName + "On.src");
		return true;
	}
}

function deactivate( imageName ) {
	if ( document.images ) {
		document[imageName].src = eval( imageName + "Off.src");
		return true;
	}
}

function showHideLayers() {
	var i, visStr, args, theObj, theEvent, newX, newY, testY, layerHeight, offset;
	args = showHideLayers.arguments;
	
	// with arg quadruples (objNS,objIE,visStr, event)
	
	for (i=0; i < (args.length-3); i += 4) { 
		visStr = args[i+2];
		if (isNS && document.layers != null) {
			theObj = eval(args[i]);
			theEvent = args[i+3];
			if (theObj) {
				layerHeight = theObj.clip.height;
				offset = window.innerHeight + window.pageYOffset;
				offset += -layerHeight - 2;
				newX = theEvent.pageX + 5;
				testY = theEvent.pageY;
				if ( testY != theEvent.target.y ) testY = theEvent.target.y;
				if ( testY < offset ) {
				// we're sufficiently above the bottom of the screen,
				// so check if the cursor is at the top of the link area.
				// if it's not, figure out how far below the area it is,
				// and adjust the offset of the layer so it's always at
				// the same relative y position.
					newY = testY + 5;
				} else { // we're too close to the bottom of the screen
					newX -= 5;
					newY = testY - layerHeight + 4;
				}
				theObj.moveTo( newX, newY );
				theObj.visibility = visStr;
			}
		} else if (document.all != null) { //IE
			if (visStr == 'show') visStr = 'visible'; //convert vals
			if (visStr == 'hide') visStr = 'hidden';
			theObj = eval(args[i+1]);
			if (theObj) {
				layerHeight = theObj.style.pixelHeight;
				offset = document.body.clientHeight;
				offset += document.body.scrollTop - layerHeight - 15;
				newX = window.event.clientX + 5;
				testY = window.event.clientY + document.body.scrollTop;
				
				if ( navigator.appVersion.indexOf("Macintosh") != -1 ) {
					// handle the Mac version of IE
					if ( testY < offset ) {
						newY = testY + 15;
						theObj.style.pixelLeft = newX;
						theObj.style.pixelTop = newY;
					} else {
						newX -= 5;
						newY = testY - layerHeight - 5;
						theObj.style.pixelLeft = newX;
						theObj.style.pixelTop = newY;
					}
					theObj.style.visibility = visStr;
				} else { // handle the PC version of IE
					if ( testY != testY - window.event.offsetY )
						testY -= window.event.offsetY;
					if ( testY < offset ) {
						newY = testY + 15;
						theObj.style.pixelLeft = newX;
						theObj.style.pixelTop = newY;
					} else {
						newX -= 5;
						newY = testY - layerHeight;
						theObj.style.pixelLeft = newX;
						theObj.style.pixelTop = newY;
					}
					theObj.style.visibility = visStr;
				}
	  		}
  		}
	}
}

function showHideMenu() {
	var i, visStr, args, theObj, theImgName;
	args = showHideMenu.arguments;
	
	// with arg triples (objNS,objIE,imageRef)
	
	for (i=0; i < (args.length-2); i += 3) { 
		if (isNS && document.layers != null) {
			theObj = eval(args[i]);
			theImgName = args[i+2];
			if (theObj) {
				if (theObj.visibility == "hide") {
					visStr = "show";
					activate( theImgName );
				} else {
					visStr = "hide";
					deactivate( theImgName );
				}
				theObj.visibility = visStr;
			}
		} else if (document.all != null) { //IE
			theObj = eval(args[i+1]);
			theImgName = args[i+2];
			if (theObj) {
				if (theObj.style.visibility == "hidden") {
					visStr = "visible";
					activate( theImgName );
				} else {
					visStr = "hidden";
					deactivate( theImgName );
				}
				if (navigator.appVersion.lastIndexOf("Macintosh") != -1) {
					if (theObj.style.pixelTop != 127)
						theObj.style.pixelTop = 127;
				} else {
					if (theObj.style.pixelTop != 102) 
						theObj.style.pixelTop = 102;
				}
				if (theObj.style.pixelLeft != 17)
					theObj.style.pixelLeft = 17;
				if (theObj.style.pixelWidth != 150)
					theObj.style.pixelWidth = 150;
				theObj.style.visibility = visStr;
	  		}
  		}
	}
}
