	$(document).ready(function() {
	var myWidth;
	var myHeight;

	if( typeof( window.innerWidth ) == 'number' ) { 

	//Non-IE 

	myWidth = window.innerWidth;
	myHeight = window.innerHeight; 

	} else if( document.documentElement && 

	( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { 

	//IE 6+ in 'standards compliant mode' 

	myWidth = document.documentElement.clientWidth; 
	myHeight = document.documentElement.clientHeight; 

	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { 

	//IE 4 compatible 

	myWidth = document.body.clientWidth; 
	myHeight = document.body.clientHeight; 


	}
//document.getElementById("overlay").style.height = myHeight+'px';
//document.getElementById("overlay").style.width = myWidth+'px';

var popupStatus = 0;

function loadPopup(){
//loads popup only if it is disabled
if(popupStatus==0){
//document.getElementById("overlay").style.height = myHeight+'px';
//document.getElementById("overlay").style.width = myWidth+'px';
$("#overlay-k2").fadeIn("slow");
$("#lightbox-k2").fadeIn("slow");
popupStatus = 1;
}
}

//centering popup  
function centerPopup(){  
//request data for centering  
var windowWidth = document.documentElement.clientWidth;  
var windowHeight = document.documentElement.clientHeight;  
var popupHeight = $("#lightbox-k2").height();  
var popupWidth = $("#lightbox-k2").width();  
//centering  
$("#lightbox-k2").css({  
"position": "absolute",  
"top": windowHeight/2-popupHeight/2,
"left": windowWidth/2-popupWidth/2  
});  
//only need force for IE6  
  
$("#overlay-k2").css({  
"height": windowHeight  
});  
  
}  


//Function for close/disable our popup:


//disabling popup with jQuery magic!
function disablePopup(){
//disables popup only if it is enabled
if(popupStatus==1){
$("#overlay-k2").fadeOut("slow");
$("#lightbox-k2").fadeOut("slow");
popupStatus = 0;
}
}

$(".open2").click(function(){
//centering with css
centerPopup();
document.getElementById("overlay-k2").style.width = myWidth+'px';
//load popup
loadPopup();
});


//CLOSING POPUP
//Click the x event!
$(".close-k2").click(function(){
disablePopup();
});
//Click out event!
$("#overlay-k2").click(function(){
disablePopup();
});
//Press Escape event!
$(document).keypress(function(e){
if(e.keyCode==27 && popupStatus==1){
disablePopup();
}
});

})

