/*onerror = handleErr;

function handleErr (theMessage, URL, lineError) { 
	errorText = "<strong>Erro: </strong> " + theMessage + "<br />"; 
	errorText += " URL: " + URL + "<br />"; 
	errorText += " Linha: " + lineError + "<br />"; 
	objDebug.debug(errorText); 
	return true; 
};

var objDebug = { 
	debug: function( message ){ 
		if ( !this.debugWindow || this.debugWindow.closed ) { 
			this.debugWindow = openCenterWin( '', 'debugWindow',  'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no', 320, 240);
			this.debugWindow.document.bgColor = "#EEEEEE"; 
			this.debugWindow.document.writeln( '<h4 style="color:#CC0000;"> JavaScript DEBUG </h4><br />' );			
		} 
		this.debugWindow.document.writeln( message + '<hr /> <br />' ); 
		this.debugWindow.scroll( 0, 5000000 ); 
	} 
};*/

function openCenterWin( URL, windowName, winFeatures, winWidth, winHeight ) {
	winLeft = (screen.width - winWidth) / 2;
	winTop = (screen.height - winHeight) / 2;
	features = winFeatures;
	features += ', left = ' + winLeft + ', top =' + winTop;
	features += ', width=' + winWidth + ', height=' + winHeight;
	newWindow = window.open(URL, windowName, features);
	newWindow.focus();
};

function submitOnEnter(form, e) {
	if (document.all) e = window.event;
	key	= (document.layers) ? e.which : e.keyCode;
	if (13 == key) {
		if (form) form.submit();
	return false;
	}
	return true;
};

function jumpMenu(targ,selObj,restore){ 
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function showHideLayers( ) {//showHideLayers(Layer1,'','show',Layer2,'','hide');
	var i, p, v, obj, args = showHideLayers.arguments;
	for (i = 0; i < (args.length - 2); i += 3) {
		if ((obj = getObject(args[i])) != null) {
			v = args[i + 2];
			if (obj.style) {
				obj = obj.style;
				v = (v == 'show') ? 'visible' : (v == 'hide') ? 'hidden' : v;
			}
			obj.visibility = v;
		}
	}
};

function getObject (theObj, theDoc) {// theObject = getObject("image1");
	var p, i, foundObj;
	
	if(!theDoc) theDoc = document;
	if( (p = theObj.indexOf("?")) > 0 && parent.frames.length){
		theDoc = parent.frames[theObj.substring(p+1)].document;
		theObj = theObj.substring(0,p);
	}
	if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
	for (i=0; !foundObj && i < theDoc.forms.length; i++) foundObj = theDoc.forms[i][theObj];
	for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) foundObj = getObject(theObj,theDoc.layers[i].document);
	if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
	return foundObj;
};

function preloadImages() {//preloadImages('image01.jpg','image02.jpg');
	if(document.images){
		if(!document.imageArray) document.imageArray = new Array();
		var i,j = document.imageArray.length, args = preloadImages.arguments;
		for(i=0; i<args.length; i++){
			if (args[i].indexOf("#")!=0){
				document.imageArray[j] = new Image;
				document.imageArray[j++].src = args[i];
			}
		}
	}
};