/*------------------ global js (Front End) ----------------------------*/

/*--------------- Get the height of a div ----------------------*/
function cmGetHeight (obj, num) {

  var height = obj.offsetHeight;
  if (height > 0) {
		return height-num;
  }
  //if (!obj.firstChild) {
		//return 0;
  // }

  return obj.firstChild.offsetHeight;

}
/*--------------- Change style css ----------------------*/
function celOver(obj) {
  var s = obj.className;
  s = s.replace(/-over/g, "");
  obj.className = s+"-over";
}

function celOut(obj) {
  var s = obj.className;
  s = s.replace(/-over/g, "");
  obj.className = s;
}


/*------------- Search field ----------------*/
function searchinfo() {
  var errors = '';
  var form = document.SearchFrm
  if (form.searchfield.value == "Search" || form.searchfield.value == "") {
    errors = "True";
  }
  if (errors) {
    //alert('The following error(s) occurred:\n'+errors);
  }
  document.MM_returnValue = (errors == '');
}

function searchfocus(val) {
  if (val.value == "Search") {
    val.value = "";
  }
}

function searchblur(val) {
  if (val.value == "") {
    val.value = "Search";
  }
}


/*-------gallery system (item)----------*/
function popup(idimg,width,height) { 
  xp = (screen.width-width)/2;
  if (xp <= 0) {
    xp = 0;
  }
  yp = 0;

  fen = window.open(idimg,'','toolbar=0,location=0,directories=0,status=0,scrollbars=0,resizable=0,copyhistory=0,menuBar=0,top='+yp+',left='+xp+',width=' + width + ',height=' + height);
  fen.focus(); 
}

/*-------gallery system (itempopup)----------*/
function checksize() {
 if (document.images[0].complete) {
  window.resizeTo(document.images[0].width+12,document.images[0].height+30);
  window.focus();
 }
}

/*------------------end global js----------------------------*/