// 백그라운드 이미지 로딩
try {document.exeCommand('BackgroundImageCashe', false, true);} catch (e) {}

// png 파일 투명 처리 
function setPng24(obj) {
    obj.width=obj.height=1;
    obj.className=obj.className.replace(/\bpng24\b/i,'');
    obj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src +"',sizingMethod='image');"
    obj.src='';
    return '';
}

// 이미지 오버 
function imageOver(imgs) {
	imgs.src = imgs.src.replace("dw.gif", "ov.gif");
}
function imageOut(imgs) {
	imgs.src = imgs.src.replace("ov.gif", "dw.gif");
}
function imageClick(imgs) {
	imgs.src = imgs.src.replace("dw.gif", "ov.gif");
}

// 플래시
function flashString(mID, mUrl, mWidth, mHeight, mParams, mBGcolor, mWmode) {
	var buff = [];
	buff.push("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='" + mWidth + "' height='" + mHeight + "' id='" + mID + "' align='middle'>");
	buff.push("<param name='allowScriptAccess' value='always' />");
	buff.push("<param name='allowFullScreen' value='true' />");
	buff.push("<param name='movie' value='" + mUrl + "' />");
	buff.push("<param name='FlashVars' value='" + mParams + "' />");
	buff.push("<param name='quality' value='high' />");
	buff.push("<param name='wmode' value='" + mWmode + "' />");
	buff.push("<param name='bgcolor' value='" + mBGcolor + "' />");
	buff.push("<embed src='" + mUrl + "' FlashVars='" + mParams + "' quality='high' wmode='" + mWmode + "' bgcolor='" + mBGcolor + "' width='" + mWidth + "' height='" + mHeight + "' name='" + mID + "' align='middle' allowScriptAccess='always' allowFullScreen='false' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />");
	buff.push("</object>");
	
	return buff.join("");
}

function flashObject(mID, mUrl, mWidth, mHeight, mParam, mBGcolor, mWmode) {
	document.write(flashString(mID, mUrl, mWidth, mHeight, mParam, mBGcolor, mWmode));
}

// 오버탭
function imageOverTab(imgs) {
	imgs.src = imgs.src.replace("off.gif", "over.gif");
}
function imageOutTab(imgs) {
	imgs.src = imgs.src.replace("over.gif", "off.gif");
}


/* 글자 확대 축소
----------------------------------------------------------------------------------------*/

var nowZoom = 100; // 현재비율 
var maxZoom = 500; // 최대비율(500으로하면 5배 커진다) 
var minZoom = 80; // 최소비율

//화면 키운다. 
function zoomIn() 
{
	var loca1 = document.getElementById("wrapper");

    if (nowZoom < maxZoom) 
    { 
        nowZoom += 10; //25%씩 커진다. 
    } 
    else 
    { 
        return; 
    } 
    loca1.style.zoom = nowZoom + "%";

   

		
} 

//화면 줄인다. 
function zoomOut() 
{ 
	var loca1 = document.getElementById("wrapper");

    if (nowZoom > minZoom) 
    { 
        nowZoom -= 10; //25%씩 작아진다. 
    } 
    else 
    { 
        return; 
    } 
    loca1.style.zoom = nowZoom + "%";

 

		
}

function zoomDefault() 
{ 
	var loca1 = document.getElementById("wrapper");
	nowZoom = 100;
    loca1.style.zoom = nowZoom + "%";


		
}	


function showPic(whichpic) {
  if (!document.getElementById("placeholder")) return true;
  var source = whichpic.getAttribute("href");
  var placeholder = document.getElementById("placeholder");
  placeholder.setAttribute("src",source);
  if (!document.getElementById("description")) return false;
  if (whichpic.getAttribute("title")) {
    var text = whichpic.getAttribute("title");
  } else {
    var text = "";
  }
  var description = document.getElementById("description");
  if (description.firstChild.nodeType == 3) {
    description.firstChild.nodeValue = text;
  }
  return false;
}

function prepareGallery() {
  if (!document.getElementsByTagName) return false;
  if (!document.getElementById) return false;
  if (!document.getElementById("imagegallery")) return false;
  var gallery = document.getElementById("imagegallery");
  var links = gallery.getElementsByTagName("a");
  for ( var i=0; i < links.length; i++) {
    links[i].onclick = function() {
      return showPic(this);
	}
    links[i].onkeypress = links[i].onclick;
  }
}

function showPic2(whichpic) {
  if (!document.getElementById("placeholder2")) return true;
  var source = whichpic.getAttribute("href");
  var placeholder = document.getElementById("placeholder2");
  placeholder.setAttribute("src",source);
  if (!document.getElementById("description2")) return false;
  if (whichpic.getAttribute("title")) {
    var text = whichpic.getAttribute("title");
  } else {
    var text = "";
  }
  var description = document.getElementById("description2");
  if (description.firstChild.nodeType == 3) {
    description.firstChild.nodeValue = text;
  }
  return false;
}

function prepareGallery2() {
  if (!document.getElementsByTagName) return false;
  if (!document.getElementById) return false;
  if (!document.getElementById("imagegallery2")) return false;
  var gallery = document.getElementById("imagegallery2");
  var links = gallery.getElementsByTagName("a");
  for ( var i=0; i < links.length; i++) {
    links[i].onclick = function() {
      return showPic2(this);
	}
    links[i].onkeypress = links[i].onclick;
  }
}

function showPic3(whichpic) {
  if (!document.getElementById("placeholder3")) return true;
  var source = whichpic.getAttribute("href");
  var placeholder = document.getElementById("placeholder3");
  placeholder.setAttribute("src",source);
  if (!document.getElementById("description3")) return false;
  if (whichpic.getAttribute("title")) {
    var text = whichpic.getAttribute("title");
  } else {
    var text = "";
  }
  var description = document.getElementById("description3");
  if (description.firstChild.nodeType == 3) {
    description.firstChild.nodeValue = text;
  }
  return false;
}

function prepareGallery3() {
  if (!document.getElementsByTagName) return false;
  if (!document.getElementById) return false;
  if (!document.getElementById("imagegallery3")) return false;
  var gallery = document.getElementById("imagegallery3");
  var links = gallery.getElementsByTagName("a");
  for ( var i=0; i < links.length; i++) {
    links[i].onclick = function() {
      return showPic3(this);
	}
    links[i].onkeypress = links[i].onclick;
  }
}

function showPic4(whichpic) {
  if (!document.getElementById("placeholder4")) return true;
  var source = whichpic.getAttribute("href");
  var placeholder = document.getElementById("placeholder4");
  placeholder.setAttribute("src",source);
  if (!document.getElementById("description4")) return false;
  if (whichpic.getAttribute("title")) {
    var text = whichpic.getAttribute("title");
  } else {
    var text = "";
  }
  var description = document.getElementById("description4");
  if (description.firstChild.nodeType == 3) {
    description.firstChild.nodeValue = text;
  }
  return false;
}

function prepareGallery4() {
  if (!document.getElementsByTagName) return false;
  if (!document.getElementById) return false;
  if (!document.getElementById("imagegallery4")) return false;
  var gallery = document.getElementById("imagegallery4");
  var links = gallery.getElementsByTagName("a");
  for ( var i=0; i < links.length; i++) {
    links[i].onclick = function() {
      return showPic4(this);
	}
    links[i].onkeypress = links[i].onclick;
  }
}

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

addLoadEvent(prepareGallery);

$(function() {
	$('.pinkDl dd:last').css('margin-bottom','0');
});

