﻿// JScript File
function load() 
{ 
  var pagename = FileName();
  var location = Location(); 
  var result = null; 
  switch (pagename) { 
    case "Location.aspx": mapLoad(location); break;
    default: ;
  }
} 

function FileName() 
{ 
  // Check whether '/' exists. 
  if (location.href.lastIndexOf('/') !=-1) 
  { 
    // If it does then we ... 
    // Find the first position (the file starts after this) 
    firstpos=location.href.lastIndexOf('/')+1; 
    
    if (location.href.lastIndexOf('?') != -1)
      lastpos=location.href.lastIndexOf('?')
    else
      lastpos=location.href.length; 
      
    /* Normally, the last position of the filename will be at the end of the complete URL - although it could have a # and a name at the end!*/ 
    Namer=location.href.substring(firstpos,lastpos); 
    // We extract the string (the file's name). 
     //alert('My name is "'+Namer+'"'); 
    // And reveal all to the clicker! 
  } 
  return Namer 
} 

function Location() 
{ 
  // Check whether '/' exists. 
  if (location.href.lastIndexOf('=') !=-1) 
  { 
    // If it does then we ... 
    // Find the first position (the file starts after this) 
    firstpos=location.href.lastIndexOf('=')+1; 
    
    lastpos=location.href.length; 
      
    /* Normally, the last position of the filename will be at the end of the complete URL - although it could have a # and a name at the end!*/ 
    Namer=location.href.substring(firstpos,lastpos); 
    // We extract the string (the file's name). 
     //alert('My name is "'+Namer+'"'); 
    // And reveal all to the clicker! 
  } 
  return Namer 
} 

function checkEMail(inEmail) {
	var locAt;
	var locPeriod;
	var okEmail;

	locAt = inEmail.indexOf("@");
	okEmail = ((locAt != -1) && 
			   (locAt != 0) &&
			   (locAt != (inEmail.length - 1)) &&
			   (inEmail.indexOf("@", locAt + 1) == -1)
			  );
	if (okEmail) {
		// so far, so good
		locPeriod = inEmail.indexOf(".");
		okEmail = ((locPeriod != -1) && (locPeriod != (inEmail.length - 1)) && (locPeriod > locAt));
	}
	
	return okEmail;
}



