﻿$(document).ready(function() {

    //twitter
    /*
    $("#twitter").tweet({
        username: "tivibu",
        avatar_size: 32,
        count: 20,
        loading_text: "yükleniyor..."
    });*/
    
    $('.socialMediaScroll').jScrollPane({showArrows:true});

    // topNav 
    $("li#memberAction").hoverIntent({
        sensitivity: 3,
        interval: 200,
        over: mpOver,
        timeout: 500,
        out: mpOut
    });
    /*$("li#supportAction").hoverIntent({
        sensitivity: 3,
        interval: 200,
        over: mpOver,
        timeout: 500,
        out: mpOut
    });*/

    // custom select
    $("select").uniform();


    $("#sharepop a.main").mouseenter(function(){
		    $("#sharepop .subdiv").fadeIn("fast");
		    $(this).addClass("hover");
	    });

    $("#sharepop").mouseleave(function(){
		    $("#sharepop .subdiv").fadeOut("fast");
		    $("#sharepop a.main").removeClass("hover");
	    });	
	    
    $("textarea.oneclick").click(function(){
		    $(this).html("");
		    $(this).removeClass("oneclick");
	    });						   					   
	

	//videoThumbAction
    $(".videoThumbAction li, .videoListView li").mouseover(function() {
		$(this).addClass("selected");
    }).mouseout(function() {
		$(this).removeClass("selected");
	});

	
});

// topNav Function
function mpOver(){ $(this).addClass("selected");$(this).find("ul").show();}
function mpOut() { $(this).removeClass("selected"); $(this).find("ul").hide(); }

// fbFeed
$(function() {
    /*$.get("/home/fbfeed.aspx", {}, function(response) {

        $("#social_facebook").html(response);
        $('#socialMediaScrollFb').jScrollPane({ showArrows: false });
    }, "html");*/
    $('#socialMediaScrollFb').jScrollPane({ showArrows: false });
});

//anasayfa.js
$(document).ready(function() {

    $("a[rel='#overlay']").overlay({
        mask: 'black',
        effect: 'apple',
        onBeforeLoad: function() {
            // grab wrapper element inside content
            var wrap = this.getOverlay().find(".contentWrap");
            // load the page specified in the trigger
            wrap.load(this.getTrigger().attr("href"));
        },
        onClose: function(){
            $("#overlay .contentBox").html("");
        }
    });
    /*
    if ($.cookie("iptivibu_poll") == null) {
        $("a[rel='#overlayPoll']").overlay({
            mask: 'black',
            effect: 'apple',
            onBeforeLoad: function() {
                // grab wrapper element inside content
                var wrap = this.getOverlay().find(".contentWrap");
                // load the page specified in the trigger
                wrap.load(this.getTrigger().attr("href"));
            },
            onClose: function(){
                _tag.dcsMultiTrack('DCS.dcsuri' , '/wt.gif' , 'DCSext.anket' , 'IPTVAnket_Cikis');
            },
            load: true
        });
    }*/
});


$(document).ready(function() {
    $(".dl").click(function(){
        dcsMultiTrack('DCS.dcsuri','/wt.gif','DCSext.parametre','DownloadEvent_Player');
    });
});

/*iptv poll form process*/
/*
var sendIpTvPoll = function() {
    if ($("#ipTvPollResponse_1").attr("checked")) {
        _tag.dcsMultiTrack('DCS.dcsuri', '/wt.gif', 'DCSext.anket', 'IPTVAnket_Evet');
        $("#formIpTvPoll").submit();
        return true;
    }
    else if ($("#ipTvPollResponse_0").attr("checked")) {
        _tag.dcsMultiTrack('DCS.dcsuri', '/wt.gif', 'DCSext.anket', 'IPTVAnket_Hayır');
        $("#formIpTvPoll").submit();
        return true;
    }
    else
        return false;
}*/

jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        // CAUTION: Needed to parenthesize options.path and options.domain
        // in the following expressions, otherwise they evaluate to undefined
        // in the packed version for some reason...
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};