var xmlHttp
var objj

function showHint(add,obj){

  if (add == 'sec-main.php') document.title='[ faronline.ir: Farshad Akbari\'s Website | صفحه اصلي ]';  
  else if (add == 'sec-newsarchive.php') document.title='[ faronline.ir: Farshad Akbari\'s Website | آرشيو رويدادها ]';
  else if (add == 'sec-search.php') document.title='[ faronline.ir: Farshad Akbari\'s Website | نتايج جستجو ]';
  else if (add == 'sec-contact.php') document.title='[ faronline.ir: Farshad Akbari\'s Website | تماس با من ]';  
  else if (add == 'sec-pub.php') document.title='[ faronline.ir: Farshad Akbari\'s Website | مقالات منتشره ]';  
  else if (add == 'sec-exp.php') document.title='[ faronline.ir: Farshad Akbari\'s Website | سوابق و تجارب ]';  
  else if (add == 'sec-prof.php') document.title='[ faronline.ir: Farshad Akbari\'s Website | تخصصها ]';  
  else if (add == 'sec-cv.php') document.title='[ faronline.ir: Farshad Akbari\'s Website | (CV) رزومه ]';  
  else if (add.substr(0,12) == 'sec-news.php') document.title='[ faronline.ir: Farshad Akbari\'s Website | نمايش رويداد ]';

	

  
  objj=obj;
  xmlHttp=GetXmlHttpObject();
  if (xmlHttp==null)  { 
       alert ("پشتيباني نمي كند HTTP Request مرورگر شما از");
    return ;
  } 
  var url=add;  
  if ( url.substr(0,22) == 'include/unameavail.php' )
      xmlHttp.onreadystatechange=idstateChanged ;
  else
      xmlHttp.onreadystatechange=stateChanged ;	  
	  
  xmlHttp.open("GET",url,true);
  xmlHttp.send(null);  
}
//********************
function stateChanged()
{ 
  if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
  { 
     // if server HTTP response is "OK"

     if(xmlHttp.status == 200) {
        document.getElementById(objj).innerHTML=xmlHttp.responseText;
     } else {
       // issue an error message for any other HTTP response
	   if (xmlHttp.status==12029) 
	      document.getElementById(objj).innerHTML='<div align="center" ><br><font dir="rtl" size="1" color="#ab0a0a" face="Tahoma">دسترسي به سرور به دليل قطع ارتباط ميسر نيست.</font></div>';
	   else
		  document.getElementById(objj).innerHTML='<div align="center" ><br><font dir="rtl" size="1" color="#ab0a0a" face="Tahoma">خطاي شماره '+xmlHttp.status +'، پيغام: '+xmlHttp.statusText+'</font></div>';
	  }  
  }
  else{
        my_wait='<div id="siteLoader" style="background-color:#d11e1e; color:#FFFFFF;position:absolute; left:89%; top:0px; margin-left:0px; margin-top:0px; padding:0px 0px 0px; width:110px"><div id="loadImg"><div align="center" style="direction:rtl; font-size:10px">&nbsp;<img src="images/progress.gif" align="middle" /> در حال فراخواني...</div></div></div>';
	   document.getElementById(objj).innerHTML='&nbsp;'+my_wait;


  }
} 
//********************
function idstateChanged()
{ 
  if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
  { 
     // if server HTTP response is "OK"

     if(xmlHttp.status == 200) {
        document.getElementById(objj).innerHTML=xmlHttp.responseText;
     } else {
       // issue an error message for any other HTTP response
	   if (xmlHttp.status==12029) 
	      document.getElementById(objj).innerHTML='<span align="right"><font dir="rtl" size="1" color="#ab0a0a" face="Tahoma">ارتباط با سرور قطع است!</font></span>';
	   else
		  document.getElementById(objj).innerHTML='<span align="right" ><font dir="rtl" size="1" color="#ab0a0a" face="Tahoma">خطاي:'+xmlHttp.status +'، پيغام:'+xmlHttp.statusText+'</font></span>';
	  }  
  }
  else{
	   document.getElementById(objj).innerHTML='<img align="absmiddle" src="images/loading.gif" width="15" height="15" border="0">';
  }
} 
//********************

function GetXmlHttpObject()
{ 
var objXMLHttp=null
if (window.XMLHttpRequest)
{
objXMLHttp=new XMLHttpRequest()
}
else if (window.ActiveXObject)
{
objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
}
return objXMLHttp
}
//********************

function do_contact(add,obj){
  objj=obj;
  xmlHttp=GetXmlHttpObject();
  if (xmlHttp==null)  { 
       alert ("پشتيباني نمي كند HTTP Request مرورگر شما از");
    return ;
  } 
  var url=add;
  g_name=document.getElementById('name').value;
  g_email=document.getElementById('email').value;
  g_student=document.getElementById('student').value;
  g_title=document.getElementById('title').value;
  g_degree=document.getElementById('degree').value;
  g_text=document.getElementById('text').value;

  var poststring = "name="+g_name+"&email="+g_email+"&student="+g_student+"&title="+g_title+"&degree="+g_degree+"&degree="+g_degree+"&text="+g_text;
  xmlHttp.onreadystatechange=stateChanged ;
  xmlHttp.open("POST",url,true);
  xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  xmlHttp.setRequestHeader("Content-length", poststring.length);
  xmlHttp.send(poststring);
}



