function func(state,index)
{
	if (state=="add")
	{
		window.open("add.asp","","width=520,height=310,top=10,left=150,menubar=0,toolbar=0,scrollbars=1,resizable=1");
	}
	else if (state=="update")
	{
		window.open("","update","width=520,height=360,top=10,left=150,menubar=0,toolbar=0,scrollbars=1,resizable=1");
		document.all("IndexKey").value=index;
		document.forms[0].target = "update";
		document.forms[0].action = "update.asp";
		document.forms[0].submit();
	}
	else if (state=="delete")
	{
		window.open("","delete","width=520,height=360,top=10,left=150,menubar=0,toolbar=0,scrollbars=1,resizable=1");
		document.all("IndexKey").value=index;
		document.forms[0].target = "delete";
		document.forms[0].action = "delete.asp";
		document.forms[0].submit();
	}
	else if (state=="search")
	{
		if (document.getElementById('qvalue'))
			document.getElementById('qvalueNEW').value = document.getElementById('qvalue').value;
		document.forms[0].target = "bottom";
		document.forms[0].action = "dealdata.asp";
		document.forms[0].submit();
	}
}

function changeto(obj){
  var innerObj = document.all("innerInput");
		innerObj.innerHTML="";
  switch (obj.value.toUpperCase()){
		case "COURSENAME":
		   innerObj.innerHTML="<input name='qvalue' id='qvalue' type='text' size='30' class='search_Input_Style'>";
		break;
		case "CREDITHOUR":
		   innerObj.innerHTML="<input name='qvalue' id='qvalue' type='text' size='5' class='search_Input_Style'>&nbsp;&nbsp;<font color='red'>½Ð¿é¤J¼Æ¦r</font>";
		break;
		case "COURSEPLACE":
		   innerObj.innerHTML="<input name='qvalue' id='qvalue' type='text' size='30' class='search_Input_Style'>";
		break;
   }
}

function init(state){
	if (state=="add")
	{
		window.parent.document.forms[0].action="";
		window.parent.document.forms[0].target="_self";
		window.parent.document.forms[0].submit();
	}
	else if (state=="update")
	{
		window.parent.document.forms[0].action="";
		window.parent.document.forms[0].target="_self";
		window.parent.document.forms[0].submit();
	}
	else if (state=="delete")
	{
		window.parent.document.forms[0].action="";
		window.parent.document.forms[0].target="_self";
		window.parent.document.forms[0].submit();
	}
	else if (state=="search")
	{
		document.forms[0].submit();
	}
}

function check(form)
{
	//var checkform = new CheckForm();
	form.target = "self";	
	window.close();
	return true;
}