//if (!(document.layers)) {
//	document.write('<style type="text/css">\
//	.i{border-width: 1px;\
//	border-bottom : 1 solid #E78C00;\
//	border-right : 1 solid #E78C00;\
//	border-left : 1 solid #E78C00;\
//	border-top : 1 solid #E78C00;}\
//	</style>');
//}

function Active(what) {
if(!document.layers) {
what.style.backgroundColor='#FEFDF4'
what.style.color='#333333'
}
}

function NotActive(what) {
if(!document.layers) {
what.style.backgroundColor='#FFFFFF'
what.style.color='#666666'
}
}

/**
 * name
 * @param {type} param
 */
 function swapImages(obj,img) {
 	obj.src=img;
 }


 function validateDate(date,showmessage) {
 	showmessage = showmessage || false;
	var regexp_date=/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/;
	if(date.match(regexp_date) == null) {
		if (showmessage) alert('Niepoprawny format daty');
		return false;
	}
	return true;
}

function checkIfEmpty(str,message) {
	if (str.replace(/ /g,'')=='') {
		if (typeof(message)!='undefined') {
			alert(message);
		}
		return false;
	}
	return true;
}

function numCheck(eventObj) {
	var keyCode;
	if (document.all) {
		keyCode=eventObj.keyCode;
	} else {
		keyCode=eventObj.which;
	}
	if (keyCode==0) return true;
	if (keyCode==8) return true;
	if (keyCode==47) return false;
	if (keyCode<44 || keyCode >58) return false;
	return true;
}

/**
 * switchElements
 * @param {type} param
 */
 function switchElements(obj1,obj2) {
 	document.getElementById(obj1).style.display='';
 	document.getElementById(obj2).style.display='none';
 }

/**
 * openPicPopup
 * @param {type} param
 */
 function openPicPopup(img) {
 	tcp=window.open('?action=imgpopup&image='+escape(img),'tc','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,width=100,height=100');
 }

/**
 * open3dPopup
 * @param {type} param
 */
 function open3dPopup(id) {
 	tcp=window.open('?action=3dpopup&id='+id,'t3c','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,width=500,height=580');
 }

 /**
  * name
  * @param {type} param
  */
  function openMapPopup() {
  	tcp=window.open('','t3c','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,width=658,height=550');
  	tcp.document.open();
  	tcp.document.write('<style>body { margin: 0px; padding: 0px}</style><img src="images/mapa_zoom.png">');
  	tcp.document.close();
  }

   /**
  * name
  * @param {type} param
  */
  function openContactPopup(lang) {
  	tcp=window.open('?action=message&lang='+lang,'t3k','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,width=400,height=350');
  }

 /**
  * name
  * @param {type} param
  */
  function validateEmail(email) {
    var splitted = email.match("^(.+)@(.+)$");
    if(splitted == null) return false;
    if(splitted[1] != null ) {
		var regexp_user=/^\"?[\w-_\.]*\"?$/;
		if(splitted[1].match(regexp_user) == null) return false;
    }
    if(splitted[2] != null) {
		var regexp_domain=/^[\w-\.]*\.[A-Za-z]{2,4}$/;
		if(splitted[2].match(regexp_domain) == null) {
			var regexp_ip =/^\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\]$/;
			if(splitted[2].match(regexp_ip) == null) return false;
		}
		return true;
	}
	return false;
}

function popImage(image,title) {
	title=title || 'Aqmet';
	tcp=window.open('','tc','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,width=100,height=100');
	tcp.document.open();
	tcp.document.write('<html><head><title>'+title+'</title><script src="js/prototype.js"></script><script src="js/aqumet.js"></script></head><body onLoad="resizeWin(self,$(\'pic\').width,$(\'pic\').height)" style="padding: 0px; margin: 0px; background-color: white;"><img id="pic" src="'+image+'" onClick="self.close()" style="cursor: hand"></body></html>')
	tcp.document.close();
}

function resizeWin(win,w,h) {
	iWidth = win.innerWidth?win.innerWidth:win.document.body.clientWidth;
	iHeight = win.innerHeight?win.innerHeight:win.document.body.clientHeight;
	iWidth = w - iWidth;
	iHeight = h - iHeight;
	win.resizeBy(iWidth, iHeight);
	win.focus();
}
