var zone = /(?:http:\/\/)?\w+\.(\w+)/.exec(location.search)[1]; if(zone=='com') alert('это .com') if(zone=='ru') alert('это .ru')