function mydebug(mytext){
  debugdiv = document.getElementById('debug');
  if(debugdiv)
    debugdiv.innerHTML += mytext + '<br />';
  else
    alert(mytext);
}
function strpos(str, ch) {
  for (var i = str.length; i > 0; i--)
    if (str.substring(i, i+1) == ch) return i;
  return -1;
}
function check_email(adresa){
    re = /^[^.]+(\.[^.]+)*@([^.]+[.])+[a-z]{2,3}$/;
    return adresa.search(re) == 0;
}
function check_phone(phone){
  var i;
  var number_count=0;
  for (i = 0; i < phone.length; i++){   
    // Check that current character is number.
    var c = phone.charAt(i);
    if (((c < "0") || (c > "9"))){
      if((c != " ") && c!="+")
        return false;
    }else{
      number_count++;
    }
  }
  if(number_count<8) // there has to be at least 8 digit number
    return false;
  // All characters are numbers, plus or space.
  return true;
}
/*
function MainMenuInit() {
   var builder = new DomMenuBuilder();
   builder.setSettings(new Hash(
           'openMouseoverMenuDelay', 1,
           'closeMouseoverMenuDelay', 1,
           'expandMenuArrowUrl', '../images/sub_menu_off.gif',
           'menuBarClass', 'domMenuMain_menuBar',
           'menuElementClass', 'domMenuMain_menuElement',
           'menuElementHoverClass', 'domMenuMain_menuElementHover',
           'menuElementActiveClass', 'domMenuMain_menuElementHover',
           'subMenuBarClass', 'domMenuMain_subMenuBar',
           'subMenuElementClass', 'domMenuMain_subMenuElement',
           'subMenuElementHoverClass', 'domMenuMain_subMenuElementHover',
           'subMenuElementActiveClass', 'domMenuMain_subMenuElementHover',
           'subMenuElementHeadingClass', 'domMenuMain_subMenuElementHeading'
	       ));
   builder.replace('domMenu_main');
}
function sync(useDvSide) {
  var horz = document.getElementById("dvData").scrollLeft;
  var vert = document.getElementById("dvData").scrollTop;
  var navDOM = window.innerHeight;
  if(navDOM) {
    DocWidth = document.width;
  } else {
    DocWidth = document.body.clientWidth;
  }
  if((useDvSide==1)) {
    document.getElementById("dvData").style.width = (DocWidth-457)+"px";
    document.getElementById("dvHeaderCover").style.width = (DocWidth-457)+"px";
  }
  if(horz>=0){
    if((useDvSide==1)) {
      document.getElementById("dvHeader").style.left=(-horz)+"px";
      document.getElementById("dvHeader").style.width=(DocWidth+horz)+"px";
    } else {
      document.getElementById("dvHeader").style.left=(-horz)+"px";
      document.getElementById("dvHeader").style.width=(DocWidth+horz)+"px";
    }
  }
  if((vert>=0)&&(useDvSide==1)){
    document.getElementById("dvSide").style.height=(parseInt(document.getElementById("dvSideCover").style.height)+vert)+"px";
    document.getElementById("dvSide").style.top=(-vert)+"px";
  }
}
function init(){
	//document.body.scrollTop = <?=$scroll?>;
	//document.getElementsByTagName('input')[0].focus();
	//window.setTimeOut('hidePageLoadingInfo()',3000);
	hidePageLoadingInfo();
}
function hidePageLoadingInfo() {
  document.getElementById('PageLoadingInfo').style.visibility = 'hidden';
}
function ResizeHeight(ElementId,plus){
  var frame = document.getElementById(ElementId);
  var htmlheight = document.documentElement.clientHeight;//document.body.parentNode.scrollHeight;
  var windowheight = window.innerHeight;
  if(htmlheight < windowheight) {
    document.body.style.height = windowheight + "px";
    if(frame) frame.style.height = windowheight+plus + "px";
  } else {
    document.body.style.height = htmlheight + "px";
    if(frame) frame.style.height = htmlheight+plus + "px";
  }
}
function openlive(id,col){
	document.location.href="setlive.php?id="+id+"&col="+col+"&scroll="+document.body.scrollTop
}
function closelive(id,col){
	document.location.href="closelive.php?id="+id+"&col="+col+"&scroll="+document.body.scrollTop
}
function popup(id){
	var root="./popup.php?id="+id;
	//window.open(root,"Product Info","scrollbars=no,resizable=no,status=no,toolbar=no,width=400,height=300");
	window.open(root,"my_new_window","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, copyhistory=yes, width=400, height=400");
}
*/
