function resizer() {
	var iMinHeight;
	var iOffset;
	if ( typeof( window[ 'minimumheight' ] ) != "undefined" ) {
   		iMinHeight = minimumheight;
	}
	else {
		iMinHeight = 400;
	}
	if ( typeof( window[ 'offset' ] ) != "undefined" ) {
   		iOffset = offset;
	}
	else {
		iOffset = 137;
	}
	var height = getViewportHeight();
	if ( height >= iMinHeight ) {
		//prevent css errs
		try{
		    var pc = document.getElementById("masterpage_container");
		    if (pc) {
	            {pc.style.height=parseInt( height- pc.offsetTop-iOffset )+"px";}
		    }
		}catch(err){}
	}
}
function getViewportHeight() {
	if (window.innerHeight!=window.undefined) return window.innerHeight;
	if (document.compatMode=='CSS1Compat') return document.documentElement.clientHeight;
	if (document.body) return document.body.clientHeight;

	return window.undefined;
}
function getViewportWidth() {
	var offset = 17;
	var width = null;
	if (window.innerWidth!=window.undefined) return window.innerWidth;
	if (document.compatMode=='CSS1Compat') return document.documentElement.clientWidth;
	if (document.body) return document.body.clientWidth;
}

/**
 * Gets the real scroll top
 */
function getScrollTop() {
	if (self.pageYOffset) // all except Explorer
	{
		return self.pageYOffset;
	}
	else if (document.documentElement && document.documentElement.scrollTop)
		// Explorer 6 Strict
	{
		return document.documentElement.scrollTop;
	}
	else if (document.body) // all other Explorers
	{
		return document.body.scrollTop;
	}
}
function getScrollLeft() {
	if (self.pageXOffset) // all except Explorer
	{
		return self.pageXOffset;
	}
	else if (document.documentElement && document.documentElement.scrollLeft)
		// Explorer 6 Strict
	{
		return document.documentElement.scrollLeft;
	}
	else if (document.body) // all other Explorers
	{
		return document.body.scrollLeft;
	}
}

function modalWin(obj) {
if ( typeof(obj)==="object") {
	var url = obj.url;
	var windowname = typeof (obj.name) != 'undefined' ? obj.name : (new Date()).getSeconds().toString();
	var toolbar = typeof (obj.toolbar) != 'undefined' ? obj.toolbar : 'no';
	var height = typeof (obj.height) != 'undefined' ? obj.height : 500;
	var width = typeof (obj.width) != 'undefined' ? obj.width : 700;
	var resizable = typeof (obj.resizable) != 'undefined' ? obj.resizable : "yes";
	var center = typeof (obj.center) != 'undefined' ? obj.center : "no";
	var scroll = typeof (obj.scroll) != 'undefined' ? obj.scroll : "yes";
    
	var parms
	if (window.showModalDialog) {
		var args = { name: windowname, opener: self } ;
		parms = "dialogWidth:" + width + "px;";
		parms += "dialogHeight:" + height + "px;";
		parms += "resizable:" + resizable + ";";
		parms += "center:" + center + ";";
		parms += "scroll:" + scroll;
		window.showModalDialog(url, args, parms);
	} else {
		parms = "height=" + height + ',';
		parms += "width=" + width + ',';
		parms += "toolbar=" + toolbar + ","
		parms += "directories=no,"
		parms += "status=no,"
		parms += "menubar=no,"
		parms += "scrollbars=no,"
		parms += "resizable=no,"
		parms += "modal=yes"
		window.open(url,windowname,parms);
	}
	}
}

var dialogWin = new Object()
// Generate a modal dialog.
// Parameters:
//    url -- URL of the page/frameset to be loaded into dialog
//    width -- pixel width of the dialog window
//    height -- pixel height of the dialog window
//    returnFunc -- reference to the function (on this page)
//                  that is to act on the data returned from the dialog
//    args -- [optional] any data you need to pass to the dialog
function openDialog(url, width, height, parms, returnFunc, args, dialogname) {
	if (!dialogWin.win || (dialogWin.win && dialogWin.win.closed)) {
		// Initialize properties of the modal dialog object.

		if (returnFunc==null ) { returnFunc = "";}
		if (args==null ) { args = "";}

		dialogWin.returnFunc = returnFunc
		dialogWin.returnedValue = ""
		dialogWin.args = args
		dialogWin.url = url
		dialogWin.width = width
		dialogWin.height = height

		// Keep name unique so Navigator doesn't overwrite an existing dialog.
		if (dialogname) {
			dialogWin.name = dialogname
		}
		else {
			dialogWin.name = (new Date()).getSeconds().toString()
		}	
		// Assemble window attributes and try to center the dialog.
		if (parms==null || parms=="") {	parms = "resizable=no";}

		// The best we can do is center in screen.
		dialogWin.left = (screen.width - dialogWin.width) / 2
		dialogWin.top = (screen.height - dialogWin.height) / 2
		var attr = "left=" + dialogWin.left + ",top=" + dialogWin.top + "," + parms + ",width=" + dialogWin.width + ",height=" + dialogWin.height

		// Generate the dialog and make sure it has focus.
		dialogWin.win=window.open(dialogWin.url, dialogWin.name, attr)
		dialogWin.win.focus()
	} else {
		dialogWin.win.focus()
	}
	//If current document is maintaining a list of popups, add this to the array
	if (document.rtpopups) {
		document.rtpopups.push(  dialogWin.win  );	
	}
}

