	function setupbox(e)
	{	
		//Cancel the link behavior  
	    e.preventDefault();  
	    var id = $(this).attr('href');    
	   	$('#mask').css({ 'width':'100%','height':'100%','opacity': 0.8 });   
	   	$('#mask').show();
	   	showBox(id);
	}
	
	function initbox(id)
	{ 
	   	$('#mask').css({ 'width':'100%','height':'100%','opacity': 0.8 });   
	   	$('#mask').show();
	   	showBox(id);
	}
	
	function showBox(id)
	{
	   //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);  
	   $(id).show();
	 }


$(document).ready(function() {
    //select all the a tag with name equal to modal  
    $('a[name=modal]').live('click',setupbox);  
     
    //if close button is clicked  
    $('.window .close').click(function (e) {  
       //Cancel the link behavior  
       e.preventDefault();  
       $('#mask, .window').hide();  
    });       
     
    //if mask is clicked  
    $('#mask').click(function () {  
       $(this).hide();  
       $('.window').hide();  
    });
    
    $('#submitlogin').click(function(){
  			$.get('index.php',$('#user_login_form').serialize(),function(response){
			
				if(response.error == 1)
				{
					$('#loginbox_user .alert').removeClass('hide');
				}
				else if(response.error == 2)
				{
					location = "index.php?cl=user_start&msg_active=1";
				}
				else
				{  
       				$('#mask, .window').hide(); 
       				$('#data2').hide();
					$('#successMsg').show();
					$('#errorMsg').hide();
				}			
			});										
    });
    
    $('#p-3').click(function(){
  			$.get('index.php',{ cl: 'advisor_upgrade', fnc: 'upgrade', package: 3, ajax: 1 }, function(response){
			
				if(response.saved == 1)
				{
					location.href = 'mandantenakquise.pdf';
				}
				else
				{
					alert("Es ist ein Fehler aufgetreten. Bitte laden Sie die Seite neu.");
				}		
  		});										
    });
    $('#p-4').click(function(){
  			$.get('index.php',{ cl: 'advisor_upgrade', fnc: 'upgrade', package: 4, ajax: 1 }, function(response){
			
				if(response.saved == 1)
				{
					location.href = 'mandantenakquise.pdf';
				}
				else
				{
					alert("Es ist ein Fehler aufgetreten. Bitte laden Sie die Seite neu.");
				}		
  		});										
    });

    
     $('#p-5').click(function(){
  			$.get('index.php',{ cl: 'advisor_upgrade', fnc: 'upgrade', package: 5, ajax: 1 }, function(response){
			
				if(response.saved == 1)
				{
					location.href = 'mandantenakquise.pdf';
				}
				else
				{
					alert("Es ist ein Fehler aufgetreten. Bitte laden Sie die Seite neu.");
				}		
  		});										
    });


});
 
 
 
