<!--

// ------------------------------------------------------------
// Musik-Player-Fenster
// ------------------------------------------------------------
var winmusik = null;					// Variable für Musik-Player-Fenster
function open_window_music( popunder ) {			// Musik-Player-Fenster öffnen -- falls es nicht schon offen ist
	if( !winmusik || winmusik.closed ) {
		winmusik = window.open('/fileadmin/extensions/musicplayer/mp3player.php',"mp3player","width=320,height=300,scrollbars=no,menubar=yes,toolbar=no,location=no,status=no,resizable=no");
		if( popunder ) {	// als Popunder öffnen, d.h. Focus wieder aufs aktuelle Fenster setzen
			winmusik.blur();
			window.focus();
		}
	} else {
		if( ! popunder ) {
			winmusik.focus();
		}
	}
}
function musik_start() {
	// alert( "Winmusik: " + winmusik );
	if( winmusik && ! winmusik.closed ) {
		winmusik.controlPlayer('pause');
	} else {
		open_window_music('popunder');
	}
}
function musik_stop() {
	// alert( "Winmusik: " + winmusik );
	if( winmusik && ! winmusik.closed ) {
		winmusik.controlPlayer('pause');
 	} else {
		open_window_music('popunder');
		winmusik.controlPlayer('pause');
	}
}
function controlPlayer(func,param) {
	thisMovie("mp3player").jsControl(func,param);
}
function thisMovie(movieName) {
    if (navigator.appName.indexOf("Microsoft") != -1) {
        return window[movieName]
    }
    else {
        return document[movieName]
    }
}

// ------------------------------------------------------------
// Allgemeiner Image-Changer
// ------------------------------------------------------------
function chg(ImageName, FileName) {
	if (document[ImageName]) {
		document[ImageName].src = FileName;
	} else if (typeof(document.getElementById)=="function" && document.getElementById(ImageName)) {
		document.getElementById(ImageName).src = FileName;
	}
}


// ------------------------------------------------------------
// Open_Window: Neues Fenster öffnen
// ------------------------------------------------------------
function open_window_tipafriend(ref_url) {	// Wrapper-Routine für das Tip-A-Friend-Window
	if( ref_url && ref_url != "" ) {
		open_window('/fileadmin/extensions/tipafriend/tipafriend.php?url='+ref_url,470,500);
	}
}
function open_window(url, x, y, center, name) {
	if (x && x != "") { width = x; } else { width = 600; }
	if (y && y != "") { height = y + 17; } else { height = 507; }
	if (center && center == 1) {
/*		if (navigator.appName=="Netscape") {
		    var widthall = top.window.innerWidth;
		    var heightall = top.window.innerHeight;
		} else if (navigator.appName.indexOf("Microsoft") != -1) {
		    var widthall = top.document.body.offsetWidth;
		    var heightall = top.document.body.offsetHeight;
		}*/
		var widthall = screen.Width;
		var heightall = screen.Height;
		var top = Math.round( ( heightall - height ) / 2 );
		if( widthall >= width ) {
			var left = Math.round( ( widthall - width ) / 2 );
		} else {
			var left = Math.round( ( width - widthall ) / 2 );
		}
		// alert( "Old Browser => width: " + widthall + " height: " + heightall + " \nCenter-Window => top: " + top + " left: " + left + " \nNew Window => width: " + width + " height: " + height );
	} else {
		var top = 10;
		var left = 10;
	}
	if( name && name == 1 ) {
		var myname = Math.round( 1000 * Math.random() );
	} else {
		var myname = "1";
	}
	var zoom_win = window.open(url, "openwindow"+myname, "left="+left+",top="+top+",width="+width+",height="+height+",scrollbars=yes,menubar=yes,toolbar=no,location=no,status=no,resizable=no");
}
function open_window_full(url) {
	var widthall = screen.Width;
	var heightall = screen.Height;
	var zoom_win = window.open(url, "openwindowfull", 'width=' + widthall + ',height=' + heightall + ',top=0,left=0,scrollbars=auto,menubar=yes');
}
// ------------------------------------------------------------


// ------------------------------------------------------------
// JS-Email Validation
// ------------------------------------------------------------
function check_email (emailStr) {
	var checkTLD=0; var knownDomsPat=/^(de|com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/; var emailPat=/^(.+)@(.+)$/; var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]"; var validChars="\[^\\s" + specialChars + "\]";
	var quotedUser="(\"[^\"]*\")"; var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/; var atom=validChars + '+'; var word="(" + atom + "|" + quotedUser + ")"; var userPat=new RegExp("^" + word + "(\\." + word + ")*$"); var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$"); var matchArray=emailStr.match(emailPat);
	if (matchArray==null) {
		// alert("Email address seems incorrect (check @ and .'s)");
		return false;
	}
	var user=matchArray[1];
	var domain=matchArray[2];
	// Start by checking that only basic ASCII characters are in the strings (0-127).
	for (i=0; i<user.length; i++) {
		if (user.charCodeAt(i)>127) {
			// alert("Ths username contains invalid characters.");
			return false;
		}
	}
	for (i=0; i<domain.length; i++) {
		if (domain.charCodeAt(i)>127) {
			// alert("Ths domain name contains invalid characters.");
			return false;
		}
	}
	// See if "user" is valid 
	if (user.match(userPat)==null) {
		// user is not valid
		// alert("The username doesn't seem to be valid.");
		return false;
	}
	var IPArray=domain.match(ipDomainPat);
	if (IPArray!=null) {
		for (var i=1;i<=4;i++) {
			if (IPArray[i]>255) {
				// alert("Destination IP address is invalid!");
				return false;
			}
		}
		return true;
	}
	var atomPat=new RegExp("^" + atom + "$");
	var domArr=domain.split(".");
	var len=domArr.length;
	for (i=0;i<len;i++) {
		if (domArr[i].search(atomPat)==-1) {
			// alert("The domain name does not seem to be valid.");
			return false;
		}
	}
	if (checkTLD && domArr[domArr.length-1].length!=2 && domArr[domArr.length-1].search(knownDomsPat)==-1) {
		// alert("The address must end in a well-known domain or two letter " + "country.");
		return false;
	}
	if (len<2) {
		// alert("This address is missing a hostname!");
		return false;
	}
	// If we've gotten this far, everything's valid!
	return true;
}

// Check, ob ein String eine Nummer ist
function IsNumeric(sText) {
	var ValidChars = "0123456789.,";	// ggf. noch "." oder "-" erlauben
	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;
}

// Highlighting
function FocusElement (obj,error) {
	if (document.getElementById) {
		// document.getElementById(obj).style.border = "1px solid #aaa";
		document.getElementById(obj).style.backgroundColor = "#d6d6d6";
		// opacity( obj, 50, 100, 1000 );
/*		if( obj != "kunde_provider_id" ) {
			objtr = obj + "_tr";
			document.getElementById(objtr).style.backgroundColor = "#EEFFEE";
		}*/
		if( error ) {
			document.getElementById(obj).style.backgroundColor = "#ffc";
			// document.getElementById(obj).style.border = "1px solid #900";
			// if( obj != "kunde_provider_id" ) document.getElementById(objtr).style.backgroundColor = "#ffd";
		}
	}
}
function BlurElement (obj) {
	if (document.getElementById) {
		// document.getElementById(obj).style.border = "1px dotted #aaa";
		document.getElementById(obj).style.backgroundColor = "#fff";
		// opacity( obj, 100, 50, 1000 );
		/*if( obj != "kunde_provider_id" ) {
			objtr = obj + "_tr";
			document.getElementById(objtr).style.backgroundColor = "#fff";
		}*/
	}
}
// das gleiche nochmal für Buttons
function FocusBtn (obj,error) {
	if (document.getElementById) {
		// opacity( obj, 50, 100, 1000 );
		/*objtr = obj + "_tr";
		document.getElementById(objtr).style.backgroundColor = "#EEFFEE";
		if( error ) {
			if( obj != "kunde_provider_id" ) document.getElementById(objtr).style.backgroundColor = "#ffd";
		}*/
	}
}
function BlurBtn (obj) {
	if (document.getElementById) {
		/*objtr = obj + "_tr";
		document.getElementById(objtr).style.backgroundColor = "#fff";*/
		// opacity( obj, 100, 70, 1000 );
	}
}
// Opacity Routinen
function opacity(id, opacStart, opacEnd, millisec) { 
    //speed for each frame 
    var speed = Math.round(millisec / 100); 
    var timer = 0; 

    //determine the direction for the blending, if start and end are the same nothing happens 
    if(opacStart > opacEnd) { 
        for(i = opacStart; i >= opacEnd; i--) { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } else if(opacStart < opacEnd) { 
        for(i = opacStart; i <= opacEnd; i++) 
            { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } 
} 
//change the opacity for different browsers 
function changeOpac(opacity, id) { 
    var object = document.getElementById(id).style; 
    object.opacity = (opacity / 100); 
    object.MozOpacity = (opacity / 100); 
    object.KhtmlOpacity = (opacity / 100); 
    object.filter = "alpha(opacity=" + opacity + ")"; 
} 
function shiftOpacity(id, millisec) { 
    //if an element is invisible, make it visible, else make it ivisible 
    if(document.getElementById(id).style.opacity == 0) { 
        opacity(id, 0, 100, millisec); 
    } else { 
        opacity(id, 100, 0, millisec); 
    } 
} 

function currentOpac(id, opacEnd, millisec) { 
    //standard opacity is 100 
    var currentOpac = 100; 
     
    //if the element has an opacity set, get it 
    if(document.getElementById(id).style.opacity < 100) { 
        currentOpac = document.getElementById(id).style.opacity * 100; 
    } 

    //call for the function that changes the opacity 
    opacity(id, currentOpac, opacEnd, millisec) 
} 


/* neues Array für den JS-Form-Check einrichten */
var fragen_check = new Array();

function getNode( nodeId ) {
if( document.getElementById )
	return document.getElementById( nodeId );
else if( document.all && document.all( nodeId ) )

	return document.all( nodeId );
else if( document.layers && document.layers[ nodeId ] )
	return document.layers[ nodeId ];
else
	return false;
}

function show(object) {
	getNode(object).style.display = 'block';
	setCookie('the_news', 'show');
}

function hide(object) {
	getNode(object).style.display = 'none';
	setCookie('the_news', 'hide');
}

function div_show(object) {
	getNode(object).style.visibility = 'visible';
}

function div_hide(object) {
	getNode(object).style.visibility = 'hidden';
}

function setCookie( key, value ) {
	document.cookie = key + '=' + value + '; expires=' +
		new Date( 2010, 0, 1 ).toGMTString();
		
}

// Text-Fader, simpel
var hex = -1;
function fadetext( object, start, end ) { 
	if(hex == -1) hex = start;
	if( hex > end ) { // If color is not black yet
		hex-=11; // increase color darkness
		getNode(object).style.color= "rgb("+hex+","+hex+","+hex+")";
		setTimeout("fadetext('"+object+"',"+start+","+end+");",20);
	} else {
		hex=start //reset hex value
	}
}

/*
var opacity = -1;
var ie4up = 0;
if ( navigator.appName.indexOf("Microsoft") != -1 && parseInt(navigator.appVersion) >= 4 ) { ie4up = 1; }
function fadeopacity( object, start, end ) { 
	if(opacity == -1) { opacity = start; }
	if( opacity > end ) { // If color is not black yet
		opacity-=6; // increase color darkness
		if( ie4up ) {
			getNode(object).filters.alpha.opacity=opacity;
		} else {
			getNode(object).style.opacity = opacity;
		}
		setTimeout( "fadeopacity('"+object+"',"+start+","+end+");", 20 );
	} else {
		opacity=start; //reset hex value
	}
}
*/

// quelle: http://www.brainerror.net/scripts_js_blendtrans.php
function opacity(id, opacStart, opacEnd, millisec) { 
    //speed for each frame 
    var speed = Math.round(millisec / 100); 
    var timer = 0; 
	
    //determine the direction for the blending, if start and end are the same nothing happens 
    if(opacStart > opacEnd) { 
        for(i = opacStart; i >= opacEnd; i--) { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } else if(opacStart < opacEnd) { 
        for(i = opacStart; i <= opacEnd; i++) 
            { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } 

} 
//change the opacity for different browsers 
function changeOpac(opacity, id) { 
    var object = document.getElementById(id).style; 
    object.opacity = (opacity / 100); 
    object.MozOpacity = (opacity / 100); 
    object.KhtmlOpacity = (opacity / 100); 
    object.filter = "alpha(opacity=" + opacity + ")"; 
} 


// Submit-Button enablen/disablen
function enable_submit_button( enable ) {
	if( enable && document.getElementById ) {
		document.getElementById('weiter').disabled = false;
	} else if( document.getElementById ) {
		document.getElementById('weiter').disabled = true;
	}
	return true;
}

// ------------------------------------------------------------
// Open_Window: Neues Fenster öffnen
// ------------------------------------------------------------
function blank_window(url) {
	var blank_win = window.open( url, "blankwindow" );
	 return false;
}
function open_window(url, x, y) {
	if (x && x != "") { width = x; } else { width = 495; }
	if (y && y != "") { height = y + 17; } else { height = 200; }
	var zoom_win = window.open(url, "openwindow", "width="+width+",height="+height+",scrollbars=no,menubar=no,toolbar=no,location=no,status=yes,resizable=no,top=100,left=100");
}
function open_window_full(url) {
	var zoom_win = window.open(url, "openwindowfull", 'width=' + screen.availWidth + ',height=' + screen.availHeight + ',top=0,left=0,scrollbars=auto,menubar=yes');
}
// ------------------------------------------------------------


/* ####################### Form + Button-Highlighting ####################### */
/* Farbfestlegung */
var color_focus		= "#F3F3FA";
var border_focus	= "1px solid #AAAAAA";
var color_blur		= "#FFFFFF";
var border_blur		= "1px solid #AAAAAA";
var color_error		= "#FFFFDD";
var border_error	= "1px solid #990000";
// Highlighting: http://www.webthang.co.uk/Tuts/tuts_css/ben/ben.asp
function FocusElement (obj,error,color) {
	if (document.getElementById) {
		// document.getElementById(obj).style.border = border_focus;
		if( ! color || color == "" ) { color = color_focus; }
		document.getElementById(obj).style.backgroundColor = color;
		// opacity( obj, 50, 100, 1000 );
		/* if( obj != "kunde_provider_id" ) {
			objtr = obj + "_tr";
			document.getElementById(objtr).style.backgroundColor = color_focus;
		}*/
		if( error ) {
			// document.getElementById(obj).style.border = border_error;
			document.getElementById(obj).style.backgroundColor = color_error;
		}
	}
}
function BlurElement (obj,color) {
	if (document.getElementById) {
		// document.getElementById(obj).style.border = border_blur;
		if( ! color || color == "" ) { color = color_blur; }
		document.getElementById(obj).style.backgroundColor = color;
		opacity( obj, 100, 50, 1000 );
		/*if( obj != "kunde_provider_id" ) {
			objtr = obj + "_tr";
			document.getElementById(objtr).style.backgroundColor = color_blur;
		}*/
	}
}
// das gleiche nochmal für Buttons
function FocusBtn (obj,error,color) {
	if (document.getElementById) {
		// opacity( obj, 50, 100, 1000 );
		if( ! color || color == "" ) { color = color_focus; }
		document.getElementById(obj).style.backgroundColor = color;
		if( error ) {
			document.getElementById(obj).style.backgroundColor = color_error;
		}
	}
}
function BlurBtn (obj,color) {
	if (document.getElementById) {
		if( ! color || color == "" ) { color = color_blur; }
		document.getElementById(obj).style.backgroundColor = color;
		// opacity( obj, 100, 70, 1000 );
	}
}
// das gleiche nochmal für Radio-Buttons
function FocusRadio (obj,error) {
	if (document.getElementById) {
		document.getElementById(obj).style.backgroundColor = color_focus;
		if( error ) {
			document.getElementById(obj).style.backgroundColor = color_error;
		}
	}
}
function BlurRadio (obj) {
	if (document.getElementById) {
		document.getElementById(obj).style.backgroundColor = color_blur;
	}
}


/* ####################### Opacity Routinen ####################### */
// http://www.brainerror.net/scripts_js_blendtrans.php
function opacity(id, opacStart, opacEnd, millisec) { 
    //speed for each frame 
    var speed = Math.round(millisec / 100); 
    var timer = 0; 

    //determine the direction for the blending, if start and end are the same nothing happens 
    if(opacStart > opacEnd) { 
        for(i = opacStart; i >= opacEnd; i--) { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } else if(opacStart < opacEnd) { 
        for(i = opacStart; i <= opacEnd; i++) 
            { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } 
} 

//change the opacity for different browsers 
function changeOpac(opacity, id) { 
    var object = document.getElementById(id).style; 
    object.opacity = (opacity / 100); 
    object.MozOpacity = (opacity / 100); 
    object.KhtmlOpacity = (opacity / 100); 
    object.filter = "alpha(opacity=" + opacity + ")"; 
} 

function shiftOpacity(id, millisec) { 
    //if an element is invisible, make it visible, else make it ivisible 
    if(document.getElementById(id).style.opacity == 0) { 
        opacity(id, 0, 100, millisec); 
    } else { 
        opacity(id, 100, 0, millisec); 
    } 
} 

function currentOpac(id, opacEnd, millisec) { 
    //standard opacity is 100 
    var currentOpac = 100; 
     
    //if the element has an opacity set, get it 
    if(document.getElementById(id).style.opacity < 100) { 
        currentOpac = document.getElementById(id).style.opacity * 100; 
    } 

    //call for the function that changes the opacity 
    opacity(id, currentOpac, opacEnd, millisec) 
} 

// JS-Email Validation
function check_email (emailStr) {
	var checkTLD=0; var knownDomsPat=/^(de|com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/; var emailPat=/^(.+)@(.+)$/; var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]"; var validChars="\[^\\s" + specialChars + "\]";
	var quotedUser="(\"[^\"]*\")"; var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/; var atom=validChars + '+'; var word="(" + atom + "|" + quotedUser + ")"; var userPat=new RegExp("^" + word + "(\\." + word + ")*$"); var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$"); var matchArray=emailStr.match(emailPat);
	if (matchArray==null) {
		// alert("Email address seems incorrect (check @ and .'s)");
		return false;
	}
	var user=matchArray[1];
	var domain=matchArray[2];
	// Start by checking that only basic ASCII characters are in the strings (0-127).
	for (i=0; i<user.length; i++) {
		if (user.charCodeAt(i)>127) {
			// alert("Ths username contains invalid characters.");
			return false;
		}
	}
	for (i=0; i<domain.length; i++) {
		if (domain.charCodeAt(i)>127) {
			// alert("Ths domain name contains invalid characters.");
			return false;
		}
	}
	// See if "user" is valid 
	if (user.match(userPat)==null) {
		// user is not valid
		// alert("The username doesn't seem to be valid.");
		return false;
	}
	var IPArray=domain.match(ipDomainPat);
	if (IPArray!=null) {
		for (var i=1;i<=4;i++) {
			if (IPArray[i]>255) {
				// alert("Destination IP address is invalid!");
				return false;
			}
		}
		return true;
	}
	var atomPat=new RegExp("^" + atom + "$");
	var domArr=domain.split(".");
	var len=domArr.length;
	for (i=0;i<len;i++) {
		if (domArr[i].search(atomPat)==-1) {
			// alert("The domain name does not seem to be valid.");
			return false;
		}
	}
	if (checkTLD && domArr[domArr.length-1].length!=2 && domArr[domArr.length-1].search(knownDomsPat)==-1) {
		// alert("The address must end in a well-known domain or two letter " + "country.");
		return false;
	}
	if (len<2) {
		// alert("This address is missing a hostname!");
		return false;
	}
	// If we've gotten this far, everything's valid!
	return true;
}

// Check, ob ein String eine Nummer ist
// http://www.codetoad.com/javascript/isnumeric.asp
function IsNumeric( sText ) {
	var ValidChars = "0123456789.,";	// ggf. noch "." oder "-" erlauben
	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;

}


// -------------------------------------- Nummernformatierung
// Quelle: http://www.mredkj.com/javascript/nfdocs.html

// mredkj.com
function NumberFormat(num, inputDecimal)
{
this.VERSION = 'Number Format v1.5.4';
this.COMMA = ',';
this.PERIOD = '.';
this.DASH = '-'; 
this.LEFT_PAREN = '('; 
this.RIGHT_PAREN = ')'; 
this.LEFT_OUTSIDE = 0; 
this.LEFT_INSIDE = 1;  
this.RIGHT_INSIDE = 2;  
this.RIGHT_OUTSIDE = 3;  
this.LEFT_DASH = 0; 
this.RIGHT_DASH = 1; 
this.PARENTHESIS = 2; 
this.NO_ROUNDING = -1 
this.num;
this.numOriginal;
this.hasSeparators = false;  
this.separatorValue;  
this.inputDecimalValue; 
this.decimalValue;  
this.negativeFormat; 
this.negativeRed; 
this.hasCurrency;  
this.currencyPosition;  
this.currencyValue;  
this.places;
this.roundToPlaces; 
this.truncate; 
this.setNumber = setNumberNF;
this.toUnformatted = toUnformattedNF;
this.setInputDecimal = setInputDecimalNF; 
this.setSeparators = setSeparatorsNF; 
this.setCommas = setCommasNF;
this.setNegativeFormat = setNegativeFormatNF; 
this.setNegativeRed = setNegativeRedNF; 
this.setCurrency = setCurrencyNF;
this.setCurrencyPrefix = setCurrencyPrefixNF;
this.setCurrencyValue = setCurrencyValueNF; 
this.setCurrencyPosition = setCurrencyPositionNF; 
this.setPlaces = setPlacesNF;
this.toFormatted = toFormattedNF;
this.toPercentage = toPercentageNF;
this.getOriginal = getOriginalNF;
this.moveDecimalRight = moveDecimalRightNF;
this.moveDecimalLeft = moveDecimalLeftNF;
this.getRounded = getRoundedNF;
this.preserveZeros = preserveZerosNF;
this.justNumber = justNumberNF;
this.expandExponential = expandExponentialNF;
this.getZeros = getZerosNF;
this.moveDecimalAsString = moveDecimalAsStringNF;
this.moveDecimal = moveDecimalNF;
this.addSeparators = addSeparatorsNF;
if (inputDecimal == null) {
this.setNumber(num, this.PERIOD);
} else {
this.setNumber(num, inputDecimal); 
}
this.setCommas(true);
this.setNegativeFormat(this.LEFT_DASH); 
this.setNegativeRed(false); 
this.setCurrency(false); 
this.setCurrencyPrefix('$');
this.setPlaces(2);
}
function setInputDecimalNF(val)
{
this.inputDecimalValue = val;
}
function setNumberNF(num, inputDecimal)
{
if (inputDecimal != null) {
this.setInputDecimal(inputDecimal); 
}
this.numOriginal = num;
this.num = this.justNumber(num);
}
function toUnformattedNF()
{
return (this.num);
}
function getOriginalNF()
{
return (this.numOriginal);
}
function setNegativeFormatNF(format)
{
this.negativeFormat = format;
}
function setNegativeRedNF(isRed)
{
this.negativeRed = isRed;
}
function setSeparatorsNF(isC, separator, decimal)
{
this.hasSeparators = isC;
if (separator == null) separator = this.COMMA;
if (decimal == null) decimal = this.PERIOD;
if (separator == decimal) {
this.decimalValue = (decimal == this.PERIOD) ? this.COMMA : this.PERIOD;
} else {
this.decimalValue = decimal;
}
this.separatorValue = separator;
}
function setCommasNF(isC)
{
this.setSeparators(isC, this.COMMA, this.PERIOD);
}
function setCurrencyNF(isC)
{
this.hasCurrency = isC;
}
function setCurrencyValueNF(val)
{
this.currencyValue = val;
}
function setCurrencyPrefixNF(cp)
{
this.setCurrencyValue(cp);
this.setCurrencyPosition(this.LEFT_OUTSIDE);
}
function setCurrencyPositionNF(cp)
{
this.currencyPosition = cp
}
function setPlacesNF(p, tr)
{
this.roundToPlaces = !(p == this.NO_ROUNDING); 
this.truncate = (tr != null && tr); 
this.places = (p < 0) ? 0 : p; 
}
function addSeparatorsNF(nStr, inD, outD, sep)
{
nStr += '';
var dpos = nStr.indexOf(inD);
var nStrEnd = '';
if (dpos != -1) {
nStrEnd = outD + nStr.substring(dpos + 1, nStr.length);
nStr = nStr.substring(0, dpos);
}
var rgx = /(\d+)(\d{3})/;
while (rgx.test(nStr)) {
nStr = nStr.replace(rgx, '$1' + sep + '$2');
}
return nStr + nStrEnd;
}
function toFormattedNF()
{	
var pos;
var nNum = this.num; 
var nStr;            
var splitString = new Array(2);   
if (this.roundToPlaces) {
nNum = this.getRounded(nNum);
nStr = this.preserveZeros(Math.abs(nNum)); 
} else {
nStr = this.expandExponential(Math.abs(nNum)); 
}
if (this.hasSeparators) {
nStr = this.addSeparators(nStr, this.PERIOD, this.decimalValue, this.separatorValue);
} else {
nStr = nStr.replace(new RegExp('\\' + this.PERIOD), this.decimalValue); 
}
var c0 = '';
var n0 = '';
var c1 = '';
var n1 = '';
var n2 = '';
var c2 = '';
var n3 = '';
var c3 = '';
var negSignL = (this.negativeFormat == this.PARENTHESIS) ? this.LEFT_PAREN : this.DASH;
var negSignR = (this.negativeFormat == this.PARENTHESIS) ? this.RIGHT_PAREN : this.DASH;
if (this.currencyPosition == this.LEFT_OUTSIDE) {
if (nNum < 0) {
if (this.negativeFormat == this.LEFT_DASH || this.negativeFormat == this.PARENTHESIS) n1 = negSignL;
if (this.negativeFormat == this.RIGHT_DASH || this.negativeFormat == this.PARENTHESIS) n2 = negSignR;
}
if (this.hasCurrency) c0 = this.currencyValue;
} else if (this.currencyPosition == this.LEFT_INSIDE) {
if (nNum < 0) {
if (this.negativeFormat == this.LEFT_DASH || this.negativeFormat == this.PARENTHESIS) n0 = negSignL;
if (this.negativeFormat == this.RIGHT_DASH || this.negativeFormat == this.PARENTHESIS) n3 = negSignR;
}
if (this.hasCurrency) c1 = this.currencyValue;
}
else if (this.currencyPosition == this.RIGHT_INSIDE) {
if (nNum < 0) {
if (this.negativeFormat == this.LEFT_DASH || this.negativeFormat == this.PARENTHESIS) n0 = negSignL;
if (this.negativeFormat == this.RIGHT_DASH || this.negativeFormat == this.PARENTHESIS) n3 = negSignR;
}
if (this.hasCurrency) c2 = this.currencyValue;
}
else if (this.currencyPosition == this.RIGHT_OUTSIDE) {
if (nNum < 0) {
if (this.negativeFormat == this.LEFT_DASH || this.negativeFormat == this.PARENTHESIS) n1 = negSignL;
if (this.negativeFormat == this.RIGHT_DASH || this.negativeFormat == this.PARENTHESIS) n2 = negSignR;
}
if (this.hasCurrency) c3 = this.currencyValue;
}
nStr = c0 + n0 + c1 + n1 + nStr + n2 + c2 + n3 + c3;
if (this.negativeRed && nNum < 0) {
nStr = '<font color="red">' + nStr + '</font>';
}
return (nStr);
}
function toPercentageNF()
{
nNum = this.num * 100;
nNum = this.getRounded(nNum);
return nNum + '%';
}
function getZerosNF(places)
{
var extraZ = '';
var i;
for (i=0; i<places; i++) {
extraZ += '0';
}
return extraZ;
}
function expandExponentialNF(origVal)
{
if (isNaN(origVal)) return origVal;
var newVal = parseFloat(origVal) + ''; 
var eLoc = newVal.toLowerCase().indexOf('e');
if (eLoc != -1) {
var plusLoc = newVal.toLowerCase().indexOf('+');
var negLoc = newVal.toLowerCase().indexOf('-', eLoc); 
var justNumber = newVal.substring(0, eLoc);
if (negLoc != -1) {
var places = newVal.substring(negLoc + 1, newVal.length);
justNumber = this.moveDecimalAsString(justNumber, true, parseInt(places));
} else {
if (plusLoc == -1) plusLoc = eLoc;
var places = newVal.substring(plusLoc + 1, newVal.length);
justNumber = this.moveDecimalAsString(justNumber, false, parseInt(places));
}
newVal = justNumber;
}
return newVal;
} 
function moveDecimalRightNF(val, places)
{
var newVal = '';
if (places == null) {
newVal = this.moveDecimal(val, false);
} else {
newVal = this.moveDecimal(val, false, places);
}
return newVal;
}
function moveDecimalLeftNF(val, places)
{
var newVal = '';
if (places == null) {
newVal = this.moveDecimal(val, true);
} else {
newVal = this.moveDecimal(val, true, places);
}
return newVal;
}
function moveDecimalAsStringNF(val, left, places)
{
var spaces = (arguments.length < 3) ? this.places : places;
if (spaces <= 0) return val; 
var newVal = val + '';
var extraZ = this.getZeros(spaces);
var re1 = new RegExp('([0-9.]+)');
if (left) {
newVal = newVal.replace(re1, extraZ + '$1');
var re2 = new RegExp('(-?)([0-9]*)([0-9]{' + spaces + '})(\\.?)');		
newVal = newVal.replace(re2, '$1$2.$3');
} else {
var reArray = re1.exec(newVal); 
if (reArray != null) {
newVal = newVal.substring(0,reArray.index) + reArray[1] + extraZ + newVal.substring(reArray.index + reArray[0].length); 
}
var re2 = new RegExp('(-?)([0-9]*)(\\.?)([0-9]{' + spaces + '})');
newVal = newVal.replace(re2, '$1$2$4.');
}
newVal = newVal.replace(/\.$/, ''); 
return newVal;
}
function moveDecimalNF(val, left, places)
{
var newVal = '';
if (places == null) {
newVal = this.moveDecimalAsString(val, left);
} else {
newVal = this.moveDecimalAsString(val, left, places);
}
return parseFloat(newVal);
}
function getRoundedNF(val)
{
val = this.moveDecimalRight(val);
if (this.truncate) {
val = val >= 0 ? Math.floor(val) : Math.ceil(val); 
} else {
val = Math.round(val);
}
val = this.moveDecimalLeft(val);
return val;
}
function preserveZerosNF(val)
{
var i;
val = this.expandExponential(val);
if (this.places <= 0) return val; 
var decimalPos = val.indexOf('.');
if (decimalPos == -1) {
val += '.';
for (i=0; i<this.places; i++) {
val += '0';
}
} else {
var actualDecimals = (val.length - 1) - decimalPos;
var difference = this.places - actualDecimals;
for (i=0; i<difference; i++) {
val += '0';
}
}
return val;
}
function justNumberNF(val)
{
newVal = val + '';
var isPercentage = false;
if (newVal.indexOf('%') != -1) {
newVal = newVal.replace(/\%/g, '');
isPercentage = true; 
}
var re = new RegExp('[^\\' + this.inputDecimalValue + '\\d\\-\\+\\(\\)eE]', 'g');	
newVal = newVal.replace(re, '');
var tempRe = new RegExp('[' + this.inputDecimalValue + ']', 'g');
var treArray = tempRe.exec(newVal); 
if (treArray != null) {
var tempRight = newVal.substring(treArray.index + treArray[0].length); 
newVal = newVal.substring(0,treArray.index) + this.PERIOD + tempRight.replace(tempRe, ''); 
}
if (newVal.charAt(newVal.length - 1) == this.DASH ) {
newVal = newVal.substring(0, newVal.length - 1);
newVal = '-' + newVal;
}
else if (newVal.charAt(0) == this.LEFT_PAREN
&& newVal.charAt(newVal.length - 1) == this.RIGHT_PAREN) {
newVal = newVal.substring(1, newVal.length - 1);
newVal = '-' + newVal;
}
newVal = parseFloat(newVal);
if (!isFinite(newVal)) {
newVal = 0;
}
if (isPercentage) {
newVal = this.moveDecimalLeft(newVal, 2);
}
return newVal;
}

// -->
