function sendToFriend(material_id) {
	//showEditor('stf_content', 'ClientShort', 360, 200);
	
	STFfillField(material_id);
	
	document.getElementById('div_trans').style.height = document.body.scrollHeight+"px";
	document.getElementById('div_trans').style.display = "block";
	
	var width = "740";
	var height = "360";
	var left = (screen.width  - width)  / 2;
	var top = (screen.height - height) / 3 + document.body.scrollTop;
	document.getElementById('div_send_to_friend').style.width = width+"px";
	document.getElementById('div_send_to_friend').style.height = height+"px";
	document.getElementById('div_send_to_friend').style.left = left+"px";
	document.getElementById('div_send_to_friend').style.top = top+"px";
	
	document.getElementById('div_send_to_friend').style.display = "block";
	loadFriendList();
}


function loadFriendList() {
	var url = base_url+"/js/STF_load_friend_list.js";
	var jsel = document.createElement('SCRIPT');
	jsel.type = 'text/javascript';
	jsel.src = url;
	document.getElementById('js').appendChild(jsel);	
}



function addFrindToSendToFrd(id) {
	if (browser_type == 'msie') var nick_name = document.getElementById('stf_frd_list_'+id).innerText;
	else var nick_name = document.getElementById('stf_frd_list_'+id).textContent;
	
	if (document.getElementById('stf_to').value) nick_name = ", "+nick_name;
	document.getElementById('stf_to').value += nick_name;
}


function sendToFriendRss(rss_id) {
	
	//showEditor('stf_content', 'ClientShort', 360, 200);
	
	STF_RSSfillField(rss_id);
	
	document.getElementById('div_trans').style.height = document.body.scrollHeight+"px";
	document.getElementById('div_trans').style.display = "block";
	
	var width = "500";
	var height = "380";
	var left = (screen.width  - width)  / 2;
	var top = (screen.height - height) / 3 + document.body.scrollTop;
	document.getElementById('div_send_to_friend').style.width = width+"px";
	document.getElementById('div_send_to_friend').style.height = height+"px";
	document.getElementById('div_send_to_friend').style.left = left+"px";
	document.getElementById('div_send_to_friend').style.top = top+"px";
	
	document.getElementById('div_send_to_friend').style.display = "block";
	
	loadFriendList();
}


function sendToFriendPhotoAlbum(album_id) {
	
	STF_PhotoAlbumfillField(album_id);
	
	document.getElementById('div_trans').style.height = document.body.scrollHeight+"px";
	document.getElementById('div_trans').style.display = "block";
	
	var width = "500";
	var height = "380";
	var left = (screen.width  - width)  / 2;
	var top = (screen.height - height) / 3 + document.body.scrollTop;
	document.getElementById('div_send_to_friend').style.width = width+"px";
	document.getElementById('div_send_to_friend').style.height = height+"px";
	document.getElementById('div_send_to_friend').style.left = left+"px";
	document.getElementById('div_send_to_friend').style.top = top+"px";
	
	document.getElementById('div_send_to_friend').style.display = "block";
	
	loadFriendList();
}


function stf_close() {
	document.getElementById('div_send_to_friend').style.display = "none";
	document.getElementById('div_trans').style.display = "none";
}



function STFfillField(material_id) {
	var url = base_url+"/js/STF_get_info.js&material_id="+material_id;
	var jsel = document.createElement('SCRIPT');
	jsel.type = 'text/javascript';
	jsel.src = url;
	document.getElementById('js').appendChild(jsel);	
}


function STF_PhotoAlbumfillField(album_id) {
	var url = base_url+"/js/STF_photo_album_get_info.js&album_id="+album_id;
	var jsel = document.createElement('SCRIPT');
	jsel.type = 'text/javascript';
	jsel.src = url;
	document.getElementById('js').appendChild(jsel);
	
}


function STF_RSSfillField(rss_id) {
	var url = base_url+"/js/STF_rss_get_info.js&rss_id="+rss_id;
	var jsel = document.createElement('SCRIPT');
	jsel.type = 'text/javascript';
	jsel.src = url;
	document.getElementById('js').appendChild(jsel);
	
}


function checkSTFForm() {
	var message = "";
	
	//var secImgArr = document.getElementById('img_pm_stf_sec_code').src.split('/');
	
	
	if (document.getElementById('stf_to').value == "") {
		message += 'Введите Получателей';
	}

	if (FCKeditorAPI.GetInstance('stf_content').GetXHTML(true) == "") {
		if (message != "") message += "\n";
		message += 'Введите Тело Сообщения';
	}
	
	if (document.getElementById('stf_from_nick_name').value == "") {
		if (message != "") message += "\n";
		message += 'Введите Подпись';
	}


	if (message == "") {
		return true;
	}
	else {
		alert(message);
		return false;
	}
}