﻿
//SETTING UP OUR POPUP
//0 means disabled; 1 means enabled;
var popupStatus = 0;

//loading popup with jQuery magic!
function loadPopup(){
	//loads popup only if it is disabled
	if(popupStatus==0){
		$("#backgroundPopup").css({
			"opacity": "0.3"
		});
		$("#backgroundPopup").fadeIn("fast");
		$("#popupContact").fadeIn("fast");
		popupStatus = 1;
	}
}

function loadPopup2(id){
	//loads popup only if it is disabled
	var poptext = document.getElementById('popup_head_text');
	if (id == 1) poptext.innerHTML="The full report is for registered members only.<br>Membership is absolutely FREE and can be done below.";
	if (id == 2) poptext.innerHTML="'Add to favorites' functionality is for registered members only. Membership is absolutely FREE and can be done below.";
	if (id == 3) poptext.innerHTML="'Save searches' functionality is for registered members only. Membership is absolutely FREE and can be done below.";
	if(popupStatus==0){
		$("#backgroundPopup").css({
			"opacity": "0.3"
		});
		$("#backgroundPopup").fadeIn("fast");
		$("#div_unregister").fadeIn("fast");
		popupStatus = 1;
	}
}

function disablePopup(){
	//disables popup only if it is enabled
	if(popupStatus==1){
		$("#backgroundPopup").fadeOut("fast");
		$("#popupContact").fadeOut("fast");
		popupStatus = 0;
	}
}

function disable_full(){
	//disables popup only if it is enabled
    Ext.getCmp('quickReport').setValue(true);
    Ext.getCmp('fullReport').setValue(false);
}

//disabling popup with jQuery magic!
function disablePopup2(){
	//disables popup only if it is enabled
    Ext.getCmp('quickReport').setValue(true);
    Ext.getCmp('fullReport').setValue(false);
	
	if(popupStatus==1){
		$("#backgroundPopup").fadeOut("fast");
		$("#div_unregister").fadeOut("fast");
		popupStatus = 0;
	}
}

//centering popup
function centerPopup(){
	//request data for centering
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	var popupHeight = $("#popupContact").height();
	var popupWidth = $("#popupContact").width();
	//centering
	$("#popupContact").css({
		"position": "absolute",
		"top": windowHeight/2-popupHeight/2,
		"left": windowWidth/2-popupWidth/2-50
	});
	//only need force for IE6
	
	$("#backgroundPopup").css({
		"height": 1000
	});
	
}

function centerPopup2(){
	//request data for centering
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	var popupHeight = $("#div_unregister").height();
	var popupWidth = $("#div_unregister").width();
	//centering
	$("#div_unregister").css({
		"position": "absolute",
		"top": windowHeight/2-popupHeight/2,
		"left": windowWidth/2-popupWidth/2-50
	});
	//only need force for IE6
	
	$("#backgroundPopup").css({
		"height": 1000
	});
	
}



//CONTROLLING EVENTS IN jQuery
$(document).ready(function(){
	
				
	//CLOSING POPUP
	//Click the x event!
	$("#popupContactClose").click(function(){
		disablePopup();
	});
	//Click out event!

});