/*------------------------------------------------------------------------------*/
/*		DHTML X-Browser Utilities.
*/
/*------------------------------------------------------------------------------*/

thisBrowser				= getBrowserType();
var hiddenSelects		= new Array();
var netscapeVersion;
/*------------------------------------------------------------------------------*/




//This particular section which is added to make the calender popup appear
//in proper positions for netscape6.0 and versions above it

 // convert all characters to lowercase to simplify testing
    var agt=navigator.userAgent.toLowerCase();
    var appVer = navigator.appVersion.toLowerCase();

    // *** BROWSER VERSION ***

   
	//alert(is_major);
    // Note: On IE, start of appVersion return 3 or 4
    // which supposedly is the version of Netscape it is compatible with.
    // So we look for the real version further on in the string

    // Netscape6 is mozilla/5 + Netscape6/6.0!!!
    // Mozilla/5.0 (Windows; U; Win98; en-US; m18) Gecko/20001108 Netscape6/6.0
    var nav6Pos = agt.indexOf('netscape6');
    if (nav6Pos !=-1) {
       is_minor = parseFloat(agt.substring(nav6Pos+10))
       is_major = parseInt(is_minor)
    }

    var is_getElementById   = (document.getElementById) ? "true" : "false"; // 001121-abk
    var is_getElementsByTagName = (document.getElementsByTagName) ? "true" : "false"; // 001127-abk
    var is_documentElement = (document.documentElement) ? "true" : "false"; // 001121-abk

    var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
                && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
                && (agt.indexOf('webtv')==-1));
    var is_nav2 = (is_nav && (is_major == 2));
    var is_nav3 = (is_nav && (is_major == 3));
    var is_nav4 = (is_nav && (is_major == 4));
    var is_nav4up = (is_nav && is_minor >= 4);  // changed to is_minor for
                                                // consistency - dmr, 011001
    var is_navonly      = (is_nav && ((agt.indexOf(";nav") != -1) ||
                          (agt.indexOf("; nav") != -1)) );

/*	var is_nav6 = (is_nav && (agt.indexOf('netscape6') != -1)); // new 001120 - abk
	var is_nav6up = (is_nav && is_getElementById);              // new 001121 - abk
*/
	var is_nav6   = (is_nav && is_major==6);    // new 010118 mhp
	var is_nav6up = (is_nav && is_minor >= 6) // new 010118 mhp

    var is_nav5   = (is_nav && is_major == 5 && !is_nav6); // checked for ns6
    var is_nav5up = (is_nav && is_minor >= 5);







//--> end hide JavaScript






function getBrowserType() {
	var browserVersion	= parseInt(navigator.appVersion);
	var browserFamily	= navigator.appName;
	var browserKey;
	
	
	 var agt=navigator.userAgent.toLowerCase();
    	 var appVer = navigator.appVersion.toLowerCase();
	
	 var is_minor = parseFloat(appVer);
   	 var is_major = parseInt(is_minor);
   	 
   		
	
	
	
	

	if (browserFamily == "Netscape") {			
   		
		browserKey			= "ns";
		
	} else {
		
		browserKey			= "ie";
		
	}
	
	return browserKey;
}

/*------------------------------------------------------------------------------*/
function getObject() {
//	Function which returns an object when passed the
//	name (for IE) of ID of the object, as a string.
//	Also can accept the specific window object to 
//	use.  Thus we can find objects in frames or 
//	spawned windows.
	var obj;				//	Object to return
	var objRef;				//	String name of the object to find
	var winRef;				//	Window object which the object should be found
	var args;				//	Array of arguments passed to this function
	var doc;				//	Final document object
	
	args	= getObject.arguments;
	objRef	= args[0];
	winRef	= args[1];
	
//	If an actual object was already passed here, just pass it back
//	otherwise, find the real object.	
	if (typeof objRef == "object") {
		obj	= objRef;
		
	} else {
		//	Assume that unless we get an actual window object
		//	passed, we'll use the current window.
		if (typeof winRef == "object") {
			doc	= winRef.document;
		} else {
			doc	= document;
		}
		
		if (document.all) {
		//	Internet Explorer 5.5 and below
			obj	= eval("doc.all." + objRef);
			
		} else if (document.layers) {
		//	Netscape Navigator 4.7x and below
			obj	= eval("doc.layers[\"" + objRef + "\"]");
	
		} else if (document.getElementById) {
		//	Internet Explorer and Netscape Navigator 6
			obj	= eval("doc.getElementById('" + objRef + "')");
	
		} else {
		//	Who knows?
			obj = null;
		}
	}
	
	return obj;
}

/*------------------------------------------------------------------------------*/
function setObjectSize() {
//	Function to set the size of any object (height and width)
	var objRef;
	var winRef;
	var args;
	var w;
	var h;

	args	= setObjectSize.arguments;
	objRef	= args[0];
	w		= args[1];
	h		= args[2];
	winRef	= args[3];
	
	var theObj	= getObject(objRef, winRef);
	
	if (document.all) {
		with (theObj) {
			style.width		= w + "px";
			style.height	= h + "px";
		}
	} else if (document.layers) {
		with (theObj) {
			clip.width		= w;
			clip.height		= h;
		}
	} else if (document.getElementById) {
		with (theObj) {
			style.width		= w + "px";
			style.height	= h + "px";
		}
	} else {
	}
}

/*------------------------------------------------------------------------------*/
function getObjectCoords() {
//	Function to locate an object on the page, from the top-left corner
//	of the browser.  Returns a two-element array containing x and y (in pixels)
//	Can find objects either by reference (a passed string) or as a direct object.
	var objRef;
	var winRef;
	var args;
	var theObj;
	var x;
	var y;
	var arrayCoords	= new Array(2);
	var tmpOffsetLeft		= tmpLeft;
	var tmpOffsetTop		= tmpTop;
	
	args	= getObjectCoords.arguments;
	objRef	= args[0];
	winRef	= args[1];

	var theObj	= getObject(objRef, winRef);

	
	if (document.all) {
	//	For Internet Explorer, we must step through all
	//	containing objects to find the location of this one.
		
		var theObjHasParents	= true;
		var theObjParent		= theObj.offsetParent;
		
		while (theObjHasParents) {
			
			tmpOffsetLeft	= tmpOffsetLeft + theObjParent.offsetLeft;
			tmpOffsetTop	= tmpOffsetTop + theObjParent.offsetTop;
		
			//	The BODY or HTML tags are the ultimate parent as far as IE is concerned.
			//	So once we get this far, we stop.
			if ((theObjParent.tagName == "BODY") || (theObjParent.tagName == "HTML")) {
				theObjHasParents	= false;
			} else {
				theObjHasParents	= true;
				theObjParent	= theObjParent.offsetParent;
			}
		}
		
		//	Finally, don't forget to add the offset of the object itself.
		x	= theObj.offsetLeft + tmpOffsetLeft;
		y	= theObj.offsetTop + tmpOffsetTop;
		
		tmpOffsetLeft  = 0;
		tmpOffsetTop   = 0;
		
		
	}
	
	else if (document.layers) {
	//	Netscape makes this very easy.
		x	= theObj.pageX;
		y	= theObj.pageY;
		
		
	}
	
	else if (document.getElementById) {
	
	
	netscapeVersion = navigator.userAgent; 
	netscapeVersion=netscapeVersion.substring(netscapeVersion.length-1);
	
	
	
	
	if(netscapeVersion == 0){
	//for netscape 6.0
		
		tmpOffsetLeft		= tmpLeftNS6;
		tmpOffsetTop		= tmpTopNS6;
	}else if(netscapeVersion > 0){
	//for versions above 6.0
		
		tmpOffsetLeft		= tmpLeftNS6Up;
		tmpOffsetTop		= tmpTopNS6Up;
	}
	
	
	//	Generation 6 browsers
		x	= theObj.offsetLeft + tmpOffsetLeft;
		y	= theObj.offsetTop + tmpOffsetTop;
		//alert(x);	
		//alert(y);	
		
	} else {
	
		x	= 0;
		y	= 0;
	}
	
	
	arrayCoords[0]	= x;
	arrayCoords[1]	= y;
	
	return arrayCoords;
	
}

/*------------------------------------------------------------------------------*/
function setObjectCoords() {
//	Function to set the (x,y) coordinates for the upper left-hand corner of a DIV
	var objRef;
	var winRef;
	var args;
	var oX;
	var oY;

	args	= setObjectCoords.arguments;
	objRef	= args[0];
	oX		= args[1];
	oY		= args[2];
	winRef	= args[3];
	
    oX		= (oX+1); //  ####### setting x co-ordinate the display postion of calendar ####### 
	//oY		= 10;
	
//	alert(oX)
//	alert(oY)
	
	var theObj	= getObject(objRef, winRef);
	
	/*if (document.all && !document.getElementById) {
		with (theObj) {
			style.pixelLeft		= oX;
			style.pixelTop		= oY;
		}
	} else if (document.layers) {
		with (theObj) {
			left				= oX;
			top					= oY;
		}
	} else if (document.getElementById) {
		with (theObj) {
			style.left			= oX;
			style.top			= oY;
		}
	} else {
	}*/
}

/*------------------------------------------------------------------------------*/