﻿
var requestTimeout = 100000;
var MaxNewsID = 0;
var MinNewsID = 0;
var CategoryID = 1;
var UpdateInterval = 10000;
var VideoOverlay = null;
var Finish = true;
var VideoURL = "";
var CategoryName = "";
$(document).ready(function() {
    /*
    $('#LoadingPanel').fadeOut(0);
    $.timer(UpdateInterval, function(timer) {
        GetNextNews();
        timer.stop();
    });
    $(".NewsItem").live(
        {
            mouseout: function() {
                $(this).removeClass('ActiveItem');
            },
            mouseover: function() {
                $(this).addClass('ActiveItem');
            }
        });
        */
    /*** Set Image Heights relative to Their Width**/
    $.each($('.AdjustImage'), function(index, value) {
        //$(value).css('height', ($(value).width() / 1.75) + 'px');
        var _width = Math.floor($(value).width());
        var _height = Math.floor((_width / 1.75));
        $(value).css('height', _height + 'px');
        $(value).find('img').css('width', _width + 'px').css('height', _height + 'px').css('display', 'block');
    });
    $('.OverlayTrigger').overlay({
        mask: {
            color: '#000',
            loadSpeed: 200,
            opacity: 0.5
        },
        oneInstance: false
    });
	$('.MainTable').css('visibility', 'visible');
    $.mask.close();
});
/**************************************/
function ViewRSS() {
    $('#RSSWrapper').overlay({
        mask: {
            color: '#000',
            loadSpeed: 200,
            opacity: 0.5
        },
        oneInstance: false        
    }).load();
}
/************/
function fbs_click(url,title) {
    window.open('http://www.facebook.com/sharer.php?u=' + encodeURIComponent(url) +
					'&t=' + encodeURIComponent(title), 'sharer', 'toolbar=0,status=0,width=626,height=436');
    return false;
}
/*********************/
function PlayVideo(sender,url, is_external) {
    /*Fill Content*/
    $('#VideoPlayer').find('.Content').eq(0).empty();
    if (is_external) {
        $('#VideoPlayer').find('.Content').eq(0).html($(sender).find('.URL').eq(0).text().replace('[', '<').replace(']', '>'));
    }
    else {
        $('#VideoPlayer').find('.Content').eq(0).flashembed({
            src: '/UI/Resources/cinemaplayer.swf',
            wmode: "transparent",
            width: '600',
            height: '360'
        },
        {
                content: url,
                ads_allow: 'false',
                allowembed: 'false',
                allowcopylink: 'false'
            
        })
        /*var _Content = '<object width="600" height="360"  id="sonetticFLVPlayer"  '+
        'classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" '+
        'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0"> '+ 
        '<param name="movie" value="/UI/Resources/cinemaplayer.swf"/> '+
        '<param name="allowFullScreen" value="true"/>  '+
        '<param name="allowScriptAccess" value="sameDomain" />  '+
        '<param name="bgcolor" value="#161616"/>  ' +
        '<param name="flashvars" value="content='+url+'&ads_allow=false&allowembed=false&allowcopylink=false"/>  '+
        '<embed src="/UI/Resources/cinemaplayer.swf" name="sonetticFLVPlayer" type="application/x-shockwave-flash" ' +
        'width="600" height="360" bgcolor="#161616" allowFullScreen="true" allowScriptAccess="sameDomain" '+
        'flashvars="content='+ url +'&ads_allow=false&allowembed=false&allowcopylink=false"> </embed></object>';
        $('#VideoPlayer').html(_Content);*/
    }
    /*Load Overlay*/
    if (VideoOverlay == null) {
        VideoOverlay = $('#VideoPlayer').overlay({
            mask: {
                color: '#000',
                loadSpeed: 200,
                opacity: 0.5,
                closeOnClick: false,
                closeOnEsc:false
            },
            oneInstance: false,
            load: true,
            onClose: function(event) {
                $('#VideoPlayer').find('.Content').eq(0).empty();
            }
        });
    }
    else {
        VideoOverlay.overlay().load();
    }
}
