$(document).ready(function(){
    
    
   var popClass =  $('div').hasClass('ikea-livepop-show');

   
  if(popClass){
      $('<div id="blackScreen" />').css({
        background:'#000',
        opacity:0.6,
        position:'fixed',
        width:$(window).width()+'px',
        height:$(document).height()+'px',
        left:0,
        top:0,
        zIndex:10
    }).appendTo('body');
    
   $('<div id="welPop"><a class="wel-pop-closeBtn" href="#"></a><div class="wel-pop-content"></div> </div>').css({
            width:'529px',
            minHeight:'250px',
            position:"fixed",
            left:'50%',
            top:'50%',
            padding:'0 25px 25px 25px',
            zIndex:15
    }).appendTo('body');
    
    $('#welPop').css({
            marginLeft:(-($('#welPop').outerWidth()/2)+'px'),
            marginTop:(-($('#welPop').outerHeight()/2)+'px')
    })
    
    $('.wel-pop-closeBtn,span.undr-line').click(function(){
        $('#blackScreen,#welPop').hide();    
        return false;
    })
    
    $('span.undr-line').live('click', function(){
        $('#blackScreen,#welPop').hide();    
        return false;
    })
    
    var $title = $("#wel-pop-content").html();
    $('.wel-pop-content').html($title);
    
      $('div#ikealive-check').click(function () {
      var sessionid = $('#remoteaddrforsurvey').val();
      var countryforsurvey = $('#countryforsurvey').val();
              if(this.id == 'ikealive-check') {
                $.post(Drupal.settings.fullpath + "/savesurveystat", {savesurveystatval: 1, sessionidval: sessionid, countryforsurveyval: countryforsurvey},
                          function(content) {
                                        if(content){
                                            
                                        }
            });
                }
     
    });
    
        
  
  }
  
});
