//**************************************************************************************
function setDefaultViewer()
{                                  
    var viewPrtCookie = getCookie('&WSVPVER');
    var pluginVersion = document.tifViewer.version;
    /** alert("Your pluginVersion is:" + pluginVersion);
    /** If you found the Plugin, they are not using Java and the Plugin version **/
    /** does not match the cookie, update the cookie **/
    if (pluginVersion && viewPrtCookie != "JV01" && pluginVersion != viewPrtCookie )
    {writeCookie('&WSVPVER',pluginVersion);return true;}

    /** If you did not find either the Plugin or the viewPrtCookie, set to Java **/
    if (!pluginVersion && !viewPrtCookie){writeCookie('&WSVPVER','JV01');
    alert("Your viewing/printing preference has been set to the Java Applet.\n\nIf you are using Internet Explorer and prefer the Browntech Plugin:\n1. If not already installed, use the link at the bottom of this page to install it\n2. Use the Set Viewing/Printing Preferences link on the Main Menu to change your setting to the Plugin.");
     }
}
//**************************************************************************************
function getCookie(name)
{
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1)
    {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    }
    else
    {
        begin += 2;
    }
    var end = dc.indexOf(";", begin);
    if (end == -1)
    {
        end = dc.length;
    }
    return unescape(dc.substring(begin + prefix.length, end));
}

//**************************************************************************************
function writeCookie(name,cookieValue)
{
    var d = new Date("December 31, 2099");
    var cd = d.toGMTString();
    document.cookie = name + '=' + cookieValue + ';expires=' + cd + ';' + 'path=/;';
}

//**************************************************************************************
function checkDate(strDatVal){


        //check format
        if (        !strDatVal.match('^[0-1][0-9][0-3][0-9][1-2][0-9][0-9][0-9]$')        ){
                return false;
        }

        var intMonth = parseInt(strDatVal.substr(0,2),10) - 1;
        var datDatVal = dateConvert(strDatVal);
        return true;
}

//**************************************************************************************
function checkInt(strIntVal){

        //check to make sure only digits
        if ( !strIntVal.match('^[ ]*[0-9][0-9]*[ ]*$') ){
                return false;
        } else {
                return true;
        }
}

//**************************************************************************************
//** begin tifViewer Functions
var CurrentVersion = "2.03";
var pluginVersion;

if (document.tifViewer) {pluginVersion = document.tifViewer.version;} else {pluginVersion = "Not installed";}
function checkVersion(){
        if (document.tifViewer.version == CurrentVersion
	 || document.tifViewer.version == "1.92"
	 || document.tifViewer.version == "1.93"
	 || document.tifViewer.version == "1.94"
	 || document.tifViewer.version == "1.95"
	 || document.tifViewer.version == "1.96"
	 || document.tifViewer.version == "1.97"
	 || document.tifViewer.version == "1.98"
	 || document.tifViewer.version == "1.99"
	 || document.tifViewer.version == "2.00"
	 || document.tifViewer.version == "2.01"
	 || document.tifViewer.version == "2.02"){
                return true;
        }else if (pluginVersion == "Not installed") {
                alert("We are unable to detect what version, if any, of the Browntech Image Plugin is installed on your machine.  You must select either the Java Applet or, if running Windows and Internet Explorer, the Plugin.  Please review the Support/FAQ document for instructions.  To do so, follow these steps:\n\n1. Click on the OK button to close this window\n2. Click on the Support/FAQ link near the bottom of the View window\n3. Review the document, searching for 'Plugin'");
                return false;
        }else {
                alert(pluginVersion + " is out of date.  You must select either the Java Applet or, if running Windows and Internet Explorer, the Plugin.  Please review the Support/FAQ document for instructions.  To do so, follow these steps:\n\n1. Click on the OK button to close this window\n2. Click on the Support/FAQ link near the bottom of the View window\n3. Review the document, searching for 'Plugin'");
                return false;
        }
}

//**************************************************************************************
function closeWindow() {
window.open('','_parent','');
window.close();
}

//**************************************************************************************
function dateConvert(mmddyyy){
        var intMonth = parseInt(mmddyyy.substr(0,2),10) - 1;
        var intDay = parseInt(mmddyyy.substr(2,2),10);
        var intYear = parseInt(mmddyyy.substr(4,4),10);
        
        return new Date(intYear,intMonth,intDay);
}

//**************************************************************************************
//** DropDown list function execution
function doAction(wsiqtp,w9rccy,w9rcmm,w9rcdd,ctlns,dockycd,imid){
        var dest_page;
        var myWind;

        if(wsiqtp.substr(2) == '09I'){
                myWind = window.top.document.getElementById('frmbt_left');
        } else {
                myWind = window;
        }

        if (wsiqtp.length > 0){
        dest_page = '/ALIS/WW400R.HTM/&WSIQTP=' + wsiqtp
                + '&W9RCCY=' + w9rccy
                + '&W9RCMM=' + w9rcmm
                + '&W9RCDD=' + w9rcdd
                + '&W9CTLN=' + ctlns
                + '&WSKYCD=' + dockycd
                + '&W9IMID=' + imid;

        myWind.location = dest_page;
        }
}


//**************************************************************************************
function doPrint(){
        if (document.tifViewer && checkVersion()){
                tifViewer.printPages();
        }
}

//**************************************************************************************
function doPrintCart(sURL,sConfirmURL,blnOverlayPrint){
        if (document.tifViewer && checkVersion()){
                if (blnOverlayPrint == true){
                        tifViewer.overlayPrint = true;
                } else {
                        tifViewer.overlayPrint = false;
                }
                tifViewer.doPrintCart(sURL,sConfirmURL);
        }
}

//**************************************************************************************
function doRotateL(){
        if (document.tifViewer && checkVersion()){
                tifViewer.rotateL();
        }
}

//**************************************************************************************
function doRotateR(){
        if (document.tifViewer && checkVersion()){
                tifViewer.rotateR();
        }
}

//**************************************************************************************
//* This function accepts a variable form name and IqTp and submits the form
function doVarButton2(frmName,IqTp){
       oFormObject = document.forms[frmName];
       oFormObject.elements["WSIQTP"].value = IqTp;

       timeoutString='document.getElementById\(\'' + frmName + '\' \).submit\(\)\;';
       setTimeout(timeoutString,500);
}

//**************************************************************************************
//* This function accepts a variable form name, IqTp and KyCd and submits the form with those values
function doVarButton3(frmName,IqTp,KyCd){

       oFormObject = document.forms[frmName];
       oFormObject.elements["WSKYCD"].value = KyCd;
       oFormObject.elements["WSIQTP"].value = IqTp;

       timeoutString='document.getElementById\(\'' + frmName + '\' \).submit\(\)\;';
       //*alert(timeoutString);
       setTimeout(timeoutString,500);
}

//**************************************************************************************
function doZoomIn(){
        if (document.tifViewer && checkVersion()){
                tifViewer.zoomIn();
        }
}

//**************************************************************************************
function doZoomOut(){
        if (document.tifViewer && checkVersion()){
                tifViewer.zoomOut();
        }
}

//**************************************************************************************
// Script to audit the agenda year and number
function fh422j(){
        var errorstring = '';
        var refcd = stripWhitespace(document.search.W9AGCY.value,3);
        var refn  = stripWhitespace(document.search.W9ASEQ.value,3);
        
        if (refcd.length == 100 ){
                errorstring += 'You must enter an agenda year\n';
        }

        if (refn.length == 0 ){
                errorstring += 'You must enter an agenda number\n';
        }
        

        if (errorstring.length > 0){
                alert(errorstring);
        } else {
                document.search.W9AGCY.value = refcd
                document.search.W9ASEQ.value = refn
                setTimeout('document.search.submit()',1);
        }
}

//**************************************************************************************
function frameUpdate(){
        var leftFrameId   = parent.frmbt_left.document.getElementById("WSHTNM").form.id;
        var leftFrameKyCd = parent.frmbt_left.document.getElementById("WSKYCD").value;
        var rightFrameId  = parent.frmbt_right.document.getElementById("WSHTNM").form.id;

	//*alert(' frmbt_left form id is:' + leftFrameId + '\n frmbt_left WSKYCD is:' + leftFrameKyCd + '\n frmbt_right form id is:' + rightFrameId);

	if (leftFrameId == 'search'){
                switch (window.parent.frmbt_left.document.getElementById('WSKYCD').value){

			case "B":        //book/page
				var timeoutString = '';
                                if ((parent.frmbt_left.document.search.W9BKCD)?true:false){
                                        timeoutString += "parent.frmbt_left.document.search.W9BKCD.value =document.res_frm.W9BKCD.value;";
                                }
                                timeoutString += "parent.frmbt_left.document.search.W9BK.value=stripLeadingZeros(document.res_frm.W9BK.value);"
                                + "parent.frmbt_left.document.search.W9PG.value=stripLeadingZeros(document.res_frm.W9PG.value);";
                                //*alert('timeoutString is:' + timeoutString);
				setTimeout(timeoutString,500);
                                break;                

                        case "C":        //Ctl Num
                                break;

                        case "D":        //Document #
                                setTimeout("parent.frmbt_left.document.search.W9DOCN.value = stripLeadingZeros(document.res_frm.W9DOCN.value);",500);
                                break;

                        case "F":        //LC Certificate
                                if ((document.res_frm.W9CTFN)?true:false){
                                setTimeout("parent.frmbt_left.document.search.W9CTFN.value = document.res_frm.W9CTFN.value;",500);
                                }
                                break;

                        case "I":        //Instrument #
                                setTimeout(
                                "parent.frmbt_left.document.search.W9RCCY.value = document.res_frm.W9RCCY.value;"
                                + "parent.frmbt_left.document.search.W9INO.value = stripLeadingZeros(document.res_frm.W9INO.value);",500);
                                break;
                        
                        case "L":        //LC by name
                                if ((document.res_frm)?true:false){
                                setTimeout(
				  "parent.frmbt_left.document.search.W9SN8.value = document.res_frm.W9SN8.value;" 
                                + "parent.frmbt_left.document.search.W9GN8.value = document.res_frm.W9GN8.value;",500);
                                }
                                break;

                        case "M":        //LC Encumbrance
                                if ((document.res_frm.W9CTFN)?true:false){
                                setTimeout(
				"parent.frmbt_left.document.search.W9CTFN.value = document.res_frm.W9CTFN.value;",500);
                                }
                                break;

                        case "N":        //Rec Land by Name
 				if ((document.res_frm)?true:false){
				var $Abr=document.res_frm.W9ABR.value;
				var $Town=document.res_frm.W9TOWN.value;
				timeoutString
				= "parent.frmbt_left.document.search.W9SNM.value=document.res_frm.W9SNM.value;"
                                + "parent.frmbt_left.document.search.W9GNM.value=document.res_frm.W9GNM.value;"
				+ "parent.frmbt_left.document.search.W9TOWN.value=document.res_frm.W9TOWN.value;"
				+ "parent.frmbt_left.document.search.W9ABR.value=document.res_frm.W9ABR.value;"
				;
				//*alert('W9ABR is:' + $Abr + '\nW9TOWN is: + $Town);
				setTimeout(timeoutString,500);
				}
                                break;
                        
                        case "P":        //Rec Land Plan Bk-Pg
                                setTimeout(
                                  "parent.frmbt_left.document.search.W9ABR.value = stripLeadingZeros(stripWhitespace(document.res_frm.W9ABR.value,3));"
				+ "parent.frmbt_left.document.search.W9PBK.value = stripLeadingZeros(stripWhitespace(document.res_frm.W9PBK.value,3));"
                                + "parent.frmbt_left.document.search.W9PPG.value = stripLeadingZeros(document.res_frm.W9PPG.value);"
                                + "parent.frmbt_left.document.search.W9PPG2.value = stripLeadingZeros(document.res_frm.W9PPG2.value);",500); 
                                break;

                        case "Q":        //LC Plan #
				setTimeout(
				"parent.frmbt_left.document.search.W9PLN1.value = document.res_frm.W9PLN1.value;",500);
                                break;

                        case "R":        //Ref #
                                var myForm
                                if ((document.res_frm)?true:false){
                                        myForm = document.res_frm;
                                } else {
                                myForm = document.res_frm;
                                parent.frmbt_left.document.search.W9REFCD.value = myForm.W9REFCD.value;  
                                parent.frmbt_left.document.search.W9REFN.value = myForm.W9REFN.value;                        
                                }
                                break;

                        case "U":        //Rec Land Plan #
				setTimeout(
                                "parent.frmbt_left.document.search.W9ABR.value = stripLeadingZeros(stripWhitespace(document.res_frm.W9ABR.value,3));"
     				+ "parent.frmbt_left.document.search.W9RCCY.value = stripLeadingZeros(stripWhitespace(document.res_frm.W9RCCY.value,3));"
                                + "parent.frmbt_left.document.search.W9PLNN.value = stripLeadingZeros(document.res_frm.W9PLNN.value);",500); 
                                break;
                }
        }
}

//**************************************************************************************
//** This routine appends the Search Records Per Page value to the url and reloads the page
function handleChgRpp(pageName,url){
url = url + pageName.value;
window.location=url;
}

//**************************************************************************************
function initViewer(sImageSrc,blnOverlayView,blnOverlayPrint){
        if (document.tifViewer && checkVersion()){
                document.tifViewer.overlayView=blnOverlayView;
                document.tifViewer.overlayPrint=blnOverlayPrint;
                document.tifViewer.imageSrc=sImageSrc
        }
}

//**************************************************************************************
//** Auto-cursor advance function
function inputTab(obj,len,numeric,nextElement) {
var maxSize = 0 ;
var rExp  =  /(^-?\d\d*\.\d*$)|(^-?\d\d*$)|(^-?\.\d\d*$)/;

if (obj.value.length != maxSize) {
maxSize = obj.value.length;
if (numeric == 0) {goodVal = 1;}
if (numeric == 1) {goodVal = rExp.test(obj.value);}
if ((maxSize == len) && (goodVal)) {nextElement.focus();}
}
}

//**************************************************************************************
function lc401j(){
        var errorstring = '';
        var startDate = document.search.W9FDTA.value;
        var endDate = document.search.W9TDTA.value;

        //check to make sure dates are valid
        if (startDate.length >  0){
                if (!checkDate(startDate)){
                        errorstring += "Start date must be a valid date in the format, MMDDYYYY\n"
                } 
        }
                        
        if (endDate.length >  0){
                if (!checkDate(endDate)){
                        errorstring += "Stop date must be a valid date in the format, MMDDYYYY\n"
                } else if (dateConvert(startDate).valueOf() > dateConvert(endDate).valueOf()){
                        errorstring += "Stop date must be greater than Start date\n";
                } 
        }
        
        if (errorstring.length > 0){
                alert(errorstring);
        } else {
                setTimeout('document.search.submit()',1);
        }
                
}

//**************************************************************************************
// Script to audit Land Ct document #
function lc409j(){
        var errorstring = '';
        var doc = document.search.W9DOCN.value;
        
        if (!checkInt(doc)){
                errorstring += 'Document # may only contain digits\n';
        }

        if (errorstring.length > 0){
                alert(errorstring);
        } else {
                document.search.W9DOCN.value = stripWhitespace(document.search.W9DOCN.value,3);
                setTimeout('document.search.submit()',1);
        }
}

//**************************************************************************************
// Script to audit Land Ct Certificate #
function lc412j(){
        var errorstring = '';
        var doc = document.search.W9CTFN.value;
        
        if (doc.length == 0){
                errorstring += 'Certificate # must be entered\n';
        }

        if (errorstring.length > 0){
                alert(errorstring);
        } else {
                document.search.W9CTFN.value = stripWhitespace(document.search.W9CTFN.value,3);
                setTimeout('document.search.submit()',1);
        }
}

//**************************************************************************************
// Script to audit Land Ct Encumbrance entry screen
function lc421j(){
        var errorstring = '';
        var ctf = document.search.W9CTFN.value;
        var doc = document.search.W9PDOC.value;
        
        if (ctf.length == 0){
        if (doc.length == 0){
                errorstring += 'Either Certificate # or Document # must be entered\n';
        }}

        if (errorstring.length == 0){
        if (doc.length > 0){
        if (!checkInt(doc)){errorstring += 'Document # may only contain digits\n';}
        }}

        if (errorstring.length > 0){
                alert(errorstring);
        } else {
                document.search.W9CTFN.value = stripWhitespace(document.search.W9CTFN.value,3);
                document.search.W9PDOC.value = stripWhitespace(document.search.W9PDOC.value,3);
                setTimeout('document.search.submit()',1);
        }
}

//**************************************************************************************
// Script to audit Land Ct Plan #
function lp409j(){
        var errorstring = '';
        var pln1 = document.search.W9PLN1.value;
        
        if (!checkInt(pln1)){
                errorstring += 'Plan # may only contain digits\n';
        }

        if (errorstring.length > 0){
                alert(errorstring);
        } else {
                document.search.W9PLN1.value = stripWhitespace(document.search.W9PLN1.value,3);
                setTimeout('document.search.submit()',1);
        }
}

//**************************************************************************************
function openLogin(IqTp){
  window.open("/ALIS/WW400R.HTM?WSIQTP=" + IqTp,'wPopup',         
  'menubar=no,location=no,directories=no,toolbar=no,resizable=no,scrollbars=no,left=100,top=100');
}

//**************************************************************************************
function openPopup(IqTp){
  window.open("/ALIS/WW400R.HTM?WSIQTP=" + IqTp,'wPopup',
 'menubar=no,location=no,directories=no,toolbar=no,scrollbars=yes,resizable=yes')
  }

//**************************************************************************************
function openPopup2(url){
  window.open("/ALIS/WW400R.HTM" + url,'wPopup',
'height=250,width=550,menubar=no,location=no,directories=no,toolbar=no,scrollbars=yes,resizable=yes,left=400,top=200')
  }

//**************************************************************************************
function refreshPrev() {
  window.opener.location.reload();
  window.close();
  }

//**************************************************************************************
function rg401j(){
        var errorstring = '';
        var startDate = document.search.W9FDTA.value;
        var endDate = document.search.W9TDTA.value;
        var rdoCheckYears = document.search.W9INQ;
        var intMinCY = parseInt(document.search.CYVAL.value,10);
        var intMinAY = parseInt(document.search.AYVAL.value,10);

        if (startDate.length >  0){
                if (!checkDate(startDate)) { errorstring += "Start date must be a valid date in the format, MMDDYYYY\n" }
        }

        if (endDate.length >  0){
                if (!checkDate(endDate)) { errorstring += "Stop date must be a valid date in the format, MMDDYYYY\n" }
               else if (dateConvert(startDate).valueOf() > dateConvert(endDate).valueOf()) { errorstring += "Stop date must be greater than Start date\n" }
        }

        if (errorstring.length > 0){
                alert(errorstring);
        } else {
                setTimeout('document.search.submit()',1);
        }
                
}

//**************************************************************************************
// Script to audit the year-inst# prompt
function rg405j(){
        var errorstring = '';
        var ino  = document.search.W9INO.value;
        var year = document.search.W9RCCY.value;

        if (!checkInt(year)){
                errorstring += 'You must enter a Year and it may only contain digits\n';
        }

        if (!checkInt(ino)){
                errorstring += 'You must enter an Instrument # and it may only contain digits\n';
        }

        if (errorstring.length > 0){
                alert(errorstring);
        } else {
                document.search.W9INO.value = stripWhitespace(document.search.W9INO.value,3)
                document.search.W9RCCY.value = stripWhitespace(document.search.W9RCCY.value,3)
                setTimeout('document.search.submit()',1);
        }
}

//**************************************************************************************
// Script to audit the document book-page prompt
function rg409j(){
        var errorstring = '';
        var book = document.search.W9BK.value;
        var page = document.search.W9PG.value;

        if (!checkInt(book)){
                errorstring += 'Book may only contain digits\n';
        }

        if (!checkInt(page)){
                errorstring += 'Page may only contain digits\n';
        }

        if (errorstring.length > 0){
                alert(errorstring);
        } else {
                document.search.W9BK.value = stripWhitespace(document.search.W9BK.value,3)
                document.search.W9PG.value = stripWhitespace(document.search.W9PG.value,3)
                setTimeout('document.search.submit()',1);
        }
}

//**************************************************************************************
// Script to audit the entry date prompt
function rg413j(){
        var errorstring = '';
        var fc$ = document.search.W9FC$.value;
        var tc$ = document.search.W9TC$.value;

        if(fc$.length > 0) {
                if (!checkInt(fc$)){
                errorstring += 'FROM consideration may only contain digits\n';
        }}

        if(tc$.length > 0) {
                if (!checkInt(tc$)){
                errorstring += 'TO consideration may only contain digits\n';
        }}

        if (errorstring.length > 0){
                alert(errorstring);
        } else {
                document.search.W9FC$.value = stripWhitespace(document.search.W9FC$.value,3)
                document.search.W9TC$.value = stripWhitespace(document.search.W9TC$.value,3)
                setTimeout('document.search.submit()',1);
        }
}

//**************************************************************************************
// Script to audit the plan book-page prompt
function rp409j(){
        var errorstring = '';
        var book = document.search.W9PBK.value;
        var page = document.search.W9PPG.value;

        if (book.length == 0){
                errorstring += 'Book must be entered\n';
        }
        if (page.length > 0) 
	   { if(!checkInt(page)){
                errorstring += 'Page may only contain digits\n';
        }}

        if (errorstring.length > 0){
                alert(errorstring);
        } else {
                document.search.W9PBK.value = stripWhitespace(document.search.W9PBK.value,3)
                document.search.W9PPG.value = stripWhitespace(document.search.W9PPG.value,3)
                setTimeout('document.search.submit()',1);
        }
}

//**************************************************************************************
// Script to audit the plan year-plan # prompt
function rp409u(){
        var errorstring = '';
        var year = document.search.W9RCCY.value;
        var plan = document.search.W9PLNN.value;

        if (year.length == 0){
                errorstring += 'Plan year must be entered. \n';
        } else {
        if(!checkInt(year)){
                errorstring += 'Plan year may only contain digits. \n';
        }}
        if (plan.length == 0){
                errorstring += 'Plan number must be entered. \n';
        } else {
        if(!checkInt(plan)){
                errorstring += 'Plan number may only contain digits.\n';
        }}

        if (errorstring.length > 0){
                alert(errorstring);
        } else {
                document.search.W9RCCY.value = stripWhitespace(document.search.W9RCCY.value,3)
                document.search.W9PLNN.value = stripWhitespace(document.search.W9PLNN.value,3)
                setTimeout('document.search.submit()',1);
        }
}

//**************************************************************************************
// Script to just submit the form "search" witout any pre-edits
function synulj()
{
setTimeout('document.search.submit()',1);
}

//**************************************************************************************
// Script to audit section block lot
function sy407j(){
        var errorstring = '';
        var section = stripWhitespace(document.search.W9SBL1.value,3);
        
        if (section.length == 0 ){errorstring += 'You must enter a section code\n';}

        if (errorstring.length > 0){alert(errorstring);
        } else {setTimeout('document.search.submit()',1);
        }
}

//**************************************************************************************
//** Script to audit the reference code and number
//** 01-03-2008 Stop removing blanks from REFN
function sy411j(){
        var errorstring = '';
        var refcd = stripWhitespace(document.search.W9REFCD.value,3);
        var refn  = stripWhitespace(document.search.W9REFN.value,3);
	var refn  = document.search.W9REFN.value;
        if (refcd.length == 100 ){
                errorstring += 'You must enter a reference code\n';
        }

        if (refn.length == 0 ){
                errorstring += 'You must enter a reference number\n';
        }
        

        if (errorstring.length > 0){
                alert(errorstring);
        } else {
                document.search.W9REFCD.value = refcd
                document.search.W9REFN.value = refn
                setTimeout('document.search.submit()',1);
        }
}


//**************************************************************************************
function sy414j(){
        var errorstring = '';
        var startDate = document.search.W9FDTA.value;
        var endDate = document.search.W9TDTA.value;

        //check to make sure dates are valid
        if (startDate.length > 0){
                if (!checkDate(startDate)){
                        errorstring += "Start date must be a valid date in the format, MMDDYYYY\n"
                }
        }
                        
        if (endDate.length > 0){
                if (!checkDate(endDate)){
                        errorstring += "Stop date must be a valid date in the format, MMDDYYYY\n"
                } else if (dateConvert(startDate).valueOf() > dateConvert(endDate).valueOf()){
                        errorstring += "Stop date must be greater than Start date\n"                }
        }
        
        if (errorstring.length > 0){alert(errorstring);}
        else {setTimeout('document.search.submit()',1);}
                
}

//**************************************************************************************
function resetDropdowns(){
        if((document.frm_drpdn.IQTP)?true:false){
                if((document.frm_drpdn.IQTP[1].length)?true:false){
                        for (i = 0; i < document.frm_drpdn.IQTP.length; i++){
                                document.frm_drpdn.IQTP[i].selectedIndex = 0;
                
                        }
                }else{
                        document.frm_drpdn.IQTP.selectedIndex = 0;
                }
        }
}

//**************************************************************************************
function rtclickcheck(keyp){
        if (document.layers && keyp.which != 1) {
                alert(message);
                return false;
        }

        if (document.all && event.button != 1) {
                alert(message);
                return false;
        }
}

//**************************************************************************************
function stripLeadingZeros(s){

 var i;
 var returnstring = '';
 var tdone = false;
 var lastd;
 
   
     for (i = 0; i < s.length; i++)
     {   
                if (s.charAt(i) != '0'){
                        returnstring+= s.charAt(i);
                        tdone = true;
                } else if (tdone){
                        returnstring+= s.charAt(i);
                }        
     }
  
  return returnstring;
 }

//**************************************************************************************
function stripWhitespace (s, v)
///*
// This is a multipurpose function
// pass in string (s)
// pass in Direction (v)
// if v = 1 Remove Leading White Spaces
// if v = 2 Remove Trailing White Spaces
// if v = 3 Remove all White Spaces
//*/
{
 var whitespace = " \t\n\r";

 var i;
 var returnstring = '';
 var tdone = 0;
 var lastd;
 if (v == null) v = 3;
 
   if (v == 1) {
   
     for (i = 0; i < s.length; i++)
     {   
        var c = s.charAt(i);
        if (whitespace.indexOf(c) == -1) tdone = 1;
        if (tdone == 1 || i == s.length) returnstring +=c;  
                
     }
   }  
   if (v == 2) {
     for (i = s.length; i > -1; i--)
     {
        var c = s.charAt(i);
        if (whitespace.indexOf(c) == -1) tdone = 1;
        if (tdone == 1) 
        {
        lastd = i;
        i = -1;
                }
         }
         for (x = 0; x <= lastd; x++)
        {
           var ch = s.charAt(x);
           returnstring +=ch        
        }   
     } 
   if (v == 3) {
     for (i = 0; i < s.length; i++)
     {
        var c = s.charAt(i);
        if (whitespace.indexOf(c) == -1) returnstring +=c;
 
     }
   } 
  
  return returnstring;
 }

