var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
try {
var pageTracker = _gat._getTracker("UA-1312912-8");
pageTracker._trackPageview();
} catch(err) {}

function imposeMaxLength(Object, MaxLen)
{
  return (Object.value.length <= MaxLen);
}
function selectAll(form,zmienna) {
       for (var i=0;i < form.length;i++) {
               fldObj = form.elements[i];
               if (fldObj.name.substring(0,zmienna.length) == zmienna.toString())
               fldObj.checked = (fldObj.checked) ? false : true;
       }
}
function count_spec(nowy,gsm) {
	var spec_counter = 0;
	if(gsm == false) {
	// kodowanie latin
		for (i=0;i<nowy.length;i++) {
			if (
				nowy.charAt(i)=='[' || nowy.charAt(i)==']' || nowy.charAt(i)=='}' || nowy.charAt(i)=='{' || nowy.charAt(i)=='\\' ||
				nowy.charAt(i)=='~' || nowy.charAt(i)=='|' || nowy.charAt(i)=='^' || nowy.charAt(i)=="\n"
			) spec_counter++;
		}
	} else {
	// kodowanie gsm
		for (i=0;i<nowy.length;i++) {
			if (
				nowy.charAt(i)=='[' || nowy.charAt(i)==']' || nowy.charAt(i)=='}' || nowy.charAt(i)=='{' || nowy.charAt(i)=='\\' ||
				nowy.charAt(i)=='~' || nowy.charAt(i)=='|' || nowy.charAt(i)=='^' || nowy.charAt(i)=="\n" || nowy.charAt(i)=="€"
			) spec_counter++;
		}
	}
	return spec_counter;
}
function count_all(type,left,count,flash,gsm){
	if(type.value.length>0){
		var nStr = type.value;
		if(!check_other_chars(type,gsm.checked)){

			spec_counter = count_spec(type.value,gsm.checked);
			if(nStr.length+spec_counter>457) {
				type.value=type.value.substring(0,457-spec_counter);
				nStr = type.value;
			}

			left.value=457 - nStr.length - spec_counter;
			
			if (left.value<0) left.value = 0;

			flash.disabled=false;
			
			if(nStr.length+spec_counter<=160) count.value = 1;
			else if(nStr.length+spec_counter<=305) count.value = 2;
			else if(nStr.length+spec_counter<=457) count.value = 3;
			
		} else {
			if(nStr.length>201) type.value=type.value.substring(0,201-nStr.length+type.value.length);
			left.value=201 - type.value.length;
			if (left.value<0) left.value = 0;

			flash.disabled=true;
			flash.checked=false;

			if(type.value.length<=70) count.value = 1;
			else if(type.value.length<=134) count.value = 2;
			else if(type.value.length<=201) count.value = 3;

		}
		
	} else {
		left.value=457;
		count.value=1 ;
	}
}

function check_other_chars(obj,gsm){
	if (gsm == true) return !/^[@£$¥èéùìòÇØøÅå_^\{\}\\\[~\]|ÆæßÉ!"#¤%&'()*+,-.\/0-9:;<=>?¡a-zÄÖÑÜ§¿äöñüàΓΔΘΛΞΠΣΦΨΩαβγδεζηθικλμνξοπρστυφχψωςέάόίώύήϊϋΐΰΆΈΊΉΌΎΏΪΫ€ \r\n]{0,}$/i.test(obj.value);
	else return !/^[@£$¥èéùìòÇØøÅå_^\{\}\\\[~\]|ÆæßÉ!"#¤%&'()*+,-.\/0-9:;<=>?¡a-zÄÖÑÜ§¿äöñüà \r\n]{0,}$/i.test(obj.value);
}

function hinter(obj,kom,co) {
	var dl_kom = 100;
	if (co==1) {
		x = document.getElementById(obj);
		document.all.hinter.style.left = x.offsetLeft+5;

		if (x.offsetLeft+150>document.body.offsetWidth) document.all.hinter.style.left= x.offsetLeft-(dl_kom/2)+6;
		document.all.hinter.style.top = x.offsetTop-10;
		document.all.hinter.innerHTML = kom;
		document.all.hinter.style.visibility="visible";
	} else {
		document.all.hinter.style.visibility="hidden";
		document.all.hinter.style.left=0;
	}
}
function check_error(error_no) {
	if (error_no=='11' || error_no=='12') { error = 'Nevyplnili ste správu.'; }
	else if (error_no=='13') { error = 'Nesprávne vyplnený príjemca.'; }
	else if (error_no=='14') { error = 'Nesprávny odosielateľ.'; }
	else if (error_no=='17') { error = 'Nemôžete odosielať FLASH SMS so špeciálnymi znakmi.'; }
	else if (error_no=='18') { error = 'Chybný počet parametrov.'; }
	else if (error_no=='19') { error = 'Príliš veľa čísel (max. 100).'; }
	else if (error_no=='20') { error = 'Chybný počet parametrov IDX.'; }
	else if (error_no=='101') { error = 'Žiadne autorizačné data.'; }
	else if (error_no=='102') { error = 'Nesprávne prihlasovacie meno alebo heslo.'; }
	else if (error_no=='103') { error = 'Nedostatok kreditu.'; }
	else if (error_no=='104') { error = 'Žiadne šablóny.'; }
	else if (error_no=='200') { error = 'Správa nebola poslaná.'; }
	else if (error_no=='300') { error = 'Nesprávna hodnota poľa  (mal by=1).'; }
	else if (error_no=='301') { error = 'ID správy neexistuje'; }
	else if (error_no=='400') { error = 'Nesprávne ID štatútu správy.'; }
	else if (error_no=='999') { error = 'Chyba aplikácie (prosím kontaktujte nás).'; }
	return error;
}

