﻿// ---- BEGIN BROWSER DETECTION FUNCTIONS ----

var isIE4 = (document.all) ? true : false;
var isNS4 = (document.layers) ? true : false;
var isDOM = (document.getElementById && !document.all) ? true : false;

function GetViewableBrowserDimension(dimension)
{
    var bWidth = 0, bHeight = 0;
    
    if(typeof(window.innerWidth) == 'number')
    {
        //Non-IE
        bWidth = window.innerWidth;
        bHeight = window.innerHeight;
    }
    else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight))
    {
        //IE 6+ in 'standards compliant mode'
        bWidth = document.documentElement.clientWidth;
        bHeight = document.documentElement.clientHeight;
    }
    else if(document.body && (document.body.clientWidth || document.body.clientHeight))
    {
        //IE 4 compatible
        bWidth = document.body.clientWidth;
        bHeight = document.body.clientHeight;
    }
    else
    {
        bWidth = document.offsetWidth;
        bHeight = document.offsetHeight;
    }
    
    if(dimension.toLowerCase() == 'w')
    {
        return bWidth;
    }
    else if(dimension.toLowerCase() == 'h')
    {
        return bHeight;
    }
}

function GetViewableBrowserWidth()
{
    return GetViewableBrowserDimension('w');
}

function GetViewableBrowserHeight()
{
    return GetViewableBrowserDimension('h');
}

function GetScrollPosition(scrollType)
{
    var vXOffset;
    var vYOffset;
 
     if(typeof(window.pageXOffset) == 'number')
    {
        //Non-IE
        vXOffset = window.pageXOffset;
        vYOffset = window.pageYOffset;
    }
    else if(document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop))
    {
        //IE 6+ in 'standards compliant mode'
        vXOffset = document.documentElement.scrollLeft;
        vYOffset = document.documentElement.scrollTop;
    }
    else if(document.body && (document.body.scrollLeft || document.body.scrollTop))
    {
        //IE 4 compatible
        vXOffset = document.body.scrollLeft;
        vYOffset = document.body.scrollTop;
    }
    
    if(scrollType.toLowerCase() == 'x')
    {
        return vXOffset;
    }
    else if(scrollType.toLowerCase() == 'y')
    {
        return vYOffset;
    }
}

function GetScrollPositionWidth()
{
    return GetScrollPosition('x');
}

function GetScrollPositionHeight()
{
    return GetScrollPosition('y');
}

// ---- END BROWSER DETECTION FUNCTIONS ----

// ---- BEGIN POPUP WINDOW FUNCTIONS ----

function OpenPopup(URL, width, height) {
	window.self.name = "main";
	//var now = new Date();
	//var remote = window.open(URL, "popup" + now.getTime(), "width=" + width + ",height=" + height + ",toolbar=0,location=0,directories=0,resizable=1,status=1,menubar=0,scrollbars=0");
	var remote = window.open(URL, "popup", "width=" + width + ",height=" + height + ",toolbar=0,location=0,directories=0,resizable=1,status=1,menubar=0,scrollbars=0");
	//remote.resizeTo(parseInt(width)+2,parseInt(height)+35);
	//remote.focus();	
}

function OpenBarlessScrollingPopup(URL, width, height) {
	window.self.name = "main";
	//var now = new Date();
	//var remote = window.open(URL, "popup" + now.getTime(), "width=" + width + ",height=" + height + ",toolbar=0,location=0,directories=0,resizable=0,status=0,menubar=0,scrollbars=yes");
	var remote = window.open(URL, "popup", "width=" + width + ",height=" + height + ",toolbar=0,location=0,directories=0,resizable=0,status=0,menubar=0,scrollbars=yes");
	remote.resizeTo(parseInt(width)+2,parseInt(height)+35);
	remote.focus();	
}

function OpenBarlessPopup(URL, width, height) {
	window.self.name = "main";
	//var now = new Date();
	//var remote = window.open(URL, "popup" + now.getTime(), "width=" + width + ",height=" + height + ",toolbar=0,location=0,directories=0,resizable=0,status=0,menubar=0,scrollbars=0");
	var remote = window.open(URL, "popup", "width=" + width + ",height=" + height + ",toolbar=0,location=0,directories=0,resizable=0,status=0,menubar=0,scrollbars=0");
	remote.resizeTo(parseInt(width)+2,parseInt(height)+35);
	remote.focus();
}

function OpenScrollingPopup(URL, width, height) {
	window.self.name = "main";
	//var now = new Date();
	//var remote = window.open(URL, "popup" + now.getTime(), "width=" + width + ",height=" + height + ",toolbar=0,location=0,directories=0,resizable=1,status=1,menubar=1,scrollbars=yes");
	var remote = window.open(URL, "popup", "width=" + width + ",height=" + height + ",toolbar=0,location=0,directories=0,resizable=1,status=1,menubar=1,scrollbars=yes");
	remote.resizeTo(parseInt(width)+2,parseInt(height)+35);
	remote.focus();	
}

// ---- END POPUP WINDOW FUNCTIONS ----

// ---- BEGIN DHTML DISPLAY FUNCTIONS ----

function ToggleDivDisplay(div)
{
    if(document.getElementById(div).style.display == 'none')
    {
        document.getElementById(div).style.display = 'block';
    }
    else
    {
        document.getElementById(div).style.display = 'none';
    }
}

function CenterLayerPosition(divLayer)
{
    var elem = document.getElementById(divLayer);
    var scrollX = parseInt(GetViewableBrowserWidth());
    var scrollY = parseInt(GetViewableBrowserHeight());
    
    elem.style.left = ((scrollX/2) - (parseInt(elem.style.width)/2)) + 'px';
    elem.style.top = ((scrollY/2) + (parseInt(elem.style.height)/2) + GetScrollPositionHeight() - 120) + 'px';
    elem = null;
}

// ---- END DHTML DISPLAY FUNCTIONS ----

// ---- BEGIN NAVIGATION ROLLOVER FUNCTIONS ----
	
function hideNavMenu(lay) {
	if (isIE4) {document.all[lay].style.visibility = "hidden";}
	if (isNS4) {document.layers[lay].visibility = "hide";}
	if (isDOM) {document.getElementById([lay]).style.visibility = "hidden";}
}

function showNavMenu(lay) {
	var i;

	if('nav0menu' != lay)
	{
		if((lay.charAt(0) == 'n') && (lay.charAt(lay.length - 1) == 'u')) {
			for(i = 1; i < 9; i++) {
				if(('nav' + i + 'menu') == lay) {
					//alert('nav' + i + 'menu is on');
					if (isIE4) {document.all[lay].style.visibility = "visible";}
					if (isNS4) {document.layers[lay].visibility = "show";}
					if (isDOM) {document.getElementById([lay]).style.visibility = "visible";}
				}
				else {
					//alert('nav' + i + 'menu is off');
					if (isIE4) {document.all['nav' + i + 'menu'].style.visibility = "hidden";}
					if (isNS4) {document.layers['nav' + i + 'menu'].visibility = "hide";}
					if (isDOM) {document.getElementById(['nav' + i + 'menu']).style.visibility = "hidden";}		
				}
			}
		}
		else {
				if (isIE4) {document.all[lay].style.visibility = "visible";}
				if (isNS4) {document.layers[lay].visibility = "show";}
				if (isDOM) {document.getElementById([lay]).style.visibility = "visible";}
		}
	}
	else
	{
		for(i = 1; i < 20; i++) {
			if (isIE4 && document.all['nav' + i + 'menu'] != null) {document.all['nav' + i + 'menu'].style.visibility = "hidden";}
			if (isNS4 && document.layers['nav' + i + 'menu'] != null) {document.layers['nav' + i + 'menu'].visibility = "hide";}
			if (isDOM && document.getElementById(['nav' + i + 'menu']) != null) {document.getElementById(['nav' + i + 'menu']).style.visibility = "hidden";}
		}
	}
}
function showNavLayerMenu(lay,intLayCount) {
	var i;
	var intNavCount;
	intNavCount = parseInt(intLayCount) + 1;

	if((lay.charAt(0) == 'n') && (lay.charAt(lay.length - 1) == 'u')) {
		for(i = 1; i < intNavCount; i++) {
			if(('nav' + i + 'menu') == lay) {
				//alert('nav' + i + 'menu is on');
				if (isIE4) {document.all[lay].style.visibility = "visible";}
				if (isNS4) {document.layers[lay].visibility = "show";}
				if (isDOM) {document.getElementById([lay]).style.visibility = "visible";}
			}
			else {
				//alert('nav' + i + 'menu is off');
				if (isIE4) {document.all['nav' + i + 'menu'].style.visibility = "hidden";}
				if (isNS4) {document.layers['nav' + i + 'menu'].visibility = "hide";}
				if (isDOM) {document.getElementById(['nav' + i + 'menu']).style.visibility = "hidden";}		
			}
		}
	}
	else if((lay.charAt(0) == 's') && (lay.charAt(lay.length - 1) == 'u')) {
		for(i = 1; i < intNavCount; i++) {
			if(('subnav' + i + 'menu') == lay) {
				//alert('subnav' + i + 'menu is on');
				if (isIE4) {document.all[lay].style.visibility = "visible";}
				if (isNS4) {document.layers[lay].visibility = "show";}
				if (isDOM) {document.getElementById([lay]).style.visibility = "visible";}
			}
			else {
				//alert('subnav' + i + 'menu is off');
				if (isIE4) {document.all['subnav' + i + 'menu'].style.visibility = "hidden";}
				if (isNS4) {document.layers['subnav' + i + 'menu'].visibility = "hide";}
				if (isDOM) {document.getElementById(['subnav' + i + 'menu']).style.visibility = "hidden";}		
			}
		}
	}	
	else {
			if (isIE4) {document.all[lay].style.visibility = "visible";}
			if (isNS4) {document.layers[lay].visibility = "show";}
			if (isDOM) {document.getElementById([lay]).style.visibility = "visible";}
	}
}
// ---- END NAVIGATION ROLLOVER FUNCTIONS ----

// ---- BEGIN OFFICE FINDER REDIRECT FUNCTION ----

function RedirectOffice(strAppPath,frmValue)
{
	//alert(frm);

	if(frmValue != "")
	{
		var arrData = frmValue.split("|");
		var strLocale = arrData[2].replace(' ', '+');
		strLocale.replace('&aacute;','%E1');
		strLocale.replace('&oacute;','%F3');
		
		if(arrData[1] == "C")
		{
			//alert(strAppPath + "/about+us/office+finder/officeresults.htm?zone=" + arrData[0] + "&city=" + strLocale);
			window.location.href = strAppPath + "/about+us/office+finder/officeresults.htm?zone=" + arrData[0] + "&city=" + strLocale;
		}
		else if(arrData[1] == "A")
		{
			//alert(strAppPath + "/about+us/office+finder/officeresults.htm?zone=" + arrData[0] + "&area=" + strLocale);
			window.location.href = strAppPath + "/about+us/office+finder/officeresults.htm?zone=" + arrData[0] + "&area=" + strLocale;
		}
	}		
}

// ---- END OFFICE FINDER REDIRECT FUNCTION ----

// ---- BEGIN CLEAR DROP MENU FUNCTION ----

function ClearDropMenu(menu) {
	document.getElementById(menu).selectedIndex = 0;
}

// ---- END CLEAR DROP MENU FUNCTION ----

// ---- BEGIN FORM RELATED FUNCTIONS ----

function SetFocus(frmInput)
{
    document.frmPage[frmInput].focus();
}

// ---- END FORM RELATED FUNCTIONS ----

//---- BEGIN OBJECT ACTIVATION FIX ----
// EOLAS won a lawsuit vs. Microsoft.  Apparently EOLAS patented the ability to load an Active X control
// in the browser with the ability to interact with it immediately without pressing "ok".
// http://www.eweek.com/article2/0,1895,1865104,00.asp - Eolas Wins Round vs. MS in Browser Patent Fight
// http://www.eweek.com/article2/0,1895,1895907,00.asp - Microsoft Bows to Eolas, Revamps IE's Multimedia Handling

function EnableObjects()
{
	var arrObjects;
	var arrApplets;
	var arrEmbeds;
	
	arrObjects = document.getElementsByTagName("object");
	arrApplets = document.getElementsByTagName("applet");
	arrEmbeds = document.getElementsByTagName("embed");
	
	for(var i = 0; i < arrObjects.length; i++)
	{
		//arrObjects[i].outerHTML = arrObjects[i].outerHTML;
		
		if(arrObjects[i].id.indexOf('NCPHRICH') >= 0) //Enable only for MCMS Placeholder Controls
		{
			parentObj = arrObjects[i].parentNode;
			newObjContent = parentObj.innerHTML;
			parentObj.removeChild(arrObjects[i]);
			parentObj.innerHTML = newObjContent;
		}
	}
	
	for(var j = 0; j < arrApplets.length; j++)
	{
		//arrApplets[j].outerHTML = arrApplets[j].outerHTML;
		parentApplet = arrApplets[j].parentNode;
		newAppContent = parentApplet.innerHTML;
		parentApplet.removeChild(arrApplets[j]);
		parentApplet.innerHTML = newAppContent;
	}
	
	for(var k = 0; k < arrEmbeds.length; k++)
	{
		//arrEmbeds[k].outerHTML = arrEmbeds[k].outerHTML;
		parentEmbed = arrEmbeds[k].parentNode;
		newEmbedContent = parentEmbed.innerHTML;
		parentEmbed.removeChild(arrEmbeds[k]);
		parentEmbed.innerHTML = newEmbedContent;
	}
}

//function DrawFlashImage(strURL, intWidth, intHeight, intCX, intCY)
//{
//	document.write("<object id=\"Shockwaveflash1\" codeBase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" height=\"" + intHeight + "\" width=\"" + intWidth + "\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" VIEWASTEXT>\n");
//	document.write("	<param name=\"_cx\" value=\"" + intCX + "\">\n");
//	document.write("	<param name=\"_cy\" value=\"" + intCY + "\">\n");
//	document.write("	<param name=\"FlashVars\" value=\"\">\n");
//	document.write("	<param name=\"Movie\" value=\"" + strURL + "\">\n");
//	document.write("	<param name=\"Src\" value=\"" + strURL + "\">\n");
//	document.write("	<param name=\"WMode\" value=\"Window\">\n");
//	document.write("	<param name=\"Play\" value=\"-1\">\n");
//	document.write("	<param name=\"Loop\" value=\"-1\">\n");
//	document.write("	<param name=\"Quality\" value=\"High\">\n");
//	document.write("	<param name=\"SAlign\" value=\"\">\n");
//	document.write("	<param name=\"Menu\" value=\"-1\">\n");
//	document.write("	<param name=\"Base\" value=\"\">\n");
//	document.write("	<param name=\"AllowScriptAccess\" value=\"always\">\n");
//	document.write("	<param name=\"Scale\" value=\"ShowAll\">\n");
//	document.write("	<param name=\"DeviceFont\" value=\"0\">\n");
//	document.write("	<param name=\"EmbedMovie\" value=\"0\">\n");
//	document.write("	<param name=\"BGColor\" value=\"\">\n");
//	document.write("	<param name=\"SWRemote\" value=\"\">\n");
//	document.write("	<param name=\"MovieData\" value=\"\">\n");
//	document.write("	<param name=\"SeamlessTabbing\" value=\"1\">\n");
//	document.write("	<embed src=\"" + strURL + "\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"" + intWidth + "\" height=\"" + intHeight + "\"></embed>\n");
//	document.write("</object>\n");
//}

//---- END OBJECT ACTIVATION FIX ----

//---- BEGIN FLASH DETECTION KIT ----

//Legacy Function
function SWFObject(strURL, strName, intWidth, intHeight, intVersion, strBGColor)
{
	DrawFlashImage(strURL,strName,intWidth,intHeight,strBGColor);
}

function DrawFlashImage(strURL, strName, intWidth, intHeight, strBGColor)
{
	//**Global Vars**

	//- Major version of Flash required
	var requiredMajorVersion = 9;

	//- Minor version of Flash required
	var requiredMinorVersion = 0;

	//- Minor revision of Flash required
	var requiredRevision = 0;

	//- Version check based upon the values entered in "Global Vars"
	var hasRequestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);

	//- Check to see if the version meets the requirements for playback
	if(hasRequestedVersion)
	{
		// embed the Flash content SWF when all tests are passed
		AC_FL_RunContent(
			"src", strURL,
			"width", intWidth,
			"height", intHeight,
			"align", "middle",
			"id", strName,
			"quality", "high",
			"bgcolor", strBGColor,
			"name", strName,
			"allowScriptAccess", "sameDomain",
			"WMode", "transparent",
			"type", "application/x-shockwave-flash",
			"codebase", "http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab",
			"pluginspage", "http://www.adobe.com/go/getflashplayer"
		);
	}
	else
	{
		//flash is too old or we can't detect the plugin
		var alternateContent = '<p>Adobe Flash Player 9 was not detected on your system.  Please update or download now.</p>' +
							'<p><a href=\"http://www.adobe.com/go/getflash/\">Get Flash</a>';
							
		document.write(alternateContent);
	}
}

//---- END FLASH DETECTION KIT ----


//---- Sqare360 javascript code ---
/*************************************************************************
  This code is from Dynamic Web Coding at http://www.dyn-web.com/
  Copyright 2003 by Sharon Paine 
  See Terms of Use at http://www.dyn-web.com/bus/terms.html
  regarding conditions under which you may use this code.
  This notice must be retained in the code as is!
*************************************************************************/

var menuLayers = {
  timer: null,
  activeMenuID: null,
  offX: -5,   // horizontal offset 
  offY: -5,   // vertical offset 
  show: function(id, e, type) {
    var mnu = document.getElementById? document.getElementById(id): null;
    if (!mnu) return;
    this.activeMenuID = id;
    if ( mnu.onmouseout == null ) mnu.onmouseout = this.mouseoutCheck;
    if ( mnu.onmouseover == null ) mnu.onmouseover = this.clearTimer;
    viewport.getAll();
    this.position(mnu,e,type);
  },
  
  hide: function() {
    this.clearTimer();
    if (this.activeMenuID && document.getElementById) 
      this.timer = setTimeout("document.getElementById('"+menuLayers.activeMenuID+"').style.visibility = 'hidden'", 0);
  },
  
  position: function(mnu, e, type) {
    
    var x;
    var y;
    var sourceObj = e.srcElement? e.srcElement: e.target;
    var arrPos = findPos(sourceObj);
    
    if(type == undefined){
    
        x = arrPos[0]
        y = arrPos[1]
    
        if ( x + mnu.offsetWidth + this.offX > viewport.width + viewport.scrollX )
          x = x - mnu.offsetWidth - this.offX;
        else x = x + this.offX;
      
        if ( y + mnu.offsetHeight + this.offY > viewport.height + viewport.scrollY )
          y = ( y - mnu.offsetHeight - this.offY > viewport.scrollY )? y - mnu.offsetHeight - this.offY : viewport.height + viewport.scrollY - mnu.offsetHeight;
        else y = y + this.offY;
    
    }else{
        // for employee login menu
        x = arrPos[0] - 11;
        y = arrPos[1] - 5;   
    }
    
    mnu.style.left = x + "px"; mnu.style.top = y + "px";
    this.timer = setTimeout("document.getElementById('" + menuLayers.activeMenuID + "').style.visibility = 'visible'", 200);
  },
  
  mouseoutCheck: function(e) {
    e = e? e: window.event;
    // is element moused into contained by menu? or is it menu (ul or li or a to menu div)?
    var mnu = document.getElementById(menuLayers.activeMenuID);
    var toEl = e.relatedTarget? e.relatedTarget: e.toElement;
    if ( mnu != toEl && !menuLayers.contained(toEl, mnu) ) menuLayers.hide();
  },
  
  // returns true of oNode is contained by oCont (container)
  contained: function(oNode, oCont) {
    if (!oNode) return; // in case alt-tab away while hovering (prevent error)
    while ( oNode = oNode.parentNode ) 
      if ( oNode == oCont ) return true;
    return false;
  },

  clearTimer: function() {
    if (menuLayers.timer) clearTimeout(menuLayers.timer);
  }
  
}

/*************************************************************************

  dw_viewport.js
  version date Nov 2003
  
  This code is from Dynamic Web Coding 
  at http://www.dyn-web.com/
  Copyright 2003 by Sharon Paine 
  See Terms of Use at http://www.dyn-web.com/bus/terms.html
  Permission granted to use this code 
  as long as this entire notice is included.

*************************************************************************/  
  
viewport = {
  getWinWidth: function () {
    this.width = 0;
    if (window.innerWidth) this.width = window.innerWidth - 18;
    else if (document.documentElement && document.documentElement.clientWidth) 
  		this.width = document.documentElement.clientWidth;
    else if (document.body && document.body.clientWidth) 
  		this.width = document.body.clientWidth;
  },
  
  getWinHeight: function () {
    this.height = 0;
    if (window.innerHeight) this.height = window.innerHeight - 18;
  	else if (document.documentElement && document.documentElement.clientHeight) 
  		this.height = document.documentElement.clientHeight;
  	else if (document.body && document.body.clientHeight) 
  		this.height = document.body.clientHeight;
  },
  
  getScrollX: function () {
    this.scrollX = 0;
  	if (typeof window.pageXOffset == "number") this.scrollX = window.pageXOffset;
  	else if (document.documentElement && document.documentElement.scrollLeft)
  		this.scrollX = document.documentElement.scrollLeft;
  	else if (document.body && document.body.scrollLeft) 
  		this.scrollX = document.body.scrollLeft; 
  	else if (window.scrollX) this.scrollX = window.scrollX;
  },
  
  getScrollY: function () {
    this.scrollY = 0;    
    if (typeof window.pageYOffset == "number") this.scrollY = window.pageYOffset;
    else if (document.documentElement && document.documentElement.scrollTop)
  		this.scrollY = document.documentElement.scrollTop;
  	else if (document.body && document.body.scrollTop) 
  		this.scrollY = document.body.scrollTop; 
  	else if (window.scrollY) this.scrollY = window.scrollY;
  },
  
  getAll: function () {
    this.getWinWidth(); this.getWinHeight();
    this.getScrollX();  this.getScrollY();
  }
  
}

function findPos(obj) {
    var curleft = curtop = 0;
    if (obj.offsetParent) {
        curleft = obj.offsetLeft
        curtop = obj.offsetTop
        while (obj = obj.offsetParent) {
	        curleft += obj.offsetLeft
	        curtop += obj.offsetTop
        }
    }
    return [curleft,curtop];   
}


function highlightRow(gridID){
   if (document.all && document.getElementById){  
        navRoot = document.getElementById(gridID);

        // Get a reference to the TBODY element 
        tbody = navRoot.childNodes[0];
  
        for (i = 1; i < tbody.childNodes.length; i++){
            node = tbody.childNodes[i];
            if (node.nodeName == "TR"){
                
                node.onmouseover=function(){
                    this.className = "over";                
                }
                
                node.onmouseout=function(){
                    this.className = this.className.replace("over", "");
                }
            }
        }
    }
}

// pop up div for "Approve/Decline" link in Pending Uploads Admin
function popDiv(docID,docName,email,eventType,e){
    var divLayer = getObjRef('Panel1');
    var posx = 0;
	var posy = 0;
    
    divLayer.style.visibility = 'visible';
    
    if(eventType == "decline"){
        document.forms[0].ctl00_cpMain_TextBox1.value = docName + " has been declined";
        getObjRef('ctl00_cpMain_Label1').innerHTML = "http://gkc3.cbre.com/admin/fileupload.aspx?strDocId=" + docID;
        
        getObjRef('ctl00_cpMain_btnApprove').style.display = "none";
        getObjRef('ctl00_cpMain_btnDecline').style.display = "";
    }else{
        document.forms[0].ctl00_cpMain_TextBox1.value = docName + " has been approved";
        getObjRef('ctl00_cpMain_btnApprove').style.display = "";
        getObjRef('ctl00_cpMain_btnDecline').style.display = "none";    
    }

    document.forms[0].ctl00$cpMain$HiddenField1.value = docID + "," + email + ",http://gkc3.cbre.com/admin/fileupload.aspx?strDocId=";
    
	if (!e) var e = window.event;
	if (e.pageX || e.pageY) 	{
		posx = e.pageX;
		posy = e.pageY;
	}
	else if (e.clientX || e.clientY) 	{
		posx = e.clientX + document.body.scrollLeft 
			+ document.documentElement.scrollLeft;
		posy = e.clientY + document.body.scrollTop
			+ document.documentElement.scrollTop;
	}

    divLayer.style.top =  posy + "px";
    divLayer.style.left = posx + "px";
}

// get dom type
function getObjRef(obj){
    var docObj;
    if(isDOM){
        docObj = document.getElementById(obj);
    }
    else{
        docObj = document.all(obj);
    }
    return docObj;
}


// Fix for IE background image flicker 
try 
{ 
    document.execCommand('BackgroundImageCache', false, true); 
} 
catch(e) {} 
