/**JumpTalke
*Sample: jQuery('#button').click(function(){
						jQuery('#popupContact').setPopupContact(jQuery('#backgroundPopup'),jQuery('#popupContactClose'),0,0);	
				  });
* plus_width,plus_height的参数来设置jQuery('#popupContact')在浏览器中的位置
*/

jQuery.fn.setPopupContact = function(backgroundPopup_obj,popupContactClose_obj,plus_width,plus_height)
{
    var popupStatus = 0;
	var backgroundPopup = jQuery(backgroundPopup_obj);
	var popupContact = jQuery(this);
	var popupContactClose = jQuery(popupContactClose_obj);


    function loadPopup(){   
 //仅在开启标志popupStatus?的情况下加载  
	 if(popupStatus==0){   
		 backgroundPopup.css({"opacity": "0.6"});   
		 backgroundPopup.fadeIn("slow");   
		 popupContact.fadeIn("slow");   
		 popupStatus = 1;   
	  }   
   }  
   function disablePopup(){   
 //仅在开启标志popupStatus?的情况下去除
	  if(popupStatus==1){   
		backgroundPopup.hide("slow");   
		popupContact.hide("slow");   
		popupStatus = 0;   
	  }   
   }  
  function centerPopup(){   
 //获取系统变量
   var windowWidth = document.documentElement.clientWidth;   
   var windowHeight = document.documentElement.clientHeight;   
   var popupHeight = popupContact.height();   
   var popupWidth = popupContact.width();   
 //居中设置   
	 popupContact.css({   
		 "position": "absolute",   
		 "top": 70,   
		 "left": windowWidth/2-popupWidth/2 -211
	  });   
	 //以下代码仅在IE6下有?
	 var winheaight = 0;
	 if(windowHeight > jQuery('body').height() ){
		   winheaight = windowHeight;
	  }else{
		   winheaight = jQuery('body').height();
	  }
	  
	  backgroundPopup.css({ 
		"width"	: windowWidth,			  
	    //"height": jQuery('body').height()  
		"height": winheaight 
	  });   
    }
	//打开弹出窗口 
			  //调用函数居中窗口
				centerPopup(); 
			  //调用函数加载窗口
			    loadPopup(); 			  

			 //关闭弹出窗口   
			 //点击"X"所触发的事?
			 popupContactClose.click(function(){   
                disablePopup();   
             }); 
				 //点击窗口以外背景所触发的关闭窗口事?
			/*backgroundPopup.click(function(){   
				//disablePopup();   
		     //}); */
				 //键盘按下ESC时关闭窗?
			jQuery(document).keypress(function(e){   
				if(e.keyCode==27 && popupStatus==1){   
					disablePopup();   
					}   
			}); 

}
