

var intLeft = null;
var ns4=document.layers;
var ie4=document.all;
var ns6=document.getElementById&&!document.all;

function __VoidPopUp(eventVar, strTextVar) {
    
    objDiv=ie4? document.all.endtablesearch : ns6? document.getElementById("endtablesearch") : ns4? document.endtablesearch : "";
    objDiv.contentheight=(ie4||ns6)? objDiv.offsetHeight : objDiv.document.gui.document.height;
    
    text=ie4? document.all.strText : ns6? document.getElementById("strText") : ns4? document.strText : "";
    text.thestyle=(ie4||ns6)? text.style : text;
    if (ie4||ns6) {
      text.innerHTML=strTextVar;
    }
    else {
      text.document.write('<layer name=gui bgColor=#E6E6E6 width=200 onmouseover="clearhidemenu()" onmouseout="hidemenu()">'+strTextVar+'</layer>');
      text.document.close();
    }
    popup=ns6? document.getElementById("divPopUp") : document.all.divPopUp;
    popup.thestyle=(ie4||ns6)? popup.style : popup
    popup.thestyle.display = 'block';
    popup.contentwidth=(ie4||ns6)? popup.offsetWidth : popup.document.gui.document.width;
    popup.contentheight=(ie4||ns6)? popup.offsetHeight : popup.document.gui.document.height;
    popup.thestyle.display = 'none';
    
    eventX=ie4? event.clientX : ns6? eventVar.clientX : eventVar.x;
    eventY=ie4? event.clientY : ns6? eventVar.clientY : eventVar.y;
    //if( intLeft == null) {
      if (ie4)
        intLeft = eventX - window.event.offsetX;
      else
        intLeft = eventX;
      intLeft = intLeft + 15;
    //}
    //Find out how close the mouse is to the corner of the window
    var rightedge=ie4? document.body.clientWidth-eventX : window.innerWidth-eventX
    var bottomedge=ie4? document.body.clientHeight-eventY : window.innerHeight-eventY
    popup.thestyle.left = eventX;
    popup.thestyle.left = intLeft;
    
    //same concept with the vertical position
    if (bottomedge<popup.contentheight) {
      var intTop = ie4? document.body.scrollTop+eventY-popup.contentheight : ns6? window.pageYOffset+eventY-popup.contentheight : eventY-popup.contentheight;
      if ( intTop < 10 )
        popup.thestyle.top = 10;
      else
        popup.thestyle.top = intTop;
    }
    else
      popup.thestyle.top=ie4? document.body.scrollTop+event.clientY : ns6? window.pageYOffset+eventY : eventY;
    popup.thestyle.display = 'block';
    popup.thestyle.width = '155px';
}

function __VoidPopUpPriceInfo(eventVar, strTextVar, strAlignVar) {
    
    //objDiv=ie4? document.all.endtablesearch : ns6? document.getElementById("endtablesearch") : ns4? document.endtablesearch : "";
    //objDiv.contentheight=(ie4||ns6)? objDiv.offsetHeight : objDiv.document.gui.document.height;
    
    text=ie4? document.all.strText : ns6? document.getElementById("strText") : ns4? document.strText : "";
    text.thestyle=(ie4||ns6)? text.style : text;
    if (ie4||ns6) {
      text.innerHTML=strTextVar;
    }
    else {
      text.document.write('<layer name=gui bgColor=#E6E6E6 width=200 onmouseover="clearhidemenu()" onmouseout="hidemenu()">'+strTextVar+'</layer>');
      text.document.close();
    }
    if (strAlignVar != null && strAlignVar != "") {
        document.getElementById("tdPriceInfo").style.textAlign = strAlignVar;
    }
    else {
        document.getElementById("tdPriceInfo").style.textAlign = "center";
    }
    popup=ns6? document.getElementById("divPopUp") : document.all.divPopUp;
    popup.thestyle=(ie4||ns6)? popup.style : popup
    //popup.thestyle.display = 'block';
    popup.contentwidth=(ie4||ns6)? popup.offsetWidth : popup.document.gui.document.width;
    popup.contentheight=(ie4||ns6)? popup.offsetHeight : popup.document.gui.document.height;
    popup.thestyle.display = 'none';
    
    eventX=ie4? event.clientX : ns6? eventVar.clientX : eventVar.x;
    eventY=ie4? event.clientY : ns6? eventVar.clientY : eventVar.y;
    //if( intLeft == null) {
      if (ie4)
        intLeft = eventX - window.event.offsetX;
      else
        intLeft = eventX;
      intLeft = intLeft - 285;
    //}
    //Find out how close the mouse is to the corner of the window
    var rightedge=ie4? document.body.clientWidth-eventX : window.innerWidth-eventX
    var bottomedge=ie4? document.body.clientHeight-eventY : window.innerHeight-eventY
    popup.thestyle.left = eventX;
    popup.thestyle.left = intLeft;
    
    //same concept with the vertical position
    if (bottomedge<popup.contentheight) {
      var intTop = ie4? document.body.scrollTop+eventY-popup.contentheight : ns6? window.pageYOffset+eventY-popup.contentheight : eventY-popup.contentheight;
      if ( intTop < 10 )
        popup.thestyle.top = 10 + 10;
      else
        popup.thestyle.top = intTop + 10;
    }
    else
      popup.thestyle.top=ie4? document.body.scrollTop+event.clientY+10 : ns6? window.pageYOffset+eventY+10 : eventY+10;
    popup.thestyle.display = 'block';
    popup.thestyle.width = '295px';
}

  
function __GetInitializeDrag(e) {
    var firedobj=ns6? e.target : event.srcElement
    var topelement=ns6? "HTML" : "BODY"
    //while ( firedobj.id != "endtablesearch" && firedobj.tagName != topelement && firedobj.id != "divPopUp" ){
    while ( firedobj.tagName != topelement && firedobj.id != "divPopUp" ){
        firedobj=ns6? firedobj.parentNode : firedobj.parentElement
        if (firedobj == null)
            return;
    }
    //if (firedobj.id!="divPopUp" && firedobj.id == "endtablesearch"){
    if (firedobj.id!="divPopUp"){
        __VoidClosePopUp();
    }
}
  
document.onmousedown=__GetInitializeDrag
  
function __VoidClosePopUp(){
    popup=ns6? document.getElementById("divPopUp") : document.all.divPopUp
    popup.thestyle=(ie4||ns6)? popup.style : popup
    popup.thestyle.display="none";
}


function __VoidPopUpPriceInfoOld(eventVar, strTextVar) {
    text=ie4? document.all.divPriceInfo : ns6? document.getElementById('divPriceInfo') : ns4? document.divPriceInfo : "";
    text.thestyle=(ie4||ns6)? text.style : text;
    if (ie4||ns6) {
        text.innerHTML=strTextVar;
    }
    else {
        text.document.write('<layer name=gui bgColor=#E6E6E6 width=200 onmouseover="clearhidemenu()" onmouseout="hidemenu()">'+strTextVar+'</layer>');
        text.document.close();
    }
    //objText=ns6? document.getElementById('divText') : document.all.divText;
    //objText.thestyle=(ie4||ns6)? objText.style : objText
    text.thestyle.display = 'block';
    text.contentwidth=(ie4||ns6)? text.offsetWidth : text.document.gui.document.width;
    text.contentheight=(ie4||ns6)? text.offsetHeight : text.document.gui.document.height;
    text.thestyle.display = 'none';
    eventX=ie4? event.clientX : ns6? eventVar.clientX : eventVar.x;
    eventY=ie4? event.clientY : ns6? eventVar.clientY : eventVar.y;
    //Find out how close the mouse is to the corner of the window
    var rightedge=ie4? document.body.clientWidth-eventX : window.innerWidth-eventX
    var bottomedge=ie4? document.body.clientHeight-eventY : window.innerHeight-eventY
    if (rightedge<text.contentwidth) {
        var intLeft= ie4? document.body.scrollLeft+eventX-text.contentwidth : ns6? window.pageXOffset+eventX-text.contentwidth : eventX-text.contentwidth
        if ( intLeft < 10 )
            text.thestyle.left = 10;
        else
            text.thestyle.left = intLeft;
    }
    else
        text.thestyle.left=ie4? document.body.scrollLeft+event.clientX : ns6? window.pageXOffset+eventX : eventX;
    //same concept with the vertical position
    if (bottomedge<text.contentheight) {
        var intTop = ie4? document.body.scrollTop+eventY-text.contentheight : ns6? window.pageYOffset+eventY-text.contentheight : eventY-text.contentheight;
        if ( intTop < 10 )
            text.thestyle.top = 10;
        else
            text.thestyle.top = intTop;
    }
    else
        text.thestyle.top=ie4? document.body.scrollTop+event.clientY : ns6? window.pageYOffset+eventY : eventY;
        text.thestyle.display = 'block';
    }



function __GetInitializeMouseOut(e) {
    var firedobj=ns6? e.target : event.srcElement
    var topelement=ns6? 'HTML' : 'BODY'
    while ( firedobj.tagName != topelement && firedobj.id != 'divPriceInfo' ){
        firedobj=ns6? firedobj.parentNode : firedobj.parentElement
        if (firedobj == null)
            return;
    }
    if (firedobj.id!='divPriceInfo') {
        __VoidClosePopUpPriceInfo();
    }
}
  
document.onmouseout=__GetInitializeMouseOut

function __VoidClosePopUpPriceInfo() {
    text=ns6? document.getElementById('divPriceInfo') : document.all.divPriceInfo
    if ( text != null) {
        text.thestyle=(ie4||ns6)? text.style : text
        text.thestyle.display='none';
    }
}


