                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                if(!window.__td){window.__MT=100;window.__ti=0;window.__td=[];window.__td.length=__MT;window.__noTrace=false;


}




if(typeof vp=="undefined"){
var vp={};
}





vp.win=function win(){if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}};





vp.win.childWindows=[];








vp.win._checkForWindow=function win__checkForWindow(oWindow,sFunc){if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}

if(!oWindow){
throw new Error("Call to vp.win."+sFunc+"() with a null window reference.");
}

if(!oWindow.resizeTo||!oWindow.moveTo){
throw new Error("Call to vp.win."+sFunc+"() with a non-window argument.");
}
};







vp.win.verifyWindow=function win_verifyWindow(oWindow)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
if(!oWindow)
{
return false;
}
try
{
if(oWindow.closed)
{
return false;
}

if(!oWindow.resizeTo||!oWindow.moveTo)
{
return false;
}

var sUrl=oWindow.document.location.href;

return true;

}
catch(ex)
{
return false;
}
};







vp.win.center=function win_center(oWindow){if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}

oWindow=oWindow||window;


this._checkForWindow(oWindow);


var iWidth=0,iHeight=0;

if(oWindow.dialogWidth){
iWidth=parseInt(oWindow.dialogWidth);
iHeight=parseInt(oWindow.dialogHeight);
}else if(typeof oWindow.innerWidth=="number"){
iWidth=oWindow.innerWidth;
iHeight=oWindow.innerHeight;
}else if(document.documentElement){
iWidth=document.documentElement.offsetWidth;
iHeight=document.documentElement.offsetHeight;
}else if(document.body){
iWidth=document.body.clientWidth;
iHeight=document.body.clientHeight;
}


if(oWindow.dialogWidth){
oWindow.dialogLeft=((screen.availWidth/2)-(iWidth/2))+"px";
oWindow.dialogTop=((screen.availHeight/2)-(iHeight/2))+"px";
}else{
oWindow.moveTo((screen.availWidth/2)-(iWidth/2),(screen.availHeight/2)-(iHeight/2));
}

};









vp.win.close=function win_close(oWindow){if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}


oWindow=oWindow||window;


this._checkForWindow(oWindow,"close");


oWindow.top.close();
};





vp.win.closeChildWindows=function win_closeChildWindows(){if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}


for(var i=0,c=this.childWindows.length;i<c;i++){
try{this.childWindows[i].close();}
catch(ex){}
}

};







vp.win.isPopup=function win_isPopup(oWindow){if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}


oWindow=oWindow||window;


this._checkForWindow(oWindow,"isPopup");


return!!oWindow.top.opener;
};












vp.win.open=function win_open(sUrl,sName,sFeatures,bDisablePopupBlockingWarning,bIsCrossDomain){if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}

try
{

var oWin=window.open(sUrl,sName,sFeatures);


if(!oWin)
{
if(!bDisablePopupBlockingWarning)
{
alert(vp.LangMap["PopupBlockerWarning"]);
}

return null;
}


if(!bIsCrossDomain)
{
var oTemp=oWin.document;
}


this.childWindows[this.childWindows.length]=oWin;

oWin.focus();


return oWin;

}
catch(ex)
{
return null;
}
};















vp.win.openCentered=function win_openCentered(sUrl,sName,iWidth,iHeight,bResizable,bScrolling,bIsCrossDomain){if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}

iWidth=Math.min(iWidth,screen.width);
iHeight=Math.min(iHeight,screen.height);


var sFeatures="width="+iWidth+",height="+iHeight;


var iLeft=screen.width/2-iWidth/2;
var iTop=screen.height/2-iHeight/2;


sFeatures+=",left="+iLeft+",top="+iTop;


sFeatures+=",resizable="+(bResizable?"yes":"no")+",scrollbars="+(bScrolling?"yes":"no");


return vp.win.open(sUrl,sName,sFeatures,bIsCrossDomain);

};












vp.win.resizeAndCenter=function win_resizeAndCenter(iWidth,iHeight,oWindow)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
if(!oWindow)
{
oWindow=window;
}

var bBodyAvailable=(oWindow&&oWindow.document&&oWindow.document.body)?true:false;

if(!iHeight&&bBodyAvailable)
{
iHeight=oWindow.document.body.scrollHeight+5;
}
else if(!iHeight)
{
throw new Error("vp.win.resizeAndCenter(): document.body not available- call resize window from vp.events.addToOnLoad()");
}

if(!iWidth)
{
iWidth=oWindow.document.body.scrollWidth;
}
else if(!iWidth)
{
throw new Error("vp.win.resizeAndCenter(): document.body not available- call resize window from vp.events.addToOnLoad()");
}

var MAX_HEIGHT=600;
var MAX_WIDTH=800;

if(iWidth>MAX_WIDTH)
{
iWidth=MAX_WIDTH;
}

if(iHeight>MAX_HEIGHT)
{
iHeight=MAX_HEIGHT;
}

if(oWindow.dialogHeight)
{
oWindow.dialogHeight=iHeight+"px";
oWindow.dialogWidth=iWidth+"px";


if(oWindow.document.body.offsetHeight<iHeight)
{
oWindow.dialogHeight=(parseInt(oWindow.dialogHeight)+(iHeight-oWindow.document.body.offsetHeight))+"px";
}

vp.win.center(oWindow);
return;
}

var fnTimeout=function pv_fnTimeout()
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
try
{
oWindow.resizeTo(iWidth,iHeight);
}
catch(err)
{

}

if(bBodyAvailable)
{
var oBody=oWindow.document.body;

if(oBody.scrollHeight>oBody.clientHeight||oBody.scrollWidth>oBody.clientWidth){
oWindow.resizeBy(0,(oBody.scrollHeight-oBody.clientHeight)+20);
}
}

vp.win.center(oWindow);
};


setTimeout(fnTimeout,10);
};









vp.win.getCallbackHandler=function win_getCallbackHandler(iCallbackID,oWin)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
if(!oWin)
{
if(window.parent&&window.parent!=window)
{

oWin=window.parent;
}
else if(window.opener)
{

oWin=window.opener;
}
else
{
throw new Error("vp.win.getCallbackHandler: unable to reach parent window.");
}
}


if(!oWin||!oWin.__callbackHandlers)
{
return null;
}
return oWin.__callbackHandlers[iCallbackID];
};








vp.win.createCallbackHandler=function win_createCallbackHandler(fnHandler)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
if(!window.__callbackHandlers)
{
window.__callbackHandlers=[];
}

var iIndex=-1;
for(var i=0;i<window.__callbackHandlers.length;i++)
{
try
{
if(window.__callbackHandlers[i]==fnHandler)
{
iIndex=i;
break;
}
}
catch(e)
{
window.__callbackHandlers.remove(i);
i--;
}
}

if(iIndex!=-1)
{
return iIndex;
}

window.__callbackHandlers.add(fnHandler);

return window.__callbackHandlers.length-1;
};










vp.win.resizeIFrameToContent=function win_resizeIFrameToContent(vIFrame,bHeight,bWidth)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
if(typeof(vIFrame)=="string")
{
vIFrame=parent.document.getElementById(vIFrame);
}

if(vIFrame)
{
var frameDoc=vIFrame.contentDocument||vIFrame.contentWindow.document;


var x,y;
var scroll=frameDoc.body.scrollHeight;
var offset=frameDoc.body.offsetHeight;
if(scroll>offset)
{
x=frameDoc.body.scrollWidth;
y=frameDoc.body.scrollHeight;
}
else

{
x=frameDoc.body.offsetWidth;
y=frameDoc.body.offsetHeight;
}

if(bHeight)
{
vIFrame.style.height=y+'px';
}

if(bWidth)
{
vIFrame.style.width=x+'px';
}
}
};







vp.win.waitForLoadAndNavigate=function win_waitForLoadAndNavigate(oWin,sURL)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
if(!oWin)
{
return;
}
else if(!oWin.document)
{
var fnRetry=function pv_fnRetry()
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
vp.win.waitForLoadAndNavigate(oWin,sURL);
};
setTimeout(fnRetry,500);
}
else
{
oWin.document.location.replace(sURL);
}
};
