essential and important JavaScript functions required in website

These are the following important java script functions used in a website. Please note that  you may use jquery for all functions

Progressive pop ups for Social networking

<script>
// create social networking pop-ups
(function() {
// link selector and pop-up window size
    var Config = {
                Link: "a.share",
		Width: 500,
		Height: 500
	};

// add handler links
	var slink = document.querySelectorAll(Config.Link);
	for (var a = 0; a < slink.length; a++) {
		slink[a].onclick = PopupHandler;
	}

	// create popup
	function PopupHandler(e) {

		e = (e ? e : window.event);
		var t = (e.target ? e.target : e.srcElement);

		// popup position
		var px = Math.floor(((screen.availWidth || 1024) - Config.Width) / 2),
		py = Math.floor(((screen.availHeight || 700) - Config.Height) / 2);

		// open popup
		var popup = window.open(t.href, "social", 
			"width="+Config.Width+",height="+Config.Height+
			",left="+px+",top="+py+
			",location=0,menubar=0,toolbar=0,status=0,scrollbars=1,resizable=1");
		if (popup) {
			popup.focus();
			if (e.preventDefault) e.preventDefault();
			e.returnValue = false;
		}

		return !!popup;
	}

}());
</script>

Image slider with thumbnail navigator
<script src="jssor.slider.min.js"></script>
<script>
    jssor_slider1_starter = function (containerId) {
        var options = {
            $ThumbnailNavigatorOptions: {
                $Class: $JssorThumbnailNavigator$,
                $ChanceToShow: 2
            }
        };
        var jssor_slider1 = new $JssorSlider$(containerId, options);
    };
</script>
Bootstrap DateTime picker

<script type="text/javascript">
 $(function() 
{ 
$('#datetimepicker1').datetimepicker({ language: 'pt-BR' }); 
});
 </script>

ScrollTop in javascript

 <script type="text/javascript">
        function OnScrollDiv (div) {
            var info = document.getElementById ("info");
            info.innerHTML = "Horizontal: " + div.scrollLeft
                            + "px<br/>Vertical: " + div.scrollTop + "px";
        }
    </script>

 Using JsFiddle

$(document).ready(function () {

 $(window).scroll(function () {
 if ($(this).scrollTop() > 100) {
 $('.scrollup').fadeIn();
 } else {
 $('.scrollup').fadeOut();
 }
 });

 $('.scrollup').click(function () {
 $("html, body").animate({
 scrollTop: 0
 }, 600);
 return false;
 });

});

//css for jSFiddle

.scrollup {
 width: 40px;
 height: 40px;
 position: fixed;
 bottom: 50px;
 right: 100px;
 display: none;
 text-indent: -9999px;
 background: url('icon_top.png') no-repeat;
 background-color: #000;
}
Blinking Text

<script language=”javascript”>

setInterval(blinktext, 500);

var txt = “”;

var count = 0;

function blinktext() {

var cntrl = document.getElementById(“txtblinkingtext”);

if (count == 0)

txt = cntrl.value;

if (count % 2 == 0)

cntrl.value = “”;

else

cntrl.value = txt;

count++;

}

</script>

Pagination in javascript

function Pager(tableName, itemsPerPage) {
    this.tableName = tableName;
    this.itemsPerPage = itemsPerPage;
    this.currentPage = 1;
    this.pages = 0;
    this.inited = false;
 
    this.showRecords = function(from, to) {        
        var rows = document.getElementById(tableName).rows;
        // i starts from 1 to skip table header row
        for (var i = 1; i < rows.length; i++) {
            if (i < from || i > to)  
                rows[i].style.display = 'none';
            else
                rows[i].style.display = '';
        }
    }
 
    this.showPage = function(pageNumber) {
    	if (! this.inited) {
    		alert("not inited");
    		return;
    	}
 
        var oldPageAnchor = document.getElementById('pg'+this.currentPage);
        oldPageAnchor.className = 'pg-normal';
 
        this.currentPage = pageNumber;
        var newPageAnchor = document.getElementById('pg'+this.currentPage);
        newPageAnchor.className = 'pg-selected';
 
        var from = (pageNumber - 1) * itemsPerPage + 1;
        var to = from + itemsPerPage - 1;
        this.showRecords(from, to);
    }   
 
    this.prev = function() {
        if (this.currentPage > 1)
            this.showPage(this.currentPage - 1);
    }
 
    this.next = function() {
        if (this.currentPage < this.pages) {
            this.showPage(this.currentPage + 1);
        }
    }                        
 
    this.init = function() {
        var rows = document.getElementById(tableName).rows;
        var records = (rows.length - 1); 
        this.pages = Math.ceil(records / itemsPerPage);
        this.inited = true;
    }
 
    this.showPageNav = function(pagerName, positionId) {
    	if (! this.inited) {
    		alert("not inited");
    		return;
    	}
    	var element = document.getElementById(positionId);
 
    	var pagerHtml = '<span onclick="' + pagerName + '.prev();" class="pg-normal"> &#171  </span> Blogroll';
        for (var page = 1; page <= this.pages; page++) 
            pagerHtml += '<span id="pg' + page + '" class="pg-normal" onclick="' + pagerName + '.showPage(' + page + ');"></span>  ';
        pagerHtml += '<span onclick="'+pagerName+'.next();" class="pg-normal">  »</span>';            
 
        element.innerHTML = pagerHtml;
    }
}