﻿/*
function viewmsgbox(){
	with(parent.document.getElementById("mymsgbox").style){
		visibility=visibility=='hidden'?'visible':'hidden'
	}
}
*/
var ie=document.all
var ns=document.layers
var ns6=document.getElementById&&!document.all



function getElementLeft(Elem) {
	
		var elem = document.getElementById(Elem);
		
		xPos = elem.offsetLeft;
		tempEl = elem.offsetParent;
  		while (tempEl != null) {
  			xPos += tempEl.offsetLeft;
	  		tempEl = tempEl.offsetParent;
  		}
		return xPos;

		
	
}


function getElementTop(Elem) {
        var elem = document.getElementById(Elem);
		yPos = elem.offsetTop;
		tempEl = elem.offsetParent;
		
		while (tempEl != null) {
  			yPos += tempEl.offsetTop;
	  		tempEl = tempEl.offsetParent;
  		}
		return yPos;
	
}


function viewmsgbox(which,e,w,h,lbl){
//Render image code for IE 4+ and NS6
		crossobj=document.getElementById? document.getElementById("mymsgbox") : document.all.mymsgbox
		crossobj.style.visibility="hidden"
		if (crossobj.style.visibility=="hidden"){
//			crossobj.style.left=ns6? pageXOffset+e.clientX : document.body.scrollLeft+event.clientX
//			crossobj.style.top=ns6? pageYOffset+e.clientY : document.body.scrollTop+event.clientY
			crossobj.style.left=ns6? (document.body.pageXOffset-crossobj.clientWidth)/2 : (document.body.offsetWidth-crossobj.clientWidth)/2
			crossobj.style.top=ns6? (document.body.pageYOffset-crossobj.clientHeight)/2 : (document.body.offsetHeight-crossobj.clientHeight)/2
			crossobj.innerHTML='<div style="background-color: #3366CC" align=right id=drag><font color=#ffffff>'+lbl+'</font>     <b onClick=closemsgbox()>&nbsp;<a style="font-family: System; font-size: 10pt; color: #000000; text-decoration: none; font-weight: bold"  href=javascript:void(0);>X</a>&nbsp;&nbsp;</b></div><iframe width='+w+' height='+h+' scrollbars=no src="'+which+'">'
			crossobj.style.visibility="visible"
		}
		else
			crossobj.style.visibility="hidden"
		return false
}
/*
function enlarge(which,e){
//Render image code for IE 4+ and NS6
	if (ie||ns6){
		crossobj=document.getElementById? document.getElementById("mymsgbox") : document.all.mymsgbox
		if (crossobj.style.visibility=="hidden"){
			crossobj.style.left=ns6? pageXOffset+e.clientX : document.body.scrollLeft+event.clientX
			crossobj.style.top=ns6? pageYOffset+e.clientY : document.body.scrollTop+event.clientY
			crossobj.innerHTML='<div align=right id=drag ><b onClick=closemsgbox()>&nbsp;<a style="font-family: David; font-size: 10pt; color: #FFFFFF; text-decoration: none; font-weight: bold"  href=javascript:void(0);>X</a>&nbsp;</b></div><img src="'+which+'">'
//			crossobj.innerHTML='<div align=right id=drag ><b onClick=closepreview()>&nbsp;<a style="font-family: David; font-size: 10pt; color: #FFFFFF; text-decoration: none; font-weight: bold"  href=javascript:void(0);>X</a>&nbsp;</b></div><img src="'+which+'">'

			crossobj.style.visibility="visible"
		}
		else
			crossobj.style.visibility="hidden"
		return false
	}
//Render image code for NS 4
	else if (document.layers){
		if (document.mymsgbox.visibility=="hide"){
			document.mymsgbox.document.write('<a href="#" onMouseover="drag_dropns(mymsgbox)"><img src="'+which+'" border=0></a>')
			document.mymsgbox.document.close()
			document.mymsgbox.left=e.x
			document.mymsgbox.top=e.y
			document.mymsgbox.visibility="show"
		}
		else
			document.mymsgbox.visibility="hide"
		return false
	}
//if NOT IE 4+ or NS 4, simply display image in full browser window
	else
		return true
	}
*/
function closemsgbox(){
	document.getElementById("mymsgbox").style.visibility='hidden'
}
//drag drop function for IE 4+ and NS6////
/////////////////////////////////

function drag_drop(e){
	if (ie&&dragapproved){
		crossobj.style.left=tempx+event.clientX-offsetx
		crossobj.style.top=tempy+event.clientY-offsety
	}
	else if (ns6&&dragapproved){
		crossobj.style.left=tempx+e.clientX-offsetx
		crossobj.style.top=tempy+e.clientY-offsety
	}
	return false
}

//drag drop function for NS 4////
/////////////////////////////////

var nsx,nsy,nstemp

function drag_dropns(name){
	temp=eval(name)
	temp.captureEvents(Event.MOUSEDOWN | Event.MOUSEUP)
	temp.onmousedown=gons
	temp.onmousemove=dragns
	temp.onmouseup=stopns
}

function gons(e){
	temp.captureEvents(Event.MOUSEMOVE)
	nsx=e.x
	nsy=e.y
}

function dragns(e){
	temp.moveBy(e.x-nsx,e.y-nsy)
	return false
}

function stopns(){
	temp.releaseEvents(Event.MOUSEMOVE)
}

function initializedrag(e){
	if (ie&&event.srcElement.id=="drag"||ns6&&e.target.id=="drag"){
		offsetx=ie? event.clientX : e.clientX
		offsety=ie? event.clientY : e.clientY

		tempx=parseInt(crossobj.style.left)
		tempy=parseInt(crossobj.style.top)

		dragapproved=true
		document.onmousemove=drag_drop
	}
}
function getXmlHttpObj(){
    
        var xmlhttp=false;

        if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	        try {
		        xmlhttp = new XMLHttpRequest();
	        } catch (e) {
		        xmlhttp=false;
	        }
        }
        if (!xmlhttp && window.createRequest) {
	        try {
		        xmlhttp = window.createRequest();
	        } catch (e) {
		        xmlhttp=false;
	        }
        }
        
        if (window.ActiveXObject) {
         // ...otherwise, use the ActiveX control for IE5.x and IE6.
         try
         {
            xmlhttp = new ActiveXObject('MSXML2.XMLHTTP.3.0');
            }
            catch(e)
            {
            xmlhttp=false;
            }
        }


          return xmlhttp

    }

function setOrdersSession(ordersList)
{
    
          var xmlHttp = getXmlHttpObj();
          
          if(xmlHttp)

              {
              
              //xmlHttp.onready     
              var resonseVariable;  
              
              responseVariable = "?ordersList=" +ordersList + "&flg=ordersList";
              
              xmlHttp.open("GET", "xmlHttpHandle.asp" + responseVariable, true);
              
              xmlHttp.send(null);   
              
              /*xmlHttp.onreadystatechange=function() {
                if (xmlHttp.readyState==4) 
                    alert(xmlHttp.responseText)
           
            } */
              
              
            }


}


function getItemDetails(ItemID)
{
          
          var xmlHttp = getXmlHttpObj();
          if(xmlHttp)

              {

              xmlHttp.onready     
              var resonseVariable;  
              
              responseVariable = "?ItemID=" +ItemID + "&flg=ItemDetail";
              
              xmlHttp.open("GET", "xmlHttpHandle.asp" + responseVariable, true);
              
              xmlHttp.send();   
              
              xmlHttp.onreadystatechange=function() {
                if (xmlHttp.readyState==4) 
                    alert(xmlHttp.responseText);
           
            } 
              
              
            }


}




document.onmousedown=initializedrag
document.onmouseup=new Function("dragapproved=false")
