﻿function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

var loc = stringA = location.href.toLowerCase();
var strLocation = "/";
var len = strLocation.length;
var pos = stringA.indexOf(strLocation);

function lastFileName(stringA) {
	if (pos >= 0){
		stringA = stringA.substring(pos + len,stringA.length);
		while (stringA.indexOf("/") >= 0){
			pos = stringA.indexOf("/");
			stringA = stringA.substring(pos + 1,stringA.length);
		}
	}
	return stringA;
}

function lastFolderName(stringA) {
	if (pos >= 0){
		var pos1,pos2;
		pos1 = stringA.lastIndexOf("/");
		stringA = stringA.substring(pos + len,pos1);
		pos2 = stringA.lastIndexOf("/");
		stringA = stringA.substring(pos2 + 1,pos1);
	}
	return stringA;
}

var lastFileOrFolderName = lastFolderName(stringA);
var lastfilename = lastFileName(stringA);
function selectBg(i){
	
	document.getElementById(i).className = "select";	
}
function clearBg(i){
	document.getElementById(i).className = "";	
}
var links = new Array(
						"wsi",
						"wse",
						"ourMethod",
						"ourCourses",
						"corpEnglish",
						"careers"
					  );

var pic   = new Array(
						"WALL STREET INSTITUTE",
						"WALL STREET ENGLISH",
						"OUR METHOD",
						"OUR COURSES",
						"CORPORATE ENGLISH TRAINING",
						"CAREERS"
					  );
var loc = "http://www.wsi.com.cn/new/";
var divShow  = new Array(
						'<img src="'+loc+'images/share/dashed_line.gif" /><a id="about_wsi" href="'+loc+'templates/en/wsi/about_WSI.html">About WSI</a><a id="global_centers" href="'+loc+'templates/en/wsi/global_Centers.html">WSI Centers Around the World</a><a id="the_world_leader" href="'+loc+'templates/en/wsi/the_World_Leader.html">Learn English with the World Leader</a>',
						'<img src="'+loc+'images/share/dashed_line.gif" /><a id="about_wse" href="'+loc+'templates/en/wse/about_WSE.html">About WSE</a><a id="our_mission" href="'+loc+'templates/en/wse/our_Mission.html">Our Mission</a><a id="our_centers" href="'+loc+'templates/en/wse/our_Centers.html">Our Centers</a><a id="wse_in_the_news" href="'+loc+'templates/en/wse/wse_in_the_News.html">WSE in the News<a id="student_testimonials" href="'+loc+'templates/en/wse/student_Testimonials.html">Student Testimonials</a><a id="global_certifications" href="'+loc+'templates/en/wse/global_Certifications.html">Global Certifications</a>',
						'<img src="'+loc+'images/share/dashed_line.gif" /><a id="unique_multimethod" href="'+loc+'templates/en/ourMethod/unique_Multimethod.html">Unique Multimethod®</a><a id="8_advantages" href="'+loc+'templates/en/ourMethod/8_Advantages.html">8 Advantages</a>',
						'<img src="'+loc+'images/share/dashed_line.gif" /><a id="course_structure" href="'+loc+'templates/en/ourCourses/course_Structure.html">Course Structure</a><a id="course_type" href="'+loc+'templates/en/ourCourses/course_Type.html">Course Type</a><a id="harvard" href="'+loc+'templates/en/ourCourses/harvard.html">Online Management Training Course </a><a id="students_zone" href="'+loc+'templates/en/ourCourses/Students_Zone.html">Student’s Zone </a>',
						'<img src="'+loc+'images/share/dashed_line.gif" /><a id="overview" href="'+loc+'templates/en/corpEnglish/overview.html">Overview</a><a id="corporate_clients" href="'+loc+'templates/en/corpEnglish/corporate_clients.html">Corporate Clients</a><a id="corporate_client_testimonials" href="'+loc+'templates/en/corpEnglish/corporate_Client_Testimonials.html">Corporate Client Testimonials</a>',
						'<img src="'+loc+'images/share/dashed_line.gif" /><a id="careers_with_wse" href="'+loc+'templates/en/careers/careers_with_WSE.html">Careers with WSE</a><a id="teach_english_at_wse" href="'+loc+'templates/en/careers/teach_English_at_WSE.html">Teach English at WSE</a><a id="available_positions" href="'+loc+'templates/en/careers/available_Positions.html">Available Positions</a><a id="application_process" href="'+loc+'templates/en/careers/application_Process.html">Application Process</a><a id="people_at_wse" href="'+loc+'templates/en/careers/people_at_WSE.html">People @ WSE</a>'
					  );

function topNavLink() {
	var topNavList = '';
	for (var i = 0; i < links.length; i++) {
			if (lastFileOrFolderName == links[i].replace(/(.+\/)/,"").toLowerCase()){
				topNavList += '<li class="select_on">'+ pic[i] +'<div style="display:block;">'+ divShow[i] +'</div></li>';
			}
			else {
				topNavList += '<li id="'+i+'" onmouseover=selectBg('+i+'); onmouseout=clearBg('+i+');>'+ pic[i] +'<div>'+ divShow[i] +'</div></li>';
			}
	}
	document.write(topNavList);
	filename = lastfilename.split(".");
	var selectFileName = filename[0].toLowerCase();
	$("#"+selectFileName).addClass("over");
}