// reload for Netscape
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

// Preload images
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

//MM_preloadImages('/images/navnew/nav_welcome_roll.gif','/images/navnew/nav_classinfo_roll.gif','/images/navnew/nav_teachers_roll.gif','/images/navnew/nav_teachers_roll.gif','/images/navnew/nav_style_roll.gif','/images/navnew/nav_events_roll.gif','/images/navnew/nav_bodywork_roll.gif');

// replace any strange characters
String.prototype.normalize = function()
{
//  return this.replace( /^\s+/g , '' ).replace( /\s+$/g , '' ).replace( /\s+/g , " " ) ;

  return this.replace( /%20+/g , ' ' ).replace( /_/g , "" ).replace( /-/g , "" ).replace( /,/g , "" ).replace( /\s+/g , "" ) ;
  
}



// determine server
if (top.location != self.location) {
  top.location = self.location;
}

var url = self.location.href;
//url = url.toLowerCase();

url = self.location.href;

var DOM   = '';
var local = 'localhost/wholepetvet/'; //'website/';
var live  = 'wholepetvet.com';
((url.indexOf(local) > -1)? DOM = local: DOM =  live);

// determine path, section of site and subdirectory variable
var endOfDOM = url.lastIndexOf(DOM);
var endOfURL = url.substring((endOfDOM + DOM.length), url.length);

// determine filename
var HTM = '.php';
var endOfHTM = url.lastIndexOf(HTM);
var beg_file = url.lastIndexOf('/');
var filename = url.substring(beg_file + 1, endOfHTM).normalize();

//alert('subdir =' + subdir)
//alert('section =' + section)
//alert('filename =' + filename)



// determine path, section of site and subdirectory variable
var endoDOM = url.lastIndexOf(DOM);
var endoURL = url.substring((endoDOM + DOM.length), url.length);


// determine path, section of site and subdirectory variable
var filen = '';
var dir = '';
//var section = '';
for (i=0; i<endoURL.length; i++) {
  if (i < endoURL.lastIndexOf('/') )      { dir  += endoURL.charAt(i); }
  if (i > endoURL.lastIndexOf('/') )      { filen += endoURL.charAt(i); } 
  //if (endOfURL.charAt(i)=='/')         { path += '../'; }
}

//Search site
function check_search(){
if(ssearch.term.value.length < 1 || ssearch.term.value =='Search Site' ){
	alert("Please enter some text to search for");
	ssearch.term.focus();
	ssearch.term.value='';
	return false;
	}

ssearch.submit();
}

// Browser Sniffer
var sAgent = navigator.userAgent;
var mac = sAgent.indexOf("Mac") > -1;
var bName = navigator.appName;
var bVer = parseInt(navigator.appVersion);
var ns3 = (bName == "Netscape" && bVer == 3);
var ie3 = (bName == "Microsoft Internet Explorer" && bVer == 3);
var ns4 = (document.layers) ? true : false;
var ie4 = (document.all && !document.getElementById) ? true : false;
var ie5 = (document.all && document.getElementById) ? true : false;
var ns6 = (document.getElementById && !document.all) ? true : false;