// Flash Embed
function flash(url,w,h,id,bg,vars,win,allow){

var flashStr=
"<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0' width='"+w+"' height='"+h+"' id='"+id+"' align='middle'>"+
"<param name='allowScriptAccess' value='"+allow+"' />"+
"<param name='movie' value='"+url+"' />"+
"<param name='FlashVars' value='"+vars+"' />"+
"<param name='wmode' value='"+win+"' />"+
"<param name='menu' value='false' />"+
"<param name='quality' value='high' />"+
"<param name='bgcolor' value='"+bg+"' />"+
"<embed src='"+url+"' FlashVars='"+vars+"' wmode='"+win+"' menu='false' quality='high' bgcolor='"+bg+"' width='"+w+"' height='"+h+"' name='"+id+"' align='middle' allowScriptAccess='"+allow+"' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"+
"</object>";

document.write(flashStr);
}

// Current URL
function currentUrl() {
	URL=document.URL
	document.write(URL);
}

// Popup Open
function popOpen(url, t, w, h, s) {
	var sw;
	var sh;
	sw = (screen.Width - w) / 2;
	sh = (screen.Height - h) / 2;
	window.open(url, t, 'Width='+w+'px, Height='+h+'px, Left='+sw+', Top='+sh+', scrollbars='+s);
}



// 탑메뉴
function topmenuVIew(id) {

	for(var num=1; num<=5; num++) document.getElementById('gnb0'+num).style.visibility='hidden'; //모든 서브메뉴를 숨긴 다음
	document.getElementById(id).style.visibility='visible'; //해당 ID만 보임
}

function menuShow(imgName,num,subTotal) {

	var img_path = "/07momnbaby/images/nav/";
	var mnImg = document.getElementById(imgName+"_"+num);
	for(var i=1; i<=subTotal; i++) {
		var allImgs = document.getElementById(imgName+"_"+i);
		allImgs.src = img_path+imgName+"_"+i+"_or.png";
	}
	mnImg.src = img_path+imgName+"_"+num+"_on.png";

}

function ImgShowHide(imgEl,chk,nowPage) {
	
	var thisImg = document.getElementById(imgEl);
	
	if (chk != "hide"){
		thisImg.src = thisImg.src.replace("_or.png", "_on.png");
		
	} else {
		if (imgEl != nowPage){
			thisImg.src = thisImg.src.replace("_on.png", "_or.png");
			
		}
	}
}

function ImgShowHide1(imgEl,chk,nowPage) {
	
	var thisImg = document.getElementById(imgEl);
	
	if (chk != "hide"){
		thisImg.src = thisImg.src.replace("_or.gif", "_on.gif");
		
	} else {
		if (imgEl != nowPage){
			thisImg.src = thisImg.src.replace("_on.gif", "_or.gif");
			
		}
	}
}



// Tab Navigation
function initTabMenu(tabContainerID) {
	var tabContainer = document.getElementById(tabContainerID);
	var tabAnchor = tabContainer.getElementsByTagName("a");
	var i = 0;

	for(i=0; i<tabAnchor.length; i++) {
		var thismenu;
		var currentmenu;
		if (tabAnchor.item(i).className == "tab"){
			thismenu = tabAnchor.item(i);
		}
			
		else{
			continue;
		}
		thismenu.container = tabContainer;
		thismenu.targetEl = document.getElementById(tabAnchor.item(i).href.split("#")[1]);
		thismenu.targetEl.style.display = "none";
		thismenu.imgEl = thismenu.getElementsByTagName("img").item(0);
		thismenu.onclick = function tabMenuClick() {
			currentmenu = this.container.current;
			if (currentmenu == this)
				return false;

			if (currentmenu) {
				currentmenu.targetEl.style.display = "none";
				if (currentmenu.imgEl) {
					currentmenu.imgEl.src = currentmenu.imgEl.src.replace("_on.gif", "_or.gif");
				} else {
					currentmenu.className = currentmenu.className.replace(" on", "");
				}
			}
			this.targetEl.style.display = "block";
			if (this.imgEl) {
				this.imgEl.src = this.imgEl.src.replace("_or.gif", "_on.gif");
			} else {
				this.className += " on";
			}
			this.container.current = this;
			
			return false;
		};

		if (!thismenu.container.first)
			thismenu.container.first = thismenu;
	}
	if (tabContainer.first)
		tabContainer.first.onclick();
}


// top스크롤

function initMoving(target) {
	if (!target){
		return ;
	}
	var obj = target;
	obj.initTop = 530;
	obj.initLeft = 943;
	obj.bottomLimit = document.documentElement.scrollHeight;
	obj.topLimit = 260;

	obj.style.position = "absolute";
	obj.top = obj.initTop;
	obj.left = obj.initLeft;
	obj.style.top = obj.top + "px";
	obj.style.left = obj.left + "px";

	obj.getTop = function() {
		if (document.documentElement.scrollTop) {
			return document.documentElement.scrollTop;
		} else if (window.pageYOffset) {
			return window.pageYOffset;
		} else {
			return 0;
		}
	}
	obj.getHeight = function() {
		if (self.innerHeight) {
			return self.innerHeight;
		} else if(document.documentElement.clientHeight) {
			return document.documentElement.clientHeight;
		} else {
			return 600;
		}
	}
	obj.move = setInterval(function() {
		var pos = obj.getTop() + obj.getHeight() / 7;

		if (pos > obj.bottomLimit)
			pos = obj.bottomLimit
		if (pos < obj.topLimit)
			pos = obj.topLimit

		var interval = obj.top - pos;
		obj.top = obj.top - interval / 3;
		obj.style.top = obj.top + "px";
	}, 40)
}


// 메인 상담 tab 
//tabChange 
function tabChange2(obj,num,imgId,total) {
		
    for (i=1; i<=total; i++)    {
        var imgIds = document.getElementById(imgId+i);
        var imgSrc = imgIds.getAttribute("src");

		//var hIds = document.getElementById (hId+i);
        if (i==num)    {
            document.getElementById(obj+i).style.visibility= 'visible';
            imgIds.setAttribute("src",imgSrc.replace("_or","_on"));
			//if(hIds){hIds.className = "on";}
        }
        else {
            document.getElementById(obj+i).style.visibility = 'hidden';
            imgIds.setAttribute("src",imgSrc.replace("_on","_or"));
			//if(hIds){hIds.className = "";}
        }
    }
}





