var eret = "<TABLE cellspacing='0' cellpadding='0' border='0'><TR><TD><DIV class='second eryregbx'><SPAN class='erctf'><SPAN class='erclf'></SPAN></SPAN><DIV class='eryregbxtit'>";
var ereb = "</DIV><SPAN class='ercbf'><SPAN class='erclf'></SPAN></SPAN></DIV></TD></TR></TABLE>";
var eremsg = "VAR_MSG";
var ertemplate = eret + eremsg + ereb;

function _getform(){
	var theform;
	if(window.navigator.appName.toLowerCase().indexOf("netscape")>-1){
		theform=document.forms["Form1"];
	}else{
		theform=document.Form1;
	}
	return theform;
}
function _getfelems(elemsid) {
	var theelems;
	if(window.navigator.appName.toLowerCase().indexOf("netscape")>-1){
		theelems=document.getElementById(elemsid);
	}else{
		var theform=_getform();
		theelems=theform.elements(elemsid);
	}
	return theelems;
}
// Cross-browser get element 
function _getfelemsbyId(eName){
  if(document.all)
    return document.all[eName]; 
  else
    return document.getElementById(eName); 
}

function setcss_selected()
{
	chk = event.srcElement;	
	row = event.srcElement.parentElement.parentElement;	
	if(chk.checked)
		row.className = "rowsel";
	else
	{
		if(row.title==null || row.title=="")
			row.className = "rownor";
		else
			row.className = row.title;
	}
}
function setselected(chk)
{
	row = chk.parentElement.parentElement;	
	if(chk.checked)
		row.className = "rowsel";
	else
	{
		if(row.title==null || row.title=="")
			row.className = "rownor";
		else
			row.className = row.title;
	}		
}

function tggle(d){
	var e=document.getElementById(d);
	if(e==null) return;
	if(e.style.display=='none') e.style.display = '';
	else e.style.display = 'none';
}
function tgglev(d){
	var e=document.getElementById(d);
	if(e==null) return;
	e.style.display='';
}
function tggleh(d){
	var e=document.getElementById(d);
	if(e==null) return;
	e.style.display='none';
}

function selAll(icheckall, icheck)
{
		var theform = _getform();
		var checkall = _getfelems(icheckall);
		var status = checkall.checked;
		for(var i=0;i<theform.elements.length;i++){
				var e = theform.elements[i];
				if (e.type=='checkbox' && e.name==icheck){
					e.checked = status;
					setselected(e);
				}	
		}
		return;
}
function cleAll(icheck)
{
		var theform = _getform();
		for(var i=0;i<theform.elements.length;i++){
				var e = theform.elements[i];
				if (e.type=='checkbox' && e.name==icheck)
					e.checked = false;
		}
		return;
}


function Fileattachview(fileUrl, vnote){
	if(fileUrl=='') return;
	var theelems=_getfelemsbyId('dfileattachview');
	theelems.innerHTML=fileUrl+'<BR>'+vnote;
	return;
}
function openWI(blto, itmid){
	var url='zoominfo.aspx?browse=watch&blto='+blto+'&itmid='+itmid;
	window.open(url, "zoominfo", "scroll=yes, status=yes, height=600, width=600, resizable=no");
}
function openWR(itmid){
	var url='newsreplies.aspx?browse=watch&itmid='+itmid;
	window.open(url, "replies", "scroll=no, status=yes, height=600, width=600, resizable=no");
}
function openWP(itmid){
	var url='newsprint.aspx?browse=watch&itmid='+itmid;
	window.open(url, "print");
}

function loaderror(dview, msg)
{
		var theelme = document.getElementById(dview);
		if(theelme==null) return;
		theelme.style.display = '';
		theelme.innerHTML = "<DIV align='center' style='padding-top:5px; FONT-FAMILY:  Arial, Tahoma; FONT-SIZE: 12px; FONT-WEIGHT: normal; COLOR: #c61444;'>" + msg + "</DIV>";
}
function loaderrorf(dview, msg)
{
		var theelme = document.getElementById(dview);
		if(theelme==null) return;
		theelme.style.display = '';
		theelme.innerHTML = msg==''? '' : ertemplate.replace(eremsg, msg);
}
function loading(dview)
{
		var theelme = document.getElementById(dview);
		if(theelme==null) return;
		theelme.style.display = '';
		theelme.innerHTML = "<DIV align='center'><IMG align='absmiddle' src='../images/progress.gif'></DIV>";
}
function loadingnott(dview)
{
		var theelme = document.getElementById(dview);
		if(theelme==null) return;
		theelme.style.display = '';
		theelme.innerHTML = "<SPAN><IMG align='absmiddle' src='../images/loading.gif'></SPAN>";
}
function initreload(dlview, dlhide, removetext)
{
		var theelem;
		theelem = document.getElementById(dlview);
		if(theelem!=null)
				theelem.style.display = '';
		if(removetext && theelem!=null) 
				theelem.value = '';
		theelem = document.getElementById(dlhide);
		if(theelem!=null)
				theelem.style.display = 'none';
		return;
}
function resetstatus(e)
{
		setTimeout("initreload('null', '" + e.id + "', true)", 10000);
}
function mydetail(e,tourl,act,id){
	if(act!=0){e.className='vllnkdefsdis';return;}
	e.className='vllnkdefs';
	location.href=tourl+'?browse=watch&itmid='+id;
}

