/////////////////////////////////////////////////////////////////////
// Common Library JavaScript Component File (.Net 2.0)
// Version : 103 (15.01.2008)
/////////////////////////////////////////////////////////////////////
function OpenWindowFixed(url, name, w, h)
{	
	if(w == 0 && h == 0)
	{
		w = 150;
		h = 150;
	}

	l = (screen.width / 2) - (w / 2);
	t = (screen.height / 2) - (h / 2);
	
	newWindow = window.open(url, name, 'location=0, resizable=0, scrollbars=1, status=0, width=' + w + ', height=' + h + ', top=' + t + ', left=' + l);
	newWindow.focus();
	
	return false;
}

function OpenWindowSizable(url, name, w, h)
{	
	if(w == 0 && h == 0)
	{
		w = 150;
		h = 150;
	}

	l = (screen.width / 2) - (w / 2);
	t = (screen.height / 2) - (h / 2);
	
	newWindow = window.open(url, name, 'location=no, resizable=1, scrollbars=1, status=0, width=' + w + ', height=' + h + ', top=' + t + ', left=' + l);
	newWindow.focus();
	
	return false;
}

function OpenWindowDialog(url, name, w, h)
{	
	OpenWindowFixed(url, name, w, h);
	/*if(w == 0 && h == 0)
	{
		l = 0
		t = 0;
		w = 150;
		h = 150;
	}
	else
	{
		l = (screen.width / 2) - (w / 2);
		t = (screen.height / 2) - (h / 2);
	}
	
	if (window.showModalDialog)
	{
		window.showModalDialog(url, name, 'status=0; help=0; dialogWidth=' + w + 'px; dialogHeight=' + h + 'px;');	
	}
	else
	{
		window.open(url, name, 'modal=1, menubar=0, scrollbars=1, resizable=0, width=' + w + ', height=' + h + ', top=' + t + ', left=' + l);
		
	}*/
	
	return false;
}

function Alert(msg)
{	
	alert(msg);
}

function Confirm(msg)
{	
	return window.confirm(msg);
}

function ConfirmDouble(msg1, msg2)
{	
	if(window.confirm(msg1))
	{
		return window.confirm(msg2);
	}
	else
	{
		return false;
	}
}

function RefreshParentWindow()
{
	if(window.opener != null)
	{
		window.opener.document.forms(0).submit();
	}
	else
	{
	
	}
}

function PostBackParentWindow(c)
{
	if(window.opener != null)
	{
		window.opener.__doPostBack(c, '');
	}
	else
	{
	
	}
}
	
function MoveWindowTo(x , y)
{
	window.moveTo(x, y);
}

function MoveWindowToCenter()
{
	if(parseInt(navigator.appVersion) > 3)
	{
		if(navigator.appName == "Netscape")
		{
			w = window.innerWidth;
			h = window.innerHeight;
		}
		if(navigator.appName.indexOf("Microsoft") != -1)
		{
			w = document.body.offsetWidth;
			h = document.body.offsetHeight;
		}
	}
	
	x = (screen.width / 2) - (w / 2);
	y = (screen.height / 2) - (h / 2);
	
	// for normal windows...
	window.moveTo(x, y);
	
	// for modal windows...
    window.dialogLeft = x + "px";
    window.dialogTop = y + "px";
}

function CloseWindow()
{
	window.close();
}

function ResizeWindowTo(w, h)
{	
	// for normal windows...
	window.resizeTo(w, h);
    
    // for modal windows...
    window.dialogWidth = w + "px";
    window.dialogHeight = h + "px";
}

function ResizeWindowToFullScreen()
{	
	window.moveTo(0, 0);
	
	// for normal windows...
	window.resizeTo(screen.availWidth, screen.availHeight);
    
    // for modal windows...
    window.dialogWidth = screen.availWidth + "px";
    window.dialogHeight = screen.availHeight + "px";
}

function DoBeforePaste(c)
{
    maxLength = c.attributes["maxLength"].value;
    if(maxLength)
    {
         event.returnValue = false;
    }
}

function DoPaste(c)
{
    maxLength = c.attributes["maxLength"].value;
    value = c.value;
    if(maxLength)
    {
         event.returnValue = false;
         maxLength = parseInt(maxLength);
         var oTR = c.document.selection.createRange();
         var iInsertLength = maxLength - value.length + oTR.text.length;
         var sData = window.clipboardData.getData("Text").substr(0,iInsertLength);
         oTR.text = sData;
    }
}

function LimitInput(c)
{
    if(c.value.length > c.attributes["maxLength"].value)
    {
        c.value = c.value.substring(0,c.attributes["maxLength"].value);
    }
}

/////////////////////////////////////////////////////////////////////
