/*******************************************************************************************************
* ÇÁ¸®ºä À̹ÌÁö ·¹À̾î
* »ç¿ë¹ý (#Ç¥½Ã´Â Çʼö)
º¸À̱â : ShowPreView(#À̹ÌÁöÄÚµå, ȸ»çÄÚµå, ŸÀÌƲ, ¼³¸í, #»ç¿ë°ª, #°¡·Î»çÀÌÁî, #¼¼·Î»çÀÌÁî, ÄíÅ°»ç¿ë¿©ºÎ, #À̹ÌÁöÁÖ¼Ò);
¼û±â±â : HidePreView();
/common/default.css ÀÇ [#trailimageid] ºÎºÐ Çʼö ÂüÁ¶.
ÄíÅ° »ç¿ë ½Ã republic.js¿¡ Ãß°¡ÇÑ set_cookie, get_cookie »ç¿ë Çʼö ÂüÁ¶.
*******************************************************************************************************/
var offsetfrommouse=[15, -15]; //image x,y offsets from cursor position in pixels. Enter 0,0 for no offset
var currentimagewidth = 600; // maximum image width.
var currentimageheight = 400; // maximum image height.
var nowPreviewPath = "";
if (document.getElementById || document.all) {
document.write('
');
document.write('
');
}
if (document.getElementById || document.all) {
document.write('');
}
function getshimobj() {
if (document.getElementById) return document.getElementById("DivShim").style
else if (document.all) return document.all.DivShim.style
}
function gettrailobj() {
if (document.getElementById) return document.getElementById("trailimageid").style
else if (document.all) return document.all.trailimagid.style
}
function getshimobjnostyle() {
if (document.getElementById) return document.getElementById("DivShim")
else if (document.all) return document.all.DivShim
}
function gettrailobjnostyle() {
if (document.getElementById) return document.getElementById("trailimageid")
else if (document.all) return document.all.trailimagid
}
function truebody() {
return (!window.opera && document.compatMode && document.compatMode!="BackCompat") ? document.documentElement : document.body;
}
function ShowPreView(imageCd, CompanyId, title, description, showpreview, width, height, ck, PreviewUrl) {
if (ck == "yes") {
if (showpreview <= 0 || get_cookie("user_preview") != "yes") return;
} else {
if (showpreview <= 0) return;
}
nowPreviewPath = PreviewUrl;
if (width == 0 && height == 0) {
var pv = new Image();
pv.src = nowPreviewPath;
currentimagewidth = pv.width;
currentimageheight = pv.height;
} else {
if (width > 0) { currentimagewidth = width; }
if (height > 0) { currentimageheight = height; }
}
document.getElementById("trailimageid").style.display = "";
document.onmousemove=followmouse;
newHTML = '';
newHTML = newHTML + '
';
newHTML = newHTML + '';
newHTML = newHTML + ' ';
newHTML = newHTML + '';
newHTML = newHTML + ' |
';
gettrailobjnostyle().innerHTML = newHTML;
gettrailobj().visibility="visible";
}
function HidePreView() {
gettrailobj().visibility = "hidden";
getshimobj().visibility = "hidden";
document.onmousemove="";
gettrailobj().left="-1000px";
}
var getNowScroll = function() {
var de = document.documentElement;
var b = document.body;
var now = {};
now.X = document.all ? (!de.scrollLeft ? b.scrollLeft : de.scrollLeft) : (window.pageXOffset ? window.pageXOffset : window.scrollX);
now.Y = document.all ? (!de.scrollTop ? b.scrollTop : de.scrollTop) : (window.pageYOffset ? window.pageYOffset : window.scrollY);
return now;
}
function followmouse(e) {
// À̹ÌÁö »çÀÌÁî Çѹø´õ üũ
if (currentimagewidth == 0 || currentimageheight == 0) {
var pv = new Image();
pv.src = nowPreviewPath;
currentimagewidth = pv.width;
currentimageheight = pv.height;
}
var xcoord=offsetfrommouse[0];
var ycoord=offsetfrommouse[1];
var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-15;
var docheight=document.all? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(window.innerHeight);
obj = document.getElementById("listPhoto_Box");
if (typeof e != "undefined") {
var inBodytop = getObjectTop(obj) - getNowScroll().Y;
var inBodyleft = getObjectLeft(obj) - getNowScroll().X;
// width
if (e.pageX > currentimagewidth)
{ // to left
xcoord = e.pageX - inBodyleft - currentimagewidth - 55;
}
else
{
xcoord = e.pageX - inBodyleft + 20;
}
// height
if ((e.pageY - getNowScroll().Y) > currentimageheight + 50)
{ // to Top
ycoord = (e.pageY - getNowScroll().Y) - inBodytop - currentimageheight - 55;
}
else if((docheight - (e.pageY - getNowScroll().Y)) > currentimageheight + 100)
{ // to Down
ycoord = (e.pageY - getNowScroll().Y) - inBodytop + 20;
}
else
{ // to Middle
if (inBodytop >= 0)
{
ycoord = 50 - inBodytop;
}
else
{
ycoord = Math.abs(inBodytop) + 50;
}
}
} else if (typeof window.event != "undefined") {
var inBodytop = getObjectTop(obj) - document.body.scrollTop;
var inBodyleft = getObjectLeft(obj) - document.body.scrollLeft;
// width
if (event.clientX > currentimagewidth)
{ // to left
xcoord = event.clientX - inBodyleft - currentimagewidth - 55;
}
else
{
xcoord = event.clientX - inBodyleft + 20;
}
// height
if (event.clientY > currentimageheight + 50)
{ // to Top
ycoord = event.clientY - inBodytop - currentimageheight - 55;
}
else if((docheight - event.clientY) > currentimageheight + 100)
{ // to Down
ycoord = event.clientY - inBodytop + 20;
}
else
{ // to Middle
if (inBodytop >= 0)
{
ycoord = 50 - inBodytop;
}
else
{
ycoord = Math.abs(inBodytop) + 50;
}
}
}
gettrailobj().left=xcoord+"px";
gettrailobj().top=ycoord+"px";
getshimobj().top = gettrailobj().top;
getshimobj().left = gettrailobj().left;
getshimobjnostyle().width = gettrailobjnostyle().offsetWidth;
getshimobjnostyle().height = gettrailobjnostyle().offsetHeight;
getshimobj().zIndex = gettrailobj().zIndex - 1;
getshimobj().visibility = "visible";
/*
//Value test
alr_str = "ÇöÀçȸé w : "+docwidth+"n";
alr_str += "ÇöÀçȸé h : "+docheight+"n";
alr_str += "À̹ÌÁö w : "+currentimagewidth+"n";
alr_str += "À̹ÌÁö h : "+currentimageheight+"n";
alr_str += "¸¶¿ì½ºÀ§Ä¡ x : "+e.pageX+"n";
alr_str += "¸¶¿ì½ºÀ§Ä¡ y : "+e.pageY+"n";
alr_str += "½ºÅ©·Ñ x : "+getNowScroll().X+"n";
alr_str += "½ºÅ©·Ñ y : "+getNowScroll().Y+"n";
alr_str += "¾ÈÂÊ·¹À̾î x : "+getObjectLeft(obj)+"n";
alr_str += "¾ÈÂÊ·¹À̾î y : "+getObjectTop(obj)+"n";
alr_str += "inBody x : "+inBodyleft+"n";
alr_str += "inBody y : "+inBodytop+"n";
alr_str += "»Ñ·ÁÁö´Â À§Ä¡ x : "+xcoord+"n";
alr_str += "»Ñ·ÁÁö´Â À§Ä¡ y : "+ycoord+"n";
alert(alr_str);
*/
xcoord = 0;
ycoord = 0;
inBodytop = 0;
inBodyleft = 0;
}
function getObjectTop(obj)
{
if( obj == null) return 0;
if(obj.offsetParent == document.body)
return obj.offsetTop;
else
return obj.offsetTop + getObjectTop(obj.offsetParent);
}
function getObjectLeft(obj)
{
if( obj == null) return 0;
if(obj.offsetParent == document.body)
return obj.offsetLeft;
else
return obj.offsetLeft + getObjectLeft(obj.offsetParent);
}
function getPreviewPath(originalRequest)
{
//put returned XML in the textarea
nowPreviewPath = originalRequest.responseText;
}