/* Navbar title attributes */
var homeTitle         = "Mirand Homepage";
var solutionsTitle         = "Check out some of the solutions that we offer";
var caseTitle     = "Feel free to browse our portfolio of work";
var aboutusTitle        = "Find out more about Mirand";
var contactusTitle     = "Get in contact with us today";
var faqTitle 	      = "Get answers to frequently asked questions";
var navSite = {
  "home"         : { name : "Home", title : homeTitle, url : "http://www.mirandms.com/index.php" },
  "solutions"    : { name : "Solutions", title : solutionsTitle, url : "http://www.mirandms.com/solutions.php"},
  "casestudies"  : { name : "Case studies", title : caseTitle, url : "http://www.mirandms.com/casestudies.php"},
  "about"        : { name : "About us", title : aboutusTitle, url : "http://www.mirandms.com/aboutus.php"},
  "contact"      : { name : "Contact us", title : contactusTitle, url : "http://www.mirandms.com/contact.php"}
  //"faq"          : { name : "FAQ", title : faqTitle, url : "faq.php"}

};


BuildNavBar = function ( currentPage )	{
  document.write('<ul>');
  for (i in navSite) document.write('<li><a href="' + navSite[i].url + '" title="' + navSite[i].title + '" id="' + i  +'">' + navSite[i].name + '</a></li>'); 
  document.write('</ul>');
  
 if ( currentPage == "home" || currentPage == "solutions" || currentPage == "casestudies" || currentPage == "about" || currentPage == "contact" || currentPage == "faq" ) {  
	setCurrent(currentPage); }
}

setCurrent = function (current) {
  var thePage = document.getElementById( current );

  /* Check if the class is already there */
  if (!thePage.className.match(new RegExp('\\bcurrent\\b'))) {
    thePage.className += ' current';
  }

  thePage.className = "current";

}



mms_init = function() {
	projBoxHover('content');
}

	
projBoxHover = function(theId) {

		var box = document.getElementById(theId);
		var boxes = box.getElementsByTagName('div');
		for (var i=0; i<boxes.length; i++){
			var thebox = boxes[i];
			if (thebox.getAttribute('title')) {
				
			thebox.onmouseover = function () { this.className = 'projectBoxHover'; }
			thebox.onmouseout = function () { this.className = 'projectBox'; }
			
			}
		}	
		
}

displayYear = function() {
var currentTime = new Date();
document.write(currentTime.getFullYear());
}


/***** older functions below *****/
/*
function checkForm(iform) {

 if (iform.message.value == "") {
  alert ("\nPlease enter your question or comment.\n\n"+"Thank you.");
  iform.message.focus ();        
  return false;
 }

 if ((iform.from.value == "") && (!isValidEmail(iform.from.value))) {
  alert ("\nPlease enter a valid email address.\n\n"+"Thank you.");
  iform.from.focus ();        
  return false;
 }


 return true;
}		
*/

function ClearField(cf) {
     if (cf.value == cf.defaultValue) {
         cf.value = "";
     }
}

function clearField(xyz) {
  ClearField (xyz);
}


/*
function isValidEmail(str) {
  alert(str);
  // check that regular expressions are supported
  var bSupported = 0;
  if (window.RegExp) {
    var tempStr = "a";
    var tempReg = new RegExp(tempStr);
    if (tempReg.test(tempStr)) {
      bSupported = 1;
    }
  }
  if (!bSupported) {
    return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
  }

  var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
  var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");

  return (!r1.test(str) && r2.test(str));
}
*/
