// A helper function to get the variable from the query string
function getQueryVariable(variable) {
  var query = window.location.search.substring(1);
  var vars = query.split("&");
  for (var i=0;i<vars.length;i++) {
    var pair = vars[i].split("=");
    if (pair[0] == variable) {
      return pair[1];
    }
  } 
}

// This is the main javascript function to jump to certain section of the content. Will only jump if the query string 'jump' is true.
// The maybank staff has to change the jumping coordinates manually in the switch case.
function jumpToSection() {
  var isJump = getQueryVariable('jump');
  var isPoint = getQueryVariable('point');
  // Only jump if the query string is there
  if (isJump  != null && isPoint==null) {
	     
        var coordToJump = 0;
        var strHTMName = ""; 
  	var strUrl = location.pathname;
  	// Find the name of the .htm in the url by looking at the last slash
        var intIndexOfLastSlash = strUrl.lastIndexOf("\\"); 
  	if (intIndexOfLastSlash > 0)
		  strHTMName = strUrl.substring(intIndexOfLastSlash + 1);
          
	
	/******************************************************************************************/
        // This is the part where the maybank staff will change the code.
       
        switch (strHTMName.toLowerCase()) {
		case "desktop_banking.shtml" :
			coordToJump = 210
			break	
	}
        switch (strHTMName.toLowerCase()) {
		case "faq.shtml" :
			coordToJump = 1390
			break	
	}
	/******************************************************************************************/
	
	scrollTo(coordToJump);
	
  }
 if (isJump  != null && isPoint  != null) {
       
        var coordToJump = 0;
        var strHTMName = ""; 
  	var strUrl = location.pathname;
  	// Find the name of the .htm in the url by looking at the last slash
     
	
                 strHTMName = isPoint;
	
	/******************************************************************************************/
        // This is the part where the maybank staff will change the code.
        switch (strHTMName.toLowerCase()) {
		case "view_benefits" :
			coordToJump = 140
			break	
               	case "faq_ediv" :
			coordToJump = 1560
			break
                case "faq_eenq" :
			coordToJump = 1700
			break		
		case "faq_epay" :
			coordToJump = 1870
			break		
		case "faq_mdtb" :
			coordToJump = 2000
			break		
		case "userguide_01" :
			coordToJump = 600
			break
		case "userguide_02" :
			coordToJump = 870
			break
		case "userguide_03" :
			coordToJump = 1120
			break
		case "userguide_04" :
			coordToJump = 1370
			break
		case "userguide_05" :
			coordToJump = 1620
			break		
		case "demo_01" :
			coordToJump = 1900
			break	
		case "fileformat_01" :
			coordToJump = 2150
			break	
		case "filelayout_01" :
			coordToJump = 2430
			break	
		case "m2e_01" :
			coordToJump = 2700
			break
		case "enhancement_01" :
			coordToJump = 2980
			break
		case "converter_01" :
			coordToJump = 3240
			break
		case "form_01" :
			coordToJump = 3550
			break	
	}
       
	/******************************************************************************************/
	
	scrollTo(coordToJump);
	
  }
}