if( typeof( window.XMLHttpRequest ) != "undefined" ) {
  ajax_obj = new XMLHttpRequest;
} else {
  ajax_obj = new ActiveXObject( "Microsoft.XMLHTTP" );
}

ajax_lock = false;
function ajax_get( call_function, call_information ) {
  if( !ajax_lock ) {
    ajax_lock = true;
    if( ajax_obj ) {
      if( typeof( ajax_force_get ) != "undefined" ) {
        ajax_obj.open( "GET", "/ajax" );
        delete( ajax_force_get );
      } else {
        ajax_obj.open( "POST", "/ajax" );
      }
      ajax_obj.setRequestHeader( "Content-Type", "application/x-www-form-urlencoded");
      ajax_obj.onreadystatechange = function() {
        if( ajax_obj.readyState == 4 && ajax_obj.status == 200 ) {
          ajax_response = ajax_obj.responseText;
          eval( "if( typeof( ajax_"+call_function+"_done ) != 'undefined' ) ajax_"+call_function+"_done();" );
          delete( ajax_response );
          ajax_lock = false;
        }
      }
      var call_information_schema = "";
      var first = true;
      for( i in call_information ) {
        if( !first )
          call_information_schema += "&";
        first = false;
        call_information_schema += i+"="+call_information[i];
      }
/*alert( call_information_schema+"&function="+call_function );*/
      ajax_obj.send( call_information_schema+"&function="+call_function );
    }
  }
}
/**
 *  Doctors Portal - Israel's Permier Medical Portal
 *  Copyright © COMRAX® Ltd. All rights reserved.
 *  Unauthorized duplication and modification prohibited.
 *
 *  END-USER LICENSE AND AGREEMENT
 *
 *  THIS SOFTWARE  IS PROVIDED  BY "COMRAX LTD" ``AS IS'' AND  ANY EXPRESS  OR
 *  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED  TO, THE IMPLIED WARRANTIES
 *  OF MERCHANTABILITY  AND FITNESS FOR  A PARTICULAR PURPOSE  ARE DISCLAIMED.
 *  IN  NO  EVENT  SHALL  "COMRAX LTD"  BE  LIABLE FOR  ANY  DIRECT, INDIRECT,
 *  INCIDENTAL, SPECIAL, EXEMPLARY,  OR CONSEQUENTIAL DAMAGES (INCLUDING,  BUT
 *  NOT LIMITED  TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 *  DATA,  OR PROFITS;  OR BUSINESS INTERRUPTION)  HOWEVER CAUSED  AND true  ANY
 *  THEORY  OF  LIABILITY,  WHETHER  IN  CONTRACT, STRICT  LIABILITY, OR  TORT
 *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING  IN ANY WAY OUT  OF THE USE OF
 *  THIS  SOFTWARE,  EVEN  IF ADVISED  OF  THE  POSSIBILITY  OF  SUCH  DAMAGE.
*/

  function chinner( obj_id, content ) {
    document.getElementById( obj_id ).innerHTML = content;
  }

  function show_am_start() {
    ebi( "asm1" ).innerHTML = "<a href='"+ebi( "am1" ).href+"' target='_blank'>"+ebi( "asm1" ).innerHTML+"</a>";
    remember_am = ebi( "asm1" ).innerHTML;
    last_am = 1;
  }

  function show_am( obj1,num ) {
    onclk = obj1.onclick+"";
    onclk = onclk.split( '{' );
    onclk = onclk[1].replace( '}', '' );

    if( num == 1 ) {
      chinner( "asm1", remember_am );
    } else {
      if( num <= 5 ) {
        chinner( "asm1","<a rel='nofollow' style='padding-right:"+( num * 96 - 95 )+"' href='#' onclick='"+onclk+"'>"+ebi( "asm"+num ).innerHTML+"</a>" );
      } else {
        chinner( "asm1","<a rel='nofollow' style='text-align: left;padding-left:"+( ( 6 - ( num - 5 ) ) * 96 - 95 )+"' href='#' onclick='"+onclk+"'>"+ebi( "asm"+num ).innerHTML+"</a>" );
      }
    }
    ebi( "am"+last_am ).className = "";
    obj1.className  = "advbg";

    last_am = num;
  }

  function reovechar( ) {
    if( obj1.innerHTML != "" ) {
      obj1.innerHTML = obj1.innerHTML.substr( 0,obj1.innerHTML.length - 3);
      if( obj1.innerHTML != "" ) {
        setTimeout("reovechar( )",10);
      }
    }
  }

  function effect( obj2 ) {
    obj1 = obj2;
    reovechar( obj1 );
  }

function medicine_selected(a,b) {
  ebi('search_selection').disabled=a;
  ebi('search_keywords').disabled=b;
}

function medicine_check(c,d) {
  ebi('search_selection').checked=c;
  ebi('bydrug').checked=d;
}

var g_iCount = 13;

function ad_startCountdown(){
       if((g_iCount - 1) >= 0){
               g_iCount = g_iCount - 1;
               ebi( 'ad_counter' ).innerHTML =  g_iCount;
               setTimeout('ad_startCountdown()',1000);
       }
}


allow_bigad = true;
function show_bigad( content ) {
  ebi( 'bigad_iframe_div' ).style.width="100%";
  ebi( 'bigad_iframe_div' ).style.height="100%";
  ebi( 'bigad_iframe' ).style.width="973";
  ebi( 'bigad_iframe' ).style.height="100%";
  ebi( 'content' ).className ="hidden_content";
  
}

function hide_bigad( content ) {
  ebi( 'bigad_iframe' ).style.width="0";
  ebi( 'bigad_iframe' ).style.height="0";
  ebi( 'bigad_iframe' ).style.display="none";
  ebi( 'bigad_iframe_div' ).style.width="0";
  ebi( 'bigad_iframe_div' ).style.height="0";
  ebi( 'bigad_iframe_div' ).style.display="none";
  ebi( 'content' ).className ="content";
}

function show_big_ad() {
  if( ebi( 'adframe' ) ) {
    var diframe = ebi( 'adframe' );
    diframe.width = 770;
    diframe.height = 400;
    var ddiv = ebi( 'addiv' );
    var ad = ebi( 'ad' );
    var badiv = ebi( 'big_ad_div' );
    ad.className = 'adpage-banner-container';
    ddiv.className = 'adpage-banner-skip-text';
    badiv.className = '';
    var cdiv = ebi( 'contentdiv' );
    cdiv.className = 'real_hidden';
    setTimeout( 'hide_big_ad()' ,( (g_iCount - 1)*1000 ) );
    ad_startCountdown( );
  }
}

function hide_big_ad() {
  var diframe = ebi( 'adframe' );
  diframe.width = 0;
  diframe.height = 0;
  var ddiv = ebi( 'addiv' );
  var badiv = ebi( 'big_ad_div' );
  var ad = ebi( 'ad' );
  badiv.innerHTML = '';
  badiv.className ='hidden real_hidden';
  ddiv.className = 'hidden';
  ad.className = 'hidden';
  ad.innerHTML = '';
  diframe.className = 'hidden';
  var cdiv = ebi( 'contentdiv' );
  cdiv.className = '';
}
function DOCTORS_CheckEmail( address ) {
  filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
  return( address && filter.test( address ) );
}

function DOCTORS_GetSelectedRadio( radio )
{
  if( !radio ) {
    return 0;
  }
    var radioLength = radio.length;
    if( radioLength == undefined ) {
        if( radio.checked ) {
            return radio.value;
    } else {
            return 0;
    }
  }
    for( var cycle = 0; cycle < radioLength; cycle++ ) {
        if( radio[ cycle ].checked ) {
            return radio[ cycle ].value;
        }
    }
  return 0;
}
function DOCTORS_SetRadioIndex( radio, newValue ) {
    if( !radio ) {
        return;
  }
    var radioLength = radio.length;
    if( radioLength == undefined ) {
        radio.checked = ( radio.value == newValue.toString( ) );
        return;
    }
    for( var cycle = 0; cycle < radioLength; cycle++ ) {
        radio[ cycle ].checked = false;
        if( radio[ cycle ].value == newValue.toString( ) ) {
            radio[ cycle ].checked = true;
        }
    }
}

function DOCTORS_setAsHomepage( url ) {
  if( document.all ) {
    document.links[0].style.behavior = 'url(#default#homepage)';
    document.links[0].setHomePage( url );
  }
  return true;
}

function DOCTORS_openCentralizedModal( url, width, height ) {
  openCenteredWindow( url, '', width, height, /* status */ false, /* scrollbars */ true, 'toolbar=no,location=no,menubar=no,resizable=no' );
}

function TSO_openCentralizedModal( url ) {
  var width = 800;
  var height = 600;
  openCenteredWindow( url, 'ConsultWithMe', width, height, false, false, 'toolbar=no,location=no,menubar=no,resizable=no,scrollbars=yes' );
}

function DOCTORS_OpenWindow( uri, w, h, props ) {
  if( !w || !h ) {
    window.open( uri );
  } else {
    if( props ) props = ',' + props;
    window.open( uri, '', 'width=' + w + ',height=' + h + props );
  }
};

function Open_print_window( aURL ) {
  win_object = Open_window_max( aURL );
}

function Open_print_window_cb() {
  win_object.window.print();
}

owm_id = 0;
function Open_window_max( aURL ) {
   if( aURL[0] == '/' ) {
      aURL = "http://www.doctors.co.il"+aURL;
   }

   var wOpen;
   var sOptions;
   var aWinName;

   owm_id++;
   if( window.name.substr( 0, 11 ) == 'new_window_' )
     owm_id = window.name.replace( 'new_window_', "" )+1;
   aWinName = 'new_window_'+owm_id;

   sOptions = 'status=yes,menubar=yes,scrollbars=yes,resizable=yes,toolbar=yes,location=yes';
   sOptions = sOptions + ',width=' + (screen.availWidth - 10).toString();
   sOptions = sOptions + ',height=' + (screen.availHeight - 122).toString();
   sOptions = sOptions + ',screenX=0,screenY=0,left=0,top=0';

   wOpen = window.open( '', aWinName, sOptions );
   wOpen.location = aURL;
   wOpen.focus();
   wOpen.moveTo( 0, 0 );
   wOpen.resizeTo( screen.availWidth, screen.availHeight );
   return wOpen;
}

function checkCookie(c_name) {
  if (document.cookie.length>0)  {
    c_start=document.cookie.indexOf(c_name + "=");
    if (c_start!=-1) { 
      c_start=c_start + c_name.length+1; 
      c_end=document.cookie.indexOf(";",c_start);
      if (c_end==-1) c_end=document.cookie.length;
      return true;
    }  
  }
  return false;
}

function DOCTORS_SendVote( form, is_voting ) {
  var poll_id = form.xPL.value;
  var vote    = ( is_voting )? DOCTORS_GetSelectedRadio( form.xCS ): 0;
  if( vote ) {
    var targetUrl = '/m/Doctors/a/Vote/xPL/xPOLLx/xCS/xVOTEx';
  } else {
    var targetUrl = '/m/Doctors/a/Poll/xPL/xPOLLx';
  }
  targetUrl = targetUrl.replace( 'xPOLLx', poll_id ).replace( 'xVOTEx', vote );
  openCenteredWindow( targetUrl, '_doctors_poll', 500, 700, /* status */ false, /* scrollbars */ true, 'toolbar=no,location=no,menubar=no,resizable=no' );
}

function DOCTORS_DateDiff( date1, date2 ) {
  diff = new Date( );

  diff.setTime( Math.abs( date1.getTime( ) - date2.getTime( ) ) );
  timediff = diff.getTime( );

  weeks = Math.floor( timediff / ( 1000 * 60 * 60 * 24 * 7 ) );
  timediff -= weeks * ( 1000 * 60 * 60 * 24 * 7 );

  days = Math.floor( timediff / ( 1000 * 60 * 60 * 24 ) ); 
  timediff -= days * ( 1000 * 60 * 60 * 24 );

  hours = Math.floor( timediff / ( 1000 * 60 * 60 ) ); 
  timediff -= hours * ( 1000 * 60 * 60 );

  mins = Math.floor( timediff / ( 1000 * 60 ) ); 
  timediff -= mins * ( 1000 * 60 );

  secs = Math.floor( timediff / 1000 ); 
  timediff -= secs * 1000;

  return new Array( weeks, days, hours, mins, secs );
}

function DOCTORS_ClientSendMail( emailUser, emailDomain ) {
  location = 'mailto:' + emailUser + '@' + emailDomain;
  return false;
}

var renesi_temporary_img_url = "/i/renesibutton.gif";
var renesi_maxwait_timeout = 0; //0 secs.
var renesi_service_maxwait_timeout = 2000; //2 secs.
var renesi_scrp = "";
var renesi_is_on = 0;
var renesi_interval_id = 0;
var renesi_wait_timeout = 0;
var renesi_service_wait_timeout = 0;
var renesi_service_interval_id = 0;

function show_cur_date( ) {
  ebi( 'cur_date' ).className = 'span no-spacing block rtl date-div';
}

function show_current_date () {
  setTimeout( 'show_cur_date()', 3000 );
}

function side_add_by_resolition( ) {
  if( ebi( 'right_side_ad' ) ) {
    var WinWidth = 0;

    if (parseInt(navigator.appVersion)>3) {
      if (navigator.appName=="Netscape") {
        WinWidth = window.innerWidth;
      }

      if (navigator.appName.indexOf("Microsoft")!=-1) {
        WinWidth = document.body.offsetWidth;
      }

      if( WinWidth < 990 ) {
        ebi( 'right_side_ad' ).className = 'real_hidden';
        ebi( 'left_side_ad' ).className = 'real_hidden';
      } else {
        ebi( 'right_side_ad' ).className = 'side_ad_right_div';
        ebi( 'left_side_ad' ).className = 'side_ad_left_div';
      }
    }
  }
}

function show_msn_box( place, content ) {
  id = 'bottom'+place;
  ebi( id  ).innerHTML = content;
};

hide_select = false;

function vsearch_searcher( vtext ) {
  first = true;
  for( var vvalue in values ) {
    if( typeof( values[vvalue] ) == 'string' ) {
      if( values[vvalue].match( '^.*'+vtext+'.*$' ) != null ) {
        if( foundw[ vvalue ] == undefined ) {
          ihtml += "<option onclick="+'"'+"ebi( 'tempSpeciality' ).value = '"+values[vvalue]+"'; ebi( 'vsearch_select' ).className='hidden hidden_iframe'"+'"'+" value='"+vvalue+"'";
          if( vtext == values[vvalue] /*|| first_option == true*/ ) {
            ihtml += ' selected="selected"';
            if( !first_option == true ) {
            }
            first_option = false;
          };
          ihtml += ">"+ values[vvalue]+"</option>";
          foundw[ vvalue ] = true;

        };

        if( first ) {
          first = false;
        };
      };
    };
  };
  return first;
};

function getSelectText( select_obj ) {
  return select_obj.options[ select_obj.selectedIndex ].text;
}

vignore_words = Array( "מומחה", "רופא", "רפואת", "רפואה", "טיפול", "מטפל", "פרופסור", "פר'", "דר'", "דוקטור", "פרופ'", "בעיות", "רופאי" );

function vsearch( vtext ) {
  for( i in vignore_words ) {
    vtext = vtext.replace( vignore_words[i]+" ", "" );
  }
  first_option = true;
  if( ebi( "csearch_select" ) != null ) {
    ebi( "csearch_select" ).className = "hidden";
  }
  hide_select = false;
  foundw = Array();

  if( vtext != '' && vtext != null ) {
    ihtml = "<div><div><select class='clinic-search-select clinic-search-select2'  style='height: 120px' id='vsearch_select' name='SearchSpeciality' multiple='multiple' onclick='ebi( "+'"'+"tempSpeciality"+'"'+" ).value = this.options[ this.selectedIndex ].text; this.className="+'"'+"hidden hidden_iframe"+'"'+"'>";

    not_found = true;

    if( !vsearch_searcher( vtext ) ) not_found = false;
    vtext2 = vtext.replace( /[א,ה,ו,י]/g,'.*' );
    
    if( !hide_select && !vsearch_searcher( vtext2 ) ) not_found = false;

    if( vtext.match( / /g ) ) {
      vtexts = vtext.split( ' ' );
      for( var vti in vtexts )
        if( vtexts[ vti ].length > 1 ) {
          vtext3 = vtexts[ vti ];
          if( typeof( vtext3 ) == "string" ) {
            if( !vsearch_searcher( vtext3 ) ) { not_found = false; };
            vtext2 = vtext3.replace( /[א,ה,ו,י]/g,'.*' );
            if( !vsearch_searcher( vtext2 ) ) { not_found = false; };
          }
        }
    }

    if( not_found == true ) {
      vtext4 = vtext.replace( /[א,ה,ו,י]/g,'' );
      str_len = vtext4.length;
      if( str_len >= 4 ) {
        vtext5 = "";
        for( i=0; i < str_len; i++ ) {
          vtext5 += vtext4.substr( i, 1 )+".*";
        }
        ihtml += "<option value=''>תוצאות מקורבות</option><option value=''>----------------------</option>";
        if( !vsearch_searcher( vtext5 ) ) { not_found = false; };
      }
      if( not_found == true ) {
        ihtml += "<option value=''>לא נמצאו תוצאות</option>";
      }
    }

    ebi("SearchSpeciality").innerHTML = ihtml+"</select></div></div>";
    if( hide_select ) {
      ebi( "vsearch_select").className="hidden";
    }
  } else {
    if( ebi( "vsearch_select") != null ) {
      ebi( "vsearch_select").className="hidden";
    }
  }

};

function csearch( vtext ) {
  first_option = true;
  if( ebi( "vsearch_select" ) != null ) {
    ebi( "vsearch_select" ).className = "hidden";
  }
  hide_select = false;
  option_added = false;
  if( vtext != "" && vtext != null ) {
    ihtml = "<div><div><select id='csearch_select' name='SearchCity' class='clinic-search-select clinic-search-scity' multiple='multiple' onclick='ebi( "+'"'+"tempCity"+'"'+" ).value = this.options[ this.selectedIndex ].text; this.className="+'"'+"hidden"+'"'+"'>";
    first1 = true;
    for( var vvalue in cvalues ) {
      if( typeof( cvalues[vvalue] ) == "string" ) {
        if( cvalues[vvalue].match( "^.*"+vtext+".*$" ) != null ) {
          if( first1 == true ) {
            first1 = false;
          };
          option_added = true;
          ihtml += "<option onclick="+'"'+"ebi( 'csearch_select' ).value = this.value; ebi( 'csearch_select').className='hidden'"+'"'+'value="'+vvalue+'"';

          if( vtext == cvalues[vvalue] && !hide_select ) {
            ihtml += " selected='selected'";
            hide_select = true;
          };

          if( ( vtext == cvalues[vvalue] && !hide_select ) || first_option == true ) {
            ihtml += ' selected="selected"';
            if( !first_option == true ) {
              hide_select = true;
            }
            first_option = false;
          };

          ihtml += ">"+ cvalues[vvalue]+"</option>";
        };
      };
    };

    if( first1  ) {
      ihtml += "<option value=''></option>";
    };

    ihtml += "</select></div></div>";

    if( !option_added ) {
      ihtml = '';
      hide_select = true;
    }
    ebi( "SearchCity" ).innerHTML = ihtml;
    if( hide_select ) {
      vtext2 = vtext.replace( /א/g,'.*' );
      vtext2 = vtext2.replace( /ה/g,'.*' );
      vtext2 = vtext2.replace( /ו/g,'.*' );
      vtext2 = vtext2.replace( /י/g,'.*' );
      if( vtext2 != vtext ) {
        csearch( vtext2 );
      } else {
      csearch
        if( ebi( 'csearch_select' ) != null ) {
          ebi( 'csearch_select' ).className = 'hidden';
        }
        hide_select = false;
      }
    };
  } else {
    if( ebi( "csearch_select") != null ) {
      ebi( "csearch_select").className="hidden";
    }
  }
};


function show_banner( bannerid, bcontent ) {
  ebi( bannerid ).innerHTML = bcontent;
};

function execJS(node) {
  var bSaf = (navigator.userAgent.indexOf('Safari') != -1);
  var bOpera = (navigator.userAgent.indexOf('Opera') != -1);
  var bMoz = (navigator.appName == 'Netscape');

  if (!node) return;

  /* IE wants it uppercase */
  var st = node.getElementsByTagName('SCRIPT');
  var strExec;

  for(var i=0;i < st.length; i++) {
    if (bSaf) {
      strExec = st[i].innerHTML;
      st[i].innerHTML = "";
    } else if (bOpera) {
      strExec = st[i].text;
      st[i].text = "";
    } else if (bMoz) {
      strExec = st[i].textContent;
      st[i].textContent = "";
    } else {
      strExec = st[i].text;
      st[i].text = "";
    };

    try {
      var x = document.createElement("script");
      x.type = "text/javascript";

      /* In IE we must use .text! */
      if ((bSaf) || (bOpera) || (bMoz))
        x.innerHTML = strExec;
      else x.text = strExec;

      document.getElementsByTagName("head")[0].appendChild(x);
    } catch(e) {
      errormsg = e;
    };
  };
};


function jshow_banner( bannerid, bcontent ) {
  if( ebi( bannerid ) ) {
    ebi( bannerid ).innerHTML = bcontent;
    execJS( ebi( bannerid ) );
  } else {
    setTimeout( "jshow_banner( '"+bannerid+"', '"+bcontent+"' )", 300 );
  }
};


cleared = Array();
function clearonce( obj ) {
  if( typeof( cleared[ obj.name ] )== "undefined" ) {
    obj.value = '';
    cleared[ obj.name ] = true;
  }
}

function sleep(delay) {
    var start = new Date().getTime();
    while (new Date().getTime() < start + delay);
}

function article_print() {
  docbackup = document.body.innerHTML;
  newwin=window.open('','printwin','left=100,top=100,width=400,height=400');
  newwin.document.innerHTML = docbackup;
  newwin.document.body.innerHTML = "<center>"+parent.ebi( "article_heder" ).innerHTML+parent.ebi( "article_content" ).innerHTML+"</center>";
  newwin.window.print();
  newwin.window.close();
}

  ofl_idadd = "";
  ofl_uri = "/xFF-Read,xFI-_XFI_,xFP-_XFP_,xRF-4,realxrf-4,id-_ID_,showhtml-__showhtml__,adv-_ADV_,m-Doctors,a-Forums.html";
  ofl_stat = Array();

  function rand ( n ) {
    return ( Math.floor ( Math.random ( ) * n + 1 ) );
  }

    function show_prom_interval( xfp ) {
  	if( ebi( "promoted_"+xfp ) ) {
      ebi( "promoted_"+xfp ).innerHTML = "<span class='prmb'>רופאים ומטפלים:</span><b class='prmb'>כתבות בנושאי הפורום:</b><div class='prmbox'>"+ta_html_array[ xfp ]+"</div>";
    } else {
      setTimeout( "show_prom_interval("+xfp+")", 500 );
    }
  }
  
  function show_prom(xfp) {
    if( typeof( ta ) == "undefined" ) {
      return;
    }
    tgs_array_size = ta.length;
    array_number = -5;
		brk_counter = 0;
    while( typeof( ta[ array_number ] ) == "undefined" ) {
			brk_counter++;
			if( brk_counter == 500 ) {
				break;
			}
      var array_number = rand( tgs_array_size )-1;
    }
    ar = Array();
    if( typeof( ta[ array_number ] ) == "undefined" ) {
      return;
    }
    ar[1] = rand( ta[ array_number ].length )-1;
    ar[2] = ar[1];
    brk_counter = 0;
    while( ar[2] == ar[1] ) {
      brk_counter++;
      if( brk_counter == 500 ) {
        break;
      }
      ar[2] = rand( ta[ array_number ].length )-1;
    }

    ta_html = "";
    for( i=1; i <= 2; i++ ) {
      temp_exp = ta[ array_number ][ ar[i] ].split( "_" );
      var link  = "/ar/"+temp_exp[0];

      if( temp_exp[1] == "" ) {
        var image = "http://static.doctors.co.il/new_images/empty.gif";
      } else {
        if( typeof( static_imgs[ [ array_number ]+"_"+[ ar[i] ] ] ) != "undefined" ) {
          var image = "http://static.doctors.co.il/media/di_"+temp_exp[1]+".jpg";
        } else {
          var image = image_link.replace( "_article_image_" ,temp_exp[1] );
        }
      }

      ta_html += "<div><a target='_blank' href='"+link+"'><img src='"+image+"'><span>"+articles[temp_exp[0]]+"</span></a></div>";
    }

    if( docs.length != 0 ) {
      ar[3] = rand( docs.length )-1;
      temp_exp = docs[ ar[3] ].split( "_" );
      
      if( temp_exp[0].substr(0,1) == "m" ) {
        temp_exp[0] = temp_exp[0].replace( "m", "" );
        //var link  = prmdoclinkm.replace( '__docid__', temp_exp[0] );
        var link  = '/dr/pro'+temp_exp[0];
      } else {
        //var link  = prmdoclink.replace( '__docid__', temp_exp[0] );
        var link  = '/dr/tr-'+temp_exp[0];
      }

      if( temp_exp[1] != "n" && temp_exp[1] != "" ) {
        var image = image_link.replace( "_article_image_" ,temp_exp[1] );
      } else {
        var image = "/i/no-doctor.png";
      }
      ta_html = "<div class='promoted'><div><a target='_blank' href='"+link+"'><img src='"+image+"'><span>"+docsinfo[ ar[3]]+"</span></a></div>"+ta_html;
    } else {
      ta_html = "<div class='promoted'><div>&nbsp;</div>"+ta_html;
    }
    ta_html += "</div>";
    if( typeof( ta_html_array ) == "undefined" ) {
      ta_html_array = Array();
    }
    ta_html_array[ xfp ] = ta_html;
    
	    show_prom_interval( xfp );
      }
  function ofl( xfi, xfp ) {
    setTimeout( "realofl( '"+xfi+"', '"+xfp+"' )", 1 );
    return false;
  }

  function realofl( xfi, xfp ) {

   if( typeof( ofl_stat[ xfi+xfp ] ) == "undefined" ) {
      if( typeof( old_body_class ) == "undefined" ) {
        old_body_class = document.body.className;
      }
    } else {
      delete( ofl_stat[ xfi+xpg+xft+xfp ] );
    }

    var final_ofl_uri;
    final_ofl_uri = ofl_uri.replace( "_XFI_", xfi );
    final_ofl_uri = final_ofl_uri.replace( "_XFP_", xfp );
    final_ofl_uri = final_ofl_uri.replace( "_ID_", xfp+ofl_idadd );

    if( typeof( dontshowadv ) == "undefined" ) {
      final_ofl_uri = final_ofl_uri.replace( "_ADV_", "true" );
    } else {
      final_ofl_uri = final_ofl_uri.replace( "_ADV_", "false" );
    }

    show_article_comment( xfp, final_ofl_uri , true );
    return false;
  }

  function nshow_commentadd( cid ) {
    if( !ebi( "cmt"+cid ) && ebi( "cmt"+cid+"msg" ) ) {
      cid += "msg";
      var jump = true;
    }
    if( ebi( "cmt"+cid ).className == "add_comment_closed" ) {
      ebi( "cmt"+cid ).className = "add_comment_open" ;
    } else {
      ebi( "cmt"+cid ).className = "add_comment_closed" ;
    }

    if( typeof( jump ) != "undefined" ) {
      window.location = "#cmt"+cid;
    }
  }

fli_uri = " <a href=\"/xFF-List,xFI-_id_,m-Doctors,a-Forums.html\">";

function multi_fli( fli_string ) {
  fli_string_array = fli_string.split( ",," );
  for( i in fli_string_array ) {
    tmpstr = fli_string_array[i].split( "__" );
    fli( tmpstr[0], tmpstr[1] );
  }
}

function fli( link_id, link_name ) {
  document.write( fli_uri.replace( "_id_", link_id ) + " &nbsp; " + link_name + "</a>" );
}

function u( fid ) {
  document.write( "<u id=\"f"+fid+"\" class=\"hidden hidden_iframe\">");
}

function eu() {
  document.write( "</u>" );
}

skip_div = true;
function b( folder_id, folder_name, desc ) {
  skip_div = !skip_div;
  document.write( "<b title=\"לחץ לפתיחת הפורומים\" id=\"ft"+folder_id+"\" onclick=\"show_folder( '"+folder_id+"' )\"><p class='t'>"+folder_name+"</p><span>"+desc+"</span></b>" );
  if( skip_div ) {
    document.write( "</div><div>" );
  }
}

  old_folder = false;
  function show_folder( fid ) {
    if( old_folder == fid ) {
      ebi( "f"+fid ).className = "hidden hidden_iframe";
      ebi( "ft"+fid ).className = "";
      old_folder = false;
    } else {
      if( ebi( "f"+old_folder ) ) {
        ebi( "ft"+old_folder ).className = "";
        ebi( "f"+old_folder ).className = "hidden hidden_iframe";
      }
      if( ebi( "f"+fid ).className == "hidden hidden_iframe" ) {
        ebi( "f"+fid ).className = "forums_block";
        ebi( "ft"+fid ).className = "forums_topic_block";
        this.classname="forums_topic_block";
      } else {
        ebi( "f"+fid ).className = "hidden hidden_iframe";
      }
      old_folder = fid;
    }
  }

function sbc( char ) {
  document.write( "<a href='#' onclick=\"show_bychar('"+ char+"'); return false\">"+char+"</a>" );
}

forum_link = "/forum-_forum_id_";

function show_bychar( char ) {
  document                                                                                                                        .getElementById( 'Results_div' ).innerHTML = "<hr>";
  if( typeof( f[ char ] ) != "undefined" ) {
    for( fname in f[ char ] ) {
      if( fname.substr( 0,1 ) == char ) {
        ebi( 'Results_div' ).innerHTML += "<a class='fl_link' href='"+forum_link.replace( '_forum_id_', f[ char ][ fname ]  )+"'>"+fname+"</a>";
      }
    }
  } else {
    ebi( 'Results_div' ).innerHTML = "לא נמצאו תוצאות באות  "+char+"'";
  }
  ebi( 'Results_div' ).innerHTML += "<br><hr style=\"float: right; width: 350;\">";
}

function show_byname( search_string ) {
  if( search_string.length > 2 ) {

    search_string3 = search_string.replace( /א/g,'' );
    search_string3 = search_string3.replace( /ה/g,'' );
    search_string3 = search_string3.replace( /ו/g,'' );
    search_string3 = search_string3.replace( /י/g,'' );

    if( search_string3.length < 3 ) {
      search_string2 = "dont_search";
    } else {
      search_string2 = search_string.replace( /א/g,'.*' );
      search_string2 = search_string2.replace( /ה/g,'.*' );
      search_string2 = search_string2.replace( /ו/g,'.*' );
      search_string2 = search_string2.replace( /י/g,'.*' );
    }

    if( search_string2 == search_string ) {
      search_string2 = "dont_search";
    }
  } else {
    search_string2 = "dont_search";
  }

  var found = Array();

  if( search_string != '' && search_string.length > 1 ) {
    ebi( 'Results_div' ).innerHTML = "<hr>";
    
    

    for( char in f ) {
      for( fname in f[ char ] ) {
        if( typeof( found_first ) == "undefined" ) {
            ebi( 'Results_div' ).innerHTML += "<a><hr></a><a>תוצאות חיפוש</a><a><hr></a>";
            
            
            if( search_string == 'סרט' || search_string == 'סרטן'){
            	ebi( 'Results_div' ).innerHTML += "<a class='fl_link' href='"+forum_link.replace( '_forum_id_', f[ char ][ fname ]  )+"'>HPV - וירוס הפפילומה, קונדילומה, צוואר הרחם</a>";
            }
            
            
            var found_first;
            found_first = true;
          }
        if( fname.match( '^.*'+search_string+'.*$' ) != null  ) {
          ebi( 'Results_div' ).innerHTML += "<a class='fl_link' href='"+forum_link.replace( '_forum_id_', f[ char ][ fname ]  )+"'>"+fname+"</a>";
          found[ fname ] = true;
        }
      }
      
 
      
    }

    if( search_string2 != "dont_search" ) {
      for( char in f ) {
        for( fname in f[ char ] ) {
          if( fname.match( '^.*'+search_string2+'.*$' ) != null && typeof( found[ fname ] ) == "undefined" ) {
            if( typeof( found_more ) == "undefined" ) {
              ebi( 'Results_div' ).innerHTML += "<a><hr></a><a>תוצאות מקורבות</a><a><hr></a>";
              var found_more;
              found_more = true;
            }
            ebi( 'Results_div' ).innerHTML += "<a class='fl_link' href='"+forum_link.replace( '_forum_id_', f[ char ][ fname ]  )+"'>"+fname+"</a>";
          }
        }
      }
    }
    ebi( 'Results_div' ).innerHTML += "<a><hr></a>";
  }
}

function gebi( eid ) {
  if( !ebi( eid ) ) {
    return "";
  }
  return ebi( eid ).value;
}

function ebi( eid ) {
  if( !document.getElementById( eid ) ) {
    return null;
  }
  return document.getElementById( eid );
}



encoded_chars = "אבגדהוזחטיכלמנסעפצקרשתםןךףץ,";encoded_to_chars = "E0E1E2E3E4E5E6E7E8E9EBECEEF0F1F2F4F6F7F8F9FAEDEFEAF3F52C";function url_encode( cstring ) {
  for( i=0; i < 28; i++ ) {
    from_char = encoded_chars.substr( i, 1 );
    to_char = encoded_to_chars.substr( i*2, 2 );

    old_string = 0;
    while( old_string != cstring ) {
      old_string = cstring;
      cstring = cstring.replace( from_char, "%"+to_char );
    }

  }

  return cstring;
}

function chclass( cc_objid, cc_newclass ) {
  ebi( cc_objid ).className = cc_newclass;
}


q_add = "";

function google_submit() {
  q_add = "";
  i = 1;
  if( ebi( "qccheck1" ) == null ) {
    i = 2;
  }
  got_checked = false;
  checked_sum = 0;
  while( ebi( "qccheck"+i ) != null && ebi( "qccheck"+i ) != "" ) {
    if( ebi( "qccheck"+i ).checked ) {
      checked_sum++;
      if( got_checked ) {
        q_add += " OR ";
      }
      q_add += ebi( "qccheck"+i ).value;
      got_checked = true;
    }

    i++;
  }

  if( checked_sum == 1 && ebi( "qccheck4" ).checked ) {
    ebi( "cse-search-box" ).method = "POST";
    ebi( "q" ).name = "SearchFreeValues";
    ebi( "cse-search-box" ).action = "/dr#aftersearch";
    q_add = "";
  } else if( checked_sum == 1 && ebi( "qccheck3" ).checked ) {
    ebi( "q" ).name = "xMS";
    ebi( "cse-search-box" ).action = "/m/Medicine/a/Search";
    q_add = "";
    
  }else if( ebi( "qccheck5" ).checked ) {
    ebi( "cse-search-box" ).method = "POST";
    ebi( "q" ).name = "SearchFreeValues";
    ebi( "cse-search-box" ).action = "/pharmacy#dsearch_results";
    q_add = ""; 
    
    
    
  } else {
    if( ebi( "qccheck1" ) != null && ebi( "qccheck1" ).checked != true && got_checked ) {
      ebi( "q" ).value += " -xfi ";
    }
    if( ebi( "qccheck2" ) != null && ebi( "qccheck2" ).checked != true && got_checked ) {
      ebi( "q" ).value +=  " -\"doctors.co.il/ar\" ";
    }
  }

  ebi( "q" ).value += q_add;
}

ce_cur = 50;
ce_speed = -4;
function ch_ceffect() {
  if( ce_cur < 50 || ce_cur > 99 )
    ce_speed = ce_speed * -1;
  ce_cur -= ce_speed;
  ce_obj.style.opacity = ce_cur/100;
  ce_obj.style.filter = "alpha(opacity = "+ce_cur+");";
  setTimeout( "ch_ceffect()", 25 );
}


function select_onchange_loc_new_page (page) {
	document.location.href = page;
}


function UcheckChek (val) {
	if(val == 1){
		document.myform.qccheck1.checked = false; 
		document.myform.qccheck2.checked = false; 
		document.myform.qccheck3.checked = false; 
		document.myform.qccheck4.checked = false; 
		document.myform.qccheck5.checked = false;
	}else if(val == 2 || val == 3){
		document.myform.qccheck0.checked = false; 
		document.myform.qccheck3.checked = false; 
		document.myform.qccheck4.checked = false; 
		document.myform.qccheck5.checked = false;
	}else if(val == 4){
		document.myform.qccheck0.checked = false; 
		document.myform.qccheck1.checked = false; 
		document.myform.qccheck2.checked = false; 
		document.myform.qccheck4.checked = false; 
		document.myform.qccheck5.checked = false;
	}else if(val == 5){
		document.myform.qccheck0.checked = false; 
		document.myform.qccheck1.checked = false; 
		document.myform.qccheck2.checked = false; 
		document.myform.qccheck3.checked = false; 
		document.myform.qccheck5.checked = false;
	}else if(val == 6){
		document.myform.qccheck0.checked = false; 
		document.myform.qccheck1.checked = false; 
		document.myform.qccheck2.checked = false; 
		document.myform.qccheck3.checked = false; 
		document.myform.qccheck4.checked = false;
	}
}
var winReference = null;

function openPositionedWindow(url, name, width, height, x, y, status, scrollbars, moreProperties, openerName) {
		var agent = navigator.userAgent.toLowerCase();
	if (agent.indexOf("mac") != -1 && agent.indexOf("msie") != -1 && (agent.indexOf("msie 4") != -1 || agent.indexOf("msie 5.0") != -1) ) {
		height += (status) ? 17 : 2;
	}
 
	width += (scrollbars != '' && scrollbars != null && agent.indexOf("mac") == -1) ? 16 : 0;

	var properties = 'width=' + width + ',height=' + height + ',screenX=' + x + ',screenY=' + y + ',left=' + x + ',top=' + y + ((status) ? ',status' : '') + ',scrollbars' + ((scrollbars) ? '' : '=no') + ((moreProperties) ? ',' + moreProperties : '');
	var reference = openWindow(url, name, properties, openerName);
	return reference;
}

function openCenteredWindow(url, name, width, height, status, scrollbars, moreProperties, openerName) {
	var x, y = 0;
	if (screen) {
      x = (screen.availWidth - width) / 2;
	   y = (screen.availHeight - height) / 2;
   }
	if (!status) status = '';
	if (!openerName) openerName = '';
	var reference = openPositionedWindow(url, name, width, height, x, y, status, scrollbars, moreProperties, openerName);
	return reference;
}	

function openCenteredOnOpenerWindow(url, name, width, height, status, scrollbars, moreProperties, openerName) {
	var centerX = 0;
   var centerY = 0;
   if (window.screenX != null && window.outerWidth) {
      centerX = window.screenX + (window.outerWidth / 2);
      centerY = window.screenY + (window.outerHeight / 2);
   }
   else if (window.screenLeft) {
      if (document.documentElement) {
         centerX = window.screenLeft + (document.documentElement.offsetWidth / 2);
         centerY = window.screenTop + (document.documentElement.offsetHeight / 2);
      }
      else if (document.body && document.body.offsetWidth) {
         centerX = window.screenLeft + (document.body.offsetWidth / 2);
         centerY = window.screenTop + (document.body.offsetHeight / 2);
      }
   }
   
   if (centerX == 0) {
      openCenteredWindow(url, name, width, height, status, scrollbars, moreProperties, openerName);
   }
   var x = parseInt(centerX - (width / 2));
   var y = parseInt(centerY - (height / 2));
	if (!status) status = '';
	if (!openerName) openerName = '';
	var reference = openPositionedWindow(url, name, width, height, x, y, status, scrollbars, moreProperties, openerName);
	return reference;
}	

function openMaxedWindow(url, name, scrollbars, openerName) {
	var x, y = 0;
	var width  = 600;
	var height = 800;
	if (screen) {
      if (screen.availLeft) {
         x = screen.availLeft;
         y = screen.availTop;
      }
      width  = screen.availWidth - 6;
	   height = screen.availHeight - 29;
   }
	var reference = openPositionedWindow(url, name, width, height, x, y, false, scrollbars, openerName);
	return reference;
}

function openFullChromeWindow(url, name, openerName) {
	return openWindow(url, name, 'directories,location,menubar,resizable,scrollbars,status,toolbar');
}

function openSizedFullChromeWindow(url, name, width, height, openerName) {
	return openCenteredWindow(url, name, width, height, true, true, 'directories,location,menubar,resizable,toolbar', openerName)
}

function openWindow(url, name, properties, openerName) {
	var agent = navigator.userAgent.toLowerCase();
	if (agent.indexOf("msie") != -1 && parseInt(navigator.appVersion) == 4 && agent.indexOf("msie 5") == -1 && agent.indexOf("msie5") == -1 && agent.indexOf("win") != -1 && url.indexOf('http://') == 0) {
		winReference = window.open('about:blank', name, properties);
		
		setTimeout('if (winReference && !winReference.closed) winReference.location.replace("' + url + '")', 300);
	}
	else {
		winReference = window.open(url, name, properties);
	}

	// ie doesn't like giving focus immediately (to new window in 4.5 on mac; to existing ones in 5 on pc)
	setTimeout('if (winReference && !winReference.closed) winReference.focus()', 200);
	
	if (openerName) self.name = openerName;
	return winReference;
}

function closeDialog(dialog) {
	if (dialog && dialog.closed != true) dialog.close();
}

function closeParentDialog() {
	if (top.opener && isWindowPopup(top.opener)) {
		root = top.opener.top.opener;
		top.opener.close();
		top.opener = root;
	}
}

function isWindowPopup(win) {
	return ((win.opener) ? true : false);
}
