var minYear = 1900;
var maxYear = 2100;
var dtCh = "/";

function isInteger(s)
{
	var i;
    for (i = 0; i < s.length; i++){   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function stripCharsInBag(s, bag)
{
	var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++){   
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function daysInFebruary (year)
{
	// February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}

function DaysArray(n) 
{
	for (var i = 1; i <= n; i++) {
		this[i] = 31
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
		if (i==2) {this[i] = 29}
   } 
   return this
}

function isDate(dtStr)
{
	var daysInMonth = DaysArray(12)
	var pos1=dtStr.indexOf(dtCh)
	var pos2=dtStr.indexOf(dtCh,pos1+1)
	var strMonth=dtStr.substring(0,pos1)
	var strDay=dtStr.substring(pos1+1,pos2)
	var strYear=dtStr.substring(pos2+1)
	strYr=strYear
	if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
	if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
	for (var i = 1; i <= 3; i++) {
		if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
	}
	month=parseInt(strMonth)
	day=parseInt(strDay)
	year=parseInt(strYr)
	if (pos1==-1 || pos2==-1){
		return false
	}
	if (strMonth.length<1 || month<1 || month>12){
		return false
	}
	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
		return false
	}
	if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
		return false
	}
	if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
		return false
	}
return true
}

function checkRegistration()
{	
	if( isBlank($F('username')) )
	{
		new Effect.Highlight('username', {startcolor: '#ff0000'});
		return false;		
	}

	if( isBlank($F('password')) )
	{
		new Effect.Highlight('password', {startcolor: '#ff0000'});
		return false;		
	}
	
	if( isBlank($F('verify_password')) )
	{
		new Effect.Highlight('verify_password', {startcolor: '#ff0000'});
		return false;		
	}

	if( $F('password') != $F('verify_password') )
	{
		new Effect.Highlight('password', {startcolor: '#ff0000'});		
		new Effect.Highlight('verify_password', {startcolor: '#ff0000'});
		return false;
	}

	if( isBlank($F('email')) || ! isEmailValid($F('email')) )
	{
		new Effect.Highlight('email', {startcolor: '#ff0000'});
		return false;		
	}

	if( isBlank($F('type')) )
	{
		new Effect.Highlight('type', {startcolor: '#ff0000'});
		return false;		
	}

	if( isBlank($F('captcha')) )
	{
		new Effect.Highlight('captcha', {startcolor: '#ff0000'});
		return false;		
	}
}

function checkActivation()
{	
	if( isBlank($F('username')) )
	{
		new Effect.Highlight('username', {startcolor: '#ff0000'});
		return false;		
	}

	if( isBlank($F('password')) )
	{
		new Effect.Highlight('password', {startcolor: '#ff0000'});
		return false;		
	}

	if( isBlank($F('type')) )
	{
		new Effect.Highlight('type', {startcolor: '#ff0000'});
		return false;		
	}
}

function isBlank(fieldValue) 
{
	var blankSpaces = / /g;
	fieldValue = fieldValue.replace(blankSpaces, "");
	return (fieldValue == "") ? true : false;
}

function isEmailValid(fieldValue) 
{
	var emailFilter = /^.+@.+\..{2,4}$/;
	var atSignFound = 0;
	for (var i = 0; i <= fieldValue.length; i++)
		if ( fieldValue.charAt(i) == "@" )
			atSignFound++;
	if ( atSignFound > 1 )
		return false;
	else
		return ( emailFilter.test(fieldValue) && !doesEmailHaveInvalidChar(fieldValue) ) ? true : false;
}

function doesEmailHaveInvalidChar(fieldValue) 
{
	var illegalChars = /[\(\)\<\>\,\;\:\\\/\"\[\] ]/;
	return ( illegalChars.test(fieldValue) ) ? true : false;
}

function checkusername()
{
	var username = document.getElementById('username').value;
	
	var func = function(t) {
		var result = t.responseText;

		if( result == 'free' )
		{
			document.getElementById('checkusername').style['color'] = 'green';
			document.getElementById('checkusername').innerHTML = 'Супер! Името е свободно.';
		}
		else
		{
			document.getElementById('checkusername').style['color'] = 'red';			
			document.getElementById('checkusername').innerHTML = 'Хм, заето е.';	
		}
	}
	
	Element.show('checkusername');
	Element.hide('askfree');	
	
	if( isBlank(username) )
	{
		document.getElementById('checkusername').innerHTML = 'Няма въведено име.';		
		return false;
	}
	else
	{
		document.getElementById('checkusername').innerHTML = 'Eдин момент моля ...';
	}
	
	new Ajax.Request(base_url+'register/checkusername', { method: 'post', postBody: 'username='+username, onSuccess: func });	
	return false;
}

function putchecklink()
{
	Element.hide('checkusername');
	Element.show('askfree');
}

function checklogin()
{
	if( isBlank($F('username')) )
	{
		new Effect.Highlight('username', {startcolor: '#ff0000'});
		return false;		
	}

	if( isBlank($F('password')) )
	{
		new Effect.Highlight('password', {startcolor: '#ff0000'});
		return false;		
	}
}

function checkContact()
{
	if( isBlank($F('name')) )
	{
		new Effect.Highlight('name', {startcolor: '#ff0000'});
		return false;		
	}
	
	if( isBlank($F('email')) || ! isEmailValid($F('email')) )
	{
		new Effect.Highlight('email', {startcolor: '#ff0000'});
		return false;		
	}
	
	if( isBlank($F('subject')) )
	{
		new Effect.Highlight('subject', {startcolor: '#ff0000'});
		return false;		
	}	
	
	if( isBlank($F('message')) )
	{
		new Effect.Highlight('message', {startcolor: '#ff0000'});
		return false;		
	}	
}

function checkAccess()
{
	if( isBlank($F('email')) || ! isEmailValid($F('email')) )
	{
		new Effect.Highlight('email', {startcolor: '#ff0000'});
		return false;		
	}
	
	if( $F('new_password') != $F('confirm_password') )
	{
		new Effect.Highlight('new_password', {startcolor: '#ff0000'});		
		new Effect.Highlight('confirm_password', {startcolor: '#ff0000'});
		return false;
	}	
}

function checkProfile()
{
	if( isBlank($F('name')) )
	{
		new Effect.Highlight('name', {startcolor: '#ff0000'});
		return false;		
	}
		
	if( $F('day') != 0 || $F('month') != 0 || $F('year') != 0 )
	{
		var date = $F('month')+'/'+$F('day')+'/'+$F('year');

		if( ! isDate(date) )
		{
			new Effect.Highlight('day', {startcolor: '#ff0000'});
			new Effect.Highlight('month', {startcolor: '#ff0000'});
			new Effect.Highlight('year', {startcolor: '#ff0000'});
			return false;
		}
	}	
}

function checkUpload(field)
{	
	if( isBlank($F(field)) )
	{
		new Effect.Highlight(field, {startcolor: '#ff0000'});
		return false;		
	}
}

function checkFolder()
{
	if( isBlank($F('cat_name')) )
	{
		new Effect.Highlight('cat_name', {startcolor: '#ff0000'});
		return false;		
	}	
}

function verifyDeleteContact(contact, id)
{	
	var question = confirm('Наистина ли искаш да изтриеш този контакт?');
	
	if( question )
	{
		var loading = function() {
			document.getElementById('l'+contact).innerHTML = '<img src="'+base_url+'img/front/ajax-loader.gif" />';
			new Effect.Appear('l'+contact);
		}
		
		var success = function(t) {			
			var result = t.responseText;
			
			if( result == 'success' )
			{
				new Effect.Fade(contact);
			}
		}
		
		new Ajax.Request(base_url+'my_contacts/delete_contact', { method:'post', postBody:'id='+id, onLoading: loading, onSuccess: success });
	}

	return false;
}

function verifyDeleteFolder(folder, id, how)
{
	document.getElementById('lf'+id).innerHTML = '<img src="'+base_url+'img/front/ajax-loader.gif" />';	
	
	var question = confirm('Наистина ли искаш да изтриеш тази папка и всички контакти в нея?');
	
	if( question )
	{
		if( how == 'none' )
		{
			return true;	
		}
		else
		{						
			var loading = function() {
				document.getElementById('l'+folder).innerHTML = '<img src="'+base_url+'img/front/ajax-loader.gif" />';
				new Effect.Appear('l'+folder);
			}
			
			var success = function(t) {			
				var result = t.responseText;
				
				if( result == 'success' )
				{
					new Effect.Fade(folder);
				}
			}
			
			new Ajax.Request(base_url+'my_contacts/del_category', { method:'post', postBody:'id='+id, onLoading: loading, onSuccess: success });
		}
	}
	else
	{
		document.getElementById('lf'+id).innerHTML = '<img src="'+base_url+'img/front/icon_contacts_folder.gif" />';
		return false;
	}	
	
	return false;
}

function addFolder(action)
{
	if( action == 'show' )
	{
		new Effect.Appear('addFolder');
	}
	else if( action == 'hide' )
	{
		new Effect.Fade('addFolder');		
	}
	
	return false;
}

function editFolder(id, name)
{
	document.getElementById('lf'+id).innerHTML = '<img src="'+base_url+'img/front/ajax-loader.gif" />';	
	var newFolder = prompt('Какво ново име да има папката?');
	
	if( newFolder != '' && newFolder != null )
	{		
		var complete = function() {
			document.getElementById('lf'+id).innerHTML = '<img src="'+base_url+'img/front/icon_contacts_folder.gif" />';
		}
		
		new Ajax.Updater('h'+id, base_url+'my_contacts/edit_category', { method:'post', postBody:'id='+id+'&name='+newFolder, asynchronous:false, onComplete:complete });	
		new Effect.Highlight('f'+id);
	}
	else
	{
		document.getElementById('lf'+id).innerHTML = '<img src="'+base_url+'img/front/icon_contacts_folder.gif" />';
	}
}

function checkNewContact(name)
{
	if( ! isBlank($F(name)) )
	{
		var loading = function() {
			document.getElementById('check').innerHTML = '<img src="'+base_url+'img/front/ajax-loader.gif" style="margin-top: 6px;" />';
		}
		
		var success = function(t) {			
			var result = t.responseText;
			
			if( result == 'yes' )
			{
				document.getElementById('result').style['color'] = 'green';			
				document.getElementById('result').innerHTML = 'Супер! Има такъв потребител.';
			}
			else
			{
				document.getElementById('result').style['color'] = 'red';
				document.getElementById('result').innerHTML = 'За съжаление няма такъв потребител.';
			}
	
			new Effect.Appear('result');
			document.getElementById('check').innerHTML = '<a href="javascript:void(0);" onclick="checkNewContact(\''+name+'\');"><img src="'+base_url+'img/front/icon_check_user.gif" alt="провери, дали съществува" title="провери, дали съществува" style="margin-top: 6px;" /></a>';
		}
		
		new Ajax.Request(base_url+'my_contacts/checkNewContact', { method:'post', postBody:'username='+$F(name), onLoading: loading, onSuccess: success });		
	}
}

function checkAddGroup(form)
{	
	if( isBlank($F('group_name')) )
	{
		new Effect.Highlight('group_name', {startcolor: '#ff0000'});
		return false;		
	}

	if( ! form.group_type[0].checked && ! form.group_type[1].checked && ! form.group_type[2].checked )
	{
		new Effect.Highlight('wo', {startcolor: '#ff0000'});
		new Effect.Highlight('wc', {startcolor: '#ff0000'});
		new Effect.Highlight('wp', {startcolor: '#ff0000'});
		return false;
	}
}

function checkGroupName()
{
	if( ! isBlank($F('group_name')) )
	{
		var loading = function() {
			document.getElementById('check').innerHTML = '<img src="'+base_url+'img/front/ajax-loader.gif" style="margin-top: 6px;" />';
		}
		
		var success = function(t) {			
			var result = t.responseText;
			
			if( result == 'no' )
			{
				document.getElementById('result').style['color'] = 'green';			
				document.getElementById('result').innerHTML = 'Супер! Все още няма такава група.';
			}
			else
			{
				document.getElementById('result').style['color'] = 'red';
				document.getElementById('result').innerHTML = 'Опс, някой вече е създал тази група.';
			}
	
			new Effect.Appear('result');
			document.getElementById('check').innerHTML = '<a href="javascript:void(0);" onclick="checkGroupName()"><img src="'+base_url+'img/front/icon_check_group.gif" alt="Провери, дали има вече такава група" title="Провери, дали има вече такава група" style="margin-top: 6px;" /></a>';
		}
		
		new Ajax.Request(base_url+'groups/home/checkNewGroup', { method:'post', postBody:'group_name='+$F('group_name'), onLoading: loading, onSuccess: success });		
	}
}

function verifyDeleteMessage( how )
{	
	var question = confirm( ( how == 'trash' ) ? 'Пращаме ли съобщението в кошчето?' : 'Наистина ли искаш да го изтриеш завинаги?' );
	
	return ( question ) ? true : false;
}

function checkMsgAnswer()
{
	if( isBlank($F('answer')) )
	{
		new Effect.Highlight('answer', {startcolor: '#ff0000'});
		return false;		
	}		
	else
	{
		document.getElementById('submit').disabled = true;	
	}
}

function modAnswerForm()
{
	if( document.getElementById('answer_message').style.display == 'none' )
	{
		new Effect.Appear('answer_message');
		document.getElementById('want_to_answer').style.display = 'none';
	}
	else
	{
		document.getElementById('answer').outerHTML = '';
		document.getElementById('answer_message').style.display = 'none';
		document.getElementById('want_to_answer').style.display = 'block';
	}
	
	return false;	
}

function changecolor( color )
{	
	var list 	= $('colors').getElementsByTagName('div');
	var num 	= list.length;

	if( num > 0 )
	{
		for( a = 0; a < num; a++ )
		{
			list[a].style.border='1px solid #f1f1f1';
       	}
	}

	document.getElementById('color_id').value = color;
	document.getElementById('c_'+color).style.border = '2px solid #999';
}

function check_fPassword()
{
	if( isBlank($F('email')) || ! isEmailValid($F('email')) )
	{
		new Effect.Highlight('email', {startcolor: '#ff0000'});
		return false;		
	}		
}

function checkAddContact()
{
	if( isBlank($F('username')) )
	{
		new Effect.Highlight('username', {startcolor: '#ff0000'});
		return false;		
	}		
}

function checkWriteMsg(name, reserve)
{
	if( document.getElementById('input_field').style.display == 'none' )
	{	
		if( isBlank($F(reserve)) || $F(reserve) == 0 )
		{
			new Effect.Highlight(reserve, {startcolor: '#ff0000'});
			return false;		
		}			
	}
	else if( document.getElementById('mycontacts').style.display == 'none' )
	{
		if( isBlank($F(name)) )
		{
			new Effect.Highlight(name, {startcolor: '#ff0000'});
			return false;		
		}		
	}

	if( isBlank($F('subject')) )
	{
		new Effect.Highlight('subject', {startcolor: '#ff0000'});
		return false;		
	}		
	
	if( isBlank($F('msg')) )
	{
		new Effect.Highlight('msg', {startcolor: '#ff0000'});
		return false;		
	}			
}

function getMyContacts()
{	
	if( document.getElementById('input_field').style.display == 'none' )
	{
		document.getElementById('input_field').style.display = 'block';
		document.getElementById('mycontacts').style.display = 'none';
		return false;
	}
	else
	{
		document.getElementById('input_field').style.display = 'none';
		document.getElementById('receiver').value = '';
		document.getElementById('mycontacts').style.display = 'block';
		return false;
	}
}


function checkEditGroup()
{
	if( isBlank($F('group_name')) )
	{
		new Effect.Highlight('group_name', {startcolor: '#ff0000'});
		return false;		
	}		

	if( isBlank($F('tag_name')) )
	{
		new Effect.Highlight('tag_name', {startcolor: '#ff0000'});
		return false;		
	}		
}

function verifyDeleteGroup(folder, id, how)
{
	document.getElementById('lc'+id).innerHTML = '<img src="'+base_url+'img/front/ajax-loader.gif" />';	
	
	var question = confirm('Наистина ли искаш да изтриеш тази група и всички контакти и теми в нея?');
	
	if( question )
	{
		if( how == 'none' )
		{
			return true;	
		}
		else
		{						
			var loading = function() {
				document.getElementById('l'+folder).innerHTML = '<img src="'+base_url+'img/front/ajax-loader.gif" />';
				new Effect.Appear('c'+folder);
			}
			
			var success = function(t) {			
				var result = t.responseText;
				
				if( result == 'success' )
				{
					new Effect.Fade(folder);
				}
			}
			
			new Ajax.Request(base_url+'groups/manage/delete', { method:'post', postBody:'id='+id, onLoading: loading, onSuccess: success });
		}
	}
	else
	{
		document.getElementById('lc'+id).innerHTML = '<img src="'+base_url+'img/front/icon_group_25.gif" />';
		return false;
	}	
	
	return false;	
}

function check_tellFriend()
{
	if( isBlank($F('my_name')) )
	{
		new Effect.Highlight('my_name', {startcolor: '#ff0000'});
		return false;		
	}		
	
	if( isBlank($F('my_email')) || ! isEmailValid($F('my_email')) )
	{
		new Effect.Highlight('my_email', {startcolor: '#ff0000'});
		return false;		
	}		

	if( isBlank($F('friend_email')) || ! isEmailValid($F('friend_email')) )
	{
		new Effect.Highlight('friend_email', {startcolor: '#ff0000'});
		return false;		
	}
}

function checkAddInfo()
{
	if( isBlank($F('name')) )
	{
		new Effect.Highlight('name', {startcolor: '#ff0000'});
		return false;		
	}		

	if( $F('city') == 0 )
	{
		new Effect.Highlight('city', {startcolor: '#ff0000'});
		return false;		
	}		

	if( isBlank($F('address')) )
	{
		new Effect.Highlight('address', {startcolor: '#ff0000'});
		return false;		
	}		

	if( $F('type_id') == 0 )
	{
		new Effect.Highlight('type_id', {startcolor: '#ff0000'});
		return false;		
	}
}

function fillTime()
{
	var begin = $F('monday_b');
	var end = $F('monday_e');
	
	if( isBlank(begin) || isBlank(end) )
	{
		alert('Попълни само работното време за понеделник първо.');	
	}
	else
	{
		var days = new Array('tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday');
		
		for( i = 0; i < days.length; i++ )
		{
			var day = days[i]+'_b';
			document.getElementById(day).value = begin;
			
			day = days[i]+'_e';
			document.getElementById(day).value = end;		
		}	
	}
	
	return false;	
}

function closedTime()
{
	document.getElementById('sunday_b').value = '-';
	document.getElementById('sunday_e').value = '-';
	return false;
}

function checkAddServices()
{
	for( i = 1; i < 11; i++ )
	{
		if( ! isBlank($F('service'+i)) )
		{
			if( isBlank($F('price'+i)) )	
			{
				new Effect.Highlight('price'+i, {startcolor: '#ff0000'});
				return false;		
			}
			else if( isBlank($F('price_type'+i)) )
			{
				new Effect.Highlight('price_type'+i, {startcolor: '#ff0000'});
				return false;							
			}
		}		
	}
}

function verifyRemoveSpot(spot, id)
{	
	document.getElementById('lc'+id).innerHTML = '<img src="'+base_url+'img/front/ajax-loader.gif" />';	

	var question = confirm('Наистина ли вече не харесваш спота?');
	
	if( question )
	{
		var loading = function() {
			document.getElementById('lc'+id).innerHTML = '<img src="'+base_url+'img/front/ajax-loader.gif" />';
			new Effect.Appear('lc'+id);
		}
		
		var success = function(t) {			
			var result = t.responseText;
			
			if( result == 'success' )
			{
				new Effect.Fade(spot);
			}
		}
		
		new Ajax.Request(base_url+'my_spots/remove_spot', { method:'post', postBody:'id='+id, onLoading: loading, onSuccess: success });
	}
	else
	{
		document.getElementById('lc'+id).innerHTML = '<img src="'+base_url+'img/front/icon_spot_25.gif" />';			
	}
	
	return false;
}

function verifyDeleteSpot(spot, id)
{	
	document.getElementById('lc'+id).innerHTML = '<img src="'+base_url+'img/front/ajax-loader.gif" />';	

	var question = confirm('Наистина ли искаш да изтриеш спота? По този начин той няма да фигурира повече тук и цялата информация за него ще изчезне. Е?');
	
	if( question )
	{
		var loading = function() {
			document.getElementById('lc'+id).innerHTML = '<img src="'+base_url+'img/front/ajax-loader.gif" />';
			new Effect.Appear('lc'+id);
		}
		
		var success = function(t) {			
			var result = t.responseText;
			
			if( result == 'success' )
			{
				new Effect.Fade(spot);
			}
		}
		
		new Ajax.Request(base_url+'my_spots/delete_spot', { method:'post', postBody:'id='+id, onLoading: loading, onSuccess: success });
	}
	else
	{
		document.getElementById('lc'+id).innerHTML = '<img src="'+base_url+'img/front/icon_spot_25.gif" />';			
	}
	
	return false;
}

function verifyDeleteFAQQuestion( )
{	
	var question = confirm( 'Искате ли да изтриете въпроса?' );
	
	return ( question ) ? true : false;
}

function verifyDeleteFAQCategory( )
{	
	var question = confirm( 'Искате ли да изтриете категорията?' );
	
	return ( question ) ? true : false;
}

function change_s_forms()
{
	if( $('basic_search_form').style.display == 'none' )
	{
		$('advanced_search_form').style.display = 'none';
		new Effect.Appear('basic_search_form');	
		$('advanced_search').innerHTML = '<a href="javascript:void(0);" onclick="change_s_forms()">Детайлно търсене</a>';
	}
	else
	{
		$('basic_search_form').style.display = 'none';
		new Effect.Appear('advanced_search_form');
		$('advanced_search').innerHTML = '<a href="javascript:void(0);" onclick="change_s_forms()">Опростено търсене</a>';
	}
}

function vote_spot(id, how, member_id)
{	
	if ( member_id == 0 )
	{
		$('vote_done').innerHTML = 'Хей, <a href="'+base_url+'login">логни се</a> в акаунта си първо.';
		new Effect.Appear('vote_done');
		return false;
	}
	else
	{
		new Ajax.Updater('vote_results', base_url+'spots/vote', { method:'post', postBody:'id='+id+'&how='+how, asynchronous:false });
		new Effect.Highlight('vote_results');
	}
}

function show_comment_form(how)
{
	if( how == 'logged' )
	{
		if( $('comment_form').style.display == 'none' )
		{
			$('more_comments').style.display = 'none';
			new Effect.Appear('comment_form');
		}
		else
		{
			$('comment_form').style.display = 'none';		
			$('answer').value = '';
			new Effect.Appear('more_comments');	
		}
	}
	else if( how == 'normal' )
	{
		if( $('comment_form').style.display == 'none' )
		{
			$('no_comments').style.display = 'none';
			new Effect.Appear('comment_form');
		}
		else
		{
			$('comment_form').style.display = 'none';		
			$('answer').value = '';
			new Effect.Appear('no_comments');	
		}
	}
}

function checkCompany()
{
	if( ! isBlank($F('email')) )
	{
		if( ! isEmailValid($F('email')) )
		{
			new Effect.Highlight('email', {startcolor: '#ff0000'});
			return false;		
		}	
	}
}

function checkPhotoDelete()
{
	return confirm('Наистина ли искаш да изтриеш снимката?');		
}

function checkStartSearch()
{
	if( isBlank($F('keywords')) )	
	{
		new Effect.Highlight('keywords', {startcolor: '#ff0000'});	
		return false;	
	}	
}

function checkAdvSearch()
{
	if( $F('cities') == 0 )	
	{
		new Effect.Highlight('cities', {startcolor: '#ff0000'});
		return false;		
	}

	if( $F('type_id') == 0 )	
	{
		new Effect.Highlight('type_id', {startcolor: '#ff0000'});
		return false;		
	}
	
	if( isBlank($F('adv_keywords')) )	
	{
		new Effect.Highlight('adv_keywords', {startcolor: '#ff0000'});
		return false;		
	}	
}