//**********************************************//
// TITLE:       General Scripts                 //
// DESCRIPTION: Design Wizard                   //
// DATE:        02/14/2001                      //
// AUTHOR:      David Shvartsman                //
//		    deWeb.NET                   //
//**********************************************//
// Simple browser detection (seperate into:  NS4.x, IE4.x, DOCOM[5+] browsers)

var ns = (navigator.appName == 'Netscape');
var gen3 = (parseInt(navigator.appVersion) >= 3 && parseInt(navigator.appVersion) < 4);
var ns4 = (ns && parseInt(navigator.appVersion) >= 4 && parseInt(navigator.appVersion) < 5);
var ie = (navigator.appName == 'Microsoft Internet Explorer');
var ie3 = (ie && navigator.appVersion < 4);
var ie4 = (ie && parseInt(navigator.appVersion) >= 4);
var docom = (document.getElementById);
var win2k = (navigator.userAgent.indexOf('Windows NT 5.0') != -1);
var ie4mac = (ie && !docom && navigator.userAgent.indexOf('Macintosh') != -1);
var dhtmlBrowser = (ie4 || ns4 || docom);
var win31 = (navigator.appVersion.indexOf("Win16") != -1)
var SHOW, HIDE;

if (ie4 || docom) {SHOW = "visible";HIDE = "hidden";}
else { if (ns4) {SHOW = "show"; HIDE = "hide";}	}

if (ns4) {var doc = 'document.', vis = '.visibility',top='.top',left='.left';end='';}
if (ie4) {var doc = 'document.all.', vis = '.style.visibility',top='.style.top',left='.style.left';end='';}
else { 
  if (docom) {var doc = 'document.getElementById(\'', vis='\').style.visibility',top='\').style.top',left='\').style.left';end='\')';}
}

function show(object)	{
    if (dhtmlBrowser) {eval(doc + object + vis + ' = SHOW');}
    return true;
}

function hide(object)	{
    if (dhtmlBrowser) {eval(doc + object + vis + ' = HIDE');}
    return true;
}

function launchW(theURL,xWidth,yHeight) {
  self.name = "wMain";
  var strCommand =  'remote = open("'+theURL+'", "remote", "width='+xWidth+',height='+yHeight+',left=20,top=20")'
  eval(strCommand);
}
function statusW(msg)	{
	window.status = ' '+msg+' ';
	return true;
}
function getEltPageLeft(elt) {
  var x;

  if (ns4)
    return elt.pageX;
  if (ie4) {
    x = 0;
    while (elt.offsetParent != null) {
      x += elt.offsetLeft;
      elt = elt.offsetParent;
    }
    x += elt.offsetLeft;
    return x;
  }
  if (docom) {
    x = 0;
    while (elt.offsetParent != null) {
      x += elt.offsetLeft;
      elt = elt.offsetParent;
    }
    x += elt.offsetLeft;
    return x;
  }
  return -1;
}

/* xbrowser pageY equivalent */
function getEltPageTop(elt) {
  var y;

  if (ns4)
    return elt.pageY;
  if (ie4) {
    y = 0;
    while (elt.offsetParent != null) {
      y += elt.offsetTop;
      elt = elt.offsetParent;
    }
    y += elt.offsetTop;
    return y;
  }
  if (docom) {
    y = 0;
    while (elt.offsetParent != null) {
      y += elt.offsetTop;
      elt = elt.offsetParent;
    }
    y += elt.offsetTop;
    return y;
  }
  return -1;
}
//Refresh function for repositioning DHTML on screen size change
if( ns4 ){origWidth=innerWidth;origHeight=innerHeight;onresize=function(){if(innerWidth!=origWidth||innerHeight!=origHeight)location.reload()}}
if( ie4 || docom ) {onresize=function(){location.reload()}}

function WindowClick(e)	{

if ( ns4 &&(e.which == 3||e.which == 2))	{
	alert(strClickMessage);
	return false;
}
else	if (ie4 && (event.button == 2||event.button == 3))	{
		alert(strClickMessage);
		return false;
	}
else	if (docom && !ie)	{
		if (e.button==2||e.button==3) {
			alert(strClickMessage);
			return false;
		}		
	}
return true;
}
if (hideProperys)	{
//Adding event handeling
if (ns4)	{
	window.captureEvents(Event.MOUSEDOWN);
	window.onmousedown=WindowClick;
	document.onmousedown=WindowClick;
	}
else if (ie4)	{
	window.onmousedown=WindowClick;
	document.onmousedown=WindowClick;
	}
else if (docom && !ie)	{
	window.addEventListener("mousedown",WindowClick,true)
	}
}

