function checkReturn(obj, e) {

    if (e.keyCode == 13 || e.which == 13) {
        var form = window.document.forms[0];
        var clicknext = false;
        var nextobj;
        for (var i = 0; i < form.elements.length; i++) {
            if (form.elements[i] == obj) clicknext = true;

            if (clicknext) {
                nextobj = form.elements[i];
                if (nextobj.type.toUpperCase() == "BUTTON" || nextobj.type.toUpperCase() == "SUBMIT") {
                    // for google search, move focus from the search input textbox to avoid page submit or url redirection by other code
                    if (obj.id == "searchText" && nextobj.id == "searchButton")
                        nextobj.focus();
                        
                    nextobj.click();
                    break;
                }
            }
        }
        return false;
    }
    return true;
}

sfHover = function() {
  if (document.getElementById("GopNav")) {
	var sfEls = document.getElementById("GopNav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
  }
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

function OpenWindow(URL,w,h,px,py)
{
 mywindow = window.open(URL,"mywindow","resizable,location=1,status=1,scrollbars=1,width="+ w + ",height=" + h)
 mywindow.moveTo(px,py)
 } 

function checkReturn(obj, windowEv, ev) {

    var workingEvent = null;

    if (windowEv != null) workingEvent = windowEv;
    else if (ev != null) workingEvent = ev;

    if (workingEvent.keyCode == 13 || workingEvent.which == 13) {
        var form = window.document.forms[0];
        var clicknext = false;
        var nextobj;
        for (var i = 0; i < form.elements.length; i++) {
            if (form.elements[i] == obj) clicknext = true;

            if (clicknext) {
                nextobj = form.elements[i];
                if (nextobj.type.toUpperCase() == "BUTTON" || nextobj.type.toUpperCase() == "SUBMIT") {
                    nextobj.focus();
                    var ua = navigator.userAgent;
                    if (/trident/ig.test(ua) || /presto/ig.test(ua)) { // IE or opera
                        nextobj.click();
                    }
                    else {    // other browsers that do not support calling click() directly
                        var newEvent = document.createEvent("MouseEvents");
                        newEvent.initEvent("click", true, true);
                        nextobj.dispatchEvent(newEvent);
                        ev.preventDefault();
                    }
                    break;
                }
            }
        }
        return false;
    }
    return true;
}

function Form1_onsubmit(box) {
if(box.value=="")
	{ 
	alert("A required field found empty")
	box.focus()
	return (false)
	}
else {
	if(confirm("are you shure you want to make changes"))
		return(true)
	else 
		return(false)
	}
}

function LC_StartPage(OrderNum)
{
    var url;
    if((OrderNum != null) && (OrderNum.toString() != ''))
    {
        url = '/livechat_gop/hppcwis.dll?varUserRequest=REQ_WEBCHAT_MAIN&varUserLanguage=english&startpage=' + window.location.toString() + "&OrderNum=" + OrderNum;
    }
    else
    {
        url = '/livechat_gop/hppcwis.dll?varUserRequest=REQ_WEBCHAT_MAIN&varUserLanguage=english&startpage=' + window.location.toString();
    }
    
    return url;
}


