function onload_On(){
  window.onload = onload_Go;
}


function onload_Go(){
  for(var i = 0;i < arr_onloads_func.length;i++)
    eval(arr_onloads_func[i]);
}


function onload_Add(func){
  arr_onloads_func[arr_onloads_func.length] = func;
}


var arr_onloads_func = new Array();
var force_fill_once		=null;
//onload_Add('hideDiv("rightBox")');
//onload_Add('ajaxInit()');
//onload_Add('setHandler("tr","mo","onmouseover","rowHightlight")');




	var arr_comment_items				=new Array();
	var curr_index_in_arr_comment_items	=0;
	var max_n_items_in_comment			=0;
	var max_per_page_in_comment			=20;
	
	function class_show_all_comment_items(nform,xml_folder,page,node,list_items_id,goto_id,available_nfiles,style_function){
		this.nform						=0;
		this.page						=0;
		this.node						=0;
		this.available_nfiles			='';
		this.xmlhttp_nfile_list			=null;
		this.xmlhttp_category			=null;
		this.goto_obj					=null;
		this.list_items_obj				=null;
		this.xml_folder					='';
		this.category_ul_str			='';
		this.arr_category_lables		=new Array();;
		this.this_lable_category		='';
		this.style_function				='';
		this.curr_index_for_showing		=0;
		
		this.arr_boxes					=new Array();
		this.my_table					=null;
		this.my_tbody					=null;
		//this.arr_nfile_comment_items	=null;
		

		this.arr_ajx				=new Array();

		
		this.make_arr_category_lables=function(){
			

				
			this.category_ul_str=str_category_lables;		
			
			for(i=0;i<arr_category_lables.length;i++){
				if(arr_category_lables[i][0]==this.node){
					this.this_lable_category=arr_category_lables[i][1];
					break;
				}
			}
			
			//alert("this_lable_category="+this.this_lable_category);
			
			
		
			
			var my_row		=document.createElement("TR");
			var my_td		=document.createElement("TD");
			my_td.id		=this.xml_folder+"_item_td_00";
			this.my_tbody.appendChild(my_row);
			my_row.appendChild(my_td);	
			my_row.bgColor	="#C0E2C8";	
			my_row.align	="right";	
			my_row.dir		="ltr";	
			my_row.height	=40;	
			my_td.innerHTML	="<font dir=rtl style='font-family:arial;font-size:12pt'>&nbsp;&nbsp;<b>"+this.this_lable_category+":</b></font>";
			this.arr_boxes[0]=new Array();
			this.arr_boxes[0][0]=my_td;//obj of html
			this.arr_boxes[0][1]=0;//nfile of xml
			
			/*
			var my_row		=document.createElement("TR");
			var my_td		=document.createElement("TD");
			my_td.id		=this.xml_folder+"_item_td_01";
			this.my_tbody.appendChild(my_row);
			my_row.appendChild(my_td);	
			my_row.bgColor	="white";	
			my_row.align	="right";	
			my_row.dir		="ltr";	
			my_row.height	=40;	
			my_td.innerHTML	="<img src='"+host_address+"/fa/pictures/loading2.gif' hspace=10 vspace=10 align=middle><font dir=rtl style='font-family:tahoma;font-size:8pt;color:silver'>درحال بارگذاری...</font>";	
			this.arr_boxes[1]=new Array();
			this.arr_boxes[1][0]=my_td;//obj of html
			this.arr_boxes[1][1]=0;//nfile of xml			
			*/
		
			//alert('ddd');
			//return;
			//alert(this.node);

			var self=this;
			var aj1	=new sack();
			
			aj1.method = 'GET';
			
			if(this.node==0){
				url				=host_address+"/app3.php";
				aj1.setVar("subsite"	, 1);
				aj1.setVar("lang"		, 'fa');
				aj1.setVar("xml_folder"	, this.xml_folder);
				aj1.setVar("method"		, 10);
			}
			else
				url				=host_address+"/fa/xml/"+this.xml_folder+"/node_"+this.node+".xml";

			//alert(url);
			//return;
			//alert(this.xml_folder);
			//alert(this.xml_folder);
			aj1.requestFile		= url;	
			aj1.onCompletion	= function(){  self.xmlhttp_nfile_list=this.responseXML;   self.get_nfile_list();  };	
			aj1.runAJAX();




		}
		this.get_nfile_list=function(){
			var c_xml=this.xmlhttp_nfile_list;
			if(c_xml===false){
				alert('error 87');
				return;
			}


			//alert('dddkkkkkkkkkd');
			//return;


			var arr_nfiles	=available_nfiles.split("-");
			
			
			if(arr_nfiles=='' || arr_nfiles==undefined || (arr_nfiles.length==0)){
				obj			=c_xml.getElementsByTagName("items")[0];
				if(obj.childNodes.length==0){
					alert('.اين پوشه خالي است');
					return;
				}				
				str_nfiles	=obj.childNodes[0].nodeValue;
				
				arr_nfiles	=str_nfiles.split("-");
			}

			//alert(arr_nfiles);

				
				
			max_n_items_in_comment=arr_nfiles.length;
		
			
			
			arr_nfiles.sort(sortNumber);
			
			from_i		=(Number(this.page)-1)*max_per_page_in_comment;
			to_i		=from_i+max_per_page_in_comment-1;
			arr_nfiles2	=new Array();
			for(i=0;i<arr_nfiles.length;i++){
				if(i<from_i || i>to_i)
					continue;
				c=arr_nfiles2.length;
				arr_nfiles2[c]=arr_nfiles[i];
			}
		
			
			arr_nfile_comment_items=new Array();
			for(i=0;i<arr_nfiles2.length;i++){
				nfile						=arr_nfiles2[i];
				arr_nfile_comment_items[i]	=nfile;
			}
					
			if(this.goto_obj.innerHTML==""){
				str_goto_page_link=write_goto_page_link_in_talar(max_n_items_in_comment,max_per_page_in_comment,this.node,this.nform,this.page);	
				this.goto_obj.innerHTML=str_goto_page_link;
			}
		
			
			//alert(arr_nfile_comment_items.length);
			//return;
			//this.my_table.deleteRow(1);
		
			var i;	
			var this_id;
			this.arr_ajx=new Array();//reset array
			

			
			for(i=0;i<arr_nfile_comment_items.length;i++){

				var my_row	=document.createElement("TR");
				var my_td	=document.createElement("TD");
				my_td.id	=this.xml_folder+"_item_td_"+arr_nfile_comment_items[i];
				this.my_tbody.appendChild(my_row);
				my_row.appendChild(my_td);	
				my_row.bgColor	="white";	
				my_row.align	="right";	
				my_row.dir		="ltr";	
				my_td.innerHTML	="<img src='"+host_address+"/fa/pictures/loading2.gif' hspace=10 vspace=10 align=middle><font dir=rtl style='font-family:tahoma;font-size:8pt;color:silver'>درحال بارگذاری...</font>";	
				

			}
			
			
			
			this.show_a_row(this.curr_index_for_showing);
			
			//window.setTimeout("this.fill_rows()", 1000);
			//window.setTimeout("fill_rows()", 100);
			

		};	

		this.show_a_row=function(index){
			//alert('index='+index);
			
			
			this_id		=arr_nfile_comment_items[index];
			var url		=host_address+"/fa/xml/board/"+this_id+".xml";
			
			var c=this.arr_ajx.length;
			//arr_ajx[c]	=new class_show_one_comment_item(url,7,this_id,'board',"f115(qst_row,time_send,nfile,arr_pics);");
			this.arr_ajx[c]	=new class_show_one_comment_item(url,this.nform,this_id,this.xml_folder,this.style_function);
			
			//alert(arr_ajx[c].arr_pics);
			
			this.curr_index_for_showing++;
			//alert(this.curr_index_for_showing);
			//if(arr_nfile_comment_items[this.curr_index_for_showing])
			
			var self=this;
			if(this.curr_index_for_showing<arr_nfile_comment_items.length)
				window.setTimeout("cc44.show_a_row("+this.curr_index_for_showing+");", 10);
				
				//this.show_a_row(this.curr_index_for_showing);
				
			
				
			
		};
		this.init_class=function(){
			
			this.nform				=nform;
			this.page				=page;
			this.node				=node;
			this.available_nfiles	=available_nfiles;
			this.xml_folder			=xml_folder;
			this.style_function		=style_function;
			
			eval("this.goto_obj=document.all."+goto_id);
			eval("this.list_items_obj=document.all."+list_items_id);

			
			var curr_node=node;
			var curr_page					=page;
			this.goto_obj.innerHTML			="";
			this.list_items_obj.innerHTML	="";
			
			c_xml_comment_form		=null;
			comment_node_count		=new Array();
			//arr_category_lables		=new Array();
			//arr_qst_titles			=new Array();
			c_xml_node				=null;
			tbody_of_comment			=null;
			arr_xml_comment_items		=new Array();
			arr_nfile_comment_items	=new Array();
			arr_xml_pic_comment_items	=new Array();
			curr_node				=0;
			curr_page				=0;	
			

			
			my_this_page=page;
			curr_index_in_arr_comment_items=0;
			arr_nfile_comment_items=new Array();
		
			
			this.my_table=document.createElement("TABLE");
			
			this.my_tbody=document.createElement("TBODY");
			this.my_tbody.id="main_tbody";
			this.my_table.appendChild(this.my_tbody);
			this.list_items_obj.appendChild(this.my_table);
			this.my_table.cellSpacing=1;
			this.my_table.cellPadding=0;
			
			this.my_table.bgColor='#8FBC8F';	
			this.my_table.width='100%';	
			
			
			if(available_nfiles==''){
				var url=host_address+"/fa/xml/"+this.xml_folder+"/node_list.xml";
				//alert(url);
				var self=this;
				var aj1	=new sack();
	
				aj1.requestFile		= url;	
				aj1.onCompletion	= function(){  self.xmlhttp_category=this.responseXML;   self.make_arr_category_lables();  };	
				aj1.runAJAX();				
			}
			else	
				this.get_nfile_list();
			
			
			
				
						
		};			

		
		this.init_class();
	}
	//
	//end of class class_show_all_comment_items
	//-----------------------------------------
	//-----------------------------------------
	
	
	
	
	
	
	
	function class_show_one_comment_item(url,nform,nfile,xml_folder,style_function){
		this.url			='';
		this.nfile			=0;
		this.xmlhttp_1		=null;
		this.xmlhttp_2		=null;
		this.xmlhttp_3		=null;
		this.xml_folder		=null;
		this.main_td_obj	=null;
		this.nform			=null;
		this.style_function	='';
		this.arr_pics		=null;
		
		this.error_f1=function(){
			//alert('error in nfile='+this.nfile);
			this.main_td_obj.innerHTML='';
		}
		this.f1=function(){
			var c_xml=this.xmlhttp_1;
			//alert(this.nfile);
			//var c_xml_node=this.arr_xmlhttp[index][1];
			//var c_xml_node=this.k2;
			if(c_xml===false){
				alert('error 87');
				return;
			}

			eval("var c_xml_talar_form=c_xml_talar_form_"+this.nform);
			
			main_title_number	=c_xml_talar_form.getElementsByTagName("main_title_number"	)[0].childNodes[0].nodeValue;
			main_body_number	=c_xml_talar_form.getElementsByTagName("main_body_number"	)[0].childNodes[0].nodeValue;
			
			obj				=c_xml.getElementsByTagName("noskhe")[0];
			
			
			if(obj.getElementsByTagName("time").length==0)
				time_send		=obj.getElementsByTagName("time_send")[0].childNodes[0].nodeValue;
			else
				time_send		=obj.getElementsByTagName("time")[0].childNodes[0].nodeValue;
				
			
	
			
			

				
			var nform2		=0;
			var value2		='';
			var arr_pics	=new Array();
			this.arr_pics	=new Array();
			
			var obj_relation=obj.getElementsByTagName("relations")[0];
			//if(this.nfile==17021){
			//	alert(obj_relation.getElementsByTagName('form')[0]);
			//}
			for(i=0;i<obj_relation.childNodes.length;i++){
				nform2=0;
				value2='';
				try {
   					//s	=obj.getElementsByTagName("qst_"+i)[0].childNodes[0].nodeValue;
   					//s	=obj.getElementsByTagName("qst_"+i)[0].getAttribute("nform");
   					//qst="form";
   					//alert(qst);
   					//nform2=obj.getElementsByTagName(qst)[0].getAttribute("nform");
   					cmd="nform2=obj_relation.getElementsByTagName('form')["+i+"].getAttribute('name');";

   					eval(cmd);
   					
   					value2	=obj_relation.getElementsByTagName('form')[i].childNodes[0].nodeValue;
				}
				catch(e){
   					//alert('e='+e);
				}
				if(nform2==1){
					break;
				}
			}
			if(nform2==1){
				//alert("nfile="+this.nfile+"         i="+i+"    nform="+nform2+"   value="+value2);
				arr_pics		=value2.split("-");
				this.arr_pics	=value2.split("-");
			}
			/*
			if(this.nfile==17021){
				alert("time_send="+time_send);
				alert("len="+obj_relation.childNodes.length);
				alert("nform2="+nform2);
				alert(arr_pics);
			}
			*/
			
			//alert("nfile="+this.nfile);
			
			
			for(i=1;i<qst_row.length;i++){
				qst_row[i][4]=get_element_value(obj,'qst_'+i);
			}
			//return;

			links		=get_element_value(obj,'links');
			var 		nfile=this.nfile;
			
			//return;


			

			if(this.style_function==''){
				var id_element="";
				result	="<table dir=ltr border=0 cellpadding=2 cellspacing=2 bgcolor=white width=100% style='font-family:tahoma;font-size:8pt'>";
				my_value=qst_row[main_title_number][4];			
				result+="<tr><td align=right dir=rtl  style='color:red'>"+my_value+"</td><td dir=rtl align=left width=100 bgcolor='#F6FAFE'><font color=red>"+this.nfile+"</font> - </td></tr>";							
				for(i=1;i<qst_row.length;i++){
					my_title	=qst_row[i][1];
					my_value	=qst_row[i][4];
					pattern		=qst_row[i][2];
					id_element	='';
					//alert("pattern="+pattern);
					if(pattern==6)
						continue;
					if(i==main_title_number)
						continue;
					if(i==main_body_number && my_value.length>400){
						id_element="td__body__"+this.nfile;
						my_value=my_value.replace(/<br \/>/g, "\n");
						my_value=my_value.slice(0,400);
						my_value=my_value.replace(/\n/g,"<br />");
						my_value=my_value+" <a href=javascript:show_full_payam2("+this.nfile+",'"+id_element+"',"+main_body_number+",'"+this.xml_folder+"'); style='color:blue;font-family:tahoma;font-size:8pt;line-height:100%'>(ادامه ...)</a> ";
					}
					
					result+="<tr><td align=right dir=rtl id='"+id_element+"' style='line-height:180%'>"+my_value+"</td><td dir=rtl align=left width=100 bgcolor='#F6FAFE' valign=top><font color=green>"+my_title+"</font></td></tr>";							
				}
				result+="<tr><td align=right dir=rtl id='time_id_"+this.nfile+"'>"+time_send+"</td><td dir=rtl align=left width=100 bgcolor='#F6FAFE'><font color=green>تاریخ ارسال:</font></td></tr>";							
	
				if(links!='---'){
					arr_links=links.split("-");
					links='';
					for(m=0;m<arr_links.length;m++){
						this_link	=arr_links[m];
						this_link2	=arr_links[m]+"_"+this.nfile;
						links+="<p style='line-height:180%;color:#666666' align=right dir=rtl id=payam_"+this_link2+"_links><a style='color:blue;font-family:tahoma;font-size:8pt;line-height:100%'  href=javascript:show_full_payam("+this_link+",'payam_"+this_link2+"_links');>"+this_link+"</a></p>";
					}
					
				}
				result+="<tr><td align=right dir=rtl>"+links+"</td><td dir=rtl align=left width=100 bgcolor='#F6FAFE' valign=top><font color=green>پيام هاي مرتبط:</font></td></tr>";							
				result+="</table>";	
			}else{
				//alert('style_function');
				eval("result="+this.style_function+";");
					
				result=result.replace(/\"/g, '\\\"');
				
				curr_index_in_arr_comment_items=arr_nfile_comment_items[this.nfile];
				
				if(this.main_td_obj==null)
					return;
				this.main_td_obj.innerHTML=result;
				this.show_pictures();
				this.show_farsi_times(time_send);
				//alert(this.arr_pics);
				//show_pictures();
				return;					
			}
		
			
			result=result.replace(/\"/g, '\\\"');
			//alert(result);
			
			curr_index_in_arr_comment_items=arr_nfile_comment_items[this.nfile];
					

			
			//eval("var obj6=document.all.comment_item_td_"+this.nfile);
			if(this.main_td_obj==null)
				return;
			this.main_td_obj.innerHTML=result;	
						
			
			
			//alert(this_pic);

			if(this_pic!=""){
				//alert('ssssssssss');
				url								=host_address+"/fa/xml/pictures/"+this_pic+".xml";
				var self=this;
				var aj1	=new sack();
				
				aj1.requestFile		= url;
				aj1.onCompletion	= function(){  self.xmlhttp_2=this.responseXML;   self.on_complete_fo_show_picture();  };	
				aj1.runAJAX();	
			}
			
			if(!isNaN(Number(time_send))){
				//time_send="dddddddddddddd";
				url								=host_address+"/app3.php?subsite=1&lang=fa&method=9&time="+time_send;
				var self=this;
				var aj1	=new sack();
				
				aj1.requestFile		= url;
				aj1.onCompletion	= function(){  self.xmlhttp_3=this.response;   self.on_complete_for_set_time();  };	
				aj1.runAJAX();					
			}
			
	
			
			
		};
		this.show_farsi_times=function(time_send){
			url								=host_address+"/app3.php?subsite=1&lang=fa&method=9&time="+time_send;
			var self=this;
			var aj1	=new sack();
			
			aj1.requestFile		= url;
			aj1.onCompletion	= function(){  self.xmlhttp_3=this.response;   self.on_complete_for_set_time();  };	
			aj1.runAJAX();				
		}
		this.show_pictures=function(){
			//alert('show_pictures len='+this.arr_pics.length);
			for(i=0;i<this.arr_pics.length;i++){
				pic_file	=this.arr_pics[i];

				this_id		="my_picture_"+pic_file;
				c			=new class_show_one_image(pic_file,this_id,'w100');				
			}

		};
		this.on_complete_fo_show_picture=function(){
			var c_xml	=this.xmlhttp_2;			
			
			obj_pic		=c_xml.getElementsByTagName("noskhe")[0];
			pic_title	=get_element_value(obj_pic,'qst_1');
			pic_name	=get_element_value(obj_pic,'qst_2');
			
			//alert("pic_name="+pic_name+"   ,   nfile="+this.nfile);
			
			eval("var obj3=document.all.pic_id_"+this.nfile);
			if(obj3==null)
				return;

			obj3.innerHTML="<img width=100 src='"+host_address+"/gallery/w100/"+pic_name+"' align=left border=1>";		
			obj3.href=host_address+'/gallery/'+pic_name;
						
			
			
		};

		this.on_complete_for_set_time=function(){			
			var c_xml=this.xmlhttp_3;

			eval("var obj4=document.all.time_id_"+this.nfile);
			if(obj4==null)
				return;
				
			obj4.innerHTML=c_xml;
			
		}		
		

		this.init_class=function(){
			this.url				=url;
			this.nfile				=nfile;
			this.xml_folder			=xml_folder;
			this.nform				=nform;
			this.style_function		=style_function;
			
			
			//return;
			//alert(this.xml_folder+"_item_td_"+this.nfile);
			
			eval("this.main_td_obj=document.all."+this.xml_folder+"_item_td_"+this.nfile);
			//alert(nfile);
			var self=this;
			var aj1	=new sack();
			
			//alert(this.url);
			
			aj1.requestFile		= this.url;
			aj1.onCompletion	= function(){  self.xmlhttp_1=this.responseXML;   self.f1();  		};	
			aj1.onError			= function(){  self.xmlhttp_1=this.responseXML;   self.error_f1();  };	
			aj1.runAJAX();	

		};

		this.init_class();
	
	
	
	}
	// end of class_show_one_comment_item
	//-------------------------------------------------
	//-------------------------------------------------
	
function save_on_cookie(form_id){
	
}
	
function test_submit_form(form_id){

	var error_for_empty='لطفا همه فیلدها را تکمیل نماييد';
	if(site_lang=='en')
		error_for_empty='please fill all entries.';
		

		for(i in arr_qst_titles2){
			
			qst_pattern			=arr_qst_titles2[i][2];
			
			if(qst_pattern==8)
				continue;
			
			str="var obj_table=talar_form_"+form_id;
			eval(str);
			
			str="obj_element=talar_form_"+form_id+".qst_"+i+"_"+qst_pattern+"_"+1;
			eval(str);

			//alert("form_id="+form_id+"   ,   qst_pattern="+qst_pattern+"       i="+i+"      ");

			ss='';
			for(m=0;m<obj_table.getElementsByTagName("input").length;m++){
				if(obj_table.getElementsByTagName("input")[m].getAttribute('type')=='file'){
					obj_element=obj_table.getElementsByTagName("input")[m];
					if(obj_element.value==''){
						alert(error_for_empty);
						obj_element.focus();
						return false;
					}
				}
			}

			//alert(obj_element);
			if(obj_element===undefined)
				continue;
				/*
			if(obj_element==undefined)
				alert('lkl');
				
			if(obj_element.value===null)
				alert('lkl');
			*/
			value=obj_element.value;
			

			if(qst_pattern==1){
				if(value==''){
					alert(error_for_empty);
					obj_element.focus();
					return false;
				}
			}
			if(qst_pattern==2){
				if(value==''){
					alert(error_for_empty);
					obj_element.focus();
					return false;				
				}
			}
			if(qst_pattern==3){
				if(value==0){
					alert(error_for_empty);
					obj_element.focus();
					return false;				
				}
			}
			if(qst_pattern==5){
				var is_it_ok=false;
				for(i=0;i<obj_element.length;i++){
					if(obj_element[i].checked){
						is_it_ok=true;
						break;
					}
					
				}

				if(!is_it_ok){
					alert(error_for_empty);
					obj_element[0].focus();
					return false;				
				}
			}				

			
		}		
		

	return true;
	
}
	function show_full_payam_class(url,id_element,n_qst){
		
		this.xmlhttp_1		=null;
		this.obj			=null;
		this.n_qst			=0;
		
		this.on_complete_1	=function(){
			
			var c_xml=this.xmlhttp_1;
			if(c_xml===false){
				alert('error 87');
				return;
			}

			x			=c_xml.childNodes;
			if(x.length==0 || x.length==null){
				alert('.این پيام فعال نمي باشد');
				return;
			}
	
			var obj55	=c_xml.getElementsByTagName("noskhe")[0];
			payam		=obj55.getElementsByTagName("qst_"+this.n_qst)[0].childNodes[0].nodeValue;
			
			
			this.obj.innerHTML=payam;
	
		};
		this.init = function(){
			this.url		=url;
			this.id_element=id_element;
			this.n_qst		=n_qst;
			
			eval("this.obj=document.all."+id_element);
			//alert(id_element);
			this.obj.innerHTML="<img src='"+host_address+"/fa/pictures/loading2.gif'>";
			//alert('nnn');
			var self=this;
			var aj1	=new sack();
			
			aj1.requestFile		= url;
			aj1.onCompletion	= function(){  self.xmlhttp_1=this.responseXML;   self.on_complete_1();  };	
			aj1.runAJAX();		
		};
		this.init();		
	}
	function show_talar_items_class(url,talar_index){
		
		this.xmlhttp_1				=null;
		this.xmlhttp_2				=null;
		this.xmlhttp_3				=null;
		this.url					=null;
		this.talar_index			=null;

		this.on_complete_board_1=function(){
			var c_xml=this.xmlhttp_1;
			if(c_xml===false){
				alert('error 87');
				return;
			}

			obj			=c_xml.getElementsByTagName("noskhe")[0];
			time_send	=obj.getElementsByTagName("time")[0].childNodes[0].nodeValue;
			sender		=get_element_value(obj,'qst_1');
			tel			=get_element_value(obj,'qst_2');
			email		=get_element_value(obj,'qst_3');
			onvan		=get_element_value(obj,'qst_4');
			payam		=get_element_value(obj,'qst_5');
			links		=get_element_value(obj,'links');
			nfile		=arr_nfile_talar_items[this.talar_index];






			if(payam.length>400){
				payam0=payam.replace(/<br \/>/g, "\n");
				//payam0=
				payam0=payam0.slice(0,400);
				payam0=payam0.replace(/\n/g,"<br />");
				payam=payam0+" <a href=javascript:show_full_payam("+nfile+",'payam_"+nfile+"'); style='color:blue;font-family:tahoma;font-size:8pt;line-height:100%'>(ادامه ...)</a> ";
			}
		
			relations	=obj.getElementsByTagName("relations")[0].getElementsByTagName("form");
			picture		="";
			var this_pic="";
		
			if(relations.length>0){
				form_name	=obj.getElementsByTagName("relations")[0].getElementsByTagName("form")[0].getAttribute("name");
				pic_nfiles	=obj.getElementsByTagName("relations")[0].getElementsByTagName("form")[0].childNodes[0].nodeValue;
				arr_pics	=pic_nfiles.split("-");
				this_pic	=arr_pics[0];
				picture		="<a target=_blank id='pic_id_"+this.talar_index+"'></a>";
			}
		
			result="<table dir=ltr border=0 cellpadding=2 cellspacing=2 bgcolor=white width=100% style='font-family:tahoma;font-size:8pt'>";
			result+="<tr><td align=right dir=rtl><font color=red>"+onvan+"</font></td><td dir=rtl align=left width=100 bgcolor='#F6FAFE'><font color=red>"+nfile+"</font> -</td></tr>";							
			result+="<tr><td align=right dir=rtl style='line-height:180%'>"+picture+"<span id=payam_"+nfile+">"+payam+"</span></td><td dir=rtl align=left width=100 bgcolor='#F6FAFE' valign=top><font color=green>"+arr_qst_titles2[5][1]+"</font></td></tr>";							
			result+="<tr><td align=right dir=rtl>"+sender+"</td><td dir=rtl align=left width=100 bgcolor='#F6FAFE'><font color=green>"+arr_qst_titles2[1][1]+"</font></td></tr>";							
			result+="<tr><td align=right dir=rtl>"+tel+"</td><td dir=rtl align=left width=100 bgcolor='#F6FAFE'><font color=green>"+arr_qst_titles2[2][1]+"</font></td></tr>";							
			result+="<tr><td align=right dir=rtl>"+email+"</td><td dir=rtl align=left width=100 bgcolor='#F6FAFE'><font color=green>"+arr_qst_titles2[3][1]+"</font></td></tr>";							
			result+="<tr><td align=right dir=rtl id='time_id_"+this.talar_index+"'>"+time_send+"</td><td dir=rtl align=left width=100 bgcolor='#F6FAFE'><font color=green>تاریخ ارسال:</font></td></tr>";							

			if(links!='---'){
				arr_links=links.split("-");
				links='';
				for(m=0;m<arr_links.length;m++){
					this_link	=arr_links[m];
					this_link2	=arr_links[m]+"_"+talar_index;
					links+="<p style='line-height:180%;color:#666666' align=right dir=rtl id=payam_"+this_link2+"_links><a style='color:blue;font-family:tahoma;font-size:8pt;line-height:100%'  href=javascript:show_full_payam("+this_link+",'payam_"+this_link2+"_links');>"+this_link+"</a></p>";
				}
			}
			result+="<tr><td align=right dir=rtl>"+links+"</td><td dir=rtl align=left width=100 bgcolor='#F6FAFE' valign=top><font color=green>پيام هاي مرتبط:</font></td></tr>";							
			
			result+="</table>";						
		
			result=result.replace(/\"/g, '\\\"');
			
			//alert(arr_nfile_talar_items);
			
			curr_index_in_arr_talar_items=arr_nfile_talar_items[this.talar_index];
					
			//alert("before step3 finished. curr_index_in_arr_talar_items="+curr_index_in_arr_talar_items+"     , index="+index);
			
			eval("var obj6=document.all.talar_item_td_"+curr_index_in_arr_talar_items);
			if(obj6==null)
				return;
			obj6.innerHTML=result;	
						
			
			
			//alert("step3 finished for curr_index_in_arr_talar_items="+curr_index_in_arr_talar_items+"         ,   index="+index);
		
			if(this_pic!=""){
				url								=host_address+"/fa/xml/pictures/"+this_pic+".xml";
				var self=this;
				var aj1	=new sack();
				
				aj1.requestFile		= url;
				aj1.onCompletion	= function(){  self.xmlhttp_2=this.responseXML;   self.on_complete_board_2();  };	
				aj1.runAJAX();	
							
				//arr_xml_pic_talar_items[index]	=new class3(url,"f5("+index+");");
			}
			
			if(!isNaN(Number(time_send))){
				//time_send="dddddddddddddd";
				url								=host_address+"/app3.php?subsite=1&lang=fa&method=9&time="+time_send;
				var self=this;
				var aj1	=new sack();
				
				aj1.requestFile		= url;
				aj1.onCompletion	= function(){  self.xmlhttp_3=this.response;   self.on_complete_board_3();  };	
				aj1.runAJAX();					
			}			
			
			
			
			
			

			
				
					
			
		};
		this.on_complete_board_2=function(){
			
			var c_xml=this.xmlhttp_2;
			if(c_xml===false){
				alert('error 87');
				return;
			}
			
			
			obj_pic		=c_xml.getElementsByTagName("noskhe")[0];
			pic_title	=get_element_value(obj_pic,'qst_1');
			pic_name	=get_element_value(obj_pic,'qst_2');
			
			eval("var obj3=document.all.pic_id_"+this.talar_index);
			if(obj3==null)
				return;
			/*
			if(obj3==undefined){
				alert('xxxxxxxxxx talar_index='+arr_nfile_talar_items[talar_index]+"     , talar_index="+talar_index);
				eval("var obj5=document.all.talar_item_td_"+arr_nfile_talar_items[talar_index]);
				alert(obj5.innerHTML)
			}*/
			obj3.innerHTML="<img width=100 src='"+host_address+"/gallery/w100/"+pic_name+"' align=left border=1>";		
			obj3.href=host_address+'/gallery/'+pic_name;
						
			
			
			
			
		}
		this.on_complete_board_3=function(){
			
			var c_xml=this.xmlhttp_3;

			eval("var obj4=document.all.time_id_"+this.talar_index);
			if(obj4==null)
				return;
				
			obj4.innerHTML=c_xml;
			
		}
		this.init = function(){
			this.url		=url;
			this.talar_index=talar_index;
	

			
			var self=this;
			var aj1	=new sack();
			
			aj1.requestFile		= url;
			aj1.onCompletion	= function(){  self.xmlhttp_1=this.responseXML;   self.on_complete_board_1();  };	
			aj1.runAJAX();		
		};
		this.init();
	}
	
	
	
	
	
	
	function class3(url,on_compelete_func){
		
		this.xmlhttp			=null;
		this.url				='';
		this.on_compelete_func	='';
		
		this.on_complete3=function(){
			var c_xml=this.xmlhttp;
			if(c_xml===false){
				alert('error 87');
				return;
			}
			//alert(on_compelete_func);
			eval(this.on_compelete_func);
			
		};
		this.on_error1=function(){
			//alert('error in downloading ');
			eval(this.on_compelete_func);
			return(null);
		};
	
		this.init = function(){
			
			this.url				=url;
			this.on_compelete_func	=on_compelete_func;
			
			var self=this;
			var aj1	=new sack();
			//alert(url);
			aj1.requestFile		= this.url;	
			aj1.onCompletion	= function(){  self.xmlhttp=this.responseXML;   self.on_complete3();  };	
			aj1.onError			= function(){  self.on_error1();  };	
			aj1.runAJAX();		
		};
		this.init();
	}
		
	function class2(node,top_node){
		
	//	
		//alert(aj1.method);
		this.xmlhttp_node	=null;
		this.xmlhttp_news	=null;
		this.xmlhttp_picture=null;
		this.xmlhttp_picture_height=null;
		this.home_node		=0;
		this.top_node		=0;
		this.news_nfile		=0;
		this.pic_title		=0;
		this.pic_name		='';
		this.news_title		='';
		this.news_abs		='';
		this.htmlbody		='';
		this.href1			='';
		this.href2			='';

	
		this.on_complete_node_xml=function(){
			var c_xml=this.xmlhttp_node;
			//alert('on_complete_node_xml');
			if(c_xml===false){
				alert('error 87');
				//eval("document.all.td_goonagoon_"+node+".innerHTML='2&nbsp;'");
				return;
			}
			//alert(xml_node);
			
			//alert('j1');
			this.news_nfile=c_xml.getElementsByTagName("items")[0].childNodes[0].nodeValue;	
			//alert('j2');
			//alert("news_nfile="+this.home_node);	
			
			//alert("fini homenode");

			eval("var obj7=document.all.pic_"+this.home_node);
			this.href1=host_address+"/fa/goonagoon2.php?id="+this.news_nfile+"&s="+this.top_node;
			obj7.href=this.href1;

			eval("var obj7=document.all.title_"+this.home_node);
			obj7.href=this.href1;

			eval("var obj7=document.all.href2_"+this.home_node);
			obj7.href=this.href2;
			
			eval("var obj7=document.all.href2_sayer_"+this.home_node);
			obj7.href=this.href2;


			url					=host_address+"/fa/xml/news/"+this.news_nfile+".xml";
			var self			=this;
			var aj2				=new sack();
			//alert(url);
			aj2.requestFile 	= url;	// Specifying which file to get
			aj2.onCompletion 	= function(){  self.xmlhttp_news=this.responseXML;   self.on_complete_news_xml();  };	
			aj2.runAJAX();		// Execute AJAX function	
	
			
			
		};
		this.on_complete_news_xml=function(){
			//alert(this.news_nfile+'   =on_complete_news_xml');
			var c_xml=this.xmlhttp_news;
			
			if(c_xml===false){
				alert('error 57');
				return;
			}
			
			//alert('hhhhhh');
			this.news_title	=c_xml.getElementsByTagName("qst_1")[0].childNodes[0].nodeValue;
			//alert("title="+this.news_title);
			this.news_abs	=c_xml.getElementsByTagName("qst_2")[0].childNodes[0].nodeValue;
			
			
			//alert("abs="+this.news_abs);
			
			var edame			=" <a href='"+this.href1+"' style='font-size:9pt;color:green'>ادامه...</a> ";
			//alert("edame="+edame);
			
			this.news_abs	+=edame;
			
			
			eval("var obj7=document.all.title_"+this.home_node);
			obj7.innerHTML=this.news_title;
			
			eval("var obj7=document.all.abs_"+this.home_node);
			obj7.innerHTML+=this.news_abs;
			//abs	=abs.replace(/\"/g, '&quot;');
			
	

				
			
			relations	=c_xml.getElementsByTagName("relations")[0].getElementsByTagName("form");
			picture		="";
			
			//alert("fini news");
			
			if(relations.length>0){
				form_name	=c_xml.getElementsByTagName("relations")[0].getElementsByTagName("form")[0].getAttribute("name");
				pic_nfiles	=c_xml.getElementsByTagName("relations")[0].getElementsByTagName("form")[0].childNodes[0].nodeValue;
				arr_pics	=pic_nfiles.split("-");
				this_pic	=arr_pics[0];
				
				//alert(arr_pics);
				
				url						=host_address+"/app3.php";//?subsite=1&lang=fa&method=9&time="+time_send;
	
				var self			=this;
				var aj4				=new sack();
				aj4.setVar("subsite"	, 1);
				aj4.setVar("lang"		, 'fa');
				aj4.setVar("method"		, 12);
				aj4.setVar("pic_nfiles"	, pic_nfiles);
				aj4.setVar("folder"		, 'w100');
				//aj4.setVar("link"		, this.href1);
				//alert(this.href1);
				aj4.setVar("link"		, "---");
				aj4.requestFile 	= url;	
				aj4.onCompletion 	= function(){  self.xmlhttp_picture_height=this.responseXML;   self.on_complete_set_pic_height();  };	
				aj4.runAJAX();	
					
					
				
				
				
/*				
				url					=host_address+"/fa/xml/pictures/"+this_pic+".xml";
				var self			=this;
				var aj3				=new sack();
				aj3.requestFile 	= url;	
				aj3.onCompletion 	= function(){  self.xmlhttp_picture=this.responseXML;   self.on_complete_picture_xml();  };	
				aj3.runAJAX();			
*/					
				
	
			}

			
		};
		this.on_complete_picture_xml=function(){
			
			var c_xml=this.xmlhttp_picture;
			
			if(c_xml===false){
				alert('error 34');
				return;
			}
/*			
			this.pic_title	=c_xml.getElementsByTagName("qst_1")[0].childNodes[0].nodeValue;
			this.pic_name	=c_xml.getElementsByTagName("qst_2")[0].childNodes[0].nodeValue;
	
			
			eval("var obj7=document.all.pic_"+this.home_node);
			obj7.innerHTML="<img align=right title='"+this.pic_title+"' hspace=5 vspace=5 border=1 width=100 src='"+host_address+"/gallery/w100/"+this.pic_name+"'>";
			
			
			var x1=host_address+"/gallery/w100/"+this.pic_name;
			obj7.innerHTML="<table cellspacing=0 cellpadding=2 align=right width=100><tr bgcolor=white><td><object border=1 classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" width=100  height=100 id='height_pic_"+this.news_nfile+"' codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0\" id=\"01\" align=top><param name=\"allowScriptAccess\" value=\"sameDomain\" /><param name=\"allowFullScreen\" value=\"true\" /><param name=\"movie\" value=\"01.swf?x=1&x1="+x1+"\" /><param name=\"quality\" value=\"high\" /><param name=\"bgcolor\" value=\"#ffffff\" /><embed src=\"01.swf\" quality=\"high\" bgcolor=\"#ffffff\"  name=\"01\" align=\"top\" allowScriptAccess=\"sameDomain\" allowFullScreen=\"true\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" /></object></td></tr></table>";		
			
			url						=host_address+"/app3.php";//?subsite=1&lang=fa&method=9&time="+time_send;

			var self			=this;
			var aj4				=new sack();
			aj4.setVar("subsite"	, 1);
			aj4.setVar("lang"		, 'fa');
			aj4.setVar("method"		, 11);
			aj4.setVar("pic_name"	, this.pic_name);
			aj4.setVar("folder"		, 'w100');
			aj4.requestFile 	= url;	
			aj4.onCompletion 	= function(){  self.xmlhttp_picture_height=this.responseXML;   self.on_complete_set_pic_height();  };	
			aj4.runAJAX();	
*/
			
			
	
			
		};	
		this.on_complete_set_pic_height=function(){
			
			var c_xml=this.xmlhttp_picture_height;
			
			if(c_xml===false){
				alert('error 34');
				return;
			}
			
			pic_height	=c_xml.getElementsByTagName("pic_height")[0].childNodes[0].nodeValue;
			url			=c_xml.getElementsByTagName("url")[0].childNodes[0].nodeValue;
			
			re=/,/gm;
			//url=url.replace(re,"&amp;");
			url=url.replace(re,"&");
			//alert(url);
			
			eval("var obj7=document.all.pic_"+this.home_node);
			s="<table cellspacing=0 cellpadding=2 align=right width=100><tr bgcolor=white><td><object border=1 classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" width=100  height=100 id='height_pic_"+this.news_nfile+"' codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0\" id=\"01\" align=top><param name=\"allowScriptAccess\" value=\"sameDomain\" /><param name=\"allowFullScreen\" value=\"true\" /><param name=\"movie\" value=\"01.swf?"+url+"\" /><param name=\"quality\" value=\"high\" /><param name=\"bgcolor\" value=\"#ffffff\" /><embed src=\"01.swf\" quality=\"high\" bgcolor=\"#ffffff\"  name=\"01\" align=\"top\" allowScriptAccess=\"sameDomain\" allowFullScreen=\"true\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" /></object></td></tr></table>";
			//s="<table cellspacing=0 cellpadding=2 align=right width=100><tr bgcolor=white><td><object border=1 classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" width=100  height=100 id='height_pic_"+this.news_nfile+"' codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0\" id=\"01\" align=top><param name=\"allowScriptAccess\" value=\"sameDomain\" /><param name=\"allowFullScreen\" value=\"true\" /><param name=\"movie\" value=\"01.swf?x=1&x1=374d31addbe47fcb87f779bafbddc3b4.jpg\" /><param name=\"quality\" value=\"high\" /><param name=\"bgcolor\" value=\"#ffffff\" /><embed src=\"01.swf\" quality=\"high\" bgcolor=\"#ffffff\"  name=\"01\" align=\"top\" allowScriptAccess=\"sameDomain\" allowFullScreen=\"true\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" /></object></td></tr></table>";
			//alert(s);
			//return;
			obj7.innerHTML=s;
			
			
			
			
			eval("var obj43=document.all.height_pic_"+this.news_nfile);
			if(obj43.height<pic_height)
				obj43.height=pic_height;			
			
				
				
			
/*			
			pic_height	=c_xml.getElementsByTagName("pic_height")[0].childNodes[0].nodeValue;

			eval("var obj43=document.all.height_pic_"+this.news_nfile);
			if(obj43.height<pic_height)
				obj43.height=pic_height;
*/			

						
			
	
			
		};	
		this.init = function(){
			
			//alert('0');			
			this.top_node=top_node;
			this.home_node=node;
			this.href2=host_address+"/fa/goonagoon3.php?s="+this.top_node;
			var self=this;
			var aj1=new sack();
			var url=host_address+"/fa/xml/news/node_"+node+".xml";
			//alert("url1="+url);
			aj1.requestFile = url;	// Specifying which file to get
			aj1.onCompletion = function(){  self.xmlhttp_node=this.responseXML;   self.on_complete_node_xml();  };	
			//alert('h2');
			aj1.runAJAX();		// Execute AJAX function	
		};
		this.init();
	}	

	








function get_table_of_pattern(pattern,number,index_nfile){

		if(arr_qst_width_height[number]==null || arr_qst_width_height[number]==undefined){
			width	=10;
			height	=10;
		}
		else{
			width	=arr_qst_width_height[number][0];
			height	=arr_qst_width_height[number][1];
		}
		
		value='';
		//f_color=lable_normal_color;
		
		if(arr_submitted_values.length>0){
			//alert(arr_submitted_values);
			for(i=0;i<arr_submitted_values.length;i++){
				if(arr_submitted_values[i][2]==number){
					value		=arr_submitted_values[i][0];//value
				}
			}
			/*
			if(arr_submitted_values[number]!=null  && arr_submitted_values[number]!=undefined){
				value		=arr_submitted_values[number][0];//value
			}
			*/
		}
		
		//alert(f_color);
		
		//if(value==undefined)
		//	value='';
			
		//width	=arr_qst_width_height[number][0];
		//height	=arr_qst_width_height[number][1];
		

		switch(pattern){
			case "1":
				name="qst_"+number+"_"+pattern+"_1";
				answer_control="<input "+dir+" value='"+value+"'  name='"+name+"' style='font-family:tahoma;font-size:8pt;width:"+width+";'>";
				break;						
			case "2":
				name="qst_"+number+"_"+pattern+"_1";			
				answer_control="<textarea  name='"+name+"'  style='font-family:tahoma;font-size:8pt;width:"+width+";height:"+height+"'>"+value+"</textarea>";
				break;
			case "3":
				name="qst_"+number+"_"+pattern+"_1";			
				answer_control="<select "+dir+" name='"+name+"'   style='font-family:tahoma;font-size:8pt;width:"+width+"'>";
				count=arr_items.length;
				//alert("count="+count);
				selected='';
				for(p=0;p<count;p++){
					if(value==p)
						selected='selected';
					answer_control+="<option "+selected+" value='"+p+"'>"+arr_items[p];
				}
				answer_control+="</select>";
				break;		
			case "4":
				name="qst_"+number+"_"+pattern+"_1";			
				answer_control="";
				count=arr_items.length;
				for(p=0;p<count;p++){
					answer_control+="<input  name='"+name+"'  type='checkbox' >"+arr_items[p];
				}
				break;
			case "5":
				name="qst_"+number+"_"+pattern+"_1";			
				answer_control="";
				count=arr_items.length;
				for(p=0;p<count;p++){
					lable=arr_items[p];
					re=/ /gm;
					lable=lable.replace(re,"&nbsp; ");
					answer_control+="<input  name='"+name+"'  type='radio' value='"+p+"'>"+lable;
				}
				break;		
			case "6":
				name="qst_"+number+"_6_"+index_nfile+"_0_0";//qst_number_pattern_qstnumber2_number_index
				answer_control="";
				answer_control+="<div dir=ltr align=right><input style='width:"+width+"' name='"+name+"'  type='file' value='' dir=ltr></div>";
				name="qst_"+number+"_1_"+index_nfile+"_0_0";
				answer_control+="<input type=hidden value='---' name='"+name+"' >";
				break;	
			case "7":
				name="qst_"+number+"_7_"+index_nfile+"_0_0";			
				answer_control="";
				answer_control+="<div dir=ltr align=right><input style='width:"+width+"' name='"+name+"'  type='file' value='' dir=ltr></div>";
				name="qst_"+number+"_1_"+index_nfile+"_0_0";
				answer_control+="<input type=hidden value='---' name='"+name+"' >";				
				break;	
			case "8":
				name="qst_"+number+"_"+pattern+"_1";;			
				answer_control="<input  type=hidden name='"+name+"'  >";
				break;	
			case "9":
				//alert('999999999');
				answer_control="<select "+dir+" name=subject_second style='width:"+width+";font-family:tahoma;font-size:8pt'>";
				//alert(c_xml_node_list);
				//	alert(c_xml_node_list.xmlhttp);
				//if(c_xml_node_list==undefined || c_xml_node_list==null || c_xml_node_list===false || c_xml_node_list.xmlhttp==null || c_xml_node_list.xmlhttp==undefined){
				if(c_xml_node_list==undefined || c_xml_node_list==null  || c_xml_node_list===false ){
					//alert('ddd');
					answer_control+="<option value='0-10004'>ريشه</select>";
					break;
				}
				node_count	=c_xml_node_list.getElementsByTagName("sbj").length;
				sbj_count=c_xml_node_list.getElementsByTagName("sbj").length;
				selected="";
				//alert("sbj_count="+sbj_count);
				for(i=0;i<sbj_count;i++){
					if(i==0)
						continue;
					if(i==7)
						selected=" selected ";
					obj		=c_xml_node_list.getElementsByTagName("items")[0];
					n_node	=obj.getElementsByTagName("sbj")[i].getAttribute("node");
					count	=obj.getElementsByTagName("sbj")[i].getAttribute("count");
					//alert("n_node="+n_node);
					value	=c_xml_node_list.getElementsByTagName("sbj")[i].childNodes[0].nodeValue;
					answer_control+="<option "+selected+" value='10004-"+n_node+"'>"+value;
				}
				answer_control+="</select>";
				//alert(answer_control);
				break;				
			case "10":
				name1="qst_"+number+"_10_1";			
				name2="qst_"+number+"_1_1";			
				answer_control="";
				answer_control+="<div dir=ltr align=right><input style='width:"+width+"' name='"+name1+"'  type='file' value='' dir=ltr></div>";
				answer_control+="<input name='"+name2+"'  type='hidden' value='' dir=ltr>";
				break;	
			case "12":
				name="qst_"+number+"_"+pattern+"_1";			
				answer_control="<textarea  name='"+name+"'  style='font-family:tahoma;font-size:8pt;width:"+width+";height:"+height+"'></textarea>";
				break;
			case "13":
				ramz=randomString();
				//alert(Math.random());
				name="qst_"+number+"_"+pattern+"_1";
				answer_control="<input dir=ltr readonly  style='text-align:center;width:70;font-family:arial;font-weight:bold;font-size:12pt' type=text value='"+ramz+"' name='"+name+"' >";
			case "16":
				name="qst_"+number+"_"+pattern+"_1";
				answer_control="<input dir=ltr  type=password name='"+name+"' style='font-family:tahoma;font-size:8pt;width:"+width+";'>";
				break;						
						

				break;				
			default:
				answer_control="&nbsp;";
		}
		return answer_control;
			
}

function randomString() {
	var chars = "123456789abcdefghikmnpqrstuvwxyz";
	var string_length = 5;
	var randomstring = '';
	for (var i=0; i<string_length; i++) {
		var rnum = Math.floor(Math.random() * chars.length);
		randomstring += chars.substring(rnum,rnum+1);
	}
	return(randomstring);
}


function sortNumber(a,b){
	return b - a;
}
function show_full_payam(nfile,id_element){
	
	url		=host_address+"/fa/xml/board/"+nfile+".xml";
	c_xml	=new show_full_payam_class(url,id_element,5);
			
}
function show_full_payam2(nfile,id_element,n_qst,xml_folder){
	
	url		=host_address+"/fa/xml/"+xml_folder+"/"+nfile+".xml";
	c_xml	=new show_full_payam_class(url,id_element,n_qst);
			
}

function get_element_value(obj,element){
	
	
	x			=obj.childNodes;
	value		='';
	
	for (m=0;m<x.length;m++){
		if (x.item(m).nodeType==1){
			if(x.item(m).nodeName==element){
				
				cmd="var obj7=obj.getElementsByTagName(\""+element+"\")[0].childNodes";
				eval(cmd);				
				
				if(obj7.length==0)
					value="---";		
				else
					value=obj7[0].nodeValue;


				break;
			}
		}
	}
	
	if(value=='')
		return("---");
	else
		return value;

}

var arr_talar_items=new Array();
var curr_index_in_arr_talar_items=0;
var max_n_items_in_talar=0;
var max_per_page_in_talar=20;





function show_talar_items(nform,page,node){

	curr_node=node;
	curr_page=page;
	document.all.talar_goto_div.innerHTML="";
	
	c_xml_talar_form		=null;
	talar_node_count		=new Array();
	//arr_category_lables		=new Array();
	//arr_qst_titles			=new Array();
	c_xml_node				=null;
	tbody_of_talar			=null;
	arr_xml_talar_items		=new Array();
	arr_nfile_talar_items	=new Array();
	arr_xml_pic_talar_items	=new Array();
	curr_node				=0;
	curr_page				=0;	
	
	//alert(arr_category_lables);
	//obj=new show_talar_items_ class('talar_section_div',);
	
	my_this_page=page;
	curr_index_in_arr_talar_items=0;
	arr_nfile_talar_items=new Array();

	document.all.talar_section_div.innerHTML="";
	my_table=document.createElement("TABLE");
	
	tbody_of_talar=document.createElement("TBODY");
	tbody_of_talar.id="talar_main_tbody";
	my_table.appendChild(tbody_of_talar);
	document.all.talar_section_div.appendChild(my_table);
	my_table.cellSpacing=1;
	my_table.cellPadding=0;
	
	my_table.bgColor='#8FBC8F';	
	my_table.width='100%';	
	
	
	

	var this_lable_category='';
	for(i=0;i<arr_category_lables.length;i++){
		if(arr_category_lables[i][0]==node){
			this_lable_category=arr_category_lables[i][1];
			break;
		}
	}
	
	
	var my_row		=document.createElement("TR");
	var my_td		=document.createElement("TD");
	my_td.id		="talar_item_td_00";
	tbody_of_talar.appendChild(my_row);
	my_row.appendChild(my_td);	
	my_row.bgColor	="#C0E2C8";	
	my_row.align	="right";	
	my_row.dir		="ltr";	
	my_row.height	=40;	
	my_td.innerHTML	="<font dir=rtl style='font-family:arial;font-size:12pt'>&nbsp;&nbsp;<b>"+this_lable_category+":</b></font>";
	
	
	var my_row		=document.createElement("TR");
	var my_td		=document.createElement("TD");
	my_td.id		="talar_item_td_01";
	tbody_of_talar.appendChild(my_row);
	my_row.appendChild(my_td);	
	my_row.bgColor	="white";	
	my_row.align	="right";	
	my_row.dir		="ltr";	
	my_row.height	=40;	
	my_td.innerHTML	="<img src='"+host_address+"/fa/pictures/loading2.gif' hspace=10 vspace=10 align=middle><font dir=rtl style='font-family:tahoma;font-size:8pt;color:silver'>درحال بارگذاری...</font>";	
	


	if(node==0)
		url				=host_address+"/app3.php?subsite=1&lang=fa&xml_folder=board&method=10";
	else
		url				=host_address+"/fa/xml/board/node_"+node+".xml";
	c_xml_node		=new class3(url,"f3("+node+","+page+");");
	





}
function f3(node,page){
	
	if(c_xml_node==null)
		return;
	c_xml_node=c_xml_node.xmlhttp;
	
	//obj			=c_xml_node.getElementsByTagName("items");
	obj			=c_xml_node.getElementsByTagName("items")[0];
	
	if(obj.childNodes.length==0){
		alert('.اين پوشه خالي است');
		return;
	}
	
	str_nfiles	=obj.childNodes[0].nodeValue;

	
	

	arr_nfiles=str_nfiles.split("-");

	max_n_items_in_talar=arr_nfiles.length;

	
	arr_nfiles.sort(sortNumber);
	
	from_i		=(Number(page)-1)*max_per_page_in_talar;
	to_i		=from_i+max_per_page_in_talar-1;
	arr_nfiles2	=new Array();
	for(i=0;i<arr_nfiles.length;i++){
		if(i<from_i || i>to_i)
			continue;
		c=arr_nfiles2.length;
		arr_nfiles2[c]=arr_nfiles[i];
	}

	
	for(i=0;i<arr_nfiles2.length;i++){
		nfile=arr_nfiles2[i];
		arr_nfile_talar_items[i]=nfile;
	}
			
	if(document.all.talar_goto_div.innerHTML==""){
		str_goto_page_link=write_goto_page_link_in_talar(max_n_items_in_talar,max_per_page_in_talar,node,7,page);	
		document.all.talar_goto_div.innerHTML=str_goto_page_link;
	}

	talar_item_td_01.innerHTML="";
	
	
	my_table.deleteRow(1);
	
	for(i=0;i<arr_nfile_talar_items.length;i++){
		
		var my_row	=document.createElement("TR");
		var my_td	=document.createElement("TD");
		my_td.id="talar_item_td_"+arr_nfile_talar_items[i];
		tbody_of_talar.appendChild(my_row);
		my_row.appendChild(my_td);	
		my_row.bgColor	="white";	
		my_row.align	="right";	
		my_row.dir		="ltr";	
		my_td.innerHTML	="<img src='"+host_address+"/fa/pictures/loading2.gif' hspace=10 vspace=10 align=middle><font dir=rtl style='font-family:tahoma;font-size:8pt;color:silver'>درحال بارگذاری...</font>";	
		
		this_id		=arr_nfile_talar_items[i];
		url			=host_address+"/fa/xml/board/"+this_id+".xml";
		//arr_xml_talar_items[i]	=new class4(url,talar_id,talar_nfile,"f4("+i+","+this_id+");");
		xml			=new show_talar_items_class(url,i);		
	}

	

	
	




}

	function feedback_submit_form(message,form_number){
			
		//form_number=110;
		//alert("form_number="+form_number);
		
		var have_error=false;
		for(i in arr_submitted_values){
			if(arr_submitted_values[i][1]!=''){
				have_error=true;
				break;
			}
		}
		var qst_numbers_that_have_error='';
		regexp=/arr_submitted_values\s+=new Array/g;
		if(have_error){
			alert("! خطا در تکميل فرم");

			document.all.feedback_error_section.innerHTML=make_error_string();
			eval("show_new_empty_form_"+form_number+"('');");
			window.scroll(0,50);
			
			
		}else{
			document.all.feedback_error_section.innerHTML="";
			cmd="document.all.talar_form_section_div_"+form_number+".innerHTML=message;";
			eval(cmd);
			arr_submitted_values=new Array();
			window.scroll(0,50);
			
			
			//createCookie("form_"+form_number,"filled",10);
			
			
			eval("handling_cookie_if_needed_"+form_number+"('');");
			//form_properties		=c_xml_talar_form.getElementsByTagName("properties"			)[0].childNodes[0].nodeValue;
			//alert(form_properties);
		}
		
	}

		
		

	function make_error_string(){
	
	
	
		var k=0;
		var arr_error=new Array();
		for(i in arr_submitted_values){
			error=arr_submitted_values[i][1];
			if(error==undefined || error==null || error=='')
				continue;
				
			re=/\"([^\"]+)\"/gm;
			error=error.replace(re,"<font color='"+error_font_color2+"'>\" $1 \"</font>");
						
			arr_error[k]=error;
			k++;
		}
		str=arr_error.join('<br>');
		//alert(str);
		str="<font style='font-size:8pt;line-height:200%' color='"+error_font_color1+"'>"+str+"</font><br><br>";
	
		return str;
	}

	







	
function submit_form(id,form_id,style_submit){


	

eval(id+".submit();");		



	
	
	
	
	
	return false;
	
	eval("var loading_logo_for_ajax=document.all.loading_logo_for_ajax_"+form_id);
	if(style_submit==1){
		if(!test_submit_form(form_id))
			return false;		
		loading_logo_for_ajax.style.visibility='visible';
		if(force_fill_once!=null && force_fill_once=='yes'){
			document.cookie="is_filled_form_"+form_id+"=yes";
		}
		eval(id+".submit();");		
	}


	loading_logo_for_ajax.style.visibility='visible';
	eval(id+".submit();");


}
var arr_qst_titles			=new Array();
var arr_qst_width_height	=new Array();
var arr_items				=new Array();

function get_qst_widths(str_properties){
	var result=new Array();
	var re;
	var arr;
		
	re=/^(\d+)=(\d+)(-(\d+)){0,1}/mg;
	//re=/^(\d+)=/mg;
	while ((arr = re.exec(str_properties)) != null){
		n=arr[1];
		if(Number(n)>90)
			continue;
		//alert("n="+n);
		//alert("2="+arr[2]);
		//alert("3="+arr[3]);
		//alert("4="+arr[4]);
		result[n]=new Array();
		result[n][0]=arr[2];
		result[n][1]=arr[4];
		//alert(arr);
	}

	
	return result;
}
function get_form_properties(str_properties){
	var result=new Array();
	var re;
	var arr;
	
	
	//alert('d1');
/*
	------- document: -------
	0=99 	table_w-first_td_w
	1=98	excepts
*/	

	//var str_properties="99=350-150,920-90";

	//re=/^99=(.+)/mg;
	//re=/99=(.+)/;

	var re = new RegExp("^99=(.+)","mg");
	arr = re.exec(str_properties);

	//alert(arr);
	
	s=arr[1];
	result[0]=s.split("-");
	
	//alert('d2');
	
	re=/^98=([^,]+)/mg;
	arr = re.exec(str_properties);
	//alert(arr);
	if(arr!=null){
		s=arr[1];	
		result[1]=s.split("-");
	}else
		result[1]=0;
	
	//alert('d3');
	
	re=/^504=([^,]+)/mg;
	arr = re.exec(str_properties);
	if(arr!=null){
		result[2]=arr[1];
	}else
		result[2]='';
	
		
	re=/^512=([^,]+)/mg;
	arr = re.exec(str_properties);
	if(arr!=null){
		result[3]=arr[1];
	}else
		result[3]='';
	
	//alert(result[2]);
	
	
	return (result);
}
function show_talar_form(form_id,relations,style_form,style_submit,form_bgcolor,style_function){
	//alert('start show_talar_form='+form_id);
	eval("var loading_logo_for_ajax=document.all.loading_logo_for_ajax_"+form_id);
	eval("var talar_form_section_div=document.all.talar_form_section_div_"+form_id);
	eval("var c_xml_talar_form=c_xml_talar_form_"+form_id);
	
	
	loading_logo_for_ajax.style.visibility='hidden';
	//document.all.talar_form_section_div.innerHTML="";
	talar_form_section_div.innerHTML="";
	var my_table=document.createElement("TABLE");
	var tbody=document.createElement("TBODY");
	my_table.appendChild(tbody);
	//document.all.talar_form_section_div.appendChild(my_table);
	talar_form_section_div.appendChild(my_table);
	my_table.cellSpacing=0;
	my_table.cellPadding=0;
	
	my_table.width='100%';	
	
	//alert('4');
	
	
	//xmlDoc_for_talar=loadxml2("form/"+form_id+".xml");
	
	main_title_number	=c_xml_talar_form.getElementsByTagName("main_title_number"	)[0].childNodes[0].nodeValue;
	main_body_number	=c_xml_talar_form.getElementsByTagName("main_body_number"	)[0].childNodes[0].nodeValue;
	form_title			=c_xml_talar_form.getElementsByTagName("title"				)[0].childNodes[0].nodeValue;
	form_properties		=c_xml_talar_form.getElementsByTagName("properties"			)[0].childNodes[0].nodeValue;
	form_number			=form_id;
	//form_noskhe			=c_xml_talar_form.getElementsByTagName("form_noskhe"		)[0].childNodes[0].nodeValue;


	//alert(form_title);
	
	submit_lable='ارسال';
	this_dir='rtl';
	this_align='left';
	if(site_lang=='en'){
		this_dir='ltr';
		this_align='right';
		submit_lable='&nbsp;send&nbsp;';
	}
	
	re=/<br \/>/gm;
	form_properties=form_properties.replace(re,"\n");

	
	//alert('6');
	//alert(form_properties);
	
	arr=get_form_properties(form_properties);
	
	//alert(arr[1]);
	
	table_width	=arr[0][0];
	title_width	=arr[0][1];
	email		=arr[2];
	
	/*
	if(form_id==4){
		alert(arr[3]);
	}*/
	
	//alert("email="+email);
	qst_excepts	=arr[1];
	qst_seq		=arr[3];
	
	//alert(qst_excepts);
	
	//alert('7');
	
	
	arr_qst_width_height=get_qst_widths(form_properties);
	if(form_bgcolor==undefined)
		form_bgcolor="#CE6538";
	
	var result="<form method='POST' id='talar_form_"+form_id+"' target='upload_target_"+form_id+"' action='"+host_address+"/app3.php' ENCTYPE='multipart/form-data'>";
	

	//alert('8');
	
	result+="<input type='hidden' name='func' 				value='68'>";
	result+="<input type='hidden' name='subsite' 			value="+subsite+" >";
	result+="<input type='hidden' name='subject' 			value='10004-0'>";
	result+="<input type='hidden' name='actual_name' 		value=''>";
	result+="<input type='hidden' name='form_relations' 	value='"+relations+"'>";
	result+="<input type='hidden' name='lang' 				value='"+site_lang+"'>";
	result+="<input type='hidden' name='home_nodes' 		value=''>";
	result+="<input type='hidden' name='submit_from_client' value='yes'>";
	result+="<input type='hidden' name='username' 			value='visitor'>";
	result+="<input type='hidden' name='form_number' 		value='"+form_number+"'>";
	result+="<input type='hidden' name='email' 				value='"+email+"'>";

	
	
	qst_count			=c_xml_talar_form.getElementsByTagName("qst").length;
	
	//alert("qst_count="+qst_count);
	
	qst_row=new Array();
	var i=0;
	


	
	
	//var title_width=70;
	//if(form_id==1)
	//	title_width=100;
	//	alert('d2');
	
		obj					=c_xml_talar_form.getElementsByTagName("noskhe")[0];
		obj0				=obj.getElementsByTagName("questions")[0];
			
		//alert(qst_count);
	for(i=0;i<qst_count;i++){
		
		//alert("i="+i);
		obj					=obj0.getElementsByTagName("qst")[i];
		//alert(obj.length);
		//return;
		
		
		
		
		
		
		
		
		
		
		
		
		//obj					=c_xml_talar_form.getElementsByTagName("qst")[i];
		number				=obj.getAttribute("number");
		
		
		
		//alert("number1="+number);
		
		flag=false;
		for(m in qst_excepts){
			if(qst_excepts[m]==number){
				flag=true;
				break;
			}
		}
		if(flag){
			//alert('break for='+i);
			continue;
		}
			
		qst_tozih='';
		
		//alert('g55');
		
		
		//alert(obj.getElementsByTagName("title")[0].firstChild.data);
		

		
		
		qst_title			=obj.getElementsByTagName("title"	)[0].firstChild.data;
		qst_lang			=obj.getElementsByTagName("lang"	)[0].firstChild.data;
		qst_pattern			=obj.getElementsByTagName("pattern"	)[0].firstChild.data;
		qst_ertefa			=obj.getElementsByTagName("ertefa"	)[0].firstChild.data;
		qst_gozineha		=obj.getElementsByTagName("gozineha")[0];
		qst_gozineha_count	=qst_gozineha.getElementsByTagName("item").length;
		
		//alert(qst_gozineha_count);
		//continue;
		
		
		/*
		qst_title			=obj.childNodes[0].childNodes[0].nodeValue;
		alert('g56');
		qst_lang			=obj.childNodes[1].childNodes[0].nodeValue;
		alert('g57');
		qst_pattern			=obj.childNodes[2].childNodes[0].nodeValue;
		alert('g58');
		qst_ertefa			=obj.childNodes[3].childNodes[0].nodeValue;
		alert('g59');
		qst_gozineha_count	=obj.childNodes[4].getElementsByTagName("item").length;
		*/
		//alert('j60');
		
		if(form_id==11)
			qst_tozih			=c_xml_talar_form.getElementsByTagName("qst"	)[i].getElementsByTagName("tozih"	)[0].childNodes[0].nodeValue;
		
		//alert(qst_title);
		
		arr_qst_titles[i]=qst_title;
		
		//alert(qst_lang);
		
		if(qst_lang=='farsi')
			dir=' dir=rtl ';
		else
			dir='dir=ltr ';
			
		//alert("qst_gozineha_count="+qst_gozineha_count);
		
		arr_items=new Array();
		for(j=0;j<qst_gozineha_count;j++){
			s=qst_gozineha.getElementsByTagName("item")[j].childNodes[0].nodeValue;
			arr_items[j]=s;
			//alert("s="+s);
		}
		
		
		c=1;

		answer_control=get_table_of_pattern(qst_pattern,number,c);

		//alert('num='+number);
		c=qst_row.length;
		qst_row[c]=new Array();
		qst_row[c][0]=answer_control;
		qst_row[c][1]=qst_title;
		qst_row[c][2]=qst_pattern;
		qst_row[c][3]=qst_tozih;
		qst_row[c][4]=number;
		//qst_row[number][4]=value;

		
		
		//alert("number2="+number);
		//alert("number="+number+" , qst_count="+qst_count +" , i="+i);
		arr_qst_titles2=qst_row;
	}

	bgcolor2='#F0F5FC';
	bgcolor2='#D6D7D9';
	
	//alert("2");
	//alert("style_function="+style_function);
	
	if(style_function!="" && style_function!=undefined){
		eval("result+="+style_function+";");
		//alert('xxx---');
		
		var my_row	=document.createElement("TR");
		var my_td	=document.createElement("TD");
		tbody.appendChild(my_row);
		my_row.appendChild(my_td);


		my_td.innerHTML=result;
		//alert('ddd');
		return;
	}
		
	//alert('ddddd 6666 dddddddd');
	
	if(form_id==12){
		result+="<table width='"+table_width+"' cellpadding=5 cellspacing=1 border=0 bgcolor='"+form_bgcolor+"' align=center>";
		result+="<tr ><td align=center height=30><font style='font-family:tahoma;font-size:8pt;' color=white dir='"+this_dir+"'>"+form_title+"</font></td></tr>";
		result+="<tr bgcolor=white><td height=1></td></tr>";
		result+="<tr bgcolor=white><td>";		
		result+="<table width='"+table_width+"' cellspacing='0' align=center cellpadding='1'  border='0' style='font-family:tahoma;font-size:8pt;line-height:180%' dir='"+this_dir+"'>";
		result+="<tr ><td width='"+title_width+"' align='left' dir=rtl valign=top  ><font style='font-family:tahoma;font-size:8pt;' >"+qst_row[1][1]+"</font></td><td  valign=top>"+qst_row[1][0]+"</td></tr>";
		result+="<tr ><td align='left' dir=rtl valign=top  ><font style='font-family:tahoma;font-size:8pt;' >"+qst_row[2][1]+"</font></td><td   valign=top>"+qst_row[2][0]+"</td></tr>";
		result+="<tr ><td align='left' dir=rtl valign=top  ><font style='font-family:tahoma;font-size:8pt;' >"+qst_row[3][1]+"</font></td><td   valign=top>"+qst_row[3][0]+"</td></tr>";
		result+="<tr ><td align='left' dir=rtl valign=top  ><font style='font-family:tahoma;font-size:8pt;' >"+qst_row[7][1]+"</font></td><td   valign=top>"+qst_row[7][0]+"</td></tr>";
		result+="<tr ><td colspan=2 align='right' dir=rtl valign=top style='color:#777777' >"+qst_row[4][1]+qst_row[4][0]+"</td></tr>";
		result+="<tr ><td colspan=2 align='left' dir=ltr valign=top style='color:#777777' >"+qst_row[5][0]+"</td></tr>";
		result+="<tr ><td align='left' dir=rtl valign=top  ><font style='font-family:tahoma;font-size:8pt;' >"+qst_row[6][1]+"</font></td><td   valign=top>"+qst_row[6][0]+"</td></tr>";
		result+="<tr bgcolor=white><td colspan=3 align='"+this_align+"'><input id=submit_talar_button onclick=\"submit_form('talar_form_"+form_id+"',"+form_id+","+style_submit+")\" type='button' value='"+submit_lable+"' class=buttongreen style='color:white;background-color:"+form_bgcolor+"'></td></tr>";
		result+="</table></td></tr></table>";
		result+="</form>";		
	}	
	
	if(form_id==7){
		result+="<table width='"+table_width+"' cellpadding=5 cellspacing=1 border=0 bgcolor='"+form_bgcolor+"' align=center>";
		result+="<tr ><td align=center height=30><font style='font-family:tahoma;font-size:8pt;' color=white dir='"+this_dir+"'>"+form_title+"</font></td></tr>";
		result+="<tr bgcolor=white><td height=1></td></tr>";
		result+="<tr bgcolor=white><td>";		
		result+="<table width='"+table_width+"' cellspacing='0' align=center cellpadding='1'  border='0' style='font-family:tahoma;font-size:8pt;line-height:180%' dir='"+this_dir+"'>";
		result+="<tr ><td width='"+title_width+"' align='left' dir=rtl valign=top  ><font style='font-family:tahoma;font-size:8pt;' >"+qst_row[1][1]+"</font></td><td  valign=top>"+qst_row[1][0]+"</td></tr>";
		result+="<tr ><td align='left' dir=ltr valign=top  ><font style='font-family:tahoma;font-size:8pt;' >"+qst_row[2][1]+"</font></td><td   valign=top>"+qst_row[2][0]+"</td></tr>";
		result+="<tr ><td align='left' dir=rtl valign=top  ><font style='font-family:tahoma;font-size:8pt;' >"+qst_row[3][1]+"</font></td><td   valign=top>"+qst_row[3][0]+"</td></tr>";
		result+="<tr ><td align='left' dir=rtl valign=top  ><font style='font-family:tahoma;font-size:8pt;' >"+qst_row[4][1]+"</font></td><td   valign=top>"+qst_row[4][0]+"</td></tr>";
		result+="<tr ><td align='left' dir=rtl valign=top  ><font style='font-family:tahoma;font-size:8pt;' >"+qst_row[5][1]+"</font></td><td   valign=top>"+qst_row[5][0]+"</td></tr>";
		result+="<tr ><td align='left' dir=rtl valign=top  ><font style='font-family:tahoma;font-size:8pt;' >"+qst_row[9][1]+"</font></td><td   valign=top>"+qst_row[9][0]+"</td></tr>";
		result+="<tr ><td colspan=2 align='right' dir=rtl valign=top style='color:#777777' >"+qst_row[6][1]+qst_row[6][0]+"</td></tr>";
		result+="<tr ><td colspan=2 align='left' dir=ltr valign=top style='color:#777777' >"+qst_row[7][0]+"</td></tr>";
		result+="<tr ><td align='left' dir=rtl valign=top  ><font style='font-family:tahoma;font-size:8pt;' >"+qst_row[8][1]+"</font></td><td   valign=top>"+qst_row[8][0]+"</td></tr>";
		result+="<tr bgcolor=white><td colspan=3 align='"+this_align+"'><input id=submit_talar_button onclick=\"submit_form('talar_form_"+form_id+"',"+form_id+","+style_submit+")\" type='button' value='"+submit_lable+"' class=buttongreen style='color:white;background-color:"+form_bgcolor+"'></td></tr>";
		result+="</table></td></tr></table>";
		result+="</form>";		
	}
	if((form_id==3 || form_id==4) && this_dir=='rtl'){
		//alert('3-4');
		result+="<table width='"+table_width+"' cellpadding=5 cellspacing=1 border=0 bgcolor='"+form_bgcolor+"' align=center>";
		result+="<input type=hidden name='comment_after_submit' value=\"<table  align=center ><tr><td valign=center  align=center><font style='font-family:tahoma;font-size:8pt;color:gold'>با تشکر ، پيام شما با موفقيت ذخيره گرديد.</font><br><br><a href='javascript:show_new_empty_form_"+form_id+"();'  style='text-decoration:none;font-family:tahoma;font-size:8pt;;color:blue;BORDER-BOTTOM: blue 1px solid;'>( نمايش مجدد فرم )</a>\">";
		result+="<tr ><td align=center height=30><font style='font-family:tahoma;font-size:8pt;' color=white dir='"+this_dir+"'>"+form_title+"</font></td></tr>";
		result+="<tr bgcolor=white><td height=1></td></tr>";
		result+="<tr bgcolor=white><td>";		
		result+="<table width='"+table_width+"' cellspacing='0' align=center cellpadding='1'  border='0' style='font-family:tahoma;font-size:8pt;line-height:180%' dir='"+this_dir+"'>";
		result+="<tr ><td align='"+this_align+"' dir='"+this_dir+"' valign=top  width='"+title_width+"'><font style='font-family:tahoma;font-size:8pt;' >"+qst_row[1][1]+"</font></td><td  valign=top>"+qst_row[1][0]+"</td></tr>";
		result+="<tr ><td align='"+this_align+"' dir='"+this_dir+"' valign=top  ><font style='font-family:tahoma;font-size:8pt;' >"+qst_row[2][1]+"</font></td><td   valign=top>"+qst_row[2][0]+"</td></tr>";
		result+="<tr ><td align='"+this_align+"' dir='"+this_dir+"' valign=top  ><font style='font-family:tahoma;font-size:8pt;' >"+qst_row[3][1]+"</font></td><td   valign=top>"+qst_row[3][0]+"</td></tr>";
		result+="<tr ><td align='"+this_align+"' dir='"+this_dir+"' valign=top  ><font style='font-family:tahoma;font-size:8pt;' >"+qst_row[4][1]+"</font></td><td   valign=top>"+qst_row[4][0]+"</td></tr>";
		result+="<tr bgcolor=white><td colspan=3 align='"+this_align+"'><input id=submit_talar_button onclick=\"submit_form('talar_form_"+form_id+"',"+form_id+","+style_submit+")\" type='button' value='"+submit_lable+"' class=buttongreen style='color:white;background-color:"+form_bgcolor+"'></td></tr>";
		result+="</table></td></tr></table>";
		result+="</form>";		
	}
	if(form_id==10){
		result+="<table width='"+table_width+"' cellpadding=5 cellspacing=1 border=0 bgcolor='"+form_bgcolor+"' align=center>";
		result+="<tr ><td align=center height=30><font style='font-family:tahoma;font-size:8pt;' color=white dir='"+this_dir+"'>"+form_title+"</font></td></tr>";
		result+="<tr bgcolor=white><td height=1></td></tr>";
		result+="<tr bgcolor=white><td>";		
		result+="<table width='"+table_width+"' cellspacing='0' align=center cellpadding='1'  border='0' style='font-family:tahoma;font-size:8pt;line-height:180%' dir='"+this_dir+"'>";
		result+="<tr ><td width='"+title_width+"' align='left' dir=rtl valign=top  ><font style='font-family:tahoma;font-size:8pt;' >"+qst_row[1][1]+"</font></td><td  valign=top>"+qst_row[1][0]+"</td></tr>";
		//result+="<tr ><td align='left' dir=rtl valign=top  ><font style='font-family:tahoma;font-size:8pt;' >"+qst_row[2][1]+"</font></td><td   valign=top>"+qst_row[2][0]+"</td></tr>";
		//result+="<tr ><td align='left' dir=rtl valign=top  ><font style='font-family:tahoma;font-size:8pt;' >"+qst_row[3][1]+"</font></td><td   valign=top>"+qst_row[3][0]+"</td></tr>";
		//result+="<tr ><td align='left' dir=rtl valign=top  ><font style='font-family:tahoma;font-size:8pt;' >"+qst_row[4][1]+"</font></td><td   valign=top>"+qst_row[4][0]+"</td></tr>";
		//result+="<tr ><td align='left' dir=rtl valign=top  ><font style='font-family:tahoma;font-size:8pt;' >"+qst_row[5][1]+"</font></td><td   valign=top>"+qst_row[5][0]+"</td></tr>";
		result+="<tr bgcolor=white><td colspan=3 align='"+this_align+"'><input id=submit_talar_button onclick=\"submit_form('talar_form_"+form_id+"',"+form_id+","+style_submit+")\" type='button' value='"+submit_lable+"' class=buttongreen style='color:white;background-color:"+form_bgcolor+"'></td></tr>";
		result+="</table></td></tr></table>";
		result+="</form>";		
	}	
	
	if(form_id==1){
		result+="<table width='"+table_width+"' cellpadding=5 cellspacing=1 border=0 bgcolor='"+form_bgcolor+"' align=center>";
		result+="<tr ><td align=center height=30><font style='font-family:tahoma;font-size:8pt;' color=white dir='"+this_dir+"'>"+form_title+"</font></td></tr>";
		result+="<tr bgcolor=white><td height=1></td></tr>";
		result+="<tr bgcolor=white><td>";		
		result+="<table width='"+table_width+"' cellspacing='0' align=center cellpadding='1'  border='0' style='font-family:tahoma;font-size:8pt;line-height:180%' dir='"+this_dir+"'>";
		result+="<tr ><td align='left' dir=rtl valign=top width="+title_width+"  ><font style='font-family:tahoma;font-size:8pt;' >"+qst_row[1][1]+"</font></td><td   valign=top>"+qst_row[1][0]+"</td></tr>";
		result+="<tr ><td align='left' dir=rtl valign=top  ><font style='font-family:tahoma;font-size:8pt;' >"+qst_row[2][1]+"</font></td><td   valign=top>"+qst_row[2][0]+"</td></tr>";
		result+="<tr bgcolor=white><td colspan=3 align='"+this_align+"'><input id=submit_talar_button onclick=\"submit_form('talar_form_"+form_id+"',"+form_id+","+style_submit+")\" type='button' value='"+submit_lable+"' class=buttongreen style='color:white;background-color:"+form_bgcolor+"'></td></tr>";
		result+="</table></td></tr></table>";
		result+="</form>";		
	}
	if((form_id==13 || form_id>100) && (this_dir=='rtl')){
		
			
		result+="<table width='"+table_width+"' cellpadding=5 cellspacing=1 border=0 bgcolor='"+form_bgcolor+"' align=center>";
		result+="<tr ><td align=center height=30><font style='font-family:tahoma;font-size:8pt;' color=white dir='"+this_dir+"'>"+form_title+"</font></td></tr>";
		result+="<tr bgcolor=white><td height=1></td></tr>";
		result+="<tr bgcolor=white><td>";		
		result+="<table width='"+table_width+"' cellspacing='0' align=center cellpadding='1'  border='0' style='font-family:tahoma;font-size:8pt;line-height:180%' dir='"+this_dir+"'>";
		
		bgcolor='white';
		//alert("length="+qst_row.length);
		for(i=1;i<qst_row.length;i++){
			//alert(qst_row[i]);
			//alert("-"+qst_row[i][3]+"-");
			tozih='';
			if(qst_row[i][3]!='---' && qst_row[i][3]!='' && qst_row[i][3]!=null){
				tozih="<font style='font-size:8pt;font-family:tahoma' color=red>"+qst_row[i][3]+"</font>";
			}
			if(style_form==1){
				if(qst_row[i][2]==8){
					result+="<tr bgcolor='"+bgcolor+"' ><td colspan=4  height=1></td></tr>";
					result+="<tr  ><td bgcolor='#F1F9EE' colspan=2 align='right' ><font style='font-weight:bold;font-family:tahoma;font-size:8pt;color:green' >&nbsp;"+qst_row[i][1]+" </font></td></tr>";
					result+="<tr bgcolor='"+bgcolor+"' ><td colspan=4  height=1></td></tr>";
				}
				else
					result+="<tr bgcolor='"+bgcolor+"' colspan=2><td align='left' dir='"+this_dir+"' valign=top  width='"+title_width+"'><font style='font-family:tahoma;font-size:8pt;' ><font color=red></font>"+qst_row[i][1]+" </font></td><td   valign=middle>"+qst_row[i][0]+"<br>"+tozih+"</td></tr>";
			}
			else
				result+="<tr bgcolor='"+bgcolor+"'><td align=center valign=top style='color:red;width:25' >"+i+"-</td><td align='right' dir=rtl valign=top  width='"+title_width+"'><font style='font-family:tahoma;font-size:8pt;' ><font color=red></font>"+qst_row[i][1]+" </font></td><td   valign=middle>"+qst_row[i][0]+"<br>"+tozih+"</td></tr>";
			if(bgcolor=='white')
				bgcolor=bgcolor2;
			else
				bgcolor='white';
		}
		result+="<tr bgcolor=white><td colspan=3 align='"+this_align+"'><input id=submit_talar_button onclick=\"submit_form('talar_form_"+form_id+"',"+form_id+","+style_submit+")\" type='button' value='"+submit_lable+"' class=buttongreen style='color:white;background-color:"+form_bgcolor+"'></td></tr>";
		result+="</table></td></tr></table>";
		result+="</form>";		
	}		
	
	if(style_submit==undefined)
		style_submit=0;
		
	
	
	//result="fffff";

	var my_row	=document.createElement("TR");
	var my_td	=document.createElement("TD");
	tbody.appendChild(my_row);
	my_row.appendChild(my_td);

	//alert(result);
	
	my_td.innerHTML=result;

	//show_answers_for_a_feedback(id,page);
		
}



var my_this_page=0;


function write_goto_page_link(n_file,max_n_items,n_item_this_page){
	
	//alert(max_n_items+" "+n_item_this_page);	
	goto_page_links2.innerHTML="";
	//alert('1');
	var n_page=Math.ceil(max_n_items/n_item_this_page);
	//alert(n_page);
	
	var result="<table border=0 align=center cellpadding=0 cellspacing='1'><tr ><td>";
	result+="<table align=right border='0' cellspacing='1' bgcolor='silver' style='font-family:tahoma;font-size:8pt;line-height:180%' dir='rtl'><tr bgcolor=white>";
	for(i=1;i<=n_page;i++){
		//alert(i);
		bgcolor='white';
		//alert("this_page="+this_page);
		//alert(i);
		//alert('h1');
		if(i>1){
			//alert('h2');
			if(((i-1)%20)==0){
				//alert('h3');
				result+="</tr></table></td></tr><tr><td><table align=right border='0' cellspacing='1' bgcolor='silver' style='font-family:tahoma;font-size:8pt;line-height:180%' dir='rtl'><tr bgcolor=white>"
			}
		}
		//this_page
		if(i==my_this_page)
			bgcolor="LightSkyBlue";
		result+="<td title='رجوع به صفحه شماره "+i+"' width=23 bgcolor='"+bgcolor+"' align=center dir=ltr onmouseover=over_td(this); onmouseout=out_td(this); style='cursor:hand' onmousedown=show_a_feedback("+n_file+","+i+")>"+i+"</td>";	
	}
	
	result+="</tr></table></td></tr></table>";
	//goto_page_links1.innerHTML=result;
	goto_page_links2.innerHTML=result;
	
				
}

function over_td(obj){
	var x=obj.innerText;
	if(x==my_this_page)
		obj.bgColor='LightSkyBlue';
	else
		obj.bgColor='#d7eeff';
		
}		
function out_td(obj){
	var x=obj.innerText;
	if(x!=my_this_page)
		//obj.bgColor='LightSkyBlue';		
	obj.bgColor='white';
	
}	





var my_this_page=1;
function getmessage(page){
	//alert(document.all.main_div.innerHTML);
	document.all.main_div.innerHTML="";
	
	//document.all.main_div.innerHTML="";
	//if(page==2)
	//	return;
	//alert(document.all.main_div.innerHTML);
	var my_table=document.createElement("TABLE");
	var tbody=document.createElement("TBODY");
	my_table.appendChild(tbody);
	main_div.appendChild(my_table);
	my_table.cellSpacing=0;
	my_table.cellPadding=0;
	//my_table.border=1;
	my_table.width='100%';	
	//alert('1');
	xmlDoc=loadxml(4,"&p="+page);
	//alert('2');
	my_this_page=page;
	
	//alert('h30');		
	var n_all_items=xmlDoc.childNodes[1].getAttribute("max_count");
	//alert('h31');	
	//alert('h32');	
	var n_item_this_page=xmlDoc.getElementsByTagName("title").length;//alert(n_item_this_page);
	//alert('h33');	
	for(i=0;i<n_item_this_page;i++){
		var result="<table width='100%' border='0' style='font-family:tahoma;font-size:8pt;line-height:180%' dir='rtl'>";
		title	=xmlDoc.getElementsByTagName("title"	)[i].childNodes[0].nodeValue;
		number	=xmlDoc.getElementsByTagName("number"	)[i].childNodes[0].nodeValue;
		body	=xmlDoc.getElementsByTagName("body"		)[i].childNodes[0].nodeValue;
		sender	=xmlDoc.getElementsByTagName("sender"	)[i].childNodes[0].nodeValue;
		tel		=xmlDoc.getElementsByTagName("tel"		)[i].childNodes[0].nodeValue;
		mail	=xmlDoc.getElementsByTagName("mail"		)[i].childNodes[0].nodeValue;
		time	=xmlDoc.getElementsByTagName("time"		)[i].childNodes[0].nodeValue;
		file	=xmlDoc.getElementsByTagName("file"		)[i].childNodes[0].nodeValue;
		//alert(file);
		if(file!="-")
			file="<a target='_blank' href='"+host_address+"/gallery/"+file+"'><img style='border-color:silver' align=left border=1 width=100 src='"+host_address+"/gallery/w100/"+file+"'></a>";
		else
			file="";

		result+="<tr><td bgcolor='#F6FAFE' width='100' align='left' dir=ltr valign='top'>-<font color=red > "+number+"</font></td><td align='right'><font color=red>"+title+"</font></td></tr>";
		result+="<tr><td bgcolor='#F6FAFE' width='100' align='left' style='color:green' valign='top'>پيام:</td><td align='right'>"+file+"<p align='justify'>"+body+"</SPAN></p></td></tr>";
		result+="<tr><td bgcolor='#F6FAFE' width='100' align='left' style='color:green'>فرستنده:</td><td align='right'>"+sender+"</td></tr>";
		result+="<tr><td bgcolor='#F6FAFE' width='100' align='left' style='color:green'>تلفن:</td><td align='right'>"+tel+"</td></tr>";
		result+="<tr><td bgcolor='#F6FAFE' width='100' align='left' style='color:green'>ایميل:</td><td align='right'><a terget=_blank style='text-decoration:none;color:navy;font-weight:normal;font-size:9pt' href='mailto:"+mail+"'>"+mail+"</a></td></tr>";
		result+="<tr><td bgcolor='#F6FAFE' width='100' align='left' style='color:green'>تاريخ ارسال:</td><td align='right' dir=ltr>"+time+"</td></tr>";
		result+="<tr><td height=1 bgcolor=silver colspan=2></td></tr>";
		result+="</table>";

		var my_row	=document.createElement("TR");
		var my_td	=document.createElement("TD");
		tbody.appendChild(my_row);
		my_row.appendChild(my_td);
		my_td.innerHTML=result;
	}

	//alert('h11');
	write_goto_page_link_in_board(n_all_items,10);
	//alert('h12');
	//alert('h13');


}

function write_goto_page_link_in_talar(max_n_items,n_item_this_page,node,nform,this_page){
	
	//alert("this_page="+this_page);	
	//goto_page_links2.innerHTML="";
	//alert('1');
	var n_page=Math.ceil(max_n_items/n_item_this_page);
	//alert(n_page);
	
	var result="<table border=0 align=right cellpadding=0 cellspacing='1'><tr><td colspan=2 height=20></td></tr><tr ><td>";
	result+="<table border=0 align=right cellpadding=0 cellspacing='1'><tr ><td>";
	result+="<table align=right border='0' cellspacing='1' bgcolor='silver' style='font-family:tahoma;font-size:8pt;line-height:180%' dir='rtl'><tr bgcolor=white>";
	for(i=1;i<=n_page;i++){
		//alert(i);
		bgcolor='white';
		//alert("this_page="+this_page);
		//alert(i);
		//alert('h1');
		if(i>1){
			//alert('h2');
			if(((i-1)%30)==0){
				//alert('h3');
				result+="</tr></table></td></tr><tr><td><table align=right border='0' cellspacing='1' bgcolor='silver' style='font-family:tahoma;font-size:8pt;line-height:180%' dir='rtl'><tr bgcolor=white>"
			}
		}
		//this_page
		if(i==this_page)
			bgcolor="LightSkyBlue";
		result+="<td title='رجوع به صفحه شماره "+i+"' width=23 bgcolor='"+bgcolor+"' align=center dir=ltr onmouseover=over_td(this); onmouseout=out_td(this); style='cursor:hand' onmousedown=f18("+i+","+node+")>"+i+"</td>";	
	}
	
	result+="</tr></table></td></tr></table>";
	result+="</td><td width=120 align=left valign=top dir=rtl style='font-family:tahoma;font-size:8pt;color:green'>رجوع به صفحه شماره:</td></tr><tr><td colspan=2 height=20></td></tr></table>";
	
	return(result);
	//goto_page_links1.innerHTML=result;
	//goto_page_links2.innerHTML=result;
	
				
}







 
 
var fadebgcolor="#004967";
 
////NO need to edit beyond here/////////////
 
var fadearray=new Array() //array to cache fadeshow instances
var fadeclear=new Array() //array to cache corresponding clearinterval pointers
 
var dom=(document.getElementById) //modern dom browsers
var iebrowser=document.all
 
function fadeshow(theimages, fadewidth, fadeheight, borderwidth, delay, pause, onetime, displayorder,element_id){
this.flag=0
this.onetime=onetime
this.element_id=element_id;
 
this.pausecheck=pause
this.mouseovercheck=0
this.delay=delay
this.degree=5 //initial opacity degree (10%)
this.curimageindex=0
this.nextimageindex=1
fadearray[fadearray.length]=this
this.slideshowid=fadearray.length-1
this.canvasbase="canvas"+this.slideshowid
this.curcanvas=this.canvasbase+"_0"
if (typeof displayorder!="undefined")
theimages.sort(function() {return 0.5 - Math.random();}) //thanks to Mike (aka Mwinter) :)
this.theimages=theimages
this.imageborder=parseInt(borderwidth)
this.postimages=new Array() //preload images
for (p=0;p<theimages.length;p++){
this.postimages[p]=new Image()
this.postimages[p].src=theimages[p][0]
}
 
var fadewidth=fadewidth+this.imageborder*2
var fadeheight=fadeheight+this.imageborder*2
 
if (iebrowser&&dom||dom){ //if IE5+ or modern browsers (ie: Firefox)
	//document.write('<div id="master'+this.slideshowid+'" style="position:relative;width:'+fadewidth+'px;height:'+fadeheight+'px;overflow:hidden;"><div id="'+this.canvasbase+'_0" style="position:absolute;width:'+fadewidth+'px;height:'+fadeheight+'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);opacity:10;-moz-opacity:10;-khtml-opacity:10;background-color:'+fadebgcolor+'"></div><div id="'+this.canvasbase+'_1" style="position:absolute;width:'+fadewidth+'px;height:'+fadeheight+'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);opacity:10;-moz-opacity:10;background-color:'+fadebgcolor+'"></div></div>')
	cmd="var mo_obj=document.all."+this.element_id+";";
	eval(cmd);
	//alert(mo_obj);
	//mo_around_html
	mo_obj.innerHTML=('<div id="master'+this.slideshowid+'" style="position:relative;width:'+fadewidth+'px;height:'+fadeheight+'px;overflow:hidden;"><div id="'+this.canvasbase+'_0" style="position:absolute;width:'+fadewidth+'px;height:'+fadeheight+'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);opacity:10;-moz-opacity:10;-khtml-opacity:10;background-color:'+fadebgcolor+'"></div><div id="'+this.canvasbase+'_1" style="position:absolute;width:'+fadewidth+'px;height:'+fadeheight+'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);opacity:10;-moz-opacity:10;background-color:'+fadebgcolor+'"></div></div>')
	//alert(this.element_id);
}
else{
	//document.write('<div><img name="defaultslide'+this.slideshowid+'" src="'+this.postimages[0].src+'"></div>')
	cmd="var mo_obj=document.all."+this.element_id+";";
	eval(cmd);
	mo_obj.innerHTML=('<div><img name="defaultslide'+this.slideshowid+'" src="'+this.postimages[0].src+'"></div>');
	
}
 
if (iebrowser&&dom||dom) //if IE5+ or modern browsers such as Firefox
this.startit()
else{
this.curimageindex++
setInterval("fadearray["+this.slideshowid+"].rotateimage()", this.delay)
}
}
 
function fadepic(obj){
	if (obj.degree<100){
		obj.degree+=2.5 
		if (obj.tempobj.filters&&obj.tempobj.filters[0]){
		if (typeof obj.tempobj.filters[0].opacity=="number") //if IE6+
		obj.tempobj.filters[0].opacity=obj.degree
		else //else if IE5.5-
		obj.tempobj.style.filter="alpha(opacity="+obj.degree+")"
		}
		else if (obj.tempobj.style.MozOpacity)
		obj.tempobj.style.MozOpacity=obj.degree/101
		else if (obj.tempobj.style.KhtmlOpacity)
		obj.tempobj.style.KhtmlOpacity=obj.degree/100
		else if (obj.tempobj.style.opacity&&!obj.tempobj.filters)
		obj.tempobj.style.opacity=obj.degree/101
	}
	else{
		clearInterval(fadeclear[obj.slideshowid])
		obj.nextcanvas=(obj.curcanvas==obj.canvasbase+"_0")? obj.canvasbase+"_0" : obj.canvasbase+"_1"
		obj.tempobj=iebrowser? iebrowser[obj.nextcanvas] : document.getElementById(obj.nextcanvas)
		if(obj.flag&&obj.onetime)
			return;
			
		//alert("obj.postimages.length="+obj.postimages.length);
		if(obj.nextimageindex==obj.postimages.length-1)
			obj.flag=1;
		//alert("obj.nextimageindex="+obj.nextimageindex);
		obj.populateslide(obj.tempobj, obj.nextimageindex)
		obj.nextimageindex=(obj.nextimageindex<obj.postimages.length-1)? obj.nextimageindex+1 : 0
		setTimeout("fadearray["+obj.slideshowid+"].rotateimage()", obj.delay)
	}
}
 
fadeshow.prototype.populateslide=function(picobj, picindex){
	var slideHTML=""
	if (this.theimages[picindex][1]!=""){ //if associated link exists for image
		//alert(picindex);
		slideHTML='<a href="'+this.theimages[picindex][1]+'" target="'+this.theimages[picindex][2]+'">'
	}
	slideHTML+='<img src="'+this.postimages[picindex].src+'" border="'+this.imageborder+'px">'
	if (this.theimages[picindex][1]!="") //if associated link exists for image
		slideHTML+='</a>'
	picobj.innerHTML=slideHTML
}
 
 
fadeshow.prototype.rotateimage=function(){
	if (this.pausecheck==1) //if pause onMouseover enabled, cache object
	var cacheobj=this
	if (this.mouseovercheck==1)
	setTimeout(function(){cacheobj.rotateimage()}, 100)
	else if (iebrowser&&dom||dom){
	this.resetit()
	var crossobj=this.tempobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
	crossobj.style.zIndex++
	fadeclear[this.slideshowid]=setInterval("fadepic(fadearray["+this.slideshowid+"])",50)
	this.curcanvas=(this.curcanvas==this.canvasbase+"_0")? this.canvasbase+"_1" : this.canvasbase+"_0"
	}
	else{
	var ns4imgobj=document.images['defaultslide'+this.slideshowid]
	ns4imgobj.src=this.postimages[this.curimageindex].src
	}
	this.curimageindex=(this.curimageindex<this.postimages.length-1)? this.curimageindex+1 : 0
}
 
fadeshow.prototype.resetit=function(){
	this.degree=10
	var crossobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
	if (crossobj.filters&&crossobj.filters[0]){
	if (typeof crossobj.filters[0].opacity=="number") //if IE6+
	crossobj.filters(0).opacity=this.degree
	else //else if IE5.5-
	crossobj.style.filter="alpha(opacity="+this.degree+")"
	}
	else if (crossobj.style.MozOpacity)
	crossobj.style.MozOpacity=this.degree/101
	else if (crossobj.style.KhtmlOpacity)
	crossobj.style.KhtmlOpacity=this.degree/100
	else if (crossobj.style.opacity&&!crossobj.filters)
	crossobj.style.opacity=this.degree/101
}
 
 
fadeshow.prototype.startit=function(){
	//alert('startit this.curimageindex='+this.curimageindex);
	var crossobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
	this.populateslide(crossobj, this.curimageindex)
	if (this.pausecheck==1){ //IF SLIDESHOW SHOULD PAUSE ONMOUSEOVER
		var cacheobj=this
		var crossobjcontainer=iebrowser? iebrowser["master"+this.slideshowid] : document.getElementById("master"+this.slideshowid)
		crossobjcontainer.onmouseover=function(){cacheobj.mouseovercheck=1}
		crossobjcontainer.onmouseout=function(){cacheobj.mouseovercheck=0}
	}
	this.rotateimage()
}
 
 
 




	
	function class_show_one_image(nfile,element_id,image_folder){
		this.nfile			=0;
		this.xmlhttp		=null;
		this.pic_obj		=null;
		this.pic_obj_link	=null;
		this.image_folder	='w100';
		


		this.show_picture=function(){
			var c_xml=this.xmlhttp;			
			
			obj_pic		=c_xml.getElementsByTagName("noskhe")[0];
			pic_title	=get_element_value(obj_pic,'qst_1');
			pic_name	=get_element_value(obj_pic,'qst_2');
			
			//alert(this.image_folder);

			if(this.image_folder!='w100'){
	    		this.pic_obj.style.filter="blendTrans(duration=1)";
	   			this.pic_obj.filters.blendTrans.Apply();
	   			
				if (this.pic_obj.filters){
					this.pic_obj.filters.blendTrans.Play();
				}			
			}
			//this.pic_obj.border=1;
			this.pic_obj.src=host_address+"/gallery/"+this.image_folder+"/"+pic_name;	
			if(this.pic_obj_link==null || this.pic_obj_link==undefined){
				//alert('dddddd');
				return;
			}
			this.pic_obj_link.href=host_address+"/gallery/"+pic_name;	
			//url2=host_address+"/gallery/"+pic_name;	
			//this.pic_obj.onclick="this.location='"+url2+"'";
			//this.pic_obj.src = imageFile;

  			
			
		}

		
		

		this.init_class=function(){
			//alert(' ');
			this.nfile			=nfile;
			this.image_folder	='w100';
			
			this.image_folder	=image_folder.toLowerCase();
			
		
			if(element_id!='' && element_id!=undefined)
				eval("this.pic_obj=document.all."+element_id);
			else
				eval("this.pic_obj=document.all.my_picture_"+this.nfile);

			
			eval("this.pic_obj_link=document.all.my_picture_"+this.nfile+"_link");
			
			
			url					=host_address+"/"+site_lang+"/xml/pictures/"+nfile+".xml";
			var self=this;
			var aj1	=new sack();
			
			//alert(url);
			
			aj1.requestFile		= url;
			aj1.onCompletion	= function(){  self.xmlhttp=this.responseXML;   self.show_picture();  };	
			aj1.runAJAX();	
			
		};
	
		this.init_class();
	
	
	
	}
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
var mo_arr00=new Array();	
	
	
var dynamicContent_ajaxObjects = new Array(); 
var jsCache = new Array();
var enableCache = true; 

function ajax_loadContent(divId,pathToFile,pic_folder,href){
	
	if(enableCache && jsCache[pathToFile]){
		document.getElementById(divId).innerHTML = jsCache[pathToFile];
		return;
	}
	
	
	
	var ajaxIndex = dynamicContent_ajaxObjects.length;
	//document.getElementById(divId).innerHTML = 'Loading content...';
	
	dynamicContent_ajaxObjects[ajaxIndex] = new Array();

	dynamicContent_ajaxObjects[ajaxIndex][0] = new sack();
	dynamicContent_ajaxObjects[ajaxIndex][0].requestFile = pathToFile;
	dynamicContent_ajaxObjects[ajaxIndex][0].onCompletion = function(){ ajax_showContent(divId,ajaxIndex,pathToFile); };  
	
	dynamicContent_ajaxObjects[ajaxIndex][1]=divId;
	dynamicContent_ajaxObjects[ajaxIndex][2]='';//mean: pic_name
	dynamicContent_ajaxObjects[ajaxIndex][3]='';//mean: pic_title
	dynamicContent_ajaxObjects[ajaxIndex][4]='';//mean: pic_width
	dynamicContent_ajaxObjects[ajaxIndex][5]='';//mean: pic_height
	dynamicContent_ajaxObjects[ajaxIndex][6]=pic_folder;//mean: pic_folder
	dynamicContent_ajaxObjects[ajaxIndex][7]=href;//mean: pics_url
  
} 


function run_all_ajaxes_for_this_news(divId){
	var i;
	for(i=0;i<dynamicContent_ajaxObjects.length;i++){
		if(dynamicContent_ajaxObjects[i][1]==divId){
			//alert(divId);
			dynamicContent_ajaxObjects[i][0].runAJAX();
		}
	}
	//alert('d');
}

function ajax_showContent(divId,ajaxIndex,pathToFile){
	var c_xml=dynamicContent_ajaxObjects[ajaxIndex][0].responseXML;
	
	
		
	
	obj_pic		=c_xml.getElementsByTagName("noskhe")[0];
	pic_title	=get_element_value(obj_pic,'qst_1');
	pic_name	=get_element_value(obj_pic,'qst_2');
	pic_width	=get_element_value(obj_pic,'qst_3');
	pic_height	=get_element_value(obj_pic,'qst_4');
	
	dynamicContent_ajaxObjects[ajaxIndex][2]=pic_name;
	dynamicContent_ajaxObjects[ajaxIndex][3]=pic_title;
	dynamicContent_ajaxObjects[ajaxIndex][4]=pic_width;
	dynamicContent_ajaxObjects[ajaxIndex][5]=pic_height;
	
	
	if(enableCache){
		jsCache[pathToFile] = dynamicContent_ajaxObjects[ajaxIndex][0].responseXML;
	}
	dynamicContent_ajaxObjects[ajaxIndex][0] = false;
	
	

	
	
	if(is_fimished_downloading_all_pics_for_a_news(divId))
		show_pics_for_a_news(divId);
	
}	
	

function is_fimished_downloading_all_pics_for_a_news(divId){
	//alert(dynamicContent_ajaxObjects.length);
	for(i=0;i<dynamicContent_ajaxObjects.length;i++){
		if(dynamicContent_ajaxObjects[i][1]==divId){
			if(dynamicContent_ajaxObjects[i][0]!=false){
				return(false);
			}
		}
	}
	
	return true;
}

var all_fadeimages=new Array();
var fadebgcolor="#ffffff";

function show_pics_for_a_news(divId){
	
	var count_of_imgs			=0;
	
	for(i=0;i<dynamicContent_ajaxObjects.length;i++){
		if(dynamicContent_ajaxObjects[i][1]==divId)
			count_of_imgs++;
	}
	//alert(count_of_imgs);
	
	var html='';
	if(count_of_imgs==1){
		for(i=0;i<dynamicContent_ajaxObjects.length;i++){
			if(dynamicContent_ajaxObjects[i][1]==divId){
				name		=dynamicContent_ajaxObjects[i][2];
				title		=dynamicContent_ajaxObjects[i][3];
				pic_folder	=dynamicContent_ajaxObjects[i][6];
				news_url	=dynamicContent_ajaxObjects[i][7];
				
				tiny_width=pic_folder;
				re=/(w|h)/gm;
				tiny_width=tiny_width.replace(re,"");
								
				url			=host_address+"/gallery/"+pic_folder+"/"+name;
				html		="<a href='"+news_url+"'><img width='"+tiny_width+"' class=div_for_slideshow align=left vspace=0 hspace=0  title='"+title+"' src='"+url+"'></a>";
				break;
			}
		}
	}else{
		var k=0;
		c=all_fadeimages.length;
		all_fadeimages[c]=new Array();
		var max_height=0;
		var tiny_width=100;
		
		for(i=0;i<dynamicContent_ajaxObjects.length;i++){
			if(dynamicContent_ajaxObjects[i][1]==divId){
				width		=dynamicContent_ajaxObjects[i][4];
				height		=dynamicContent_ajaxObjects[i][5];
				pic_folder	=dynamicContent_ajaxObjects[i][6];
				
				tiny_width=pic_folder;
				re=/(w|h)/gm;
				tiny_width=tiny_width.replace(re,"");
				tiny_width=Number(tiny_width);
				
				height=Math.ceil((height*tiny_width)/width);
				if(height>max_height)
					max_height=height;
			}
		}		
		for(i=0;i<dynamicContent_ajaxObjects.length;i++){
			if(dynamicContent_ajaxObjects[i][1]==divId){
				name		=dynamicContent_ajaxObjects[i][2];
				title		=dynamicContent_ajaxObjects[i][3];
				width		=dynamicContent_ajaxObjects[i][4];
				height		=dynamicContent_ajaxObjects[i][5];
				pic_folder	=dynamicContent_ajaxObjects[i][6];
				news_url	=dynamicContent_ajaxObjects[i][7];
				
				url			=host_address+"/gallery/"+pic_folder+"/"+name;
				
				k=all_fadeimages[c].length;
				if(news_url=='' || news_url==undefined)
					news_url='';
				
				all_fadeimages[c][k]=[url,news_url,""];

			}
		}
		
		if(max_height==0)
			max_height=130;
		if(tiny_width==0)
			tiny_width=10;
		
		
		
	}
		
	
	document.getElementById(divId).innerHTML =html;
	//دو خط پایین تر باید با کمی مکث اجرا شود یعنی اگر در ایف بالایی میزاشتم چون سریع ران میشد خطا میداد برای همین جداش کردم آو.ردم زید ایینر اچ تی ام ال:
	if(count_of_imgs>1){
		new fadeshow(all_fadeimages[c], tiny_width, max_height, 0, 3000, 0, 0,undefined,divId);
	}
	
	
}




function f_mohammad(element_id,nfiles,pic_folder,href){
	
	if(element_id=='comment_picture_0'){
		alert(nfiles);
	}

	c=mo_arr00.length;
	mo_arr00[c]=new Array();
	mo_arr00[c][0]=element_id;
	mo_arr00[c][1]=0;//count of images that shuld be downloaded
	mo_arr00[c][2]=new Array();
			
	//alert(nfiles);
	//return;
	
	var arr_nfiles			=nfiles.split('-');
	var i;
	
	var url;
	
	//alert(arr_nfiles);
	
	
	document.getElementById(element_id).innerHTML ="<img title='در حال نمایش عکس' border=0 src='"+host_address+"/fa/pictures/loading2.gif'>";
			
	var i=0;
	for(i=0;i<arr_nfiles.length;i++){
		nfile	=Number(arr_nfiles[i]);
		if(nfile==0)
			continue;
			
		url		=host_address+"/fa/xml/pictures/"+nfile+".xml";
		ajax_loadContent(element_id,url,pic_folder,href);	

	}
	
	if(i==1){
		document.getElementById(element_id).innerHTML ="";
		document.getElementById(element_id).className ="";
	}
	
	
	run_all_ajaxes_for_this_news(element_id);


}
	
	
function mo_666(divId)	{
	
	
	for(i=0;i<dynamicContent_ajaxObjects.length;i++){
		if(dynamicContent_ajaxObjects[i][1]==divId){
			if(dynamicContent_ajaxObjects[i][0]!=false){
				alert(dynamicContent_ajaxObjects[i][4])
			}
		}
	}
}
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	

	
	function class_show_some_images(nfiles,element_id,image_folder){
		this.nfiles			=new Array();
		this.xmlhttp		=null;
		this.pic_obj		=null;
		this.pic_obj_link	=null;
		this.image_folder	='w100';
		this.arr_pictures	=new Array();
		this.arr_ajax		=new Array();

		
		this.gether_name_title_for_a_npic=function(element_id,index){
			//var c_xml=this.xmlhttp;	
			
			nfile=this.arr_ajax[index].nfile;
			alert("nfile="+nfile);
			/*
			
			obj_pic		=c_xml.getElementsByTagName("noskhe")[0];
			pic_title	=get_element_value(obj_pic,'qst_1');
			pic_name	=get_element_value(obj_pic,'qst_2');
						
			for(i=0;i<this.arr_pictures.length;i++){
				if(this.arr_pictures[i][3]==nfile){
					alert("nfile="+nfile+"      i="+i);
					//this.arr_pictures[i]	=new Array();
					this.arr_pictures[i][0]	=pic_title;
					this.arr_pictures[i][1]	=pic_name;
					this.arr_pictures[i][2]	='finished';
				}
			}
						

			*/

			//test_aya_hame_aks_ha_download_shode_and_agar_bale_hala_namayesh_es_shoon_bede
			//this.show_pictures();			
			
			
		};
		
		
/*
		this.show_picture=function(){
			var c_xml=this.xmlhttp;			
			
			obj_pic		=c_xml.getElementsByTagName("noskhe")[0];
			pic_title	=get_element_value(obj_pic,'qst_1');
			pic_name	=get_element_value(obj_pic,'qst_2');
			
			//alert(this.image_folder);

			if(this.image_folder!='w100'){
	    		this.pic_obj.style.filter="blendTrans(duration=1)";
	   			this.pic_obj.filters.blendTrans.Apply();
	   			
				if (this.pic_obj.filters){
					this.pic_obj.filters.blendTrans.Play();
				}			
			}
			//this.pic_obj.border=1;
			this.pic_obj.src=host_address+"/gallery/"+this.image_folder+"/"+pic_name;	
			if(this.pic_obj_link==null || this.pic_obj_link==undefined){
				//alert('dddddd');
				return;
			}
			this.pic_obj_link.href=host_address+"/gallery/"+pic_name;	
			//url2=host_address+"/gallery/"+pic_name;	
			//this.pic_obj.onclick="this.location='"+url2+"'";
			//this.pic_obj.src = imageFile;

  			
			
		}*/

		
		
		this.show_pictures=function(){
			
			for(i=0;i<this.arr_pictures.length;i++){
				if(this.arr_pictures[i][2]!='finished'){
					//alert(this.arr_pictures);
					return;
				}
			}
			
			//وقتی به اینجا میرسد یعنی همه عکسها کامل دانلود شده اندک
			alert('yes='+this.arr_pictures.length);
		};
		
		this.init_class_6=function(){
			//alert(' ');
			this.nfiles			=nfiles.split('-');
			this.image_folder	='w100';
			this.image_folder	=image_folder.toLowerCase();
			

					
			//alert(this.nfiles);
			//return;
			
			
			//if(element_id!='' && element_id!=undefined)
				eval("this.pic_obj=document.all."+element_id);
			//else
			//	eval("this.pic_obj=document.all.my_picture_"+this.nfile);

			
			//eval("this.pic_obj_link=document.all.my_picture_"+this.nfile+"_link");
			var index=0;
			var nfile=0;
			var i=0;
			
			for(i=0;i<this.nfiles.length;i++){
				nfile	=Number(this.nfiles[i]);
				if(nfile==0)
					continue;
					
				index=this.arr_pictures.length;
				this.arr_pictures[index]	=new Array();
				this.arr_pictures[index][0]	='';
				this.arr_pictures[index][1]	='';
				this.arr_pictures[index][2]	='';
				this.arr_pictures[index][3]	=nfile;
			}
			
			host_address			=host_address+"/"+site_lang;
			var c=0;
			for(i=0;i<this.arr_pictures.length;i++){
				var nfile				=this.arr_pictures[i][3];
				
				url						=host_address+"/xml/pictures/"+nfile+".xml";
				
				document.getElementById(element_id).innerHTML ="<img border=0 src='"+host_address+"/pictures/loading2.gif'>";
				c=this.arr_ajax.length;
				//alert("c="+c);
				var self						=this;
				this.arr_ajax[c]				=new sack();
				this.arr_ajax[c].nfile			= nfile;
				this.arr_ajax[c].requestFile	= url;
				this.arr_ajax[c].onCompletion	=function(){  gether_name_title_for_a_npic(element_id,c);  };	
				this.arr_ajax[c].runAJAX();		
				//this.arr_ajax[c]
				
				//var self=this;
				//var aj1	=new sack();
				
				//alert(nfile);
				
				//aj1.requestFile		= url;
				//aj1.onCompletion	= function(){  self.xmlhttp=this.responseXML;   self.gether_name_title_for_a_npic(nfile);  };	
				//aj1.runAJAX();					
				
			}
			
			//for(i=0;i<this.arr_ajax.length;i++){
			//	alert(this.arr_ajax[i].onCompletion);
			//}
			//alert(this.arr_ajax[0]);
			
			
				
				//alert(index);

				
			
			
			
		};
	
		this.init_class_6();
	
	
	
	}
		
	function gether_name_title_for_a_npic(element_id,c){
		alert(c);
	}
	
	
	function class_show_counter(){

		this.show=function(){
			var counter=this.xmlhttp;			
			
			//counter		=c_xml.getElementsByTagName("variables")[0].getElementsByTagName("counter")[0].childNodes[0].nodeValue;
			//alert(counter);
			document.all.counter_section.innerText=counter;
			//alert(counter);
		}
		this.init_class=function(){
			
			url					=host_address+"/app3.php";
			var self=this;
			var aj1	=new sack();
			
			//alert("subsite="+subsite+ "    lang="+site_lang);
			
			aj1.method = 'GET';
			aj1.setVar("subsite"	, subsite);
			aj1.setVar("lang"		, site_lang);
			aj1.setVar("method"		, 15);
			aj1.requestFile		= url;
			aj1.onCompletion	= function(){  self.xmlhttp=this.response;   self.show();  };	
			aj1.runAJAX();	
			
		};
	
		this.init_class();
	}
	

/***********************************************
* Pausing up-down scroller- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/

function pausescroller(content, divId, divClass, delay){
this.content=content //message array content
this.tickerid=divId //ID of ticker div to display information
this.delay=delay //Delay between msg change, in miliseconds.
this.mouseoverBol=0 //Boolean to indicate whether mouse is currently over scroller (and pause it if it is)
this.hiddendivpointer=1 //index of message array for hidden div
document.write('<div id="'+divId+'" class="'+divClass+'" style="position: relative; overflow: hidden"><div class="innerDiv" style="position: absolute; width: 100%" id="'+divId+'1">'+content[0]+'</div><div class="innerDiv" style="position: absolute; width: 100%; visibility: hidden" id="'+divId+'2">'+content[1]+'</div></div>')
var scrollerinstance=this
if (window.addEventListener) //run onload in DOM2 browsers
window.addEventListener("load", function(){scrollerinstance.initialize()}, false)
else if (window.attachEvent) //run onload in IE5.5+
window.attachEvent("onload", function(){scrollerinstance.initialize()})
else if (document.getElementById) //if legacy DOM browsers, just start scroller after 0.5 sec
setTimeout(function(){scrollerinstance.initialize()}, 500)
}

// -------------------------------------------------------------------
// initialize()- Initialize scroller method.
// -Get div objects, set initial positions, start up down animation
// -------------------------------------------------------------------

pausescroller.prototype.initialize=function(){
this.tickerdiv=document.getElementById(this.tickerid)
this.visiblediv=document.getElementById(this.tickerid+"1")
this.hiddendiv=document.getElementById(this.tickerid+"2")
this.visibledivtop=parseInt(pausescroller.getCSSpadding(this.tickerdiv))
//set width of inner DIVs to outer DIV's width minus padding (padding assumed to be top padding x 2)
this.visiblediv.style.width=this.hiddendiv.style.width=this.tickerdiv.offsetWidth-(this.visibledivtop*2)+"px"
this.getinline(this.visiblediv, this.hiddendiv)
this.hiddendiv.style.visibility="visible"
var scrollerinstance=this
document.getElementById(this.tickerid).onmouseover=function(){scrollerinstance.mouseoverBol=1}
document.getElementById(this.tickerid).onmouseout=function(){scrollerinstance.mouseoverBol=0}
if (window.attachEvent) //Clean up loose references in IE
window.attachEvent("onunload", function(){scrollerinstance.tickerdiv.onmouseover=scrollerinstance.tickerdiv.onmouseout=null})
setTimeout(function(){scrollerinstance.animateup()}, this.delay)
}


// -------------------------------------------------------------------
// animateup()- Move the two inner divs of the scroller up and in sync
// -------------------------------------------------------------------

pausescroller.prototype.animateup=function(){
var scrollerinstance=this
if (parseInt(this.hiddendiv.style.top)>(this.visibledivtop+2)){
this.visiblediv.style.top=parseInt(this.visiblediv.style.top)-2+"px"
this.hiddendiv.style.top=parseInt(this.hiddendiv.style.top)-2+"px"
setTimeout(function(){scrollerinstance.animateup()}, 50)
}
else{
this.getinline(this.hiddendiv, this.visiblediv)
this.swapdivs()
setTimeout(function(){scrollerinstance.setmessage()}, this.delay)
}
}

// -------------------------------------------------------------------
// swapdivs()- Swap between which is the visible and which is the hidden div
// -------------------------------------------------------------------

pausescroller.prototype.swapdivs=function(){
var tempcontainer=this.visiblediv
this.visiblediv=this.hiddendiv
this.hiddendiv=tempcontainer
}

pausescroller.prototype.getinline=function(div1, div2){
div1.style.top=this.visibledivtop+"px"
div2.style.top=Math.max(div1.parentNode.offsetHeight, div1.offsetHeight)+"px"
}

// -------------------------------------------------------------------
// setmessage()- Populate the hidden div with the next message before it's visible
// -------------------------------------------------------------------

pausescroller.prototype.setmessage=function(){
var scrollerinstance=this
if (this.mouseoverBol==1) //if mouse is currently over scoller, do nothing (pause it)
setTimeout(function(){scrollerinstance.setmessage()}, 100)
else{
var i=this.hiddendivpointer
var ceiling=this.content.length
this.hiddendivpointer=(i+1>ceiling-1)? 0 : i+1
this.hiddendiv.innerHTML=this.content[this.hiddendivpointer]
this.animateup()
}
}

pausescroller.getCSSpadding=function(tickerobj){ //get CSS padding value, if any
if (tickerobj.currentStyle)
return tickerobj.currentStyle["paddingTop"]
else if (window.getComputedStyle) //if DOM2
return window.getComputedStyle(tickerobj, "").getPropertyValue("padding-top")
else
return 0
}	

	
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}

 

