মিডিয়াউইকি:Common.js

মুক্ত বিশ্বকোষ উইকিপিডিয়াত্ত উইকিপিডিয়া

খিয়াল থ: তর পছনহানি রক্ষা করানির থাঙনাত পতাহানি চানার কা তর ব্রাউজারর ক্যাশ লালুয়া যানা লাগতে পারে। মোজিলা/ফায়ারফক্স/সাফারি: শিফট কী চিপিয়া থয়া রিলোড-এ ক্লিক কর, নাইলে কন্ট্রোল-শিফট-R(এপল ম্যাক-এ কমান্ড-শিফট-R) আকপাকে চিপা; ইন্টারনেট এক্সপ্লোরার: কন্ট্রোল চিপিয়া থয়া রিফ্রেশ-এ ক্লিক কর, নাইলে কন্ট্রোল-F5 চিপা; কংকারার: হুদ্দা রিলোড ক্লিক করলে বা F5 চিপিলে চলতই; অপেরা ব্যবহারকরেকুরাই Tools→Preferences-এ গিয়া কাশ সম্পূর্ণ ঙক্ষি করানি লাগতে পারে।

/**
 * WikiMiniAtlas is a popup click and drag world map.
 * See [[meta:WikiMiniAtlas]] for more information. 
 * Maintainers: [[w:User:Dschwen]]
 */
mw.loader.load('//meta.wikimedia.org/w/index.php?title=MediaWiki:Wikiminiatlas.js&action=raw&ctype=text/javascript&smaxage=21600&maxage=86400');
 
/**
 * Test if an element has a certain class
 *
 * Description: Uses regular expressions and caching for better performance.
 * Maintainers: [[User:Mike Dillon]], [[User:R. Koot]], [[User:SG]]
 */
var hasClass = (function () {
     var reCache = {};
     return function (element, className) {
         return (reCache[className] ? reCache[className] : (reCache[className] = new RegExp("(?:\\s|^)" + className + "(?:\\s|$)"))).test(element.className);
     };
 })();

 /** Interwiki links to featured articles ***************************************
  *
  *  Description: Highlights interwiki links to featured articles (or
  *               equivalents) by changing the bullet before the interwiki link
  *               into a star.
  *  Maintainers: [[User:R. Koot]]
  */
 
 function LinkFA() 
 {
    for(var i=0; a = document.getElementsByTagName("span")[i]; i++) {
       if(a.className == "FA") {
          for(var j=0; b = document.getElementsByTagName("li")[j]; j++) {
             if(b.className == "interwiki-" + a.id && b.className.indexOf("badge-featuredarticle") === -1 && b.className.indexOf("badge-goodarticle") === -1) {
                b.className += " FA";
                b.title = "This article has gained featured status";
             }
          }
       }
    }
 }
 
 $( document ).ready( LinkFA );

 
 /** Dynamic Navigation Bars (experimental) *************************************
  *
  *  Description: See [[Wikipedia:NavFrame]].
  *  Maintainers: UNMAINTAINED
  */
 
  // set up the words in your language
  var NavigationBarHide = '[গুর]';
  var NavigationBarShow = '[নিকালা]';
  
  // set up max count of Navigation Bars on page,
  // if there are more, all will be hidden
  // NavigationBarShowDefault = 0; // all bars will be hidden
  // NavigationBarShowDefault = 1; // on pages with more than 1 bar all bars will be hidden
  var NavigationBarShowDefault = 3;
  
  
  // shows and hides content and picture (if available) of navigation bars
  // Parameters:
  //     indexNavigationBar: the index of navigation bar to be toggled
  function toggleNavigationBar(indexNavigationBar)
  {
     var NavToggle = document.getElementById("NavToggle" + indexNavigationBar);
     var NavFrame = document.getElementById("NavFrame" + indexNavigationBar);
  
     if (!NavFrame || !NavToggle) {
         return false;
     }
  
     // if shown now
     if (NavToggle.firstChild.data == NavigationBarHide) {
         for (
                 var NavChild = NavFrame.firstChild;
                 NavChild != null;
                 NavChild = NavChild.nextSibling
             ) {
             if (NavChild.className == 'NavPic') {
                 NavChild.style.display = 'none';
             }
             if (NavChild.className == 'NavContent') {
                 NavChild.style.display = 'none';
             }
         }
     NavToggle.firstChild.data = NavigationBarShow;
  
     // if hidden now
     } else if (NavToggle.firstChild.data == NavigationBarShow) {
         for (
                 var NavChild = NavFrame.firstChild;
                 NavChild != null;
                 NavChild = NavChild.nextSibling
             ) {
             if (NavChild.className == 'NavPic') {
                 NavChild.style.display = 'block';
             }
             if (NavChild.className == 'NavContent') {
                 NavChild.style.display = 'block';
             }
         }
     NavToggle.firstChild.data = NavigationBarHide;
     }
  }
  
/* adds show/hide-button to navigation bars */
function createNavigationBarToggleButton() {
    var indexNavigationBar = 0;
    var NavFrame;
    var NavChild;
    /* iterate over all < div >-elements */
    var divs = document.getElementsByTagName( 'div' );
    for ( var i = 0; (NavFrame = divs[i]); i++ ) {
        /* if found a navigation bar */
        if ( $( NavFrame ).hasClass( 'NavFrame' ) ) {

            indexNavigationBar++;
            var NavToggle = document.createElement( 'a' );
            NavToggle.className = 'NavToggle';
            NavToggle.setAttribute( 'id', 'NavToggle' + indexNavigationBar );
            NavToggle.setAttribute( 'href', '#' );
            $( NavToggle ).on( 'click', $.proxy( window.toggleNavigationBar, window, indexNavigationBar ) );

            var isCollapsed = $( NavFrame ).hasClass( 'collapsed' );
            /**
             * Check if any children are already hidden.  This loop is here for backwards compatibility:
             * the old way of making NavFrames start out collapsed was to manually add style="display:none"
             * to all the NavPic/NavContent elements.  Since this was bad for accessibility (no way to make
             * the content visible without JavaScript support), the new recommended way is to add the class
             * "collapsed" to the NavFrame itself, just like with collapsible tables.
             */
            for ( NavChild = NavFrame.firstChild; NavChild != null && !isCollapsed; NavChild = NavChild.nextSibling ) {
                if ( $( NavChild ).hasClass( 'NavPic' ) || $( NavChild ).hasClass( 'NavContent' ) ) {
                    if ( NavChild.style.display === 'none' ) {
                        isCollapsed = true;
                    }
                }
            }
            if ( isCollapsed ) {
                for ( NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling ) {
                    if ( $( NavChild ).hasClass( 'NavPic' ) || $( NavChild ).hasClass( 'NavContent' ) ) {
                        NavChild.style.display = 'none';
                    }
                }
            }
            var NavToggleText = document.createTextNode( isCollapsed ? NavigationBarShow : NavigationBarHide );
            NavToggle.appendChild( NavToggleText );

            /* Find the NavHead and attach the toggle link (Must be this complicated because Moz's firstChild handling is borked) */
            for( var j = 0; j < NavFrame.childNodes.length; j++ ) {
                if ( $( NavFrame.childNodes[j] ).hasClass( 'NavHead' ) ) {
                    NavToggle.style.color = NavFrame.childNodes[j].style.color;
                    NavFrame.childNodes[j].appendChild( NavToggle );
                }
            }
            NavFrame.setAttribute( 'id', 'NavFrame' + indexNavigationBar );
        }
    }
}
  
  $( document ).ready( createNavigationBarToggleButton );
  

 /** Collapsible tables *********************************************************
  *
  *  Description: Allows tables to be collapsed, show only the header. See
  *               [[Wikipedia:NavFrame]].
  *  Maintainers: [[User:R. Koot]]
  */
 
 var autoCollapse = 2;
 var collapseCaption = "গুর";
 var expandCaption = "নিকালা";
 
 function hasClass( element, className ) {
   var Classes = element.className.split( " " );
   for ( var i = 0; i < Classes.length; i++ ) {
     if ( Classes[i] == className ) {
       return ( true );
     }
   }
   return ( false );
 }
 
 function collapseTable( tableIndex )
 {
     var Button = document.getElementById( "collapseButton" + tableIndex );
     var Table = document.getElementById( "collapsibleTable" + tableIndex );
 
     if ( !Table || !Button ) {
         return false;
     }
 
     var Rows = Table.getElementsByTagName( "tr" ); 
 
     if ( Button.firstChild.data == collapseCaption ) {
         for ( var i = 1; i < Rows.length; i++ ) {
             Rows[i].style.display = "none";
         }
         Button.firstChild.data = expandCaption;
     } else {
         for ( var i = 1; i < Rows.length; i++ ) {
             Rows[i].style.display = Rows[0].style.display;
         }
         Button.firstChild.data = collapseCaption;
     }
 }
 
 function createCollapseButtons()
 {
     var tableIndex = 0;
     var NavigationBoxes = new Object();
     var Tables = document.getElementsByTagName("table");
 
     for ( var i = 0; i < Tables.length; i++ ) {
         if ( hasClass( Tables[i], "collapsible" ) ) {
             NavigationBoxes[ tableIndex ] = Tables[i];
             Tables[i].setAttribute( "id", "collapsibleTable" + tableIndex);
 
             var Button     = document.createElement( "span" );
             var ButtonLink = document.createElement( "a" );
             var ButtonText = document.createTextNode( collapseCaption );
 
             Button.style.styleFloat = "right";
             Button.style.cssFloat = "right";
             Button.style.fontWeight = "normal";
             Button.style.textAlign = "right";
             Button.style.width = "6em";
 
             ButtonLink.setAttribute( "id", "collapseButton" + tableIndex );
             ButtonLink.setAttribute( "href", "javascript:collapseTable(" + tableIndex + ");" );
             ButtonLink.appendChild( ButtonText );
 
             Button.appendChild( document.createTextNode( "[" ) );
             Button.appendChild( ButtonLink );
             Button.appendChild( document.createTextNode( "]" ) );
 
             var Header = Tables[i].getElementsByTagName( "tr" )[0].getElementsByTagName( "th" )[0];
             Header.insertBefore( Button, Header.childNodes[0] );
 
             tableIndex++;
         }
     }
 
     for ( var i = 0;  i < tableIndex; i++ ) {
         if ( hasClass( NavigationBoxes[i], "collapsed" ) || ( tableIndex >= autoCollapse && hasClass( NavigationBoxes[i], "autocollapse" ) ) ) {
             collapseTable(i);
         }
     }
 }
 
 $( document ).ready( createCollapseButtons );

 /** "Technical restrictions" title fix *****************************************
  *
  *  Description:
  *  Maintainers: [[User:Interiot]], [[User:Mets501]]
  */
 
 // For pages that have something like Template:Lowercase, replace the title, but only if it is cut-and-pasteable as a valid wikilink.
 //	(for instance [[iPod]]'s title is updated.  But [[C#]] is not an equivalent wikilink, so [[C Sharp]] doesn't have its main title changed)
 //
 // The function looks for a banner like this: 
 // <div id="RealTitleBanner">    <!-- div that gets hidden -->
 //   <span id="RealTitle">title</span>
 // </div>
 // An element with id=DisableRealTitle disables the function.
 var disableRealTitle = 0;		// users can disable this by making this true from their monobook.js
 if (mw.config.get('wgIsArticle')) {			// don't display the RealTitle when editing, since it is apparently inconsistent (doesn't show when editing sections, doesn't show when not previewing)
     $( document ).ready(function() {
 	try {
 		var realTitleBanner = document.getElementById("RealTitleBanner");
 		if (realTitleBanner && !document.getElementById("DisableRealTitle") && !disableRealTitle) {
 			var realTitle = document.getElementById("RealTitle");
 			if (realTitle) {
 				var realTitleHTML = realTitle.innerHTML;
 				realTitleText = pickUpText(realTitle);
 
 				var isPasteable = 0;
 				//var containsHTML = /</.test(realTitleHTML);	// contains ANY HTML
 				var containsTooMuchHTML = /</.test( realTitleHTML.replace(/<\/?(sub|sup|small|big)>/gi, "") ); // contains HTML that will be ignored when cut-n-pasted as a wikilink
 				// calculate whether the title is pasteable
 				var verifyTitle = realTitleText.replace(/^ +/, "");		// trim left spaces
 				verifyTitle = verifyTitle.charAt(0).toUpperCase() + verifyTitle.substring(1, verifyTitle.length);	// uppercase first character
 
 				// if the namespace prefix is there, remove it on our verification copy.  If it isn't there, add it to the original realValue copy.
 				if (mw.config.get('wgNamespaceNumber') != 0) {
 					if (mw.config.get('wgCanonicalNamespace') == verifyTitle.substr(0, mw.config.get('wgCanonicalNamespace').length).replace(/ /g, "_") && verifyTitle.charAt(mw.config.get('wgCanonicalNamespace').length) == ":") {
 						verifyTitle = verifyTitle.substr(mw.config.get('wgCanonicalNamespace').length + 1);
 					} else {
 						realTitleText = mw.config.get('wgCanonicalNamespace').replace(/_/g, " ") + ":" + realTitleText;
 						realTitleHTML = mw.config.get('wgCanonicalNamespace').replace(/_/g, " ") + ":" + realTitleHTML;
 					}
 				}
 
 				// verify whether wgTitle matches
 				verifyTitle = verifyTitle.replace(/^ +/, "").replace(/ +$/, "");		// trim left and right spaces
 				verifyTitle = verifyTitle.replace(/_/g, " ");		// underscores to spaces
 				verifyTitle = verifyTitle.charAt(0).toUpperCase() + verifyTitle.substring(1, verifyTitle.length);	// uppercase first character
 				isPasteable = (verifyTitle == mw.config.get('wgTitle'));
 
 				var h1 = document.getElementsByTagName("h1")[0];
 				if (h1 && isPasteable) {
 					h1.innerHTML = containsTooMuchHTML ? realTitleText : realTitleHTML;
 					if (!containsTooMuchHTML)
 						realTitleBanner.style.display = "none";
 				}
 				document.title = realTitleText + " - Wikipedia, the free encyclopedia";
 			}
 		}
 	} catch (e) {
 		/* Something went wrong. */
 	}
     });
 }
 
 
 // similar to innerHTML, but only returns the text portions of the insides, excludes HTML
 function pickUpText(aParentElement) {
   var str = "";
 
   function pickUpTextInternal(aElement) {
     var child = aElement.firstChild;
     while (child) {
       if (child.nodeType == 1)		// ELEMENT_NODE 
         pickUpTextInternal(child);
       else if (child.nodeType == 3)	// TEXT_NODE
         str += child.nodeValue;
 
       child = child.nextSibling;
     }
   }
 
   pickUpTextInternal(aParentElement);
 
   return str;
 }

 //fix edit summary prompt for undo
 //this code fixes the fact that the undo function combined with the "no edit summary prompter" causes problems if leaving the
 //edit summary unchanged
 //this was added by [[User:Deskana]], code by [[User:Tra]]
 $( document ).ready(function () {
   if (document.location.search.indexOf("undo=") != -1
   && document.getElementsByName('wpAutoSummary')[0]) {
     document.getElementsByName('wpAutoSummary')[0].value='';
   }
 })

 /** Add dismiss button to watchlist-message *************************************
  *
  *  Description: Hide the watchlist message for one week.
  *  Maintainers: [[User:Ruud Koot|Ruud Koot]]
  */
 
 function addDismissButton() {
    var watchlistMessage = document.getElementById("watchlist-message");
    if ( watchlistMessage == null ) return;
 
    if ( document.cookie.indexOf( "hidewatchlistmessage=yes" ) != -1 ) {
        watchlistMessage.style.display = "none";
    }
 
    var Button     = document.createElement( "span" );
    var ButtonLink = document.createElement( "a" );
    var ButtonText = document.createTextNode( "dismiss" );
 
    ButtonLink.setAttribute( "id", "dismissButton" );
    ButtonLink.setAttribute( "href", "javascript:dismissWatchlistMessage();" );
    ButtonLink.setAttribute( "title", "Hide this message for one week" );
    ButtonLink.appendChild( ButtonText );
 
    Button.appendChild( document.createTextNode( "[" ) );
    Button.appendChild( ButtonLink );
    Button.appendChild( document.createTextNode( "]" ) );
 
    watchlistMessage.appendChild( Button );
 }
 
 function dismissWatchlistMessage() {
     var e = new Date();
     e.setTime( e.getTime() + (7*24*60*60*1000) );
     document.cookie = "hidewatchlistmessage=yes; expires=" + e.toGMTString() + "; path=/";
     var watchlistMessage = document.getElementById("watchlist-message");
     watchlistMessage.style.display = "none";
 }
 
$( document ).ready( addDismissButton );

/**
  * Remove need for CSS hacks regarding MSIE and IPA.
  */
if(navigator.userAgent.indexOf('MSIE') != -1 && document.createStyleSheet) {
   document.createStyleSheet().addRule('.IPA', 'font-family: "Doulos SIL", "Charis SIL", Gentium, "DejaVu Sans", Code2000, "TITUS Cyberbit Basic", "Arial Unicode MS", "Lucida Sans Unicode", "Chrysanthi Unicode";');
}

/**
 * SVG image rendering
 * Description: Adds links to rendered PNG images in different resolutions
 * From: [[commons:Mediawiki:Common.js]]
 */
function SVGThumbs() {
	var file = document.getElementById('file'); // might fail if MediaWiki can't render the SVG
	if (file && mw.config.get( 'wgIsArticle' ) && mw.config.get( 'wgTitle' ).match(/\.svg$/i)) {
		var thumbu = file.getElementsByTagName('IMG')[0].src;
		if(!thumbu) return;
 
		function svgAltSize( w, title) {
			var path = thumbu.replace(/\/\d+(px-[^\/]+$)/, '/' + w + "$1");
			var a = document.createElement('A');
			a.setAttribute('href', path);
			a.appendChild(document.createTextNode(title));
			return a;
		}
 
		var p = document.createElement('p');
		p.className = 'SVGThumbs';
		p.appendChild(document.createTextNode("এরে ফটক এগ পিএনজি ফরম্যাটে পানা য়্যাকরতই"+': '));
		var l = [200, 500, 1000, 2000];
                var b = ['২০০', '৫০০', '১০০০', '২০০০'];
                for( var i = 0; i < l.length; i++ ) {
			p.appendChild(svgAltSize( l[i], b[i] + " পিক্সেল"));
			if( i < l.length-1 ) p.appendChild(document.createTextNode(', '));
                }
		p.appendChild(document.createTextNode('।'));
		var info = file.parentNode.querySelector('div.fullMedia' )[0];
		if( info ) info.appendChild(p);
	}
}
$( SVGThumbs );

// To enable [[MediaWiki:Edittools.js]]
var load_edittools = true;
// extra drop down menu on editing for adding special characters
importScript( 'MediaWiki:Edittools.js' );
// Editpage scripts
if( mw.config.get('wgAction') == 'edit' || mw.config.get('wgAction') == 'submit' ) {
        importScript( 'MediaWiki:Editpage.js' );
}

//Script by Uttam Singha @ http://www.usingha.com
var mn = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
var beng_month_name = new Array;
beng_month_name[1] = "বৈশাখ";
beng_month_name[2] = "জেঠ";
beng_month_name[3] = "আষাঢ়";
beng_month_name[4] = "হাওন";
beng_month_name[5] = "ভাদ";
beng_month_name[6] = "আশ্বিন";
beng_month_name[7] = "কার্তিক";
beng_month_name[8] = "আগন";
beng_month_name[9] = "পৌষ";
beng_month_name[10] = "মাঘ";
beng_month_name[11] = "ফাল্গুন";
beng_month_name[12] = "চৈত";
var bWeekdays = new Array("লামুইসিং",
                "নিংথৌকাপা",
                 "লেইপাকপা",
                 "ইনসাইনসা",
                 "সাকলসেন",
                 "ইরেই",
                 "থাংচা",
                 "লামুইসিং");
var bmonth_len = "";
var bWeekdays1 = new Array("লাম", "নিং", "লেই", "ইন", "সাক", "ইরে", "থাং", "লাম");
function convert(str) {
    var mystr = str.toString();
    var outj; // javascript escaped hex
    var outj1;
    var be = new Array();
    be['1'] = "\u09E7";
    be['2'] = "\u09E8";
    be['3'] = "\u09E9";
    be['4'] = "\u09EA";
    be['5'] = "\u09EB";
    be['6'] = "\u09EC";
    be['7'] = "\u09ED";
    be['8'] = "\u09EE";
    be['9'] = "\u09EF";
    be['0'] = "\u09E6";
    be[' '] = '';
    be['-'] = '-';
    outj1 = "";
    for (var i = 0; i < mystr.length; i++) {
        var ch = mystr.substr(i, 1);
        outj = be[ch];
        outj1 += outj;
    }
    return outj1;

}

var mas_len = [0, 30.92569444, 62.63289352, 94.00184028, 125.4761458, 156.4885417, 186.9247338, 216.8066667, 246.3155787, 275.6427546, 305.0935301, 334.9103588, 365.2587564814815];

function ModernDate_to_Julianeday(eyear, emonth, eday) {
    var julian_eday;

    if (emonth < 3) {
        eyear = eyear - 1;
        emonth = emonth + 12;
    }

    julian_eday = Math.floor((365.25 * eyear)) + Math.floor(30.59 * (emonth - 2)) + eday + 1721086.5;
    if (eyear < 0) {
        julian_eday = julian_eday - 1;
        if (((eyear % 4) == 0) && (3 <= emonth)) {
            julian_eday = julian_eday + 1;
        }
    }
    if (2299160 < julian_eday) {
        julian_eday = julian_eday + Math.floor(eyear * 1.0 / 400) - Math.floor(eyear * 1.0 / 100) + 2;
    }

    return julian_eday;
}

function BPM_Date(eyear, emonth, eday) {
    var country = "India";

    var str = "";
    var startjd = 0.0;
    if (country = "India") {
        startjd = 1938094.4629; //India
    }
    else {
        startjd = 1938094.483733333;
    }
    var nJD = ModernDate_to_Julianeday(eyear, emonth, eday);
    if (nJD < startjd) {
        str = " Date is not appropriate.\n";
    }
    else {
        var jddiff = nJD - startjd;
        var lasteyear = Math.floor(jddiff / 365.2587564814815);
        var mesh = startjd + lasteyear * 365.2587564814815;
        var lasteday = 0.0;
        var ps, ns, bemonth, beday;
        for (var i = 0; i < 12; i++) {
            ps = mesh + mas_len[i];
            ns = mesh + mas_len[i + 1];
            if ((nJD >= ps) && (nJD <= Math.floor(ns) + 1.75)) {
                bemonth = i + 1;
                beday = Math.floor(nJD - ps) + 1;
            }

        }
var array = [];
          for (var i = 0; i < 13; i++)
                     {
                         lastday = mesh + mas_len[i];
                         var nda = new Date(calData(lastday + 1).toDateString());
                         array.push((nda.getMonth()+1) + "/" + nda.getDate() + "/" + nda.getFullYear());
                     }
                     bmonth_len = array.join(",");
    }
    return new Array(lasteyear + 1, bemonth, beday);

}
function oneDay() {
    var now = new Date();
    now.setTime(now.getTime() + (now.getTimezoneOffset() + 360) * 60 * 1000);
    var eday = now.getDate();
    var emonth = now.getMonth();
    var eyear = now.getFullYear();
    var bcal = BPM_Date(eyear, emonth + 1, eday);
    var nJD = ModernDate_to_Julianeday(eyear, emonth + 1, eday);
    var bar = Math.floor(nJD + 0.5) % 7 + 1;
    var str = convert(bcal[2]) + " " + beng_month_name[bcal[1]] + " " + convert((bcal[0])) + " মারি, " + bWeekdays[bar];
    return str;
}
var theDiv = document.getElementById("contentSub"); 
var content = document.createTextNode(oneDay()); 
theDiv.appendChild(content);
function calData(jd)
{
with(Math){
z1 = jd + 0.5;
z2 = floor(z1);
f = z1 - z2;
if(z2 < 2299161)a = z2;
else {
alf = floor((z2 - 1867216.25)/36524.25);
a = z2 + 1 + alf - floor(alf/4);
}
b = a + 1524;
c = floor((b - 122.1)/365.25);
d = floor(365.25*c);
e = floor((b - d)/30.6001);
days = b - d - floor(30.6001*e) + f;
kday = floor(days);
if(e < 13.5)kmon = e - 1;
else kmon = e - 13;
if(kmon > 2.5)kyear = c - 4716;
if(kmon < 2.5)kyear = c - 4715;
hh1 = (days - kday)*24;
khr = floor(hh1);
kmin = hh1 - khr;
ksek = kmin*60;
kmin = floor(ksek);
ksek = floor((ksek - kmin)*60);
if (kday < 10)kday = " " + kday;
if (khr < 10)khr = "0" + khr;
if (kmin < 10)kmin = "0" + kmin;
if (ksek < 10)ksek = "0" + ksek;
var dstr = mn[kmon - 1] + " " + kday + ", " + kyear + " " + khr + ":" + kmin + ":00";
//var sDate = new Date(Date.parse("03/20/2012", "MM/dd/yyyy"));
s = new Date(dstr);

}
return s;
}

function BPMMaha() {
    var dynTable = "";
    var now = new Date();
    now.setTime(now.getTime() + (now.getTimezoneOffset() + 360) * 60 * 1000); 
    var day = now.getDate();
    var month = now.getMonth();
    var year = now.getFullYear();
    var bcal = BPM_Date(year, month + 1, day);
    var mesh = 1938094.4629 + (bcal[0] - 1) * 365.2587564814815;
    var bar = calData(mesh + mas_len[bcal[1] - 1] + 1);
    var startingDay = bar.getDay();
    var one_day = 1000 * 60 * 60 * 24;
    var mr = bmonth_len.split(",");
    var diff = Math.ceil((new Date(mr[bcal[1]]) - new Date(mr[bcal[1] - 1])) / (one_day));

    var monthLength = diff;
    //bcal[2]
  var html = '<table class="gridtable">';
   html += '<tr><th colspan="7">';
   html +=  beng_month_name[bcal[1]] + "&nbsp;" + convert((bcal[0])) + " সন";
   html += '</th></tr>';
   html += '<tr>';
   for (var i = 0; i <= 6; i++) {
       html += '<td style=\"color: red; background: #99ff66; border: 1px solid black; font: 12px Siyam Rupali;\">';
       html += bWeekdays1[i];
       html += '</td>';
   }
   html += '</tr><tr>';
   var day = 1;
  // this loop is for is weeks (rows)
  for (var i = 0; i < 9; i++) {
    // this loop is for weekdays (cells)
    for (var j = 0; j <= 6; j++) { 
      html += '<td>';
      if (day <= monthLength && (i > 0 || j >= startingDay)) {
          if (day == bcal[2]) //DD added
          {
              html += 'আজি<br><font size="3" color="red">' + convert(day) +  '</font><br>'; //DD added
          }
          else {
              html +=  convert(day)  +  '<br>';
          }
      day++;
  }
  html += '</td>';
}
// stop making rows if we've run out of days
if (day > monthLength) {
    break;
} else {
    html += '</tr><tr>';
}
}
html += '</tr></table>';
return html;
}
if(document.getElementById("panji"))
{
var inx=document.getElementById("panji");
  inx.innerHTML = BPMMaha();
}