﻿var regex=/\w+/;

function ChangeLanguage(value){ 
 var match = document.location.pathname.match(regex);
  if (match == null) {
    newUrl = 'http://' + document.location.hostname + '/' + value + document.location.pathname;
  } else {
    newUrl = 'http://' + document.location.hostname + document.location.pathname.replace(match,value);
  }
 window.location = newUrl;
}

jQuery(document).ready(function() {
  var match = document.location.pathname.match(regex);
  if (match != null) {
    jQuery('#ddlLanguage').val(match);
  }
});
