

function Void() {
}

function openNewWindow(theURL,winName,features) {
    winName = window.open(theURL,winName,features);
}


function UpdateAccessories( Model ) {
    var DivList = document.getElementsByTagName('div') ;
    var AncList = document.getElementsByTagName('a') ;

    if ( Model == '' ) {
        for ( i = 0 ; i < AncList.length ; i++ ) {
            if ( AncList[i].id.substr(0,6) == 'ACC_I_' && Model.length == 0 ) {
                Model =  AncList[i].id ;
            }
        }
    }

    if ( Model.substr(0,6) == 'ACC_I_' ) {
        var InList = Model.substr(6);
        for ( i = 0 ; i < AncList.length ; i++ ) {
            if ( AncList[i].id.substr(0,6) == 'ACC_I_' ) {
                var ModelList = AncList[i].id.substr(6);
                var model = ModelList.replace( /-/ , '' ).toLowerCase() ;
                AncList[i].className = model ;
                if ( AncList[i].id.indexOf( InList ) >= 0 ) {
                    AncList[i].className = model+'-on' ;
                }
            }
        }

        ModelList = Model.substr(6);
        for ( i = 0 ; i < DivList.length ; i++ ) {
            if ( DivList[i].id.substr(0,6) == 'ACC_M_' ) {
                DivList[i].style.display = 'none' ;
                var ItemList = DivList[i].firstChild.innerHTML ;
                if ( ItemList.indexOf( ModelList ) >= 0 ) {
                    DivList[i].style.display = 'block' ;
                }
            }
        }
    }

    if ( Model.substr(0,6) == 'ACC_M_' ) {
        for ( i = 0 ; i < DivList.length ; i++ ) {
            if ( DivList[i].id.substr(0,6) == 'ACC_M_' ) {
                DivList[i].style.display = 'none' ;
            }
        }
        document.getElementById( Model ).style.display = 'block' ;
        ItemList = document.getElementById( Model ).firstChild.innerHTML ;
        for ( i = 0 ; i < AncList.length ; i++ ) {
            if ( AncList[i].id.substr(0,6) == 'ACC_I_' ) {
                var ModelList = AncList[i].id.substr(6);
                var model = ModelList.replace( /-/ , '' ).toLowerCase() ;
                AncList[i].className = model ;
                if ( ItemList.indexOf( ModelList ) >= 0 ) {
                    AncList[i].className = model+'-on' ;
                }
            }
        }
    }
    if ( Model.substr(0,6) == 'All' ) {
        for ( i = 0 ; i < AncList.length ; i++ ) {
            if ( AncList[i].id.substr(0,6) == 'ACC_I_' ) {
                var ModelList = AncList[i].id.substr(6);
                var model = ModelList.replace( /-/ , '' ).toLowerCase() ;
                AncList[i].className = model+'-on' ;
            }
        }
        for ( i = 0 ; i < DivList.length ; i++ ) {
            if ( DivList[i].id.substr(0,6) == 'ACC_M_' ) {
                DivList[i].style.display = 'block' ;
            }
        }
    }
}


function TabContent ( num ) {

    for ( i = 1 ; i <= 3 ; i++ ) {
        eval ( "document.getElementById('Button_0"+i+"').className = 'off';" ) ;
    }

    eval ( "document.getElementById('Button_"+num+"').className = 'on';" ) ;

    document.getElementById('Tab_01').style.display = 'none' ; 
    document.getElementById('Tab_02').style.display = 'none' ; 
    document.getElementById('Tab_03').style.display = 'none' ; 
//    document.getElementById('Tab_04').style.display = 'none' ; 

    eval( "document.getElementById('Tab_"+num+"').style.display = 'block' " ); 

}


function ModelAccessory( Acc ) {

    var DivList = document.getElementsByTagName('li') ;

    if ( Acc == '' ) {
        for ( i = 0 ; i < DivList.length ; i++ ) {
            if ( DivList[i].id.substr(0,6) == 'ACC_L_' && Acc.length == 0 ) {
                Acc =  DivList[i].id.substr(6) ;
            }
        }
    }

    var DataID = 'ACC_D_'+Acc ;
    var LinkID = 'ACC_L_'+Acc ;

    document.getElementById( 'ACC_Details' ).innerHTML = document.getElementById( DataID ).innerHTML ;

    for ( i = 0 ; i < DivList.length ; i++ ) {
        if ( DivList[i].id.substr(0,6) == 'ACC_L_' ) {
            document.getElementById( DivList[i].id ).className = 'off' ;
        }
    }
    var LinkID = 'ACC_L_'+Acc ;
    document.getElementById( LinkID ).className = 'on' ;

}

function PartNumbers() {

    if ( document.getElementById('PartNoChoices') ) {
        var DivList = document.getElementsByTagName('div') ;
        var ThisCategory = document.getElementById('PartNoChoices').options[ document.getElementById('PartNoChoices').selectedIndex ].value ;

        for ( i = 0 ; i < DivList.length ; i++ ) {
            if ( DivList[i].id.substr(0,10) == 'CAT_LABEL_' ) {
                if ( DivList[i].id.substr(0,11) == ThisCategory ) {
                    DivList[i].style.display = 'block' ;
                } else {
                    DivList[i].style.display = 'none' ;
                }
            }
        }
    }
}


function Online_Order_Form ( CR , PT ) {

            var attrs = 'Action=Step_2&Product_Type='+PT+'&Contact_Reason='+CR  ;
            myurl = '/customer-service/ContactUs.cgi?'+attrs;

            myRand = parseInt(Math.random()*999999999999999);

            var modurl = myurl+"&r="+myRand;

            http.open("GET", modurl, true);
            http.onreadystatechange = useHttpResponse;
            http.send(null);

}


function openProVendorList(){
    var cn = document.getElementById('vendor-list')  ;
    if ( cn.className == 'off' ) {
        cn.className = 'on' ;
    } else {
        cn.className = 'off' ;
    }
}

function RotateTestimonials() {
    if ( document.getElementById('testimonial') ) {

        if ( document.getElementById('testimonial').style.display == 'none' ) {
            document.getElementById('testimonial').style.display = '' ;
        }

        var NumCnt = parseInt( document.getElementById('testimonial_count').innerHTML ) ;
        var TotCnt = parseInt( document.getElementById('testimonial_total').innerHTML ) ;
        if ( parseInt(NumCnt) < 10 ) {
            CommentID = "TT_COMMENT_0" + parseInt(NumCnt) ;
            AuthorID  = "TT_AUTHOR_0" + parseInt(NumCnt) ;
        } else {
            CommentID = "TT_COMMENT_" + parseInt(NumCnt) ;
            AuthorID  = "TT_AUTHOR_" + parseInt(NumCnt) ;
        }

        if ( document.getElementById( CommentID ) ) {
            var Comment =  document.getElementById( CommentID ).innerHTML ;
            var Author  =  document.getElementById( AuthorID  ).innerHTML ;

            document.getElementById('T_COMMENT').innerHTML = Comment ;
            document.getElementById('T_AUTHOR').innerHTML  = Author ;
        } else {
            // alert ( CommentID );
        }

        if ( parseInt( NumCnt ) + 1 >= TotCnt ) {
            document.getElementById('testimonial_count').innerHTML = 0 ;
        } else {
            document.getElementById('testimonial_count').innerHTML = parseInt( NumCnt ) + 1 ;
        }
      //  setTimeout("RotateTestimonials();",5000); // 5 second delay
      //  setTimeout("RotateTestimonials();",30000); // 30 second delay

    }
}


function OnLoadScript(){
    var Loc = document.location.toString() ;
    var showTestimonial = 0 ;
//    if ( Loc.search( /practice-management/i ) > 0 ) {
//        showTestimonial ++ ;
//    }
    if ( showTestimonial == 0 ) {
        RotateTestimonials();
    }
}


// *************************************************************************************


function PopImageJS( obj , content , Wide , High ) {
    var coors = findPos(obj);
    var objLeft = coors[0] + 20 ; 
    var x = document.getElementById('PopImage');
    var aScrollOffsets = getScrollXY();
    var fullHeight = getViewportHeight();

    if ( window.createPopup ) {
        // ie browsers functions
        var objTop = coors[1] + 120 ;

    } else {

        var objTop = coors[1]-High-25;
        
    }

        var innerHtml   = '<div style="text-align: center; padding: 10px; border: 1px solid #000000;  width:'+Wide+'px; height:'+High+'px; '+
                          'background-color: #ffffff ; position: absolute; '+
                          'left:'+objLeft+'px; top:'+objTop+'px; ">'+content+'</div>';
    x.innerHTML = innerHtml ;

}

function UnpopImageJS() { 
    if ( document.getElementById('PopImage') ) {
        document.getElementById('PopImage').innerHTML = '';
    }
}

function findPos(obj) {
    var curleft = curtop = 0;
    if ( obj.offsetParent ) {
        do {    curleft += obj.offsetLeft;
                curtop += obj.offsetTop;
           } while (obj = obj.offsetParent);
    }
    return [curleft,curtop];
}


function getScrollXY() {
  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
  return [ scrOfX, scrOfY ];
}

function getViewportHeight() {
    if (window.innerHeight!=window.undefined) return window.innerHeight;
    if (document.compatMode=='CSS1Compat') return document.documentElement.clientHeight;
    if (document.body) return document.body.clientHeight; 

    return window.undefined; 
}

