function tooltip(d,E,b,i,a){
  d=document;E=d.documentElement;b=d.body;if(!E)return;
  for(i=0;a=d.getElementsByClassName("listImage")[i];i++){
      image=d.getElementById("image_"+a.title).value;
      with(a.t=d.createElement("div")){
        id="tooltip"
        innerHTML="<img src='"+image+"&h=300&w=300' />";
      }
      a.onmouseover=function(e){
        with(this){title="";onmousemove(e)}
        b.appendChild(this.t)
      }
      a.onmouseout=function(x){
        with(this){title=t.innerHTML.replace(/<br \/>/g,"\|")}
        if(x=d.getElementById("tooltip"))b.removeChild(x)
      }
      a.onmousemove=function(e){
        e=e||event;with(this.t.style){
         left=e.clientX+(E.scrollLeft||b.scrollLeft)+"px"
         top=e.clientY+(E.scrollTop||b.scrollTop)+"px"
        }
      }
  }
  
  for(i=0;a=d.getElementsByClassName("cardImage")[i];i++){
      image=document.getElementById("image_"+a.title).value;
      with(a.t=d.createElement("div")){
        id="tooltip"
        innerHTML="<img src='"+image+"&h=300&w=300' />";
      }
      a.onmouseover=function(e){
        with(this){title="";onmousemove(e)}
        b.appendChild(this.t)
      }
      a.onmouseout=function(x){
        with(this){title=t.innerHTML.replace(/<br \/>/g,"\|")}
        if(x=d.getElementById("tooltip"))b.removeChild(x)
      }
      a.onmousemove=function(e){
        e=e||event;with(this.t.style){
         left=e.clientX+(E.scrollLeft||b.scrollLeft)+"px"
         top=e.clientY+(E.scrollTop||b.scrollTop)+"px"
        }
      }
  }
  
  for(i=0;a=d.getElementsByClassName("additionalImage")[i];i++){
      image=a.title;
      with(a.t=d.createElement("div")){
        id="tooltip"
        innerHTML="<img src='"+image+"&h=400' />";
      }
      a.onmouseover=function(e){
        with(this){title="";onmousemove(e)}
        b.appendChild(this.t)
      }
      a.onmouseout=function(x){
        with(this){title=t.innerHTML.replace(/<br \/>/g,"\|")}
        if(x=d.getElementById("tooltip"))b.removeChild(x)
      }
      a.onmousemove=function(e){
        e=e||event;with(this.t.style){
         left=e.clientX+(E.scrollLeft||b.scrollLeft)+"px"
         top=e.clientY+(E.scrollTop||b.scrollTop)+"px"
        }
      }
  }
}

function addEvent(O,E,F,x){
  return(x=O.addEventListener)?x(E,F,1):(x=O.attachEvent)?x('on'+E,F):!1
}
addEvent(window,'load',tooltip);
addEvent(window,'load',searchPhrase);

function searchPhrase() {
  var login = document.getElementById("email_address"), lTxt = '- login -';
  login.onblur = function(){ if (this.value == '') this.value = lTxt; };    
  login.onfocus = function(){ if (this.value == lTxt) this.value = ''; }; 
  
  var passwd = document.getElementById("passwd"), pTxt = '1234';
  passwd.onblur = function(){ if (this.value == '') { this.value = pTxt;  } };    
  passwd.onfocus = function(){ this.value = ''; };
}

function showRequestInformation(Text){
  var area=document.getElementById('requestArea');
  area.innerHTML=Text;
  area.style.display='block';
}

function categoryMenuAction(CategoryId){
  var Area=document.getElementById('subCategoryArea_'+CategoryId);
  if(Area.style.display=='block'){
    Area.style.display='none';  
  }else{
    Area.innerHTML='<img src="images/loader_circle.gif" border="0" />';
    Area.style.display='block';
    new Ajax.Request('request.php?action=show_box_menu_subcategory&category_id='+CategoryId,
      {
        method:'get',
        onSuccess: function(transport){
          var response = transport.responseText || "no response text";
          if(response==0){
            window.location='index.php?cPath='+CategoryId;          
          }else{
            Area.innerHTML=response;
          }
        },
        onFailure: function(){ alert('Something went wrong...') }
      });
  }
  var i = 0;
  for(i=0; i<1000; i++){
    if(i!=CategoryId){
      a = document.getElementById('subCategoryArea_'+i);
      if(a!=null) a.style.display='none';
    }
  }
}

