// JScript File

//Routines to show the RadWindow
function loadSendListing(aid, sid){
    var oManager = GetRadWindowManager();
        //Show a particular existing window
    var oWnd = oManager.getWindowByName("winListingAddOn");  
    oWnd.add_close(empty); 
    oWnd.setUrl("lisSendListing.aspx?aid="+aid+"&sid="+sid);
    oWnd.SetSize("600px","680px");
    oWnd.show();
}

function loadSend2Mobile(aid, sid){
    var oManager = GetRadWindowManager();
        //Show a particular existing window
    var oWnd = oManager.getWindowByName("winListingAddOn");   
    oWnd.add_close(OnClientClose); 
    oWnd.setUrl("lisSend2Mobile.aspx?aid="+aid+"&sid="+sid);
    oWnd.SetSize("600px","650px");
    oWnd.show();
}

function loadBusMap(aid, sid){
    var oManager = GetRadWindowManager();
        //Show a particular existing window
    var oWnd = oManager.getWindowByName("winListingAddOn");   
    oWnd.setUrl("lisBusMap.aspx?aid="+aid+"&sid="+sid);
    oWnd.SetSize("950px","850px");
    oWnd.show();
    
}

function loadBusGallery(aid, sid, gal){
    var oManager = GetRadWindowManager();
        //Show a particular existing window
    var oWnd = oManager.getWindowByName("winListingAddOn");   
    oWnd.setUrl("lisBusGallery.aspx?aid="+aid+"&sid="+sid+"&gal="+gal);
    oWnd.SetSize("1050px","700px");
    oWnd.show();
    
}

function loadBusVideo(aid, sid, vid){
    var oManager = GetRadWindowManager();
        //Show a particular existing window
    var oWnd = oManager.getWindowByName("winListingAddOn");
    oWnd.add_close(OnClientClose);
    oWnd.setUrl("lisBusVideo.aspx?aid="+aid+"&sid="+sid+"&vid="+vid);
    oWnd.SetSize("950px","550px");
    oWnd.show();        
} 


function loadC2Call(aid, sid){
    var oManager = GetRadWindowManager();
        //Show a particular existing window
    var oWnd = oManager.getWindowByName("winListingAddOn");   
    oWnd.setUrl("lisClick2Call.aspx?aid="+aid+"&sid="+sid);
    oWnd.SetSize("550px","520px");
    oWnd.show();
    
}


function empty(){}



//Refreshes after the submit has been sent
function OnClientCloseBusiness(oWnd)
{
    var arg = oWnd.argument;
    if (arg){
         //Then I refresh so the review makes apparent.
        window.location.href = window.location.href;// - will refresh the page by reloading the URL     
        
        //I cleanup...
        //NOTE: I remove the event and argument cause they accumulate. 
        //If I didn't then those events and args would apply for the next requests
        //for the oWnd
        if(oWnd){
            oWnd.argument = null;
            oWnd.setUrl("about:blank"); // Sets url to blank 
            oWnd.remove_close(OnClientCloseBusiness); 
        }
        
       
    }
    
}

//Alert to confirm the result of the operations
function OnClientClose(oWnd)
{
    var arg = oWnd.argument;
    if (arg){
        radalert(arg.return_msg,300, 100,arg.sender_aspx);    
    }
    
    //I cleanup...
    //NOTE: I remove the event and argument cause they accumulate. 
    //If I didn't then those events and args would apply for the next requests
    //for the oWnd
    if(oWnd){
        oWnd.argument = null;
        oWnd.setUrl("about:blank"); // Sets url to blank 
        oWnd.remove_close(OnClientClose); 
    }   
}