function register(username) {
  window.open('../common/register.php?username='+username,'register',"directories=no,location=no,menubar=no,status=no,toolbar=no,width=400,height=450");
}

function posli_e(id) {
  window.open('../common/posli.php?id='+id,'posli',"directories=no,location=no,menubar=no,status=no,toolbar=no,width=520,height=350");
}

function posli_e2(to) {
  to = to.replace("#","@");
  window.open('../common/posli.php?to='+to,'posli',"directories=no,location=no,menubar=no,status=no,toolbar=no,width=520,height=350");
}

/**
	* DHTML pro IE a Mozilla */
function getEl(elem) {
	if (document.all) {
		return document.all[elem];
	} else {
		return document.getElementById(elem);
	} 	
};

/**
	* View date if checkbox unchecked
	*/
function do_view_date(kde) {

	if (getEl(kde+'_input').checked) {
		getEl(kde+'_now').style.display = ""; 
		getEl(kde+'_date').style.display = "none"; 
	} else {
		getEl(kde+'_date').style.display = ""; 
		getEl(kde+'_now').style.display = "none"; 
	}
}

/**
	* change all <p> to \n and
	*/
function p2nl(str) {
	str = str.replace(/\n/g," ");
	str = str.replace(/<p>/g, "\n");
	str = str.replace(/<p\/>/g, "\n");
	return str;
}

/**
	* Tests, if it is email
	*/
function isEmail(str){
	var objRegExp =  /^((?:(?:(?:(\w|~)[~\.\-\+]?)*)(\w|~))+)\@((?:(?:(?:\w[\.\-\+]?){0,62})\w)+)\.([a-zA-Z]{2,6})$|^$/;
	return (objRegExp.test(str) && str != "");
}   

/**
	* Tests, if if email in one element is valid, when second element is checked
	*/
function checkEmailForNotify(emailel, checkel, msg) {
	if (document.getElementById(checkel).checked) {
		if (!isEmail(document.getElementById(emailel).value)) {
			alert(msg);	
			document.getElementById(emailel).focus();
			document.getElementById(checkel).checked = false;
		}
	}
}


