

function popup(arg) {
						   
// Here we will write a function when link click under class popup				   
								
						
// Here we will describe a variable popupid which gets the
// rel attribute from the clicked link							
var popupid = $('#'+arg).attr('rel');


// Now we need to popup the marked which belongs to the rel attribute
// Suppose the rel attribute of click link is popuprel then here in below code
// #popuprel will fadein
$('#'+arg).fadeIn();


// append div with id fade into the bottom of body tag
// and we allready styled it in our step 2 : CSS
//$('body').append('<div id="fade"></div>');
$('#fade').css({'filter' : 'alpha(opacity=80)'}).fadeIn();


// Now here we need to have our popup box in center of 
// webpage when its fadein. so we add 10px to height and width 
var popuptopmargin = ($('#' + popupid).height() + 10) / 2;
var popupleftmargin = ($('#' + popupid).width() + 10) / 2;


// Then using .css function style our popup box for center allignment
$('#' + popupid).css({
'margin-top' : -popuptopmargin,
'margin-left' : -popupleftmargin
});

$('#popuprel').click(function() {
	$('#fade , #popuprel').fadeOut()
});

// Now define one more function which is used to fadeout the 
// fade layer and popup window as soon as we click on fade layer
$('#fade').click(function() {

// Add markup ids of all custom popup box here 						  
$('#fade , #popuprel, #tips').fadeOut()
return false;
});
};

function popup2(innhold,vidde,hoyde)
	{
		$('#popuprel').remove();
		var div = '';
		var div2 = '';
		div += '<div style="width:'+vidde+';height:'+hoyde+';" class="popupbox2" id="popuprel">';	
		div += '<img src="'+innhold+'" />';
		div += '</div>';
		var div2 = '<div id="fade"></div>';
		
		$("body").append(div);
		$("body").append(div2);
		
		$('#popuprel').fadeIn();
		$('#fade').css({'filter' : 'alpha(opacity=80)'}).fadeIn();
		
		$('#popuprel').click(function() {
			$('#fade , #popuprel').fadeOut()
		});
		
		$('#fade').click(function() {
			// Add markup ids of all custom popup box here 						  
			$('#fade,#popuprel').fadeOut()
			return false;
			});
	}

