var nw;

function help()
{
  if(!nw)
  {
     var url="bby_vis_help.php?bby_id";
     nw=window.open(url,"","toolbars=NO,Scrollbars=YES,Top=50,Left=150,Width=400,height=200");
  }
}
//****************************  Showing name rating popup  ************************
function show_popup(bby_id, bby_name)
{
  if(!nw)
  {
     var url="bby_vis_name_rat.php?bby_id="+bby_id+"&bby_name="+bby_name;
     nw=window.open(url,"","toolbars=NO,Scrollbars=YES,Top=50,Left=150,Width=550,height=300");
  }
}
function mybaby()
{
  if(!nw)
  {
     var url="bby_vis_mybaby_popup.php";
     nw=window.open(url,"","toolbars=NO,Scrollbars=YES,Top=50,Left=150,Width=660,height=600, resizable");
  }
}

//======= THIS FUNCTION SETS LAST STATUS OF HIDE-SHOW OF NAME MEANING============//
function set_old_view_status()
{
   
   if(document.cookie=="")
  {
    show="S";   
    document.cookie="show="+show+"=";
  }
  else
 {
    show=document.cookie.split("=")[1];
 }

  if ( (show!="S") && (show !="H"))
    show="S";
   
   set_view(show);  // CALL TO  FUNCTION
}
//================================================================//


// THIS FUNCTION SETS THE VARIABLE IN COOKIE AND SET THE SELECTED STATUS OF HIDE-SHOW  OF NAME Meaning ==//
function show_meanings(show)
{  
   set_view(show);  // CALL TO FUNCTION
   document.cookie="show="+show+"=";
}

//============================================================================//

// THIS FUNCTION ACTUALLY SETS THE NAME MEANING HIDDEN OR SHOWN

function set_view(show)
{
   
	var cnt=document.myform.name_count.value;
    if(cnt>0){
       if(show=="S") {          
          obj=document.getElementById("hidelink");
          obj.style.display="block"; 
          obj=document.getElementById("showlink");
          obj.style.display="none";
       }
       else {
          obj=document.getElementById("showlink");
          obj.style.display="block";
          obj=document.getElementById("hidelink");
          obj.style.display="none";
       }
	for(i=1; i<=cnt; i++) { 
      if(show=="S") 
     { 
         obj=document.getElementById("block"+i);
         obj.style.display="block";
          if(document.getElementById("favourite_link"+i))
          {
             obj=document.getElementById("favourite_link"+i);
             obj.style.display="block";
          }
       }
       else
       { 
	      obj=document.getElementById("block"+i); 
          obj.style.display="none";
          if(document.getElementById("favourite_link"+i))
          {
             obj=document.getElementById("favourite_link"+i);
             obj.style.display="none";
          }
	   }     
     } // FOR ENDED
  }
}
//=========================================================================

function add_to_fav(bby_id)  // FOR SRCH LIST
{
  document.myform.bby_id.value=bby_id;
  document.myform.action="bby_vis_addremove_bby.php";
  document.myform.submit();
}