// image roll over
function ImageOver(img) {
  try {
    if(img.src.search(/_1(\.(gif|jpg))$/) != -1) {
      img.src = img.src.replace(/_1(\.(gif|jpg))$/, "_2$1");
    }
  } catch(e) {
  }
}

function ImageOut(img) {
  try {
    if(img.src.search(/_2(\.(gif|jpg))$/) != -1) {
      img.src = img.src.replace(/_2(\.(gif|jpg))$/, "_1$1");
    }
  } catch(e) {
  }
}

function RowRollover(tr, bool) {
  tr.style.background = bool ? "#E6E6EA" : "#FFFFFF";
}

function Open_Window(url, name, width, height, scroll) {
  var win_x, win_y, option, obj;
  
  win_x = (screen.availWidth - width) * 0.5;
  win_y = (screen.availHeight - height) * 0.5;

  option = "width=" + width + ",height=" + height + ",left=" + win_x + ",top=" + win_y + ",status=0";
  option += (scroll) ? ",scrollbars=1" : "";

  obj = window.open(url, name, option);

  obj.focus();
}

function Open_ModalDialog(url, name, width, height, scroll) {
  var option;

  option = "dialogWeight:" + width + "px;dialogHeight:" + height + "px;scroll:" + scroll;
  option += ";help:0;resizable:0;status:0";

  window.showModalDialog(url, name, option);
}


// popup
function Add_Person(customer) {
  Open_Window("/customer/add_person.asp?customer=" + customer, "add_person", 500, 220)
}

function Modify_Person(customer, person) {
  Open_Window("/customer/modify_person.asp?customer=" + customer + "&person=" + person, "modify_person", 500, 220)
}

function Add_Machine(customer) {
  Open_Window("/customer/add_machine.asp?customer=" + customer, "add_machine", 500, 400)
}
////////////////////////////////////////////
//////*2009.02.04 (WSY) *//////////////
////////////////////////////////////////////
function Add_Machine02() {  	
	//Open_Window("", "add_machine", 500, 400);
	var customerv = document.Frm.customer.value;
	Open_Window("/customer/add_machine.asp?customer=" + customerv, "add_machine", 500, 400)
}


function Modify_Machine(customer, machine) {
  Open_Window("/customer/modify_machine.asp?customer=" + customer + "&machine=" + machine, "modify_machine", 500, 400)
}

function Add_TechnicalPoint(project) {
  Open_Window("/project/add_technical.asp?project=" + project, "add_technical", 650, 580)
}

function View_TechnicalPoint(project, technical) {
  Open_Window("/project/view_technical.asp?project=" + project + "&technical=" + technical, "view_technical", 650, 600)
}

function Modify_TechnicalPoint(project, technical) {
  Open_Window("/project/modify_technical.asp?project=" + project + "&technical=" + technical, "modify_technical", 650, 500)
}

function Add_Activities(project, customer) {
  Open_Window("/project/add_activities.asp?project=" + project + "&customer=" + customer, "add_activities", 500, 320)
}
/*list url*/
function Add_Activities02(Url) {
window.location.href = Url
}

function Modify_Activities(activities, customer) {
  Open_Window("/project/modify_activities.asp?activities=" + activities + "&customer=" + customer, "modify_activities", 500, 600)
}

function Select_Machine() {
  Open_Window("/common/select_machine.asp", "select_machine", 400, 320)
}

// download
function Download(type, file) {
  if (type != "" || file != "") {
    window.location.href = "/common/download.asp?type=" + type + "&file=" + file;
  }
}

// form check
function EmailCheck(email) {
	var pattern = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
	return pattern.test(email);
}

function NumberCheck(n) {
	var pattern = /^[0-9]+$/;
	return pattern.test(n);
}

function EmptyCheck(value) {
  return (value == "" || value == null) ? false : true;
}

// key press
function OnlyNumeric(){
  if (event.keyCode >= 48 && event.keyCode <= 57) {
    return true;
  } 
  else {
    event.returnValue = false;
  }
}

//new.popup
function pop_view(pageurl,wid,hei){
  window.open(pageurl , "popup", "width="+wid+", height="+hei+", toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0");
}
