var _CurrentPopupBox = null;
function OpenModal(url, boxId)
{
	if (_CurrentPopupBox != null) _CurrentPopupBox.style.display = 'none';
	
	if (boxId == null) boxId = StandardModal;
	
	var box = document.getElementById(boxId);
	_CurrentPopupBox = box;
	// Move the box to the center of the screen:
	box.style.display = 'block';
	document.getElementById(boxId + '_Frame').src = url;
	document.getElementById(boxId + '_Cover').style.display='block';
}

function CloseModal(refreshParent)
{
	if (_CurrentPopupBox == null) return;
	document.getElementById(_CurrentPopupBox.id + '_Frame').src = '/PleaseWait.htm';
	document.getElementById(_CurrentPopupBox.id + '_Cover').style.display='';

	_CurrentPopupBox.style.display = 'none';
	_CurrentPopupBox = null;
	if (refreshParent==true)
	{
		window.location = window.location;
	}
}

/// This will break the execution for current javascript thread.
function Break()
{
	// Return nothing. This method is meant to be used in hyperlink href's
}

function OpenBrowserWindow(url, target)
{
	window.open(url, target);
}

function ShowPleaseWait()
{
    var image = document.createElement("img");
    
    image.style.position = "absolute";
    image.style.left=0;
    image.style.top=0;
    image.style.margin ='30% 50% 50% 50%';    
    image.setAttribute("src","/Images/PleaseWait.gif");
    
    document.getElementById('aspnetForm').appendChild(image);  
}

function UpdateFileUploadStatus(lstMode, fileUploadControlId)
{
    var prefix = lstMode.getAttribute('id').substring(0, lstMode.getAttribute('name').lastIndexOf("$") + 1);
    var file = document.getElementById(prefix + fileUploadControlId);
    
    if (lstMode.selectedIndex == 1 && file.style.display == 'none') 
        file.style.display = '';              
    else
        file.style.display='none';
}