function showStyles(cats)
{
   style='';
   func = '';
   style +='<style type="text/css">';
   for(i=0;i<cats.length;i++)
   {
       style +='#caja_'+cats[i]+' { width:250px; display: none; }';
       style +='#mostrar_'+cats[i]+' { display:block;width:250px;padding:0px;border:none 1px; }';
       func += '<script>$(function() { $("#mostrar_'+cats[i]+'").click(function(event) { event.preventDefault(); $("#caja_'+cats[i]+'").slideToggle(); showDiv(\'cat_'+cats[i]+'\'); }); $("#caja_'+cats[i]+' a").click(function(event) { event.preventDefault(); $("#caja_'+cats[i]+'").slideUp(); showDiv(\'cat_'+cats[i]+'\');}); });</script>';
   }
   style +='</style>';
   document.write(style);
   document.write(func);
}
//showDiv(\'cat_'+cats[i]+'\');
function showDiv(obj)
{
   if(document.getElementById(obj).style.display == 'block') document.getElementById(obj).style.display='none';
   else
   {
      document.getElementById(obj).style.display='block';
   }
}
     

var ldr=null;
var ldr2=null;

function selector()
{
   var A=null;
   try
   {
      A=new ActiveXObject("Msxml2.XMLHTTP");
   }
   catch(e)
   {
      try
      {
         A=new ActiveXObject("Microsoft.XMLHTTP");
      }
      catch(oc)
      {
         A=null;
      }
   }
   if(!A&&typeof XMLHttpRequest!="undefined")
   {
      A=new XMLHttpRequest();
   }
   return A;
}

function selector2()
{
   var A=null;
   try
   {
      A=new ActiveXObject("Msxml2.XMLHTTP");
   }
   catch(e)
   {
      try
      {
         A=new ActiveXObject("Microsoft.XMLHTTP");
      }
      catch(oc)
      {
         A=null;
      }
   }
   if(!A&&typeof XMLHttpRequest!="undefined")
   {
      A=new XMLHttpRequest();
   }
   return A;
}

function add(sel,v,n)
{
   var newOpt=sel.appendChild(document.createElement('option'));
   newOpt.text=n;
   newOpt.value=v;
}


function chan(lng, f,name,qw,parm)
{
  if(ldr && ldr.readyState!=0) { ldr.abort() }
  ldr=selector();

  if(ldr)
  {
    name.length = 0;
    ff = document.getElementById('attrvalue'); //alert(qw);
    //document.write("/actions.php?action=getAttribs&q="+parm+"&sel="+qw+"&lng="+lng);
    
    ldr.open("GET","/actions.php?action=getAttribs&q="+parm+"&sel="+qw+"&lng="+lng,true);
    ldr.onreadystatechange=function()
    {
      if(ldr.readyState>=0 && ldr.readyState<4)
      {
         //add(ff, '', 'Р�РґС‘С‚ Р·Р°РіСЂСѓР·РєР° Р·РЅР°С‡РµРЅРёР№...');
         if(document.getElementById('attrib_select_1')) document.getElementById('attrib_select_1').innerHTML = 'Р�РґС‘С‚ Р·Р°РіСЂСѓР·РєР° Р·РЅР°С‡РµРЅРёР№...';
      }
      else if(ldr.readyState==4 && ldr.responseText)
      {
         //eval(ldr.responseText);
         if(lng > 0) choose = 'Р’С‹Р±РµСЂiС‚СЊ Р·РЅР°С‡РµРЅРЅСЏ';
         else choose = 'Р’С‹Р±РµСЂРёС‚Рµ Р·РЅР°С‡РµРЅРёРµ';
         if(document.getElementById('attrib_select_1')) document.getElementById('attrib_select_1').innerHTML = choose;
         document.getElementById('attrib_vals_1').innerHTML = ldr.responseText;
         //alert(ldr.responseText);
      }
    }
    ldr.send(null)
  }
}

function showNewsIndex()
{
   if(ldr && ldr.readyState!=0) { ldr.abort() }
   ldr=selector();
   bl = 'ajax_block';
   bl2 = 'status_n';
   if(ldr)
   {
      ldr.open("GET","/actions.php?action=showNewsIndex",true);

      ldr.onreadystatechange=function()
      {
         if(ldr.readyState==4 && ldr.responseText)
         {
            document.getElementById(bl).innerHTML = ldr.responseText;
            document.getElementById(bl2).innerHTML = '';
         }
         else if(ldr.readyState > 0 && ldr.readyState < 4)
         {
            document.getElementById(bl2).innerHTML = '<img src="/i/working.gif" />';
         }
      }
      ldr.send(null);
   }
}


function showOfferGroup(id,id2)
{
   if(ldr && ldr.readyState!=0) { ldr.abort() }
   ldr=selector();
   bl = 'ajax_block';
   bl2 = 'status_n';
   if(ldr)
   {
      ldr.open("GET","/actions.php?action=showOfferGroup&gid="+id+"&gid2="+id2,true);

      ldr.onreadystatechange=function()
      {
         if(ldr.readyState==4 && ldr.responseText)
         {
            document.getElementById(bl).innerHTML = ldr.responseText;
            document.getElementById(bl2).innerHTML = '';
			fixTrans();
         }
         else if(ldr.readyState > 0 && ldr.readyState < 4)
         {
            document.getElementById(bl2).innerHTML = '<img src="/i/working.gif" />';
         }
      }
      ldr.send(null);
   }
}




function setCookie (name, value, path, expires, domain, secure)
{
   document.cookie = name + "=" + escape(value) +
   ((expires) ? "; expires=" + expires : "") +
   ((path) ? "; path=" + path : "") +
   ((domain) ? "; domain=" + domain : "") +
   ((secure) ? "; secure" : "");
}

function cookieVal(cookieName)
{
  thisCookie = document.cookie.split("; ")
  for(i = 0; i < thisCookie.length; i++)
  {
      if(cookieName == thisCookie[i].split("=")[0])
      {
         return thisCookie[i].split("=")[1];
      }
  }
  return 0;
}

function getCartCount()
{
   if(ldr && ldr.readyState!=0) { ldr.abort() }
   ldr=selector();
   if(ldr)
   {
      ldr.open("GET","/actions.php?action=cartCount",true);
      
      ldr.onreadystatechange=function()
      {
         if(ldr.readyState==4 && ldr.responseText)
         {
            return ldr.responseText;
         }
      }
      ldr.send(null);
   }
}

function add2Cart(id, image,image2,lng,image3, attr_ischoise)
{
	
	//alert(123222);
	
 //if(cookieVal('vasilek_add2Cart') == 1) return false;  //Р”СЂСѓРіРѕР№ С‚РѕРІР°СЂ СѓР¶Рµ РґРѕР±Р°РІР»СЏРµС‚СЃСЏ РІ РєРѕСЂР·РёРЅСѓ,Р±Р»РѕРєРёСЂСѓРµРј РґРѕР±Р°РІР»РµРЅРёРµ РґСЂСѓРіРѕРіРѕ РґРѕ РїРѕР»СѓС‡РµРЅРёСЏ РѕС‚РІРµС‚Р°
  

     //Р’СЃРµ РћРљ, Р±Р»РѕРєРёСЂСѓРµРј РєРѕСЂР·РёРЅСѓ
     setCookie ('vasilek_add2Cart', 1, '/'); //РќР° РґРѕР±Р°РІР»РµРЅРёРµ
     setCookie ('vasilek_delCart', 1, '/');  //РќР° СѓРґР°Р»РµРЅРёРµ
     var cartCount = parseInt(cookieVal('vasilek_cartCount'));
     cartCount++;
     setCookie ('vasilek_cartCount', cartCount, '/'); //alert(cartCount);
     
     var attribs = '';
     if(attr_ischoise!=''){
       var attr_ischoise_ = attr_ischoise.split('_');       
       for(var i in attr_ischoise_){
         var name = 'itm_attr_'+attr_ischoise_[i];
         var sel_name = document.getElementById(name);
         attribs+=sel_name.options[sel_name.selectedIndex].value+'_';
       }
     }
     
     
     
     
     //alert('qweqwe');
     
     if(ldr && ldr.readyState!=0) { ldr.abort() }
     ldr=selector();
     
     
     
     if(ldr)
     {
        bl = "cart_info";
        bl2 = "itm_"+id;                                             
        bl3 = "korzina";

        
        ldr.open("GET","/actions.php?action=add2Cart&item_id="+id+"&attribs="+attribs,true);
        ldr.onreadystatechange=function()
        {
           if(ldr.readyState==4 && ldr.responseText)
           {
              if(image) document.getElementById(bl2).innerHTML = '<a id="cart_'+id+'" class="by" style="background: url('+image+') no-repeat;" href="javascript://" title="'+ldr.responseText+'" onclick="delFromCart(\''+id+'\',\''+image2+'\',\''+image+'\',\''+lng+'\',\''+image3+'\',\''+attr_ischoise+'\')" onmouseover="changeBgCart(\'cart_'+id+'\',\''+image2+'\')" onmouseout="changeBgCart(\'cart_'+id+'\',\''+image+'\')" ></a>';
              else document.getElementById(bl2).innerHTML = '<a id="cart_'+id+'" class="by" style="background: url('+image+') no-repeat;" href="javascript://" title="'+ldr.responseText+'" onclick="delFromCart(\''+id+'\',\''+image2+'\',\'\',\''+lng+'\')" ></a>';

              document.getElementById(bl3).style.display = 'block';
              if(cartInfo(lng))
              {
                 document.getElementById(bl).innerHTML = cartInfo(lng);
              }
              
              //Р Р°Р·Р±Р»РѕРєРёСЂСѓРµРј РєРѕСЂР·РёРЅСѓ
              setCookie ('vasilek_add2Cart', 0, '/');
              setCookie ('vasilek_delCart', 0, '/');
           }
           else
           {
              document.getElementById(bl2).innerHTML = '<a class="by" style="background: url(/i/working.gif) no-repeat;"></a>';
           }
        }
     ldr.send(null);
     }
  
}

function delFromCart(id, image,image2,lng,image3, attr_ischoise)
{
  
//	if(cookieVal('vasilek_delCart') == 1) return false;  //Р”СЂСѓРіРѕР№ С‚РѕРІР°СЂ СѓРґР°Р»СЏРµС‚СЃСЏ РёР·  РєРѕСЂР·РёРЅС‹,Р±Р»РѕРєРёСЂСѓРµРј СѓРґР°Р»РµРЅРёРµРµ РґСЂСѓРіРѕРіРѕ РґРѕ РїРѕР»СѓС‡РµРЅРёСЏ РѕС‚РІРµС‚Р°
  
  
//  else
//  {
     //Р’СЃРµ РћРљ, Р±Р»РѕРєРёСЂСѓРµРј РєРѕСЂР·РёРЅСѓ
     setCookie ('vasilek_delCart', 1, '/'); //РќР° СѓРґР°Р»РµРЅРёРµ
     setCookie ('vasilek_add2Cart', 1, '/'); //РќР° РґРѕР±Р°РІР»РµРЅРёРµ
     var cartCount = parseInt(cookieVal('vasilek_cartCount'));
     cartCount--;
     setCookie ('vasilek_cartCount', cartCount, '/');

     if(ldr&&ldr.readyState!=0) { ldr.abort() }
     ldr=selector();
     if(ldr)
     {
        bl = "cart_info";
        bl2 = "itm_"+id;
        bl3 = "korzina";
        if(image3) over = image3;                                                                                                                                                                                                                                                             
        else over = image;

        ldr.open("GET","/actions.php?action=delFromCart&item_id="+id,true);
        ldr.onreadystatechange=function()
        {
           if(ldr.readyState==4 && ldr.responseText)
           {
              if(image) document.getElementById(bl2).innerHTML = '<a id="cart_'+id+'" class="by" style="background: url('+image+') no-repeat;" title="'+ldr.responseText+'" href="javascript://" onclick="add2Cart(\''+id+'\',\''+image2+'\',\''+image+'\',\''+lng+'\',\''+image3+'\',\''+attr_ischoise+'\')" onmouseover="changeBgCart(\'cart_'+id+'\',\''+over+'\')" onmouseout="changeBgCart(\'cart_'+id+'\',\''+image+'\')"><img border="0" src="/i/card2-active.gif" alt="РљСѓРїРёС‚СЊ"/></a>';
              else document.getElementById(bl2).innerHTML = '<a id="cart_'+id+'" class="by" style="background: url('+image+') no-repeat;" title="'+ldr.responseText+'" href="javascript://" onclick="add2Cart(\''+id+'\',\'\',\'\',\''+lng+'\')"><img border="0" src="/i/card2-active.gif" alt="РљСѓРїРёС‚СЊ"/></a>';

              if(cartInfo(lng))
              {
                 document.getElementById(bl).innerHTML = cartInfo(lng);
              }

              if(cartCount <= 0)
              {
                 document.getElementById(bl3).style.display = 'none';
                 setCookie ('vasilek_cartCount', 0, '/');
                 
              }
              
              //Р Р°Р·Р±Р»РѕРєРёСЂСѓРµРј РєРѕСЂР·РёРЅСѓ
              setCookie ('vasilek_delCart', 0, '/');
              setCookie ('vasilek_add2Cart', 0, '/');
           }
           else
           {
              document.getElementById(bl2).innerHTML = '<a class="by" style="background: url(/i/working.gif) no-repeat;"></a>';
           }
        }
        ldr.send(null);
     }
  //}
}

function add2Cart2(id, image,image2,lng)
{
  if(cookieVal('vasilek_add2Cart') == 1) return false;  //Р”СЂСѓРіРѕР№ С‚РѕРІР°СЂ СѓР¶Рµ РґРѕР±Р°РІР»СЏРµС‚СЃСЏ РІ РєРѕСЂР·РёРЅСѓ,Р±Р»РѕРєРёСЂСѓРµРј РґРѕР±Р°РІР»РµРЅРёРµ РґСЂСѓРіРѕРіРѕ РґРѕ РїРѕР»СѓС‡РµРЅРёСЏ РѕС‚РІРµС‚Р°
  else
  {
     //Р’СЃРµ РћРљ, Р±Р»РѕРєРёСЂСѓРµРј РєРѕСЂР·РёРЅСѓ
     setCookie ('vasilek_add2Cart', 1, '/'); //РќР° РґРѕР±Р°РІР»РµРЅРёРµ
     setCookie ('vasilek_delCart', 1, '/');  //РќР° СѓРґР°Р»РµРЅРёРµ
     var cartCount = parseInt(cookieVal('vasilek_cartCount'));
     cartCount++;
     setCookie ('vasilek_cartCount', cartCount, '/');
     
     if(ldr&&ldr.readyState!=0) { ldr.abort() }
     ldr=selector();
     if(ldr)
     {
        bl = "cart_info";
        bl2 = "litm_"+id;

        ldr.open("GET","/actions.php?action=add2Cart&item_id="+id,true);
        ldr.onreadystatechange=function()
        {
           if(ldr.readyState==4 && ldr.responseText)
           {
              //alert('<a href="javascript://" title="'+ldr.responseText+'" onClick="delFromCart(\''+id+'\',\''+image2+'\',\''+image+'\')"><img src="/i/'+image+'" border="0"/></a>');
              if(image) document.getElementById(bl2).innerHTML = '<a href="javascript://" title="'+ldr.responseText+'" onClick="delFromCart2(\''+id+'\',\''+image2+'\',\''+image+'\',\''+lng+'\')"><img src="/i/'+image+'" border="0"/></a>';
              else document.getElementById(bl2).innerHTML = '<a href="javascript://" title="'+ldr.responseText+'" onClick="delFromCart2(\''+id+'\',\'\',\'\',\''+lng+'\')"><img src="/i/'+image+'" border="0"/></a>';
              if(cartInfo(lng)) document.getElementById(bl).innerHTML = cartInfo(lng);
              //document.getElementById(bl3).style.display = 'inline';
              
              //Р Р°Р·Р±Р»РѕРєРёСЂСѓРµРј РєРѕСЂР·РёРЅСѓ
              setCookie ('vasilek_add2Cart', 0, '/');
              setCookie ('vasilek_delCart', 0, '/');
           }
           else
           {
              document.getElementById(bl2).innerHTML = '<img src="/i/working.gif"/>';
           }
        }
        ldr.send(null);
     }
  }
}

function delFromCart2(id, image,image2,lng)
{
  if(cookieVal('vasilek_delCart') == 1) return false;  //Р”СЂСѓРіРѕР№ С‚РѕРІР°СЂ СѓРґР°Р»СЏРµС‚СЃСЏ РёР·  РєРѕСЂР·РёРЅС‹,Р±Р»РѕРєРёСЂСѓРµРј СѓРґР°Р»РµРЅРёРµРµ РґСЂСѓРіРѕРіРѕ РґРѕ РїРѕР»СѓС‡РµРЅРёСЏ РѕС‚РІРµС‚Р°
  else
  {
     //Р’СЃРµ РћРљ, Р±Р»РѕРєРёСЂСѓРµРј РєРѕСЂР·РёРЅСѓ
     setCookie ('vasilek_delCart', 1, '/'); //РќР° СѓРґР°Р»РµРЅРёРµ
     setCookie ('vasilek_add2Cart', 1, '/'); //РќР° РґРѕР±Р°РІР»РµРЅРёРµ
     var cartCount = parseInt(cookieVal('vasilek_cartCount'));
     cartCount--;
     setCookie ('vasilek_cartCount', cartCount, '/');
     
     if(ldr&&ldr.readyState!=0) { ldr.abort() }
     ldr=selector();
     if(ldr)
     {
        bl = "cart_info";
        bl2 = "litm_"+id;

        ldr.open("GET","/actions.php?action=delFromCart&item_id="+id,true);
        ldr.onreadystatechange=function()
        {
           if(ldr.readyState==4 && ldr.responseText)
           {
              //alert('<a title="'+ldr.responseText+'" href="javascript://" onClick="add2Cart(\''+id+'\',\''+image2+'\',\''+image+'\')"><img src="/i/'+image+'" border="0"/></a>');
              if(image) document.getElementById(bl2).innerHTML = '<a title="'+ldr.responseText+'" href="javascript://" onClick="add2Cart2(\''+id+'\',\''+image2+'\',\''+image+'\',\''+lng+'\')"><img src="/i/'+image+'" border="0"/></a>';
              else document.getElementById(bl2).innerHTML = '<a title="'+ldr.responseText+'" href="javascript://" onClick="add2Cart2(\''+id+'\',\'\',\'\',\''+lng+'\')"><img src="/i/by_ic_green.gif" border="0"/></a>';
              if(cartInfo(lng))
              {
                 document.getElementById(bl).innerHTML = cartInfo(lng);
                 
              }
              //if(cartCount <= 0) document.getElementById(bl3).style.display = 'none';
              
              //Р Р°Р·Р±Р»РѕРєРёСЂСѓРµРј РєРѕСЂР·РёРЅСѓ
              setCookie ('vasilek_delCart', 0, '/');
              setCookie ('vasilek_add2Cart', 0, '/');
           }
           else
           {
              document.getElementById(bl2).innerHTML = '<img src="/i/working.gif"/>';
           }
        }
     ldr.send(null);
     }
  }
}

function cartInfo(lng)
{
  if(ldr2&&ldr2.readyState!=0) { ldr2.abort() }
  ldr2=selector2();
  if(ldr2)
  {
     bll = "cart_info";
     ldr2.open("GET","/actions.php?action=cartInfo&ln="+lng,true);
     ldr2.onreadystatechange=function()
     {
        if(ldr2.readyState==4 && ldr2.responseText)
        {
           //alert(bll + " " +document.getElementById(bll).innerHTML);
           if(document.getElementById(bll) && ldr2.responseText!='') document.getElementById(bll).innerHTML = ldr2.responseText;
           else document.getElementById(bll).innerHTML = '';
        }
        else
        {
           document.getElementById(bll).innerHTML = '&#160;';
        }
     }
     ldr2.send(null);
  }
}

function compare(id,del,lng,image,image2,s)
{
  if(cookieVal('vasilek_compare') == 1) return false;  //Р”СЂСѓРіРѕР№ С‚РѕРІР°СЂ РґРѕР±Р°РІР»СЏРµС‚СЃСЏ РІ СЃСЂР°РІРЅРµРЅРёРµ
  else
  {
     if(s != 1) s = 0;
     setCookie ('vasilek_compare', 1, '/');    //alert(s);
     
     if(ldr&&ldr.readyState!=0) { ldr.abort() }
     ldr=selector();
     if(ldr)
     {
        bl = "cmp_"+id;
        ldr.open("GET","/actions.php?action=compare&item_id="+id+"&del="+del,true);
        ldr.onreadystatechange=function()
        {
           if(ldr.readyState==4 && ldr.responseText)
           {
              if(document.getElementById(bl))
              {
                 if(del == 0)
                 {
                    if(image) document.getElementById(bl).innerHTML = '<a class="scale-link" style="background: url('+image+') no-repeat;" href="javascript://" title="'+ldr.responseText+'" onClick="return compare(\''+id+'\',\'1\',\''+lng+'\',\''+image+'\',\''+image2+'\',\'1\');"><img src="'+image+'" border="0"/></a>';
                    else document.getElementById(bl).innerHTML = '<a class="scale-link" href="javascript://" title="'+ldr.responseText+'" onClick="return compare(\''+id+'\',\'1\',\''+lng+'\');"><img src="'+image+'" border="0"/></a>';
                 }
                 else
                 {
                    if(image) document.getElementById(bl).innerHTML = '<a class="scale-link" href="javascript://" title="'+ldr.responseText+'" onClick="return compare(\''+id+'\',\'0\',\''+lng+'\',\''+image+'\',\''+image2+'\',\'1\');"><img src="'+image+'" border="0"/></a>';
                    else document.getElementById(bl).innerHTML = '<a class="scale-link" href="javascript://" title="'+ldr.responseText+'" onClick="return compare(\''+id+'\',\'0\',\''+lng+'\');"><img src="'+image+'" border="0"/></a>';
                 }
              }
              getCompItems(lng,s);
              setCookie ('vasilek_compare', 0, '/');
           }
           else
           {
            if(document.getElementById(bl)) document.getElementById(bl).innerHTML = '<a class="scale-link" style="background: url(/i/working.gif) no-repeat;"><img src="/i/working.gif"/></a>';
           }
        }
        ldr.send(null)
     }
   }
}

function compare2(id,del,lng)
{
  if(cookieVal('vasilek_compare') == 1) return false;  //Р”СЂСѓРіРѕР№ С‚РѕРІР°СЂ РґРѕР±Р°РІР»СЏРµС‚СЃСЏ РІ СЃСЂР°РІРЅРµРЅРёРµ
  else
  {
     if(ldr&&ldr.readyState!=0) { ldr.abort() }
     ldr=selector();
     if(ldr)
     {
        setCookie ('vasilek_compare', 1, '/');
        bl = "cmp_"+id;

        ldr.open("GET","/actions.php?action=compare&item_id="+id+"&del="+del,true);
        ldr.onreadystatechange=function()
        {
         if(ldr.readyState==4 && ldr.responseText)
         {
            setCookie ('vasilek_compare', 0, '/');
            window.location.reload();
         }
         else
         {
            if(document.getElementById(bl)) document.getElementById(bl).innerHTML = '<img src="/i/working.gif"/>';
         }

        }
        ldr.send(null)
     }
  }
}

function getCompItems(lng,s)
{

   if(ldr2&&ldr2.readyState!=0) { ldr2.abort() }
   ldr2=selector();

   if(ldr2)
   {
        blc = "comp_items_list";

        ldr2.open("GET","/actions.php?action=getCompItems&ln="+lng+"&search="+s,true);
        ldr2.onreadystatechange=function()
        {
          if(ldr2.readyState==4 && ldr2.responseText)
          {
             //eval(ldr.responseText);
             if(ldr2.responseText == '&#160;') document.getElementById(blc).innerHTML = '';
             else document.getElementById(blc).innerHTML = ldr2.responseText;
          }
          else
          {
             //document.getElementById(bl).innerHTML = '';
          }
        };
        ldr2.send(null)
    }

}


function showOrderForm()
{
   if(document.getElementById('order_div').style.display == 'none') document.getElementById('order_div').style.display = 'block';
   else document.getElementById('order_div').style.display = 'none';
   
   if(document.getElementById('zakaz-button').className == 'button-zakaz') document.getElementById('zakaz-button').className = 'button-zakaz active';
   else document.getElementById('zakaz-button').className = 'button-zakaz';

}

function checkOrderForm(errEmail,errEmailIncorrect,errName,errPhone)
{
    /*
   if(document.orderForm.surname.value == '')
   {
      alert(errSurName);
      document.orderForm.surname.focus();
      return false;
   }*/

   if(document.orderForm.name.value == '')
   {
      alert(errName);
      document.orderForm.name.focus();
      return false;
   }

   if(document.orderForm.phone.value == '')
   {
      alert(errPhone);
      document.orderForm.phone.focus();
      return false;
   }
   
   if(document.orderForm.email.value == '')
   {
      alert(errEmail);
      document.orderForm.email.focus();
      return false;
   }
   else
   {
      if(document.orderForm.email.value.indexOf('@') == '-1')
      {
         alert(errEmailIncorrect);
         document.orderForm.email.focus();
         return false;
      }
   }
   
   document.orderForm.submit();
   return false;
}

function showRespForm(obj)
{
   if(document.getElementById(obj).style.display == 'none') document.getElementById(obj).style.display = 'block';
   else document.getElementById(obj).style.display = 'none';
}

function showLoginBlock()
{
   if(document.getElementById('popup').style.display == 'none')
   {
      document.getElementById('popup').style.display = 'block';
   }
   else document.getElementById('popup').style.display = 'none';
}

function showSubscribeBlock()
{
   if(document.getElementById('subscr_div').style.display == 'none')
   {
      document.getElementById('subscr_div').style.display = 'block';
   }

   else document.getElementById('subscr_div').style.display = 'none';
}



function showChildrenBlock()
{
   if(document.getElementById('children_block').style.display == 'none') document.getElementById('children_block').style.display = 'block';
   else document.getElementById('children_block').style.display = 'none';
}

function showChildrenForm(cnt,id)
{
   if(ldr && ldr.readyState!=0) { ldr.abort() }
   ldr=selector();
   bl = 'children_block';
   if(ldr)
   {
      ldr.open("GET","/actions.php?action=showChildrenForm&cnt="+cnt+"&id="+id,true);

      ldr.onreadystatechange=function()
      {
         if(ldr.readyState==4 && ldr.responseText)
         {
            document.getElementById(bl).style.display = 'block';
            document.getElementById(bl).innerHTML = ldr.responseText;
         } //else document.getElementById(bl).style.display = 'none';
      }
      ldr.send(null);
   }
}

function deleteChild(obj,id,cnt,user_id)
{
   if(ldr && ldr.readyState!=0) { ldr.abort() }
   ldr=selector();
   bl = 'children_block';
   cnt = parseInt(cnt);
   new_cnt =  cnt-1; //alert("/actions.php?action=deleteChild&name="+name+"&cnt="+cnt+"&id="+id+"&user_id="+user_id);

   if(ldr)
   {
      ldr.open("GET","/actions.php?action=deleteChild&name="+name+"&cnt="+cnt+"&id="+id+"&user_id="+user_id,true);

      ldr.onreadystatechange=function()
      {
         if(ldr.readyState==4 && ldr.responseText)
         {
            document.getElementById(bl).style.display = 'block';
            document.getElementById(bl).innerHTML = ldr.responseText;
            document.regForm.count_children.options[new_cnt].selected = true;
         }
         else
         {
            document.getElementById(obj).style.background = '#ffd838';
         }
      }
      ldr.send(null);
   }

}

function deleteCartItem(text,id,lng,user_id)
{
   if(confirm(text))
   {
      if(ldr && ldr.readyState!=0) { ldr.abort() }
      ldr=selector();
      bl = 'cart_list';
      bl2 = 'cart_item_'+id;
      
      var cartCount = parseInt(cookieVal('vasilek_cartCount'));
      cartCount--;
      setCookie ('vasilek_cartCount', cartCount, '/'); //alert(cartCount);

      if(ldr)
      {
         ldr.open("GET","/actions.php?action=deleteCartItem&id="+id+"&lng="+lng+"&user_id="+user_id,true);

         ldr.onreadystatechange=function()
         {
            if(ldr.readyState==4 && ldr.responseText)
            {
               if(cartInfo(lng))
               {
                  document.getElementById(bl).innerHTML = cartInfo(lng);
               }

               if(ldr.responseText != '&#160;')
               {
                  document.getElementById(bl).innerHTML = ldr.responseText;
                  //document.getElementById('cart_count').innerHTML = '('+cartCount+')';
               }
               else
               {
                  document.getElementById(bl).innerHTML = 'РљРѕСЂР·РёРЅР° РїСѓСЃС‚Р°';
                  document.getElementById('korzina-buttons_ul').style.display = 'none';
                  setCookie ('vasilek_cartCount', 0, '/');
               }
               
               if(cartCount <= 0)
               {
                  document.getElementById('cart_title').style.display = 'none';
                  setCookie ('vasilek_cartCount', 0, '/');
               }
            }
            else
            {
               document.getElementById(bl2).style.background = '#ffd838';
            }
         }
         ldr.send(null);
      }

   }
}


/***************  РЎС‚РёР»Рё Рё Р±РµРєРіСЂР°СѓРЅРґС‹   ****************/
function changeIcon(cat,bottom,top)
{
   old_bg = document.getElementById('slider_'+cat).style.backgroundImage;
   old_bg = old_bg.toString();

   if(old_bg == 'url(/images/cat/'+bottom+')')
   {
      bg = 'url(/images/cat/'+top+')';
      //showDiv('cat_'+cat);
   }
   else bg = 'url(/images/cat/'+bottom+')';
   document.getElementById('slider_'+cat).style.background = bg;
}

function changeIcon2(cat,bottom,top)
{
   old_bg = document.getElementById('slider_'+cat).style.backgroundImage;
   old_bg = old_bg.toString();

   if(old_bg == 'url('+bottom+')')
   {
      bg = 'url('+top+')';
      //showDiv('cat_'+cat);
   }
   else bg = 'url('+bottom+')';
   document.getElementById('slider_'+cat).style.background = bg;
}

function changeBgSlider(id)
{
   old_bg = document.getElementById(id).style.backgroundPosition;  //alert(old_bg);
   old_bg = old_bg.toString();

   if(old_bg == '0px 0px')  bg = '0px 24px';
   else bg = '0px 0px';
   document.getElementById(id).style.backgroundPosition = bg;
}

function changeBg(cat)
{
   old_bg = document.getElementById(cat).style.backgroundPosition;  //alert(old_bg);
   old_bg = old_bg.toString();
   
   if(old_bg == '0px 0px')  bg = '0px -19px';
   else bg = '0px 0px';
   document.getElementById(cat).style.backgroundPosition = bg;
}

function changeBgLang(obj)
{
   old_bg = document.getElementById(obj).style.backgroundPosition;  //alert(old_bg);
   old_bg = old_bg.toString();

   if(old_bg == '0px 0px')  bg = '-20px 0px';
   else bg = '0px 0px';
   document.getElementById(obj).style.backgroundPosition = bg;
}

function changeBgAttr(obj)
{
   old_bg = document.getElementById(obj).style.backgroundPosition;  //alert(old_bg);
   old_bg = old_bg.toString();

   if(old_bg == '0px 0px')  bg = '0px -50px';
   else bg = '0px 0px';
   document.getElementById(obj).style.backgroundPosition = bg;
}

function changeBgCart(obj,bg)
{
   document.getElementById(obj).style.background = 'url('+bg+')';
}

function changeImgCart(obj,bg)
{
   document.getElementById(obj).src = bg;
}

/***************  РЎС‚РёР»Рё Рё Р±РµРєРіСЂР°СѓРЅРґС‹   ****************/



