function tabButtonClicked(t, b) {
  var lis=document.body.getElementsByTagName('li');
  for (var i=0; i<lis.length; i++) {
    if (lis[i].id==t+'_'+b+'_button') {
			lis[i].className='ac';
    } else if (lis[i].id.match('^'+t+'_.*_button$')) {
			lis[i].className='ia';
    }
  }
  var divs=document.body.getElementsByTagName('div');
  for (var i=0; i<divs.length; i++) {
    if (divs[i].id==t+'_'+b+'_content') {
			divs[i].style.display='block';
    } else if (divs[i].id.match('^'+t+'_.*_content$')) {
			divs[i].style.display='none';
    }
  }

}


function dopyt(productId, productName,categoryId){
 Set_Cookie( 'pt_id_'+productId, productId, 0.1, '/', '', '' );
 Set_Cookie( 'pt_cid_'+productId, categoryId, 0.1, '/', '', '' );
 //Set_Cookie( 'pt_pname_'+productId, productName, 0.1, '/', '', '' );
 //Set_Cookie( 'pt_cname_'+productId, categoryName, 0.1, '/', '', '' );
 alert("Produkt "+productName+" bol pridaný do dopytu.")
}

function delete_dopyt(productId){

 Delete_Cookie( 'pt_id_'+productId, '/', '');

 location.href="./Dopyt";
}

function Set_Cookie( name, value, expires, path, domain, secure )
{
  // set time, it's in milliseconds
  var today = new Date();
  today.setTime( today.getTime() );

  /*
  if the expires variable is set, make the correct
  expires time, the current script below will set
  it for x number of days, to make it for hours,
  delete * 24, for minutes, delete * 60 * 24
  */
  if ( expires )
  {
    expires = expires * 1000 * 60 * 60 * 24;
  }
  var expires_date = new Date( today.getTime() + (expires) );

  document.cookie = name + "=" +escape( value ) +
  ( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
  ( ( path ) ? ";path=" + path : "" ) +
  ( ( domain ) ? ";domain=" + domain : "" ) +
  ( ( secure ) ? ";secure" : "" );
}

function Delete_Cookie( name, path, domain ) {
	 document.cookie = name + "=" +( ( path ) ? ";path=" + path : "") + ( ( domain ) ? ";domain=" + domain : "" ) + ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}

