// JavaScript Document

function ShowSidebar()
{
	var Mleft = document.getElementById("main_left").style;
	var Mcenter = document.getElementById("main_center").style;
	var Mright = document.getElementById("main_right").style;
	var Dleft = document.getElementById("left_menu_bdy").style;
	var img = document.getElementById("main_left_sidebar_on");
	if(Mright.display == "block")
	{
		if(Dleft.display == "block")
		{
			Dleft.display = "none";
			Mleft.width = "4%";
			Mcenter.width = "78%";
			img.className = "main_left_sidebar_off";
		}
		else
		{
			Mcenter.width = "64%";
			Mleft.width = "18%";
			Dleft.display = "block";
			img.className = "main_left_sidebar_on";
		}
	}
	else
	{
		if(Dleft.display == "block")
		{
			Dleft.display = "none";
			Mleft.width = "4%";
			Mcenter.width = "96%";
			img.className = "main_left_sidebar_off";
		}
		else
		{
			Mcenter.width = "82%";
			Mleft.width = "18%";
			Dleft.display = "block";			
			img.className = "main_left_sidebar_on";
		}
	}
}

function ShowHelpDiv(divName)
{
	var Mright = document.getElementById("main_right").style;
	if(Mright.display == "block")
	{
		document.getElementById("help_content").innerHTML = document.getElementById(divName).innerHTML;
	}
	else
	{
		ShowHelp();
		document.getElementById("help_content").innerHTML = document.getElementById(divName).innerHTML;
	}
}

function ShowHelp()
{
	var Mleft = document.getElementById("main_left").style;
	var Mcenter = document.getElementById("main_center").style;
	var Mright = document.getElementById("main_right").style;
	var Dleft = document.getElementById("left_menu_bdy").style;
	var img = document.getElementById("main_left_sidebar_on");
	if(Dleft.display == "block")
	{
		if(Mright.display == "block")
		{
			Mright.display = "none";
			Mcenter.width = "82%";
		}
		else
		{
			Mcenter.width = "64%";
			Mright.display = "block";
		}
	}
	else
	{
		if(Mright.display == "block")
		{
			Mright.display = "none";
			Mcenter.width = "96%";
		}
		else
		{
			Mcenter.width = "82%";
			Mright.display = "block";
		}
	}
}

function ChangeOrder(N)
{
	var object = document.getElementsByName("img_darr");
	if(object[N].className == "img_darr")
	{
		object[N].className ="img_uarr";
	}
	else
	{
		object[N].className ="img_darr";
	}
}

function ChangeAllDetail(N,img)
{
	var object = document.getElementsByName("img_detail_add");
	var img = document.getElementsByName(img);
	var detail = document.getElementsByName("detail");
	if(object[N].className == "img_detail_add")
	{
		object[N].className ="img_detail_min";
		for ( var i = 0 ; i < detail.length ; i++)
		{
			img[i].innerText = "-";
			detail[i].style.display = "block";
		}
	}
	else
	{
		object[N].className ="img_detail_add";
		for ( var i = 0 ; i < detail.length ; i++)
		{
			img[i].innerText = "+";
			detail[i].style.display = "none";
		}
	}
}

function ShowMainSearch()
{
	var Tsearch = document.getElementById("main_menu_search");
	var img = document.getElementById("menu_img_add");

	if(Tsearch.style.display == "none")
	{
		Tsearch.style.display = "block";
		img.className = "img_min";
	}
	else
	{
		Tsearch.style.display = "none";
		img.className = "img_add";
	}
	
}

function ShowMainBatch()
{
	var Tsearch = document.getElementById("main_menu_search");
	var Tbatch = document.getElementById("main_menu_batch");
	var Mbatch = document.getElementById("menu_batch");
	var Msearch = document.getElementsByName("main_menu_buttom")[0];
	var img = document.getElementById("menu_img_add");
	if(Tsearch.style.display == "none")
	{
		if(Tbatch.style.display == "none")
		{
			Tbatch.style.display = "block";
			Mbatch.className = "main_menu_active";
			img.className = "img_min";
		}
		else
		{
			Tbatch.style.display = "none";
			Mbatch.className = "main_menu_buttom";
			img.className = "img_add";
		}
	}
	else
	{
		Tsearch.style.display = "none";
		Tbatch.style.display = "block";
		Msearch.className = "main_menu_buttom";
		Mbatch.className = "main_menu_active";
	}
}


function OnCancel(gURL)
{
	window.location.href = gURL;
}

function ShowMenu(N,Nobject)
{
	var img = document.getElementsByName("onoff");
	var object = document.getElementById(Nobject);
	if(img[N].className == "img_add")
	{
		img[N].className = "img_min";
		object.style.display = "block"; 
	}
	else
	{
		img[N].className = "img_add";
		object.style.display = "none"; 
	}
}

function ChangeNumber(objectname,A)
{
	var object = document.getElementById(objectname);
	if(A == 0)
	{
		object.disabled = true;
	}
	else if(A == 1)
	{
		object.disabled = false;
	}
}

function OpenMode(sURL,sWIDTH,sHEIGHT)
{
	var obj = new Object();
	if(sWIDTH != "unfiend" || sHEIGHT != "unfiend")
	{
		sWIDTH = Math.round(sWIDTH*screen.width/1024);
		sHEIGHT =Math.round(sHEIGHT*screen.height/768);
		var variable = "dialogWidth:" + sWIDTH + "px;dialogHeight:" + sHEIGHT + "px;status:no;help:no;";
	}
	else
	{
		var variable = "status:no;help:no";
	}
	window.showModalDialog(sURL,obj,variable);
}

function CheckAll(form,object)
{
	for(var i = 0 ; i < form.elements.length ; i++)
	{
		var E = form.elements[i];
		if((E.name  != object.name) && (E.type == "checkbox"))
		{
				E.checked = object.checked;
		}
	}
}

function LineMouseOver(object)
{
	if(object.className == "lineMouseDown")
	{
		return false;
	}
	else
	{
		object.className = "lineMouseOver";
	}
}

function LineMouseOut(object,N)
{
	if(object.className == "lineMouseDown")
	{
		return false;
	}
	else
	{
		if(N % 2 == 0)
		{
			object.className = "even";
		}
		else
		{
			object.className = "odd";
		}
	}
}

function LineMouseDown(object,N)
{
	if(object.className == "lineMouseDown")
	{
		if(N % 2 == 0)
		{
			object.className = "even";
		}
		else
		{
			object.className = "odd";
		}
	}
	else
	{
		object.className = "lineMouseDown";
	}
}

function LineMouseOver(object)
{
	if(object.className == "lineMouseDown")
	{
		return false;
	}
	else
	{
		object.className = "lineMouseOver";
	}
}

function LineMouseOut(object,N)
{
	if(object.className == "lineMouseDown")
	{
		return false;
	}
	else
	{
		if(N % 2 == 0)
		{
			object.className = "even";
		}
		else
		{
			object.className = "odd";
		}
	}
}

function LineMouseDown(object,N)
{
	if(object.className == "lineMouseDown")
	{
		if(N % 2 == 0)
		{
			object.className = "even";
		}
		else
		{
			object.className = "odd";
		}
	}
	else
	{
		object.className = "lineMouseDown";
	}
}

function ShowDetail(N)
{
	N = N - 1;
	var img = document.getElementsByName("add");
	var object = document.getElementsByName("detail");
	if(img.length >=1)
	{
		if(img[N].innerText == "+")
		{
			for(var i = 0 ; i < document.getElementsByName("detail").length ; i++)
			{
				img[i].innerText = "+";
				object[i].style.display = "none";
			}
			img[N].innerText = "-";
			object[N].style.display = "block";
		}
		else
		{
				img[N].innerText = "+";
				object[N].style.display = "none";
		}
	}
}

function ShowAdvanced()
{
	var object = document.getElementsByName("advanced");
	for( var i = 0 ; i <object.length ; i++)
	{
		if(object[i].style.display == "none")
		{
			object[i].style.display = "block";
		}
		else
		{
			object[i].style.display = "none";
		}
	}
}

function ChangeTR(object,TRName)
{
	var Tobject = document.getElementsByName(TRName);
	if(object.options[object.selectedIndex].value == 1)
	{
		Tobject[1 - 1].style.display = "block";
		Tobject[2 - 1].style.display = "none";
	}
	else if(object.options[object.selectedIndex].value >= 2)
	{
		Tobject[1 - 1].style.display = "none";
		Tobject[2 - 1].style.display = "block";
	}
}


function ShowBetween(sValue,Index)
{
	var object = document.getElementsByName("between");
	sValue = sValue.options[sValue.selectedIndex].value;
	if(sValue == 3)
	{
		object[Index - 1].style.display = "block";
	}
	else
	{
		object[Index - 1].style.display = "none";
	}
}

function DisplayShow(objname)
{
	var object = document.getElementsByName(objname);
	for( var i = 0 ; i <object.length ; i++)
	{
		if(object[i].style.display == "none")
		{
			object[i].style.display = "block";
		}
		else
		{
			object[i].style.display = "none";
		}
	}
}