﻿// JS for the specialists pages


$(document).ready(function (){var MOt=setTimeout("addMouseOvers()", 100);});
var infoHover = false; //bool to stop info box from hiding when you hover on it 

function addMouseOvers(){
    $('.DrBtn')
     .hover(function(e){
       DrInfoDiv('show',$(this).attr("DrKey"),e.pageX,e.pageY);
     },function(){
       DrInfoDiv('hide');
     }) 
    ;
}
function DrInfoDiv(toggle,DrID,posX,posY){


    $('#DrInfoDisp').hover(function(){infoHover=true},function(){
       infoHover=false;
       $("#DrInfoDisp")
       .css("display","none");
       });
    if(toggle=='show'){
      
      $("#DrInfoDisp")
      .html(getDrInfo(DrID))
      //.css("display","block")
      .css("top",(posY-200)+"px")
      .css("left",posX+"px")
      .fadeIn(400)
      ;
    }else{
       hovOutT = setTimeout("hideDrInfo()",1);
    }
}
function hideDrInfo(){
        if(!infoHover){
            $("#DrInfoDisp")
            .css("display","none")
            ;
          }
}

function getDrInfo(docID){
// I have made a bit of a mess in the function as I was just exploring JQuery methods. Ignore the commented code I only left it as I might come back to  play around with it. 

    var retStr = "";
    //var reXstr = "/^(\x3C\x3Fxml[\x20-\x7E]{1,}\x3F\x3E[\x20-\x7E]{0,}\x3Cstring[\x20-\x7E]{1,}\x3E)([\x20-\x7E]{1,})/m";
    //var cheatReX = new RegExp(reXstr);
    var drXML;
    drXML = $.ajax({
    type: "POST",
    url: "../XML/IVFservice.asmx/Get_SpecialistTxt",
    data: "SpecialistId="+docID,
    dataType: "xml",
    async: false
   });
   var XMLdoc = drXML.responseXML.documentElement;
   //var xResStr = drXML.responseText;
   try{retStr = $(XMLdoc).find("DrInfoTxt").text();}
     catch(ex){}
    //alert(retStr);
    
    //alert(drXML.responseXML.getElementsByTagName("string")[0].nodeValue);
   
    return retStr;//getElementsByTagName("DrInfoTxt")[0].childNodes[0].nodeValue;//.getElementsByTagName("string")[0].childNodes[0].nodeValue;
    //return drInfoStr;
}



/*$(document).ready(addMouseOvers());

function addMouseOvers(){

    $("input.DrClass")
    var docID = $(this).attr("title");
     .hover(function(){
       DrInfoDiv('show',docID);
     },function(){
       DrInfoDiv('hide',docID);
     }) 
    ;
}
function DrInfoDiv(toggle,DrID){
    //$("body").append('<div class='DrInfoDiv'>'+ getDrInfo(DrID) +'</div>')
    if(toggle=='show'){
      $("#DrInfoDisp").text(getDrInfo(DrID))
      .css("display","block")
      ;
    }else{
      $("#DrInfoDisp").text(getDrInfo(DrID))
      .css("display","none")
      ;
    }
}
function getDrInfo(docID){
    var drInfoStr = "This is a test string for DrID" + docID;
    return drInfoStr;
}*/

