//   DS SPECIFIED FILE.  	EDIT AT YOUR OWN RISK.

function Focus() { document.forms[0].elements[0].focus() }

function StartUpScript() {
	// EMPTY STARTUP script,  edit in UserDefined.js or <scriptname>.js
}

function OpenPopup(x, y ,href, i, scr) {
	if(scr == "No") {
		var newwin = window.open(href, "PopUp", "left=0,top=0,width="+x+",height="+y+",scrollbars=No");
	} else {
		var newwin = window.open(href, "PopUp", "left=0,top=0,width="+x+",height="+y+",scrollbars");
	}
	newwin.opener = self;
}

function CloseAuthority(txt,fld) {
	var x = "window.opener.document.SearchForm."+fld+".value = '"+txt+"'"
	eval(x);
	self.close();

}

function setCookie(name, value, expires, path, domain, secure) {
	var curCookie = name + "=" + escape(value) + ((expires) ? "; expires=" + expires : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : "");
	document.cookie = curCookie;
}

function CheckCookies() {
	if(document.cookie == '') {
		document.cookie = 'KILL_acook=yes';
		if(document.cookie == '') {
			alert("Your browser doesn't accept cookies!  Returning to menu");
			self.location.href=document.referrer;
			return 0 ; // set cookie failed - return to calling page
		}
	}
	// kill test cookie
	document.cookie = "KILL_acook=''; expires=Fri, 13-Apr-1970 00:00:00 GMT"
	return 1; // cookie already exists
}

function KillCookie(x) {
	document.write("Killing: "+x+"=''; expires=Fri, 13-Apr-1970 00:00:00 GMT");
}

function Page(x,m) {
 	var c = document.PageNum.PageCt.value;
	c = eval(c + x)
	if (c<1) { var c = 1}
	if (c>m) { var c = m }
	document.PageNum.PageCt.value=c;
}

function ChangePage(app,srvr,ini,db,srch,max,cnt) {
	var c = document.PageNum.PageCt.value;
	if (c < 2) { c = 2 }
	if (eval(max - c) < 0) { c = max }
	var c = ((c-1) * cnt) + 1
	var h = window.opener
	var r = h.location.href
	var pos = r.split("?")
	hr = pos[0]+'?dsqServer='+srvr+'&dsqApp='+app+'&dsqDb='+db+'&dsqCmd=Overview.tcl'+'&dsqPos='+c
	h.location.href = hr
	self.close()
}

function ChangeRecord(app,srvr,ini,db,srch,max,cnt) {
	var c = document.PageNum.PageCt.value;
	if (c < 2) { c = 2 }
	if (eval(max - c) < 0) { c = max }

	var h = window.opener
	var r = h.location.href
	var pos = r.split("?")
	hr = pos[0]+'?dsqServer='+srvr+'&dsqApp='+app+'&dsqDb='+db+'&dsqCmd=Show.tcl'+'&dsqPos='+c+'&dsqSearch='+srch
	h.location.href = hr
	self.close()
}

