var selectedList;
var availableList;
var global_search_obj;
var global_list_like;
global_list_like=2;
function Hidepopup(){
if (global_list_like!=2){
  document.getElementById('list_like').style.display='none';
  }
global_list_like=2;
}
var Script = {
  _loadedScripts: [],
  include: function(script){
    // include script only once
    if (this._loadedScripts.include(script)){
      return false;
    }
    // request file synchronous
    var code = new Ajax.Request(script, {
      asynchronous: false, method: "GET",
      evalJS: false, evalJSON: false
    }).transport.responseText;
    // eval code on global level
    if (Prototype.Browser.IE) {
      window.execScript(code);
    } else if (Prototype.Browser.WebKit){
      $$("head").first().insert(Object.extend(
        new Element("script", {type: "text/javascript"}), {text: code}
      ));
    } else {
      window.eval(code);
    }
    // remember included script
    this._loadedScripts.push(script);
  }
};
function loadjscssfile(filename, filetype){
 if (filetype=="js"){ //if filename is a external JavaScript file
  var fileref=document.createElement('script')
  fileref.setAttribute("type","text/javascript")
  fileref.setAttribute("src", filename)
 }
 else if (filetype=="css"){ //if filename is an external CSS file
  var fileref=document.createElement("link")
  fileref.setAttribute("rel", "stylesheet")
  fileref.setAttribute("type", "text/css")
  fileref.setAttribute("href", filename)
 }
 if (typeof fileref!="undefined")
  document.getElementsByTagName('head')[0].appendChild(fileref);
}
function clear_days(){
document.getElementById("days").innerHTML='';
}
function generate_days(date1,date2){
var dateString1 = document.getElementById("divCalendar_"+date1+"_lbl").innerHTML;
var myDate1 = new Date(dateString1);
var dateString2 = document.getElementById("divCalendar_"+date2+"_lbl").innerHTML;
var myDate2 = new Date(dateString2);
if (myDate2<myDate1){myDate2=myDate1;}
var one_day=1000*60*60*24;
var str='';
var nextday = new Date();
var btn='0'
for(i=0;i<=Math.ceil((myDate2.getTime()-myDate1.getTime())/(one_day));i++){
if((!(document.getElementById('button_clear')))&&(btn=='0')){
  str=str+'<br><input id="button_clear" type="button" class="anket_button" style="width:120px" value="Изчисти" onclick="clear_days();"><br>';
  btn='1';
}
nextday.setTime(myDate1.getTime()+(one_day*i));
if(!(document.getElementById('day_'+nextday.format("Ymd")))){
  str=str+'Ден > '+'<input readonly style="margin-top:3px;width:80px;background-color:silver" id="day_'+nextday.format("Ymd")+'" name="day_'+nextday.format("Ymd")+'" type="text" value="'+nextday.format("d/m/Y")+'">';
  str=str+' Час от : '+'<input style="margin-top:3px;width:40px" id="hourfrom_'+nextday.format("Ymd")+'" name="hourfrom_'+nextday.format("Ymd")+'" type="text" value="00:00">';
  str=str+' Час до : '+'<input style="margin-top:3px;width:40px" id="hourto_'+nextday.format("Ymd")+'" name="hourto_'+nextday.format("Ymd")+'" type="text" value="00:00">';
  str=str+'<br>';
}
}
document.getElementById("days").innerHTML=document.getElementById("days").innerHTML+str;
}
function delAttribute(){
   availableList = document.getElementById("spec1");
   selectedList = document.getElementById("spec2");
   var selIndex = selectedList.selectedIndex;
   if(selIndex < 0)
      return;
   var rstr = document.getElementById("spec").value;
   document.getElementById("spec").value=rstr.replace(','+selectedList.options.item(selIndex).value+',',',');
   availableList.appendChild(
      selectedList.options.item(selIndex))
   selectNone(selectedList,availableList);
   setSize(availableList,selectedList);
}
function addAttribute(){
   availableList = document.getElementById("spec1");
   selectedList = document.getElementById("spec2");
   var addIndex = availableList.selectedIndex;
   if(addIndex < 0)
      return;
   document.getElementById("spec").value=document.getElementById("spec").value+availableList.options.item(addIndex).value+',';
   selectedList.appendChild(
      availableList.options.item(addIndex));
   selectNone(selectedList,availableList);
   setSize(selectedList,availableList);
}
function listvk(){
  var link='';
  link='vklist.php?grad='+document.getElementById('grad').value+'&spec='+document.getElementById('spec').value;
  window.location.href=link;
}
function workdays(id){
  idd=document.getElementById('vid').value;
  if (idd==0){
    document.getElementById('days').style.display="block";
    document.getElementById('odd').style.display="none";
  }else{
    document.getElementById('days').style.display="none";
    document.getElementById('odd').style.display="block";
  }
}
String.prototype.splitCSV1 = function(sep) {
  for (var foo = this.split(sep = sep || "|"), x = foo.length - 1, tl; x >= 0; x--) {
    if (foo[x].replace(/"\s+$/, '"').charAt(foo[x].length - 1) == '"') {
      if ((tl = foo[x].replace(/^\s+"/, '"')).length > 1 && tl.charAt(0) == '"') {
        foo[x] = foo[x].replace(/^\s*"|"\s*$/g, '').replace(/""/g, '"');
      } else if (x) {
        foo.splice(x - 1, 2, [foo[x - 1], foo[x]].join(sep));
      } else foo = foo.shift().split(sep).concat(foo);
    } else foo[x].replace(/""/g, '"');
  } return foo;
};
String.prototype.splitCSV2 = function(sep) {
  for (var foo = this.split(sep = sep || ";"), x = foo.length - 1, tl; x >= 0; x--) {
    if (foo[x].replace(/"\s+$/, '"').charAt(foo[x].length - 1) == '"') {
      if ((tl = foo[x].replace(/^\s+"/, '"')).length > 1 && tl.charAt(0) == '"') {
        foo[x] = foo[x].replace(/^\s*"|"\s*$/g, '').replace(/""/g, '"');
      } else if (x) {
        foo.splice(x - 1, 2, [foo[x - 1], foo[x]].join(sep));
      } else foo = foo.shift().split(sep).concat(foo);
    } else foo[x].replace(/""/g, '"');
  } return foo;
};
function showcitylz(nlz){
  for(i=1;i<20;i++){
  if (typeof(document.getElementById("mcity"+i.toString())) != 'undefined' && document.getElementById("mcity"+i.toString()) != null)
  {
        document.getElementById("mcity"+i.toString()).style.visibility="hidden";
        document.getElementById(i.toString()).style.backgroundColor="white";
  }
  }
  if (typeof(document.getElementById("mcity"+nlz)) != 'undefined' && document.getElementById("mcity"+nlz) != null)
  {
        document.getElementById("mcity"+nlz).style.visibility="visible";
        document.getElementById(nlz).style.backgroundColor="#FFCC00";
        getlz(nlz);
  }
}
function rateProduct(rating,productID,ID)  {
		//remotos = new datosServidor;
		//nt = remotos.enviar('update.php?rating='+rating+'&productID='+productID);
		rating2 = (rating * 25);
		if (rating2==0){rating2=1} else{rating2=rating2-2};
		document.getElementById('current-rating'+ID).style.width = rating2+'px';
		document.getElementById('rating'+ID).value = rating;
		//document.getElementById('ratelinks').style.display = 'none';
		//document.getElementById('ratingtext').innerHTML = 'Thank you for your vote!';
}
function show_hide_ans(obj,ind){
cind=obj.selectedIndex;
cvalue=obj.options[cind].value;
if (cvalue==0){
  document.getElementById("sv_text_"+ind).style.display="block";
 }else{
  document.getElementById("sv_text_"+ind).style.display="none";
 }
}
function district(){
cind=document.getElementById('citym').selectedIndex;
cvalue=document.getElementById('citym').options[cind].value;
cind1=document.getElementById('kvartal').selectedIndex;
cvalue1=document.getElementById('kvartal').options[cind1].value;
window.location='maps_'+cvalue+'_'+cvalue1;
}
function maps(){
cind=document.getElementById('citym').selectedIndex;
cvalue=document.getElementById('citym').options[cind].value;
window.location='maps_'+cvalue;
}
function addsm(sm){
if (sm==1){
document.getElementById("mnenie").value=document.getElementById("mnenie").value+':)';
}
if (sm==2){
document.getElementById("mnenie").value=document.getElementById("mnenie").value+":'(";
}
if (sm==3){
document.getElementById("mnenie").value=document.getElementById("mnenie").value+':(';
}
if (sm==4){
document.getElementById("mnenie").value=document.getElementById("mnenie").value+':P';
}
}
function newpreview(sm){
if (sm.id=='file'){
document.getElementById(sm.id+"div").src=sm.value;
}else{
document.getElementById(sm.id+"div").innerHTML=sm.value;
}
}
// holds an instance of XMLHttpRequest
var xmlHttp = createXmlHttpRequestObject();
// creates an XMLHttpRequest instance
function createXmlHttpRequestObject()
{
// will store the reference to the XMLHttpRequest object
var xmlHttp;
// this should work for all browsers except IE6 and older
try
{
// try to create XMLHttpRequest object
xmlHttp = new XMLHttpRequest();
}
catch(e)
{
// assume IE6 or older
var XmlHttpVersions = new Array("MSXML2.XMLHTTP.6.0",
"MSXML2.XMLHTTP.5.0",
"MSXML2.XMLHTTP.4.0",
"MSXML2.XMLHTTP.3.0",
"MSXML2.XMLHTTP",
"Microsoft.XMLHTTP");
// try every prog id until one works
for (var i=0; i<XmlHttpVersions.length && !xmlHttp; i++)
{
try
{
// try to create XMLHttpRequest object
xmlHttp = new ActiveXObject(XmlHttpVersions[i]);
}
catch (e) {}
}
}
// return the created object or display an error message
if (!xmlHttp)
alert("Error creating the XMLHttpRequest object.");
else
return xmlHttp;
}
function changevid(vl){
if (vl==0){
document.getElementById("uinl").style.display = 'none';
document.getElementById("divuinl").innerHTML='';
}else{
document.getElementById("uinl").style.display = 'block';
document.getElementById("divuinl").innerHTML='УИНЛ';
}
}
function checkuname(vl){
// only continue if xmlHttp isn't void
if (xmlHttp)
{
// try to connect to the server
try
{
// get the two values entered by the user
var uname = vl;
var params = "uname=" + vl;
// initiate the asynchronous HTTP request
xmlHttp.open("GET", "checkuser.php?" + params, true);
xmlHttp.onreadystatechange = handleRequestStateChange1;
xmlHttp.send(null);
}
// display the error in case of failure
catch (e)
{
alert("Възникна грешка, опитайте отново");
}
}
}
// function called when the state of the HTTP request changes
function handleRequestStateChange1()
{
// when readyState is 4, we are ready to read the server response
if (xmlHttp.readyState == 4)
{
// continue only if HTTP status is "OK"
if (xmlHttp.status == 200)
{
try
{
// do something with the response from the server
//handleServerResponse();
myDiv = document.getElementById("divuname");
myDiv.innerHTML = xmlHttp.responseText;
}
catch(e)
{
// display error message
alert("Error reading the response: " + e.toString());
}
}
else
{
// display status message
alert("There was a problem retrieving the data:\n" +
xmlHttp.statusText);
}
}
}
function checkemail(vl){
// only continue if xmlHttp isn't void
if (xmlHttp)
{
// try to connect to the server
try
{
// get the two values entered by the user
var uname = vl;
var params = "email=" + vl;
// initiate the asynchronous HTTP request
xmlHttp.open("GET", "checkemail.php?" + params, true);
xmlHttp.onreadystatechange = handleRequestStateChange2;
xmlHttp.send(null);
}
// display the error in case of failure
catch (e)
{
alert("Възникна грешка, опитайте отново");
}
}
}
// function called when the state of the HTTP request changes
function handleRequestStateChange2()
{
// when readyState is 4, we are ready to read the server response
if (xmlHttp.readyState == 4)
{
// continue only if HTTP status is "OK"
if (xmlHttp.status == 200)
{
try
{
// do something with the response from the server
//handleServerResponse();
myDiv = document.getElementById("divemail");
myDiv.innerHTML = xmlHttp.responseText;
}
catch(e)
{
// display error message
alert("Error reading the response: " + e.toString());
}
}
else
{
// display status message
alert("There was a problem retrieving the data:\n" +
xmlHttp.statusText);
}
}
}
// read a file from the server
function process()
{
// only continue if xmlHttp isn't void
if (xmlHttp)
{
// try to connect to the server
try
{
// get the two values entered by the user
var uname = document.getElementById("uname").value;
var pass = document.getElementById("pass").value;
//var secondNumber = document.getElementById("secondNumber").value;
// create the params string
var params = "uname=" + uname+"&pass="+pass;
// initiate the asynchronous HTTP request
xmlHttp.open("GET", "loginuser.php?" + params, true);
xmlHttp.onreadystatechange = handleRequestStateChange;
xmlHttp.send(null);
}
// display the error in case of failure
catch (e)
{
alert("Възникна грешка, опитайте отново");
}
}
}
// function called when the state of the HTTP request changes
function handleRequestStateChange()
{
// when readyState is 4, we are ready to read the server response
if (xmlHttp.readyState == 4)
{
// continue only if HTTP status is "OK"
if (xmlHttp.status == 200)
{
// do something with the response from the server
//handleServerResponse();
myDiv = document.getElementById("divlogin");
var login = xmlHttp.responseText;
if (login.search('Фамилия')>-1){
window.location.reload();
}else{
myDiv.innerHTML = xmlHttp.responseText;
}
var str=myDiv.innerHTML;
var pos=str.indexOf(">Профил</");
if (pos>=0)
{
  if (typeof(document.getElementById("L_MARK")) != 'undefined' && document.getElementById("L_MARK") != null)
  {
        document.getElementById("L_MARK").innerHTML='<input id="submit" type="submit" name="submit" value="Запис">';
        window.scrollTo(0,25);
  }
  if (typeof(document.getElementById("L_ADDLZ")) != 'undefined' && document.getElementById("L_ADDLZ") != null)
  {
        document.getElementById("L_ADDLZ").innerHTML='<input type="submit" value="Добави" style="width:145px">';
        window.scrollTo(0,25);
  }
  if (typeof(document.getElementById("newmark")) != 'undefined' && document.getElementById("newmark") != null)
  {
        document.getElementById("newmark").innerHTML='<input type="button" onclick="document.getElementById('+String.fromCharCode(39)+'rnd_container'+String.fromCharCode(39)+').style.display='+String.fromCharCode(39)+'block'+String.fromCharCode(39)+';"  style="font-weight:700" value="Ново оценяване"/>';
        window.scrollTo(0,25);
  }
}
}
else
{
// display status message
//alert("There was a problem retrieving the data:\n" +
//xmlHttp.statusText);
}
}
}
// handles the response received from the server
function handleServerResponse()
{
// retrieve the server's response packaged as an XML DOM object
var xmlResponse = xmlHttp.responseXML;
// catching potential errors with IE and Opera
if (!xmlResponse || !xmlResponse.documentElement)
throw("Invalid XML structure:\n" + xmlHttp.responseText);
// catching potential errors with Firefox
var rootNodeName = xmlResponse.documentElement.nodeName;
if (rootNodeName == "parsererror")
throw("Invalid XML structure:\n" + xmlHttp.responseText);
// getting the root element (the document element)
xmlRoot = xmlResponse.documentElement;
// testing that we received the XML document we expect
if (rootNodeName != "response" || !xmlRoot.firstChild)
throw("Invalid XML structure:\n" + xmlHttp.responseText);
// the value we need to display is the child of the root <response> element
responseText = xmlRoot.firstChild.data;
// display the user message
myDiv = document.getElementById("myDivElement");
myDiv.innerHTML = "Server says the answer is: " + responseText;
}
//search LZ
function searchlzvk(vk)
{
// only continue if xmlHttp isn't void
if (xmlHttp)
{
// try to connect to the server
try
{
// get the two values entered by the user
var type = document.getElementById("typess").value;
var city = document.getElementById("citys").value;
var name = document.getElementById("names").value;
var adres = document.getElementById("adres").value;
//var secondNumber = document.getElementById("secondNumber").value;
// create the params string
var params = "T=" + type+"&C="+city+"&N="+name+"&A="+adres;
// initiate the asynchronous HTTP request
xmlHttp.open("GET", "searchlzvk.php?vk="+vk+"&"+ params, true);
xmlHttp.onreadystatechange = handleRequestStateChangelz;
xmlHttp.send(null);
}
// display the error in case of failure
catch (e)
{
alert("Възникна грешка, опитайте отново");
}
}
}
function searchlz()
{
// only continue if xmlHttp isn't void
if (xmlHttp)
{
// try to connect to the server
try
{
// get the two values entered by the user
var type = document.getElementById("typess").value;
var city = document.getElementById("citys").value;
var name = document.getElementById("names").value;
var adres = document.getElementById("adres").value;
//var secondNumber = document.getElementById("secondNumber").value;
// create the params string
var params = "T=" + type+"&C="+city+"&N="+name+"&A="+adres;
// initiate the asynchronous HTTP request
xmlHttp.open("GET", "searchlz.php?" + params, true);
xmlHttp.onreadystatechange = handleRequestStateChangelz;
xmlHttp.send(null);
}
// display the error in case of failure
catch (e)
{
alert("Възникна грешка, опитайте отново");
}
}
}
// function called when the state of the HTTP request changes
function handleRequestStateChangelz()
{
// when readyState is 4, we are ready to read the server response
if (xmlHttp.readyState == 4)
{
// continue only if HTTP status is "OK"
if (xmlHttp.status == 200)
{
// do something with the response from the server
//handleServerResponse();
myDiv = document.getElementById("searchrez");
myDiv.innerHTML = xmlHttp.responseText;
}
else
{
// display status message
//alert("There was a problem retrieving the data:\n" +
//xmlHttp.statusText);
}
}
}
function searchlekars()
{
// only continue if xmlHttp isn't void
if (xmlHttp)
{
// try to connect to the server
try
{
// get the two values entered by the user
var type = document.getElementById("typess").value;
var city = document.getElementById("citys").value;
var name = document.getElementById("names").value;
var adres = document.getElementById("adres").value;
//var secondNumber = document.getElementById("secondNumber").value;
// create the params string
var params = "T=" + type+"&C="+city+"&N="+name+"&A="+adres;
// initiate the asynchronous HTTP request
xmlHttp.open("GET", "searchlekars.php?" + params, true);
xmlHttp.onreadystatechange = handleRequestStateChangelekars;
xmlHttp.send(null);
}
// display the error in case of failure
catch (e)
{
alert("Възникна грешка, опитайте отново");
}
}
}
// function called when the state of the HTTP request changes
function handleRequestStateChangelekars()
{
// when readyState is 4, we are ready to read the server response
if (xmlHttp.readyState == 4)
{
// continue only if HTTP status is "OK"
if (xmlHttp.status == 200)
{
// do something with the response from the server
//handleServerResponse();
myDiv = document.getElementById("searchrez");
myDiv.innerHTML = xmlHttp.responseText;
}
else
{
// display status message
//alert("There was a problem retrieving the data:\n" +
//xmlHttp.statusText);
}
}
}
function getdrugs(drug)
{
// only continue if xmlHttp isn't void
if (xmlHttp)
{
// try to connect to the server
try
{
var type;
type=document.getElementById('types').selectedIndex;
type=document.getElementById('types').options[type].value;
var params = "drug=" + drug+"&type=" + type;
// initiate the asynchronous HTTP request
xmlHttp.open("GET", "searchdrugs.php?" + params, true);
xmlHttp.onreadystatechange = handleRequestStateChangedrug;
xmlHttp.send(null);
}
// display the error in case of failure
catch (e)
{
alert("Възникна грешка, опитайте отново");
}
}
}
// function called when the state of the HTTP request changes
function handleRequestStateChangedrug()
{
// when readyState is 4, we are ready to read the server response
if (xmlHttp.readyState == 4)
{
// continue only if HTTP status is "OK"
if (xmlHttp.status == 200)
{
// do something with the response from the server
//handleServerResponse();
myDiv = document.getElementById("drugs");
myDiv.innerHTML = xmlHttp.responseText;
}
else
{
// display status message
//alert("There was a problem retrieving the data:\n" +
//xmlHttp.statusText);
}
}
}
//klistlz
function getlz(type)
{
// only continue if xmlHttp isn't void
if (xmlHttp)
{
// try to connect to the server
try
{
var city=document.getElementById("mcity"+type.toString()).value;
var params = "t=" + type+"&c="+city;
// initiate the asynchronous HTTP request
xmlHttp.open("GET", "searchlzlist.php?" + params, true);
xmlHttp.onreadystatechange = handleRequestStateChangelz45;
xmlHttp.send(null);
}
// display the error in case of failure
catch (e)
{
alert("Възникна грешка, опитайте отново");
}
}
}
// function called when the state of the HTTP request changes
function handleRequestStateChangelz45()
{
// when readyState is 4, we are ready to read the server response
if (xmlHttp.readyState == 4)
{
// continue only if HTTP status is "OK"
if (xmlHttp.status == 200)
{
// do something with the response from the server
//handleServerResponse();
myDiv = document.getElementById("listlz");
myDiv.innerHTML = xmlHttp.responseText;
}
else
{
// display status message
//alert("There was a problem retrieving the data:\n" +
//xmlHttp.statusText);
}
}
}
function locupd(l1,l2,id)
{
//var xmlHttp1 = createXmlHttpRequestObject();
// only continue if xmlHttp isn't void
if (xmlHttp)
{
// try to connect to the server
try
{
var params = "L1=" +l1+"&L2="+l2+"&ID="+id;
// initiate the asynchronous HTTP request
xmlHttp.open("GET", "loc_upd.php?" + params, true);
xmlHttp.onreadystatechange = handleRequestStateChangeloc;
xmlHttp.send(null);
}
// display the error in case of failure
catch (e)
{
alert("Възникна грешка, опитайте отново");
}
}
}
// function called when the state of the HTTP request changes
function handleRequestStateChangeloc()
{
// when readyState is 4, we are ready to read the server response
if (xmlHttp.readyState == 4)
{
// continue only if HTTP status is "OK"
if (xmlHttp.status == 200)
{
myDiv = document.getElementById("autoloc");
myDiv.innerHTML = myDiv.innerHTML+xmlHttp.responseText;
}
else
{
// display status message
//alert("There was a problem retrieving the data:\n" +
//xmlHttp.statusText);
}
}
}
function adresmap(adr)
{
//var xmlHttpT = createXmlHttpRequestObject();
// only continue if xmlHttp isn't void
if (xmlHttp)
{
// try to connect to the server
//try
//{
//alert(adr);
xmlHttp.abort();
xmlHttp.async = false;
xmlHttp.open('GET', 'http://google.com/');
//xmlHttp.onreadystatechange = handleRequestStateChangemap12;
xmlHttp.send(null);
//}
// display the error in case of failure
//catch (e)
//{
//alert("Възникна грешка, опитайте отново");
//}
}
}
// function called when the state of the HTTP request changes
function handleRequestStateChangemap12()
{
// when readyState is 4, we are ready to read the server response
if (xmlHttp.readyState == 4)
{
// continue only if HTTP status is "OK"
if (xmlHttp.status == 200)
{
alert(xmlHttp.responseText);
//myDiv = document.getElementById("autoloc");
//myDiv.innerHTML = myDiv.innerHTML+xmlHttp.responseText;
}
else
{
// display status message
//alert("There was a problem retrieving the data:\n" +
//xmlHttp.statusText);
}
}
}
var v_old;
var v_oldparam;
var v_lekar;
var v_name;
// virtual kab
var v_oldname;
var v_oldparam;
function handleRequestStatevirtualcab()
{
if (xmlHttp.readyState == 4)
{
if (xmlHttp.status == 200)
{
myDiv = document.getElementById("private_content");
myDiv.innerHTML = xmlHttp.responseText;
if (v_oldname=='ul_editdays'){
   if (document.getElementById('work_l1').value>0){
     initialize_vk(0,document.getElementById('work_l1').value,document.getElementById('work_l2').value);
   }}
if (v_oldname=='ul_newdays'){
     initialize_vk(1,0,0);
}
if (v_oldname=='ul_editstatii'){
    uploadfile('ul_savestatii.php?'+v_oldparam.substr(1,v_oldparam.length));
}
if (v_oldname=='ul_setup'){
    uploadpicture_vk('ul_savesetuppic.php',v_lekar);
}
if (v_oldname=='ul_gallery_pics'){
}
}
else
{
}
}
}
function virtualcab(name,params,lekar)
{
if (xmlHttp)
{
try
{
myDiv = document.getElementById("private_content");
v_oldname= name;
v_oldparam= params;
v_lekar=lekar;
myDiv.innerHTML = '<img style="margin-left:320px;margin-top:220px" src="images/wait.gif" width="64" height="44" />';
//alert(name + ".php"  + "?lekar="+ lekar + params);
xmlHttp.open("GET",name + ".php"  + "?lekar="+ lekar + params, true);
xmlHttp.onreadystatechange = handleRequestStatevirtualcab;
xmlHttp.send(null);
}
catch (e)
{
alert("Възникна грешка, опитайте отново");
}
}
}
var v_id;
function handleRequestStateSavecab()
{
if (xmlHttp.readyState == 4)
{
if (xmlHttp.status == 200)
{
if ((v_name=='uh_addanketa')||(v_name=='uh_newansw')||(v_name=='uh_a_up')||(v_name=='uh_a_down')||(v_name=='uh_a_del')){
  if (v_name=='uh_addanketa'){
    cont = xmlHttp.responseText;
    if (cont.indexOf("Грешка")>=0){
       myDiv = document.getElementById("d_error");
    } else {
       myDiv = document.getElementById("private_content");
    }
    myDiv.innerHTML = cont;
  } else {
     virtualcab(v_old,'&q='+v_id,v_lekar);
  }
} else {
  virtualcab(v_old,'',v_lekar);
}
}
else
{
}
}
}
function savevirtualcab_ans(name,old,id,lekar,hid,param1,param2,param3,param4,param5,param6,file)
{
if (xmlHttp)
{
try
{
v_old=old;
v_lekar=hid;
v_id=id;
v_name=name;
params='';
if ((name!='ul_saveworkdays')&&(name!='ul_savesetup')&&(name!='uh_savesetup')&&(name!='uh_newankt')&&(name!='uh_newotd')&&(name!='uh_saveankt')&&(name!='uh_newansw')&&(name!='uh_addanketa')){
if (document.getElementById(param1+id)!=null){
   vl=document.getElementById(param1+id).value;
   params=params+'&'+param1+'='+encodeURIComponent(vl);
}
if (document.getElementById(param3+id)!=null){
   vl=document.getElementById(param3+id).value;
   params=params+'&'+param3+'='+encodeURIComponent(vl);
}
if (param2!='FCK'){
if (document.getElementById(param2+id)!=null){
   vl=document.getElementById(param2+id).value;
   params=params+'&'+param2+'='+encodeURIComponent(vl);
}}
else{
   vl=FCKeditorAPI.GetInstance('1').GetHTML(true);
   params=params+'&'+'source='+encodeURIComponent(vl);
}
if (document.getElementById(param4+id)!=null){
   vl=document.getElementById(param4+id).value;
   params=params+'&'+param4+'='+encodeURIComponent(vl);
}
if (document.getElementById(param5+id)!=null){
   vl=document.getElementById(param5+id).value;
   params=params+'&'+param5+'='+encodeURIComponent(vl);
}
if (document.getElementById(param6+id)!=null){
   vl=document.getElementById(param6+id).value;
   params=params+'&'+param6+'='+encodeURIComponent(vl);
}
if (document.getElementById(file)!=null){
   v_file=document.getElementById(file).innerHTML;
   params=params+'&file='+encodeURIComponent(v_file);
}
}
else{
    var elms = document.getElementById('savedays').elements;
    for(var i = 0, maxI = elms.length; i < maxI; ++i) {
    var elm = elms[i];
        switch(elm.type) {
          case "text":params=params+'&'+elm.id+'='+encodeURIComponent(elm.value);break;
          case "hidden":params=params+'&'+elm.id+'='+encodeURIComponent(elm.value);break;
          case "textarea":params=params+'&'+elm.id+'='+encodeURIComponent(elm.value);break;
          case "radio":params=params+'&'+elm.id+'='+encodeURIComponent(elm.value);break;
          case "select-one":params=params+'&'+elm.id+'='+encodeURIComponent(elm.value);break;
          case "select-multiple":params=params+'&'+elm.id+'='+encodeURIComponent(elm.value);break;
          case "checkbox":params=params+'&'+elm.id+'='+elm.checked;break;
        }
    }
}
params = "id="+ id +"&lekar="+ lekar +"&hid="+ hid + params;
xmlHttp.open("POST",name + ".php", true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=windows-1251");
//xmlHttp.setRequestHeader("Accept-Charset", "windows-1251");
xmlHttp.setRequestHeader("Content-length", params.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.onreadystatechange = handleRequestStateSavecab;
xmlHttp.send(params);
}
catch (e)
{
alert("Възникна грешка, опитайте отново");
}
}
}
function savevirtualcab(name,old,id,lekar,param1,param2,param3,param4,param5,param6,file)
{
if (xmlHttp)
{
try
{
v_old=old;
v_lekar=lekar;
v_id=id;
v_name=name;
params='';
if ((name!='ul_saveworkdays')&&(name!='ul_savepic')&&(name!='ul_savesetup')&&(name!='uh_savesetup')&&(name!='uh_newotd')&&(name!='uh_newankt')&&(name!='uh_saveankt')&&(name!='uh_newansw')&&(name!='uh_addanketa')){
if (document.getElementById(param1+id)!=null){
   vl=document.getElementById(param1+id).value;
   params=params+'&'+param1+'='+encodeURIComponent(vl);
}
if (document.getElementById(param3+id)!=null){
   vl=document.getElementById(param3+id).value;
   params=params+'&'+param3+'='+encodeURIComponent(vl);
}
if (param2!='FCK'){
if (document.getElementById(param2+id)!=null){
   vl=document.getElementById(param2+id).value;
   params=params+'&'+param2+'='+encodeURIComponent(vl);
}}
else{
   vl=FCKeditorAPI.GetInstance('1').GetHTML(true);
   params=params+'&'+'source='+encodeURIComponent(vl);
}
if (document.getElementById(param4+id)!=null){
   vl=document.getElementById(param4+id).value;
   params=params+'&'+param4+'='+encodeURIComponent(vl);
}
if (document.getElementById(param5+id)!=null){
   vl=document.getElementById(param5+id).value;
   params=params+'&'+param5+'='+encodeURIComponent(vl);
}
if (document.getElementById(param6+id)!=null){
   vl=document.getElementById(param6+id).value;
   params=params+'&'+param6+'='+encodeURIComponent(vl);
}
if (document.getElementById(file)!=null){
   v_file=document.getElementById(file).innerHTML;
   params=params+'&file='+encodeURIComponent(v_file);
}
}
else{
    var elms = document.getElementById('savedays').elements;
    for(var i = 0, maxI = elms.length; i < maxI; ++i) {
    var elm = elms[i];
        switch(elm.type) {
          case "text":params=params+'&'+elm.id+'='+encodeURIComponent(elm.value);break;
          case "hidden":params=params+'&'+elm.id+'='+encodeURIComponent(elm.value);break;
          case "textarea":params=params+'&'+elm.id+'='+encodeURIComponent(elm.value);break;
          case "radio":params=params+'&'+elm.id+'='+encodeURIComponent(elm.value);break;
          case "select-one":params=params+'&'+elm.id+'='+encodeURIComponent(elm.value);break;
          case "select-multiple":params=params+'&'+elm.id+'='+encodeURIComponent(elm.value);break;
          case "checkbox":params=params+'&'+elm.id+'='+elm.checked;break;
        }
    }
}
params = "id="+ id +"&lekar="+ lekar + params;
xmlHttp.open("POST",name + ".php", true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=windows-1251");
//xmlHttp.setRequestHeader("Accept-Charset", "windows-1251");
xmlHttp.setRequestHeader("Content-length", params.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.onreadystatechange = handleRequestStateSavecab;
xmlHttp.send(params);
}
catch (e)
{
alert("Възникна грешка, опитайте отново");
}
}
}
function handleRequestStateDeletecab()
{
if (xmlHttp.readyState == 4)
{
if (xmlHttp.status == 200)
{
virtualcab(v_old,'',v_lekar);
}
else
{
}
}
}
function deletevirtualcab(name,old,id,lekar,temp)
{
if (xmlHttp)
{
try
{
v_old=old;
v_lekar=lekar;
xmlHttp.open("GET",name + ".php"  + "?id="+ id+'&file='+temp, true);
xmlHttp.onreadystatechange = handleRequestStateDeletecab;
xmlHttp.send(null);
}
catch (e)
{
alert("Възникна грешка, опитайте отново");
}
}
}
function handleRequestStateNewcab()
{
if (xmlHttp.readyState == 4)
{
if (xmlHttp.status == 200)
{
if (v_old==''){
myDiv = document.getElementById("private_content");
myDiv.innerHTML = xmlHttp.responseText;
}else{
virtualcab(v_old,v_oldparam,v_lekar);
}
}
else
{
}
}
}
function newvirtualcab(name,old,lekar,user,param1,param2,param3,param4,param5,param6,file)
{
if (xmlHttp)
{
try
{
v_old=old;
if (old=='ul_msg_id'){
  v_oldparam='&id='+document.getElementById(param2+'0').value;;
}  
v_lekar=lekar;
params='';
if ((name!='ul_newsavedays')&&(name!='uh_newn')&&(name!='uh_saven')){
if (document.getElementById(param1+'0')!=null){
   vl=document.getElementById(param1+'0').value;
   params=params+'&'+param1+'='+encodeURIComponent(vl);
}
if (param2!='FCK'){
if (document.getElementById(param2+'0')!=null){
   vl=document.getElementById(param2+'0').value;
   params=params+'&'+param2+'='+encodeURIComponent(vl);
}}
else{
   vl=FCKeditorAPI.GetInstance('1').GetHTML(true);
   params=params+'&'+'source='+encodeURIComponent(vl);
}
if (document.getElementById(param3+'0')!=null){
   vl=document.getElementById(param3+'0').value;
   params=params+'&'+param3+'='+encodeURIComponent(vl);
}
if (document.getElementById(param4+'0')!=null){
   vl=document.getElementById(param4+'0').value;
   params=params+'&'+param4+'='+encodeURIComponent(vl);
}
if (document.getElementById(param5+'0')!=null){
   vl=document.getElementById(param5+'0').value;
   params=params+'&'+param5+'='+encodeURIComponent(vl);
}
if (document.getElementById(param6+'0')!=null){
   vl=document.getElementById(param6+'0').value;
   params=params+'&'+param6+'='+encodeURIComponent(vl);
}
if (document.getElementById(file)!=null){
   v_file=document.getElementById(file).innerHTML;
   params=params+'&file='+encodeURIComponent(v_file);
}
}
else{
if ((name=='uh_newn')||(name=='uh_saven')){
 if (document.getElementById('name').value==''){
   alert('Заглавието е задължително!');
   return;
 }
}
    var elms = document.getElementById('savedays').elements;
    for(var i = 0, maxI = elms.length; i < maxI; ++i) {
    var elm = elms[i];
        switch(elm.type) {
          case "text":params=params+'&'+elm.id+'='+encodeURIComponent(elm.value);break;
          case "hidden":params=params+'&'+elm.id+'='+encodeURIComponent(elm.value);break;
          case "textarea":params=params+'&'+elm.id+'='+encodeURIComponent(elm.value);break;
          case "radio":params=params+'&'+elm.id+'='+encodeURIComponent(elm.value);break;
          case "select-one":params=params+'&'+elm.id+'='+encodeURIComponent(elm.value);break;
          case "select-multiple":params=params+'&'+elm.id+'='+encodeURIComponent(elm.value);break;
          case "checkbox":params=params+'&'+elm.id+'='+elm.checked;break;
        }
    }
if (param2=='FCK')
{
   vl=FCKeditorAPI.GetInstance('1').GetHTML(true);
   params=params+'&'+'source='+encodeURIComponent(vl);
}
}
params = "lekar="+lekar+'&user='+user + params;
xmlHttp.open("POST",name + ".php", true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded;");
//xmlHttp.setRequestHeader("Accept-Charset", "windows-1251");
xmlHttp.setRequestHeader("Content-length", params.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.onreadystatechange = handleRequestStateNewcab;
xmlHttp.send(params);
}
catch (e)
{
alert("Възникна грешка, опитайте отново");
}
}
}
function uploadfile(link){
    new AjaxUpload('#button3', {
		action: link,
		name: 'userfile',
		onComplete : function(file, response){
			myDiv = document.getElementById("upfiles");
            myDiv.innerHTML = response;
            myDiv.style.color = "green";
            document.getElementById("clr").style.visibility="visible";
		},
    	onSubmit : function(file , ext){
                if (ext && /^(doc|pdf|DOC|PDF)$/.test(ext)){
                    myDiv = document.getElementById("upfiles");
                    myDiv.innerHTML = 'Качване на '+file;
                    myDiv.style.color = "darkorange";
				} else {
		        	myDiv = document.getElementById("upfiles");
                    myDiv.innerHTML = 'Разрешени за качване са само файлове (DOC, PDF)';
                    myDiv.style.color = "red";
					return false;
				}
			}
	});
}
function uploadpicture(link){
    new AjaxUpload('#button3', {
		action: link,
		name: 'userfile',
		onComplete : function(file){
			myDiv = document.getElementById("upfiles");
            myDiv.innerHTML = file;
            myDiv.style.color = "green";
            document.getElementById("clr").style.visibility="visible";
		},
    	onSubmit : function(file , ext){
                if (ext && /^(jpg|JPG)$/.test(ext)){
                    myDiv = document.getElementById("upfiles");
                    myDiv.innerHTML = 'Качване на '+file;
                    myDiv.style.color = "darkorange";
				} else {
		        	myDiv = document.getElementById("upfiles");
                    myDiv.innerHTML = 'Разрешени за качване са само файлове (JPG)';
                    myDiv.style.color = "red";
					return false;
				}
			}
	});
}

function uploadpicture_adv(){
    new AjaxUpload('#button3', {
		action: 'uploadadv_pic.php',
		name: 'userfile',
		onComplete : function(file, response){
			myDiv = document.getElementById("upfiles");
            myDiv.value = response;
            myDiv.style.color = "green";
			pic = document.getElementById("pic");
            pic.src = response;
		},
    	onSubmit : function(file , ext){
                if (ext && /^(jpg|JPG)$/.test(ext)){
                    myDiv = document.getElementById("upfiles");
                    myDiv.value = 'Качване на '+file;
                    myDiv.style.color = "darkorange";
				} else {
		        	myDiv = document.getElementById("upfiles");
                    myDiv.value = 'Error: Разрешени за качване са само файлове (JPG)';
                    myDiv.style.color = "red";
					return false;
				}
			}
	});
}

function uploadpicture_vk(link,lekar){
    new AjaxUpload('#button3', {
		action: link,
		name: 'userfile',
		onComplete : function(file){
            alert('Снимката ще бъде одобрена с рамките на един ден.');
            virtualcab('ul_setup','',lekar);
            //document.getElementById("clr").style.visibility="visible";
		},
    	onSubmit : function(file , ext){
                if (ext && /^(jpg|JPG)$/.test(ext)){
                    myDiv = document.getElementById("upfiles");
                    //myDiv.innerHTML = 'Качване на '+file;
                    myDiv.style.color = "darkorange";
				} else {
		        	myDiv = document.getElementById("upfiles");
                    //myDiv.innerHTML = 'Разрешени за качване са само файлове (JPG)';
                    myDiv.style.color = "red";
					return false;
				}
			}
	});
}
var v_replyid;
function post_reply_state()
{
if (xmlHttp.readyState == 4)
{
if (xmlHttp.status == 200)
{
myDiv = document.getElementById("reply_"+v_replyid);
myDiv.innerHTML = xmlHttp.responseText;
}
else
{
}
}
}
function post_reply(id)
{
if (xmlHttp)
{
try
{
myDiv = document.getElementById("cont_"+id);
myDiv.style.display="block";
v_replyid=id;
xmlHttp.open("GET","get_reply.php"  + "?id="+ id, true);
xmlHttp.onreadystatechange = post_reply_state;
xmlHttp.send(null);
}
catch (e)
{
//alert("Възникна грешка, опитайте отново");
}
}
}
function ins_reply_state()
{
if (xmlHttp.readyState == 4)
{
if (xmlHttp.status == 200)
{
post_reply(v_replyid);
}
else
{
}
}
}
function ins_reply(id)
{
if (xmlHttp)
{
try
{
var elms = document.getElementById('content'+id).value;
params = "id="+id+"&content="+encodeURIComponent(elms);
v_replyid=id;
xmlHttp.open("POST","ins_reply.php", true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded;");
xmlHttp.onreadystatechange = ins_reply_state;
xmlHttp.setRequestHeader("Content-length", params.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(params);
}
catch (e)
{
//alert("Възникна грешка, опитайте отново");
}
}
}
function handleRequestStateGlobalvirtualcab()
{
if (xmlHttp.readyState == 4)
{
if (xmlHttp.status == 200)
{
myDiv = document.getElementById("global_content");
myDiv.innerHTML = xmlHttp.responseText;
if (v_oldname=='ulg_setup'){
    uploadpicture_vk('ul_savesetuppic.php',v_lekar);
}
}
else
{
}
}
}
function globalvirtualcab(obj,name,params,lekar)
{
obj.className = "selected";
if ((obj.id!='info')&&(document.getElementById("info")!=null)){
document.getElementById("info").className = "";
}
if ((obj.id!='marks')&&(document.getElementById("marks")!=null)){
document.getElementById("marks").className = "";
}
if ((obj.id!='setup')&&(document.getElementById("setup")!=null)){
document.getElementById("setup").className = "";
}
if ((obj.id!='msgs')&&(document.getElementById("msgs")!=null)){
document.getElementById("msgs").className = "";
}
if ((obj.id!='anketa')&&(document.getElementById("anketa")!=null)){
document.getElementById("anketa").className = "";
}
if ((obj.id!='news')&&(document.getElementById("news")!=null)){
document.getElementById("news").className = "";
}
if (xmlHttp)
{
try
{
myDiv = document.getElementById("global_content");
v_oldname= name;
v_oldparam= params;
v_lekar=lekar;
myDiv.innerHTML = '<img style="margin-left:320px;margin-top:220px" src="images/wait.gif" width="64" height="44" />';
//alert(name + ".php"  + "?lekar="+ lekar + params);
xmlHttp.open("GET",name + ".php"  + "?lekar="+ lekar + params, true);
xmlHttp.onreadystatechange = handleRequestStateGlobalvirtualcab;
xmlHttp.send(null);
}
catch (e)
{
alert("Възникна грешка, опитайте отново");
}
}
}
function handleRequestStatenewmark()
{
if (xmlHttp.readyState == 4)
{
if (xmlHttp.status == 200)
{
res=xmlHttp.responseText;
if (res=='OK'){
globalvirtualcab(document.getElementById("marks"),'ulg_marks','',v_lekar)
}else{
alert(res);
}
}
else
{
}
}
}
function newmark(lekar){
v_lekar=lekar;
if (xmlHttp)
{
try
{
params='&lekar='+lekar;
if (document.getElementById('rating1')!=null){
   vl=document.getElementById('rating1').value;
   params=params+'&'+'prof'+'='+encodeURIComponent(vl);
}
if (document.getElementById('rating2')!=null){
   vl=document.getElementById('rating2').value;
   params=params+'&'+'rell'+'='+encodeURIComponent(vl);
}
if (document.getElementById('rating3')!=null){
   vl=document.getElementById('rating3').value;
   params=params+'&'+'rez'+'='+encodeURIComponent(vl);
}
if (document.getElementById('comm')!=null){
   vl=document.getElementById('comm').value;
   params=params+'&'+'comm'+'='+encodeURIComponent(vl);
}
xmlHttp.open("POST","newmark.php", true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=windows-1251");
xmlHttp.setRequestHeader("Content-length", params.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.onreadystatechange = handleRequestStatenewmark;
xmlHttp.send(params);
}
catch (e)
{
alert("Възникна грешка, опитайте отново");
}
}
}
function handleRequestStatesearch_vk()
{
if (xmlHttp.readyState == 4)
{
if (xmlHttp.status == 200)
{
myDiv = document.getElementById("vk_result");
myDiv.innerHTML = xmlHttp.responseText;
}
else
{
}
}
}
function search_vk(name){
if ((name.length > 0)&&(name.length < 3)) {return;}
if (xmlHttp)
{
try
{
params='&name='+name;
if (document.getElementById('grad')!=null){
   vl=document.getElementById('grad').value;
   params=params+'&'+'grad'+'='+encodeURIComponent(vl);
}
if (document.getElementById('spec')!=null){
   vl=document.getElementById('spec').value;
   params=params+'&'+'spec'+'='+encodeURIComponent(vl);
}
xmlHttp.open("POST","search_vk.php", true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=windows-1251");
xmlHttp.setRequestHeader("Content-length", params.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.onreadystatechange = handleRequestStatesearch_vk;
xmlHttp.send(params);
}
catch (e)
{
alert("Възникна грешка, опитайте отново");
}
}
}
function handleRequestStatesearch_reg_lekari()
{
if (xmlHttp.readyState == 4)
{
if (xmlHttp.status == 200)
{
myDiv = document.getElementById("reg_lekar");
myDiv.innerHTML = xmlHttp.responseText;
}
else
{
}
}
}
function search_reg_lekar(name,specid,grad){
if ((name.length > 0)&&(name.length < 3)) {return;}
if (xmlHttp)
{
try
{
params='&name='+name+'&grad'+'='+encodeURIComponent(grad)+'&specid'+'='+encodeURIComponent(specid);
xmlHttp.open("POST","search_reg_lekari.php", true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=windows-1251");
xmlHttp.setRequestHeader("Content-length", params.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.onreadystatechange = handleRequestStatesearch_reg_lekari;
xmlHttp.send(params);
}
catch (e)
{
alert("Възникна грешка, опитайте отново");
}
}
}
function handleRequestStatesearch_all_obj()
{
if (xmlHttp.readyState == 4)
{
if (xmlHttp.status == 200)
{
myDiv = document.getElementById("search_rez");
myDiv.innerHTML = xmlHttp.responseText;
}
else
{
}
}
}
function search_all_obj(name){
if ((name.length > 0)&&(name.length < 3)) {return;}
if (xmlHttp)
{
try
{
myDiv = document.getElementById("search_rez");
myDiv.innerHTML = '<center><div style="font-size:10px;color:silver">Моля изчакайте, търси ...</div></center>';
params='&name='+name;
var domain = "http://" + "<_?php echo $_SERVER['HTTP_HOST'] ?_>";
xmlHttp.open("POST","search_all_obj.php", true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=windows-1251");
xmlHttp.setRequestHeader("Content-length", params.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.onreadystatechange = handleRequestStatesearch_all_obj;
xmlHttp.send(params);
}
catch (e)
{
alert("Възникна грешка, опитайте отново");
}
}
}
function handleRequestStatecheckwebsite()
{
if (xmlHttp.readyState == 4)
{
if (xmlHttp.status == 200)
{
alert(xmlHttp.responseText);
}
else
{
}
}
}
function checkwebsite(name){
if (xmlHttp)
{
try
{
var temp1=name.toUpperCase();
if (temp1.search('HTTP://')==-1){
  name='http://'+name;
  document.getElementById("website_link").value='http://'+document.getElementById("website_link").value;
}
params='&website='+name;
xmlHttp.open("POST","checkwebsite.php", true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=windows-1251");
xmlHttp.setRequestHeader("Content-length", params.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.onreadystatechange = handleRequestStatecheckwebsite;
xmlHttp.send(params);
}
catch (e)
{
alert("Възникна грешка, опитайте отново");
}
}
}
function handleRequestStatelist_like()
{
if (xmlHttp.readyState == 4)
{
if (xmlHttp.status == 200)
{
myDiv = document.getElementById("list_like");
myDiv.innerHTML = xmlHttp.responseText;
}
else
{
}
}
}
function list_like_obj(name){
if (xmlHttp)
{
try
{
myDiv = document.getElementById("list_like");
params='&name='+name;
var domain = "http://" + "<_?php echo $_SERVER['HTTP_HOST'] ?_>";
xmlHttp.open("POST","list_like_obj.php", true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=windows-1251");
xmlHttp.setRequestHeader("Content-length", params.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.onreadystatechange = handleRequestStatelist_like;
xmlHttp.send(params);
}
catch (e)
{
alert("Възникна грешка, опитайте отново");
}
}
}
function handleRequestStatelist_obj_marks()
{
if (xmlHttp.readyState == 4)
{
if (xmlHttp.status == 200)
{
myDiv = document.getElementById("list_obj_marks");
myDiv.innerHTML = xmlHttp.responseText;
}
else
{
}
}
}
function list_obj_marks(gr,t,name,order){
if ((name.length > 0)&&(name.length < 3)) {return;}
if (xmlHttp)
{
try
{
myDiv = document.getElementById("search_rez");
myDiv.innerHTML = '<center><div style="font-size:10px;color:silver">Моля изчакайте, търси ...</div></center>';
params='&GR='+gr+'&T='+t+'&NAME='+name+'&O='+order;
xmlHttp.open("POST","list_obj_marks.php", true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=windows-1251");
xmlHttp.setRequestHeader("Content-length", params.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.onreadystatechange = handleRequestStatelist_obj_marks;
xmlHttp.send(params);
}
catch (e)
{
alert("Възникна грешка, опитайте отново");
}
}
}
function handleRequestStateshow_hid_alert()
{
if (xmlHttp.readyState == 4)
{
if (xmlHttp.status == 200)
{
document.getElementById('alert_hid').style.display='none';
if (xmlHttp.responseText!=''){
alert(xmlHttp.responseText);
}
}
else
{
}
}
}
function show_hid_alert(gr,hid,userid){
if (xmlHttp)
{
try
{
var txt_alert = document.getElementById("txt_alert").value;
params='&gr='+gr+'&hid='+hid+'&userid='+userid+'&text='+txt_alert;
xmlHttp.open("POST","ins_alert.php", true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=windows-1251");
xmlHttp.setRequestHeader("Content-length", params.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.onreadystatechange = handleRequestStateshow_hid_alert;
xmlHttp.send(params);
}
catch (e)
{
alert("Възникна грешка, опитайте отново");
}
}
}
var v_month;
var v_year;
function handleRequestStateopenmonth()
{
if (xmlHttp.readyState == 4)
{
if (xmlHttp.status == 200)
{
myDiv = document.getElementById("calendar_obj");
myDiv.innerHTML = xmlHttp.responseText;
if (xmlHttp)
{
try
{
params='&month='+v_month+'&year='+v_year;
xmlHttp.open("POST","openmonthlist.php", true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=windows-1251");
xmlHttp.setRequestHeader("Content-length", params.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.onreadystatechange = handleRequestStateopenmonthlist;
xmlHttp.send(params);
}
catch (e)
{
alert("Възникна грешка, опитайте отново");
}
}
}
else
{
}
}
}
function handleRequestStateopenmonthlist()
{
if (xmlHttp.readyState == 4)
{
if (xmlHttp.status == 200)
{
myDiv = document.getElementById("calendar_list");
myDiv.innerHTML = xmlHttp.responseText;
}
else
{
}
}
}
function openmonth(month,year){
if (xmlHttp)
{
try
{
v_month=month;
v_year=year;
params='&month='+month+'&year='+year;
xmlHttp.open("POST","openmonth.php", true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=windows-1251");
xmlHttp.setRequestHeader("Content-length", params.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.onreadystatechange = handleRequestStateopenmonth;
xmlHttp.send(params);
}
catch (e)
{
alert("Възникна грешка, опитайте отново");
}
}
}
function open_hide_div(name){
arr_nodes = document.getElementsByTagName('div');
for (i = 0; i < arr_nodes.length; i++) {
obj_node = arr_nodes[i];
var id_ = obj_node.id;
if (id_.indexOf("_div")>2) {
  obj_node.style.display = 'none';
}
}
document.getElementById(name).style.display = 'block';
}
function showsearchtab(obj)
{
obj.className = "selected";
if ((obj.id!='alekar')&&(document.getElementById("alekar")!=null)){
document.getElementById("alekar").className = "";
document.getElementById("lz").style.display = 'block';
document.getElementById("lekar").style.display = 'none';
}
if ((obj.id!='alz')&&(document.getElementById("alz")!=null)){
document.getElementById("alz").className = "";
document.getElementById("lekar").style.display = 'block';
document.getElementById("lz").style.display = 'none';
}
}
function showsearchtab_rez(obj)
{
obj.className = "selected";
if ((obj.id!='rez_list')&&(document.getElementById("rez_list")!=null)){
document.getElementById("rez_list").className = "";
document.getElementById("div_map").style.display = 'block';
document.getElementById("div_list").style.display = 'none';
}
if ((obj.id!='rez_map')&&(document.getElementById("rez_map")!=null)){
document.getElementById("rez_map").className = "";
document.getElementById("div_list").style.display = 'block';
document.getElementById("div_map").style.display = 'none';
}
}

function showlayer(layer){
var myLayer = document.getElementById(layer);
if(myLayer.style.display=="none" || myLayer.style.display==""){
myLayer.style.display="block";
} else {
myLayer.style.display="none";
}
}
function imposeMaxLength(Object, MaxLen)
{
  return (Object.value.length <= MaxLen);
}

