/**
**
**
**
*/
//SETTING UP OUR POPUP
//0 means disabled; 1 means enabled;
var popupStatus = 0;

//loading popup with jQuery magic!
var loadPopup = function(){
	//loads popup only if it is disabled
	if(popupStatus==0){
		$j("#backgroundPopup").css({
				"opacity": "0.7"
		});
		$j("#backgroundPopup").fadeIn("slow");
		$j("#popupContact").fadeIn("slow");
		//$j("#backgroundPopup").show();
		//$j("#popupContact").show();
		popupStatus = 1;
	}
}

//disabling popup with jQuery magic!
var disablePopup = function(){
	//disables popup only if it is enabled
	if(popupStatus==1){
		$j("#backgroundPopup").fadeOut("slow");
		$j("#popupContact").fadeOut("slow");
		popupStatus = 0;
	}
}

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

	$j("#backgroundPopup").css({
		"height": windowHeight
	});

}
$j(document).ready(function(){
	
	//CLOSING POPUP
	//Click the x event!
	$j("#popupContactClose").click(function(){
		disablePopup();
	});
	//"Fenster schließen" Text
	$j("#popupContactClose2").click(function(){
		disablePopup();
	});
	//Click out event!
	$j("#backgroundPopup").click(function(){
		disablePopup();
	});
	//Press Escape event!
	$j(document).keypress(function(e){
		if(e.keyCode==27){
			popupStatus==1;
			disablePopup();
		}
	});
});

var pausecomp = function(millis){
	var date = new Date();
	var curDate = null;

	do { curDate = new Date(); }
	while(curDate-date < millis);
} 

window.onload = function(){
//following code will be here
	//LOADING POPUP
	//Click the button event!
		//centering with css
		centerPopup();
		//pausecomp(1250);
		//load popup
		setTimeout("loadPopup()", 1250);
}