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+"/app2.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];
			time_send		=obj.getElementsByTagName("time")[0].childNodes[0].nodeValue;
			var nform2		=0;
			var value2		='';
			var arr_pics	=new Array();
			this.arr_pics	=new Array();
			
			for(i=0;i<obj.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="qst_"+i;
   					//alert(qst);
   					//nform2=obj.getElementsByTagName(qst)[0].getAttribute("nform");
   					cmd="nform2=obj.getElementsByTagName('"+qst+"')[0].getAttribute('nform');";
   					//alert(cmd);
   					eval(cmd);
   					value2	=obj.getElementsByTagName(qst)[0].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("-");
			}
			
			
			//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;

		/*
			relations	=obj.getElementsByTagName("relations")[0].getElementsByTagName("form");
			picture		="";
			var this_pic="";
		
			//alert(relations.length);
			
			if(relations.length>0){
				form_name	=obj.getElementsByTagName("relations")[0].getElementsByTagName("form")[0].getAttribute("name");
				if(form_name==1){
					//alert("nfile="+this.nfile);
					pic_nfiles	=obj.getElementsByTagName("relations")[0].getElementsByTagName("form")[0].childNodes[0].nodeValue;
					//alert("pic_nfiles="+pic_nfiles+"    nfile="+this.nfile);
					arr_pics	=pic_nfiles.split("-");
					//alert(arr_pics);
					this_pic	=arr_pics[0];
					picture		="<a target=_blank id='pic_id_"+this.nfile+"'></a>";
				}
			}
		*/
			

			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+"/app2.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+"/app2.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 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+"/app2.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;
			}
			
			//xmlDoc_talar=this.xmlhttp;
			
			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+"/app2.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+"/app2.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){
		//alert("number="+number+"    , pattern="+pattern+"    , index_nfile="+index_nfile);
		width	=arr_qst_width_height[number][0];
		height	=arr_qst_width_height[number][1];
//alert("end");		
		switch(pattern){
			case "1":
				name="qst_"+number+"_"+pattern+"_1";
				answer_control="<input "+dir+"   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+"'></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);
				for(p=0;p<count;p++){
					answer_control+="<option 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":
				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>";
				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+"' >";

				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+"/app2.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 submit_form(id,form_id,style_submit){
	//alert(form_id);
	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";
			//alert('1');

		}
		eval(id+".submit();");		
	}
	/* dar 88-8-13 in ghesmat bekhatere form e ertebat ba emam jamaat hazf shod:
	if(form_id==11 || form_id==13 || form_id>100 ){
		if(!test_submit_form(form_id))
			return false;
	}
	*/
	//if(id=='talar_form'){
		//document.all.submit_talar_button.disabled = true;
		loading_logo_for_ajax.style.visibility='visible';
		//loading_logo_for_ajax.style.left=150;
		//loading_logo_for_ajax.style.top=300;
		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)>80)
			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('d');
/*
	------- document: -------
	0=99 	table_w-first_td_w
	1=98	excepts
*/	

	re=/^99=(.+)/mg;
	arr = re.exec(str_properties);
	s=arr[1];
	result[0]=s.split("-");
	
	re=/^98=([^,]+)/mg;
	arr = re.exec(str_properties);
	//alert(arr);
	if(arr!=null){
		s=arr[1];	
		result[1]=s.split("-");
	}else
		result[1]=0;
	
	
	re=/^504=([^,]+)/mg;
	arr = re.exec(str_properties);
	if(arr!=null){
		result[2]=arr[1];
	}else
		result[2]='';
	
	//alert(result[2]);
	
	
	return (result);
	//alert(arr);
   	//while ((arr = re.exec(str_properties)) != null)
   	//document.write(arr.index + "-" + arr.lastIndex + "\t" + arr);
}
function show_talar_form(form_id,relations,style_form,style_submit,form_bgcolor,style_function){
	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);
	//alert(talar_form_section_div);
	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%';	
	
	
	
	//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;


	
	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");

	
	
	arr=get_form_properties(form_properties);
	table_width	=arr[0][0];
	title_width	=arr[0][1];
	email		=arr[2];
	
	//alert("email="+email);
	qst_excepts=arr[1];
	//alert(qst_excepts);
	
	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+"/app2.php' ENCTYPE='multipart/form-data'>";
	

	
	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;
	
	
	
	qst_row=new Array();
	var i=0;
	


	
	
	//var title_width=70;
	//if(form_id==1)
	//	title_width=100;
	//	alert('d2');
	
	
	for(i=0;i<qst_count;i++){
		//alert("i="+i);
		obj					=c_xml_talar_form.getElementsByTagName("qst"	)[i];
		number				=obj.getAttribute("number");
		
		//alert(obj);
		
		flag=false;
		for(m in qst_excepts){
			if(qst_excepts[m]==number){
				flag=true;
				break;
			}
		}
		if(flag)
			continue;
			
		qst_tozih='';
		
		qst_title			=obj.childNodes[0].childNodes[0].nodeValue;
		qst_lang			=obj.childNodes[1].childNodes[0].nodeValue;
		qst_pattern			=obj.childNodes[2].childNodes[0].nodeValue;
		qst_ertefa			=obj.childNodes[3].childNodes[0].nodeValue;
		qst_gozineha_count	=obj.childNodes[4].getElementsByTagName("item").length;
		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=obj.childNodes[4].getElementsByTagName("item")[j].childNodes[0].nodeValue;
			arr_items[j]=s;
		}
		
		//alert("number="+number+"   ,  count="+arr_items.length);
		
		c=1;

		answer_control=get_table_of_pattern(qst_pattern,number,c);

			
		
		
	/*	
alert('number='+number);
alert('answer_control='+answer_control);
alert('qst_title='+qst_title);
alert('qst_pattern='+qst_pattern);
alert('qst_tozih='+qst_tozih);
*/		
	
		qst_row[number]=new Array();
		qst_row[number][0]=answer_control;
		qst_row[number][1]=qst_title;
		qst_row[number][2]=qst_pattern;
		qst_row[number][3]=qst_tozih;
		qst_row[number][4]='';//value;

		
		
		//alert("number="+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);
//alert('1260');

		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'){
		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){
this.flag=0
this.onetime=onetime
 
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>')
else
document.write('<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();
	
	
	
	}

/***********************************************
* 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+5)){
this.visiblediv.style.top=parseInt(this.visiblediv.style.top)-5+"px"
this.hiddendiv.style.top=parseInt(this.hiddendiv.style.top)-5+"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
}	

	
 
