<!--
function can_login(){
if(document.frmLogin.user.value == ''){
	document.frmLogin.user.focus();
	alert('Моля въведете потребителско име!');
	return false;
}else if(document.frmLogin.password.value == ''){
	document.frmLogin.password.focus();
	alert('Моля въведете парола!');
	return false;
}
return true;
}


function setCookie(c_name,value,expiredays){
	var exdate=new Date();exdate.setDate(exdate.getDate()+expiredays);
	document.cookie= c_name+ "=" +escape(value)+ ((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}

function getCookie(c_name){
if (document.cookie.length>0){
	c_start=document.cookie.indexOf(c_name + "=");
	if (c_start!=-1){
		c_start=c_start + c_name.length+1; 
		c_end=document.cookie.indexOf(";",c_start);
		if (c_end==-1) c_end=document.cookie.length;
		return unescape(document.cookie.substring(c_start,c_end));
		}
	}
	return "";
}

function checkMail(str){
	var filter=/^([a-zA-Z0-9_\.\-])+@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	return filter.test(str);
}

function checkDigit(str){
	var filter=/^[0-9]{2,3}$/;
	return (filter.test(str));
}


function can_subscribe(){
	if(checkMail(document.frmSubscription.mail.value)){
		return true;
	}else{
		alert('Моля въведете валиден e-mail адрес!');
		return false;
	}
}


function can_tell_friend(){
	if(checkMail(document.frmFriend.mail.value)){
		document.frmFriend.submit();
	}else{
		document.frmFriend.mail.focus();
		alert('Моля въведете валиден e-mail адрес!');
	}
}

var req=false;
function getContent(url,paramstr,fhandle){
	try{
		req = new XMLHttpRequest(); // Opera 8.0+, Firefox, Safari
	} catch (e){
		try{ // IЕ
			req = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				req= new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){ // Something went wrong
				alert("Моля използвайте някои от следните браузъри: Konqueror, IExplorer 5.0+, Mozilla 1.0+, Netscape 7.1+, Safari 1.2+, Opera 7.6+");
				return false;
			}
		}
	}
	rand = Math.floor(Math.random()*100000);
	req.onreadystatechange=fhandle;

	req.open('GET', url+'?rand=' + rand + '&' + encodeURI(paramstr), true);
	req.send(null);
}

function calc_days(input_date, result_1, result_2){
	var date_value = document.getElementById(input_date).value;
	if (date_value.length == 10){
		document.getElementById(result_1).innerHTML = add_days(date_value, 18);
		document.getElementById(result_2).innerHTML = add_days(date_value, 49);
	}else{
		document.getElementById(result_1).innerHTML = '??.??.????';
		document.getElementById(result_2).innerHTML = '??.??.????';
	}
}

function current_date(input_date, result_1, result_2){
	var now = new Date();
	cur_year = now.getYear();
	cur_month = now.getMonth() + 1;
	cur_day = now.getDate();

	if(cur_year < 2000){
		cur_year += 1900;
	}

	if(cur_month < 10){
		cur_month = '0' + cur_month;
	}

	if(cur_day < 10){
		cur_day = '0' + cur_day;
	}
	document.getElementById(input_date).value = cur_day + '.' + cur_month + '.' + cur_year;
	calc_days(input_date, result_1, result_2);
}

function add_days(end_date, days){

	var day = parseInt(end_date.substr(0, 2));
	var month = end_date.substr(3, 2);
	var year = end_date.substr(6, 4);

	var date = new Date(year, month, day + days);
	var new_month = date.getMonth();
	if(new_month < 10){
		new_month = '0' + new_month;
	}
	var new_day = date.getDate() ;
	if(new_day < 10){
		new_day = '0' + new_day;
	}
	var new_year = date.getYear();
	if(new_year < 2000){
		new_year += 1900;
	}
	return new_day + '.' + new_month + '.' + new_year;
}

function write_contact(first, second){
	var alabala = first + second;
	document.write('<a href="mailto:' + alabala + '">' + alabala + '</a>');
}

function showPic(url, el){
	var img = document.getElementById('gImage').src = url;
	var top = ajaxTooltip_getTopPos(el);
	var left = (ajaxTooltip_getLeftPos(el) + el.offsetWidth);
	var imgDiv = document.getElementById('gImageDiv');
	imgDiv.style.display='block';
	imgDiv.style.top = top + 'px';
	imgDiv.style.left = left + 'px';
}

function hidePic(){
	document.getElementById('gImageDiv').style.display = 'none';
}

function ajaxTooltip_getTopPos(inputObj){
  var returnValue = inputObj.offsetTop;
  while((inputObj = inputObj.offsetParent) != null){
  	if(inputObj.tagName!='HTML')returnValue += inputObj.offsetTop;
  }
  return returnValue;
}

function ajaxTooltip_getLeftPos(inputObj){
  var returnValue = inputObj.offsetLeft;
  while((inputObj = inputObj.offsetParent) != null){
  	if(inputObj.tagName!='HTML')returnValue += inputObj.offsetLeft;
  }
  return returnValue;
}

function not_valid_chars(str){
	var lc = 'abcdefghijklmnopqrstuvwxyz';
	var uc='ABCDEFGHIJKLMNOPQRSTUVWXYZ';
	for (i=0; i<str.length; i++){
		ch=str.charAt(i);
		if ((lc.indexOf(ch) > -1)||(uc.indexOf(ch) > -1)){
			return true;
		}
	}
	return false;
}

function not_valid_words(str){
	str = str.toLowerCase();
	words_wrong = new Array('галабарника', 'гълабарника', 'галабарник', 'гълабарник', 'галабарници', 'гълабарници', 'галабар', 'гълабар', 'галабите', 'гълабите', 'галаби', 'гълаби', 'галаб', 'гълаб');
	words_right = new Array('гълъбарника', 'гълъбарника', 'гълъбарник', 'гълъбарник', 'гълъбарници', 'гълъбарници', 'гълъбар', 'гълъбар', 'гълъбите', 'гълъбите', 'гълъби', 'гълъби', 'гълъб', 'гълъб');
	for (i=0; i< words_wrong.length; i++){
		if(str.indexOf(words_wrong[i]) > -1){
			alert('За съжаление има правописна грешка. Моля коригирайте ' + words_wrong[i] + ' на ' + words_right[i]);
			return true;
		}
	}
	return false;
}


function can_left_search(){
	if(document.frmLeftSearch.search.value == ''){
		alert('Въведете критерий за търсене!');
		document.frmLeftSearch.search.focus();
		return false;
	}
	return true;
}
//-->