// JavaScript Document

function warn_delete(){
	return confirm("Are you sure you want to delete this item?");
}

function warn_archive(){
	return confirm("Are you sure you want to archive this item?");
}


function image_suppress(image){
	image.onerror=null;
	image.width='1';
	image.height='1';
	image.border='0';
	image.vspace='0';
	image.hspace='0';
	image.src='http://web.reporter-news.com/documents/obits/images/no_image.jpg';

}

//COOKIES related
thisdomain = document.location + "";
thisdomain = thisdomain.substring(thisdomain.indexOf('//')+2,thisdomain.length);
thisdomain = thisdomain.substring(0,thisdomain.indexOf('/'));
thisdomain = (navigator.appName != "Netscape")? thisdomain.substring(thisdomain.indexOf('.')+1,thisdomain.length): thisdomain;


function getCookieVal (offset) {
	var endstr = document.cookie.indexOf(';',offset);
	if (endstr == -1) {
		endstr = document.cookie.length;
	}
	return unescape(document.cookie.substring(offset,endstr))
}


function SetCookie (name, value, expires, path, domain, secure) {
	document.cookie = name + "=" + escape (value) + ((expires) ? "; expires=" + expires.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : "");
} 


function GetCookie (name) {
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;

	while (i < clen) {
		var j = i + alen;
		if (document.cookie.substring(i,j) == arg) {
			return getCookieVal(j);
		}
		i = document.cookie.indexOf(" ", i) + 1;
		if (i==0) break;
	}
	return null;  
}


function DeleteCookie (name, path, domain) {
   if (GetCookie(name)) {
    document.cookie = name + "=" + ((path) ? "; path=" + path : "") +  ((domain) ? "; domain=" + domain : "") + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
   }
}


function FixCookieDate (date) { 
	var base = new Date(0); 
	var skew = base.getTime();
	if(skew > 0)
		date.setTime (date.getTime() - skew);     
}
//END COOKIES

//POLL FUNCTIONS, can be used elsewhere also
function toggle_text(id_sent, oldtext, newtext)
{
	if (document.getElementById(id_sent).innerHTML == oldtext)
		document.getElementById(id_sent).innerHTML = newtext;
	else if (document.getElementById(id_sent).innerHTML == newtext)
		document.getElementById(id_sent).innerHTML = oldtext;
}

function toggle_content(id_sent)
{
	if (document.getElementById(id_sent).style.display == "block" || document.getElementById(id_sent).style.display == "")
		document.getElementById(id_sent).style.display = "none";
	else
		document.getElementById(id_sent).style.display = "block";
}

// return the value of the radio button that is checked
// return an empty string if none are checked, or
// there are no radio buttons
function getCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}
//END POLL FUNCTIONS