    window.addEvent('domready', function()
    {
       change_menu("1");
       change_menu("2");
       change_menu("3");
       change_menu("4");
       change_menu("5");

    });

function change_menu(el_name)
{
         if($(el_name))
         {
         			$(el_name).addEvent("mouseenter",function()
         			{
      				 $(el_name).setProperty('src',"template/www/img/menu/"+ el_name +"_on.gif");
         			});
         			$(el_name).addEvent("mouseleave",function()
         			{
               $(el_name).setProperty('src',"template/www/img/menu/"+ el_name +".gif");
         			});
      	}
}
function adv_search_box()
	{
	if($('adv_search_box').style.display=='block')
	{
		$('adv_search_box').style.display='none';
		$('adv_s').style.background='url(./template/www/img/search_adv_icon.gif) no-repeat right top';
		$('adv_s_a').style.color='#FFDE8F';
	}
	else
	{
		$('adv_search_box').style.display='block';
		$('adv_s').style.background='url(./template/www/img/search_adv_bg.gif) no-repeat right top';
		$('adv_s_a').style.color='#390200';
	}
}
function clearText (field,what) {
    if(field.value==what)
      field.value = "";

}
function writeText (field,what) {
    if(field.value=="")
      field.value = what;

}
function sh( name, cent )
{

    var item = document.getElementById( name );
    if(item.style.display == 'block')
        item.style.display = 'none';
    else
    if(item.style.display = 'none')
        item.style.display = 'block';
        if(cent=="1"){
         window.scrollTo(0,0);

        }
}

function sl( name, evt )
{
    var item = document.getElementById( 'dictionarybox' );
     if(evt.pageX)
    {
      var xpos = evt.pageX;
      var ypos = evt.pageY;
      ypos = ypos+30;
    }
    else
    {
      var xpos = evt.clientX;
      var ypos = (document.documentElement.scrollTop + evt.clientY);

    }

    xpos = xpos+5;

       item.style.position = 'absolute';
       item.style.left = xpos+"px";
      item.style.top = ypos+"px";
       item.style.display = 'block';
       document.getElementById( 'dictionary_tit' ).innerHTML = name;
       document.getElementById( 'link_dict' ).href = "dictionary/#"+name.replace(" ", "_");

 /*      url: "myadmin.php?act=&mode=ajax&param=",
       url: "index.php?mod=23&mode=ajax&var=" + name,    */
     //  alert("index.php?mod=23&mode=ajax&var=" + name);
      advAJAX.get({
       url: "index.php?mod=28&mode=ajax&var=" + name,
       onLoading : function(obj) { document.getElementById( 'dictionary_desc' ).innerHTML = '<div class="processing" style="background-image: url(./template/www/img/processing2.gif); position: relative; height: 50px; display: block; left: 0px; margin-left: 130px; margin-top: 35px;"><!-- --></div>'; },
       onError : function(obj) { document.getElementById( 'dictionary_desc' ).innerHTML = '<div class="error" style="left: 0px; margin-left: 150px;  display: block; margin-top: 35px;"><!-- --></div>';  },
    /*   onSuccess : function(obj) { document.getElementById( 'dictionary_desc' ).innerHTML = obj.responseText; alert(obj.responseText); document.getElementById( 'dictionary_desc' ).style.display= ""; }*/
       onSuccess : function(obj)
       {
         document.getElementById( 'dictionary_desc' ).innerHTML = obj.responseText;
       }
   });



}
function hl( name )
{
  var item = document.getElementById( name );
  item.style.display = 'none';
}
function showTab( tab )
{
  var t1 = document.getElementById( "tab1" );
  var t2 = document.getElementById( "tab2" );
  var t3 = document.getElementById( "tab3" );
  var t4 = document.getElementById( "tab4" );

  var p = document.getElementById( 'panel' );
  var p1 = document.getElementById( "panel1" );
  var p2 = document.getElementById( "panel2" );
  var p3 = document.getElementById( "panel3" );
  var p4 = document.getElementById( "panel4" );
  if(tab==1)
  {
    if(p1.innerHTML=="<div style=\"display: table;\"></div>")
       return false;

    t1.className = 'tab_a';
    t2.className = 'tab';
    t3.className = 'tab';
    t4.className = 'tab_p';
      p.innerHTML = p1.innerHTML;
  }
  if(tab==2)
  {
    if(p2.innerHTML=="<div style=\"display: table;\"></div>")
       return false;

    t1.className = 'tab';
    t2.className = 'tab_a';
    t3.className = 'tab';
    t4.className = 'tab_p';
    p.innerHTML = p2.innerHTML;
  }
  if(tab==3)
  {
    if(p3.innerHTML=="<div style=\"display: table;\"></div>")
       return false;
    t1.className = 'tab';
    t2.className = 'tab';
    t3.className = 'tab_a';
    t4.className = 'tab_p';
    p.innerHTML = p3.innerHTML;
  }
  if(tab==4)
  {
    if(p4.innerHTML=="<div style=\"display: table;\"></div>")
       return false;
    t1.className = 'tab';
    t2.className = 'tab';
    t3.className = 'tab';
    t4.className = 'tab_a';
    p.innerHTML = p4.innerHTML;
  }

}

function sendFormPolec()
{
   advAJAX.submit(document.getElementById('polecForm'), {
    onSuccess : function(obj) { document.getElementById( 'pContent' ).innerHTML = obj.responseText; },
    onLoading : function(obj) { document.getElementById( 'pContent' ).innerHTML = '<div class="wait"><!-- --></div>'; },
    onError : function(obj) { document.getElementById( 'pContent' ).innerHTML = '<div class="error"><!-- --></div>'; }
   });
}
 function sendFormProblem()
{
   advAJAX.submit(document.getElementById('problemForm'), {
    onSuccess : function(obj) { document.getElementById( 'pContent1' ).innerHTML = obj.responseText; },
    onLoading : function(obj) { document.getElementById( 'pContent1' ).innerHTML = '<div class="wait"><!-- --></div>'; },
    onError : function(obj) { document.getElementById( 'pContent1' ).innerHTML = '<div class="error"><!-- --></div>'; }
   });
}


function loadCountry(  target, param )
{
 advAJAX.get({
 url: "cart/"+param,
 onLoading : function(obj) { document.getElementById( target ).innerHTML = '<div class="pElemLight" style="display: table; height: 200px;"><div class="wait"><!-- --></div></div>'; },
 onError : function(obj) { document.getElementById( target ).innerHTML = '<div class="pElemLight" style="display: table; height: 200px;"><div class="error"><!-- --></div></div>'; },
 onSuccess : function(obj) { document.getElementById( target ).innerHTML = obj.responseText; }
 });
}
