
 $(document).ready(function(){	
		popup();
		askform();
	//	formpopup();
                if($(".rotator").length) {
	          rotate_show($(".rotator #q1"));
        	 }

	});

function popup(){
//	$(".zapislink a").click(function(){                             	
	$(".zapis .padd").click(function(){   
		p = $(window).scrollTop()*1+50;
		$(".formlayerdiv").css("padding-top",p+"px");
		$(".formlayerdiv").css("display","block");
	});
	$(".formlayerdiv .close a").click(function(){
		$(this).parents(".formlayerdiv").css("display","none");
	});                                                      
}


function formpopup(){
	if($(".formerrors").length>0) {
		height = $(".formerrors").height()+20;
		$(".formframe").css("height",height+"px");
	}
}

function askform(){
		$(".formtit.ttask").click(function(){
				$(".formdiv.fdask").toggleClass("fdask_o");
			});
		if($(".formdiv.fdask .formerrnumb").html()>0) $(".formdiv.fdask").toggleClass("fdask_o");
	}

function rotate_next(obj){	
		ids = $(obj).attr("id");
		ids = ids.replace("q","")*1;
		//alert(ids);
		if(ids<$(".rotator img").length) {
			idn = ids+1;
			rotate_show(".rotator #q"+idn);
			}
		else rotate_show(".rotator #q1");
	}
	
	function rotate_close(obj){	
		setTimeout(function() { $(obj).fadeOut(700, function(){rotate_next(obj);} ); }, 4000);
		}
	function rotate_show(obj){		
		$(obj).fadeIn(700,rotate_close(obj));		
		}