﻿//@Sheron

function BindPopUp(id)
{
    var element = document.getElementById(id);
    
    var address = null;
    
    if(element != null)
    {
        address = element.href;
        
        element.href = "javascript:LaunchPopUp('" + address + "');";
    }
}

function LaunchPopUp(address)
{
    var result = null;
	result = window.open(address, "popup", "width="+screen.width+", height="+screen.height+", location=0, menubar=no, status=no, toolbar=no, scrollbars=1, resizable=yes");
	if (result != null)
    {
	    //Popup launch successful
	    //Position the popup window at top left corner of the screen
	    result.moveTo(0,0);
	    result.focus();
	}
	else//Unable to launch popup
	{
	    //Redirect to the address in the same window itself
		this.location = address;
	}
}