//onMouseOver="showprev('http://static-r.arttoday.com/thb/thb9/PH/tl5365_20050329/tl5365_20050329/5365_050405_62856.thb.jpg','4508930','',232,350,'/thm/thm9/PH/tl5365_20050329/tl5365_20050329/5365_050405_62856.thm.jpg','/thm/thm9/PH/tl5365_20050329/tl5365_20050329/5365_050405_62856.thl.jpg','cc7ac1e67a69e2080ff754dec6d1b512');return(_dls())"
//var offsetfrommouse=[50,-25]; //image x,y offsets from cursor position in pixels. Enter 0,0 for no offset 50,-25 default
var offsetfrommouse=[-130,-70]; //image x,y offsets from cursor position in pixels. Enter 0,0 for no offset 50,-25 default
var displayduration=0; //duration in seconds image should remain visible. 0 for always.
var currentimageheight = 320; // maximum image size.
var previewwidth = currentimageheight + 45;
var prev_h;
var prev_w;

var dnd_thm_loc;
var dnd_big_thm_loc;
var dnd_hoid;

var lbx_items = [];
var num_lbx_items = 0;
var last_lbx_item = null;
var start_lbx_item = null;

/*function lbx_item(o,thm,thl,h,n,p) {
    this.oid = o;
    this.thmloc = thm;
    this.thlloc = thl;
    this.hoid = h;
    this.added = false;
    this.deleted = false;
    this.prev=p;
    this.next=n;
}*/

/*function js_add_to_lbx(n,tloc,btloc,hoid){

    var this_lbx_item=lbx_items.length;
    if(start_lbx_item == null) start_lbx_item=this_lbx_item;
    
    lbx_items[lbx_items.length++]= new lbx_item(n,tloc,btloc,hoid,last_lbx_item,null);
    if(last_lbx_item != null) lbx_items[last_lbx_item].next=this_lbx_item;
    last_lbx_item=this_lbx_item;
    return(lbx_items[this_lbx_item]);
}

function add_to_lbx(n,tloc,btloc,hoid){

    var lbxfloater = window.frames['lbxframe'];
    var list = lbxfloater.document.forms.lightbox.lbx;

    if(n == "undefined") return;

    if(lbxfloater.document.forms.lightbox.lightbox_total.value >= 48){
        alert("Your light box is full. No more items can be added.");
        return;
    }


    lbxfloater.document.forms.lightbox.action.value = 'add';
    lbxfloater.document.forms.lightbox.OBJECT_ID.value = n;
    lbxfloater.document.forms.lightbox.THM_URI_1.value = tloc;
    lbxfloater.document.forms.lightbox.THM_URI_2.value = btloc;
    lbxfloater.document.forms.lightbox.lastitemadded.value = n;
    //lbxfloater.document.forms.lightbox.lbxpage.value = lbxfloater.document.forms.lightbox.lbxlastpage.value;
    lbxfloater.document.forms.lightbox.submit();
}
*/
function getprevobj(o){

    if (document.getElementById)
        return document.getElementById(o).style
    else if (document.all)
        return document.all.o.style
}

function getprevobjnostyle(o){

    if (document.getElementById)
        return document.getElementById(o)
    else if (document.all)
        return document.all.o
}

function getObjectByName(n){
    alert(n);

    return(document.getElementsByTagName(n)[0].firstChild);
}

function truebody(){
   return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function showPreview(imageSrc, h, w){

   
        prev_h = h;
        prev_w = w;
		preview = '<img src="'+ imageSrc + '"/>';
        /*newHTML = '<div style="padding: 5px; background-color: #FFF; border: 1px solid #888; width: ' + previewwidth + 'px;">';
        newHTML = newHTML + '<div align="center" style="padding: 8px 2px 8px 2px;"><img src="' + imagesrc + '" border="0"></div>';
        newHTML = newHTML + '</div>';*/
		newDiv = '<div style=" padding:5px ; background-color: #FFF; border: 1px solid #888; "  >' + preview + '</div>';
        getprevobjnostyle("frame").innerHTML = newDiv;
        setTimeout('getprevobj("frame").display="block"',400);
        document.onmousemove=followmouse;
   // }

}
        //newHTML = newHTML + '<font style="color:#666" class="small"></b>' + brand + '</b></font><br>';
        //newHTML = newHTML + '<center><font style="color:#666" class="small">Image# ' + oid + '</font></center>';
        //newHTML = newHTML + '<center><font style="color:#666" class="small">Image# ' + brand + '</font></center>';


function hidePreview(){

    //if(document.advsearch.showpreviews.selectedIndex == 0 && document.advsearch.dragging.value == 0){
        getprevobj("frame").display="none";
        getprevobj("frame").left="-1500px";
        document.onmousemove="";
   // }
}

function followmouse(e){

    var xcoord=offsetfrommouse[0]
    var ycoord=offsetfrommouse[1]

		//var x = e.pageX != undefined ? e.pageX : event.clientX
		//var y = e.pageY != undefined ? e.pageY : event.clientY

	var flip_loc_x = 445 // When we get to loc clientWidth - 445 then move the preview to the left of the cursor
	var left_space = 60 // close the gap when we move the preview to the left of the cursor
    var flip_loc_y = 20
	var scrolltop=0

  //  if(document.advsearch.dragging.value == 1) return;

    if(getprevobjnostyle('aspnetForm').scrollTop)
        scrolltop=getprevobjnostyle('aspnetForm').scrollTop
    else
        scrolltop=truebody().scrollTop

   /* if (document.forms.advsearch.toggle_lightbox.value == 1)
        flip_loc_y = 100
    else
        flip_loc_y = 200*/

	var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-15

	//var docheight=document.all? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(document.body.offsetHeight, window.innerHeight)
    var docheight=document.all? truebody().clientHeight : window.innerHeight

    if (typeof e != "undefined"){
		
		//document.getElementById("control").innerHTML = 	 "windWidth :"+ docwidth +",<br/> windHeight :"+ docheight+",<br/>pictW : "+prev_w +",<br/> pictH : "+ prev_h  + "<br/> x ="+ e.pageX + ", y = " + e.pageY +",<br/> scrollTop :" + scrolltop;
		
		
        if (docwidth - e.pageX < (prev_h + 30) ){			
			xcoord = e.pageX - prev_h - 25;			
        } else {			
            xcoord = e.pageX + 15 ;			
        }
		
       /* if (docheight - e.pageY - 15 < (prev_h + flip_loc_y )){			
            ycoord += e.pageY - Math.max(0,(flip_loc_y + prev_h + e.pageY - docheight - scrolltop)) ;			
        } else {
            ycoord = e.pageY + 15 ;
        }*/

		ycoord = e.pageY - (prev_h/2);

    } else if (typeof window.event != "undefined"){
				
        if ((docwidth - event.clientX) < prev_h + 30){ 		
            xcoord = event.clientX - prev_h - 25 ; 
        } else {
            xcoord = event.clientX + truebody().scrollLeft + 15; 
        }
		
        /*if ((docheight - event.clientY - 15) < (prev_h + flip_loc_y)){            
			ycoord = event.clientY - Math.max(0,(flip_loc_y + prev_h + event.clientY - docheight - scrolltop ));
        } else {			
            ycoord = event.clientY + 15 + scrolltop ;
		}*/
		ycoord = event.clientY - (prev_h/2) + scrolltop;
		
		//document.getElementById("control").innerHTML = 	 "windWidth :"+ docwidth +",<br/> windHeight :"+ docheight+",<br/>pictW : "+prev_w +",<br/> pictH : "+ prev_h  + "<br/> x ="+ event.clientX + ", y = " + event.clientY +",<br/> scrollTop :" + scrolltop +",<br/> scrollLeft :" + truebody().scrollLeft +",<br/> xcoord :" + xcoord +",<br/> ycoord :" + ycoord;
		
    }

    var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-15
    var docheight=document.all? Math.max(truebody().scrollHeight, truebody().clientHeight) : Math.max(document.body.offsetHeight, window.innerHeight)


		getprevobj("frame").left=xcoord+"px"
		getprevobj("frame").top=ycoord+"px"
		//getprevobj("frame").left = x - 150
		//getprevobj("frame").top = y - 70
		

}


