
function g(strGo) {
	location.href = strGo;
}

function c(strAsk, strGo) {
	if (confirm(strAsk)) location.href = strGo;
}

function s(objForm, strAction) {
	objForm.a.value = strAction;
	objForm.submit();
}

function sc(strAsk, objForm, strAction) {
	if (confirm(strAsk)) {
		objForm.a.value = strAction;
		objForm.submit();
	}
}

function toggle(div2Hide, div2Show) {
	document.getElementById(div2Hide).style.display = 'none';	
	document.getElementById(div2Show).style.display = 'block';	
}
		
function toggleDivs(prefix) {
	var divs = document.getElementsByTagName("div");
	for(var i = 0; i < divs.length; i++) {
		d = divs[i];
		if (d.id.substring(0, prefix.length) == prefix) {
  		d.style.display = (d.style.display == 'none' || d.style.display == '' ? 'block' : 'none');
    }
	}
}
		
function urlencode(str) {
  str = escape(str);
  str = str.replace('+', '%2B');
  str = str.replace('%20', '+');
  str = str.replace('*', '%2A');
  str = str.replace('/', '%2F');
  str = str.replace('@', '%40');
  return str;
}
		
function printTag(textarea, tag) {
	switch (tag) {
		case 'b':
			txt = '<b>' + window.prompt('Введите текст:','') + '</b>';
			break;
		case 'i':
			txt = '<i>' + window.prompt('Введите текст:','') + '</i>';
			break;
		case 'u':
			txt = '<u>' + window.prompt('Введите текст:','') + '</u>';
			break;
		case 'ul':
			txt = '<ul>\n<li>' + window.prompt('Введите текст:','') + '\n</ul>';
			break;
		case 'ol':
			txt = '<ol>\n<li>' + window.prompt('Введите текст:','') + '\n</ol>';
			break;
		case 'a href':
			txt = '<a href="' + window.prompt('Введите ссылку:','') + '">' + window.prompt('Введите текст:','') + '</a>';
			break;
		case 'a target=_blank href':
			txt = '<a target="_blank" href="' + window.prompt('Введите ссылку:','') + '">' + window.prompt('Введите текст:','') + '</a>';
			break;
		case 'img':
			txt = '<img src="' + window.prompt('Введите имя картинки:','') + '">';
			break;
		default:
			txt = '';
			break;
	}
	textarea.value = textarea.value + txt;
}

function checkNewParagraph(frm) {
	if (frm.orderno.value == "") return false; else return true;
}

function checkAllBoxes(objFrm, prefix, value) {
  for (var i = 0; i < objFrm.elements.length; i++) {
    var e = objFrm.elements[i];
    if ( (e.name.indexOf(prefix) == 0) && (e.type=='checkbox') && (!e.disabled) ) {
      e.checked = value;
    }
  }
}

function checkTweetCounter(txt, cntname) {
	var l = txt.value.length;
	$('#' + cntname).html('' + (140-l));
}

function ow(strUrl, strTitle, intWidth, intHeight) {
	// fix for other browsers than Safari
	if (navigator.appVersion.indexOf('Safari') < 0) {
		intWidth += 20;
		intHeight += 28;
	}
	strTitle = '';
	newWindow = window.open(strUrl, strTitle, 'width=' + intWidth + ',height=' + intHeight + ',left=0,top=0, toolbar=no,location=no,scrollbars=no,status=no,resizable=no,fullscreen=no');
	return;
}

