
document.onkeypress = docKeyDown;
document.onkeyup= docKeyDown;
document.onkeydown = docKeyDown;

function getObj(id){
	ret=null;
	try{    ret=document.getElementById(id); }catch(e){}
	return ret;
}

function ShowImg(image,id,imageHref,width,height){
    m = getObj(id);
    href = getObj(imageHref);
    href.href = image;
    m.src = image;
    if(width > 235)
        m.width = 235;
     else
        m.width = width;
}

function openfile(id){
    w = window.open('/HomePage/Common/OpenFile.aspx?id=' + id , null,'resizable=no,width=1,height=1,left=1,top=1');
    w.moveTo(self.screen.width/2 - 100, self.screen.height/2 - 100);
}

function printResults(){
    w = window.open('/HomePage/Common/PrintMembers.aspx?all=0', null, 'resizable=no,scrollbars=yes status=no, width=650, height=800, left=10, top=10');
}

function printAll(){
    w = window.open('/HomePage/Common/PrintMembers.aspx?all=1', null, 'resizable=no, scrollbars=yes, status=no, width=650, height=800, left=10, top=10');
}

function setFocus(id){
    if(getObj(id))
        getObj(id).focus();
}

function docKeyDown(e)
{
    if (!e) 
        var e = window.event
    
    if (e.target) 
        targ = e.target
    else if (e.srcElement) 
        targ = e.srcElement
    
    if (targ.nodeType == 3) // defeat Safari bug
        targ = targ.parentNode
    
    
    if(targ.tagName != "INPUT" && targ.tagName != "TEXTAREA")
        return false;
}

function keyUp(e, id)
{
    try { 
        k = event.keyCode   // ie
    }catch(e){}
    
    try { 
        k = e.keyCode       // mozilla
    }catch(e){}
    
    if(k == 13)
    {
        setFocus(id);
        getObj(id).click();
    }
}

function searchClick(e, id){
    if(getObj(id).value == "Search...")
        getObj(id).value = ""; 
}

function searchOut(e, id){
    if(getObj(id).value == "")
        getObj(id).value = "Search..."
}
