﻿//평면정보 글씨 클릭시 이미지 변하기//
var changeCam = function(imgSrc, index){
		$jq("#camMainImg").attr("src", imgSrc);
		$jq("a[id^='no0'][class*='selected']").removeClass("selected");
		$jq("a[id='no0"+index+"']").addClass("selected");
	};

// 이미지 클릭시 내용(영역) 변하기 //
var changeCon = function(index){
		$jq("dl[id^='adTv']").css("display","none");
		$jq("dl[id='adTv"+index+"']").css("display","block");
		$jq("a[id^='no0'][class*='selected']").removeClass("selected");
		$jq("a[id='no0"+index+"']").addClass("selected");
	};

// 이미지 클릭시 내용(영역) 변하기 //
var changeWhatis = function(index){
		$jq("div[id^='whatis']").css("display","none");
		$jq("div[id='whatis"+index+"']").css("display","block");
		$jq("a[id^='no0'][class*='selected']").removeClass("selected");
		$jq("a[id='no0"+index+"']").addClass("selected");
	};


// 이미지 오버
function imageOver(imgs) {
	imgs.src = imgs.src.replace(".gif", "on.gif");
}
function imageOut(imgs) {
	imgs.src = imgs.src.replace("on.gif", ".gif");
}

// 이미지 점선 없애기 // 11월 13일 추가
//function bluring(){
//	if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG")document.body.focus();
//}
//document.onfocusin=bluring;

// 알파그린 top 메뉴 //
function agreenTab(num) {
	for (i=1;i<5;i++) {
		if (num == i) {
			document.getElementById('agreen0'+i+'').style.display='block';
			document.getElementById('agreenimg0'+i+'').src = "/images/aGreen/common/h_mn0"+i+"_on.gif";
		} else {
			document.getElementById('agreen0'+i+'').style.display='none';
			document.getElementById('agreenimg0'+i+'').src = "/images/aGreen/common/h_mn0"+i+".gif";
		}
	}
}

// 특장점 tab //
function forteTab(num) {
	for (i=1;i<5;i++) {
		if (num == i) {
			document.getElementById('forte0'+i+'').style.display='block';
			//document.getElementById('forteimg0'+i+'').src = "/images/service/service_vtml_tab0"+i+"_on.gif";
		} else {
			document.getElementById('forte0'+i+'').style.display='none';
			//document.getElementById('forteimg0'+i+'').src = "/images/service/service_vtml_tab0"+i+"_off.gif";
		}
	}
}

// 비타민 라이프 tab //
function vtmlTab1(num) {
	for (i=1;i<4;i++) {
		if (num == i) {
			document.getElementById('vtml0'+i+'').style.display='block';
			document.getElementById('vtmlimg0'+i+'').src = "/images/service/service_vtml_tab0"+i+"_on.gif";
		} else {
			document.getElementById('vtml0'+i+'').style.display='none';
			document.getElementById('vtmlimg0'+i+'').src = "/images/service/service_vtml_tab0"+i+"_off.gif";
		}
	}
}

//수상내역 tab //
function yearTab(num) {
	for (i=1;i<6;i++) {
		if (num == i) {
			document.getElementById('year0'+i+'').style.display='block';
			document.getElementById('yearimg0'+i+'').src = "/images/brand/award_year_0"+i+"_on.gif";
		} else {
			document.getElementById('year0'+i+'').style.display='none';
			document.getElementById('yearimg0'+i+'').src = "/images/brand/award_year_0"+i+".gif";
		}
	}
}

//수상내역 tab //
function yearTab1(num) {
	for (i=1;i<7;i++) {
		if (num == i) {
			document.getElementById('year0'+i+'').style.display='block';
			document.getElementById('yearimg0'+i+'').src = "/images/brand/award_year_"+ parseInt(2012-i) + "_on.gif";
		} else {
			document.getElementById('year0'+i+'').style.display='none';
			document.getElementById('yearimg0'+i+'').src = "/images/brand/award_year_"+ parseInt(2012-i) + ".gif";
		}
	}
}

// 브랜드 홍보 tab //
function adTvTab(num) {
	for (i=1;i<12;i++) {
		if (num == i) {
			document.getElementById('adTv'+i+'').style.display='block';
			//document.getElementById('adTvLine'+i+'').style.border ='#e31b38 1px solid';
		} else {
			document.getElementById('adTv'+i+'').style.display='none';
			//document.getElementById('adTvLine'+i+'').style.border ='#e31b38 1px solid';
		}
	}
}

// 행복creator란 tab //
function hcIntroTab(num) {
	for (i=1;i<5;i++) {
		if (num == i) {
			document.getElementById('hcIntro0'+i+'').style.display='block';
			document.getElementById('hcIntroimg0'+i+'').src = "/images/brand/hcIntroTab0"+i+"_on.gif";
		} else {
			document.getElementById('hcIntro0'+i+'').style.display='none';
			document.getElementById('hcIntroimg0'+i+'').src = "/images/brand/hcIntroTab0"+i+".gif";
		}
	}
}

// sk view logo tab //
function logoTab(num) {
	for (i=1;i<3;i++) {
		if (num == i) {
			document.getElementById('logo0'+i+'').style.display='block';
			document.getElementById('logoimg0'+i+'').src = "/images/brand/logoTab0"+i+"_on.gif";
		} else {
			document.getElementById('logo0'+i+'').style.display='none';
			document.getElementById('logoimg0'+i+'').src = "/images/brand/logoTab0"+i+".gif";
		}
	}
}

// SK VIEW 토크 tab //
function viewTalkTab(num) {
	for (i=1;i<4;i++) {
		if (num == i) {
			document.getElementById('viewTalk0'+i+'').style.display='block';
			document.getElementById('viewTalkimg0'+i+'').src = "/images/brand/h_viewTalk0"+i+"_on.gif";
		} else {
			document.getElementById('viewTalk0'+i+'').style.display='none';
			document.getElementById('viewTalkimg0'+i+'').src = "/images/brand/h_viewTalk0"+i+".gif";
		}
	}
}

// 팝업창 시작 //
function popup(url,width,height,scroll) {
	window.open(url,"_blank", "location=no,resizable=no,status=no,toolbar=no,menubar=no,width="+width+",height="+height+",scrollbars="+scroll);
}
// 팝업창 종료 //

/***** 지도확인 팝업창 시작 - 모델하우스 *****/
function popupMapConfirm(url,name,forX,forY,width,height,scroll) {
	if(forX == ''||forY == '') {
		alert('좌표를 입력해 주세요');
	} else {
		window.open(url+"?name="+name+"&mapX="+forX+"&mapY="+forY,"_blank", "location=no,resizable=no,status=yes,toolbar=no,menubar=no,width="+width+",height="+height+",scrollbars="+scroll);
	}
}
/***** 지도확인 팝업창 종료 - 모델하우스 *****/

// 플래시 //
function swf_include(swfUrl,swfId,swfWidth,swfHeight,flashVars){

	var flashStr=
		"<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='"+swfWidth+"' height='"+swfHeight+"' id='"+swfId+"' />"+
		"<param name='movie' value='"+swfUrl+"' />"+
		"<param name='FlashVars' value='"+flashVars+"' />"+
		"<param name='allowScriptAccess' value='always' />"+
		"<param name='allowFullScreen' value='true' />"+
		"<param name='wmode' value='transparent' />"+
		"<param name='loop' value='false' />"+
		"<param name='quality' value='high' />"+
		"<param name='scale' value='noscale' />"+
		"<param name='bgcolor' value='#ffffff' />"+
		"<embed src='"+swfUrl+"' id='"+swfId+"' width='"+swfWidth+"' height='"+swfHeight+"' FlashVars='"+flashVars+"' quality='high' wmode='transparent' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"+
		"</object>";

	document.write(flashStr);

};


// 플래시 높이 조절
function lnbHeightResize(heightNum){

	document.getElementById('lnb').style.height = heightNum + 'px';

};

// 플래시 높이 조절
	function gnbHeightResize(heightNum){
		
	document.getElementById('header').style.height = heightNum + 'px';

};


// contents 와 left 의 높이 맞추기..
function getHeight(id) {
var el = document.getElementById(id).offsetHeight;
 document.getElementById('snb').style.height = el + "px";
}


//팝업중앙 뛰우기
var win = null;
function win_pop(mypage,myname,w,h,scroll) {
  LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
  TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
  settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable=no';
  win = window.open(mypage,myname,settings);
}

//이미지 원하는 비율로
function doLoadImageFit(imgObject,dispWidth,dispHeight)
{
	var imgNew = new Image();

	imgNew.src = imgObject.src;

	var imgWidth = imgNew.width;
	var imgHeight = imgNew.height;

	if( imgWidth > 0 && imgHeight > 0 ) {
	var rateX = dispWidth / imgWidth;
	var rateY = dispHeight / imgHeight;

	var rate = (rateX < rateY) ? rateX:rateY;
	imgObject.style.width = rate * imgWidth;
	imgObject.style.height = rate * imgHeight;
} else {
	imgObject.style.width = dispWidth;
	imgObject.style.height = dispHeight;
	}
}

//상세검색
function typeCheck(type) {
	if("1" == type) {
		
		detail_serch_open.style.display = "none";
		detail_serch_close.style.display = "block";
		
	} else if("2" == type) {
		
		detail_serch_open.style.display = "block";
		detail_serch_close.style.display = "none";
		
	}
}

// footer 패밀리사이트 // 11월 13일추가
function set_submenu2(obj) {
	var nLeft,nTop
	ph = -39 // 서브메뉴 상단위치 조절
	nLeft = event.x - event.offsetX + document.body.scrollLeft;
	nTop = event.y - event.offsetY + document.body.scrollTop;

	eval(obj+".style").posLeft = nLeft + 3;
	eval(obj+".style").posTop = nTop + ph;
	eval(obj+".style").display='block';

}

function show_submenu2(obj) {
	eval(obj+".style").display='block';
}

function hide_submenu2(obj) {
	eval(obj+".style").display='none';
}

// footer 패밀리사이트 펼침 11월 13일추가
function set_submenu(obj) {
	var nLeft,nTop
	ph = -3// 서브메뉴 상단위치 조절
	nLeft = event.x - event.offsetX + document.body.scrollLeft;
	nTop = event.y - event.offsetY + document.body.scrollTop;

	eval(obj+".style").posLeft = nLeft - 2;
	eval(obj+".style").posTop = nTop + ph;
	eval(obj+".style").display='block';

}

function show_submenu(obj) {
	eval(obj+".style").display='block';
}

function hide_submenu(obj) {
	eval(obj+".style").display='none';
}

// 최신정보보기 //

function popupLayer(s,w,h)
{
 if (!w) w = 600;
 if (!h) h = 400;

 var pixelBorder = 3;
 var titleHeight = 12;
 w += pixelBorder * 2;
 h += pixelBorder * 2 + titleHeight;

 var bodyW = document.body.clientWidth;
 var bodyH = document.body.clientHeight;

 var posX = (bodyW - w) / 2;
 var posY = (bodyH - h) / 2;

 hiddenSelectBox('hidden');

 /*** 백그라운드 레이어 ***/
 var obj = document.createElement("div");
 with (obj.style){
  position = "absolute";
  zIndex = "40";
  left = 0+"px";
  top = 0+"px";
  width = "100%";
  height = document.body.scrollHeight+"px";
  backgroundColor = "#000000";
  filter = "Alpha(Opacity=80)";
  opacity = "0.5";
 }
 obj.id = "objPopupLayerBg";
 document.body.appendChild(obj);

 /*** 내용프레임 레이어 ***/
 var obj = document.createElement("div");
 with (obj.style){
  position = "absolute";
  zIndex = "50";
  left = posX + document.body.scrollLeft +"px";
  top = 70 +"px";
  width = w + "px";
  height = h + "px";
  backgroundColor = "#ffffff";
  border = "0px";
 }
 obj.id = "objPopupLayer";
 document.body.appendChild(obj);

 /*** 타이틀바 레이어 ***/
 var bottom = document.createElement("div");
 with (bottom.style){
  position = "absolute";
  width = w +"px";
  height = titleHeight+"px";
  left = 0 +"px";
  top = 0 + "px";
  padding = "0 0 0 0";
  textAlign = "right";
  color = "#ffffff";
  font = "bold 8pt tahoma; letter-spacing:0px";
  
 }
 bottom.innerHTML = "<a href='#' onclick='javascript:closeLayer();'><img src='/images/common/null.gif' alt='' height='30px' width='74px'/></a>";
 obj.appendChild(bottom);

 /*** 아이프레임 ***/
 var ifrm = document.createElement("iframe");
 with (ifrm.style){
  width = w +"px" ;
  height = h +"px" ;
  //border = "3 solid #000000";
 }
 ifrm.frameBorder = 0;
 ifrm.src = s;
 //ifrm.className = "scroll";
 obj.appendChild(ifrm);
}
function closeLayer()
{
 hiddenSelectBox('visible');
 _ID('objPopupLayer').parentNode.removeChild( _ID('objPopupLayer') );
 _ID('objPopupLayerBg').parentNode.removeChild( _ID('objPopupLayerBg') );
}
function hiddenSelectBox(mode)
{
 var obj = document.getElementsByTagName('select');
 for (i=0;i<obj.length;i++){
  obj[i].style.visibility = mode;
 }
}

function _ID(obj)

{ return document.getElementById(obj) }  


