title: open a popup when a condition true
body: <p>I want to open a popup when 'if' condition true
  otherwise it opens normally.</p>
  
  <p>But the code that I used, open the popup whether the condition is true or false.</p>
  
  <p>so, help me guys and give ur views</p>
  
  <p>script that I use.</p>
  
  <pre><code>&lt;script&gt;
  $(document).ready(function() {  
  
          var id = '#dialog';
  
          //Get the screen height and width
          var maskHeight = $(document).height();
          var maskWidth = $(window).width();
  
          //Set heigth and width to mask to fill up the whole screen
          $('#mask').css({'width':maskWidth,'height':maskHeight});
  
          //transition effect     
          $('#mask').fadeIn(1000);    
          $('#mask').fadeTo("slow",0.8);  
  
          //Get the window height and width
          var winH = $(window).height();
          var winW = $(window).width();
  
          //Set the popup window to center
          $(id).css('top',  winH/2-$(id).height()/2);
          $(id).css('left', winW/2-$(id).width()/2);
  
          //transition effect
          $(id).fadeIn(2000);     
  
      //if close button is clicked
      $('.window .close').click(function (e) {
          //Cancel the link behavior
          e.preventDefault();
  
          $('#mask').hide();
          $('.window').hide();
      });     
  
      //if mask is clicked
      $('#mask').click(function () {
          $(this).hide();
          $('.window').hide();
      });     
  
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>and the css is here.</p>
  
  <pre><code>&lt;style&gt;
  #mask {
    position:absolute;
    left:0;
    top:0;
    z-index:9000;
    background-color:#000;
    display:none;
  }
  
  #boxes .window {
    position:absolute;
    left:0;
    top:0;
    width:440px;
    display:none;
    z-index:9999;
    padding:20px;
    padding-top:0px;
  }
  
  #boxes #dialog {
    width:975px; 
    padding-top:0px;
    background-color:#ffffff;
     background-image: url(../Images/form_bg.png);
  background-repeat: no-repeat;
  }
  
  &lt;/style&gt;
  </code></pre>
  
  <p>and the div with condition.</p>
  
  <pre><code>&lt;?php
          $check_crm=mysql_num_rows(mysql_query("select * from crm where party_id='$_GET[party_id]'"));
          if($check_crm&gt;0)
          {
              ?&gt;
          &lt;div id="boxes"&gt;
          &lt;div id="dialog" class="window"&gt;
          &lt;!-- content--&gt;
          &lt;/div&gt;
          &lt;/div&gt;
          &lt;?php
          }
          ?&gt;
  </code></pre>