//--------------- ³í¹® °Ë»ö ----------------
function Journal_Frm(vol,num)
{
	theForm = document.Journal_form;
	if(!theForm.mod.value)
	{
		if(theForm.year1.value !="" && theForm.year2.value !="")
		{
			if(theForm.year1.value > theForm.year2.value)
			{
				alert("¹ßÇà³âµµ°¡ Àß¸øÁöÁ¤µÇ¾ú½À´Ï´Ù!");
				theForm.year1.focus();
				return false;
			}
		}
	}
	else
	{
		theForm.Vol.value = vol;
		theForm.Num.value = num;
	}
/*
	if(!theForm.sub_box.checked && !theForm.aut_box.checked && !theForm.sos_box.checked && !theForm.key_box.checked && !theForm.pub_box.checked && !theForm.abs_box.checked)
	{
		alert("Ãâ·Â°á°ú¸¦ Àû¾îµµ ÇÑ°¡Áö´Â ¼±ÅÃÇÏ¼Å¾ß ÇÕ´Ï´Ù!");
		theForm.sub_box.focus();
		return false;
	}
	if(!radioCheck(theForm.sort))
	{
		alert("Á¤·Ä±âÁØÀ» ¼±ÅÃÇÏ¼Å¾ß ÇÕ´Ï´Ù!");
		theForm.sort[0].focus();
		return false;
	}
*/
	// ±ÇÈ£¼ö °Ë»ö°ú °°Àº ¸ðµâÀ» »ç¿ëÇÏ¹Ç·Î ±ÇÈ£¼ö°Ë»öÀº µû·Î –A´Ù.
	if(theForm.mod.value != "vol") {
		if (theForm.at[0].checked == true) {
			// ³»ºÎ°Ë»ö
			theForm.action = "list.html";
			theForm.submit();
		} else {
			// pubmedÀÏ¶§´Â term ¿¡ pubmedÇü½Ä Äõ¸®¹®À» »ý¼ºÇØ¾ß ÇÑ´Ù.
			var term_tmp = theForm.term.value; // ±âº» Äõ¸®¹® Journal of Veterinary Science [Journal Name]
			var key = theForm.key.value;
			var key_word =  theForm.key_word.value;
			var query_word;

			switch (key) {
				case "all" : query_word = key_word + " [ALL]"; break;
				case "title" : query_word = key_word + " [TI]"; break;
				case "author" : query_word = key_word + " [AU]"; break;
				case "keywords" : query_word = key_word + " [MA]"; break;
				case "abstract" : query_word = key_word + " [TIAB]"; break;
				default : query_word = ""; break;
			}

			// ³âµµ
			if (theForm.year1.value && theForm.year2.value) {
				year_word = theForm.year1.value + ":"+ theForm.year2.value +" [dp]";
				if (key_word == "") query_word = "";
			} else if (theForm.year1.value) {
				year_word = theForm.year1.value +" [dp]";
				if (key_word == "") query_word = "";
			} else {
				year_word = "";
			}
			// ±Ç¼ö
			if (theForm.Vol.value) {
				vol_word = theForm.Vol.value +" [VI]";
				if (key_word == "") query_word = "";
			} else {
				vol_word = "";
			}
			// È£¼ö
			if (theForm.Num.value) {
				num_word = theForm.Num.value +" [IP]";
				if (key_word == "") query_word = "";
			} else {
				num_word = "";
			}

			if (theForm.at[2].checked == true) {
				// pubmed ÀüÃ¼ - ±âº» ¼öÀÇÇÐÈ¸ Äõ¸®´Â Á¦¿Ü
				term_tmp = query_word + year_word + vol_word + num_word;
			} else {
				// pubmed ±âº» ¼öÀÇÇÐÈ¸ Äõ¸®
				term_tmp += " and (" + query_word + year_word + vol_word + num_word + ")";
			}

			theForm.term.value = term_tmp;
			theForm.action = "http://www.ncbi.nlm.nih.gov/sites/entrez";
			theForm.submit();
		}
	} else {
			theForm.action = "list.html";
			theForm.submit();
	}
}

//--------------- ±ÇÈ£¼öº° °Ë»ö ----------------
function Vol_Frm()
{
	window.location = "main.html?mod=vol";
}

//--------------- ÀüÃ¼ ¼±ÅÃ ----------------
function Allcheck()
{
	theForm = document.Journal_form;
	for( var i=0; i < theForm.elements.length; i++)
	{
		var check = theForm.elements[i];
		check.checked = true;
	}
	return;
}

//--------------- ÀüÃ¼ ¼±ÅÃ Ãë¼Ò ----------------
function Allnocheck()
{
	theForm = document.Journal_form;
	for( var i=0; i < theForm.elements.length; i++)
	{
		var check = theForm.elements[i];
		check.checked = false;
	}
	return;
}

//--------------- ¼±ÅÃ Ç×¸ñ º¸±â ----------------
function Select_check()
{
	var check_nums = document.Journal_form.elements.length;
	for(var i = 0; i < check_nums; i++)
	{
		var checkbox_obj = eval("document.Journal_form.elements[" + i + "]");
		if(checkbox_obj.checked == true)
		{
			 break;
		}
	}

	if(i == check_nums)
	{
		alert("No Select.");
		return;
	}
	else
	{
		document.Journal_form.action="view.html";
		document.Journal_form.submit();
	}
}

//--------------- ÇÑ°³ º¸±â ----------------
function View(no)
{
//	document.Journal_form.uid.value = no;
//	document.Journal_form.action="view.html";
//	document.Journal_form.submit();
	var box = eval("document.getElementById('multi_' + no)");
	box.checked = true;
	document.Journal_form.action="view.html";
	document.Journal_form.submit();
}

//--------------- °Ë»ö½Ã ¿©·¯ ±ÇÀÇ ³í¹®¸®½ºÆ®ÀÏ¶§ °¢ ±Ç,È£¼ö¸¦ °¡Á®°¡°Ô ÇÑ´Ù 2005.2.16 ½ÅÈ£Á¤----------------
function View2(no,vol,num)
{
	document.Journal_form.Vol.value = vol;
	document.Journal_form.Num.value = num;
	document.Journal_form.uid.value = no;
	document.Journal_form.action="view.html";
	document.Journal_form.submit();
}

//--------------- ¸®½ºÆ® ÆäÀÌÁö·Î ÀÌµ¿ ----------------
function List_go()
{
//	if(document.Journal_form.sflag.value=="Y"){
//		document.Journal_form.Vol.value="";
//		document.Journal_form.Num.value="";
//	}
	document.Journal_form.action="list.html";
	document.Journal_form.submit();
}

//--------------- °Ë»ö ¸ÞÀÎ ÆäÀÌÁö·Î ÀÌµ¿ ----------------
function Main_go()
{
	document.Journal_form.action="main.html";
	document.Journal_form.submit();
}
function radioCheck(oN){
	for(i=0;i<oN.length;i++){
		if(oN[i].checked){ return true; }
	}
	return false;
}

//--------------- ·Î±×ÀÎ Ã¼Å© ----------------
function session_err()
{
	alert("È¸¿øÀü¿ë °ø°£ÀÔ´Ï´Ù.");
	return;
}

// ------------- ¿£ÅÍÅ° Ã¼Å© -------------------
function chkEnterKey() {
	var f = document.Journal_form;
	if (event.keyCode=='13') {
		Journal_Frm();
	}
}


// ÄÁÆß¸Þ¼¼Áö Ãâ·Â ÈÄ ÀÌµ¿
function conf_url(msg,murl) {
	if(confirm(msg)) window.location = murl;
}

// ÆË¾÷Ã¢ ¶ç¿ì±â
var _pop //create global variable without assigning a value so that its value is null
function popen(url,name,w,h,scroll,pos,res) { // (°æ·Î,ÀÌ¸§,°¡·Î,¼¼·Î,½ºÅ©·ÑÀ¯¹«,À§Ä¡,¸®»çÀÌÁî)

	if (!scroll) scroll = 1;
	if (!pos) pos = "center";
	if (!res) res = 0;

	switch (pos) {
		case 'center' :
			LeftPosition = (screen.width) ? (screen.width - w) / 2 : 100;
			TopPosition = (screen.height) ? (screen.height - h - 100) / 2 : 100;
			break;
		case "random" :
			LeftPosition = (screen.width) ? Math.floor(Math.random() * (screen.width - w)) : 100;
			TopPosition = (screen.height) ? Math.floor(Math.random() * ((screen.height - h) - 75)) : 100;
			break;
		default :
			LeftPosition=0;
			TopPosition=0;
			break;
	}

	var settings = 'width=' + w + ', height=' + h + ', top=' + TopPosition + ', left=' + LeftPosition + ', scrollbars=' + scroll;
	settings += ', location=no, directories=no, status=no, menubar=no, toolbar=no, resizable=' + res;

	if(_pop!=null && !_pop.closed) {
		_pop.close();
	}

	pop = window.open(url, name, settings);
	pop.focus();
}
