var xmlHttp,xmlHttp2
var ckfl;
function lop(ckflg)
{ 
var faqid=document.getElementById("faqidsearch").value;
var setext=document.getElementById("setext").value;
xmlHttp2=GetXmlHttpObject()
if (xmlHttp2==null)
 {
 alert ("Browser does not support Ajax!")
 return
 }
if (ckflg=="1") 
{ 
var url3="searchfaq.php"
url3=url3+"?faqid="+faqid
}
if(ckflg=="2")
{
var url3="faqsearch.php"
url3=url3+"?setext="+setext
}
if(ckflg=="3")
{
var url3="savefaq.php"
url3=url3+"?soal="+document.getElementById("soal").value;

}
url3=encodeURI(url3);  
ckfl=ckflg;
xmlHttp2.onreadystatechange=seastateChanged
xmlHttp2.open("GET",url3,true)
xmlHttp2.send(null)                

} 
function seastateChanged() 
{ 
    if (xmlHttp2.readyState==4  || xmlHttp2.readyState=="complete")
    { 
    if(ckfl=="1") document.getElementById("sefaqre").innerHTML=xmlHttp2.responseText;
    if(ckfl=="2")
    document.getElementById("sefaqre2").innerHTML=xmlHttp2.responseText;
     if(ckfl=="3")
     {
    document.getElementById("faqidreply").innerHTML=xmlHttp2.responseText;
     }
    }
}
function shownext(cell)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support Ajax!")
 return
 }
var url="galajax.php"
url=url+"?cell="+cell
xmlHttp.onreadystatechange=galstateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}


function galstateChanged() 
{ 
    if (xmlHttp.readyState==4  || xmlHttp.readyState=="complete")
 { 
     document.getElementById('wait').style.visibility="hidden" 
     document.getElementById("result").innerHTML=xmlHttp.responseText
     varWidth=document.getElementById('varW').value
     varHeight=document.getElementById('varH').value
     Pic_Name=document.getElementById('Pic_Nam').value
     varCheck=document.getElementById('varChk').value
     document.getElementById('width1').innerHTML=document.getElementById('varW1').value
     document.getElementById('height1').innerHTML=document.getElementById('varH1').value
     document.getElementById('cat').innerHTML=document.getElementById('fa_cat').value
     document.getElementById('ttl').innerHTML=document.getElementById('fa_ttl').value
     if (parseInt(document.getElementById('tedad').value) > 1)
        document.getElementById('next').style.display='block'
     else
        document.getElementById('next').style.display='none'
     if (parseInt(document.getElementById('cell').value) > 0)
        document.getElementById('pre').style.display='block'
     else
        document.getElementById('pre').style.display='none'
     document.getElementById('imageHolder').innerHTML= '<a href="'+Pic_Name+'" target="_blank"><img GALLERYIMG="no" id="image" src="'+Pic_Name+'" '+((varCheck==2)?'height="'+varHeight+'"':'width="'+varWidth+'"')+ 'onmouseover="FadeIn(0,1)" onmouseout="FadeIn(20,-1)" style="margin:5px" /></a>'; 
     
 }
    else
        document.getElementById('wait').style.visibility="visible"
}

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 nex()
        {
         
        fb=document.getElementById('image');  
        fr=document.getElementById('cell'); 
        fr.value=parseInt(fr.value)+1; 
       shownext(fr.value);
        }
    function pre()
        { 
        fb=document.getElementById('image');   
        document.getElementById('cell').value=parseInt(document.getElementById('cell').value)-1; 
        shownext(fr.value);
        } 
  function  ChangeOpac(opac)
        {
    ft=document.getElementById("divin");
    ft.style.height=opac+"px";
    if (opac==19)
        document.getElementById('showin').style.display="block"; 
        
    else
        document.getElementById('showin').style.display="none"; 
        }
    function FadeIn(t,j)
        { 
        fg=document.getElementById('showin'); 
        fg.style.display="none";
        for (i=0;i<=19;i++)
            {
            t=t+j;
            timer=setTimeout("ChangeOpac("+t+")",i*20);   
            } 
        clearTimeout(timer);        
        }
