 var AX_Width=0, AX_Height=0;
 var AX_ScrOfX=0, AX_ScrOfY=0;
 var pageW=960;
 var py=0;
 var dnsp=false;//Popup will remain static on the window when scrolled
 var t=".png";
 var popVisibleDivID = null;

  var browser = navigator.appName;//detecting browser IE 6 and below
    var version = navigator.appVersion;
    if ( browser== "Microsoft Internet Explorer" )
        {
        var version1 = version.substring(22,25);
        var sisop = version.substring(26,41);
		if (parseInt(version1)<7){
			t=".gif";
		}
    }
 function AX_Win_Prop() {
    AX_Width = document.body.clientWidth;
    AX_Height = document.body.clientHeight;
	AX_ScrOfY = document.body.scrollTop;
    AX_ScrOfX = document.body.scrollLeft;
}


 function AX_Pop_Create(objpop){
	var pPID="";
	document.getElementById("popdiv").style.display="block";
	if (objpop.pID && typeof(objpop.pID) != "undefined") pPID = objpop.pID;
	var pBG=document.createElement("DIV");
	pBG.className="pBG";
	AX_Win_Prop();
	pBG.style.top=AX_ScrOfY+"px";
	pBG.style.left=AX_ScrOfX+"px";
	pBG.id="ipopbg"+pPID;
	popVisibleDivID = pPID;
	//document.body.appendChild(pBG);
	document.getElementById("popdiv").appendChild(pBG);

	var pP=document.createElement("DIV");
	var dHeight=parseInt(objpop.pHeight)+18, dWidth=parseInt(objpop.pWidth)+18;
	var iHeight=parseInt(objpop.pHeight)-22;
	var iWidth=parseInt(objpop.pWidth)-22;


	if (isNaN(objpop.pTop/objpop.pTop)){
		var dTop=((document.body.clientHeight-parseInt(objpop.pHeight))/2)+AX_ScrOfY;
	}
	else {
		var dTop=parseInt(AX_ScrOfY)+parseInt(objpop.pTop);
	}
	if (isNaN(objpop.pLeft/objpop.pLeft)){
		var dLeft=((document.body.clientWidth-parseInt(objpop.pWidth))/2)+AX_ScrOfX;
	}
	else {
		var dLeft=((document.body.clientWidth-pageW)/2)+parseInt(objpop.pLeft);
	}
	

	
	pP.style.position="absolute";
	pP.style.zIndex="1001";
	pP.style.height=dHeight+"px";
	pP.style.width=dWidth+"px";
	pP.style.top=dTop+"px";
	pP.style.left=dLeft+"px";
	pP.id="ipop"+pPID;
	var d=new Date();
	var fID="lPopFrame"+pPID;


	pP.innerHTML='<table border="0" cellspacing="0" cellpadding="0"><tr><td style="height:16px;width:17px;"><img src="'+iPop_imagePath+'local/localgraphics/ds_corner_lftop'+t+'"  height="16" width="17"></td><td style="height:16px;background:url('+iPop_imagePath+'local/localgraphics/ds_1top'+t+') transparent;"></td><td style="height:16px;width:23px;"><img src="'+iPop_imagePath+'local/localgraphics/ds_corner_rttop'+t+'" height="16" width="23"></td></tr><tr><td style="width:17px;background:url('+iPop_imagePath+'local/localgraphics/ds_1left'+t+') transparent;"></td><td style="background-color:#5C5C5C;padding-top:'+objpop.tP+';padding-right:'+objpop.rP+';padding-bottom:'+objpop.bP+';padding-left:'+objpop.lP+';"><iframe scrolling="no" src="" frameborder="0" height="'+iHeight+'" width="'+iWidth+'" id="'+fID+'" name="'+fID+'" style="background-color: #FFFFFF" closeP=""></iframe></td><td style="width:23px;background:url('+iPop_imagePath+'local/localgraphics/ds_1right'+t+') transparent;"></td></tr><tr><td style="height:24px;width:17px;"><img src="'+iPop_imagePath+'local/localgraphics/ds_corner_lfbottom'+t+'" height="24" width="17" ></td><td style="height:24px;background:url('+iPop_imagePath+'/local/localgraphics/ds_1bottom'+t+') transparent;"></td><td style="height:24px;width:23px;"><img src="'+iPop_imagePath+'/local/localgraphics/ds_corner_rtbottom'+t+'" height="24" width="23" ></td></tr></table>';
	pBG.pop=pP;
	
	document.getElementById("popdiv").appendChild(pP);
	document.getElementById(fID).src=objpop.source;
	document.getElementById(fID).contentWindow.pop=pBG;

	objpop.pBG=pBG;
	objpop.pF=document.getElementById(fID);
	objpop.close=function(){
		parent.document.getElementById("lPopFrame"+pPID).src=iPop_imagePath+'local/localbuttons/close03_btn.gif';
		document.getElementById("popdiv").removeChild(pBG.pop);
		document.getElementById("popdiv").removeChild(pBG);
		py-=1;
		delete objpop;
		document.getElementById("popdiv").style.display="none";
		if($.browser.msie && ($.browser.version < 7)){$("select").css("visibility","visible");}
	}
	pBG.onclick=objpop.close;
	document.getElementById(fID).closeP=objpop.close;
	py+=1;
	if($.browser.msie && ($.browser.version < 7)){$("select").css("visibility","hidden");}
 }

  function AX_Pop(pH,pW,pT,pL,pS,pID,pST,pTP){
	this.pHeight=pH;
	this.pWidth=pW;
	this.pTop=pT;
	this.pLeft=pL;
	this.pType=pTP;
	this.source=pS;
	this.pID=pID;
	this.sourceType=pST;
	AX_Pop_Create(this);	
 }
function wf(){
	if(py>0){
			if(dnsp){
				document.getElementById("ipopbg" + popVisibleDivID).style.top=document.body.scrollTop+"px";
				document.getElementById("ipopbg" + popVisibleDivID).style.left=document.body.scrollLeft+"px";
			}
			else{
				document.getElementById("ipopbg" + popVisibleDivID).style.top=document.body.scrollTop+"px";
				document.getElementById("ipopbg" + popVisibleDivID).style.left=document.body.scrollLeft+"px";
				document.getElementById("ipop"  + popVisibleDivID).style.top=((document.body.clientHeight-parseInt(document.getElementById("ipop" + popVisibleDivID).style.height))/2)+document.body.scrollTop+"px";
				document.getElementById("ipop" + popVisibleDivID).style.left=((document.body.clientWidth-parseInt(document.getElementById("ipop" + popVisibleDivID).style.width))/2)+document.body.scrollLeft+"px";
			}
		}
}
window.onscroll=wf;
window.onresize=wf;