﻿var openedWin=null,wpercent=100;function launch(){var args=launch.arguments,url=vRoot+"/"+args[0],width=args[1],height=args[2];if(!url||!width||!height)alert("Error in arguments");else{var scr_w=screen.availWidth,scr_h=screen.availHeight,target_w=0,target_h=0;wpercent=100;var scr_w=screen.availWidth,scr_h=screen.availHeight;if(width>=scr_w||height>=scr_h){if(width>=scr_w&&height<scr_h)wpercent=Math.floor((scr_w-8)*100/width);else if(height>scr_h)wpercent=Math.floor((scr_h-27)*100/height);width=Math.floor(width*wpercent/100);height=Math.floor(height*wpercent/100)}_launch(url,width,height,args[3],args[4],args[5],args[6],args[7],args[8],args[9])}}function _launch(){closeChild();var args=_launch.arguments,url=args[0],width=args[1],height=args[2],resizable=args[3]?"yes":"no",scrollbars=args[4]?"yes":"no",toolbar=args[5]?"yes":"no",menubar=args[6]?"yes":"no",status=args[7]?"yes":"no",address=args[8]?"yes":"no",directories=args[9]?"yes":"no",NewX=Math.max(0,Math.floor((screen.availWidth-(width+8))/2)),NewY=Math.max(0,Math.floor((screen.availHeight-(height+27))/2)),params=[];params.push("width="+width);params.push("height="+height);params.push("screenx="+NewX);params.push("screeny="+NewY);params.push("left="+NewX);params.push("top="+NewY);params.push("resizable="+resizable);params.push("scrollbars="+scrollbars);params.push("toolbar="+toolbar);params.push("menubar="+menubar);params.push("status="+status);params.push("location="+address);params.push("directories="+directories);openedWin=window.open(url,"",params.join(","))}function closeChild(){if(openedWin!=null)if(!openedWin.closed)openedWin.close()}onunload=closeChild