var subtotals_hash = new Hash();function cleanDRose (giving_type, grand_total_span){var cleanIT = 0;var mostly = 0;var getsel = 0;var cutSeLoc = 0;var newSubtotal = '';document.giving_form.hideRoseDisplay.value = cleanIT; var getsel = document.giving_form.other_membership.value; var cutSeLoc = getsel.indexOf('|',0); var mostly = parseFloat((getsel.slice((cutSeLoc+1), (getsel.length)) * 1)); var finalA = formatCurrency(mostly);document.giving_form.hideRoseDisplay.value = finalA; var voidRev = '<span id="displayMemberShipLevel">' + finalA + '</span>';$('displayMemberShipLevel').replace(voidRev);// new 'touch' methodsetTimeout('document.giving_form.dummy_field.focus()',25);reTotal('dollarsE', 'grandTotal');setTimeout('document.giving_form.other_membership_additional_amount.focus()',25);}function reTotal (giving_type, grand_total_span) {    var form = $('giving_form');    var value_fields = form.getElements();    var subtotal = 0;    value_fields.each(function(s) { 	    if (s.hasClassName(giving_type) || (s.hasClassName(giving_type + 'R')))		subtotal = (subtotal * 1) + (removeCurrency($F(s)) * 1); });    subtotals_hash.set(giving_type, subtotal);    var subtotalSpan = giving_type + 'Total';    var newSubtotal = '<span id="' + subtotalSpan + '">' +	formatCurrency(subtotals_hash.get(giving_type)) + '</span>';    $(giving_type + 'Total').replace(newSubtotal);        if ($(grand_total_span)) { updateGrandTotal(grand_total_span); }}function updateGrandTotal (grand_total_span) {    var grandTotal = 0;    subtotals = subtotals_hash.values();    subtotals_hash.values().each(function (s) { 	    grandTotal = (s * 1) + (grandTotal * 1) });    var newTotal = '<span id="' + grand_total_span + '">' 	+ formatCurrency(grandTotal) + '</span>';    $(grand_total_span).replace(newTotal);}function removeCurrency(strValue) {    var objRegExp = /\(/;    var strMinus = '';        //check if negative    if(objRegExp.test(strValue)){	strMinus = '-';    }        objRegExp = /\)|\(|[,]/g;    strValue = strValue.replace(objRegExp,'');    if(strValue.indexOf('$') >= 0){	strValue = strValue.substring(1, strValue.length);    }    return strMinus + strValue;}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))+','+ // full line	    //num = num.substring(0,num.length-(4*i+3))+	    num.substring(num.length-(4*i+3));    return ('$' + ((sign)?'':'-') + num + '.' + cents);}function stopAdd(){    clearInterval(interval);}// version: beta// created: 2005-08-30// updated: 2005-08-31// mredkj.com - released to public domainfunction extractNumber(obj, decimalPlaces, allowNegative){    var temp = obj.value;        // avoid changing things if already formatted correctly    var reg0Str = '[0-9]*';    if (decimalPlaces > 0) {	reg0Str += '\\.?[0-9]{0,' + decimalPlaces + '}';    } else if (decimalPlaces < 0) {	reg0Str += '\\.?[0-9]*';    }    reg0Str = allowNegative ? '^-?' + reg0Str : '^' + reg0Str;    reg0Str = reg0Str + '$';    var reg0 = new RegExp(reg0Str);    if (reg0.test(temp)) return true;        // first replace all non numbers    var reg1Str = '[^0-9' + (decimalPlaces != 0 ? '.' : '') + (allowNegative ? '-' : '') + ']';    var reg1 = new RegExp(reg1Str, 'g');    temp = temp.replace(reg1, '');        if (allowNegative) {	// replace extra negative	var hasNegative = temp.length > 0 && temp.charAt(0) == '-';	var reg2 = /-/g;	temp = temp.replace(reg2, '');	if (hasNegative) temp = '-' + temp;    }        if (decimalPlaces != 0) {	var reg3 = /\./g;	var reg3Array = reg3.exec(temp);	if (reg3Array != null) {	    // keep only first occurrence of .	    //  and the number of places specified by decimalPlaces or the entire string if decimalPlaces < 0	    var reg3Right = temp.substring(reg3Array.index + reg3Array[0].length);	    reg3Right = reg3Right.replace(reg3, '');	    reg3Right = decimalPlaces > 0 ? reg3Right.substring(0, decimalPlaces) : reg3Right;	    temp = temp.substring(0,reg3Array.index) + '.' + reg3Right;	}    }        obj.value = temp;}function blockNonNumbers(obj, e, allowDecimal, allowNegative){    var key;    var isCtrl = false;    var keychar;    var reg;        if(window.event) {	key = e.keyCode;	isCtrl = window.event.ctrlKey	    }    else if(e.which) {	key = e.which;	isCtrl = e.ctrlKey;    }        if (isNaN(key)) return true;        keychar = String.fromCharCode(key);        // check for backspace or delete, or if Ctrl was pressed    if (key == 8 || isCtrl || key == 9)	{	    return true;	}        reg = /\d/;    var isFirstN = allowNegative ? keychar == '-' && obj.value.indexOf('-') == -1 : false;    var isFirstD = allowDecimal ? keychar == '.' && obj.value.indexOf('.') == -1 : false;        return isFirstN || isFirstD || reg.test(keychar);}// elements from Tribute pagefunction changeVisTributes(e){    if (document.getElementById(e).style.display == 'none') {        document.getElementById(e).style.display = 'block';    } else {        document.getElementById(e).style.display = 'none';    }}function shoCategory(e){try {if (document.getElementById(e).style.display == 'none') {        document.getElementById(e).style.display = 'block';    } else {        document.getElementById(e).style.display = 'block';    }  } catch(e) {  }}function forceOpen(e) { var revealCategory = new Array("100","200","300","400","500","600","700", "800", "900", "1000");    var contentDetail = new Array("101","201","301","401","501","601","701", "801", "901", "1001");//alert (e + ' e'); for (var y = 0; y <= e - 1; y++) {//alert(y + ' opening');     shoCategory(revealCategory[y]); // force the mail element to display     if (y <= e - 2) {     hideTributes(contentDetail[y]); // hide the count-eth element     } } try { document.giving_form.totalTribRequest.value = y; // set hidden to correct value 1-10  } catch(e) {  }}function init() {  count = -1; // array index  whichTab = 1;  forceGrandTotal();}function forceGrandTotal() {  try {// document.giving_form.grandTotal.value = 'Click to View Total';  } catch(e) {  }$('donor_firstname').focus();}function addNewTribute(){if (count + 2 <= 9){   var revealCategory = new Array("100","200","300","400","500","600","700", "800", "900", "1000");   var contentDetail = new Array("101","201","301","401","501","601","701", "801", "901", "1001"); if(count <= 9){count++;//alert("hide postion up to " + count + " for ID " + contentDetail[count]);for (var y = 0; y <= count; y++)   {     hideTributes(contentDetail[y]); // hide the count-eth element     shoCategory(revealCategory[y]); // force the main element to display}//alert("open next arrary at " + (count+1) + " which is " + revealCategory[(count+1)]);     changeVisTributes(revealCategory[(count+1)]); // open newID//     changeVisTributes(contentDetail[(count+1)]); // toggle content to open//alert ((count + 2) + ' = tributes made');$('totalTribRequest').value = count + 2; }}}function hideTributes(e){if (document.getElementById(e).style.display == 'none') {        document.getElementById(e).style.display = 'none';    } else {        document.getElementById(e).style.display = 'none';    }} function markPanel(x) { whichTab = x;// alert ('event fires');// alert ('This panel' + whichTab + 'chosen'); if (whichTab == 2){// alert('panel 2 trigger');// alert((count + 2) + ' total Tribute Requests');try {verifyCount = document.giving_form.totalTribRequest.value;  } catch(e) {verifyCount = 0;  }// alert(verifyCount + ' verifyCount');var useTally = 0;if (count + 2 > verifyCount) { useTally = count + 2; } else { useTally = verifyCount;}for (var x = 0; x <= (useTally); x++)   {	forceOpen(x); // force the main element to display   } } return true; }function clearDefault(el) {if (el.defaultValue==el.value) el.value = ""}function popUp(URL) { faq = window.open(URL, '1', 'toolbars="no",toolbars=0,scrollbars="yes",scrollbars=1,location="no",location=0,statusbars="no",statusbars=0,menubars="no",menubars=0,resizable="no",resizable=0,width=615,height=400,top=0, left=0');}