function go(theURL,w_img) {window.open(theURL,'_blank',w_img);}

// Смайлики
function emoticon(text) {
	var txtarea = document.getElementById("message");
	if (txtarea.createTextRange && txtarea.caretPos) {
		var caretPos = txtarea.caretPos;
		caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text;
		txtarea.focus();
	} else {
		txtarea.value  += text;
		txtarea.focus();
	}
}


// Подсчет лимита символов
function countSymb(lim) {
		var lim = lim || 500;
		if (document.getElementById("message").value.length > lim) {
			alert("К сожалению, вы превысили максимально допустимую длину комментария");
			document.getElementById("message").value = document.getElementById("message").value.substring(0,lim);
			return false;
		}
		if (document.getElementById("message").value.length > (lim - 50)) {
			document.getElementById("count").style.color = "red";
		}
		if (document.getElementById("message").value.length < (lim - 50)) {
			document.getElementById("count").style.color = "green";
		}
		document.getElementById("count").innerHTML = document.getElementById("message").value.length;
}

function checkAll(cbName, checked)
{
var fname = document.all(cbName);
for (var i=0; i < fname.length; i++) fname[i].checked = checked;
}


function open_design_panel(menu, number, this_isp, modify) {
	  document.all("shadow").style.display="block";
	  document.all("design_catalog").style.display = 'block';
	  makeRequest('select_design.php?menu='+menu+'&number='+number+'&this_isp='+this_isp+'&'+modify, 'design_catalog', null);
}

function close_design_panel() {
	  document.all("shadow").style.display="none";
	  document.all("design_catalog").style.display = 'none';
}

var win = null;
function NewWindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
TopPosition = TopPosition-40;
settings =
'height='+h+',width='+w+', top='+TopPosition+', left='+LeftPosition+', scrollbars='+scroll+',resizable,location=0'
win = window.open(mypage,myname,settings)
if(win.window.focus){win.window.focus();}
}

