var xXHR=false;
var xTime=0;

function $(id){return document.getElementById(id);}

function initXHR() {
try{xXHR=new XMLHttpRequest();}catch(e){try{xXHR=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{xXHR=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){xXHR=null;}}}
if(xXHR==null){alert("Error creating request object!");}
}

function pXHR(p,v,x){
initXHR();
xXHR.onreadystatechange=function(){if(xXHR.readyState==4){$(x).innerHTML=xXHR.responseText;}};
xXHR.open('POST',p,true);
xXHR.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xXHR.setRequestHeader("Connection","close");
xXHR.send(v);
}

function r(e){e=e||window.event;var x=e.target||e.srcElement;if(x.tagName.toLowerCase()!='input'&&x.tagName.toLowerCase()!='textarea'){return false;}}
function rt(){return true;}function rf(){return false;}
document.oncontextmenu=rf;
document.onselectstart=rf;
document.ondragstart=rf;
document.onmousedown=r;
document.onclick=rt;

function fxOpac(x,o){o.style.opacity=(x/100);o.style.MozOpacity=(x/100);o.style.KhtmlOpacity=(x/100);o.style.filter="alpha(opacity="+x+")";}

function fxFade(x1,x2,o){var t=0;if(x1<x2){for(i=x2-x1;i--;){t+=2;setTimeout(function(){x1++;fxOpac(x1,o);},t);}}else{for(i=x1-x2;i--;){t+=2;setTimeout(function(){x1--;fxOpac(x1,o);},t);}}}

function fxDisplay(x){$('pbx').style.display=x;$('pbg').style.display=x;}

function preview(x){
if (typeof x === 'undefined' ){
fxFade(100,0,$('pbi'));
setTimeout(function(){fxFade(47,0,$('pbg'));},111);
setTimeout(function(){fxDisplay('none');},333);
}
else{
fxDisplay('block');
fxFade(0,47,$('pbg'));
var p=new Image(),i=$('pbi');
p.onload=function(){i.src=x;setTimeout(function(){fxFade(0,100,i);},10);};
p.src=x;
}
}

function fxSrc(){
var txt=$('i_srctxt').value;
document.title='Cautare';
pXHR('search.htm','cmd=src&txt='+txt,'content');
}

function fxTime(){
var xs='qzr2zw5wx57i4x';
var xW=screen.width;
var xH=screen.height;
var xT=xTime++;
pXHR('time.htm','cmd=time&s='+xs+'&sw='+xW+'&sh='+xH+'&t='+xT,'div_topr');
}
setInterval(fxTime,1000);

function fxSwapBanner(x){
x=x==3?0:x+1;
var s='graphics/banner_'+x+'.jpg',p=new Image(),i=$('i_banner');
p.onload=function(){$('banner').style.background = "url('" + s + "')";setTimeout(function(){fxFade(100,0,i);},10);};
p.src=s;
setTimeout(function(){i.src=s;fxOpac(100,i);},1000);
setTimeout(function(){fxSwapBanner(x);},4000);
}

function fxInit(){
fxOpac(0,$('pbg'));fxOpac(0,$('pbi'));
setTimeout(function(){fxSwapBanner(0);},3000);
}
document.onload=setTimeout(function(){fxInit();},1);

var _gaq=_gaq||[];
_gaq.push(['_setAccount','UA-17802747-4']);
_gaq.push(['_trackPageview']);

(function(){
var ga=document.createElement('script');ga.type='text/javascript';ga.async=true;
ga.src=('https:'==document.location.protocol?'https://ssl':'http://www')+'.google-analytics.com/ga.js';
var s=document.getElementsByTagName('script')[0];s.parentNode.insertBefore(ga, s);
})();
