﻿function setElement(objectId,value)
{
    try
    {
        document.getElementById(objectId).value = value;
    }
    catch(e)
    {
    }
}


function openPopup(url, isImageButton)
{
    myRef = window.open(url,'mywin','left=20,top=20,width=500,height=450,toolbar=0,resizable=1,scrollbars=1');
    if(!myRef)
        alert('We have detected that your popup blocker prevented us from launching. Please enable your browser to allow this site to launch popups');
     //this is for onclientClicks not to do a postback on imageButtons
     if(isImageButton)
        return false;
     
     myRef.focus();
}

function closePopup()
{	
    //Close this window and reload the parent.
    window.close();
}

function openSizeablePopup(url, isImageButton, width, height)
{
    myRef = window.open(url,'mywin','left=20,top=20,width='+width+',height='+height+',toolbar=0,resizable=1,scrollbars=1');
    if(!myRef)
        alert('We have detected that your popup blocker prevented us from launching. Please enable your browser to allow this site to launch popups');
     //this is for onclientClicks not to do a postback on imageButtons
     if(isImageButton)
        return false;
     
     myRef.focus();
}

var mediaId;
function openMediaPopup(mediaId, isImageButton, width, height, path)
{	
    myRef = window.open(path + '?mediaId='+mediaId,'mywin','left=20,top=20,width='+width+',height='+height+',toolbar=0,resizable=1,scrollbars=0');
    if(!myRef)
        alert('We have detected that your popup blocker prevented us from launching. Please enable your browser to allow this site to launch popups');
     //this is for onclientClicks not to do a postback on imageButtons
     if(isImageButton)
        return false;
     
     myRef.focus();
}