/***************************/
// @Author: TUONG NGUYEN - GOS Viet Nam
//
// @Company: Global Outsource Solutions - GOS VIET NAM
// @Address: 57 Lam Hoang Street - Vy Da - Hue
// @Phone: (+84) 906 583 186
// @website: www.gos.com.vn
// @email: tuong@gos.com.vn
// @license: 

// SAMPLE
/***************************/

var gosPopup = {
	popupStatus: 0,

 	'loadPopup':function(id){
		if(gosPopup.popupStatus==0){
			jQuery("#backgroundPopup").css({
				"opacity": "0.8"
			});
			jQuery(id).css({
				"z-index": "999"
			});
			
			jQuery("#backgroundPopup").fadeIn("slow");
			jQuery(id).fadeIn("slow");
			gosPopup.popupStatus = 1;
		}
	},

	'disablePopup':function(id){
		if(gosPopup.popupStatus==1){
			jQuery("#backgroundPopup").fadeOut("slow");
			jQuery(id).fadeOut("slow");
			gosPopup.popupStatus = 0;
		}
	},

	'centerPopup':function(id){
		//request data for centering
		var windowWidth = document.documentElement.clientWidth;
		var windowHeight = document.documentElement.clientHeight;
		var popupHeight = jQuery(id).height();
		var popupWidth = jQuery(id).width();
		var top = jQuery(window).scrollTop();
		
		//centering
		jQuery(id).css({
			"position": "absolute",
			"top": top+windowHeight/2-popupHeight/2,
			"left": windowWidth/2-popupWidth/2
		});
		//only need force for IE6
		
		jQuery("#backgroundPopup").css({
			"height": windowHeight
		});		
	},
	
	'show':function(id){
		gosPopup.centerPopup(id);
		//load popup
		gosPopup.loadPopup(id);		
	},
	'hide':function(id){
		gosPopup.disablePopup(id);
	},
	'init':function(){
		jQuery('.have-questions-list a').click(function(){
			gosPopup.show(this.hash);
		});
	}
}
