
function _$(dElem)
{
    return document.getElementById(dElem);
}

function _e$(dElem)
{
    return parent.document.getElementById(dElem);
}

// Track IE or other
if (navigator.userAgent.indexOf('MSIE') != -1) {
    var msie = true;
}

// Open Lightbox
function loadLightbox(id)
{
    if (msie) 
    {
        $(_$(id)).fadeIn();
        _$('lightbox_background').style.display = 'block';
    }
    else
    {
        $(_$(id)).fadeIn();
        $(_$('lightbox_background')).fadeIn();
    }
}

// Close Lightbox
function closeLightbox(id)
{
    if (msie)
    {
        $(_$(id)).fadeOut();
        _$('lightbox_background').style.display = 'none';
    }
    else
    {
        $(_$(id)).fadeOut();
        $(_$('lightbox_background')).fadeOut();
    }
}


// Close Lightbox
function closeLightboxSimple(id)
{
    if (msie)
    {
        $(_$(id)).fadeOut();
    }
    else
    {
        $(_$(id)).fadeOut();
    }
}


// Open Lightbox
function loadLightboxEmbed(id)
{
    if (msie) 
    {
        $(_e$(id)).fadeIn();
        _$('lightbox_background').style.display = 'block';
    }
    else
    {
        $(_e$(id)).fadeIn();
        $(_e$('lightbox_background')).fadeIn();
    }
}


function loadProfile(profileID, classID, admin)
{
	if( !admin )
	{
		document.getElementById('profile_frame').src = "profile_pop.php?load_profile=" + profileID + "&class_id=" + classID
	}
	else
	{
		parent.document.getElementById('profile_frame').src = "profile_pop.php?load_profile=" + profileID + "&class_id=" + classID;
	}
	
	loadLightboxEmbed('profile_content');
}


function emailProfile(profileID, admin)
{
	if( !admin )
	{
		document.getElementById('email_frame').src = "message_pop.php?load_profile=" + profileID;
	}
	else
	{
		parent.document.getElementById('email_frame').src = "message_pop.php?load_profile=" + profileID;
	}
	loadLightboxEmbed('email_content');
}

