﻿/*function b(t){
	return 0;navigator.userAgent.search(t)!=-1;
}
if(!b('MSIE 6')&&!b('MSIE 7')){*/



Cufon.replace('.moduletable_logotext, .cs-title h3, .moduletable_news h3, .moduletable h3, .right_sidebar h3, .moduletable_submenu h3, .gallery_header h3', { fontFamily: 'FuturaMd', fontWeight: '400', hover: 'true', hoverable: 'true' });
//}
//


$(document).ready(function () {
    $("li[title_item_menu='Liên hệ']").css("margin-top", "-10px");
    $("li[title_item_menu='Contact']").css("margin-top", "-10px");
    $('.content_item h3:contains(Sơ đồ tổ chức)').text('Sơ đồ tổ chức Tổng Công ty Khí Việt Nam');
    $('.right_sidebar h3:contains(Health - Safety - Environment - Quality)').text('HSEQ');

    $("li a[href='/Content/View/HeThongQuanLyATSKMT']").css("width", "190px");

    $("#topnav2 li:last").css("border-right", "none");
    $(".moduletable_login ul li:last").css("border-right", "none");

    $(".content_items_new:first").css("padding-top", "10px");

    $(".BaoCaoTaiChinh .dated").hide();
    $(".TinTongQuanDauKhi .other_news_container").hide();
    $(".TinTongQuanDauKhi .content_items_new").each(function (i) {
        $(this).find(".img_none").hide();
        if ($(this).find(".img_none").length > 0) {
            $(this).css("list-style", "square outside none");
            $(this).css("margin-left", "15px");
        }
    });


    if ($('.fancybox_item').length > 0 ) {
        $("head").append("<link>");
        css = $("head").children(":last");
        css.attr({
            rel: "stylesheet",
            type: "text/css",
            href: "/Scripts/fb/jquery.fancybox-1.3.4.css"
        });
        $.getScript("/Scripts/fb/jquery.fancybox-1.3.4.pack.js", function () {
            $(".fancybox_item").fancybox();
        });
    }

    function showFlowPlayer(href) {
        var container = $('<div style="height:400px;"/>');
        container.flowplayer('http://releases.flowplayer.org/swf/flowplayer-3.2.7.swf', 'http://www.pvgas.com.vn/Content/Films/intro.flv');
        $.fancybox({
            content: container,
            width: 500, height: 400,
            scrolling: 'no',
            autoDimensions: false
        });
    }

    flowPlayerShown = false;
    flvFile = "";

    $("a[href='/Content/Films/intro.flv']").click(function (e) {
        e.preventDefault();
        flvFile = window.location.origin + $(this).attr('href');

        if (!flowPlayerShown) {
            $("head").append("<link>");
            css = $("head").children(":last");
            css.attr({
                rel: "stylesheet",
                type: "text/css",
                href: "/Scripts/fb/jquery.fancybox-1.3.4.css"
            });
            $.getScript("/Scripts/fb/jquery.fancybox-1.3.4.pack.js", function () {
                $.getScript("/Scripts/flowplayer-3.2.6.min.js", function () {
                    showFlowPlayer(flvFile);
                });
            });
        } else {
            showFlowPlayer();
        }

        flowPlayerShown = true;
    });

    if ($("#latest_news")) {
        var targetHeight = $(".moduletable").height();
        var deltaMin = 1000;
        var iMin = 5;
        for (i = 5; i < 9; i++) {

            $(".middle #col1 ul.latestnews_news li").css("padding-top", i + "px");
            $(".middle #col1 ul.latestnews_news li").css("padding-bottom", i + "px");
            var delta = Math.abs($("#latest_news").height() - targetHeight);
            if (delta < deltaMin) {
                deltaMin = delta;
                iMin = i;
            }
        }
        $(".middle #col1 ul.latestnews_news li").css("padding-top", iMin + "px");
        $(".middle #col1 ul.latestnews_news li").css("padding-bottom", iMin + "px");
    }
});
