var domain_name='razdeta.net';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.8});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.8,to:0});new Effect.Fade(this.pay_form);}});var pay_form=null;
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;
}
var girl_l=false,boy_l=false,gc=0,bc=0,cur_img=1,is_clear=false,current_body_id=1,is_run_slide=false;
function girlLoad(){gc++;if(gc==2)girl_l=true;}
function boyLoad(){bc++;if(bc==2)boy_l=true;}
function girlPLoad(){gc++;if(gc>16&&!is_run_slide){is_run_slide=true;nextGSlide();}}
function boyPLoad(){bc++;if(bc>7&&!is_run_slide){is_run_slide=true;nextBSlide();}}
document.observe('dom:loaded',function(){
	if ($('over_l'))$('over_l').observe('mouseenter',girlEnter);
	if ($('over_l'))$('over_l').observe('mouseleave',girlLeave);
	if ($('over_r'))$('over_r').observe('mouseenter',boyEnter);
	if ($('over_r'))$('over_r').observe('mouseleave',boyLeave);
});
var glob,glob1;
function girlEnter(e){
	glob = new Effect.Parallel([
		new Effect.Fade('girl',{sync:true}),
		new Effect.Appear('girl_c',{sync:true})
	],{duration:1,afterFinish:function(){girlEnterT();}});
}
function girlEnterT(e){
	glob = new Effect.Parallel([
		new Effect.Appear('girl',{sync:true}),
		new Effect.Fade('girl_c',{sync:true})
	],{duration:1,afterFinish:function(){girlEnter();}});
}
function girlLeave(e){
	glob.cancel();
	$('girl').show();
	$('girl').setOpacity(1);
	$('girl_c').hide();
}
function boyEnter(e){
	glob1 = new Effect.Parallel([
		new Effect.Fade('boy',{sync:true}),
		new Effect.Appear('boy_c',{sync:true})
	],{duration:1,afterFinish:function(){boyEnterT();}});
}
function boyEnterT(e){
	glob1 = new Effect.Parallel([
		new Effect.Appear('boy',{sync:true}),
		new Effect.Fade('boy_c',{sync:true})
	],{duration:1,afterFinish:function(){boyEnter();}});
}
function boyLeave(e){
	glob1.cancel();
	$('boy').show();
	$('boy').setOpacity(1);
	$('boy_c').hide();
}
function getPrevGImg(cur_img){
	if (cur_img-1==0) return 17;
	else return cur_img-1;
}
function getNextGImg(cur_img){
	if (cur_img+1==18) return 1;
	else return cur_img+1;
}
function nextGSlide(){
	if (is_clear){
		new Effect.Parallel([
			new Effect.Fade('g'+cur_img,{sync:true}),
			new Effect.Appear('gc'+cur_img,{sync:true})
		],{duration:1});
		cur_img=getNextGImg(cur_img);
	}else{
		new Effect.Parallel([
			new Effect.Fade('gc'+getPrevGImg(cur_img),{sync:true}),
			new Effect.Appear('g'+cur_img,{sync:true})
		],{duration:0.5});
	}
	is_clear=!is_clear;
	setTimeout("nextGSlide();",3000);
}
function getPrevBImg(cur_img){
	if (cur_img-1==0) return 7;
	else return cur_img-1;
}
function getNextBImg(cur_img){
	if (cur_img+1==8) return 1;
	else return cur_img+1;
}
function nextBSlide(){
	if (is_clear){
		new Effect.Parallel([
			new Effect.Fade('b'+cur_img,{sync:true}),
			new Effect.Appear('bc'+cur_img,{sync:true})
		],{duration:1});
		cur_img=getNextBImg(cur_img);
	}else{
		new Effect.Parallel([
			new Effect.Fade('bc'+getPrevBImg(cur_img),{sync:true}),
			new Effect.Appear('b'+cur_img,{sync:true})
		],{duration:0.5});
	}
	is_clear=!is_clear;
	setTimeout("nextBSlide();",3000);
}
function prevGBody(){
	new Effect.Parallel([
		new Effect.Fade('g'+current_body_id,{sync:true}),
		new Effect.Appear('g'+getPrevGImg(current_body_id),{sync:true})
	],{duration:0.5});
	current_body_id=getPrevGImg(current_body_id);
}
function nextGBody(){
	new Effect.Parallel([
		new Effect.Fade('g'+current_body_id,{sync:true}),
		new Effect.Appear('g'+getNextGImg(current_body_id),{sync:true})
	],{duration:0.5});
	current_body_id=getNextGImg(current_body_id);
}
function prevBBody(){
	new Effect.Parallel([
		new Effect.Fade('b'+current_body_id,{sync:true}),
		new Effect.Appear('b'+getPrevBImg(current_body_id),{sync:true})
	],{duration:0.5});
	current_body_id=getPrevBImg(current_body_id);
}
function nextBBody(){
	new Effect.Parallel([
		new Effect.Fade('b'+current_body_id,{sync:true}),
		new Effect.Appear('b'+getNextBImg(current_body_id),{sync:true})
	],{duration:0.5});
	current_body_id=getNextBImg(current_body_id);
}