/////////////////load jquery///////////////////
$(document).ready(function(){

	$(".sendmesage form").submit(function(){
		prov=1;								  
		spamproverka=$(this).find(".spamproverka").val();
		spam=$(this).find(".spam").val();
		$(this).find(".spam").removeClass("error");
		if(spam!=spamproverka){
			$(this).find(".spam").addClass("error");
			prov=0;
		}
		var elements=$(this).find("input, textarea");
		for(var i=0;i<elements.length-1;i++){
			thisclass=elements.eq(i).attr("class");
			thisvalue=elements.eq(i).attr("tempvalue");
			thistype=elements.eq(i).attr("type");
			if((thisclass.indexOf("important")>-1)&&(thistype!="submit")){
				elements.eq(i).removeClass("error");
				if((elements.eq(i).val()=="")||(elements.eq(i).val()==thisvalue)){
					prov=0;
					elements.eq(i).addClass("error");
				}
			}
		}
		if(prov==1){
			return true;
		}
		if(prov==0){
			alert("Проверьте отмеченные поля на заполнение");
			return false;
		}	
		
	});

	
	elements=$(".sendmesage input, .sendmesage textarea");
	for(var i=0;i<elements.length;i++){
		thistempvalue=elements.eq(i).attr("tempvalue");
		if(thistempvalue!=""){
			elements.eq(i).click(function(){
				thistempvalue=$(this).attr("tempvalue");						  
				thisvalue=$(this).val();						  
				if(thisvalue==thistempvalue){
					$(this).val("");
				}
			});
			elements.eq(i).blur(function(){
				thistempvalue=$(this).attr("tempvalue");						  
				thisvalue=$(this).val();						  
				if(thisvalue==""){
					$(this).val(thistempvalue);
				}
			});
		}
	}
	
	
	$(".faqbox div").click(function(){	
		var el=$(this).parent();							
		tclass=el.attr("class");
		if(tclass.indexOf("current")>-1){
			el.find(".ansver").slideUp(300);
			el.removeClass("current");
		}
		if(tclass.indexOf("current")<0){
			el.find(".ansver").slideDown(300);
			el.addClass("current");
		}
	});



});



