

function changeLanguage(language)
{
  document.location.href = URL__CHANGE_LANGUAGE + '?language=' + language;
}


function changeContent(elem, box, tagMenu, idMenu, classBoxContent)
{
  tabContainer = $(idMenu);
  menuItem = tabContainer.getElementsByTagName(tagMenu);
  boxItem = document.getElementsByTagName('div');
  boxToShow = document.getElementById(box);
  
  for(var i=0; i < menuItem.length; i++)
  {
    menuItem[i].className=""
  }
  for(var i=0; i < boxItem.length; i++)
  {
    if(boxItem[i].className.match(classBoxContent))
    {
      boxItem[i].style.display="none"
    }
  }
  document.getElementById(elem).className="active";
  
  boxToShow.style.display="block";
  
}


function showHideBox(divToShowID)
{
  allAuctionDiv = $('AllAuction');
  hitechDiv = $('Hitech');
  carsDiv = $('Cars');
  //entertainmentDiv = $('Entertainment');
  travelDiv = $('Travel');
  divToShow = $(divToShowID);
    
  allAuctionBtn = $('AllAuctionBtn');
  hitechDivBtn = $('HitechBtn');
  carsDivBtn = $('CarsBtn');
  //entertainmentDivBtn = $('EntertainmentBtn');
  travelDivBtn = $('TravelBtn');
  divToShowBtn = $(divToShowID + "Btn");
  
  if(Element.visible(allAuctionDiv) && allAuctionDiv != divToShow)
  {
    Effect.toggle(allAuctionDiv,'slide',{duration:0.1}); 
    allAuctionBtn.className = 'btnClose';
  } 
  
  if(Element.visible(hitechDiv) && hitechDiv != divToShow)
  {
    Effect.toggle(hitechDiv,'slide',{duration:0.1}); 
    hitechDivBtn.className = 'btnClose';
  }    

  if(Element.visible(carsDiv) && carsDiv != divToShow)
  {
    Effect.toggle(carsDiv,'slide',{duration:0.1});   
    carsDivBtn.className = 'btnClose';    
  }   

  //  if(Element.visible(entertainmentDiv) && entertainmentDiv != divToShow)
  //  {
  //    Effect.toggle(entertainmentDiv,'slide',{duration:0.1});    
  //    entertainmentDivBtn.className = 'btnClose';
  //  }   

  if(Element.visible(travelDiv) && travelDiv != divToShow)
  {
    Effect.toggle(travelDiv,'slide',{duration:0.1});    
    travelDivBtn.className = 'btnClose';
  }       
  
  if(Element.visible(divToShow) == false)
  {
    divToShowBtn.className = 'btnOpen';
    Effect.toggle(divToShow,'slide',{duration:0.5});    
  }
}
function openPopup(url, width, height, scrollbar) 
{
  if(scrollbar == null)
    scrollbar = 'no';
  popup=window.open( url,'','toolbar=no,scrollbars=' + scrollbar + ',location=no,directories=no,width=' + width + ',height=' + height ); 
  popup.focus();
}

/**
 * validate a bidFormBean
 */
function validateBidForm(idBidFormBean) 
{
  bidForm = $(idBidFormBean);
   
  singleBid = bidForm.singleBid.value;
  bidFrom = bidForm.bidFroms.value;
  bidTo = bidForm.bidTo.value;
   
  if(singleBid )
    return true;
  return true;
}

function isNumberKey(evt)
{
  var charCode = (evt.which) ? evt.which : event.keyCode
  if (charCode > 31 && (charCode < 48 || charCode > 57) )
    if (charCode!=13 && charCode != 44 && charCode != 46)
      return false;

  return true;
}


function openAuction(idAuction)
{
  window.location.href = "auctionDetails.do?idAuction=" + idAuction;
}

function showHideBox2(idBox1, idBox2)
{
  idBox1Display = document.getElementById(idBox1).style.display;
  
  if (idBox1Display == 'none')
  {
    document.getElementById(idBox2).style.display = 'none';
    document.getElementById(idBox1).style.display = '';
  }
  else
  {
    document.getElementById(idBox2).style.display = '';
    document.getElementById(idBox1).style.display = 'none';
  }
}

function loaddefimages(Id)  
{  
  document.getElementById(Id).src='images/nofound.gif';  
}   
