function conf()
{
  if( confirm( 'Are you sure?' ) ) return true
  else return false;
}

function openAWindow2( pageToLoad, winName, width, height, center){

xposition=0; yposition=0;
if ((parseInt(navigator.appVersion) >= 4 ) &&(center)){
 xposition = (screen.width - width) / 8;
 yposition = (screen.height - height) / 3;
}

args = "width=" + width + ","
+ "height=" + height + ","
+ "location=0,"
+ "menubar=0,"
+ "resizable=0,"
+ "scrollbars=1,"
+ "status=0,"
+ "titlebar=0,"
+ "toolbar=0,"
+ "hotkeys=0,"
+ "screenx=" + xposition + "," //NN Only
+ "screeny=" + yposition + "," //NN Only
+ "left=" + xposition + "," //IE Only
+ "top=" + yposition; //IE Only

window.open( pageToLoad, winName, args );

}

function openAWindow( pageToLoad, winName, width, height, center){

xposition=0; yposition=0;
if ((parseInt(navigator.appVersion) >= 4 ) &&(center)){
 xposition = (screen.width - width) / 8;
 yposition = (screen.height - height) / 3;
}

args = "width=" + width + ","
+ "height=" + height + ","
+ "location=0,"
+ "menubar=0,"
+ "resizable=0,"
+ "scrollbars=0,"
+ "status=0,"
+ "titlebar=0,"
+ "toolbar=0,"
+ "hotkeys=0,"
+ "screenx=" + xposition + "," //NN Only
+ "screeny=" + yposition + "," //NN Only
+ "left=" + xposition + "," //IE Only
+ "top=" + yposition; //IE Only

window.open( pageToLoad, winName, args );

}

function void_() {
}

function xget(id) {
	if(document.getElementById) return document.getElementById(id);
	if(document.all) return document.all[id];
	return null;
}

if (navigator.userAgent.toLowerCase().indexOf('gecko') != -1) {
     window.attachEvent = function(eventName, delegate) {
         this.addEventListener(eventName.substring(2), delegate, false);
     }
 
     window.detachEvent = function(eventName, delegate) {
         this.removeEventListener(eventName.substring(2), delegate, false);
     }
 
     window.document.attachEvent = function(eventName, delegate) {
         this.addEventListener(eventName.substring(2), delegate, false);
     }
     
     window.document.detachEvent = function(eventName, delegate) {
         this.removeEventListener(eventName.substring(2), delegate, false);
     }
 
     HTMLElement.prototype.attachEvent = function(eventName, delegate) {
         this.addEventListener(eventName.substring(2), delegate, false);
     }
 
     HTMLElement.prototype.detachEvent = function(eventName, delegate) {
         this.removeEventListener(eventName.substring(2), delegate, false);
     }
 
     HTMLElement.prototype.fireEvent = function(eventName, eventInstance) {
         var events = this.ownerDocument.createEvent("events");
         events.initEvent(eventName.substring(2), false, true);
         this.dispatchEvent(ev);
     }
     
     Event.prototype.__defineGetter__("srcElement", function () {
        var node = this.target;
        while (node.nodeType != 1) node = node.parentNode;
        return node;
     })
 }

function makeHttpRequest(url, callback_function, return_xml) {
  var http_request = false;

  if (window.XMLHttpRequest) { // Mozilla, Safari,...
		http_request = new XMLHttpRequest();
		if (http_request.overrideMimeType && return_xml == 'xml') {
			 http_request.overrideMimeType('text/xml');
		}
  } else if (window.ActiveXObject) { // IE
		try {
			 http_request = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			 try {
				  http_request = new ActiveXObject("Microsoft.XMLHTTP");
			 } catch (e) {}
		}
  }

  if (!http_request) {
		alert('Unfortunately your browser doesn\'t support this feature.');
		return false;
  }

  http_request.onreadystatechange = function() {
		if (http_request.readyState == 4) {
			 if (http_request.status == 200) {
				  if (return_xml == 'xml') {
						eval(callback_function + '(http_request.responseXML)');
				  } else {
						eval(callback_function + '(http_request.responseText)');
				  }
			 } else {
//				  alert('There was a problem with the request. (Code: ' + http_request.status + ')');
			 }
		}
  }
  http_request.open('GET', url, true);
  http_request.send(null);
}

function detect_user_agent(){
	navigator.DOM=!!(document.getElementById?1:0);
	navigator.OPERA=!!(window.opera);
	navigator.OPERA5=!!(navigator.OPERA&&navigator.userAgent.indexOf("pera 5")>0);
	navigator.OPERA6=	!!(navigator.OPERA&&navigator.userAgent.indexOf("pera 6")>0);
	navigator.IE8=		!!(navigator.appVersion.indexOf("IE 8")>0&&navigator.DOM&&!navigator.OPERA?1:0);
	navigator.IE7=		!!(navigator.appVersion.indexOf("IE 7")>0&&navigator.DOM&&!navigator.OPERA?1:0);
	navigator.IE6=		!!(navigator.appVersion.indexOf("IE 6")>0&&!navigator.IE7&&!navigator.IE8&&navigator.DOM&&!navigator.OPERA?1:0);
	navigator.IE5=		!!(navigator.appVersion.indexOf("IE 5")>0&&navigator.DOM&&!navigator.OPERA?1:0);
	navigator.IE4=		!!(document.all&&!navigator.DOM?1:0);
	navigator.IE=		!!(navigator.IE4||navigator.IE5||navigator.IE6);
	navigator.MAC=		!!(navigator.userAgent.indexOf("Mac")>0);
	navigator.NS6=		!!(navigator.DOM && parseInt(navigator.appVersion)>4?1:0);
	navigator.NS4=		!!(document.layers && !navigator.DOM?1:0);
	navigator.DOMCORE1=	!!(typeof(document.getElementsByTagName)!='undefined' && typeof(document.createElement)!='undefined');
	navigator.DOMCORE2=	!!(navigator.DOMCORE1 && typeof(document.getElementById) != 'undefined' && typeof(document.createElementNS) != 'undefined');
	navigator.DOMHTML=	!!(navigator.DOMCORE1 && typeof(document.getElementById) != 'undefined');
	navigator.DOMCSS1=	!!(navigator.NS6||navigator.IE)	;
	if(navigator.DOMCORE1&&!navigator.OPERA)
	{	var check_element=document.createElement('p');
		navigator.DOMCSS2=!!(typeof(check_element)=='object');
	} else	navigator.DOMCSS2=!!(false)	
	navigator.DETECTED=	(	navigator.OPERA||navigator.OPERA6||navigator.OPERA5||navigator.IE||navigator.IE6||navigator.IE5||navigator.IE4||navigator.MAC||navigator.NS6||navigator.NS4||navigator.DOM||navigator.DOMHTML||navigator.DOMCORE1||navigator.DOMCORE2||navigator.DOMCSS1||navigator.DOMCSS2	);
	}

function getOffsetx (element) {
   var x=0, y=0;
   if (element.getBoundingClientRect) {
     var offset = element.getBoundingClientRect();
     x = offset.left;
     y = offset.top;
   } else {
     while (element !== null && element !== parent)  {
       x += element.offsetLeft || 0;
       y += element.offsetTop || 0;
       element = element.offsetParent;
     }
   }
   return x
 }
 function getOffsety (element) {
   var x=0, y=0;
   if (element.getBoundingClientRect) {
     var offset = element.getBoundingClientRect();
     x = offset.left;
     y = offset.top;
   } else {
     while (element !== null && element !== parent)  {
       x += element.offsetLeft || 0;
       y += element.offsetTop || 0;
       element = element.offsetParent;
     }
   }
   return y
 }
 
function isNumber(x) {
   return ! isNaN(x * 1);
}

function showimg(obj) {
	if (xget('popupclose')) {
		xget('popupimg').src=obj.href;		
		xget('popuptableBG').style.height=getDocumentHeight()+'px';
		xget('popuptableBG').onclick=function(){closeimg();};	
		
		xget('popupdesc').innerHTML=obj.title;
						
		xget('popuptableBG').style.display='block';				
		xget('popupclose').style.display='block';			
		
		xget('popupclose').style.top=(getBodyScrollTop()+getViewportHeight()/2-150)+"px";
		xget('popupclose').style.left=(getViewportWidth()/2-150)+"px";					
	}
	return false;	
}
function closeimg() {
	if (xget('popupclose')) {
		xget('popuptableBG').style.display='none';
		xget('popupclose').style.display='none';	
		xget('popupimg').src="/realgraphtec/images/e.gif";		
	}
	return false;	
}


var ua = navigator.userAgent.toLowerCase(); 
var isOpera = (ua.indexOf('opera')  > -1); 
var isIE = (!isOpera && ua.indexOf('msie') > -1); 
  
function getDocumentHeight() { 
return Math.max(document.compatMode != 'CSS1Compat' ? document.body.scrollHeight : document.documentElement.scrollHeight, getViewportHeight()); 
} 
function getDocumentWidth() { 
return Math.max(document.compatMode != 'CSS1Compat' ? document.body.scrollWidth : document.documentElement.scrollWidth, getViewportWidth()); 
} 
function getViewportHeight() { 
	return ((document.compatMode || isIE) && !isOpera) ? (document.compatMode == 'CSS1Compat') ? document.documentElement.clientHeight : document.body.clientHeight : (document.parentWindow || document.defaultView).innerHeight; 
}
function getViewportWidth() { 
	return ((document.compatMode || isIE) && !isOpera) ? (document.compatMode == 'CSS1Compat') ? document.documentElement.clientWidth : document.body.clientWidth : (document.parentWindow || document.defaultView).innerWidth; 
}

function getBodyScrollTop()
{
  return self.pageYOffset || (document.documentElement && document.documentElement.scrollTop) || (document.body && document.body.scrollTop);
}
function getBodyScrollLeft()
{
  return self.pageXOffset || (document.documentElement && document.documentElement.scrollLeft) || (document.body && document.body.scrollLeft);
}
