	var skuUid = 0;
	var xMousePos = 0; // Horizontal position of the mouse on the screen
  var yMousePos = 0; // Vertical position of the mouse on the screen
  var xMousePosMax = 0; // Width of the page
  var yMousePosMax = 0; // Height of the page
	
	function closeSku(id)
	{
		var divToBeClosed = document.getElementById("skuSelect");
		divToBeClosed.style.display = 'none';
	}

	function closeLastSku()
	{
		if (skuUid != 0){
			closeSku(skuUid);
			document.onclick=null;
		}
	}
	
	function  fillSkuList(uid,e)
	{	
	  captureMousePosition(e);
		var dd = document.getElementById("skuSelect");
		dd.innerHTML="<img src='images/WaitAnim.gif' width='16' height='16='/>";      
		dd.style.left = xMousePos + "px";
		dd.style.top = yMousePos + "px";  
		objAjax = initXMLHttpClient();
		if(skuUid != 0 && uid != skuUid)
	    {
	        closeSku(skuUid);
	    } 
        skuUid = uid;
		now = new Date();
		nocache = '' + now.getHours() + '-' + now.getMinutes() + '-' + now.getSeconds() + '-' + now.getMilliseconds();
		var URL = 'AjaxCall/skuQuick.aspx?id=' + uid + '&nocache=' + nocache;
		
		
		var divObj = document.getElementById("skuSelect");
		divObj.style.left = xMousePos + "px";
		divObj.style.top = yMousePos + "px";  
		
		var windowWidth = 0;
		
		if(BrowserDetect.browser != "Explorer")
		  {
		    document.onclick = checkSkuClick;
		    windowWidth = window.innerWidth;
		  }
		  else
		  {
		    windowWidth = document.body.offsetWidth;
		  }
		
		if (xMousePos + 220 > windowWidth)
				divObj.className = "bubble_right";
		else 
				divObj.className = "bubble_left";	

		objAjax.onreadystatechange = skuListCallback;    
		objAjax.open("GET", URL, true);
		objAjax.send(null);      
  }
  
  function skuListCallback()
  {    
	  if ( objAjax.readyState == 4 )
	  {	  
	    var divObj = document.getElementById("skuSelect");
 	    var strHtml = objAjax.responseText;
	    
	     if(strHtml.length != 0)  
        {                  
					divObj.style.display = "block";  
					divObj.innerHTML = strHtml;
        }
       else
       {
					divObj.innerHTML = "";
					divObj.style.display = "none";
       }		   
	  }
  }
  
  function captureMousePosition(e) {
    if (document.layers) {
        xMousePos = e.pageX;
        yMousePos = e.pageY;
    } else 
    if (document.all) {
        xMousePos = window.event.x + document.documentElement.scrollLeft;
        yMousePos = window.event.y + document.documentElement.scrollTop;
        //(Note that if you use a DOCTYPE in Explorer 6, you may have to search for scrollTop in document.documentElement instead of document.body.)
    } else
    if (document.getElementById) {
        xMousePos = e.pageX;
        yMousePos = e.pageY;
    }
    //alert( "xMousePos=" + xMousePos + ", yMousePos=" + yMousePos + ", xMousePosMax=" + xMousePosMax + ", yMousePosMax=" + yMousePosMax);
	}
	
	function checkSkuClick(e){
	var target = (e && e.target) || (event && event.srcElement);
	
	if ( !checkSkuParent(target) )
		closeLastSku();
	} 
	
	function checkSkuParent(t){
		while(t.parentNode){
			if( t==document.getElementById('skuSelect') || t.getAttribute("name") == "qicart" ){
				return true;
			}
			t=t.parentNode;
		}
		return false;
	} 
