// ---------------------------------------Browser determination----------------------------------------------//

dom = (document.getElementById);
IE4x = (document.all && (parseInt(navigator.appVersion) >= 4 ));
NC4x = (document.layers && (parseInt(navigator.appVersion) >= 4 ));
br4x = (parseInt(navigator.appVersion) >= 4);

function showFeedbackError(statusText){
	alert("Ошибка");
	return false;
}

function showFeedbackRequest(formData, jqForm, options) { 
	
	f1 = jqForm[0][2]['value']; // Имя
	f2 = jqForm[0][3]['value']; // Почта
	//f3 = jqForm[0][5]['value']; // Телефон
	f4 = jqForm[0][4]['value']; // Сообщение
	
	if (f1 == "") {
		alert("Введите, пожалуйста, Ваше имя");
		return false;
	}
 	else if (((f2 == "") || (f2.indexOf('@')<0) || (f2.indexOf('.')<0))) {
		alert("Введите, пожалуйста, корректный e-Mail");
		return false;
	}
	else if (f4 == "") {
		alert("Введите, пожалуйста, текст сообщения");
		return false;
	}
	else return true;
}

function showFeedbackResponse(responseText, statusText)  { 
	return false;
}

function strip_tags( str ){
	return str.replace(/<\/?[^>]+>/gi, '');
}

function addFavorites(fav){
			switch(fav){
				case 'fb': window.open('http://www.facebook.com/share.php?u='+location.href); break;
				case 'vk': window.open('http://vkontakte.ru/share.php?url='+location.href); break;
				case 'lj': 
					var this_text = 'http://www.livejournal.com/update.bml?subject='+encodeURIComponent(this_title)+'&event='+encodeURIComponent(strip_tags(document.getElementById('aboutproject_content').innerHTML));
					text_array = this_text.split('%20');
					new_text = new String(); i=0;
					text_add = encodeURIComponent('<br/><br/><a href="'+location.href+'">Подробнее</a>');
					while(i<text_array.length && (new_text+text_array[i]+text_add).length < 2048){
						new_text += text_array[i]+'%20';
						i++;
					}
					new_text += '...'+text_add;
					
					window.open(new_text); break;
				case 'tw': window.open('http://twitter.com/home/?status='+location.href+'+-+'+encodeURIComponent(this_title)); break;
				case 'mm': window.open('http://connect.mail.ru/share?share_url='+location.href); break;
				default: break;
			}
		}		
			
		function printFavorites(){
			var favs_array = new Array('fb','tw','lj','vk','mm');
			var titles_array=new Array('Facebook','Twitter','LiveJournal','В контакте',"Мой Мир");
			// bgcolor="#51525A"
			document.write('<table cellpadding="5" cellspacing="0" style="color:#EEEEEE;"><tr valign="middle"><!--td nowrap>Отправить:</td--><td nowrap>');
			for(i=0; i<favs_array.length; i++){
				document.write('<a title="'+titles_array[i]+'" style="float:left; background:URL(/favorites/'+favs_array[i]+'.gif) no-repeat; cursor:pointer; padding:2px 7px 0 7px; margin-left:5px;" onclick="addFavorites(\''+favs_array[i]+'\')">&nbsp;</a>');
			}
			document.write('</td></tr></table>');
		}
