<!--
//window.onerror = handleError;
//function handleError(msg, url, lno) {
//popUp("http://CallYourMissionary.com/includes/error2.asp?msg=" + msg +"&url=" + url + "&lno=" + lno,250,450)
//return true;
//}


function showhide(id){
	var div = document.getElementById(id)

	if (div.style.display=="none"){
		div.style.display="block"
	}else{
		div.style.display="none"
	}
}









var newWin = null; 
function popUp(strURL, strHeight, strWidth) { 
var left = (screen.width - strWidth) / 2
var top = (screen.height - strHeight) / 2
strType="elastic"
 if (newWin != null && !newWin.closed) 
   newWin.close(); 
 var strOptions=""; 
 if (strType=="console") 
   strOptions="resizable,height="+ 
     strHeight+",width="+strWidth; 
 if (strType=="fixed") 
   strOptions="status,height="+ 
     strHeight+",width="+strWidth; 
 if (strType=="elastic") 
   strOptions="scrollbars,"+ 
     "resizable,height="+ 
     strHeight+",width="+strWidth; 
 newWin = window.open(strURL, 'newWin', strOptions + ",left=" + left + ",top=" + top); 
 newWin.focus(); 
}






function Round(number) {
    return Math.round(number*Math.pow(10,0))/Math.pow(10,0);
}

function Round2(number) {
    return Math.round(number*Math.pow(10,2))/Math.pow(10,2);
}

function Round3(number) {
    return Math.round(number*Math.pow(10,3))/Math.pow(10,3);
}

function PadZero3(x){
	x = x.toString()
	if (x.indexOf('.') < 0) return x + ".00"
	y = x.split('.')
	if (y[1].length > 3) x = Round3(x)
	x += ""
	z = x.split('.')
	switch (z[1].length){
		case 2:
			x += "0"
			break
		case 1:
			x += "00"
			break
		default:
	}
	return x
}

function Cent(num){
	num = Round2((num *100)) + "¢"
	return num
}


function Currency(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);
}

function Currency2(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);
}

function Currency3(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) ;
}


function GetCookie(the_info,cookiename){
	var the_values = readCookie(cookiename) //broken_cookie[1];
	if (the_values==false) return false
	var separated_values = the_values.split("&");
	var property_value = "";
	for (var loop = 0; loop < separated_values.length; loop++)	{
		property_value = separated_values[loop];
		var broken_info = property_value.split("=");
		var the_property = broken_info[0];
		var the_value = broken_info[1];
		the_info[the_property] = the_value;
	}
}

function readCookie(name) {
	if(document.cookie == '') { // there's no cookie, so go no further
		return false; 
	} else { // there is a cookie
		var firstChar, lastChar;
		var theBigCookie = document.cookie;
		firstChar = theBigCookie.indexOf(name);	// find the start of 'name'
		var NN2Hack = firstChar + name.length;
		if((firstChar != -1) && (theBigCookie.charAt(NN2Hack) == '=')) { // if you found the cookie
		firstChar += name.length + 1; // skip 'name' and '='
		lastChar = theBigCookie.indexOf(';', firstChar); // Find the end of the value string (i.e. the next ';').
		if(lastChar == -1) lastChar = theBigCookie.length;
			return unescape(theBigCookie.substring(firstChar, lastChar));
		} else { // If there was no cookie of that name, return false.
			return false;
		}
	}	
}


//-->
