﻿//Sys.Browser.WebKit = {}; //Safari 3 is considered WebKit
//if (navigator.userAgent.indexOf('WebKit/') > -1) {
//    Sys.Browser.agent = Sys.Browser.WebKit;
//    Sys.Browser.version = parseFloat(navigator.userAgent.match(/WebKit\/(\d+(\.\d+)?)/)[1]);
//    Sys.Browser.name = 'WebKit';
//}
//** Consider Removing these. I do not think they are used anymore
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];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//****

function MM_swapImageByRef(image, newSource) { //v3.0
    var j = 0, x; 
    document.MM_sr = new Array;
    if ((x = image) != null) {
        document.MM_sr[j++] = x; if (!x.oSrc) x.oSrc = x.src; x.src = newSource; 
    }
}

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);

function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}

function ContestLayerShowHide() { //v3.0
    var i, p, v, obj, args = ContestLayerShowHide.arguments;
    for (i = 0; i < (args.length - 2); i += 3) {
        var layer = $get(args[i]);
        if (layer) {
            var sender = $get(args[i + 1]);
            if (sender) {
                var bounds = Sys.UI.DomElement.getBounds(sender);
                Sys.UI.DomElement.setLocation(layer, bounds.x - 450, bounds.y -100);
            }
            
            v = args[i + 2];

            Sys.UI.DomElement.setVisible(layer, v == 'show');
        }
    }
}

function MM_showHideLayersRelative() { //v3.0
  var i,p,v,obj,args=MM_showHideLayersRelative.arguments;
  for (i = 0; i < (args.length - 3); i += 4) {
      var layer = $get(args[i]);
      if (layer) {
          var sender = $get(args[i + 1]);
          if (sender) {
              var bounds = Sys.UI.DomElement.getBounds(sender);
              Sys.UI.DomElement.setLocation(layer, bounds.x + 60, bounds.y + bounds.height -190);
          }

          v = args[i + 2];

          Sys.UI.DomElement.setVisible(layer, v == 'show');
      }
  }
}

function MM_showHideLayersRelativeByRef(layer, sender, v) { //v3.0
    if (layer) {
        if (sender) {
            var bounds = Sys.UI.DomElement.getBounds(sender);
            Sys.UI.DomElement.setLocation(layer, bounds.x +60, bounds.y + bounds.height -190);
        }

        Sys.UI.DomElement.setVisible(layer, v == 'show');
    }
}

function OpenNewWindow(url, winwidth, winheight) {
            NewWindow = window.open(url, 'Category', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=' + winwidth + ',height=' + winheight + ',left=' + (screen.width - winwidth) / 2 + ',top=' + (screen.height - winheight) / 2 + ',');
            NewWindow.focus();
        }


  function OpenNewTargetWindow(url, target, winwidth, winheight) 
  {
            NewWindow = window.open(url, target, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=' + winwidth + ',height=' + winheight + ',left=' + (screen.width - winwidth) / 2 + ',top=' + (screen.height - winheight) / 2 + ',');
            NewWindow.focus();
        }

function OpenChatWindow(url,winwidth,winheight)
{
NewWindow=window.open(url,'Chat','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width='+winwidth+',height='+winheight+',left='+(screen.width-winwidth)/2+',top='+(screen.height-winheight)/2+',');
  NewWindow.focus();
}

function OpenIMWindow(url,fromUser,toUser,winwidth,winheight)
{
  NewWindow=window.open(url,'IM_'+fromUser+'_'+toUser,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width='+winwidth+',height='+winheight+',left='+(screen.width-winwidth)/2+',top='+(screen.height-winheight)/2+',');
  NewWindow.focus();
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


function textCounter(field, countfield, maxlimit) {
    if (field.value.length > maxlimit) // if too long...trim it!
        field.value = field.value.substring(0, maxlimit);
    // otherwise, update 'characters left' counter
    else
        countfield.value = maxlimit - field.value.length;
}

var removedLayers = false;
if (document.layers) {
    window.captureEvents(Event.MOUSEMOVE);
}
var Xpos = 1;
var Ypos = 1;
if (document.all) {
    function MoveHandler() {
		Xpos=0;
		Ypos=0;
		if(document.body && document.body.scrollLeft)
        	Xpos = document.body.scrollLeft + event.x;
		if(document.body && document.body.scrollTop)	
        	Ypos = document.body.scrollTop + event.y;
        if (!(Ypos < 250)) removeLayers();
        //	if (!(Xpos > 221 && Ypos>43 && Xpos < 755 && Ypos < 137)) removeLayers();
    }
    document.onmousemove = MoveHandler;
}
else if (document.layers) {
    function xMoveHandler(evnt) {
        Xpos = evnt.pageX;
        Ypos = evnt.pageY;
        if (!(Ypos < 250)) removeLayers();
    }
    window.onMouseMove = xMoveHandler;
}
function removeLayers() {
    //  clearTimeout(allTimer);
    //if (!removedLayers) {
    MM_showHideLayers('menuLayerMessages', '', 'hide', 'menuLayerUsers', '', 'hide', 'menuHookups', '', 'hide', 'menuLayerEvite', '', 'hide', 'menuLayerTravel', '', 'hide', 'menuLayerNew', '', 'hide', 'menuLayerSearch', '', 'hide', 'menuLayerEvents', '', 'hide', 'menuLayerProfile', '', 'hide', 'menuLayerBlogs', '', 'hide', 'menuLayerBlogsNiN', '', 'hide', 'menuLayerStories', '', 'hide', 'menuLayerClubs', '', 'hide', 'menuLayerLinks', '', 'hide');
    //}
    removedLayers = true;
}
function MM_showHideMenuLayers() { //v3.0
    var i, p, v, obj, args = MM_showHideMenuLayers.arguments;
    for (i = 0; i < (args.length - 2); i += 3) if ((obj = MM_findObj(args[i])) != null) {
        v = args[i + 2];
        if (obj.style) { obj = obj.style; v = (v == 'show') ? 'visible' : (v = 'hide') ? 'hidden' : v; }
        obj.visibility = v;
    }
    removedLayers = false;

}



    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;
    }

  var menu = function () {
              var t = 40, z = 80, s = 1, a;
              function dd(n) { this.n = n; this.h = []; this.c = [] }
              dd.prototype.init = function (p, c) {
                  a = c; var w = document.getElementById(p);
                  if (!w) return;
                  var s = w.getElementsByTagName('ul'), l = s.length, i = 0;
                  for (i; i < l; i++) {
                      var h = s[i].parentNode; this.h[i] = h; this.c[i] = s[i];
                      h.onmouseover = new Function(this.n + '.st(' + i + ',true)');
                      h.onmouseout = new Function(this.n + '.st(' + i + ')');
                  }
              }
              dd.prototype.st = function (x, f) {
                  var c = this.c[x], h = this.h[x], p = h.getElementsByTagName('a')[0];
                  clearInterval(c.t); c.style.overflow = 'hidden';
                  if (f) {
                      p.className += ' ' + a;
                      if (!c.mh) { c.style.display = 'block'; c.style.height = ''; c.mh = c.offsetHeight; c.style.height = 0 }
                      if (c.mh == c.offsetHeight) { c.style.overflow = 'visible' }
                      else { c.style.zIndex = z; z++; c.t = setInterval(function () { sl(c, 1) }, t) }
                  } else { p.className = p.className.replace(a, ''); c.t = setInterval(function () { sl(c, -1) }, t) }
              }
              function sl(c, f) {
                  var h = c.offsetHeight;
                  if ((h <= 0 && f != 1) || (h >= c.mh && f == 1)) {
                      if (f == 1) { c.style.filter = ''; c.style.opacity = 1; c.style.overflow = 'visible' }
                      clearInterval(c.t); return
                  }
                  var d = (f == 1) ? Math.ceil((c.mh - h) / s) : Math.ceil(h / s), o = h / c.mh;
                  c.style.opacity = o; c.style.filter = 'alpha(opacity=' + (o * 100) + ')';
                  c.style.height = h + (d * f) + 'px'
              }
              return { dd: dd }
          } ();

       
          function OpenNewWindowCountry(url, winwidth, winheight) {
              NewWindow = window.open(url, 'Country', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=' + winwidth + ',height=' + winheight + ',left=' + (screen.width - winwidth) / 2 + ',top=' + (screen.height - winheight) / 2 + ',');

              NewWindow.focus();
          }

          function insertImage(imgSRC) {
              document.getElementById('bcImageURL').value = imgSRC;
          }

