

function dialogClass(){
	this.blankImgHandle = null;
	this.tags = new Array("applet", "iframe", "select","Object");
	this.body_overflow_y = null;
	this.body_overflow_x = null;
	this.temp = new Array();
/*	this.intLength = 0;*/

	this.hideAllSelect = function()
	{
	   for( var k=0;k<this.tags.length;k++)
	   {
		   var selects = document.getElementsByTagName(this.tags[k]);	
		   for (var i=0;i<selects.length;i++)
		   {
		   	selects(i).setAttribute("oldStyleDisplay",selects(i).style.visibility);
			/*if(selects(i).style.visibility == "hidden")
			{
				temp[intLength] = selects(i).name;
				intLength ++;
			}*/
		   	selects(i).style.visibility = "hidden";
		   }
	   }	
	}
	
	this.resetAllSelect = function()
	{
	   for( var k=0;k<this.tags.length;k++)
	   {
		   var selects = document.getElementsByTagName(this.tags[k]);	
		   for (var i=0;i<selects.length;i++)
		   {	   	
		   	if (selects(i).getAttribute("oldStyleDisplay")!=null)
		   	   selects(i).style.visibility = selects(i).getAttribute("oldStyleDisplay");
			  /*for(var j =0;j<intLength;j++)
			  {
				  if(selects(i).name == temp[j])
					  selects(i).style.visibility = "hidden";
			  }*/
		   }
	    }	
	}        
        
   this.show = function(){	
        	this.body_overflow_y = document.body.style.overflowY;
	      this.body_overflow_x = document.body.style.overflowX;
	      document.body.style.overflowX = "hidden";
	      document.body.style.overflowY = "hidden";
        	this.hideAllSelect();
        	
		var w = "100%" ;
		var h = "100%" ;
		
		this.blankImgHandle = document.createElement("DIV");
		with (this.blankImgHandle.style){
			position = "absolute";
			left     = 0;
			top      = document.body.scrollTop;
			height   = "100%";
			width    = "100%";
			zIndex   = "9999";
			filter   = "progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=60)";
			backgroundColor = "#cccccc";	     	
		}	     
		
		document.body.appendChild(this.blankImgHandle);
		
		var img = document.createElement("IMAGE");
		with (img){
			src = "images/blank.gif";
			width= w ;
			height= h ;
			
		}
		this.blankImgHandle.appendChild(img);	        

		
        }        
        
        this.close = function(){
        	   document.body.style.overflowY = this.body_overflow_y;
	         document.body.style.overflowX = this.body_overflow_x;
            if (this.blankImgHandle){
             	this.blankImgHandle.removeNode(true);
            }
            this.resetAllSelect();       	
        }
}


function waitingDialog(){
	this.dialog = null;
	this.containHandle = null;
	this.width = 270;
	this.height = 123;
	this.left = null;
	this.top = null;
	this.imgsrc = "http://www.foreclosuredata.com/images/clock.gif";
	this.boxsrc = "http://www.foreclosuredata.com/images/box.gif";
	this.msgText = "Processing your request...";
	this.msgHandle = null;
	this.imgHandle = null;
	
	this.onCancel = null;
	this.show  = function(){	
		this.dialog = new dialogClass();	
	        this.dialog.show();
	        var w = document.body.clientWidth ;
		var h = document.body.clientHeight ;
		var x,y;
		x = this.left?this.left:(document.body.clientWidth-this.width)/2;
	        y = this.top?this.top:((document.body.clientHeight-this.height)/2+document.body.scrollTop + 20) ;
			
		var obody = document.getElementsByTagName('body')[0];
    	var frag = document.createDocumentFragment();
			
		this.containHandle = document.createElement("DIV");	
		with (this.containHandle.style){
			position = "absolute";
			left     = x;
			top      = y;
			height   = this.height+"px";
			width    = this.width+"px";
			zIndex   = "10000"; 
			backgroundImage	= "url("+this.boxsrc+")";
			/*paddingTop = "30px";*/
			/*paddingLeft= "40px";*/
			/*paddingRight = "15px";*/
			textAlign  = "center";
			cursor = "move";
			filter = "progid:DXImageTransform.Microsoft.dropshadow(OffX=3, OffY=3,Color='gray', Positive='true')";
		}

		this.containHandle.onmousedown = function()
		{
			if (window.dragObject==null)
			{
			   var el =event.srcElement;
			   window.dragObject = {
			      ele : el,
			      x   : event.x - el.style.pixelLeft,	
			      y   : event.y - el.style.pixelTop	
			    }			   
			}
			
		}
		this.containHandle.onmousemove = function()
		{
			if (window.dragObject)
			{

			    var obj=window.dragObject;
			    obj.ele.style.pixelLeft = event.x - obj.x;
                            obj.ele.style.pixelTop = event.y - obj.y;
			    
			}			
		}
		
		this.containHandle.onmouseup = function()
		{
			if (window.dragObject)
			{
			   window.dragObject = null; 				
			}		
		}
		
		frag.appendChild(this.containHandle);
		
		this.msgHandle = document.createElement("DIV");	
		this.msgHandle.innerText = this.msgText;
		with (this.msgHandle.style){
			paddingTop = "30px";
			textAlign  = "center";
			width = "100%";
		}
		this.containHandle.appendChild(this.msgHandle);
		
		this.msgHandle2 = document.createElement("DIV");	
		with (this.msgHandle2.style){
			position = "relative";
			paddingTop = "10px";
			paddingLeft = "119px";
			width = "50px";
		}
		this.containHandle.appendChild(this.msgHandle2);
		
		this.imgHandle  = document.createElement("IMG");
		with (this.imgHandle) {
			textAlign  = "left";
			src   = this.imgsrc;			
		}
		this.msgHandle2.appendChild(this.imgHandle);
		
		obody.insertBefore(frag, obody.firstChild);
		
		/*if (this.onCancel){
			var closebutton = document.createElement("IMG");
			with (closebutton){
				src   = "images/cancel.gif";
				title = "cancel";	
				style.cursor = "hand";	
			}
			closebutton.attachEvent("onclick",this.onCancel);
			this.containHandle.appendChild(closebutton);
	      }*/
	}
	
	this.close = function(){
	    if (this.dialog)	{
	       this.dialog.close();
	       this.dialog = null;	
	    }
	    if (this.containHandle){
             	this.containHandle.removeNode(true);
            }			
	}	
}

WaitingDialog = new waitingDialog();
function _waitingCancel(){
  WaitingDialog.close();  
}

WaitingDialog.onCancel = _waitingCancel;