 window.name = 'main';

 function popWhatIsThis() {
	newwindow2=window.open('','name','height=200,width=300');
	var tmp = newwindow2.document;
	tmp.write('<html><head><title>What is this</title>');
	tmp.write('</head><body>');
	tmp.write('<p>Use a keyword to give your listing a URL that is easy to remember. Using a keyword, you can always refer people to your ad in a very short and descriptive manner. Examples: www.equinehits.com/mypony, www.equinehits.com/mistered, etc. Use only numbers and letters, without any spaces.</p>');
	tmp.write('</body></html>');
	tmp.close();
}



 // nav functions // begin
 function nav() {
  var n;
  if (n = document.getElementById('nav')) {
   var e = n.getElementsByTagName('td');
   for (var i = 0; i < e.length; i++) {
    if (e[i].className=='b') {
     e[i].onmouseover = function () { this.style.background = '#6699FF'; }
     e[i].onmouseout = function () { this.style.background = '#336699'; }
     e[i].onclick = function () { window.location = this.lastChild.getAttribute('href'); }
    }
   }
  }
 }
 window.onload = nav;
 // nav functions / end

  // Open new pop-up window with url, width and height
  function openWindow(url,width,height) {
   var left = (window.screen.width - width) / 2;
   var top = (window.screen.height - height) / 2;
   var parameters = 'left=' + left + ',top=' + top + ',width=' + width + ',height=' + height + ',toolbar=0,menubar=0,location=0,status=0,scrollbars=1,titlebar=0,resizable=0';
   window.open(url,'popup',parameters);
  }

  // Open pop-up print window with url, width and height (different from a regular pop-up because has a toolabr)
  function openPrint(url,width,height) {
   var left = (window.screen.width - width) / 2;
   var top = (window.screen.height - height) / 2;
   var parameters = 'left=' + left + ',top=' + top + ',width=' + width + ',height=' + height + ',toolbar=1,menubar=0,location=0,status=0,scrollbars=1,resizable=0';
   window.open(url,'login',parameters);
  }

  // Make us your homepage
  function make_homepage(id) {
   if (navigator.appName=="Microsoft Internet Explorer") {
    id.style.behavior='url(#default#homepage)';
    id.setHomePage(location.href);
   }
   else
    window.alert("This feature is not supported by your browser");
  }

  // Add to favorites
  function add_tofavs() {
   if (navigator.appName=="Microsoft Internet Explorer") {
    window.external.AddFavorite(location.href,'Equine Hits - Horse Classifieds');
   }
   else
    window.alert("This feature isn't supported by your browser");
  }

  // Form field highlights
  function FieldFocus(name,color) {
   // If a stupid browser, leave it alone
   if (document.layers) return;
   id = document.getElementById(name);   
   //eval("document.forms['" + form + "']." + name + ".style.background='" + color + "'");
//alert(id);
   id.style.background=color;
  }

  // Email validation
  function validate_email(src) {
   var emailReg = "^[\\w-_\.]*[\\w-_\.]\@[\\w]\.+[\\w]+[\\w]$";
   var regex = new RegExp(emailReg);
   return regex.test(src);
  }

  // Inquiry form submission
  function submit_inquiry() {
   var inquiry = new Object(document.forms['inquiry']);
   var message = 1;
   if (inquiry.sender_inquiry.value=="") message = "Your inquiry is required";
   if (validate_email(inquiry.sender_email.value)==false) message = "Your valid email address is required";
   if (inquiry.sender_name.value=="") message = "Your name is required";
   if (message==1) {
    inquiry.submitbutton.disabled = 'true'; 
    inquiry.submit(); 
   }
   else 
    window.alert(message);
  }

  // Contact form submission
  function submit_contact() {
   var contact = new Object(document.forms['contact']);
   var message = 1;
   if (contact.comments.value=="") message = "Comments are required";
   if (validate_email(contact.email.value)==false) message = "Valid email address is required";
   if (contact.name.value=="") message = "Name is required";
   if (contact.subject.value=="") message = "Question/Subject is required";
   if (message==1) {
    contact.submitbutton.disabled = "true";
    contact.submit();
   }
   else 
    window.alert(message);
  }



function ga(o,e){if (document.getElementById){a=o.id.substring(1); p = "";r = "";g = e.target;if (g) { t = g.id;f = g.parentNode;if (f) {p = f.id;h = f.parentNode;if (h) r = h.id;}} else{h = e.srcElement;f = h.parentNode;if (f) p = f.id;t = h.id;}if (t==a || p==a || r==a) return true;location.href=document.getElementById(a).href}}
function ss(w){window.status=w;return true;}
function cs(){window.status='';}


