function navigate(navactionv, navvaluev)
{
// this.document.mainform.navaction.value=navactionv;
// this.document.mainform.navvalue.value=navvaluev;
this.document.mainform.action = "lernerpublishing.p?navaction=" + navactionv + "&navvalue=" + navvaluev;
this.document.mainform.submit();
}


function AllowReturnJS(iptype, iprtn){  
    this.document.mainform.searchtype.value = iptype;  
    this.document.mainform.AllowJavaScriptReturn.value = iprtn;
}


function rtnSubmit(keypressed) {
    var isNS6 = navigator.userAgent.toLowerCase().indexOf("gecko") == -1 ? false : true;
    var key;

    if (isNS6) {
        key=keypressed.keyCode;
    }
    else if (document.all) {
         key=window.event.keyCode;
    }
    else {
          key=keypressed.which;
    }

    if (key==13) {
        var ipNavAct = document.mainform.rtnNavAction.value;
        var ipNavVal = document.mainform.rtnNavValue.value;
        var vAllowRtn = document.mainform.AllowJavaScriptReturn.value;
        
        var amazonsubmit = document.mainform.amazonsearch.value;
        var qsword = document.mainform.lbsearch.value;
      
               
      if(vAllowRtn == "YES") {
            navigate(ipNavAct,ipNavVal);
            document.mainform.submit();
      }  
      
    }
    
}

function noimgerror(ipid,csid){
   var noimg;
   vnoimg = "http://www.lernerbooks.com/images/lerner_books/images_web/f05/noimg.gif";
   SetProcessDisplay(ipid,"hidediv");
   SetProcessDisplay(csid,"showimagediv");   
}

function AmazonLookup(){

    var isbnstring = document.mainform.currentisbn.value;
    var AmazonKeyWord = document.mainform.keywords.value;
    var qsword = document.mainform.lbsearch.value;
    
    // reference url below taken from S. Boyer html page
    // http://www.amazon.com/gp/reader/1575058308/ref=lernerpublish-20/?v=search-inside&keywords=test&go.x=45&go.y=5
    var amazonurl = "http://www.amazon.com/gp/reader/" + isbnstring + "/ref=lernerpublish-20/?v=search-inside&keywords=" + AmazonKeyWord +"&go.x=45&go.y=5"; 
    
    if(qsword == null || qsword == ""){

        amazon = window.open(amazonurl,null,"");
       
       

    }  

}


function NewAmazonLookup(){

    var isbnstring = document.mainform.currentisbn.value;
    var qsword = document.mainform.lbsearch.value;
    
    var amazonurl = "http://www.amazon.com/gp/reader/" + isbnstring + "/ref=lernerpublish-20/?v=search-inside&go.x=45&go.y=5";   
    if(qsword == null || qsword == ""){

        amazon = window.open(amazonurl,null,"");

    }  

}

function TitleQuickSearch(navactionin,navvaluein,ipsearch){

   document.mainform.rtnNavAction.value = navactionin; 
   document.mainform.rtnNavValue.value = navvaluein; 
   document.mainform.amazonsearch.value = ipsearch;
   document.mainform.onkeypress=rtnSubmit;   
   
   // "asr_f5.w"; "Simple Search";
}   



// Extended Tooltip Javascript
// copyright 9th August 2002, 3rd July 2005
// by Stephen Chapman, Felgall Pty Ltd
// permission is granted to use this javascript provided that the below code is not altered

var DH = 0;
var an = 0;
var al = 0;
var ai = 0;
    if (document.getElementById) {ai = 1; DH = 1;}
    else {
        if (document.all) {al = 1; DH = 1;} 
        else { browserVersion = parseInt(navigator.appVersion); 

        if ((navigator.appName.indexOf('Netscape') != -1) && (browserVersion == 4)) {an = 1; DH = 1;}
        }
    }  
    
    
function fd(oi, wS) {
        if (ai) return wS ? document.getElementById(oi).style:document.getElementById(oi); 
        if (al) return wS ? document.all[oi].style: document.all[oi]; 
        if (an) return document.layers[oi];
}
    
function pw() {
    return window.innerWidth != null? window.innerWidth: document.body.clientWidth != null? document.body.clientWidth:null;
}

function mouseX(evt) {
    if (evt.pageX) return evt.pageX; 
    else if (evt.clientX)return evt.clientX + (document.documentElement.scrollLeft ?  document.documentElement.scrollLeft : document.body.scrollLeft); 
    else return null;
}

function mouseY(evt) {
    if (evt.pageY) return evt.pageY; 
    else if (evt.clientY)return evt.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop); 
    else return null;
}

var ds;
var dm;
var st;
var ew;
var tv;
var lv;

function popUp(evt,oi) {
    if (DH) {var wp = pw(); ds = fd(oi,1); dm = fd(oi,0); st = ds.visibility; 
    if (dm.offsetWidth) ew = dm.offsetWidth; 
    else if (dm.clip.width) ew = dm.clip.width; 
    if (st == "visible" || st == "show") { 
        ds.visibility = "hidden"; } 
    else {tv = mouseY(evt) + 20; lv = mouseX(evt) - (ew/4); 
    if (lv < 2) lv = 2; 
    else if (lv + ew > wp) lv -= ew/2; 
    if (!an) {lv += 'px';tv += 'px';} ds.left = lv; ds.top = tv; ds.visibility = "visible";}}
}

function AdvSearchType(iptype){
    this.document.mainform.searchtype.value = iptype;
}


function SetProcessDisplay(elementnamein,classnamein) {
  document.getElementById(elementnamein).className = classnamein;
}

function DeleteHeader(navactionv, navvaluev) {
this.document.mainform.action = "lernerpublishing.p?navaction=" + navactionv + "&navvalue=" + navvaluev;
      if (confirm('You are about to delete a wish list header, Are you sure?'))
         { this.document.mainform.DeleteConfirm.value="Yes";
           this.document.mainform.submit();
         }
      else {
           this.document.mainform.submit();
           }
 }
 
function WishPrint(pvPrint) {
    window.open(pvPrint,"printWindow","toolbars=no,location=yes,directories=no,status=yes,menubar=no,scrollbars=yes,resizeable=yes");
}


function NewSite(siteurl) {
    window.open(siteurl,"sitewind","");
}

function ConfirmOrder(navactionv, navvaluev) {
  this.document.mainform.action = "lernerpublishing.p?navaction=" + navactionv + "&navvalue=" + navvaluev;
  this.document.mainform.submit();

  orderprocessing('/cgi-bin/t_iap.sh');

}


function orderprocessing(appurl) {
   opwindow = window.open(appurl + '/orderprocessing.w','orderprocessing','toolbars=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=450,height=200,left=100,top=100');
}

function closeop() {
   opwindow = window.open('','orderprocessing','toolbars=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=450,height=200,left=100,top=100');
   opwindow.close();
 }


function OrderConfirm(pvPrint) {
   window.open(pvPrint,"printWindow","toolbars=no,location=no,directories=no,status=yes,menubar=yes,scrollbars=yes,resizeable=yes");
}

function SetDisp(pvCurDiv) {
   // function used to show the specific div based on user input
   SetProcessDisplay(pvCurDiv,"showdiv");
}

function LibProcess(pvPage, pvCurDiv) {

        SetProcessDisplay("a","hidediv");
        SetProcessDisplay("b","hidediv");
        SetProcessDisplay("c","hidediv");
        SetProcessDisplay("d","hidediv");
        SetProcessDisplay("e","hidediv");
        SetProcessDisplay("f","hidediv");
        SetProcessDisplay("g",'hidediv');

        SetDisp(pvCurDiv);
}


function cmbCustShip_onchange(pvCustShip)  {

     if(pvCustShip.selectedIndex>0){
         this.document.mainform.action = "lernerpublishing.p?navaction=OrderSelectCustShip.w" + "&navvalue=" + pvCustShip.value;
         this.document.mainform.submit();
        }
}

function cmbSearchBy_onchange() {
    window.document.mainform.navigate.value="SEARCH";
        window.document.mainform.submit();
}

function OrderHistCustChg(pvCustShip)  {

     if(pvCustShip.selectedIndex>0){
         this.document.mainform.action = "lernerpublishing.p?navaction=CustOrderHist.w" + "&navvalue=" + pvCustShip.value;
         this.document.mainform.submit();
        }
}


function DeleteBook(passed) {
      if (confirm('You are about to delete a book from your list, Are you sure?'))
         { this.document.mainform.DeleteConfirm.value="Yes";
           this.document.mainform.submit();
         }
      else {
           this.document.mainform.submit();
           }
}



function SetDefaultList(navactionv, navvaluev) {
   this.document.mainform.action = "lernerpublishing.p?navaction=" + navactionv + "&navvalue=" + navvaluev;

      if (confirm('You are about to change your default list, Are you sure?'))
         { this.document.mainform.ConfirmField.value="Yes";
           this.document.mainform.submit();
         }
      else {
           this.document.mainform.submit();
           }
 }

function NoImageError() {
var noimgref;

noimgref = "http://www.lernerbooks.com/images/lerner_books/images_web/f05/noimg.gif";


   document.images["isbnimg"].src = noimgref;

}

function prevPrint(pvContent) {
    window.open(pvContent,"PrintWindow","toolbars=no,location=no,directories=no,status=yes,menubar=yes,scrollbars=yes,resizeable=yes,width=600,height=600,left=25,top=15");
}


function changeclass(elementnamein,classnamein)
{
  document.getElementById(elementnamein).className = classnamein;
}

