checkLocation();

function checkLocation() {
  // what to compare
  var x = location.href

  // regular exp

  var a = "fass\.um\.edu\.my";	// fac. of arts and social sciences
  var b = "fbe\.um\.edu\.my";	// fac. of the built environment
  var c = "fpp\.um\.edu\.my";	// fac. of business and accountancy
  var d = "dentistry\.um\.edu\.my"; // fac. of dentistry
  var e = "education\.um\.edu\.my"; // fac. of education
  var f = "engine\.um\.edu\.my";	// fac. of engineering
  var g = "language\.um\.edu\.my";	// fac. of languages and linguistics
  var h = "cultural\.um\.edu\.my";	// cultural centre
  var i = "sports\.um\.edu\.my";	// sports centre
  var j = "ipk\.um\.edu\.my";		// institute of principalship studies
  var k = "chess\.um\.edu\.my";		// chess club
  var l = "islamic\.um\.edu\.my"; 	// pkkium
  var m = "ics\.um\.edu\.my";		// institute of china studies
  var n = "upum\.um\.edu\.my";		// um consultancy unit (upum)
  var o = "familydevt\.um\.edu\.my";	// centre for family development
  var p = "citra\.um\.edu\.my";		//	citra
  var q = "law\.um\.edu\.my";    	//	fac. of law
  var r = "4college\.um\.edu\.my";	// fourth residential college
  var s = "umcic\.um\.edu\.my";	// um centre of innovation and commercialization (umcic)
  var t = "htmc\.um\.edu\.my"; // health and translational medicine cluster (htmc)
  var v = "citycampus\.um\.edu\.my";
  var w = "emrd\.um\.edu\.my"; // electromagnetic radiation and devices research group
  var y = "aei\.um\.edu\.my";
  
// compare
// fac. of arts and social sciences
var re = new RegExp(a)
  //  document.write("<br> the subject - "+x);
  //  document.write("<br> the regular exp - "+y);
  //  document.write("<br> after regexp - "+re);
if (x.match(re)) {
     // alert("match la");
     window.location="http://fass.um.edu.my/ccm/navigation/academics/faculties/fsss/";
  } else {
	//   alert("dont match lor");
  } 

// fac. of the built environment
var re = new RegExp(b)	
 if (x.match(re)) {
     window.location="http://fbe.um.edu.my/ccm/navigation/academics/faculties/FAB/";
  } else {  } 

// fac. of business and accountancy
var re = new RegExp(c)
 if (x.match(re)) {
     window.location="http://fpp.um.edu.my/ccm/navigation/academics/faculties/FPP/";
  } else {  } 

// fac. of dentistry
var re = new RegExp(d)
if (x.match(re)) {
     // alert("match la");
     window.location="http://dentistry.um.edu.my/ccm/navigation/academics/faculties/fgg/";
  } else {  } 

// fac. of education
var re = new RegExp(e)
if (x.match(re)) {
     // alert("match la");
     window.location="http://education.um.edu.my/ccm/navigation/academics/faculties/FDD/";
  } else {  } 

// fac. of engineering
var re = new RegExp(f)
if (x.match(re)) {
     // alert("match la");
     window.location="http://engine.um.edu.my/ccm/navigation/academics/faculties/FK/";
  } else {	}
  
// fac. of languages and linguistics
var re = new RegExp(g)
if (x.match(re)) {
     // alert("match la");
     window.location="http://language.um.edu.my/ccm/navigation/academics/faculties/FLL/";
  } else {  } 

// cultural centre
var re = new RegExp(h)
if (x.match(re)) {
     // alert("match la");
     window.location="http://cultural.um.edu.my/ccm/navigation/academics/centres/pbudaya/";
  } else {  } 

// sports centre
var re = new RegExp(i)
if (x.match(re)) {
     // alert("match la");
     window.location="http://sports.um.edu.my/ccm/navigation/academics/centres/sports-centre";
  } else {  }

// institute of principalship studies
var re = new RegExp(j)
if (x.match(re)) {
     // alert("match la");
     window.location="http://ipk.um.edu.my/ccm/navigation/academics/institute/institute-of-principalship-studies/";
  } else {  } 

// chess club
var re = new RegExp(k)
if (x.match(re)) {
     // alert("match la");
     window.location="http://chess.um.edu.my/ccm/navigation/staff-activities/staff-activities/pcum/";
  } else {  } 

// pkkium
var re = new RegExp(l)
if (x.match(re)) {
     // alert("match la");
     window.location="http://islamic.um.edu.my/ccm/navigation/staff-activities/staff-activities/pkkium/";
  } else {  } 

// institute of china studies
var re = new RegExp(m)
  if (x.match(re)) {
  	window.location ="http://ics.um.edu.my/ccm/navigation/academics/institute/institute-of-china-studies/";
  } else {  }

// um consultancy unit (upum)
var re = new RegExp(n)
  if (x.match(re)) {
  	window.location = "http://upum.um.edu.my/ccm/navigation/staff-centres/staff-centres/university-of-malaya-consultancy-unit/";
  } else {  }

// centre for family development  
var re = new RegExp(o)
if (x.match(re)) {
     // alert("match la");
     window.location="http://familydevt.um.edu.my/ccm/navigation/staff-centres/staff-centres/centre-for-family-development/";
  } else {  } 

//	citra
var re = new RegExp(p)
 if (x.match(re)) {
     // alert("match la");
     window.location="http://citra.um.edu.my/ccm/navigation/staff-centres/staff-centres/citra/";
  } else {  } 
  
//	fac. of law
var re = new RegExp(q)
  if (x.match(re)) {
     // alert("match la");
     window.location="http://law.um.edu.my/ccm/navigation/academics/faculties/FUU/";
  } else {  } 

// fourth residential college
var re = new RegExp(r)
  if (x.match(re)) {
     // alert("match la");
     window.location="http://4college.um.edu.my/ccm/navigation/colleges/colleges/fourth-residential-college/";
  } else {  } 

// um centre of innovation and commercialization 
var re = new RegExp(s)
  if (x.match(re)) {
     // alert("match la");
     window.location="http://umcic.um.edu.my/ccm/navigation/office/office/umcic/";
  } else {  } 
  
// health and translational medicine
var re = new RegExp(t)
  if (x.match(re)) {
     // alert("match la");
     window.location="http://htmc.um.edu.my/ccm/navigation/office/office/health-trans-medicine/";
  } else {  } 
  
// city campus management office
var re = new RegExp(v)
  if (x.match(re)) {
 	window.location = "http://citycampus.um.edu.my/ccm/navigation/office/office/city-campus/";
  } else {  }
  
// electromagnetic radiation and devices research group
var re = new RegExp(w)
  if (x.match(re)) {
 	window.location = "http://emrd.um.edu.my/ccm/navigation/office/office/emrd/";
  } else {  }
  
// asia-europe institute
var re = new RegExp(y)
  if (x.match(re)) {
 	window.location = "http://aei.um.edu.my/ccm/navigation/academics/institute/asia-europe-institute/";
  } else {  }
  
}