﻿//set the source for the lightbox image of the Flickr gallery
function setPhotoSource(userID, source, title, description, tags) {
    var code = '<h3>' + title + "</h3><div id='content'>" + description + '<img src="' + source + '"/>';

    var tagArr = tags.toString().split(' ');

    code += "<div class='tags'>";
    for (var i = 0; i < tagArr.length; i++) {
        code += '<a href="http://www.flickr.com/search/?q=' + tagArr[i] + '&w=' + userID + '" target=_BLANK>' + tagArr[i] + ' </a>';
    }
    code += '</div>';
    
    code += '</div>';

    document.getElementById('lightboxDiv').innerHTML = code;
}

//set the source for the lightbox video of the Vimeo/Youtube gallery
function setVideoSource(/*userID, */ provider, title, description, source, tags) {
    var code = '<h3>' + title + "</h3><div id='content'>" + source;

    var tagArr;

    if (provider == 0) 
    {
        code += "<p>" + description + "</p>";
        tagArr = tags.toString().split(',');

        code += "<div class='tags'>";
        for (var i = 0; i < tagArr.length; i++) 
        {
            code += '<a href="http://www.youtube.com/results?search_query=' + tagArr[i] + '&search_type=&aq=f" target=_BLANK>' + tagArr[i] + ' </a>';
        }
        code += "</div>";
    }
    else if (provider == 1) 
    {
        tagArr = tags.toString().split(' ');

        code += "<div class='tags'>";
        for (var i = 0; i < tagArr.length; i++) 
        {
            //code += '<a href="http://www.vimeo.com/' + userID + '/videos/search:' + tagArr[i] + '/sort:newest"  target=_BLANK>' + tagArr[i] + ' </a>';
            code += '<a href="http://www.vimeo.com/videos/search:' + tagArr[i] + '/sort:newest"  target=_BLANK>' + tagArr[i] + ' </a>';
        }
        code += '</div>';
    }
    code += '</div>';
    document.getElementById('lightboxDiv').innerHTML = code;
}

function openWindow(url) 
{
    window.open(url);
}

function openTarget(url) 
{
    window.location.href = url;
}