﻿var $jq = jQuery.noConflict();
var sliderInterval;
var bannerSliderCarousel;
var bannerSliderIds;
var bannerSliderFlashIsPlaying;
function mycarousel_initCallback(carousel) {
    $jq('.jcarousel-control a').bind('click', function () {
        $jq('.jcarousel-control a').removeClass('active'); $jq(this).addClass('active');
        carousel.scroll(jQuery.jcarousel.intval(jQuery(this).attr('id')));
        return false;
    });
    $jq('#tabs .tab').hover(function () { $jq(this).css('cursor', 'pointer'); $jq(this).css('color', '#504e4e'); }, function () { $jq(this).css('color', ''); $jq(this).css('cursor', ''); });


    $jq('.carousel #prev').hover(function () {
        
        if ($jq(this).css('background-image').indexOf('/eksponent_files/images/left-hide.png') == -1) {
            $jq(this).css('background-image', 'url(/eksponent_files/images/left-mo.png)');
            $jq(this).css('cursor', 'pointer');
        }
    }, function () {
        if ($jq(this).css('background-image').indexOf('/eksponent_files/images/left-hide.png') == -1) {
            $jq(this).css('cursor', '');
            $jq(this).css('background-image', 'url(/eksponent_files/images/left.png)');
        }
    });

    $jq('.carousel #next').hover(function () {
        if ($jq(this).css('background-image').indexOf('/eksponent_files/images/right-hide.png') == -1) {
            $jq(this).css('cursor', 'pointer');
            $jq(this).css('background-image', 'url(/eksponent_files/images/right-mo.png)');
        }
    }, function () {
        if ($jq(this).css('background-image').indexOf('/eksponent_files/images/right-hide.png') == -1) {
            $jq(this).css('cursor', '');
            $jq(this).css('background-image', 'url(/eksponent_files/images/right.png)');
        }
    });

    $jq('.carousel #next').bind('click', function () {
        $jq('.jcarousel-control a').removeClass('active');
        carousel.next();
        return false;
    });

    $jq('.jcarousel-control a').each(function () {
        var $a = $jq(this);
        if ($a.attr('href') == null || $a.attr('href') == 'undefined' || $a.attr('href') == '')
            $a.css('color', '#bfbfbf');
    });

    $jq('.jcarousel-control a').hover(function () {
        var $a = $jq(this);

        if ($a.attr('href') != null && $a.attr('href') != 'undefined' && $a.attr('href') != '')
            $a.css('color', '#b60000');
    }, function () {
        var $a = $jq(this);
        if ($a.attr('href') != null && $a.attr('href') != 'undefined' && $a.attr('href') != '')
            $a.css('color', '');
    });

    $jq('.carousel #prev').bind('click', function () {
        $jq('.jcarousel-control a').removeClass('active');
        carousel.prev();
        return false;
    });

    $jq('.jcarousel-item').hover(function () {
        $jq(this).css('cursor', 'pointer');
        $jq(this).find('img').css({ 'opacity': '0.9', 'filter': 'alpha(opacity=90)' });
        $jq(this).find('.name').css('color', '#504E4E');        
    }, function () {
        $jq(this).css('cursor', '');
        $jq(this).find('img').css({ 'opacity': '', 'filter': '' });
        $jq(this).find('.name').css('color', '');
    });
};

function videos_initCallback(carousel) {
    $jq('#prev-video').hover(function () {
        if ($jq(this).css('background-image').indexOf('/eksponent_files/images/prev-video-hide.png') == -1) {
            $jq(this).css('background-image', 'url(/eksponent_files/images/prev-video-mo.png)');
            $jq(this).css('cursor', 'pointer');
        }
    }, function () {
        if ($jq(this).css('background-image').indexOf('/eksponent_files/images/prev-video-hide.png') == -1) {
            $jq(this).css('cursor', '');
            $jq(this).css('background-image', '');
        }
    });

    $jq('.videos li').hover(function () {
        $jq(this).css('cursor', 'pointer');
        $jq(this).find('div.icon img').css({ 'opacity': '0.8', 'filter': 'alpha(opacity=80)' });
    }, function () {
        $jq(this).css('cursor', '');
        $jq(this).find('div.icon img').css({ 'opacity': '', 'filter': '' });
    });

    $jq('#next-video').hover(function () {
        if ($jq(this).css('background-image').indexOf('/eksponent_files/images/next-video-hide.png)') == -1) {
            $jq(this).css('cursor', 'pointer');
            $jq(this).css('background-image', 'url(/eksponent_files/images/next-video-mo.png)');
        }
    }, function () {
        if ($jq(this).css('background-image').indexOf('/eksponent_files/images/next-video-hide.png)') == -1) {
            $jq(this).css('cursor', '');
            $jq(this).css('background-image', '');
        }
    });
    $jq('#next-video').bind('click', function () {
        
        carousel.next();
        return false;
    });

    $jq('#prev-video').bind('click', function () {
        carousel.prev();
        return false;
    });
};


function banners_initCallback(carousel) {

    $jq('#banner-pager a img, #banner-prev').hover(function () { $jq(this).css('cursor', 'pointer'); }, function () { $jq(this).css('cursor', ''); });

    $jq("#banner-pager a").click(function () {
        var link = $jq(this);
        
        link.parent().children("a").each(function () {
            var link = $jq(this);        
            link.removeClass("selected");
            link.children("img").attr("src", "/eksponent_files/images/banner-pager-dot.png");
        });
        
        link.addClass("selected");
        link.children("img").attr("src", "/eksponent_files/images/banner-pager-selected.png");

        carousel.scroll(parseInt(link.attr("id"), 10) + 1); // The id's are 0 based, add 1 to scroll to image 1 instead of image 0 etc.
        return false;
    });

    $jq('#banner-pager a').hover(function () {
        var $a = $jq(this);
        if(!$a.hasClass('selected'))
            $a.find('img').attr('src', '/eksponent_files/images/banner-pager-mo.png');
    }, function () {
        var $a = $jq(this);
        if (!$a.hasClass('selected'))
            $a.find('img').attr('src', '/eksponent_files/images/banner-pager-dot.png');
    });

    $jq('#banner-prev').hover(function () {
        $jq(this).css({ 'cursor': 'pointer', 'background': 'url(/eksponent_files/images/banner-prev-mo.png)' });
        $jq(this).show();
    }, function () {
        $jq(this).hide();
        $jq(this).css({ 'cursor': '', 'background': 'url(/eksponent_files/images/banner-prev.png)' });
    });

    $jq('#banner-next').hover(function () {
        $jq(this).css({ 'cursor': 'pointer', 'background': 'url(/eksponent_files/images/banner-next-mo.png)' });
        $jq(this).show();
    }, function () {
        $jq(this).css({ 'cursor': '', 'background': 'url(/eksponent_files/images/banner-next.png)' });
        $jq(this).hide();
    });

    $jq('#banner-prev').bind('click', function () {
        var $preva = $jq('#banner-pager a.selected').prev('a');
        if ($preva.html() != null) {
            $jq('#banner-pager a').removeClass('selected');
            $jq('#banner-pager a img').attr('src', '/eksponent_files/images/banner-pager-dot.png')
            $preva.addClass('selected');
            $preva.find('img').attr('src', '/eksponent_files/images/banner-pager-selected.png')
            carousel.prev();
        }
        return false;
    });

    $jq('#banner-next').bind('click', function () {
        var $nexta = $jq('#banner-pager a.selected').next('a');
        if ($nexta.html() != null) {
            $jq('#banner-pager a').removeClass('selected');
            $jq('#banner-pager a img').attr('src', '/eksponent_files/images/banner-pager-dot.png')
            $nexta.addClass('selected');
            $nexta.find('img').attr('src', '/eksponent_files/images/banner-pager-selected.png')
            carousel.next();
        }
        return false;
    });

    bannerSliderCarousel = carousel;
    bannerSliderIds = $jq("#banner-pager a");
    sliderInterval = SetSliderInterval();

    $jq("#banner").hover(function () {
        clearInterval(sliderInterval);
    }, function () {
        if (!bannerSliderFlashIsPlaying)
        sliderInterval = SetSliderInterval();
    });
};

function SetSliderInterval() {
var carousel = bannerSliderCarousel;
var ids = bannerSliderIds;
    var intervalId = setInterval(function () {
        var id = ids.filter(".selected");
        var count = parseInt(id.attr("id"), 10);
        id.removeClass("selected");
        id.children("img").attr("src", "/eksponent_files/images/banner-pager-dot.png");
        if (count === (ids.length - 1)) {
            ids.first().addClass("selected");
            ids.first().children("img").attr("src", "/eksponent_files/images/banner-pager-selected.png");
            carousel.scroll(1); // The id's are 0 based, add 1 to scroll to image 1 instead of image 0 etc.        
        }
        else {
            id.next().addClass("selected");
            id.next().children("img").attr("src", "/eksponent_files/images/banner-pager-selected.png");
            carousel.next();
        }
    }, 20000);
    return intervalId;
}

soc = {
    polSlider: {
        initialize: function (id, index) {
            var $carousel = $jq('#' + id);
            $carousel.addClass('carousel');
            $carousel.html('');

            //create tabs
            var $tabs = $jq('<div id="tabs">');
            $carousel.append($tabs);
            $tabs.append('<div class="tab" id="1">Den politiske ledelse</div>');
            $tabs.append('<div class="tab" id="2">Alle politikere a-å</div>');
            $jq('#tabs #' + index).addClass('active');

            $jq('#tabs .tab').click(function () {
                soc.polSlider.initialize(id, $jq(this).attr('id'));
            });

            //create slidercontainer
            $carousel.append('<div id="container"></div>')

            //create paging
            $carousel.append('<div class="paging"><div class="jcarousel-control"></div></div>');

            //create prev and next buttons
            $carousel.append('<div id="prev"></div>');
            $carousel.append('<div id="next"></div>');

            //Create dataset
            var people = GetPolSliderArray(index);

            var $ul = $jq('<ul>');
            $jq('#container').append($ul);
            for (var i = 0; i < people.length; i++) {
                var $li = $jq('<li>');
                var $name = $jq('<div>');
                var $loc = $jq('<div>');
                var $img = $jq('<img>');
                $li.append($name);
                $li.append($loc);
                $li.append($img);
                $ul.append($li);
                $name.html(people[i][1] + " " + people[i][2]);
                $name.addClass('name');
                $name.attr('title', people[i][1] + " " + people[i][2]);
                $loc.html(people[i][3]);
                $loc.addClass('loc');
                $img.attr({ 'id': people[i][2], 'src': people[i][0], 'title': people[i][1] + " " + people[i][2], 'alt': people[i][1] + " " + people[i][2] });
                $li.attr('href', people[i][4]);
                $li.click(function () {
                    window.location.href = $jq(this).attr('href');
                });
                if (i == people.length - 1)
                    $li.attr('class', 'last');
            }

            if (index == 2) {
                $jq('.paging').show();
                var abc = new Array();
                var letters = "a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,æ,ø,å".split(",");
                for (var i = 0; i < letters.length; i++) {
                    abc.push(letters[i]);
                }

                var $paging = $jq('.jcarousel-control');
                for (var i = 0; i < abc.length; i++) {
                    var letter = abc[i];
                    var $a = $jq('<a>');
                    $paging.append($a);
                    $a.text(letter);
                    $jq('#container ul li img').each(function () {
                        if ($jq(this).attr('id').toLowerCase().startsWith(letter)) {
                            $a.attr({ 'id': $jq(this).parent().index(), 'href': '#' });
                            return false;
                        }
                    });
                }
            }
            else
                $jq('.paging').hide();

            $carousel.jcarousel({
                scroll: 1,
                initCallback: mycarousel_initCallback,
                buttonNextHTML: null,
                buttonPrevHTML: null,
                itemLoadCallback: function trigger(carousel, state) {
                    $jq('.carousel #prev').css('background-image', 'url(/eksponent_files/images/left.png)');
                    $jq('.carousel #next').css('background-image', 'url(/eksponent_files/images/right.png)');
                    if (carousel.first == 1)
                        $jq('.carousel #prev').css('background-image', 'url(/eksponent_files/images/left-hide.png)');

                    if (carousel.last == $jq('.carousel .jcarousel-item').length)
                        $jq('.carousel #next').css('background-image', 'url(/eksponent_files/images/right-hide.png)');

                }
            });
        }
    },
    videoSlider: {
        initialize: function (id) {
            var $slider = $jq('#' + id);
            $slider.addClass('videos');
            $slider.before('<div id="video-contents">');
            $slider.append('<div id="prev-video">');
            $slider.append('<div id="next-video">');
            $slider.append('<div id="slider"><ul /></div>');

            var $ul = $slider.find('ul');
            var videos = GetVideoSliderArray();
            for (var i = 0; i < videos.length; i++) {
                var $li = $jq('<li>');
                var $title = $jq('<div class="title">');
                var $icon = $jq('<div class="icon"><img src="' + videos[i][0] + '" alt="' + videos[i][1] + '" title="' + videos[i][1] + '" /></div>');
                var $play = $jq('<img class="play">');
                $li.append($icon);
                $li.append($play);
                $li.append($title);
                $ul.append($li);
                $title.html(videos[i][1]);
                $li.attr('id', i);
                $play.attr('src', '/eksponent_files/images/play.png');

                if (i === 0) {
                    var autoplay = false;
                    if (videos[i][3] == "")
                        autoplay = true;

                    var playlist = new Array();

                    if (!autoplay)
                        playlist.push({ url: videos[i][3], scaling: "orig" });

                    playlist.push({ url: videos[i][2], autoPlay: autoplay, provider: "influxis", onFinish: function () { this.getPlugin("myContent").show(); }, onStart: function () { this.getPlugin("myContent").hide(); } });

                    if (autoplay) {
                        playlist[0].onCuepoint = [0, function (clip) {
                            if (!this.tripwire) {
                                this.pause();
                                this.stop();
                                this.unmute();
                                this.tripwire = true;
                            }
                        } ];
                    }

                    flowplayer("video-contents", "/eksponent_files/flowplayer.commercial-3.2.6-custom.swf", {
                        key: '$d1a80ccc97a79f0b507',
                        play: {
                            url: '/eksponent_files/play_button_ny2.swf',
                            width: 92,
                            height: 92
                        },
                        onLoad: function () {
                            if (autoplay)
                                this.mute();

                            this.getPlugin("myContent").hide();
                        },
                        playlist: playlist,
                        // streaming plugins are configured under the plugins node
                        plugins: {
                            // here is our rtpm plugin configuration
                            influxis: {
                                url: '/eksponent_files/flowplayer.rtmp-3.2.3.swf',
                                // netConnectionUrl defines where the streams are found
                                netConnectionUrl: videos[0][2]
                            },
                            myContent: {
                                url: '/eksponent_files/flowplayer.content-3.2.0.swf',
                                top: 16,
                                width: 200,
                                height: 42,
                                borderRadius: 0,
                                backgroundColor: "#FFFFFF",
                                html: '<p class="text">Se flere film på <a class="link" target="_blank" href="http://www.socialdemokraterne.tv/">www.socialdemokraterne.tv</a></p>',
                                style: {
                                    '.text': {
                                        color: "#444444"
                                    },
                                    '.link': {
                                        color: "#B60000"
                                    }
                                }
                            }
                        }
                    });
                }

                $li.click(function () {
                    flowplayer("video-contents", "/eksponent_files/flowplayer.commercial-3.2.6-custom.swf", {
                        key: '$d1a80ccc97a79f0b507',
                        play: {
                            url: '/eksponent_files/play_button_ny2.swf',
                            width: 92,
                            height: 92
                        },
                        clip: {
                            url: videos[$jq(this).attr('id')][2], //'rtmp://klavs.arkena.com/socdemwebtvfl/_definst_/2011_06/SOCDEMFLASHW928_mariannestendell_511',
                            // configure clip to use influxis as our provider, it uses our rtmp plugin
                            provider: 'influxis',
                            autoPlay: true
                        },
                        // streaming plugins are configured under the plugins node
                        plugins: {
                            // here is our rtpm plugin configuration
                            influxis: {
                                url: '/eksponent_files/flowplayer.rtmp-3.2.3.swf',
                                // netConnectionUrl defines where the streams are found
                                netConnectionUrl: videos[$jq(this).attr('id')][2] //'rtmp://klavs.arkena.com/socdemwebtvfl/_definst_/2011_06/SOCDEMFLASHW928_mariannestendell_511'
                            }
                        }
                    });
                });
                if (i == videos.length - 1)
                    $li.attr('class', 'last');
            }

            $jq("#" + id).jcarousel({
                scroll: 1,
                initCallback: videos_initCallback,
                buttonNextHTML: null,
                buttonPrevHTML: null,
                itemLoadCallback: function trigger(carousel, state) {
                    $jq('#videos #prev-video').css('background-image', 'url(/eksponent_files/images/prev-video.png)');
                    $jq('#videos #next-video').css('background-image', 'url(/eksponent_files/images/next-video.png)');
                    if (carousel.first == 1)
                        $jq('#videos #prev-video').css('background-image', 'url(/eksponent_files/images/prev-video-hide.png)');

                    if (carousel.last == $jq('#videos .jcarousel-item').length)
                        $jq('#videos #next-video').css('background-image', 'url(/eksponent_files/images/next-video-hide.png)');

                }
            });
        }
    },
    bannerSlider: {
        initialize: function (id) {
            var banners = GetBannerSliderArray();

            // Se om vi er i testmode og fjern så testmode pladsen i arrayet
            var testmode = banners[(banners.length - 1)];
            banners.splice((banners.length - 1), 1);

            var $slider = $jq('#' + id);
            $slider.addClass('banner');

            var html = '<div id="banner-prev"></div><div id="banner-next"></div><div id="banner-pager"' + (banners.length === 3 ? ' class="three">' : '>');
            html += '<a id="0-banner" href="#" class="selected"><img src="/eksponent_files/images/banner-pager-selected.png" alt="" /></a>' +
                    '<a id="1-banner" href="#"><img src="/eksponent_files/images/banner-pager-dot.png" alt="" /></a>' +
                    '<a id="2-banner" href="#"><img src="/eksponent_files/images/banner-pager-dot.png" alt="" /></a>';
            if (banners.length === 4) {
                html += '<a id="3-banner" href="#"><img src="/eksponent_files/images/banner-pager-dot.png" alt="" /></a>';
            }
            html += '</div><div id="banner-slider"><ul /></div>';
            $slider.append(html);            

            var $prev = $jq('#banner-prev');
            var $next = $jq('#banner-next');
            var sliderWidth = $slider.width();
            var sliderHeight = $slider.height();

            $jq(document).bind('mousemove', function (e) {
                var x = e.pageX - $slider.offset().left;
                var y = e.pageY - $slider.offset().top;

                if (x < 1 || x > sliderWidth || y < 1 || y > sliderHeight) {
                    $prev.hide();
                    $next.hide();
                }
                else {
                    if (x < 429) {
                        $prev.show();
                        $next.hide();
                    }
                    else {
                        $next.show();
                        $prev.hide();
                    }
                }

            });

            var $ul = $slider.find('ul');

            for (var i = 0; i < banners.length; i++) {
                var $li = $jq('<li>');
                $li.attr('id', i);

                if (banners[i][1] === "flash") {
                    var src = banners[i][0];
                    var flashdump = "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' width='857' height='294' id='soc-front-film' align='middle'>" +
                                    "<param name='movie' value='" + src + "' />" +
                                    "<param name='quality' value='high' />" +
                                    "<param name='bgcolor' value='#ffffff' />" +
                                    "<param name='play' value='true' />" +
                                    "<param name='loop' value='true' />" +
                                    "<param name='wmode' value='opaque' />" +
                                    "<param name='scale' value='showall' />" +
                                    "<param name='menu' value='true' />" +
                                    "<param name='devicefont' value='false' />" +
                                    "<param name='salign' value='' />" +
                                    "<param name='allowScriptAccess' value='sameDomain' />" +
                                    "<!--[if !IE]>-->" +
                                    "<object type='application/x-shockwave-flash' data='" + src + "' width='857' height='294'>" +
                                        "<param name='movie' value='" + src + "' />" +
                                        "<param name='quality' value='high' />" +
                                        "<param name='bgcolor' value='#ffffff' />" +
                                        "<param name='play' value='true' />" +
                                        "<param name='loop' value='true' />" +
                                        "<param name='wmode' value='opaque' />" +
                                        "<param name='scale' value='showall' />" +
                                        "<param name='menu' value='true' />" +
                                        "<param name='devicefont' value='false' />" +
                                        "<param name='salign' value='' />" +
                                        "<param name='allowScriptAccess' value='sameDomain' />" +
                                    "<!--<![endif]-->" +
                                        "<a href='http://www.adobe.com/go/getflash'>" +
                                            "<img src='http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' />" +
                                        "</a>" +
                                    "<!--[if !IE]>-->" +
                                    "</object>" +
                                    "<!--<![endif]-->" +
                                "</object>";
                    $li.append(flashdump);
                }
                else {
                    var $img = $jq('<img>');
	                $img.attr('src', banners[i][0]);
	                $img.css("border", "none");
	
	                $li.append($img);
	
	                var linkObjs = banners[i][3];
	                if (linkObjs.length == 0) {
	                    var $link = $jq("<a>");
	                    $link.attr("href", banners[i][1]);
	                    $link.attr("target", banners[i][2]);
	                    $img.wrap($link);
	                }
	                else {
	                    var links = "";
	                    for (var x = 0; x < linkObjs.length; x++) {
	                        var linkObj = linkObjs[x];
	
	                        var left = linkObj.left;
	                        var top = linkObj.top;
	                        var width = linkObj.width;
	                        var height = linkObj.height;
	                        var url = linkObj.url;
	                        var target = linkObj.target;
	
	                        var $link = $jq("<a>");
	
	                        $link.attr("href", url);
	                        $link.attr("target", target);
	                        $link.css({ position: "absolute", left: left, top: top, width: width, height: height });
	                        if ($jq.browser.msie)
	                            $link.css("background-image", "url('transparent.gif')"); // Dirty IE hack to make absolute positioned links without text clickable, solution taken from http://www.webmasterworld.com/css/4020364.htm
	                        if (testmode)
	                            $link.css("background-color", "black");
	
	                        var leftint = parseInt(left.substring(0, left.length - 2), 10);
	                        var leftsideWidth = $jq("#banner .left").width();
	                        var rightsideWidth = $jq("#banner .right").width();
	
	                        $link.hover(function () {
	                            if (leftint < leftsideWidth)
	                                $jq('#banner-prev').show();
	                            else
	                                $jq('#banner-next').show();
	                        }, function () {
	                            if (leftint < leftsideWidth)
	                                $jq('#banner-prev').hide();
	                            else
	                                $jq('#banner-next').hide();
	                        });
	
	                        $li.append($link);
	                    }
	                }
                }

                $ul.append($li);
            }

            $jq("#" + id).jcarousel({
                scroll: 1,
                initCallback: banners_initCallback,
                buttonNextHTML: null,
                buttonPrevHTML: null
            });
        }
    },
    emneBokse: {
        initialize: function (id) {
            var $slider = $jq('#' + id);
            $slider.addClass('emnebokse');
            $slider.append('<img id="landekort">');
            $slider.append('<div class="social"><img id="stoet" alt="" /> <img id="facebook" alt="" /></div>');
            var $landekort = $slider.find("#landekort");
            $slider.find("#landekort").attr('src', '/eksponent_files/images/landekort.png');
            $landekort.hover(function () {
                $jq(this).attr('src', '/eksponent_files/images/landekort-mo.png');
                $jq(this).css('cursor', 'pointer');
            }, function () {
                $jq(this).attr('src', '/eksponent_files/images/landekort.png');
                $jq(this).css('cursor', '');
            });
            $landekort.click(function () { window.location.href = GetLandekortLink(); });
            var $stoet = $slider.find("#stoet");
            $stoet.attr('src', '/eksponent_files/images/stoet.png');
            $stoet.hover(function () {
                $jq(this).attr('src', '/eksponent_files/images/stoet-mo.png');
                $jq(this).css('cursor', 'pointer');
            }, function () {
                $jq(this).attr('src', '/eksponent_files/images/stoet.png');
                $jq(this).css('cursor', '');
            });
            $stoet.click(function () { window.location.href = GetStoetteLink(); });
            var $facebook = $slider.find("#facebook");
            $facebook.attr('src', '/eksponent_files/images/facebook.png');
            $facebook.hover(function () {
                $jq(this).attr('src', '/eksponent_files/images/facebook-mo.png');
                $jq(this).css('cursor', 'pointer');
            }, function () {
                $jq(this).attr('src', '/eksponent_files/images/facebook.png');
                $jq(this).css('cursor', '');
            });
            $facebook.click(function () { window.location.href = GetFacebookLink(); });
        }
    }
}
String.prototype.startsWith = function (str) { return (this.match("^" + str) == str) }
String.prototype.endsWith = function (str) { return (this.match(str + "$") == str) }
jQuery.fn.createPolSlider = function () {
    var id = $jq(this).attr('id');
    
    $jq(document).ready(function () {
        soc.polSlider.initialize(id, 1);
    });
}


jQuery.fn.createVideoSlider = function () {
    var id = $jq(this).attr('id');

    $jq(document).ready(function () {
        soc.videoSlider.initialize(id);
    });
}

jQuery.fn.createBannerSlider = function () {
    var id = $jq(this).attr('id');

    $jq(document).ready(function () {
        soc.bannerSlider.initialize(id);
    });
}

jQuery.fn.createEmneBokse = function () {
    var id = $jq(this).attr('id');

    $jq(document).ready(function () {
        soc.emneBokse.initialize(id);
    });
}

// Helper methods for the flash movies in the banner slider
function VideoStart() {
    clearInterval(sliderInterval);
    bannerSliderFlashIsPlaying = true;
}

function VideoStop() {
    bannerSliderFlashIsPlaying = false;
    sliderInterval = SetSliderInterval();
}
