//-------------------------------------------------------------------
// START: GLOBAL FUNCTIONS
//-------------------------------------------------------------------


//-------------------------------------------------------------------
// post and set box
function fncPositionBox(sBoxName) {
	var Dom = YAHOO.util.Dom;
	var iWindowWidth	= Dom.getDocumentWidth(); 
	var iWindowHeight	= Dom.getDocumentHeight(); 
	var iViewportHeight	= Dom.getViewportHeight(); 
	var iViewportScrollTop = Dom.getDocumentScrollTop();
		
	// make page_cover full width and height of page
	Dom.setStyle('page_cover', 'width', iWindowWidth+'px');
	Dom.setStyle('page_cover', 'height', iWindowHeight+'px');
	
	// center container_lightbox
		// container_lightbox width and height
		var iLightboxWidth 	= parseInt(Dom.getStyle(sBoxName, 'width'), 10);
		var iLightboxHeight	= parseInt(Dom.getStyle(sBoxName, 'height'), 10);
		
		if (isNaN(iLightboxWidth)) { iLightboxWidth = 300; }
		if (isNaN(iLightboxHeight)) { iLightboxHeight = 300; }
		
		// set position
		iBoxLeft = ((iWindowWidth/2)-(iLightboxWidth/2)) + "px";
		iBoxTop = ((iViewportHeight/2)-(iLightboxHeight/2) + iViewportScrollTop ) + "px";
		
		//alert(iWindowWidth + ' ' + iViewportHeight + ' ' + iLightboxWidth + ' ' + iLightboxHeight + ' ' + iViewportScrollTop)
		
		// position it
		Dom.setStyle(sBoxName, 'left',  iBoxLeft);
		Dom.setStyle(sBoxName, 'top', iBoxTop);
		
}; //fncPositionBox


//-------------------------------------------------------------------
// Makes sure the keystroke is only a number
function fncNumbersOnly(e) {
	// make sure it is an approved key stroke
	var keynum;
	var keychar;
	if(window.event) { // IE
		keynum = e.keyCode;
	} else if(e.which) { // Netscape/Firefox/Opera
		keynum = e.which;
	}
	keychar = String.fromCharCode(keynum);
					
	if ( fncIsNumeric(keychar)  || keynum==8 || keynum==undefined ) { // limit to numbers, comma, backspace, and undefined (arrows,del)
		return true;
	} else if ( keynum == 13 ){
		callToAS();
	} else {
		return false;
	}
} // fncNumbersOnly
function fncNumbersOnly(e) {
	// make sure it is an approved key stroke
	var keynum;
	var keychar;
	
	if(window.event) { // IE
		keynum = e.keyCode;
	} else if(e.which) { // Netscape/Firefox/Opera
		keynum = e.which;
	}
	keychar = String.fromCharCode(keynum);
		
	if ( fncIsNumeric(keychar)  || keynum==8 || keynum==undefined ) { // limit to numbers, comma, backspace, and undefined (arrows,del)
		return true;
	} else {
		return false;
	}
} // fncNumbersOnly

//-------------------------------------------------------------------
// Confirms the number is only a number
function fncIsNumeric(x) {
	var RegExp = /\d/;		
	var bIsNumber = false;
	if ( x.match(RegExp) == x ) { bIsNumber = true; }	
	return bIsNumber;
}

//-------------------------------------------------------------------
// changes styles
function fncChangeClass(thisID,thisStyleName,bOn) {
	if (bOn) {
		YAHOO.util.Dom.addClass(thisID,thisStyleName);
	} else {
		YAHOO.util.Dom.removeClass(thisID,thisStyleName);		
	}
}; // fncChangeClass