// JavaScript Document
// 롤오버
(function($){
	
	$(function(){
		$(".roll_class").mouseover(function() {
			$(this).attr("src", $(this).attr("src").replace("off","on"));
		});
		$(".roll_class").mouseout(function() {
			$(this).attr("src", $(this).attr("src").replace("on","off"));
		});
	});
    
})(jQuery);

function openOnAir()
{
	window.open("/onair.html", "onair", "width=640, height=480, scrollbars=no, titlebar=no, status=no, resizable=no");
}

function movieFunc()
{
	var xmlDoc = null;
	
	if (window.ActiveXObject)
	{
		// IE용
		xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
	}
	else if (document.implementation.createDocument)
	{
		// Mozilla, Firefox, Opera, 기타 용
		xmlDoc = document.implementation.createDocument("", "", null);
	}
	else
	{
		alert("XML을 사용못하는 브라우저임");
	}
	
	if (xmlDoc != null)
	{
		
		xmlDoc.async = false;
		xmlDoc.load("/xml/movie_list.php");

		var x = xmlDoc.getElementsByTagName("list");
	
		for (var i=0; i<x.length; i++)
		{
			
			document.getElementById('movieIframe').src = x[i].getElementsByTagName("iframe")[0].childNodes[0].nodeValue;
		}
	}
}

function showLoginForm()
{
	//alert("1");
	document.getElementById("loginWindow").style.display = "block";
}

function showSignupForm()
{
	//alert("1");
	document.getElementById("signupWindow").style.display = "block";
}

function showSiteMap()
{
	document.getElementById("siteMap").style.zIndex = 100;
	
	setTimeout(function(){getMovie("sitemap_swf").startFunc();}, 0);
}

function hideSiteMap()
{
	document.getElementById("siteMap").style.zIndex = -1;
}

function getMovie(movieName)
{
	if (navigator.appName.indexOf("Microsoft") != -1)
	{
		return window[movieName];
	}
	else
	{
		return document[movieName];
	}
}

function logout()
{
	var url = current_url.setQuery('act','dispMemberLogout');
	location.href = url;
}

function onEnter()
{
	if (event.keyCode == 13)
	{
		procFilter(document.getElementById('commonLogin'), login);
	}
}

function popupPatient()
{
	window.open("/pages/patient.html", "patient", "width=775, height=600, top=50, left=50, toolbar=no, scrollbars=yes, menubar=no, status=no, directories=no"); 
}

function popupPersonal()
{
	window.open("/pages/personal.html", "personal", "width=775, height=600, top=50, left=50, toolbar=no, scrollbars=yes, menubar=no, status=no, directories=no"); 
}

function popupCopyright()
{
	window.open("/pages/copyright.html", "copyright", "width=775, height=600, top=50, left=50, toolbar=no, scrollbars=yes, menubar=no, status=no, directories=no"); 
}

function formationTab(num)
{
	var tab1 = document.getElementById('tab1');
	var tab2 = document.getElementById('tab2');
	var tab3 = document.getElementById('tab3');
	var tab4 = document.getElementById('tab4');
	var tab5 = document.getElementById('tab5');
	
	switch (num)
	{
		case 1:
			tab1.style.display = 'block';
			tab2.style.display = 'none';
			tab3.style.display = 'none';
			tab4.style.display = 'none';
			tab5.style.display = 'none';
			break;
		case 2:
			tab2.style.display = 'block';
			tab1.style.display = 'none';
			tab3.style.display = 'none';
			tab4.style.display = 'none';
			tab5.style.display = 'none';
			break;
		case 3:
			tab3.style.display = 'block';
			tab2.style.display = 'none';
			tab1.style.display = 'none';
			tab4.style.display = 'none';
			tab5.style.display = 'none';
			break;
		case 4:
			tab4.style.display = 'block';
			tab2.style.display = 'none';
			tab3.style.display = 'none';
			tab1.style.display = 'none';
			tab5.style.display = 'none';
			break;
		case 5:
			tab5.style.display = 'block';
			tab2.style.display = 'none';
			tab3.style.display = 'none';
			tab4.style.display = 'none';
			tab1.style.display = 'none';
			break;
	}
}
