// JavaScript Document


function SDMenu(id) {
	if (!document.getElementById || !document.getElementsByTagName)
		return false;
	this.menu = document.getElementById(id);
	this.submenus = this.menu.getElementsByTagName("div");
	this.remember = true;
	this.speed = 3;
	this.markCurrent = true;
	this.oneSmOnly = false;
}
SDMenu.prototype.init = function() {
	var mainInstance = this;
	for (var i = 0; i < this.submenus.length; i++)
		this.submenus[i].getElementsByTagName("span")[0].onclick = function() {
			mainInstance.toggleMenu(this.parentNode);
		};
	if (this.markCurrent) {
		var links = this.menu.getElementsByTagName("a");
		for (var i = 0; i < links.length; i++)
			if (links[i].href == document.location.href) {
				links[i].className = "current";
				break;
			}
	}
	if (this.remember) {
		var regex = new RegExp("sdmenu_" + encodeURIComponent(this.menu.id) + "=([01]+)");
		var match = regex.exec(document.cookie);
		if (match) {
			var states = match[1].split("");
			for (var i = 0; i < states.length; i++)
				this.submenus[i].className = (states[i] == 0 ? "collapsed" : "");
		}
	}
};
SDMenu.prototype.toggleMenu = function(submenu) {
	if (submenu.className == "collapsed")
		this.expandMenu(submenu);
	else
		this.collapseMenu(submenu);
};
SDMenu.prototype.expandMenu = function(submenu) {
	var fullHeight = submenu.getElementsByTagName("span")[0].offsetHeight;
	var links = submenu.getElementsByTagName("a");
	for (var i = 0; i < links.length; i++)
		fullHeight += links[i].offsetHeight;
	var moveBy = Math.round(this.speed * links.length);
	
	var mainInstance = this;
	var intId = setInterval(function() {
		var curHeight = submenu.offsetHeight;
		var newHeight = curHeight + moveBy;
		if (newHeight < fullHeight)
			submenu.style.height = newHeight + "px";
		else {
			clearInterval(intId);
			submenu.style.height = "";
			submenu.className = "";
			mainInstance.memorize();
		}
	}, 30);
	this.collapseOthers(submenu);
};
SDMenu.prototype.collapseMenu = function(submenu) {
	var minHeight = submenu.getElementsByTagName("span")[0].offsetHeight;
	var moveBy = Math.round(this.speed * submenu.getElementsByTagName("a").length);
	var mainInstance = this;
	var intId = setInterval(function() {
		var curHeight = submenu.offsetHeight;
		var newHeight = curHeight - moveBy;
		if (newHeight > minHeight)
			submenu.style.height = newHeight + "px";
		else {
			clearInterval(intId);
			submenu.style.height = "";
			submenu.className = "collapsed";
			mainInstance.memorize();
		}
	}, 30);
};
SDMenu.prototype.collapseOthers = function(submenu) {
	if (this.oneSmOnly) {
		for (var i = 0; i < this.submenus.length; i++)
			if (this.submenus[i] != submenu && this.submenus[i].className != "collapsed")
				this.collapseMenu(this.submenus[i]);
	}
};
SDMenu.prototype.expandAll = function() {
	var oldOneSmOnly = this.oneSmOnly;
	this.oneSmOnly = false;
	for (var i = 0; i < this.submenus.length; i++)
		if (this.submenus[i].className == "collapsed")
			this.expandMenu(this.submenus[i]);
	this.oneSmOnly = oldOneSmOnly;
};
SDMenu.prototype.collapseAll = function() {
	for (var i = 0; i < this.submenus.length; i++)
		if (this.submenus[i].className != "collapsed")
			this.collapseMenu(this.submenus[i]);
};
SDMenu.prototype.memorize = function() {
	if (this.remember) {
		var states = new Array();
		for (var i = 0; i < this.submenus.length; i++)
			states.push(this.submenus[i].className == "collapsed" ? 0 : 1);
		var d = new Date();
		d.setTime(d.getTime() + (30 * 24 * 60 * 60 * 1000));
		document.cookie = "sdmenu_" + encodeURIComponent(this.menu.id) + "=" + states.join("") + "; expires=" + d.toGMTString() + "; path=/";
	}
};

	var myMenu;
	window.onload = function() {
		myMenu = new SDMenu("my_menu");
		myMenu.init();
	};





/*
document.write("<div class=\"menu_home\"><span><a href=\"../index.html\">Home </a></span></div>");
document.write("<div style=\"float: left\" id=\"my_menu\" class=\"sdmenu\">");
  document.write("<div class=\"collapsed\">");
    document.write("<span>Electronic Banking</span>");
	document.write("<a href=\"../electronic_banking/introduction.html\">Introduction</a>");
    document.write("<a href=\"../DBBLWeb/atmlocation.jsp\">ATM Locations</a>");
	document.write("<a href=\"../DBBLWeb/merchant_locations.jsp\">Merchant Locations</a>");
    document.write("<a href=\"../DBBLWeb/branchlocation.jsp\">Branch Locations</a>");
    document.write("<a href=\"../electronic_banking/apply.html\">Apply</a>");
    document.write("<a href=\"../electronic_banking/forms.html\">Forms</a>");
    document.write("<a href=\"../electronic_banking/nexuspro.html\">NexusPRO Processor Cards (Debit & Credit)</a>");
    document.write("<a href=\"../electronic_banking/debit_cards.html\">Debit Cards</a>");
    document.write("<a href=\"../electronic_banking/credit_cards.html\">Credit Cards</a>");
    document.write("<a href=\"../electronic_banking/internet_banking.html\">Internet Banking</a>");
	 document.write("<a href=\"../electronic_banking/remittance_internet.html\">Foreign Remittance through internet</a>");
    document.write("<a href=\"../electronic_banking/mobile_banking.html\">Mobile Banking</a>");
  document.write("</div>");
  document.write("<div class=\"collapsed\">");
    document.write("<span>Retail Banking</span>");
    document.write("<a href=\"../electronic_banking/introduction.html\">Electronic Banking</a>");
    document.write("<a href=\"../retail_banking/life_line.html\">DBBL Life Line</a>");
    document.write("<a href=\"../retail_banking/future_line.html\">DBBL Future Line</a>");
  document.write("</div>");
  document.write("<div>");
    document.write("<span>Deposits and Advances</span>");
    document.write("<a href=\"../depositsadv/deposits.html\">Deposits</a>");
    document.write("<a href=\"../depositsadv/term_deposit.html\">Term Deposits</a>");
    document.write("<a href=\"../depositsadv/loansadv.html\">Loans and Advances</a>");
  document.write("</div>");
  document.write("<div>");
    document.write("<span>Corporate Banking</span>");
	document.write("<a href=\"../corporate_banking/corpbanking.html\">Corporate Banking services overview</a>");
    document.write("<a href=\"../corporate_banking/ebankingforcorp.html\">Electronic Banking for your business</a>");
    document.write("<a href=\"../corporate_banking/lc_trade.html\">LC Trade</a>");
  document.write("</div>");
  document.write("<div>");
    document.write("<span>Services for Companies</span>");
    document.write("<a href=\"../under/under_cons.html\">Services for Banks</a>");
    document.write("<a href=\"../under/under_cons.html\">Services for Companies</a>");
    document.write("<a href=\"../services_company/remittance_exchange.html\">Remittance services for Exchange Houses</a>");
  document.write("</div>      ");
      document.write("<div class=\"collapsed\">");
    document.write("<span>SME Banking</span>");
    document.write("<a href=\"../sme_banking/cash_credit.html\">Smart SME Cash Credit</a>");
    document.write("<a href=\"../sme_banking/term_loan.html\">Smart SME Term Loan</a>");
    document.write("<a href=\"../sme_banking/small_shop.html\">Smart SME Small Shop Financing Scheme</a>");
  document.write("</div>");
  document.write("<div>");
    document.write("<span>News Room</span>");
    document.write("<a href=\"../under_cons.html\">Corporate Social Responsibility</a>");
    document.write("<a href=\"http://newsroom.dutchbanglabank.com/newsroom\">News</a>");
    document.write("<a href=\"../under_cons.html\">Promotions</a>");
  document.write("</div>");
  document.write("<div>");
    document.write("<span>About Us</span>");
    document.write("<a href=\"../about_us/brief_history.html\">Brief History</a>");
    document.write("<a href=\"../about_us/board.html\">Board Of Directors</a>");
    document.write("<a href=\"http://www.dutchbanglabank.com/DBBLWeb/DbblManagement\" >Management</a>");
  document.write("</div>");
  document.write("<div>");
    document.write("<span>Investor Relations</span>");
    document.write("<a href=\"../investor_relations/financial_statements.html\">Financial Statements</a>");
    document.write("<a href=\"../investor_relations/interim_report.html\">Interim Report</a>");
    document.write("<a href=\"../investor_relations/price_sensitive_information.html\">Price Sensitive Information</a>");
    document.write("<a href=\"../investor_relations/Annual_Report_2010/PDFs/disclosure on risk based capital(Basel II).pdf\">Risk Based Capital</a>");
  document.write("</div>");
  document.write("<div>");
    document.write("<span>Contact Us</span>");
	document.write("<a href=\"../help_desk/lost_stolen.html\">Lost or Stolen Cards</a>");
    document.write("<a href=\"../about_us/head_office.html\">Head Office</a>");
	document.write("<a href=\"../DBBLWeb/atmlocation.jsp\">ATM Locations</a>");
    document.write("<a href=\"../DBBLWeb/branchlocation.jsp\">Branch Locations</a>");
  document.write("</div>");
   document.write("<div>");
   document.write("<span>Miscellaneous</span>");
    document.write("<a href=\"http://mail.dbbl.com.bd/webmail/src/login.php\">DBBL Web Mail</a>");
  document.write("<a href=\"../schedule_charge/schedule_of_charges.pdf\">Charges and. Fees</a>");
		    //document.write("<a href=\"http://www.dutchbanglabank.com/dbbf/login.html\">DBBL Scholarship</a>");
			//document.write("<a href=\"../online_app/selectJob.asp\">Career Opportunity (Apply Online)</a>");
			//document.write("<a href=\"http://www.dbbl.com.bd/Online_Job/CurrentJob.aspx\">Career Opportunity (Apply Online)</a>");
document.write("<a href=\"http://www.dutchbanglabank.com/Online_Job/\">Career Opportunity (Apply Online)</a>");
document.write("<a href=\"http://www.dutchbanglabank.com/scholarship/index.html\">DBBL Scholarship</a>");
document.write("</div>");
  
  
  
  document.write("<div>");
    document.write("<span>Help Desk</span>");
    document.write("<a href=\"../help_desk/lost_stolen.html\">Lost or Stolen card</a>");
	document.write("<a href=\"../help_desk/customer_serveice.html\">Customer Service</a>");
    document.write("<a href=\"../help_desk/Frequency_asked_questions.html\">Frequently Asked Questions</a>");
    document.write("<a href=\"http://www.dutchbanglabank.com/DBBLWeb/help_desk.jsp\">Contact Us</a>");
  document.write("</div>");
document.write("</div>");

*/


