function openDetailWindow(speciesId, action, familyCode, shape, keyword, keyfield)
{
	var speciesWindow;
	speciesWindow=window.open("../detail/detail.asp?speciesId="+speciesId+"&action="+action+"&familyCode="+familyCode+"&shape="+shape+"&keyword="+keyword+"&keyfield="+keyfield, "displayWindow", "width=680,height=400,toolbar=no,scrollbars=yes");
}

function openWindow(speciesId, sqlStr)
{
	var speciesWindow;
	speciesWindow=window.open("../detail/detail.asp?speciesId="+speciesId+"&sqlStr="+sqlStr, "displayWindow", "width=680,height=400,toolbar=no,scrollbars=yes");
}
function openAdminWindow(speciesId)
{
	var speciesWindow;
	speciesWindow=window.open("../detail/detail.asp?admin=1&speciesId="+speciesId, "displayWindow", "width=680,height=400,toolbar=no,scrollbars=yes");
}
function deletePhoto(photoId)
{
	var speciesId;
	speciesId = document.detailFrm.speciesId.value;
	if (confirm("This will remove the photo from dataBase"))
	{
		location="../detail/detail.asp?admin=1&speciesId="+speciesId+"&photoId="+photoId+"&action=delete"
	}
}
function validate()
{
	var allOK=true;
	with(document.detailFrm){
		action.value="modify";
		alert(action.value);
	}
	return allOK;
}

function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}

function setCookie(name, value, expires, path, domain, secure) {
    var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
    document.cookie = curCookie;
}

function changeLang(lang, speciesId, action, familyCode, shape, keyword, keyfield)
{
	if (lang=="chi")
	{
		lang="eng";
	}else{
		lang="chi";
	}
	window.location = "http://www.hk-fish.net/"+lang+"/database/detail/detail.asp?speciesId="+speciesId+"&action="+action+"&familyCode="+familyCode+"&shape="+shape+"&keyword="+keyword+"&keyfield="+keyfield;
}

