// JavaScript Document
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function jump_to(j_url)
{
	location.href = j_url;
}
function del_one(dmsg,urlpage)
{
	if( confirm(dmsg) ) location.href = urlpage
}

function select_manage(obj,check_var){

	for(var i = 0;i<obj.elements.length;i++)
	{
		if(obj.elements[i].type == "checkbox")
		{
			if(document.getElementById('check_all').checked){
				obj.elements[i].checked = true;
			}else{
				obj.elements[i].checked = false;
			}
		}
	}
}

function change_color(check_var,row_id)
{
	if(check_var)
	{	document.getElementById(row_id).style.backgroundColor = '#DFEFF6';
		temp_color = document.getElementById(row_id).style.backgroundColor;
	}else{
		document.getElementById(row_id).style.backgroundColor = '#ffffff';
		temp_color = document.getElementById(row_id).style.backgroundColor;
	}
}
function change_colorall(check_var,y){
	var trid;
	
	for(trid=1;trid <= y;trid++)
	{
		if(check_var){
			document.getElementById(trid).style.backgroundColor = '#DFEFF6';
		}else{
			document.getElementById(trid).style.backgroundColor = '#ffffff';
		}
	}
}

function over_color(row_id){
	temp_color = document.getElementById(row_id).style.backgroundColor;
	document.getElementById(row_id).style.backgroundColor = '#F6F3D3';
}

function out_color(row_id){
	document.getElementById(row_id).style.backgroundColor = temp_color;
}

function openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


function command_show(layer_id,command_msg){
	x = event.clientX;
	y = event.clientY + document.documentElement.scrollTop;
	document.getElementById(layer_id).innerHTML 	= command_msg;
	document.getElementById(layer_id).style.left	= x+15;
	document.getElementById(layer_id).style.top		= y;
	document.getElementById(layer_id).style.display	= "block";
}

function command_hide(layer_id){
	document.getElementById(layer_id).style.display = "none";
}

function w_close(){
	window.opener.location.reload();
	window.close();
}

function regInput(obj, reg, inputStr)
{
	var docSel = document.selection.createRange()
	if (docSel.parentElement().tagName != "INPUT") return false
	oSel = docSel.duplicate()
	oSel.text = ""
	var srcRange = obj.createTextRange()
	oSel.setEndPoint("StartToStart", srcRange)
	var str = oSel.text + inputStr + srcRange.text.substr(oSel.text.length)
	return reg.test(str)
}

function pop_window(pop_url,pop_name,pop_var){
	if(pop_var){
		window.open(pop_url,pop_name,pop_var);
	}else{
		window.open(pop_url,pop_name,'width=920,height=600,left=30,top=30,menubar=no,location=no,resizable=yes,scrollbars=yes,status=no');
	}
}

function page_manage(page_num){
	document.forms['search_form'].pg.value = page_num;
	document.forms['search_form'].submit();
}

function do_sort(sort_num){
	document.forms['search_form'].sb.value = sort_num;
	document.forms['search_form'].submit();
}

function clear_value(id1,id2,id3){
	if(id1 != undefined) document.getElementById(id1).value = "";
	if(id2 != undefined) document.getElementById(id2).value = "";
	if(id3 != undefined) document.getElementById(id3).value = "";	
}

function pick_item(){
	var pick_sn = document.getElementById('item_relative').value;
	window.open('../goods_item/picker.php?p_sn='+pick_sn,'goods_picker','width=800,height=600,top=50,left=200');
}
function clear_item(){
	document.getElementById('pick_item_no').value = "";
	document.getElementById('item_relative').value = "";
}

function text_dis(obj){
	if(obj.value == "") obj.className = "stxtno";
}
function text_back(obj){
	if(obj.value == "") obj.className = "stxt";
}

