	// gmail code
	var isIE=(window.attachEvent && !window.opera);
	var Ka=navigator.userAgent.toLowerCase();
	var rt=Ka.indexOf("opera")!=-1;
	var r=Ka.indexOf("msie")!=-1&&(document.all&&!rt);
	
	function myAttachEvent(a,b,c){if(r){a.attachEvent("on"+b,c)}else{a.addEventListener(b,c,false)}}


function getXCoord(el) {
	x = 0;
	while(el){
		x += el.offsetLeft;
		el = el.offsetParent;
	}
	return x;
}

function getYCoord(el) {
	y = 0;
	while(el){
		y += el.offsetTop;
		el = el.offsetParent;
	}
	return y;
}



/*
function $(id) {
	return document.getElementById(id);
}
*/




/* ===================================== */
var divPageMask;
var divPopContainer;

function OpenMask()
{

	if(!$('divPageMask')){
		divPageMask = document.createElement('div');
		divPageMask.id = "divPageMask";
		document.body.appendChild(divPageMask);
	}
	divPageMask.innerHTML='';
	divPageMask.style.display="none";

	// set opacity
	/*if(isIE){
			divPageMask.style.filter= ' alpha(opacity=70); ';
	
	}else{
			divPageMask.style.opacity=0.7;
	}*/
	
	

	divPageMask.style.backgroundColor ="#000000";
	divPageMask.style.position = 'absolute';
	divPageMask.style.left =0+'px';
	divPageMask.style.top = 0+'px';		
	divPageMask.style.zIndex = "1";
	
	
	myAttachEvent(divPageMask,'click', CloseMask); 
	

	
	  //select
	  DispalySelect(0);  
	  
	  //?Bnh
	  /*divPageMask.style.display="block";*/	  
		Effect.Appear(divPageMask, {   from: 0.0, to: 0.8,duration: 0.6});
	 
	 //BzBnh
	  resizeMask();
	  myAttachEvent(window,'resize', resizeMask); 
	  myAttachEvent(window,'scroll', resizeMask); 
	  
	

}

function DispalySelect(val)
{  //?Mselect
 var dispalyType;
  var arrdispalyType=["hidden","visible"];
  var arrObjSelect=document.getElementsByTagName("select");
  for (i=0;i<arrObjSelect.length;i++)
  {
    arrObjSelect[i].style.visibility=arrdispalyType[val];
  }
}



function CloseMask()
{
	//select
	DispalySelect(1);
	

	
	window.onResize = null;
	window.onScroll = null;
	
	
	
	if($('divPopContainer')){
		/*divPopContainer.style.display="none";*/
		new Effect.Fade(divPopContainer, { duration: 0.6});
	}
	
	
	//BzBnh
	if(divPageMask){
		/*divPageMask.style.display="none";*/
		
		Effect.Fade(divPageMask, { duration: 0.6} );
	}

}


function resizeMask()
{

  var myWidth = 0, myHeight = 0;
  if(window.innerWidth) {

    //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;
  }
  
	  
	if(document.body.scrollWidth!=""){
		myWidth=Math.max(document.body.scrollWidth, myWidth);
	}
	
	
	if(document.body.scrollHeight!=""){
		myHeight=Math.max(document.body.scrollHeight, myHeight);
	}
	
	divPageMask.style.height=myHeight+'px';
	divPageMask.style.width=myWidth+'px';


	if($("divPopContainer")){
		
		divPopContainer=$("divPopContainer");
		getViewPoint(); // DL DT
		getViewport(); //  viewportwidth viewportheight
		divPopContainer.style.left=DL+(viewportwidth/2)-(divPopContainer.offsetWidth/2) +'px';
		divPopContainer.style.top =DT+(viewportheight/2)-(divPopContainer.offsetHeight/2)+'px';
	
	}
}

var DL, DT;
function getViewPoint(){
  if(window.pageXOffset){DL=window.pageXOffset;}
  else if(document.documentElement&&document.documentElement.scrollLeft){
    DL=document.documentElement.scrollLeft;}
  else if(document.body){DL=document.body.scrollLeft;}
  
  if(window.pageYOffset){DT=window.pageYOffset;}
  else if(document.documentElement&&document.documentElement.scrollTop){
    DT=document.documentElement.scrollTop;}
  else if(document.body){DT=document.body.scrollTop;}
}


var viewportwidth;
 var viewportheight;
 function getViewport(){
 // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
 
 if (typeof window.innerWidth != 'undefined')
 {
      viewportwidth = window.innerWidth;
      viewportheight = window.innerHeight;
	
 }
 
// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
 else if (typeof document.documentElement != 'undefined'    && typeof document.documentElement.clientWidth !=     'undefined' && document.documentElement.clientWidth != 0)
 {
       viewportwidth = document.documentElement.clientWidth;
       viewportheight = document.documentElement.clientHeight;	

 }
 
 // older versions of IE
 else
 {
       viewportwidth = document.getElementsByTagName('body')[0].clientWidth;
       viewportheight = document.getElementsByTagName('body')[0].clientHeight;
 }
/* ===================================== */

 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 


function jspop(obj_id){
	var obj=$(obj_id);
	


	/*CloseMask();*/
	OpenMask();
	
	
	if(!$('divPopContainer')){
		divPopContainer = document.createElement('div');
		divPopContainer.id = "divPopContainer";
		document.body.appendChild(divPopContainer);
	}
	
	divPopContainer.innerHTML=obj.innerHTML;
	

	
	divPopContainer.style.position = 'absolute';
	


	divPopContainer.style.display="";
	divPopContainer.style.visibility="hidden"; /* for cal  offsetWidth */
	
		
	getViewPoint(); // DL DT
	getViewport(); //  viewportwidth viewportheight
	divPopContainer.style.left =DL+(viewportwidth/2)-(divPopContainer.offsetWidth/2) +'px';
	divPopContainer.style.top =DT+(viewportheight/2)-(divPopContainer.offsetHeight/2)+'px';
		
	divPopContainer.style.display="none";
	divPopContainer.style.visibility=""; 
	

	new Effect.Appear(divPopContainer, { duration: 0.6});
	
	divPopContainer.style.zIndex = "2";
	
	

	return false;
}
