var slog=1;
var nlid=0;

window.onload=function() {
  stdel=getCookie('StartDelay');
  tofs=0;
  if (stdel==1) tofs=2000;
//  alert(parent.document.getElementById("frs").rows);
  if (parent.document.getElementById("frs").rows!='0,*') {
    for (i=0;i<=2000;i=i+20) {
      window.setTimeout('parent.document.getElementById("frs").rows=\''+(2000-i)+',*\';',tofs+i/2);
    }
    for (i=0;i<=50;i=i+10) {
      window.setTimeout('parent.document.getElementById("frs").rows=\''+(i)+',*\';',tofs+i*3+1000);
    }
    for (i=0;i<=50;i=i+10) {
      window.setTimeout('parent.document.getElementById("frs").rows=\''+(50-i)+',*\';',tofs+i*3+1200);
    }
  }
  el=document.getElementById("marjar");
  if (el) {
    window.setTimeout('document.getElementById("marjar").src=\'pic/Bence.Mate.HidePhotography.com.markusjari1.jpg\';', 9000);
    window.setTimeout('document.getElementById("marjar").src=\'pic/Bence.Mate.HidePhotography.com.markusjari3.jpg\';', 9400);
    window.setTimeout('document.getElementById("marjar").src=\'pic/Bence.Mate.HidePhotography.com.markusjari2.jpg\';', 9800);
    window.setTimeout('document.getElementById("marjar").src=\'pic/Bence.Mate.HidePhotography.com.markusjari0.jpg\';',10200);
  }
  di=document.getElementById('IMGCONT');
  if (di) {
    di.style.background='url('+document.getElementById('MIDIMG').src+')';
    slog=Math.floor(Math.random()*4)+1;
    window.setTimeout('ch_slog(slog);',8000);
  }
}

function ch_slog(i) {
  slog=i+1;
  if (slog>4) slog=1;
  geturl('getpage.php?pg=slogen&sn='+i);
}

function geturl(url) {
  try { xmlHttp=new XMLHttpRequest(); }
  catch(e) {
    try { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); }
    catch(e) {
      alert ("Your browser does not support XMLHTTP!"); return; }
  }
  xmlHttp.onreadystatechange=state_Change; xmlHttp.open("GET",url,true); xmlHttp.send(null);
}

function state_Change() {
//alert('state_Change state: '+xmlHttp.readyState+', status: '+xmlHttp.status);
  if (xmlHttp.readyState==4) {// 4 = "loaded"
    if (xmlHttp.status==200) {// 200 = OK
      txt=xmlHttp.responseText;
      di=document.getElementById('IMGSLOG');
      coba=document.getElementById('IMGCONT').style.background;
      if (di) {
        di.innerHTML=txt;
        con=document.getElementById('IMGCONT');
        con.style.background=coba;
        im=document.getElementById('MIDIMG');
        im.myOp=0; setOpacity(im);
        window.setTimeout('ch_slog(slog);',8000);
        fade();
      }
    } else {
      alert("Problem retrieving XML data");
    }
  }
}

function fade() {
  im=document.getElementById('MIDIMG');
  im.myOp+=0.05;
  if(im.myOp>=1) {
    im.myOp = 1;
    di=document.getElementById('IMGCONT');
    di.style.background='url('+im.src+')';
  }
  setOpacity(im);
  if(im.myOp<1) setTimeout(fade,50); else im.myOp=0;
}

function setOpacity(obj) {
  obj.style.opacity = obj.myOp;
  obj.style.MozOpacity = obj.myOp;
  obj.style.filter = "alpha(opacity=" + (obj.myOp*100) + ")";
}

function refreshbar(id) {
  nlid=id;
  geturl2('getmailsent.php?nlid='+nlid);
}

function geturl2(url) {
  try { xmlHttp=new XMLHttpRequest(); }
  catch(e) {
    try { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); }
    catch(e) {
      alert ("Your browser does not support XMLHTTP!"); return; }
  }
  xmlHttp.onreadystatechange=state_Change2; xmlHttp.open("GET",url,true); xmlHttp.send(null);
}

function state_Change2() {
//alert('state_Change state: '+xmlHttp.readyState+', status: '+xmlHttp.status);
  if (xmlHttp.readyState==4) {// 4 = "loaded"
    if (xmlHttp.status==200) {// 200 = OK
      txt=xmlHttp.responseText;
      if (document.getElementById('sendmailbar')) {
        document.getElementById('sendmailbar').innerHTML=txt;
        window.setTimeout('refreshbar(nlid);',5000);
      }
    } else {
      alert("Problem retrieving XML data");
    }
  }
}


function sho( pFileName, pWidth, pHeight ,pTitle ) {
  filename=pFileName.split("/").pop();
  ofsx=(screen.width-pWidth)/2; ofsy=(screen.height-pHeight)/4;
  Win=window.open( "", "_blank", "width="+ pWidth+ ",height="+pHeight+",status=no,scrollbars=no,menubar=no,resizable=no,screenX="+ofsx+",screenY="+ofsy+",left="+ofsx+",top="+ofsy);
  Win.document.write('<html><head><title>'+pTitle+'</title></head>');
  Win.document.title=pTitle;
  Win.document.write('<body topmargin="0" leftmargin="0" text="#FFFFFF" background="'+'pic/'+filename + '" style="background-repeat: no-repeat" onclick="self.close()" onblur="self.close()">');
  Win.document.write('<table border="0" width="100%" height="100%" cellspacing="5" cellpadding="0">');
  Win.document.write('<tr><td width="100%" valign="bottom" align="center"><b><i>');
  if (document.title.substring(0,6)=="Gambia") Win.document.write('(C) Pelican, 2001');
  else if (document.title.substring(0,5)=="Costa") Win.document.write('(C) Pelican, 2003');
  else if (filename.substring(0,4)=="RTWB") Win.document.write('(C) Len Bolle, 2003');
  else if (filename.substring(0,4)=="RTWJ") Win.document.write('(C) Jutka Bartalis, 2003');
  else if (filename.substring(0,4)=="HIV_") Win.document.write('(C) Hivekovics Ákos');
  else if (filename.substring(0,4)=="IMO_") Win.document.write('(C) Olasz Csaba');
  else if (document.title!="Film" && document.title!="Top secret") Win.document.write('(C) Pelican');
  Win.document.write('</b></i></td></tr></table>');
  Win.document.write('</body></html>');
  Win.document.show;
  Win.document.close();
  if (navigator.appName.substring(0,8) == "Netscape") Win.focus();
}

function show( pFileName, pWidth, pHeight ,pTitle ) {
  ofsx=(screen.width-pWidth)/2; ofsy=(screen.height-pHeight)/4;
  Win = window.open( "", "_blank", "width="+ pWidth+ ",height="+pHeight+",status=no,scrollbars=no,menubar=no,resizable=no,screenX="+ofsx+",screenY="+ofsy+",left="+ofsx+",top="+ofsy);
  Win.document.write('<html><head><title>'+pTitle+'</title></head>');
  Win.document.title=pTitle;
  Win.document.write('<body topmargin="0" leftmargin="0" text="#FFFFFF" background="'+ pFileName + '" style="background-repeat: no-repeat">');
  Win.document.write('<table border="0" width="100%" height="100%" cellspacing="5" cellpadding="0">');
  Win.document.write('<tr><td width="100%" valign="bottom" align="center"><b><i>');
  if (document.title.substring(0,6)=="Gambia") Win.document.write('(C) Pelican, 2001');
  else if (document.title.substring(0,5)=="Costa") Win.document.write('(C) Pelican, 2003');
  else if (document.title!="Film") Win.document.write('(C) Pelican, 1999-2003');
  Win.document.write('</b></i></td></tr></table>');
  Win.document.write('</body></html>');
  Win.document.show;
  Win.document.close();
  if (navigator.appName.substring(0,8) == "Netscape") Win.focus();
}
function init() {
//  if (parent.location==self.location) self.location='http://'+self.location.hostname;
//  if (self.location=='localhost') self.location='localhost/hideph01/public_html/';
//  alert(self.location);
  if (self.document.title!='') self.parent.document.title='HidePhotography - '+self.document.title;
}
function over(pTitle) {
  self.status=pTitle;
}
function out() {
  self.status='';
}
function hirdet0() {
  window.open("hirdet.htm","Hirdet","width=320,height=130,left=86,top=90,screenx=86,screeny=90");
}
function hirdet() {
  window.open("ftn.htm","FTN","width=120,height=240,left=86,top=90,screenx=86,screeny=90");
}
function info() {
  window.open("getpage.php?pg=info","Info","width=320,height=130,left=86,top=90,screenx=86,screeny=90");
}

function hideshow(hid) {
  if (document.getElementById('speclist'+hid).className=='hiddenpart') {
    document.getElementById('speclist'+hid).className='nothidden';
  } else {
    document.getElementById('speclist'+hid).className='hiddenpart';
  }
  return false
}

function nameDefined(ckie,nme) {
   var splitValues
   var i
   for (i=0;i<ckie.length;++i)
   {
      splitValues=ckie[i].split("=")
      if (splitValues[0]==nme) return true
   }
   return false
}
function delBlanks(strng) {
   var result=""
   var i
   var chrn
   for (i=0;i<strng.length;++i) {
      chrn=strng.charAt(i)
      if (chrn!=" ") result += chrn
   }
   return result
}

function SetCookieAfter(cn,cv,nHours) {
  try { xmlHttp=new XMLHttpRequest(); }
  catch(e) {
    try { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); }
    catch(e) {
     alert(err); return; }
  }
  xmlHttp.open('GET','setcookie.php?cn='+cn+'&amp;cv='+cv,true); xmlHttp.send(null);
}


function SetCookie(cookieName,cookieValue,nHours) {
 var today = new Date();
 var expire = new Date();
 if (nHours==null || nHours==0) nHours=1;
 expire.setTime(today.getTime() + 3600000*nHours);
 document.cookie = cookieName+"="+escape(cookieValue)+";expires="+expire.toGMTString()+";path=/";
}

function getCookie(cookieName) {
  if (document.cookie.length>0) {
    c_start=document.cookie.indexOf(cookieName + "=");
    if (c_start!=-1) {
      c_start=c_start + cookieName.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 testCookie(cname, cvalue) {
   var cookie=document.cookie
   var chkdCookie=delBlanks(cookie)
   var nvpair=chkdCookie.split(";")
   if(nameDefined(nvpair,cname))
   {
      tvalue=getCookie(nvpair,cname)
      if (tvalue == cvalue) return true
   else return false
   }
   else return false
}
function log(pTitle) { if (!testCookie("MyComputerName","Pelican"))
  ;//top.frames["Header"].document.location="http://www.pel.hu/header.php?ref="+pTitle;
}
function makeArray(arraySize) {
  this.length = arraySize; return this
}
function getlastmod() {
  monthNames=new makeArray(12)
  monthNames[0]="január"; monthNames[1]="február"; monthNames[2]="március"; monthNames[3]="április";
  monthNames[4]="május"; monthNames[5]="június"; monthNames[6]="július"; monthNames[7]="augusztus";
  monthNames[8]="szeptember"; monthNames[9]="október"; monthNames[10]="november"; monthNames[11]="december"
  updated=new Date(document.lastModified);
  theMonth=monthNames[updated.getMonth()];
  theYear=updated.getYear(); if (theYear<2000) theYear+=1900;
  zero='';
  if (updated.getMinutes()<10) zero='0';
  return theYear+". "+theMonth+" "+updated.getDate()+". "+updated.getHours()+":"+zero+updated.getMinutes();
}
function getstat() {
  t=new Date();
  y=t.getYear() % 100; if (y<10) y="0"+y;
  m=t.getMonth()+1; if (m<10) m="0"+m;
  return "stats.php?ho="+y+m;
}
function getdays() {
  start=new Date(2003,09,27,0,0,0);  /* a hónapnál 1-el kevesebbet kell írni, mert 0-tól indul */
  curr=new Date();
  days=(Date.UTC(curr.getFullYear(),curr.getMonth(),curr.getDate(),0,0,0)
      - Date.UTC(start.getFullYear(),start.getMonth(),start.getDate(),0,0,0))/86400000;
  return days;
}

function popImage(imageURL,imageTitle) {
  var isNN,isIE;
  if (parseInt(navigator.appVersion.charAt(0))>=4) {
    isNN=(navigator.appName=="Netscape")?1:0;
    isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;
  }
  var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
  var optIE='scrollbars=no,width=747,height=547,left='+PositionX+',top='+PositionY;
  if (isNN){imgWin=window.open('about:blank','',optNN);}
  if (isIE){imgWin=window.open('about:blank','',optIE);}
  with (imgWin.document){
    writeln('<html><head><title>Loading ...</title><style>body  {margin:0px;} </style>');writeln('<sc'+'ript>');
    writeln('var isNN,isIE;');writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
    writeln('isNN=(navigator.appName=="Netscape")?1:0;');writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
    writeln('function reSizeToImage(){');writeln('if (isIE){');writeln('window.resizeTo(100,100);');
    writeln('width=100-(document.body.clientWidth-document.images[0].width);');
    writeln('height=100-(document.body.clientHeight-document.images[0].height);');
    writeln('window.resizeTo(width,height);}');writeln('if (isNN){');
    writeln('window.innerWidth=document.images["IMG"].width;');writeln('window.innerHeight=document.images["IMG"].height;}}');
    writeln('function doTitle(){document.title="'+imageTitle+'";}');writeln('</sc'+'ript>');
    if (!AutoClose) writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()"  onClick="self.close()" >')
    else writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()" onClick="self.close()" >');
    writeln('<img name="IMG" src='+imageURL+' style="display:black"></body></html>');
    close();
  }
}

function Resize(pTitle) {
  var isNN,isIE,im;
  if (parseInt(navigator.appVersion.charAt(0))>=4) {
    isNN=(navigator.appName=="Netscape")?1:0;
    isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;
    isOP=(navigator.appName.indexOf("Opera")!=-1)?1:0;
    isFF=(navigator.appName.indexOf("Firefox")!=-1)?1:0;
  }
  if (isIE) {
    window.resizeTo(150,50);
    width=100-(document.body.clientWidth-document.images[0].width);
    height=100-(document.body.clientHeight-document.images[0].height);
    document.images[0].width=1;
    document.images[0].height=1;
    window.resizeTo(width,height);
  }
  if (isOP) {
//    window.resizeTo(150,50);
//    im=document.getElementById('IMG');
//    document.body.clientWidth=im.width;
//    document.body.clientHeight=im.height;
//    im.width=1; im.height=1;
//    window.resizeTo(im.width+2,im.height+2);
//  document.documentelement.clientheight=im.height;
//  document.documentelement.clientwidth=im.width;
  im=document.body.background;

  window.clientX=im.width;
  window.clientY=im.height;
  window.resizeTo(600+8,412+27);

  }
  if (isNN) {
    window.innerWidth=document.images["IMG"].width;
    window.innerHeight=document.images["IMG"].height;
    document.images["IMG"].width=1;
    document.images["IMG"].height=1;
  }
  if (isFF) {
    window.innerWidth=document.images["IMG"].width;
    window.innerHeight=document.images["IMG"].height;
    document.images["IMG"].width=1;
    document.images["IMG"].height=1;
  }
  document.title=pTitle;
}

function sh(pFileName,pWidth,pHeight,pTitle) {
  filename=pFileName.split("/").pop();
  pWidth=150; pHeight=50;
  ofsx=(screen.width-pWidth)/2; ofsy=(screen.height-pHeight)/4;
  Win=window.open( "", "_blank", "width="+ pWidth+ ",height="+pHeight+",status=no,scrollbars=no,menubar=no,resizable=no,screenX="+ofsx+",screenY="+ofsy+",left="+ofsx+",top="+ofsy);
  Win.document.write('<html><head><title>Loading...</title>'); Win.document.title="Loading...";
  Win.document.write('<script type="text/javascript" src="/show.js"></script></head>');
//  Win.document.write('<body topmargin="0" leftmargin="0" text="#FF0000">');
  Win.document.write('<body topmargin="0" leftmargin="0" text="#FFFFFF" background="'+'/pic/'+filename+'" style="background-repeat: no-repeat" onclick="self.close()" onblur="self.close()">');
//  Win.document.write('<img id="IMG" name="IMG" src="/pic/'+filename+'">');
  Win.document.write('<script>Resize("'+pTitle+'");</script>');
  Win.document.write('<table border="0" width="100%" height="100%" cellspacing="5" cellpadding="0">');
  Win.document.write('<tr><td width="100%" valign="bottom" align="center"><b><i>');
  if (document.title.substring(0,6)=="Gambia") Win.document.write('(C) Pelican, 2001');
  else if (document.title.substring(0,5)=="Costa") Win.document.write('(C) Pelican, 2003');
  else if (document.title!="Film" && document.title!="Top secret") Win.document.write('(C) Pelican, 1999-2004');
  Win.document.write('</b></i></td></tr></table>');
  Win.document.write('</body></html>');
  Win.document.show;
//  Win.document.title=pTitle;
  Win.document.close();
  if (navigator.appName=="Netscape") Win.focus();
}

function pwdmin(e,id) {
  if(e.value.length>4) document.getElementById(id).src='pic/HidePhotography.com.OK.small.png'; else document.getElementById(id).src='pic/spacer.png';
}

function pwdchk(e1,e2,id) {
//alert(e1.value.length);
  if(e1.value==e2.value && e1.value.length>4) document.getElementById(id).className=''; else document.getElementById(id).className='nodisp';
}

function flag(e,id) {
  document.getElementById(id).src='pic/HidePhotography.com.Flag.'+(e.value)+'.png';
}

function showhide(id) {
  el=document.getElementById(id);
  if (el.className=='disp') el.className='nodisp'; else el.className='disp';
//  setCookieAfter('disp'+id,el.className,999999);
  try { xmlHttp=new XMLHttpRequest(); }
  catch(e) {
    try { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); }
    catch(e) {alert(e); }
  }
  try {
    url='setcookie.php?cn=disp'+id+'&cv='+el.className;
    xmlHttp.open('GET',url,true);
    xmlHttp.send(null);
  } catch(e) {alert(e); }
}

/*function porg(el) {
//  el.text=Math.floor(Math.random()*8000)+1000;
//  porg2(el);
// alert(el.text);
//  for(i=0;i<10;i++)
window.setTimeout('alert(el);',1000);
//window.setTimeout('porg2(el);',1000);
}

function porg2(el) {
  alert(1);
  el.text=Math.floor(Math.random()*8000)+1000;
  porg(el);
//alert(el.text);
//  for(i=0;i<10;i++)
window.setTimeout('porg(el);',1000);
}*/
