﻿/// <reference path="libs/jquery-1.3.1-vsdoc.js" />

$(function() {
    // remove youtube link
    $('#ctl00_secContent_Videos a').attr('href', '#video');
    $('#ctl00_secContent_Videos a').click(function() {
        changeComments($(this).attr('rel'));
        changeVideo($(this).attr('rel'));
    });

    function changeVideo(value) {
        var params = { wmode: "transparent" };
        //swfobject.embedSWF("http://www.youtube.com/v/" + value + "&hl=en&fs=1&ap=%2526fmt%3D18", "mainVideo", "520", "293", "7", "/_Resources/flash/expressInstall.swf", false, params, false);
        // for swfobject 1.4
        var vid = new SWFObject("http://www.youtube.com/v/" + value + "&hl=en&fs=1&ap=%2526fmt%3D18", "", "590", "360", "6.0", "/_Resources/flash/expressInstall.swf");
        vid.addVariable("wmode", "transparent");
        vid.write("mainVideo");
    }

    function changeComments(id) {
        $.ajax({
            type: "GET",
            url: "/2011/gallery/comments.aspx?id=" + id,
            dataType: "html",
            success: function(msg) {
                $('#ctl00_priContent_Comments').html(msg);
            }
        });
    }

    if ($('#ctl00_secContent_Videos a:first').attr('rel'))
        changeComments($('#ctl00_secContent_Videos a:first').attr('rel'));
});
