﻿// JS for the specialists pages

jQuery.noConflict();
jQuery(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() {
    jQuery('.DrBtn')
     .hover(function(e) {
         DrInfoDiv('show', jQuery(this).attr("DrKey"), e.pageX, e.pageY);
     }, function() {
         DrInfoDiv('hide');
     })
    ;
}
function DrInfoDiv(toggle, DrID, posX, posY) {


    jQuery('#DrInfoDisp').hover(function() { infoHover = true }, function() {
        infoHover = false;
        jQuery("#DrInfoDisp")
       .css("display", "none");
    });
    if (toggle == 'show') {

        jQuery("#DrInfoDisp").html(getDrInfo(DrID)).css({ "top": (posY - 200) + "px" }, { "left": posX + "px" }).fadeIn(400);
    } else {
        hovOutT = setTimeout("hideDrInfo()", 1);
    }
}
function hideDrInfo() {
    if (!infoHover) {
        jQuery("#DrInfoDisp")
            .css("display", "none")
            ;
    }
}

function getDrInfo(docID) {


    var retStr = "";

    retStr = jQuery('#Profile_' + docID).html();
    return 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 = jQuery(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;*/
}



/*jQuery(document).ready(addMouseOvers());

function addMouseOvers(){

jQuery("input.DrClass")
var docID = jQuery(this).attr("title");
.hover(function(){
DrInfoDiv('show',docID);
},function(){
DrInfoDiv('hide',docID);
}) 
;
}
function DrInfoDiv(toggle,DrID){
//jQuery("body").append('<div class='DrInfoDiv'>'+ getDrInfo(DrID) +'</div>')
if(toggle=='show'){
jQuery("#DrInfoDisp").text(getDrInfo(DrID))
.css("display","block")
;
}else{
jQuery("#DrInfoDisp").text(getDrInfo(DrID))
.css("display","none")
;
}
}
function getDrInfo(docID){
var drInfoStr = "This is a test string for DrID" + docID;
return drInfoStr;
}*/

