//Domhelper.1003
FX={debugWindowId:'FXdebug',lastSibling:function(a){var b=a.parentNode.lastChild;while(b.nodeType!=1&&b.previousSibling!=null){b=b.previousSibling}return(b.nodeType==1)?b:false},firstSibling:function(a){var b=a.parentNode.firstChild;while(b.nodeType!=1&&b.nextSibling!=null){b=b.nextSibling}return(b.nodeType==1)?b:false},getText:function(a){if(!a.hasChildNodes()){return false}var b=/^\s+$/;var c=a.firstChild;while(c.nodeType!=3&&c.nextSibling!=null||b.test(c.nodeValue)){c=c.nextSibling}return c.nodeType==3?c.nodeValue:false},setText:function(a,b){if(!a.hasChildNodes()){return false}var c=/^\s+$/;var d=a.firstChild;while(d.nodeType!=3&&d.nextSibling!=null||c.test(d.nodeValue)){d=d.nextSibling}if(d.nodeType==3){d.nodeValue=b}else{return false}},createLink:function(a,b){var c=document.createElement('a');c.appendChild(document.createTextNode(b));c.setAttribute('href',a);return c},createTextElm:function(a,b){var c=document.createElement(a);c.appendChild(document.createTextNode(b));return c},closestSibling:function(a,b){var c;if(b==-1&&a.previousSibling!=null){c=a.previousSibling;while(c.nodeType!=1&&c.previousSibling!=null){c=c.previousSibling}}else if(b==1&&a.nextSibling!=null){c=a.nextSibling;while(c.nodeType!=1&&c.nextSibling!=null){c=c.nextSibling}}return c.nodeType==1?c:false},initDebug:function(){if(FX.debug){FX.stopDebug()}FX.debug=document.createElement('div');FX.debug.setAttribute('id',FX.debugWindowId);document.body.insertBefore(FX.debug,document.body.firstChild)},setDebug:function(a){if(!FX.debug){FX.initDebug()}FX.debug.innerHTML+=a+'\n'},stopDebug:function(){if(FX.debug){FX.debug.parentNode.removeChild(FX.debug);FX.debug=null}},getKey:function(e){if(window.event){var a=window.event.keyCode}else if(e){var a=e.keyCode}return a},getTarget:function(e){var a=window.event?window.event.srcElement:e?e.target:null;if(!a){return false}while(a.nodeType!=1&&a.nodeName.toLowerCase()!='body'){a=a.parentNode}return a},stopBubble:function(e){if(window.event&&window.event.cancelBubble){window.event.cancelBubble=true}if(e&&e.stopPropagation){e.stopPropagation()}},stopDefault:function(e){if(window.event&&window.event.returnValue){window.event.returnValue=false}if(e&&e.preventDefault){e.preventDefault()}},cancelClick:function(e){if(window.event){window.event.cancelBubble=true;window.event.returnValue=false}if(e&&e.stopPropagation&&e.preventDefault){e.stopPropagation();e.preventDefault()}},addEvent:function(a,b,c,d){if(a.addEventListener){a.addEventListener(b,c,d);return true}else if(a.attachEvent){var r=a.attachEvent('on'+b,c);return r}else{a['on'+b]=c}},cssjs:function(a,o,b,c){switch(a){case'swap':o.className=!FX.cssjs('check',o,b)?o.className.replace(c,b):o.className.replace(b,c);break;case'add':if(!FX.cssjs('check',o,b)){o.className+=o.className?' '+b:b}break;case'remove':var d=o.className.match(' '+b)?' '+b:b;o.className=o.className.replace(d,'');break;case'check':var e=false;var f=o.className.split(' ');for(var i=0;i<f.length;i++){if(f[i]==b){e=true}}return e;break}},safariClickFix:function(){return false},getE:function(a){if(!FX.supportE){return}return document.getElementById(a)},supportE:function(){if(!document.getElementById||!document.createTextNode){return false}else{return true}}}

//email mask
FX_Prop={
	wrap:'tblLead',
	
	init:function(){
		if (!FX.supportE){return;}
		var nodeWrap=FX.getE(FX_Prop.wrap);
		if (!nodeWrap){return;}
		var nodeAs = nodeWrap.getElementsByTagName('a');
		if (!nodeAs){return;}
		for (var x=0;x<nodeAs.length;x++){
			if (nodeAs[x].href.toLowerCase().indexOf('mailto:')==-1){
				FX.addEvent(nodeAs[x], 'click', FX_Prop.showPrompt, false)
				nodeAs[x].onclick=FX.safariClickFix

			}
		}
	},
	showPrompt:function(evt){
		var PropMask=document.createElement('div');
		PropMask.id='PropMask';
		var divRobot=document.createElement('div');
		divRobot.id='divRobot';
		divRobot.innerHTML='<div style="position:relative;margin: 20% auto 0 auto;background-color:#fff;padding:10px;border:1px solid black; width: 400px; text-align: left;"><form name=fmRobot action='+window.location.pathname+' method=post style="padding-right:20px">To show email addresses on this page, please type word <b><span class=spanRobot1>NC</span><span class=spanRobot2>vscpa</span></b> (case sensitive) in the box and click the button<br><input name=Robotstr value=""><input type=submit value="Show Email"></form><div style="padding:3px;margin-top:5px;background-color:#ddd" class=ps>*We mask our email addresses to prevent automated computer programs from harvesting them for spamming purposes.</div><div style="position:absolute;right:8px;top:3px;">[ <a href="javascript:void(0);" onclick="body.removeChild(body.firstChild);body.removeChild(body.firstChild);" style="font-weight:bold">x</a> ]</div></div>';
		document.body.insertBefore(PropMask,document.body.firstChild);
		document.body.insertBefore(divRobot,document.body.firstChild);
		var target=FX.getTarget(evt)
		FX.cancelClick(evt)
	}
}

//JSdate
FXDATE={
	init:function(){
		if (!document.getElementById){return;}
		var divdate=document.getElementById('date');
		if (!divdate) {return;}
		var d = new Date()
		var weekday=new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat")
		var monthname=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
		var html = weekday[d.getDay()] + " "
		html += d.getMonth()+1 + "/"
		html += d.getDate() + "/"
		html += d.getFullYear()
		divdate.innerHTML+= " Today is <b>"+html+"</b>"
	}
} 
FX.addEvent(window, 'load', FXDATE.init, false)


//wait 2b integrated
function togglecss(theClass,element,value1, value2) {
	var cssRules;
	if (document.all) {
		cssRules = 'rules';
	}else if (document.getElementById) {
	  cssRules = 'cssRules';
 	}
	for (var S = 0; S < document.styleSheets.length; S++){
		for (var R = 0; R < document.styleSheets[S][cssRules].length; R++) {
			if (document.styleSheets[S][cssRules][R].selectorText == theClass) {
    			if (document.styleSheets[S][cssRules][R].style[element] == value1){
    				document.styleSheets[S][cssRules][R].style[element] = value2;
    			}else{
    				document.styleSheets[S][cssRules][R].style[element] = value1;
    			}
			}
		}
	}	
}


function formatCurrency(num) {
 var sign;var cents;
num = num.toString().replace(/\$|\,/g,'');
if(isNaN(num))
num = "0";
sign = (num == (num = Math.abs(num)));
num = Math.floor(num*100+0.50000000001);
cents = num%100;
num = Math.floor(num/100).toString();
if(cents<10)
cents = "0" + cents;

//for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
//num = num.substring(0,num.length-(4*i+3))+','+ num.substring(num.length-(4*i+3));

//return (((sign)?'':'-') + '$' + num + '.' + cents);
return (((sign)?'':'-') + num + '.' + cents);
}

function doformatCurrency(fld){
fld.value= formatCurrency(parseFloat(fld.value))
}

  
function checkValue(e) {
      var val;
      if(typeof e.which != 'undefined') {
            val = e.which;
      }
      else {
            val = e.keyCode;
      }
      //alert(e.which);
      switch (val) {
            case 0:  //navigation keys in Mozilla
            case 8:  //backspace
            case 13: //enter
            case 46: //. (period)
            case 48: //0
            case 49: //1
            case 50: //2
            case 51: //3
            case 52: //4
            case 53: //5
            case 54: //6
            case 55: //7
            case 56: //8
            case 57: //9
                  return true;
            default:
                  return false;
      }
}

function trim(str, chars) {
    return ltrim(rtrim(str, chars), chars);
}

function ltrim(str, chars) {
    chars = chars || "\\s";
    return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}

function rtrim(str, chars) {
    chars = chars || "\\s";
    return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
}

var emailre;
emailre = /^([a-zA-Z0-9_&+\/\\-])+([a-zA-Z0-9_&+\/\\\.-])*@([a-zA-Z0-9]([a-zA-Z0-9-]?[a-zA-Z0-9])*\.)*([a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9]\.)+[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9]$/;



