	
	$(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';

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

/*######## CUSTOM FUNCTIONS FOR SETTING A COOKIE ############ */

/*function SetCookie (name, value) 
{
	var argv = SetCookie.arguments;
	var argc = SetCookie.arguments.length;
	var expires = (argc > 2) ? argv[2] : null;
	var path = (argc > 3) ? argv[3] : null;
	var domain = (argc > 4) ? argv[4] : null;
	var secure = (argc > 5) ? argv[5] : false;
	document.cookie = name + "=" + escape (value) +
	((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
	((path == null) ? "" : ("; path=" + path)) +
	((domain == null) ? "" : ("; domain=" + domain)) +
	((secure == true) ? "; secure" : "");
}

function getCookie(name)
{
	var cookies = document.cookie;
	//alert(document.cookie);
	if (cookies.indexOf(name) != -1)
	{
		var startpos = cookies.indexOf(name)+name.length+1;
		var endpos = cookies.indexOf(";",startpos)-1;
		if (endpos == -2) endpos = cookies.length;
		return unescape(cookies.substring(startpos,endpos));
	}
	else
	{
		return false; // the cookie couldn't be found! it was never set before, or it expired.
	}
}

if(getCookie('localization'))
{
	//alert("cokie already set --- hide");
	var popupStatus = 1;
}
else
{
	//alert("cokie Not set --- Show ");
	SetCookie('localization', 'set');
	var popupStatus = 0;
	centerPopup();
	document.getElementById("overlay-k").style.width = myWidth+'px';
	//load popup
	loadPopup();
}*/

/*######## CUSTOM FUNCTIONS FOR SETTING A COOKIE ENDS ############ */

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-k").fadeIn("slow");
		$("#lightbox-k").fadeIn("slow");
		popupStatus = 1;
	}
}

 


//Function for close/disable our popup:


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

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


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

})

