/* 
* POP UP WINDOW
* USE:
* <a href="[-URL-]" onclick="return popitup('[-URL-]')">[-LINK-]</a>
*/
	
function popitup(url) {
	newwindow=window.open(url,'name','height=550,width=400');
	if (window.focus) {newwindow.focus()}
	return false;

}



function toggleContent(toggleit){

	if(document.getElementById(toggleit).style.display == "none"){
		
		document.getElementById(toggleit).style.display = "block";
		
	}else{
		
		document.getElementById(toggleit).style.display = "none";
	
	}

}



function showContent(showit){

	if(document.getElementById(showit).style.display == "none"){
		
		document.getElementById(showit).style.display = "block";
	}
		
}


function hideContent(hideit){

	if(document.getElementById(hideit).style.display == "block"){
		
		document.getElementById(hideit).style.display = "none";
		
	}
}




function swapContent(showthis, hidethis){

	document.getElementById(hidethis).style.display ="none";
	document.getElementById(showthis).style.display = "block";


}


function calculateCredit(){

	var amount;
	var credit;

	amount = document.getElementById('calc_donation').value;

	if (amount > 1100) { 
		credit = '-';
		alert ('Maximum amount is $1100');
	}
	else if (amount > 750) credit = 2 * ((amount - 750) / 3) + 275;
	else if (amount > 400) credit = (amount - 400) / 2 + 100;
        else credit = amount / 4;

	document.getElementById('calc_credit').value = currencyFormatted(credit);

}


function currencyFormatted(amount)
{
        var i = parseFloat(amount);
        if(isNaN(i)) { i = 0.00; }
        var minus = '';
        if(i < 0) { minus = '-'; }
        i = Math.abs(i);
        i = parseInt((i + 0.005) * 100);       
        i = i / 100;
        s = new String(i);
        if(s.indexOf('.') < 0) { s += '.00'; }
        if(s.indexOf('.') == (s.length - 2)) { s += '0'; }
        s = minus + s;
        return s;
}

function taxCalcOne(){
	
}