// JS TO LOAD SITE-WIDE

document.observe('dom:loaded', function(){  

  // Global nav
  new ProtoFish('global-menu2', '400', 'hover', false);  
  
  // Top Nav Search auto-fill
  $('downloadssearch').observe('focus',function(){
    if($(this).getValue()=='Search FileMaker.com'){ $(this).setAttribute('value',''); }
  }).observe('blur',function(){
    $(this).setAttribute('value','Search FileMaker.com');
  })
  
  // Country select
  $('country-link').observe('mouseover',function(){
    $('global-country-select').removeClassName('up').addClassName('selected');
    $('countries-popup').removeClassName('up').addClassName('selected');  
  })
  // Mouseout using protohover.js
  $('global-country-select').hover(function(event){
    // console.log('mouse enter');
  },function(event){
    $('global-country-select').removeClassName('selected').addClassName('up');
    $('countries-popup').removeClassName('selected').addClassName('up');
  })
})  

N   = (document.layers) ? true:false;                 // netscape 4
I   = (document.all) ? true:false;                    // ie4+
DOM = ((document.getElementById)&&(!I))?true:false;   // ns6 etc.
MAC = (navigator.platform=="MacPPC")?true:false;   // Mac
SAFARI = (navigator.userAgent.indexOf('Safari')>-1)?true:false;   // Mac
Ixp   = (document.all)&&(navigator.userAgent.indexOf('Windows NT 5.1')>-1) ? true:false;                    // windows xp 
IE7   = (document.all)&&(navigator.userAgent.indexOf('MSIE 7')>-1) ? true:false;                    // IE7

// included from old javascript.js to make /support/downloads/index.html work
function init() {
}

// rewrite this someday
function MM_jumpMenu(targ,selObj,restore){ //v3.0 revised by FMI
	if(selObj.options[selObj.selectedIndex].text.indexOf('Choose')>-1){return}
  else{eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;}
}
function MM_preloadImages() { //v3.0
  var d = document;
  if (d.images) {
    if (!d.MM_p)
      d.MM_p = new Array();

	var a = MM_preloadImages.arguments;
	if (a.length == 1 && typeof a[0] === 'object' && a[0] instanceof Array) {
		a = a[0];
	}

    var i, j = d.MM_p.length;
    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];
      }
    }
  }
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
 if (typeof console == "undefined" || typeof console.log == "undefined") var console = { log: function() {} };
