function windowOpen(url,width,height,name,top,left,resizable,menubar,titlebar,toolbar,scrollbars,status,location,fullscreen,directories,channelmode){
	var spec=''; var win; var i;
	var p=['url','width','height','name','top','left','resizable','menubar','titlebar','toolbar','scrollbars','status','location','fullscreen','directories','channelmode'];
	if(!name) name='win';
	if(!width) width=800;
	if(!height) height=600;
	if(!top && top!=0){
		top=(screen.height-height)/2;
		if(top<0) top=0;
	}
	if(!left && left!=0){
		left=(screen.width-width)/2;
		if(left<0) left=0;
	}
	spec='width='+width+',height='+height+',top='+top+',left='+left;
	for(i=5;i<arguments.length;i++){
		if(arguments[i]!=null && arguments[i]!='') spec+=','+p[i]+'='+arguments[i];
	}
	win=window.open(url,name,spec);
	win.focus();
	return win;
}

function previewImg(src,width,height,e){
    var h=0; var w=1020;
    var img=document.getElementById('imgDetail');
    var c=getPosition(e);
    img.src=src;
    if(window.innerWidth){
        w=window.innerWidth;
    }else if(document.body.clientWidth){
        w=document.body.clientWidth;
    }
    h=c.y-(height/2);
    if(h<0) h=0;
    w=(w-width)/2;
    if(w<0) w=0;
    img.style.top=h + 'px';
    img.style.left=w + 'px';
    img.style.display='block';
    
}

function getPosition(e) {
    e = e || window.event;
    var cursor = {x:0, y:0};
    if (e.pageX || e.pageY) {
        cursor.x = e.pageX;
        cursor.y = e.pageY;
    }
    else {
        var de = document.documentElement;
        var b = document.body;
        cursor.x = e.clientX +
            (de.scrollLeft || b.scrollLeft) - (de.clientLeft || 0);
        cursor.y = e.clientY +
            (de.scrollTop || b.scrollTop) - (de.clientTop || 0);
    }
    return cursor;
}

