//editor_page - the page that is used in AjaxRequest
//editor_fields=array of fields names
if (document.images) {
    var img = new Object();
    img = new Image();
    img.src = "loader.gif";
}
function paste_error(error) {	
	str='<span class="data-mark">'+error+'</span>';
	return str;
}
function paste_loader(field_id) {
	document.getElementById(field_id).innerHTML='<img src="js/ajax/loading.gif" border="0" vspace=5>';
}
function remove_loader(field_id) {
	if (document.getElementById(field_id))
		document.getElementById(field_id).innerHTML='';
}
function editor_loader() {
	if (document.getElementById("errors"))
		document.getElementById("errors").innerHTML='';
}
//for ceparate add
function forward_friend() {
	paste_loader("loader");
	form="surveyform";
	str="";
	for (i=0; i<document.forms[form].elements.length; i++)
	{
		str=str+"&"+document.forms[form].elements[i].name+"="+document.forms[form].elements[i].value;
	}
	str="survey.php"+'?'+str;
	//alert(str);
	AjaxRequest('GET', str, '', forward_friend_result, false);
	return false;
}

function forward_friend_result(text)
{	//alert(text);
	remove_loader("loader");
	arrayOfStrings = text.split(':::');
	field_id='errors';
	if (arrayOfStrings[0]=='TRUE'){
		top.document.getElementById(field_id).innerHTML=paste_error(arrayOfStrings[1]);	
		top.TB_remove();
	}
	else if(arrayOfStrings[0]=='FALSE') {		
		document.getElementById(field_id).innerHTML=paste_error(arrayOfStrings[1]);	
	}
	else{
		document.getElementById(field_id).innerHTML=paste_error(text);	
	}
}

function print_fnc() {
	str="survey.php"+'?cmd=print';
	AjaxRequest('GET', str, '', print_fnc_result, false);
	window.print();
	return false;
}
function print_fnc_result(text) {
	return false;
}