﻿// JScript File
function openWindow(width, height, lang, idblogue, section, search, comanchor)
{
  leftVal = (screen.width - width) / 2;
      topVal = (screen.height - height) / 2;
          
  switch (section)
  {   
    case 'comments':
    {
        window.open('NewBlogComment.aspx?sc=nc&lang='+lang+'&Blg='+idblogue, 'NewCommentWindow', 'resizable=no,width='+width+'px,height='+height+'px,left='+leftVal+'px,top='+topVal+'px,scrollbars=no,status=no');
        break;
    }
    case 'modifcomments':
    {
        window.open('NewBlogComment.aspx?sc=nc&lang='+lang+'&com='+idblogue, 'NewCommentWindow', 'resizable=no,width='+width+'px,height='+height+'px,left='+leftVal+'px,top='+topVal+'px,scrollbars=no,status=no');
        break;
    }
    case 'showcomments':
    {
      window.open('BlogDetail.aspx?lang='+lang+'&Blg='+idblogue, 'BlogDetailWindow', 'resizable=no,width='+width+'px,height='+height+'px,left='+leftVal+'px,top='+topVal+'px,scrollbars=no');
      break;
    }
    case 'showsearch':
    { 
      window.open('BlogDetail.aspx?lang='+lang+'&Blg='+idblogue+'&search='+search+'#Anchor_'+comanchor, 'BlogDetailWindow', 'resizable=no,width='+width+'px,height='+height+'px,left='+leftVal+'px,top='+topVal+'px,scrollbars=no');
      break;
    }
    case 'showattachment':
    {
       window.open('Attachment.aspx?att_id='+idblogue, 'AttachmentWindow', 'resizable=no,width='+width+'px,height='+height+'px,left='+leftVal+'px,top='+topVal+'px,scrollbars=yes');
      break;
    }
    case 'searchwindow':
    {
      window.open('BlogSearch.aspx?lang='+lang, 'BlogSearch', 'resizable=no,width='+width+'px,height='+height+'px,left='+leftVal+'px,top='+topVal+'px,scrollbars=no');
      break;
    }
    default:
    {
        if (idblogue != '')
            window.open('NewBlogComment.aspx?sc=nb&lang=' + lang + '&mod=' + idblogue, 'NewBlogWindow', 'resizable=no,width='+width+'px,height='+height+'px,left='+leftVal+'px,top='+topVal+'px,scrollbars=no,status=no');
        else
            window.open('NewBlogComment.aspx?sc=nb&lang=' + lang, 'NewBlogWindow', 'resizable=no,width='+width+'px,height='+height+'px,left='+leftVal+'px,top='+topVal+'px,scrollbars=no,status=no');
        break;
    }
  }
}
/*function openWindow(width, height, lang, idblogue, section)
{
  leftVal = (screen.width - width) / 2;
      topVal = (screen.height - height) / 2;
          
  if (section != 'comments')
  {   
    if (idblogue != '')
        window.open('NewBlogComment.aspx?sc=nb&lang=' + lang + '&mod=' + idblogue, 'NewBlogWindow', 'resizable=no,width='+width+',height='+height+',left='+leftVal+',top='+topVal+',scrollbars=no,status=no')
    else
        window.open('NewBlogComment.aspx?sc=nb&lang=' + lang, 'NewBlogWindow', 'resizable=no,width='+width+',height='+height+',left='+leftVal+',top='+topVal+',scrollbars=no,status=no')
  }
  else
  {
      window.open('BlogDetail.aspx?lang='+lang+'&Blg='+idblogue, 'BlogDetailWindow', 'resizable=no,width='+width+',left='+leftVal+',top='+topVal+',scrollbars=yes')
  }
}*/

function confirmDelete(lang, object)
{
  var rep;
  switch(object)
  {
    case "blog":
      if(lang = "Fra")
      {
        rep=confirm("Voulez-vous vraiment supprimer ce blog?");
      }
      else
      {
        rep=confirm("Do you really want to delete this blog?");
      }
      break;
     case "comment":
     if(lang = "Fra")
      {
        rep=confirm("Voulez-vous vraiment supprimer ce commentaire?");
      }
      else
      {
        rep=confirm("Do you really want to delete this comment?");
      }
      break;
     case "groupe":
     if(lang = "Fra")
      {
        rep=confirm("Voulez-vous vraiment supprimer ce groupe?");
      }
      else
      {
        rep=confirm("Do you really want to delete this group?");
      }
   }
  return rep;
}

/*fonction pour faire apparaître ou disparaître les div de submenu dynamiques*/
function toggleDisplay(div_id)
{
  var div = document.getElementById(div_id);
  if(div.style.display == "none")
    div.style.display = "block";
  else
    div.style.display = "none";
}
