/*  scripts  */
function startcoos(){
var loc1='cc/Aindex.jsp';
 location = loc1 ;
 }
 
/* S1 is by account and S2 is by Name */ 
function srch01(A, B){ 
var e1 = 0;
var m1 = "";    
var s1= A.value;  
var s2=(B.value).toUpperCase();  /* convert to upper case */

// error handling
if (s1=="" && s2==""){ e1=1; m1="An Account or a name must be entered";} ;
// alert if error
  if (e1==1) { alert(m1) ; return false; }
// else continue 

var sls='N';

if (s1!=""){   
var s1len = 9-s1.length; /* convert to 9 char acct number */                                               
if (s1len==1){s1=" "+s1;}; if (s1len==2){s1="  "+s1;}; if (s1len==3){s1="   "+s1;};         
if (s1len==4){s1="    "+s1;}; if (s1len==5){s1="     "+s1;}; if (s1len==6){s1="      "+s1;};  
var s2=(B.value).toUpperCase();  /* convert to upper case */

if (s1.substring(6,7)== '.') { sls='Y'; }	

}
  

 
if (s1=="") {
var loc1='cc/WV?qid=AS02&Acct='+s2+'%25'; /* no acct use name */
}else{
var loc1='cc/WV?qid=AS20&Acct='+s1; }; /* no name use acct */
var loc2='&AY=2010&SLS='+sls;
var loc9='&LG=C&IsLogin=X&PW=a';
 location = loc1+loc2+loc9 ;
 }
 
/* Address Search  */ 
function srch05(A, B, C, D, E, F){
var e1 = 0;
var m1 = "";

var s1= A.value;                 /* house number set to zero if blank*/
if (s1==""){s1=0;};
var s2=(B.value).toUpperCase();  /* sfx convert to upper case */
var s3=(C.value).toUpperCase();  /* dir convert to upper case */;
var s4=(D.value).toUpperCase();  /* street name convert to upper case */
var s5=(E.value).toUpperCase();  /* Str sfx convert to upper case */
var s6= F.value;                 /* zip code */

// error handling
if (s1=="0" && s2=="" && s3=="" && s4=="" && s5==""){
     e1=1; m1="Please provide an additional search value with the zip code";} ;
// alert if error
  if (e1==1) { alert(m1) ; return false; }
// else continue 

var loc1='cc/WV?qid=AS05&S1='+ s1+'&S2='+s2+'&S3='+s3;
var loc2='&S4='+s4+'%25'+'&S5='+s5+'&S6='+s6;
var loc3='&AY=2010';
var loc9='&LG=coos&IsLogin=X&PW=assessor';
 location = loc1+loc2+loc3+loc9 ;
 }
 
/* Map Search  */ 
function srch10(A, B, C, D, E, F, G, H, I){
var e1 = 0;
var m1 = "";

var s1=A.value; if(s1==null || s1==' ' || s1==''){s1=0;}; /* township */
var s2=B.value; /* township dir = S hidden */
var s3=C.value; /* range */
var s4=D.value; /* range dir = W hidden */
var s5=E.value; if(s5==null || s5==' ' || s5==''){s5=0;}; /* section */
var s6=(F.value).toUpperCase(); /* Qtr section */
var s7=G.value; if(s7==null || s7==' ' || s7==''){s7=0;}; /* parcel */
var s8=(H.value).toUpperCase(); /* alpha */
var s9=I.value; if(s9==null || s9==' ' || s9==''){s9=0;}; /* # spcl Int Number */

// error handling
if (s1=="0" || s3=="" ){
     e1=1; m1="A Township, and Range must be entered";} ;
// alert if error
  if (e1==1) { alert(m1) ; return false; }
// else continue 

var loc1='cc/WV?qid=AS10&S1='+ s1+'&S2='+s2+'&S3='+s3;
var loc2='&S4='+s4+'&S5='+s5+'&S6='+s6;
var loc3='&S7='+s7+'&S8='+s8+'&S9='+s9;
var loc4='&AY=2010';
var loc9='&LG=C&IsLogin=X&PW=a';
 location = loc1+loc2+loc3+loc4+loc9 ;
 }
 
/* Account Detail  */ 
function srch20(A){
var s1=A; 
var sls='N';
 if (s1.substring(6,7)== '.') {
 sls='Y';
 }
var loc1='WV?qid=AS20&Acct='+s1;
var loc3='&AY=2010&SLS='+sls;
var loc9='&LG=C&IsLogin=X&PW=a';
 location = loc1+loc3+loc9 ;
 } 
 
/* Account Detail Et Al information  */ 
function srch21(A){
var w=400;
var h=400;
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
var n='name';
var scroll='yes';
var s1=A;  
var loc1='WV?qid=AS21&Acct='+s1;
var loc2='&AY=2010';
var loc10= loc1+loc2 ;

winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
win = window.open(loc10, n, winprops)
 } 
 
/* Account Detail Special Assessments */ 
function srch22(A){
var w=400;
var h=400;
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
var n='name';
var scroll='yes';
var s1=A;  
var loc1='WV?qid=AS22&Acct='+s1;
var loc2='&AY=2010';
var loc10=loc1+loc2;
 
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
win = window.open(loc10, n, winprops) 
 }
 
/* Account Detail Sales details */ 
function srch25(A){
var w=550;
var h=500;
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
var n='name';
var scroll='yes';
var s1=A;  
var loc1='WV?qid=AS25&Acct='+s1;
var loc2='&AY=2010';
var loc10=loc1+loc2;
 
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
win = window.open(loc10, n, winprops) 
 }    
 

function IWindow(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(); }
}

// validates that the entry is a positive or negative number
function isNumber(elem) {
    var str = elem.value;
    var oneDecimal = false;
    var oneChar = 0;
    // make sure value hasn't cast to a number data type
    str = str.toString( );
    for (var i = 0; i < str.length; i++) {
        oneChar = str.charAt(i).charCodeAt(0);
        // OK for minus sign as first character
        if (oneChar == 45) {
            if (i == 0) {
                continue;
            } else {
                alert("Only the first character may be a minus sign.");
                return false;
            }
        }
        // OK for one decimal point
        if (oneChar == 46) {
            if (!oneDecimal) {
                oneDecimal = true;
                continue;
            } else {
                alert("Only one decimal is allowed in a number.");
                return false;
            }
        }
        // characters outside of 0 through 9 not OK
        if (oneChar < 48 || oneChar > 57) {
            alert("Enter only numbers into the field.");
            return false;
        }
    }
    return true;
}

// for print button
function pageprint() {
window.print();  
}
