// Javascript Anchors
// Usefull for dynamic pages where normal anchors do not work properly
// Tyler Boespflug - 6/2007  ty AT tyjobo DOT com
// 
// Example: <a href="javascript:anchor('#Name');">LINK</a>
//     #Name is the name of the anchor you wish to call. Be sure to include the hash mark

function anchor(anchorName)
{
  //Get current URL
  var urlComplete = location.href;
  //Check for any existing anchor calls in url by checking for the hash mark
  var hashIndex =(urlComplete.indexOf("#"));

  // if hash mark does not exist, take current url and add anchor name
  // else strip the anchor reference from the url and add the new anchor call to the url
  if (hashIndex == -1) {
	window.location.href = urlComplete + anchorName;
  } //end if
  else {
	var urlStrip = (urlComplete.substr(0,hashIndex))
	window.location.href = urlStrip + anchorName;
  } //end else
}//end anchor()