var activeDelegatesComment = 0;
var tb_pathToImage = "/themes/default/img/loadingAnimation.gif";

function rotateDelegatesComments()
{
	var selector = '#delegates_comments_box > div.contentElement';
	$(selector+':eq('+activeDelegatesComment+')').fadeOut("slow", function(){
		activeDelegatesComment = ( activeDelegatesComment==(($(selector).length)-1) ? 0 : activeDelegatesComment+1 );
		$('#delegates_comments_box').animate({ 
			height: $(selector+':eq('+activeDelegatesComment+')').outerHeight()
		  }, 'slow', function(){
			  	$(selector+':eq('+activeDelegatesComment+')').fadeIn('slow');
		  });
	});
}

$(document).ready(function(){
	// if(window != top) top.location.href = location.href;
	if( $('#delegates_comments_box') ){
		// $('#delegates_comments_box').css('min-height','100px');
		if( $('#delegates_comments_box > div').length > 1 ){
			$('#delegates_comments_box').css('height', $('#delegates_comments_box > div:first').outerHeight());
			var delegatesCommentInterval = setInterval(rotateDelegatesComments,10000);
		}
	}

    if (document.cookie && document.cookie.indexOf("user_displ_res") == -1)
    {
        var myDate = new Date();
        myDate.setDate(myDate.getDate() + 1);
        var cookieDate = myDate.toGMTString();
        var userResolutionCookie = "user_displ_res="+ screen.width +"x"+ screen.height;
        userResolutionCookie = userResolutionCookie + ";expires=" + cookieDate+' ;path=/';
        document.cookie=userResolutionCookie;
    }


    initAjaxLoader();
});