function imgPop(pajina, daWidth, daHeight, daScroll) {
	// determine screen width and height
	wSize = screen.width;
	hSize = screen.height;
	// page title
	//pageTitle = 'Life Packaging Technology';
	// 
    //pageName = 'intro.html';
	wWindow = daWidth;
 	hWindow = daHeight;
	// offset X (to substract borders) and Y (to substract Windows START bar)
	offSetX = 5;
	offSetY = 30;
	// determine left and top position
	leftWindow = ((wSize - wWindow) / 2) - offSetX;
	topWindow = ((hSize - hWindow) / 2) - offSetY;
	// set some features
	/*fullScreen = 'no';
	menuBar = 'no';
	reSize = 'no';
	scrollBar = daScroll;
	statusBar = 'no';
	titleBar = 'yes';
	toolBar = 'no';*/
	window.open( pajina, "myWindow", "status = 1, height = "+hWindow+", width = "+wWindow+", top = "+topWindow+", left = "+leftWindow+", resizable = 0, scrollbars = "+daScroll)
}

// hide an element
function closeBOX(objID) {
	if (document.getElementById(objID)) {
		 document.getElementById(objID).style.display = "none";
	}
}

// show an element
function openBOX(objID) {
	if (document.getElementById(objID)) {
		 document.getElementById(objID).style.display = "block";
	}
}

function daValoare(elm1,elm2) {
	//alert(document.getElementById(elm1).value);
	//document.formName.elm2.value=document.formName.elm1.value;
	//document.getElementById(elm2).value = document.getElementById(elm1).value;
	document.getElementById(elm2).value = elm1;
	//alert(document.formName.elm2.value)
	//document.getElementById(formName).submit();
}

function changeClass(elemID,clsName) {
	document.getElementById(elemID).className = clsName;
}

///////////////////////////////
function numaNumere(camp) {
	var aCifre = new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9");
	var valueCamp = ''+document.getElementById(camp).value+'';
	
	for(var i=0; i<aCifre.length; i++) {
		for(var j=0; j<valueCamp.length; j++) {
			if(aCifre.inArray(valueCamp[j])) {
				
			} else {
				crtChar = valueCamp[j];
				valueCamp = valueCamp.replace(crtChar,'');
				document.getElementById(camp).value = valueCamp;	
			}
		}
	}
}

Array.prototype.inArray = function (value) {
	// Returns true if the passed value is found in the
	// array. Returns false if it is not.
	var i;
	for (i=0; i < this.length; i++)  {
		if (this[i] == value)  {
			return true;
		}
	}
	return false;
};
////////////////////////////////

function maxNumber(camp,maxNumber) {
	if(document.getElementById(camp).value > maxNumber) {
		document.getElementById(camp).value = maxNumber;
	}
}

function emailCheck(emailStr) {
  var emailPat=/^(.+)@(.+)$/   
  var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]";
  var validChars="\[^\\s" + specialChars + "\]";   
  var quotedUser="(\"[^\"]*\")";
  var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
  var atom=validChars + '+';
  var word="(" + atom + "|" + quotedUser + ")";
  var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
  var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
  var matchArray=emailStr.match(emailPat)
  if (matchArray==null) {
    return false;
  }
  var user=matchArray[1];
  var domain=matchArray[2];

  if (user.match(userPat)==null) {
    return false;
  }
   
  var IPArray=domain.match(ipDomainPat);
  if (IPArray!=null) {
    for (var i=1;i<=4;i++) {
      if (IPArray[i]>255) { 
        return false;
      }
    }  
    return true;
  }
  var domainArray=domain.match(domainPat);
  if (domainArray==null) {
    return false;
  }
   
  var atomPat=new RegExp(atom,"g");
  var domArr=domain.match(atomPat);
  var len=domArr.length;
  if (domArr[domArr.length-1].length<2 || domArr[domArr.length-1].length>3) {
    return false;
  }
   
  if (len<2) {
    var errStr="This address is missing a hostname!";
    return false;
  }
   
  return true;
}

