jQuery(function($) {
    $('#mainMenu > li').hover(
		function() {
		    $('ul.sub', this).show();
		},
		function() {
		    $('ul.sub', this).hide();
		}
	);

    $("#contactFormLink").colorbox({ width: '350px', height: '400px', inline: true, href: '#contactForm', opacity: 0.8 });
    /*$("#contactForm input:text").focus(function() {
    if ($(this).val() === $(this).get(0).defaultValue)
    $(this).val('');
    }).blur(function() {
    if ($(this).val().trim() === '')
    $(this).val($(this).get(0).defaultValue);
    });
    $('.puff:not(.list)').hover(
    function() {
    $(this).addClass('hover');
    },
    function() {
    $(this).removeClass('hover');
    }
    );
    $('.puff:not(.list)').click(
    function() {
    location.href = $('a', this).attr('href');
    }
    );
    */
    $('#mediaBrowser').each(function() {
        $(this).get(0).views = $('div.view', this).length;
        if ($(this).get(0).views > 1) {
            $(this).addClass('paginate');
            $(this).get(0).currentView = 0;
            var $mediaBrowser = $(this);
            var $paginator = $('<div/>').prependTo($('<div/>').addClass('paginator').appendTo($(this)));
            $('<span>Tidigare</span>').addClass('previous').appendTo($paginator).click(function() {
                $('div.view.current', $mediaBrowser).removeClass('current');
                $('span.current', $paginator).removeClass('current');
                $mediaBrowser.get(0).currentView = (($mediaBrowser.get(0).currentView + $mediaBrowser.get(0).views) - 1) % $mediaBrowser.get(0).views;
                $('div.view:eq(' + $mediaBrowser.get(0).currentView + ')', $mediaBrowser).addClass('current');
                $('span.number:eq(' + $mediaBrowser.get(0).currentView + ')', $paginator).addClass('current');
            });
            if (!$(this).hasClass('pictureViewer')) {
                for (var i = 0; i < $(this).get(0).views; i++) {
                    $('<span>' + (i + 1) + '</span>').addClass('number' + (i === 0 ? ' current' : '')).appendTo($paginator).click(function() {
                        $('div.view.current', $mediaBrowser).removeClass('current');
                        $('span.current', $paginator).removeClass('current');
                        $mediaBrowser.get(0).currentView = ($(this).text() - 1);
                        $('div.view:eq(' + $mediaBrowser.get(0).currentView + ')', $mediaBrowser).addClass('current');
                        $(this).addClass('current');
                    });
                }
            }
            $('<span>Nästa</span>').addClass('next').appendTo($paginator).click(function() {
                $('div.view.current', $mediaBrowser).removeClass('current');
                $('span.current', $paginator).removeClass('current');
                $mediaBrowser.get(0).currentView = ($mediaBrowser.get(0).currentView + 1) % $mediaBrowser.get(0).views;
                $('div.view:eq(' + $mediaBrowser.get(0).currentView + ')', $mediaBrowser).addClass('current');
                $('span.number:eq(' + $mediaBrowser.get(0).currentView + ')', $paginator).addClass('current');
            });
            $(this).mouseleave(function() {
                $('.paginator', this).fadeOut();
            }).mouseenter(function() {
                $('.paginator', this).fadeIn();
            });
            $paginator.parent('div.paginator').css('left', (($mediaBrowser.width() - $paginator.parent('div.paginator').outerWidth()) / 2) + 'px');
        }
    });

    $('#comments .showAll').click(function() {
        $(this).siblings('.earlier').slideDown();
        return false;
    });
//Disable by Abhishek This is not used in thumbs up and thumbs down rating
//    $('#comments .rate .up').click(function() {
//        $('#comments .ratings .positiveRating').text(parseInt($('#comments .ratings .positiveRating').text()) + 1);
//        alert('hmm!');
//        $.post("FORM POST URL", { "r": "up" }, // FORM POST URL = $('form').attr('action') ?
//			function(data) {
//			    if (data !== null) {
//			        $('#comments .ratings .positiveRating').text(parseInt($('#comments .ratings .positiveRating').text()) + 1);
//			    }
//			}, "json");
//        $('#comments .rate a').unbind('click').click(function() { return false; });
//        return false;
//    });
//    $('#comments .rate .down').click(function() {
//        $('#comments .ratings .negativeRating').text(parseInt($('#comments .ratings .negativeRating').text()) + 1);
//        $.post("FORM POST URL", { "r": "down" }, // FORM POST URL = $('form').attr('action') ?
//			function(data) {
//			    if (data !== null) {
//			        $('#comments .ratings .negativeRating').text(parseInt($('#comments .ratings .negativeRating').text()) + 1);
//			    }
//			}, "json");
//        $('#comments .rate a').unbind('click').click(function() { return false; });
//        return false;
//    });

    if (jQuery.browser.msie && parseInt(jQuery.browser.version) == 6) {
        DD_belatedPNG.fix('#dinSakerhetLogo img, #msbLogo img, #mainMenu .sub, #d2 .overlay img');
    }
});




 $(document).ready(function()
 {
  $('#comments .comment .info .abuse').click(function()
 {
      
        var pageID = $(this).attr('rev'); // Get the user's name
        document.cookie = pageID; // Create the cookie
        document.cookie =+ pageID+"1";
        var cookieval = document.cookie.toString();
        alert(cookieval);
        return false;
    });
 
 });
 
  
