var activeItem=""
//self.focus();

function BusinessCard(page) {
  window.open('/' + page + '','winContactPage','width=380,height=250,resizable=yes,status=no,scrollbars=yes,toolbar=no,copyhistory=no');
}

function newWindow(usePage,winName,winWidth,winHeight) {
  window.open('' + usePage + '','' + winName + '','width=' + winWidth + ',height=' + winHeight + ',resizable=yes,status=no,scrollbars=yes,toolbar=no,copyhistory=no');
}

function printWindow(printPage,winName,winWidth,winHeight) {
  window.open(''+ printPage +'','winPrintPage','width=750,height=480,resizable=yes,status=yes,scrollbars=yes,toolbar=no,copyhistory=no');
}

function viewImage(usePage,winName,winWidth,winHeight) {
  window.open('' + usePage + '','' + winName + '','width=' + winWidth + ',height=' + winHeight + ',resizable=yes,status=no,scrollbars=no,toolbar=no,copyhistory=no');
}

function setWindowHeight(){
	screenWidth = screen.width;
	screenHeight = screen.height;

	if (screenWidth == ""){maxWidth=780;} else {maxWidth=screenWidth;}
	if (screenHeight == ""){maxHeight=580;} else {maxHeight=screenHeight;}

	winWidth = document.body.offsetWidth;
	winHeight = document.body.offsetHeight;

	selfHeight=self.document.body.scrollHeight;
	if (selfHeight>=maxHeight){newHeight=maxHeight;} else {newHeight=selfHeight;}

	// selfWidth=self.document.body.scrollWidth;
	// if (selfWidth>=maxWidth){newWidth=maxWidth;} else {newWidth=selfWidth;}

	self.resizeTo(winWidth,newHeight+70);
}

function checkNumbers(strInput,okNumbers) {
	for (i=0;i<strInput.length;i++) {
		checkSubStr=strInput.substring(i,i+1)
		if (okNumbers.indexOf(checkSubStr) == -1){
			return false;
		}
	}
}

function isEmail(str) {
  if (str=="")
	 return true;
  var supported = 0;
  if (window.RegExp) {
    var tempStr = "a";
    var tempReg = new RegExp(tempStr);
    if (tempReg.test(tempStr)) supported = 1;
  }
  if (!supported) 
    return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
  var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
  var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
  return (!r1.test(str) && r2.test(str));
}