function gohome() {
    // alert(opener.length);
    //if (opener != null && opener != 'undefined' && opener.location.href.indexOf('goaupair.com')>=0)
    if (window.location.href.indexOf('time=') > 0) {//alert(opener.location.href);
        window.close();
    }
    else { window.location.href = 'apavailable.aspx'; }
}
function learnmore() {
    if (window.location.href.indexOf('time=') > 0) 
       
       { opener.location.href = 'apavailable.aspx?showid=3';
        window.close();
    }
    else { window.location.href = 'apavailable.aspx?showid=3'; }
}

function getCookie(c_name)
{
 if (document.cookie.length>0)
  {
    c_start=document.cookie.indexOf(c_name + "=");
    if (c_start!=-1)
        { 
            c_start=c_start + c_name.length+1; 
            c_end=document.cookie.indexOf(";",c_start);
            if (c_end==-1) c_end=document.cookie.length;
            return unescape(document.cookie.substring(c_start,c_end));
           
        } 
  }
   return "";

 }

function setCookie(c_name,value,expiredays)
{
    var exdate=new Date();
    exdate.setDate(exdate.getDate()+expiredays);
    document.cookie=c_name+ "=" +escape(value)+
    ((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
  
}

function oitdap(a,b)
{
window.open('http://www.goaupair.com/InterestAP.html?apn='+a +'&aid='+b);
}
function popD(c,n)
 {
     window.open('APDetails.aspx?APID=' + c + '&apn=' + n + '&time=' + new Date(), '', 'width=940,height=690,menubar=no,status=no,location=yes,toolbar=no,scrollbars=yes');
   }

//{
//window.open('APDetails.aspx?APID='+c + '&time='+new Date());
////,'AP Preview');
////,'width=660,height=680,menubar=no,status=no,location=yes,toolbar=no,scrollbars=yes');
////var result = window.showModalDialog('APDetails.aspx?APID='+c + '&time='+new Date() +'#top',"ShowDetail","dialogWidth=660px;dialogHeight=680px;scroll:auto;");
////    if(result){
////        location.href="newapavailable.aspx";
////    }
//  setCookie('APID',c,1); //alert(c);

//}
function popwin(a,b)
{
window.open(a+b);
}
function imgu(u)
{

}

function show(n)
{
 if (n==null || n=='undefined' || n=='')
 {
  n=getCookie('showid');
 }
 setCookie('showid',n,2);

 showoff();
  if(n=='1')
  {document.getElementById('images').style.display='block';
  document.getElementById('td1').style.backgroundColor= "#3771b6";//7d96f3";
  document.getElementById('tran1').style.backgroundImage='url("images/tran-blue30-42.gif")'; 
  }
  else if(n=='2')
  {document.getElementById('div2').style.display='block';
  document.getElementById('td2').style.backgroundColor= "#3771b6";//7d96f3";
  document.getElementById('tran2').style.backgroundImage='url("images/tran-blue30-42.gif")';}
  else if(n=='3')
  {document.getElementById('div3').style.display='block';
  document.getElementById('td3').style.backgroundColor= "#3771b6";
  document.getElementById('tran3').style.backgroundImage='url("images/tran-blue30-42.gif")';}
  else if(n=='4')
  {document.getElementById('div4').style.display='block';
  document.getElementById('td4').style.backgroundColor= "#3771b6";
  document.getElementById('tran4').style.backgroundImage='url("images/tran-blue30-42.gif")';}
  else {document.getElementById('images').style.display='block';
  document.getElementById('td1').style.backgroundColor= "#3771b6";
  document.getElementById('tran1').style.backgroundImage='url("images/tran-blue30-42.gif")';}
}
function showoff()
{
document.getElementById('images').style.display='none';
document.getElementById('div2').style.display='none';
document.getElementById('div3').style.display='none';
document.getElementById('div4').style.display='none';
    for(var i=1;i<5;i++)
    {//alert('td'+i);
     document.getElementById('td'+i).style.backgroundColor= "#a6c9e7";
     document.getElementById('tran'+i).style.backgroundImage='url("images/tran-blue30.gif")';
    }
   
}

function showgrid(m)
{
     if (m==null || m=='undefined' || m=='')
     {
      m=0;//getCookie('gridid');
     }

     for(var i=0;i<5;i++)
     {
     var dgi=document.getElementById('DataGrid'+i);
     if(dgi!=null)
     {dgi.style.display='none';}
     document.getElementById('pg'+i).className='pgst';
     document.getElementById('sp'+i).className='pgst';
     }
 var dgim=document.getElementById('DataGrid'+m);
 if(dgim!=null)
{dgim.style.display='block';}
 document.getElementById('pg'+m).className='pgtxt';
 document.getElementById('sp'+m).className='pgtxt';
}
function ShowDetail(type){
    var result = window.showModalDialog('ShowDetail.aspx?type=' + type + '&time='+new Date() +'#top',"ShowDetail","dialogWidth=660px;dialogHeight=640px;scroll:no;");
    if(result){
        location.href="Search.aspx";
    }
}
function disppg()
{
    var pg=document.getElementById('hpg').value;
    for(var i=5;i>=pg;i--)
    {
    var pgi= document.getElementById('pg'+i);
    if(pgi!=null)
    {pgi.style.display='none';}
    var pgs= document.getElementById('sp'+i);
    if(pgs!=null)
    {pgs.style.display='none';}
   }
}