﻿ var xmlHttp;
//==========================================================================================
function GetXmlHttpObject()
		{ 
			var objXMLHttp=null
			if (window.XMLHttpRequest)
			    {
			 	    objXMLHttp=new XMLHttpRequest()
			 	 }
			else if (window.ActiveXObject)
				{
				  objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
				}
			return objXMLHttp
		} 
//==========================================================================================
function Get_Page_Info(Mid,Sid)
    {
      window.scrollTo(0,0)
      if (document.getElementById("PageInfo"))
          document.getElementById("PageInfo").style.visibility = "hidden";
      if (document.getElementById("ResPage"))
          document.getElementById("ResPage").style.visibility = "hidden";
      if (document.getElementById("TopResPage"))
          document.getElementById("TopResPage").style.visibility = "hidden";
	 document.getElementById("LoadingPanel").style.visibility="visible"
      xmlHttp=GetXmlHttpObject() // Check For Support AJAX Technology
	  if (xmlHttp==null)
				{
				   alert ("Browser does not support HTTP Request")
				   return
				}
		url = BaseURL
	    url = url + "GetPageInfo.asp?Id="+ Mid+"&Sid="+Sid
	    xmlHttp.onreadystatechange=Show_Page_Info
	    xmlHttp.open("GET",url,true)
	    xmlHttp.send(null)
   }
//===============================================================================================
function Show_Page_Info() 
		{  
		
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		   { 
		      
			  str = new String(xmlHttp.responseText)
			  i = str.indexOf("<RAK-Title>",0)
			  if (i > 1) 
			     { 
			        tit = str.substring(0,i) 
			        document.title = tit
              	  }
              str = str.substring(i+12,str.length)
              i = str.indexOf("<RAK-FileName>",0)
              if ( i > 2)
                {
                   FileName = str.substring(0,i)
                }
              str = str.substring(i+15,str.length)
			  document.getElementById("PageInfo").innerHTML=str
		      document.getElementById("LoadingPanel").style.visibility="hidden"
    	  if (document.getElementById("PageInfo"))
     		     document.getElementById("PageInfo").style.visibility = "visible";
    	  if (document.getElementById("ResPage"))
   		       document.getElementById("ResPage").style.visibility = "visible";
   		   if (document.getElementById("TopResPage"))
   		       document.getElementById("TopResPage").style.visibility = "visible";		      
		      if ( i > 3)
                {
                     GotoPage(FileName,"ResPage")
                }
			       
	       } 
		} 
//================================================================================================
function Get_OtherPage_Info(Mid)
    {
     window.scrollTo(0,0)
      if (document.getElementById("PageInfo"))
          document.getElementById("PageInfo").style.visibility = "hidden";
      if (document.getElementById("ResPage"))
          document.getElementById("ResPage").style.visibility = "hidden";
      if (document.getElementById("TopResPage"))
          document.getElementById("TopResPage").style.visibility = "hidden";

      document.getElementById("LoadingPanel").style.visibility="visible";
      xmlHttp=GetXmlHttpObject() // Check For Support AJAX Technology
	  if (xmlHttp==null)
				{
				   alert ("Browser does not support HTTP Request")
				   return
				}
		url = BaseURL
	    url = url + "GetOtherPageInfo.asp?Id="+ Mid
	    xmlHttp.onreadystatechange=Show_OtherPage_Info
	    xmlHttp.open("GET",url,true)
	    xmlHttp.send(null)
   }
//===============================================================================================
function Show_OtherPage_Info() 
		{  
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		   { 
			  str = new String(xmlHttp.responseText)
		      document.getElementById("PageInfo").innerHTML=str
		      document.getElementById("LoadingPanel").style.visibility="hidden"
    	  if (document.getElementById("PageInfo"))
     		     document.getElementById("PageInfo").style.visibility = "visible";
    	  if (document.getElementById("ResPage"))
   		       document.getElementById("ResPage").style.visibility = "visible";
   		   if (document.getElementById("TopResPage"))
   		       document.getElementById("TopResPage").style.visibility = "visible";
		    } 
		} 
//===============================================================================================
function CheckUserPass()
    {
      xmlHttp=GetXmlHttpObject() // Check For Support AJAX Technology
	  if (xmlHttp==null)
				{
				   alert ("Browser does not support HTTP Request")
				   return
				}
		url = BaseURL
	    url = url + "CheckUserPass.asp?Un="+ document.LoginForm.TxtUn.value + "&Pw="+document.LoginForm.TxtPass.value
	    xmlHttp.onreadystatechange=CheckUserPassword
	    xmlHttp.open("GET",url,true)
	    xmlHttp.setRequestHeader("If-Modified-Since","Sat, 1 Jan 2000 00:00:00 GMT");
	    xmlHttp.send(null)
   }
//===============================================================================================
function CheckUserPassword() 
		{  
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		   { 
			  str = new String(xmlHttp.responseText)
			  if (str==1) 
			      {
			        document.LoginForm.B1.value = "اطلاعات صحیح است .."
			        document.location = "webmaster/webmaster.asp"
			      }
			   else
			      {
			        document.LoginForm.TxtUn.value = "Error....";
			        document.LoginForm.TxtPass.value = "";
  			        document.LoginForm.B1.value = "   ارســــــال   "
  			      }
		    } 
		} 
//================================================================================================
function MM_openBrWindow(theURL,winName,features) 
    { //v2.0
        window.open(theURL,winName,features);
   }
//==========================================================================================
function GotoPage(FN,Panel)
    {	 
     window.scrollTo(0,0)
     //if (document.getElementById(Panel)(
        document.getElementById(Panel).style.visibility = "hidden";
     document.getElementById("LoadingPanel").style.visibility="visible"
     xmlHttp=GetXmlHttpObject() // Check For Support AJAX Technology
	  if (xmlHttp==null)
				{
				   alert ("Browser does not support HTTP Request")
				   return
				}
		url = BaseURL
	    url = url + FN
	    //alert(url)
	    PanelName = Panel
	    xmlHttp.onreadystatechange=ShowPage
	    xmlHttp.open("GET",url,true)
	    xmlHttp.send(null)
 
   }
//===============================================================================================
function ShowPage() 
		{  
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		   { 
			  str = new String(xmlHttp.responseText)
		      document.getElementById(PanelName).innerHTML=str
			  document.getElementById("LoadingPanel").style.visibility="hidden"
		      document.getElementById(PanelName).style.visibility="visible"
	       } 
		} 
//===============================================================================================
function HighLightMenu(id) 
		{
		  
		  if(document.getElementById(Preid))
		      if(document.getElementById(Preid).className != "DPPicMenu")
	  		               document.getElementById(Preid).className = "DPMenu"
          if(document.getElementById(id)) 
             if(document.getElementById(id).className != "DPPicMenu")
		             document.getElementById(id).className = "DPMenuOn"
		  Preid  = id  
           S = "Sub"+id
		   if (document.getElementById(S))
		       document.getElementById(S).style.visibility="hidden"
		}
//================================================================================================
function HideSubMenu(id) 
		{
		  if (document.getElementById(id))
		       document.getElementById(id).style.visibility="hidden"
		}
//================================================================================================
function MouseOnMenu(id) 
		{
		   if(document.getElementById(Preid)) 
              if(document.getElementById(Preid).className != "DPPicMenu")
                  {
                    if(document.getElementById(Preid).className == "DPMenu_SubMenuOn")
  	                   document.getElementById(Preid).className = "DPMenu_SubMenu"
  	                if(document.getElementById(Preid).className == "DPMenuOn")
  	                   document.getElementById(Preid).className = "DPMenu"
                   }
  	              		
		   S = "Sub"+Preid
		   if (document.getElementById(S))
		       document.getElementById(S).style.visibility="Hidden"	   
		                
		   if(document.getElementById(id)) 
              if(document.getElementById(id).className != "DPPicMenu")
		           {
                    if(document.getElementById(id).className == "DPMenu_SubMenu")
  	                   document.getElementById(id).className = "DPMenu_SubMenuOn"
  	                if(document.getElementById(id).className == "DPMenu")
  	                   document.getElementById(id).className = "DPMenuOn"
                   }
		   S = "Sub"+id
		   if (document.getElementById(S))
		       document.getElementById(S).style.visibility="visible"	       
		       
		   Preid = id
      	}
//================================================================================================
function MouseOutMenu(id) 
		{
		  if (id != Preid) 
		    if(document.getElementById(id))
		       {
		         document.getElementById(id).className = "DPMenu"
		         return
		       }
   		}
//================================================================================================
function HideAll(id) 
		{
           S = "Sub"+id
		   if (document.getElementById(S))
		       document.getElementById(S).style.visibility="Hidden"		  

		}
//================================================================================================
function SendMail() 
        { 
           
           a = document.tamas.TXName.value
           b = document.tamas.TXEmail.value
           c = document.tamas.TxMail.value
           if (c=="") 
               return false
           GotoPage("Send_mail.asp?TxName="+a+"&TxEmail="+b+"&TxMail="+c,'TopResPage')
		}
//================================================================================================

