/* THIS SCRIPTS FUNCTION MENU

	// PAGE LISTENERS
	// CURSOR FOCUS SPECIFIC FUNCTIONS


	// CUSTOM TREE NODE WALKERS, NEEDED FOR CROSS BROWSER COMPATABILITY
	// Positioning Functions
	// String Functions
	// Validators
	// Object Manipulators
*/

/* PAGE LISTNERS */
	oldActionArray = new Array();
	function crossBrowserAttachEvent( target , eventType , action ){
		if( action instanceof Function ){
			if( target.attachEvent ){
				target.attachEvent( eventType,action );
			}else if( target.addEventListener ){
				eventType = eventType.replace(/on/,'');
				target.addEventListener( eventType , action , false );
			}
		}else{
			if( typeof target[eventType] != "undefined" && typeof target[eventType] != null  && typeof target[eventType] != 'null' && target[eventType] != null){
				oldActionArray[oldActionArray.length] = target[eventType];
				eval('target[eventType] = function(e){ oldActionArray['+(oldActionArray.length-1)+']();'+action+'}');
			}else if( action != null && action!='null' ){
				eval('target[eventType] = function(e){ '+action+' }');
			}
		}		
	}

	function windowStopLoading( ){
		try{
			window.stop();
		}catch(e){
			document.execCommand('Stop');
		}
	}
/* end PAGE LISTENERS */


function flexreturns(input,checkagainst,writeto,writefrom){
	i=input.length; j=checkagainst;
	il=input.length;
	for(t=0; t < il; ++t){ 
		if(input[t]){ if(input[t].style.display=='none'){ --i; }
		}
	}
	if(i > j){
		while(i >= j){ 
			if(input[i]){ 
				if(input[i].type=='select-one'){ input[i].selectIndex=0 } else{ input[i].value='' }
				input[i].style.display='none';
			}
			--i;
		}
	}else{
		while(i <= j){
			if(input[i]){ 


				input[i].style.display='';
			}
			else{ 
				cloneContent(writeto,writefrom);
			}
			++i;
		}
	}
}

function replacehtmlformat(input){
	var t=input;
	var t=t.replace(/&nbsp;/g,' ');
	var t=t.replace(/&lt;/g,'<');
	var t=t.replace(/&gt;/g,'>');
	var t=t.replace(/&amp;/g,'&');
	return t;
}



function dateonly(input){
	var t='';var tvl=input.value.length;
	for(i=0;i<tvl;++i){ tt=input.value.charAt(i);
		if(tt==0 || tt==1 || tt==2 || tt==3 || tt==4 || tt==5 || tt==6 || tt==7 || tt==8 || tt==9 || tt=='-' || tt=='/'){ t=t+tt; }
	}
	input.value=t;
}



function gourl(input){ if(shiftcode==1){ window.open(input); } else{ window.location=input } }

function showselectto(input,that){ input.innerHTML=that.options[that.selectedIndex].value }


function showto(input,that){ input.innerHTML=that.value }


function imgSwap( img , src1 , src2 ){
	if(src2){
		if(img.src==src1){
			img.src=src2;
		}else{
			img.src=src1;
		}
	}else{
		img.src=src1;
	}
}

function disable(input){ input.disabled=1; }

function undisable(input){ input.disabled=0; }

function disableswap(obj){
	obj.disabled==1 ? obj.disabled=0 : obj.disabled=1;

}


var totalNumberDelimiters = ',';

function checktotal(strtotal){ s=stripCharsInBag(strtotal,totalNumberDelimiters); return (isInteger(s)); }

function isInteger(s){
	var i; for (i = 0; i < s.length; i++){ var c = s.charAt(i); if (((c < "0") || (c > "9"))) return false; } return true;
}

function stripCharsInBag(s, bag){ var i; var returnString = ""; for (i = 0; i < s.length; i++){ var c = s.charAt(i); if (bag.indexOf(c) == -1) returnString += c; } return returnString; }

function isnumeric(sText){
	var ValidChars = "0123456789."; var IsNumber=true; var Char;
	for (i = 0; i < sText.length && IsNumber == true; i++){ Char = sText.charAt(i);



		if (ValidChars.indexOf(Char) == -1){ IsNumber = false; }
	} return IsNumber;

}

/* Positioning Functions */
	function calculateIFrameSizing(the_iframe){
		var the_height=the_iframe.contentWindow.document.body.scrollHeight;
		the_iframe.style.height=the_height;
	}

	function AbsolutePositionWindowCenter( Element ){

		themath=document.body.clientWidth/2;
		themath1=Element.offsetWidth/2;
		themath=themath-themath1;
		try{
			Element.style.right=themath;Element.style.top=document.body.scrollTop+15;
		}catch(e){};
	}

	function MaximumHeight( ElementID , MaxHeight ){
	
		Element=document.getElementById(ElementID);
	
		if(!Element.style.display){
			Element.style.display='';
		}
		var CurrentDisplay=Element.style.display;
		Element.style.display='none';
	
		var newheight=Element.parentNode.offsetHeight;
		if(newheight > 30){

			newheight=newheight-30;
		}
		
		if(MaxHeight && MaxHeight!=0){
			if(newheight > MaxHeight){
				newheight=MaxHeight;
			}
		}else{
			MaxHeight=0;
		}
	
		Element.style.height=newheight;
		if(Element.style.overflow!='auto'){
			Element.style.overflow='auto';
		}
		Element.style.display=CurrentDisplay;
	
		try{

			eval('MaxHeight'+ElementID);

		}catch(e){
			eval('MaxHeight'+ElementID+'=function(){ MaximumHeight("'+ElementID+'","'+MaxHeight+'"); return true }');
			UniversalAttachEvent( 'onresize' , 'MaxHeight'+ElementID )
		}
	}
/* end Positioning Functions */


/* String Functions */
	function isDefined( string ){
		if(eval('typeof '+string+' == "undefined"')){ return false }else{ return true };
	}
/* end String Functions */

/* Validators */
/* end Validators */

/* Object Manipulators */


/* end Object Manipulators */