function GetXmlHttpObject()
{
    var xmlHttp=null;
    try
     {
     // Firefox, Opera 8.0+, Safari
     xmlHttp=new XMLHttpRequest();
     }
    catch (e)
     {
     //Internet Explorer
     try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
     catch (e)
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
     }
    return xmlHttp;
}
//-------------------------------------------------------------------
function getid(id)
{
    return(document.getElementById(id));
}
//-------------------------------------------------------------------
function home(id)
{
   

	 
	 var i=1;
	 while(i<=7)
	 {
		if(i!=id)
		{
			getid(i).style.color='white';
		}
		i++;
		
	 }
	 getid(id).style.color='#FFDF1B';
	 xmlHttp=GetXmlHttpObject();
      if (xmlHttp==null)
      {
        alert ("Browser does not support HTTP Request");
        return;
      }
      //page address in server

}
function stateChanged1()
{
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
     {

        if(xmlHttp.responseText)
		{
			getid('loading').innerHTML='';
			getid('panel').innerHTML=xmlHttp.responseText;

		}
     }
	 else
	 {
		getid('loading').innerHTML='<p style="text-align:right;font:11px Tahoma">&nbsp;<img src="images/loading2.gif" align="center">&nbsp; در حال بارگزاري. لطفا منتظر بمانيد...</p>';
	 }
}
//-------------------------------------------------------------------
function view_menu(id)
{
   

	 
	 var i=1;
	 while(i<=10)
	 {
		if(i!=id)
		{
			getid(i).style.color='#0d2c58';
		}
		i++;
		
	 }
	 getid(id).style.color='#EA5503';
	 xmlHttp=GetXmlHttpObject();
      if (xmlHttp==null)
      {
        alert ("Browser does not support HTTP Request");
        return;
      }
      //page address in server
	  if(id==1)
	  {
		url="../page/home.php";
	  }
	  else if(id==2)
	  {
		url="../page/site.php";
	  }
	  else if(id==3)
	  {
		url="../page/question.php";
	  }
	  else if(id==4)
	  {
		url="../page/gallery.php";
	  }
	  else if(id==5)
	  {
		url="../page/membership.php";
	  }
	  else if(id==6)
	  {
		url="../page/member_login.php";
	  }
	  else if(id==7)
	  {
		url="../page/search.php";
	  }
	  else if(id==8)
	  {
		url="../page/about_us.php";
	  }
	  else if(id==9)
	  {
		url="../page/contact_us.php";
	  }
	  else if(id==10)
	  {
		url="../page/file.php";
	  }
	
	
      //paramet in text box
      params='id='+(id);

      xmlHttp.onreadystatechange=stateChanged1;

      xmlHttp.open("POST", url, true);

      //Send the proper header information along with the request
      xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      xmlHttp.setRequestHeader("Content-length", params.length);
      xmlHttp.setRequestHeader("Connection", "close");

     xmlHttp.send(params);

}
//---------------------------------------------------------------------------------------------
function gallery(id)
{
	xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null)
    {
		alert ("Browser does not support HTTP Request");
        return;
    }
	url="page/page_gallery.php";
	 //paramet in text box
      params='id='+(id);

      xmlHttp.onreadystatechange=stateChanged2;

      xmlHttp.open("POST", url, true);

      //Send the proper header information along with the request
      xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      xmlHttp.setRequestHeader("Content-length", params.length);
      xmlHttp.setRequestHeader("Connection", "close");

     xmlHttp.send(params);

}
function stateChanged2()
{
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
     {

        if(xmlHttp.responseText)
		{
			getid('gallery_pic').innerHTML=xmlHttp.responseText;

		}
     }
	 else
	 {
		getid('gallery_pic').innerHTML='<br></br><p style="text-align:center"><img src="images/lightbox-ico-loading.gif" align="center"></p>';
	 }
}
//----------------------------------------------------------------------------
function gallery_pic(page,id,title)
{
	var t="'"+title+"'";
	getid('title').innerHTML='<a href="#" onclick="gallery_pic(1,'+id+','+t+')"> آلبوم '+title+'</a><span id="pic_title"></span>';
	xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null)
    {
		alert ("Browser does not support HTTP Request");
        return;
    }
	url="page/gallery_pic.php";
	 //paramet in text box
	
      params='id='+(id)+'&page='+(page)+'&title='+(title);

      xmlHttp.onreadystatechange=stateChanged2;

      xmlHttp.open("POST", url, true);

      //Send the proper header information along with the request
      xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      xmlHttp.setRequestHeader("Content-length", params.length);
      xmlHttp.setRequestHeader("Connection", "close");

     xmlHttp.send(params);

}
//------------------------------------------------------------------------------------
function view_pic(id,title,cat_id)
{
	getid('pic_title').innerHTML=" » "+title;
	xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null)
    {
		alert ("Browser does not support HTTP Request");
        return;
    }
	url="page/view_pic.php";
	 //paramet in text box
      params='id='+(id)+'&cat_id='+(cat_id);

      xmlHttp.onreadystatechange=stateChanged2;

      xmlHttp.open("POST", url, true);

      //Send the proper header information along with the request
      xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      xmlHttp.setRequestHeader("Content-length", params.length);
      xmlHttp.setRequestHeader("Connection", "close");

     xmlHttp.send(params);

}
//--------------------------------------------------------------------------
function question(id)
{
	xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null)
    {
		alert ("Browser does not support HTTP Request");
        return;
    }
	url="page/page_question.php";
	 //paramet in text box
      params='id='+(id);

      xmlHttp.onreadystatechange=stateChanged3;

      xmlHttp.open("POST", url, true);

      //Send the proper header information along with the request
      xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      xmlHttp.setRequestHeader("Content-length", params.length);
      xmlHttp.setRequestHeader("Connection", "close");

     xmlHttp.send(params);

}
function stateChanged3()
{
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
     {

        if(xmlHttp.responseText)
		{
			getid('question').innerHTML=xmlHttp.responseText;

		}
     }
	 else
	 {
		getid('question').innerHTML='<br></br><p style="text-align:center"><img src="images/lightbox-ico-loading.gif" align="center"></p>';
	 }
}
//------------------------------------------------------------------
function search_question()
{
	xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null)
    {
		alert ("Browser does not support HTTP Request");
        return;
    }
	url="page/search_question.php";
	 //paramet in text box
      params='code='+(getid('code').value);

      xmlHttp.onreadystatechange=stateChanged3;

      xmlHttp.open("POST", url, true);

      //Send the proper header information along with the request
      xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      xmlHttp.setRequestHeader("Content-length", params.length);
      xmlHttp.setRequestHeader("Connection", "close");

     xmlHttp.send(params);

}
//--------------------------------------------------------------------------
function search()
{
	xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null)
    {
		alert ("Browser does not support HTTP Request");
        return;
    }
	url="page/search_result.php";
	 //paramet in text box
      params='code='+(getid('code').value)+'&option='+(getid('option').value);

      xmlHttp.onreadystatechange=stateChanged3;

      xmlHttp.open("POST", url, true);

      //Send the proper header information along with the request
      xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      xmlHttp.setRequestHeader("Content-length", params.length);
      xmlHttp.setRequestHeader("Connection", "close");

     xmlHttp.send(params);
}
//--------------------------------------------------------------------------
function send_question()
{
	
	xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null)
    {
		alert ("Browser does not support HTTP Request");
        return;
    }
	url="page/insert_question.php";
	 //paramet in text box
      params='username='+(getid('username').value)+'&password='+(getid('password').value)+'&user_login='+(getid('user_login').value)+'&idea='+(getid('idea').value);

      xmlHttp.onreadystatechange=stateChanged4;

      xmlHttp.open("POST", url, true);

      //Send the proper header information along with the request
      xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      xmlHttp.setRequestHeader("Content-length", params.length);
      xmlHttp.setRequestHeader("Connection", "close");

     xmlHttp.send(params);

}
function stateChanged4()
{

    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
     {
		
		
        if(xmlHttp.responseText)
		{
			
			getid('check_question').innerHTML=xmlHttp.responseText;

		}
     }
	 else
	 {
		getid('check_question').innerHTML='<br></br><p style="text-align:center"><img src="images/lightbox-ico-loading.gif" align="center"></p>';
	 }
}
//--------------------------------------------------------------------------
function page_site(id)
{
	xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null)
    {
		alert ("Browser does not support HTTP Request");
        return;
    }
	url="page/page_site.php";
	 //paramet in text box
      params='id='+(id);

      xmlHttp.onreadystatechange=stateChanged14;

      xmlHttp.open("POST", url, true);

      //Send the proper header information along with the request
      xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      xmlHttp.setRequestHeader("Content-length", params.length);
      xmlHttp.setRequestHeader("Connection", "close");

     xmlHttp.send(params);

}
function stateChanged14()
{
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
     {

        if(xmlHttp.responseText)
		{
			getid('site').innerHTML=xmlHttp.responseText;

		}
     }
	 else
	 {
		getid('site').innerHTML='<br></br><p style="text-align:center"><img src="images/loading.gif" align="center"></p>';
	 }
}
//------------------------------------------------------------------
function filter_site()
{
	xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null)
    {
		alert ("Browser does not support HTTP Request");
        return;
    }
	url="page/filter_site.php";
	 //paramet in text box
      params='special='+(getid('special').value)+'&option='+(getid('option').value);

      xmlHttp.onreadystatechange=stateChanged14;

      xmlHttp.open("POST", url, true);

      //Send the proper header information along with the request
      xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      xmlHttp.setRequestHeader("Content-length", params.length);
      xmlHttp.setRequestHeader("Connection", "close");

     xmlHttp.send(params);

}
//------------------------------------------------------------------
function page_filter_site(id,i,j)
{
	xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null)
    {
		alert ("Browser does not support HTTP Request");
        return;
    }
	url="page/filter_site.php";
	 //paramet in text box
      params='id='+(id)+'&special='+(i)+'&option='+(j);

      xmlHttp.onreadystatechange=stateChanged14;

      xmlHttp.open("POST", url, true);

      //Send the proper header information along with the request
      xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      xmlHttp.setRequestHeader("Content-length", params.length);
      xmlHttp.setRequestHeader("Connection", "close");

     xmlHttp.send(params);

}
//--------------------------------------------------------------------------------
function section(page,id)
{
	xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null)
    {
		alert ("Browser does not support HTTP Request");
        return;
    }
	//alert(id);
	url="page/section.php?id=10";
	//paramet in text box
      params='section='+(id)+'&page='+(page);

      xmlHttp.onreadystatechange=stateChanged5;

      xmlHttp.open("POST", url, true);

      //Send the proper header information along with the request
      xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      xmlHttp.setRequestHeader("Content-length", params.length);
      xmlHttp.setRequestHeader("Connection", "close");

     xmlHttp.send(params);

}
function stateChanged5()
{

    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
     {
		
		
        if(xmlHttp.responseText)
		{
			getid('loading').innerHTML='';
			getid('panel').innerHTML=xmlHttp.responseText;

		}
     }
	 else
	 {
		getid('loading').innerHTML='<p style="text-align:right;font:11px Tahoma">&nbsp;<img src="images/loading2.gif" align="center">&nbsp; در حال بارگزاري. لطفا منتظر بمانيد...</p>';
	 }
}
//------------------------------------------------------------------------------------------------------
function archive(id,page)
{
	xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null)
    {
		alert ("Browser does not support HTTP Request");
        return;
    }
	//alert(id);
	url="page/archive.php";
	//paramet in text box
      params='section='+(id)+'&page='+(page);

      xmlHttp.onreadystatechange=stateChanged1;

      xmlHttp.open("POST", url, true);

      //Send the proper header information along with the request
      xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      xmlHttp.setRequestHeader("Content-length", params.length);
      xmlHttp.setRequestHeader("Connection", "close");

     xmlHttp.send(params);

}
//--------------------------------------------------------------------------
function page_file(id)
{
	xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null)
    {
		alert ("Browser does not support HTTP Request");
        return;
    }
	url="page/page_file.php";
	 //paramet in text box
      params='id='+(id);

      xmlHttp.onreadystatechange=stateChanged14;

      xmlHttp.open("POST", url, true);

      //Send the proper header information along with the request
      xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      xmlHttp.setRequestHeader("Content-length", params.length);
      xmlHttp.setRequestHeader("Connection", "close");

     xmlHttp.send(params);

}
//------------------------------------------------------------------------------------------
function get_file(id,title)
{
	xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null)
    {
		alert ("Browser does not support HTTP Request");
        return;
    }
	
	url="page/get_file.php";
	 //paramet in text box
      params='id='+(id)+'&title='+(title);

      xmlHttp.onreadystatechange=stateChanged14;

      xmlHttp.open("POST", url, true);

      //Send the proper header information along with the request
      xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      xmlHttp.setRequestHeader("Content-length", params.length);
      xmlHttp.setRequestHeader("Connection", "close");

     xmlHttp.send(params);

}
//---------------------------------------------------------------------------------------------
function download_file(id)
{
	xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null)
    {
		alert ("Browser does not support HTTP Request");
        return;
    }
	code=getid('secure').value;
	url="page/download_file.php";
	 //paramet in text box
      params='id='+(id)+'&code='+(code);

      xmlHttp.onreadystatechange=stateChanged16;

      xmlHttp.open("POST", url, true);

      //Send the proper header information along with the request
      xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      xmlHttp.setRequestHeader("Content-length", params.length);
      xmlHttp.setRequestHeader("Connection", "close");

     xmlHttp.send(params);

}
function stateChanged16()
{
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
     {

        if(xmlHttp.responseText)
		{
			if(xmlHttp.responseText==1)
			{
				alert('کد امنیتی وارد شده معتبر نیست');
			}
			else
			{
				document.location=(xmlHttp.responseText);
			}
			

		}
     }
	 else
	 {
		getid('msgbox').innerHTML='<br></br><p style="text-align:center"><img src="images/loading.gif" align="center"></p>';
	 }
}
//----------------------------------------------------------------------------------------------------
function news(id)
{
   

	 var m=30+id;
	 var i=31;
	 while(i<=38)
	 {
		if(i!=m)
		{
			getid(i).style.color='Black';
		}
		i++;
		
	 }
	 getid(m).style.color='#05acff';
	 xmlHttp=GetXmlHttpObject();
      if (xmlHttp==null)
      {
        alert ("Browser does not support HTTP Request");
        return;
      }
	  url='page/news.php';

	
	
      //paramet in text box
      params='id='+(id);

      xmlHttp.onreadystatechange=stateChanged17;

      xmlHttp.open("POST", url, true);

      //Send the proper header information along with the request
      xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      xmlHttp.setRequestHeader("Content-length", params.length);
      xmlHttp.setRequestHeader("Connection", "close");

     xmlHttp.send(params);

}
function stateChanged17()
{
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
     {

        if(xmlHttp.responseText)
		{
			getid('news').innerHTML=xmlHttp.responseText;

		}
     }
	 else
	 {
		getid('news').innerHTML='<br></br><p style="text-align:center"><img src="images/lightbox-ico-loading.gif" align="center"></p>';
	 }
}
//----------------------------------------------------------------------------------------------------
function link(j,num,id)
{
   
	 var m=j;
	 var i=40;
	 while(i<(40+num))
	 {
		if(i!=m)
		{
			getid(i).style.color='Black';
		}
		i++;
		
	 }
	 getid(m).style.color='#05acff';
	 xmlHttp=GetXmlHttpObject();
      if (xmlHttp==null)
      {
        alert ("Browser does not support HTTP Request");
        return;
      }
	  url='page/link.php';

	
	
      //paramet in text box
      params='id='+(id);

      xmlHttp.onreadystatechange=stateChanged18;

      xmlHttp.open("POST", url, true);

      //Send the proper header information along with the request
      xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      xmlHttp.setRequestHeader("Content-length", params.length);
      xmlHttp.setRequestHeader("Connection", "close");

     xmlHttp.send(params);

}
function stateChanged18()
{
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
     {

        if(xmlHttp.responseText)
		{
			getid('links').innerHTML=xmlHttp.responseText;

		}
     }
	 else
	 {
		getid('links').innerHTML='<br></br><p style="text-align:center"><img src="images/lightbox-ico-loading.gif" align="center"></p>';
	 }
}
//--------------------------------------------------------------------------------------------
function idea(id)
{
   
	 if(getid('comment').value)
	 {
	 xmlHttp=GetXmlHttpObject();
      if (xmlHttp==null)
      {
        alert ("Browser does not support HTTP Request");
        return;
      }
	  url='view/save_idea.php';

	
	
      //paramet in text box
      params='id='+(id)+'&name='+(getid('name').value)+'&idea='+(getid('comment').value)+'&email='+(getid('email').value);

      xmlHttp.onreadystatechange=stateChanged19;

      xmlHttp.open("POST", url, true);

      //Send the proper header information along with the request
      xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      xmlHttp.setRequestHeader("Content-length", params.length);
      xmlHttp.setRequestHeader("Connection", "close");

     xmlHttp.send(params);
	 }
	 else
	 {
		alert("متن نظر نمی تواند خالی باشد");
	 }

}
function stateChanged19()
{
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
     {

        if(xmlHttp.responseText)
		{
			getid('idea').innerHTML=xmlHttp.responseText;

		}
     }
	 else
	 {
		getid('idea').innerHTML='<p style="text-align:center"><img src="images/loading.gif" align="center"></p>';
	 }
}
//--------------------------------------------------------------------------------------------
function idea_kandidate(id)
{
   
	 if(getid('comment').value)
	 {
	 xmlHttp=GetXmlHttpObject();
      if (xmlHttp==null)
      {
        alert ("Browser does not support HTTP Request");
        return;
      }
	  url='page/save_idea.php';

	
	
      //paramet in text box
      params='id='+(id)+'&name='+(getid('name').value)+'&idea='+(getid('comment').value);
		
      xmlHttp.onreadystatechange=stateChanged19;

      xmlHttp.open("POST", url, true);

      //Send the proper header information along with the request
      xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      xmlHttp.setRequestHeader("Content-length", params.length);
      xmlHttp.setRequestHeader("Connection", "close");

     xmlHttp.send(params);
	 }
	 else
	 {
		getid('idea').innerHTML='<p style="text-align:center;color:red;font:11px Tahoma">متن دیدگاه یا نظر شما نمی تواند خالی باشد!</p>';
	 }

}
//--------------------------------------------------------------------------------------------
function like(id,user)
{
   
	 if(user!='no')
	 {
	 xmlHttp=GetXmlHttpObject();
      if (xmlHttp==null)
      {
        alert ("Browser does not support HTTP Request");
        return;
      }
	  url='view/like.php';

	
	
      //paramet in text box
      params='id='+(id)+'&user='+(user);

      xmlHttp.onreadystatechange=stateChanged20;

      xmlHttp.open("POST", url, true);

      //Send the proper header information along with the request
      xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      xmlHttp.setRequestHeader("Content-length", params.length);
      xmlHttp.setRequestHeader("Connection", "close");

     xmlHttp.send(params);
	 }
	 else
	 {
		alert("برای استفاده از این قسمت باید عضو سایت باشید و سپس از قسمت ورود اعضا وارد سایت شوید");
	 }

}
function stateChanged20()
{
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
     {

        if(xmlHttp.responseText)
		{
			getid('like').innerHTML=xmlHttp.responseText;

		}
     }
	 else
	 {
		getid('like').innerHTML='<img src="images/loading2.gif" align="center">';
	 }
}
//--------------------------------------------------------------------------------------------
function like_kandidate(id,user)
{

	 xmlHttp=GetXmlHttpObject();
      if (xmlHttp==null)
      {
        alert ("Browser does not support HTTP Request");
        return;
      }
	  url='page/like.php';

	
	
      //paramet in text box
      params='id='+(id)+'&user='+(user);

      xmlHttp.onreadystatechange=stateChanged20;

      xmlHttp.open("POST", url, true);

      //Send the proper header information along with the request
      xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      xmlHttp.setRequestHeader("Content-length", params.length);
      xmlHttp.setRequestHeader("Connection", "close");

     xmlHttp.send(params);


}
//--------------------------------------------------------------------------------------------
function login()
{
	 xmlHttp=GetXmlHttpObject();
      if (xmlHttp==null)
      {
        alert ("Browser does not support HTTP Request");
        return;
      }
	  url='page/form/login.php';

	
	
      //paramet in text box
      params='username='+(getid('username').value)+'&password='+(getid('password').value);

      xmlHttp.onreadystatechange=stateChanged21;

      xmlHttp.open("POST", url, true);

      //Send the proper header information along with the request
      xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      xmlHttp.setRequestHeader("Content-length", params.length);
      xmlHttp.setRequestHeader("Connection", "close");

     xmlHttp.send(params);
	

}
function stateChanged21()
{
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
     {

        if(xmlHttp.responseText)
		{
			if(xmlHttp.responseText=="yes")
			{
				document.location='?page=Reporter';
			}
			else
			{
				getid('msgbox').innerHTML=xmlHttp.responseText;
			}

		}
     }
	 else
	 {
		getid('msgbox').innerHTML='<img src="images/loading2.gif" align="center">';
	 }
}
//--------------------------------------------------------------------------------------------
function logout()
{
	 xmlHttp=GetXmlHttpObject();
      if (xmlHttp==null)
      {
        alert ("Browser does not support HTTP Request");
        return;
      }
	  url='page/form/logout.php';

	
	
      //paramet in text box
      params='id='+('1');

      xmlHttp.onreadystatechange=stateChanged22;

      xmlHttp.open("POST", url, true);

      //Send the proper header information along with the request
      xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      xmlHttp.setRequestHeader("Content-length", params.length);
      xmlHttp.setRequestHeader("Connection", "close");

     xmlHttp.send(params);
	

}
function stateChanged22()
{
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
     {

        if(xmlHttp.responseText)
		{
			if(xmlHttp.responseText=="yes")
			{
				document.location='?page=Reporter';
			}

		}
     }
	
}
//--------------------------------------------------------------------------------------------
function form_reporter()
{
	 xmlHttp=GetXmlHttpObject();
      if (xmlHttp==null)
      {
        alert ("Browser does not support HTTP Request");
        return;
      }
	  url='page/form/form_reporter.php';

	
	
      //paramet in text box
      params='id='+('1');

      xmlHttp.onreadystatechange=stateChanged23;

      xmlHttp.open("POST", url, true);

      //Send the proper header information along with the request
      xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      xmlHttp.setRequestHeader("Content-length", params.length);
      xmlHttp.setRequestHeader("Connection", "close");

     xmlHttp.send(params);
	

}
//-------------------------------------------------------------------

function stateChanged23()
{
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
     {

        if(xmlHttp.responseText)
		{
		
			getid('action').innerHTML=xmlHttp.responseText;

		}
     }
	 else
	 {
		getid('action').innerHTML='<div style="text-align:center;font:11px Tahoma">&nbsp;<img src="images/loading.gif" align="center"></div>';
	 }
}
//---------------------------------------------------------------------------------------------
function save_reporter(id)
{
	 xmlHttp=GetXmlHttpObject();
      if (xmlHttp==null)
      {
        alert ("Browser does not support HTTP Request");
        return;
      }
	  url='page/form/save_reporter.php';

		
	
      //paramet in text box
      params='email='+(getid('email').value)+'&id='+(id)+'&name='+(getid('name').value)+'&username='+(getid('user').value)+'&secure='+(getid('secure').value)+'&password='+(getid('pass').value)+'&rep_password='+(getid('rep_password').value);

      xmlHttp.onreadystatechange=stateChanged25;

      xmlHttp.open("POST", url, true);

      //Send the proper header information along with the request
      xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      xmlHttp.setRequestHeader("Content-length", params.length);
      xmlHttp.setRequestHeader("Connection", "close");

     xmlHttp.send(params);
	

}
//-------------------------------------------------------------------

function stateChanged25()
{
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
     {

        if(xmlHttp.responseText)
		{
		
			getid('check_register').innerHTML=xmlHttp.responseText;

		}
     }
	 else
	 {
		getid('check_register').innerHTML='<div style="text-align:center;font:11px Tahoma">&nbsp;<img src="images/loading.gif" align="center"></div>';
	 }
}
//---------------------------------------------------------------------------------------------
function reporter(id)
{
	 var i=1;
	 while(i<=4)
	 {
		if(i!=id)
		{
			getid(i).style.color='black';
		}
		i++;
		
	 }
	 getid(id).style.color='#EA5503';
	 
	xmlHttp=GetXmlHttpObject();
      if (xmlHttp==null)
      {
        alert ("Browser does not support HTTP Request");
        return;
      }
	  url='page/reporter_action.php';

		
	
      //paramet in text box
      params='id='+(id);

      xmlHttp.onreadystatechange=stateChanged26;

      xmlHttp.open("POST", url, true);

      //Send the proper header information along with the request
      xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      xmlHttp.setRequestHeader("Content-length", params.length);
      xmlHttp.setRequestHeader("Connection", "close");

     xmlHttp.send(params);
	

}
//-------------------------------------------------------------------

function stateChanged26()
{
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
     {

        if(xmlHttp.responseText)
		{
		
			getid('reporter').innerHTML=xmlHttp.responseText;

		}
     }
	 else
	 {
		getid('reporter').innerHTML='<div style="text-align:center;font:11px Tahoma">&nbsp;<img src="images/loading.gif" align="center"></div>';
	 }
}
//---------------------------------------------------------------------------------------------
function save_poll(id,type,num)
{
	
	var choice;
	
	xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null)
    {
        alert ("Browser does not support HTTP Request");
        return;
    }
	if(type==1)
	{
		var test = document.getElementsByName('c');
		for (var k=0; k<test.length;k++)
		{
			if (test[k].checked)
			{
				var cs= test[k].value;
			}
		}
	}
	if(type==2)
	{
		var cs;
		for (var k=1; k<=num;k++)
		{
			if(getid(k).checked)
			{
				choice=choice+'&c'+k+'=1';
				cs=true;
			}
			else
			{
				choice=choice+'&c'+k+'=0';
			}
		}
		
	}
	  
	if(cs)
	{	
		url='page/save_poll.php';

		
	
		//paramet in text box
		params='id='+(id)+'&c='+(cs)+'&type='+(type)+'&num='+(num);
		if(type==2)
		{
			params+=choice;
		}
			
      xmlHttp.onreadystatechange=stateChanged27;

      xmlHttp.open("POST", url, true);

      //Send the proper header information along with the request
      xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      xmlHttp.setRequestHeader("Content-length", params.length);
      xmlHttp.setRequestHeader("Connection", "close");

     xmlHttp.send(params);
	}
	else
	{
		alert('هیچ گزینه ای انتخاب نشده است');
	}

}

function stateChanged27()
{
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
     {

        if(xmlHttp.responseText)
		{
		
			getid('poll').innerHTML=xmlHttp.responseText;

		}
     }
	 else
	 {
		getid('poll').innerHTML='<div style="text-align:center;font:11px Tahoma">&nbsp;<img src="images/loading.gif" align="center"></div>';
	 }
}
//---------------------------------------------------------------------------------------------
function result_poll(id)
{
	
	var choice;
	
	xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null)
    {
        alert ("Browser does not support HTTP Request");
        return;
    }

		url='page/result_poll.php';

		
	
		//paramet in text box
		params='id='+(id);
		
			
      xmlHttp.onreadystatechange=stateChanged27;

      xmlHttp.open("POST", url, true);

      //Send the proper header information along with the request
      xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      xmlHttp.setRequestHeader("Content-length", params.length);
      xmlHttp.setRequestHeader("Connection", "close");

     xmlHttp.send(params);
	

}





