$(document).ready(function(){
	$("#click_inp input.one_true").click(function(){
		endis(true);								 
	});
	$("#click_inp input.two_false").click(function(){
		endis(false);								 
	});
});

//==========================| FIX PNG |==========================//
function fixPNG(element) {
			  
			  if (/MSIE (5\.5|6).+Win/.test(navigator.userAgent))
			  {
				var src;
				
				if (element.tagName=='IMG') 
				{
				  if (/\.png$/.test(element.src)) 
				  {
					src = element.src;
					element.src = "images/blank.gif"; 
				  }
				}
				else 
				{
				 
				  src = element.currentStyle.backgroundImage.match(/url\("(.+\.png)"\)/i);
				  if (src)
				  {
					src = src[1]; 
					element.runtimeStyle.backgroundImage="none"; 
				  }
				}
				if (src) element.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "',sizingMethod='scale')";
			  }
			}
//==========================| END FIX PNG |==========================//

		jsHover = function() {
				var hEls = document.getElementById("cont_menu_all").getElementsByTagName("li");
				for (var i=0, len=hEls.length; i<len; i++) {
					hEls[i].onmouseover=function() { this.className+=" jshover"; }
					hEls[i].onmouseout=function() { this.className=this.className.replace(" jshover", ""); }
				}
			}
			if (window.attachEvent && navigator.userAgent.indexOf("Opera")==-1) window.attachEvent("onload", jsHover);

//==========================| TOP MENU |==========================//

$(function(){
	$('#top_menu ul li')
		.css( {backgroundPosition: "-50px -65px"} )
		.mouseover(function(){
			$(this).stop().animate({backgroundPosition:"(-50px 0px)"}, {duration:600})
		})
		.mouseout(function(){
			$(this).stop().animate({backgroundPosition:"(5px -65px)"}, {duration:500, complete:function(){
				$(this).css({backgroundPosition: "-50px -65px"})
			}})
		})
});

$(function(){
	$('#top_menu ul li a')
		.css( {backgroundPosition: "9px 13px"} )
		.mouseover(function(){
			$(this).stop().animate({backgroundPosition:"(-10px 13px)"}, {duration:300})
			.animate({backgroundPosition:"(9px 13px)"},{duration:600})
		})
		.mouseout(function(){
			$(this).stop().animate({backgroundPosition:"(-10px 13px)"}, {duration:500, complete:function(){
				$(this).css({backgroundPosition: "9px 13px"})
			}})
		})
});
//==========================| END TOP MENU |==========================//	
/*jsHover = function() {
		var hEls = document.getElementById("content").getElementsByClassName(".button_zakaz");
		for (var i=0, len=hEls.length; i<len; i++) {
			hEls[i].onmouseover=function() { this.className+=" jshover"; }
			hEls[i].onmouseout=function() { this.className=this.className.replace("jshover", ""); }
		}
	}
	if (window.attachEvent && navigator.userAgent.indexOf("Opera")==-1) window.attachEvent("onload", jsHover);
	else {window.addEventListener("load", jsHover, false); }*/
//==========================| END CONT PHOTOS |==========================//
		$(document).ready(function() {
			$("a.gallery").fancybox();
		});
//==========================| END GALLERY |==========================//


<!--
function endis(dis){
if (dis){ document.getElementById('teplo1').disabled = false; document.getElementById('teplo2').disabled = false; } else { document.getElementById('teplo1').disabled = true; document.getElementById('teplo2').disabled = true;}
}
 
function getCheckedValue(radioObj) {
	if(!radioObj) return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked) return radioObj.value; else return "";
	for(var i = 0; i < radioLength; i++) { if(radioObj[i].checked) { return radioObj[i].value; } }
	return "";
}
 
function senddata(){
	var calc_area= document.getElementById('calc_area').value;

	if (!calc_area){
		document.getElementById('calc_area').focus();
		return;
	} else {
		var calc_termo = getCheckedValue(document.getElementsByName('calc_termo'));
		var calc_teplo= getCheckedValue(document.getElementsByName('calc_teplo'));
		var calc_typ = getCheckedValue(document.getElementsByName('calc_typ'));
		var data = {
			calc_area:calc_area,
			calc_termo:calc_termo,
			calc_teplo:calc_teplo,
			calc_typ:calc_typ
		};
		xmlhttp_request('calc_res',data);
		showhide(1);
	}
}

function showhide(f){
	switch(f){
		case 1:
			document.getElementById('calc_result').style.display='inline';
			document.getElementById('form_calc').style.display='none';
			break;
		case 2:
			document.getElementById('calc_result').style.display='none';
			document.getElementById('form_calc').style.display='inline';
			break;
	}
}
 
var requests_queue = new Array();
var requests_current = 0;
var xmlhttp_requests = new Array();
var xmlhttp_targets = new Array();
var xmlhttp_param = new Array();
var xmlhttp_execute_after = new Array();
var xmlhttp_execute_after_cond = new Array();
var xmlhttp_data = new Array();
var xmlhttp_method = 'post';
var xmlhttp_script = 'calcrq.php';
 
function xmlhttp_create(){
	var xmlhttp;
	try { xmlhttp = new XMLHttpRequest(); } catch (e) { try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");} catch (e) { return false; } } }
	return xmlhttp;
}
 
function xmlhttp_request(id, data, silent, eval_function, conditionous) {
	var req_id = id;
	req_id += "-" + ( (Math.random()*Math.random()) * 1000000 );
	if(xmlhttp_requests[req_id] = xmlhttp_create()) {
		var o = document.getElementById(id);
		xmlhttp_targets[req_id] = o?o:false;
		xmlhttp_data[req_id] = 'id='+id;
		xmlhttp_data[req_id] += '&ajax=1';
		xmlhttp_param[req_id] = {silent:(silent?true:false),sync:true};
		xmlhttp_execute_after[req_id] = eval_function?eval_function:'';
		xmlhttp_execute_after_cond[req_id] = conditionous;
		if (typeof(data) == 'object') {
			for (key in data) {
				if (typeof(data[key]) == 'object') {
					for (subkey in data[key]) { xmlhttp_data[req_id] += '&' + key + '[]=' + data[key][subkey]; }
				} else xmlhttp_data[req_id] += '&' + key + '=' + data[key];
			}
		}
		if(requests_queue.length>0){ var flag = false; }else { var flag = true;requests_queue[requests_current] = req_id; }
		xmlhttp_request_send(req_id, flag);
	}
}
 
function xmlhttp_request_send(id, gogogo_flag) {
	if(gogogo_flag){
		xmlhttp_requests[id].open(xmlhttp_method, xmlhttp_script, true);
		xmlhttp_requests[id].setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlhttp_requests[id].setRequestHeader("Content-Length", xmlhttp_data[id].length);
		xmlhttp_requests[id].onreadystatechange = xmlhttp_request_statechanged;
		xmlhttp_requests[id].send(xmlhttp_data[id]);
	}else {
		var last = requests_queue.length;
		requests_queue[last] = id;
	}
}
 
function xmlhttp_request_statechanged() {
	var i, t, p, text, len = 0, value, param;
	for (id in xmlhttp_requests) {
		len ++;
		switch (xmlhttp_requests[id].readyState) {
			case 1:
				if(document.getElementById('ajaxtip')) {
					//ajaxtip.html('Loading...');
					//ajaxtip.show();
				}
				if(xmlhttp_param[id].silent) 
					{/*keep it silent*/}
				else {
					xmlhttp_targets[id].innerHTML = 'Запрос к базе данных...';}
				break;
			case 2:
				if(xmlhttp_param[id].silent) 
					{/*keep it silent*/}
				else {
					xmlhttp_targets[id].innerHTML = 'Запрос отослан...';}
				break;
			case 3:
				if(xmlhttp_param[id].silent) 
					{/*keep it silent*/}
				else {
					xmlhttp_targets[id].innerHTML = 'Получаю данные...';}
				break;
			case 4:
				if(xmlhttp_param[id].silent) 
					{/*keep it silent*/}
				else {
					xmlhttp_targets[id].innerHTML = '';}
				if (xmlhttp_targets[id] && xmlhttp_requests[id].responseText) {
					text = xmlhttp_requests[id].responseText;
					p = text.indexOf('#__SPLIT__#');
					if(p >= 0) {
						var meta = text.substr(p+11);
						text = text.substr(0,p);
						re = /([\w]+)=([\w\+\-]+)/g;
						re_results = new Array();
						var counter = 0;
						var tmp_ar = new Array();
						while(tmp_ar = re.exec(meta)) { re_results[counter] = tmp_ar; counter++; }
						for(i = 0; i<counter; i++) {
							param = re_results[i][1];
							value = re_results[i][2];
							switch(param) {
								case 'id':
									if(value=='null') xmlhttp_targets[id].id = '';
									else xmlhttp_targets[id].id = value;
									break;
								case 'class':
									xmlhttp_targets[id].className = value;
									break;
							}
						}
					}
					xmlhttp_targets[id].innerHTML = text; cpy();
				}
				delete (xmlhttp_targets[id]);
				delete (xmlhttp_data[id]);
				len ;
				//ajaxtip.hide();
				if(xmlhttp_execute_after[id]) eval(xmlhttp_execute_after[id]);
				if(xmlhttp_execute_after_cond[id]) {
					var ar = xmlhttp_execute_after_cond[id];
					for(i in ar) { if(i==xmlhttp_requests[id].responseText) { eval(ar[i]); } }
				}
				delete (xmlhttp_requests[id]);
				delete(xmlhttp_execute_after[id]);
				delete (xmlhttp_param[id]);
				//if(xmlhttp_param[id]['sync']==true) {
				var last = requests_queue.length;
				if(requests_current < last-1) { xmlhttp_request_send(requests_queue[++requests_current], true); }else { requests_queue = new Array(); requests_current = 0;}
				//}
				break;
		}
	}
}

function cpy(){
	var text;
	text = document.getElementById('calc_res').innerHTML;
	document.getElementById('forms_1_4').value = text.replace(/<[/\w =' "]+>/g," ");
}
// -->