function viewImage(src,width,height,title,description){
	minWidth=200;
	minHeight=150;
	wWidth=width+50;
	wHeight=height+32;
	if(description!=''){
		wHeight=height+85;
	}
	maxWidth=screen.width-20;
	maxHeight=screen.height-100;
	wWidth=wWidth>maxWidth ? maxWidth : wWidth;
	wHeight=wHeight>maxHeight ? maxHeight : wHeight;
	wWidth=wWidth<minWidth ? minWidth : wWidth;
	wHeight=wHeight<minHeight ? minHeight : wHeight;
	wLeft=(screen.width-wWidth)/2;
	wTop=(screen.height-wHeight-60)/2;
	param="width="+wWidth+",";
	param+="height="+wHeight+",";
	param+="left="+wLeft+",";
	param+="top="+wTop+",";
	param+="menubar=no,";
	param+="resizable=yes,";
	param+="scrollbars=yes,";
	param+="status=no,";
	param+="toolbar=no";
	popupWin=window.open("blank.htm","popupWin",param);
	popupWin.document.write('<html><head><title>'+title+'</title>');
	popupWin.document.write('<style>');
	popupWin.document.write('body{margin: 0; padding: 0; color: #222326; font-family: Tahoma, Arial; background: url(img/texture2.gif) repeat; font-size: 75%;}');
	popupWin.document.write('</style>');
	//popupWin.document.write('<link rel="stylesheet" type="text/css" href="styles.css">');
	popupWin.document.write('<meta http-equiv="Content-Type" content="text/html; charset=windows-1251"></head>');
	popupWin.document.write('<body style="text-align: center; padding: 15px;">');
	popupWin.document.write('<p><img src="'+src+'" width="'+width+'" height="'+height+'" style="border: 1px solid #AAA;"></p>');
	if(description!=''){
		popupWin.document.write('<p align="left">'+description+'</p></body></html>');
	}
}

function wOpen(src,width,height){
	wWidth=width+50;
	wHeight=height+32;
	maxWidth=screen.width-20;
	maxHeight=screen.height-100;
	wWidth=wWidth>maxWidth ? maxWidth : wWidth;
	wHeight=wHeight>maxHeight ? maxHeight : wHeight;
	wLeft=(screen.width-wWidth)/2;
	wTop=(screen.height-wHeight-60)/2;
	param="width="+wWidth+",";
	param+="height="+wHeight+",";
	param+="left="+wLeft+",";
	param+="top="+wTop+",";
	param+="menubar=no,";
	param+="resizable=yes,";
	param+="scrollbars=yes,";
	param+="status=no,";
	param+="toolbar=no";
	window.open(src,"popupWin",param);
}

function gen_input(target_id,add_text,source_id,separator){
	target=document.getElementById(target_id);
	target.value="";
	if(source_id!=""){
		source=document.getElementById(source_id);
		if(source.value!=""){
			target.value=source.value+separator;
		}
	}
	target.value+=add_text;
}

function select_free(select_id){
	el=document.getElementById(select_id);
	opt_arr=el.getElementsByTagName("option");
	for(var i=0;i<opt_arr.length;i++){
		opt_arr[i].selected=false;
	}
}
function transfer(from_id,to_id){
	from=document.getElementById(from_id);
	to=document.getElementById(to_id);
	to.innerHTML=from.innerHTML;
}
function free(id){
	el=document.getElementById(id);
	el.innerHTML="";
}
function show(id){
	el=document.getElementById(id);
	el.style.visibility="visible";
}
function hide(id){
	el=document.getElementById(id);
	el.style.visibility="hidden";
}
function change_val(id,val){
	el=document.getElementById(id);
	el.value=val;
}
function smile(smile){
	var txtarea=document.getElementById('new_mess_text');
	smile=' [:'+smile+':] ';
	if (txtarea.createTextRange && txtarea.caretPos) {
		var caretPos = txtarea.caretPos;
		caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? smile + ' ' : smile;
		txtarea.focus();
	} else {
		txtarea.value  += smile;
		txtarea.focus();
	}
	
}
function storeCaret(textEl) {
	if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate();
}





















