var ie=document.all;
var nn6=document.getElementById&&!document.all;

var isdrag=false;
var x,y,tx,ty;
var dobj;

function movemouse(e)
{
  if (isdrag)
  {
    dobj.style.left = nn6 ? tx + e.clientX - x : tx + event.clientX - x;
    dobj.style.top  = nn6 ? ty + e.clientY - y : ty + event.clientY - y;
    return false;
  }
}

function selectmouse(e) 
{
  var fobj       = nn6 ? e.target : event.srcElement;
  var topelement = (nn6 || ie) ? "HTML" : "BODY";
  
  if(fobj == null || fobj == undefined ){
    return true;
  }
  

  while (fobj.tagName != topelement && fobj.className != "dragme")
  {
    fobj = nn6 ? fobj.parentNode : fobj.parentElement;
    if(fobj.className == "content")
        return true;
  }
  
  if (fobj.className == "dragme")
  {
		dragPopUpWindow(fobj,(nn6 ? e : event));
	    return true;
		
  }
 
}

function dragPopUpWindow(fobj,ev) {
	    isdrag = true;
		dobj = fobj;
		tx = parseInt(dobj.style.left+0);
		ty = parseInt(dobj.style.top+0);
		//tx = parseInt(findAbsPosX(dobj)+0);
		//ty = parseInt(findAbsPosY(dobj)+0);
		
		//x = nn6 ? e.clientX : event.clientX;
		//y = nn6 ? e.clientY : event.clientY;
		x = ev.clientX;
		y = ev.clientY;
		
		document.onmousemove=movemouse;

		/* Code Added : start ====================================================== */
		//focusfindfield('findit');
		/* Code Added : end   ====================================================== */
		
}

/* Code Added : start ========================================================== */
/* Close Refine Popup window =================================================== */
function closepopup(obj) {
	document.getElementById(obj).style.display = "none";
	var FObj = document.getElementById("flashvideo");
	if(FObj != null)
	{
		var mov = (thisMovie("flashvideo"));
		mov.dialogBoxClosed();
	}
}//end

/* Show Refine Popup window ==================================================== */
function showpopup(divID) {
	document.getElementById(divID).style.display = 'block'
	
	//document.onfocus = focusfindfield('findit')
    document.onmousedown=selectmouse;
    document.onmouseup=new Function("isdrag=false");  
}//end


/* Show Refine Popup window =================================================== */
function focusfindfield(obj) {
	document.getElementById(obj).focus();
}//end

/* Clear "Find it now" field in the popup window ============================= */
function clearfield() {
    document.finditform.reset();
}//end

/* Change cursor style when dragging the popup window ======================== */
function changecursorstyle(obj,cursorstyle) {
	if(cursorstyle == "move") {
		document.getElementById(obj).style.cursor = "move";
	}else if(cursorstyle == "default") {
		document.getElementById(obj).style.cursor = "default";
	}
}//end

function thisMovie(movieName)
{
	if (navigator.appName.indexOf("Microsoft") != -1)
	{
        return window[movieName];
    }else{
        return document[movieName];
    }
}

/* Code Added : end   ======================================================== */