function func(state,index)
{
	if (state=="add")
	{
		window.open("add.asp","","width=420,height=163,top=10,left=150,menubar=0,toolbar=0,scrollbars=1,resizable=1");
	}
	else if (state=="update")
	{
		window.open("","update","width=420,height=210,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=420,height=210,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 "SITECLASS":
       innerObj.innerHTML="<select name='qvalue' id='qvalue' class=text><option>請選擇</option><option value=中央政府機構>中央政府機構</option><option value=地方政府機構>地方政府機構</option><option value=公會社團>公會社團</option><option value=國內大專築相關系所>國內大專築相關系所</option><option value=國外知名網站>國外知名網站</option><option value=其他>其他</option></select>";
    break;
	
	case "SITENAME":
       innerObj.innerHTML="<input name='qvalue' id='qvalue' type='text' size='30' class='search_Input_Style'>";
    break;

	case "URL":
       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;
}