﻿/*
*   Functions used for sharing content with social network communities
*   
*   Author: Rutger Frantzen, Linking Media B.V.   
*/

var shareIt = function(a) {
    a.network = (typeof a.network == 'undefined') ? '' : a.network;
    a.prog = (typeof a.prog == 'undefined') ? 0 : a.prog;
    a.station = (typeof a.station == 'undefined') ? 0 : a.station;
    openShare(a.network, a.prog, a.station, 0, 1);
}

var promoteIt = function(a) {
    a.network = (typeof a.network == 'undefined') ? '' : a.network;
    a.prog = (typeof a.prog == 'undefined') ? 0 : a.prog;
    a.station = (typeof a.station == 'undefined') ? 0 : a.station;
    openShare(a.network, a.prog, a.station, 1, 0);
}

var openShare = function(n, p, s, c, w) {
    day = new Date();
    id = day.getTime();
    eval("page" + id + " = window.open('/share/default.aspx?p="+p+"&s="+s+"&goto="+n+"&c="+c+"&w="+w+"', '" + id + "', 'toolbar=0,scrollbars=yes,location=0,statusbar=0,menubar=0,resizable=1,width=510,height=430');");
}

var shareNow = function(network,a) {
    a.prog = (typeof a.prog == 'undefined') ? 0 : a.prog;
    a.station = (typeof a.station == 'undefined') ? 0 : a.station;
    a.promote = (typeof a.promote == 'undefined') ? 0 : a.promote;
    document.location.href = 'default.aspx?p=' + a.prog + '&s=' + a.station + '&goto=' + network + '&c=' + a.promote;
}
