//(c) 2006, KSU
function NewWindow(mypage, myname, w, h, scroll){
var winl=(screen.width - w) / 2;var wint=(screen.height - h) / 2;
winprops='height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
win=window.open(mypage, myname, winprops)
if(parseInt(navigator.appVersion)>=4){win.window.focus();}}
window.onload=initialize;function initialize(){if(self.init){self.init();}}
function init(){if(typeof(document.querybox)!='undefined'){
if(typeof(document.querybox.SAB2)!='undefined'){document.querybox.SAB1.focus();}
else document.querybox.Search_Arg.focus();}if(typeof(document.logonpage)!='undefined'){document.logonpage.BC.focus();
}if(typeof(document.reqselectpage)!='undefined'){document.reqselectpage.REQPICK.focus();
}document.forms[0].onsubmit=function(){register();}}
function register(){var theIndex=0;selsearch=document.forms[0].Search_Code.selectedIndex;
if(document.forms[0].Search_Code.options[selsearch].value=='CMD'){theIndex=1;}else{theIndex=0;}
if(theIndex==1){str1=document.forms[0].Search_Arg.value;insertAND(str1);}}
function insertAND(s){s=s.replace(/(\(|\))/g," $1 ");var r=/(\"[^"]*\"|\S+)/g;s=s.replace(r,"$1#");a=s.split("#");len=a.length-1;str="";pword=0;
for(i=0;i<len;i++){if(a[i].match(/^\s*"/)){if(i==0||pword==1){str=str+a[i];pword=0;}else{str=str+" AND "+a[i];}
}else{if(a[i].match(/^\s*and\s*$/i)){if(pword==1){}else{str=str+"AND";pword=1;}}else if(a[i].match(/^\s*or\s*$/i)){if(pword==1){}else{str=str+"OR";pword=1;}}else if(a[i].match(/^\s*not\s*$/i)){str=str+"NOT";pword=1;}else if(a[i].match(/&/)){str=str.replace(/\s*([a-zA-Z0-9_\-\(\)\?]+)\s+$/," \"$1");str=str+" & "+a[i+1]+"\" ";i++;
}else if(a[i].match(/(^\s*GKEY\s*$|^\s*IALL\s*$|^\s*ISBN\s*$|^\s*ISSN\s*$|^\s*JKEY\s*$|^\s*KPPD\s*$|^\s*LSUB\s*$|^\s*NKEY\s*$|^\s*NOTE\s*$|^\s*SERI\s*$|^\s*SKEY\s*$|^\s*TKEY\s*$|^\s*\d{3}[ABCKLNT]\s*$)/)){
if(pword==1||i==0){str=str+a[i];}else{str=str+" AND "+a[i];}pword=1;}else if(a[i].match(/\(/)){
if(pword==1||i==0){str=str+"(";}else{str=str+" AND"+"(";pword=1;}if(i==0){pword=1;}}else if(a[i].match(/\)/)){str=str+")";
pword=0;}else if(a[i].match(/-/)){if(pword==1||i==0){str=str+"\""+a[i]+"\"";pword=0;}else{str=str+" AND "+"\""+a[i]+"\"";
}}else{if(i==0||pword==1){str=str+a[i];pword=0;}else{str=str+" AND "+a[i];}}}
str=str+" ";}document.forms[0].Search_Arg.value=str;}