function IEPngFix(pngimg, gifimg, width, height)
{
	var code = '<img src="'+ gifimg +'" width="' + width + '" height="' + height + '" border="0" style="background:url('+pngimg+') no-repeat 0px 0px;"/>';
	if( navigator.userAgent.indexOf("Opera") > 1 ) document.write(code);
	else
		if( navigator.userAgent.indexOf("MSIE 6") > 1 ) document.write('<img src="'+gifimg+'" width="' + width + '" height="' + height + '" border="0" style="filter: progid:DXImageTransform.Microsoft.AlphaImageLoader (src=' + pngimg + ' , sizingMethod=crop );"/>');
		else
			if(navigator.userAgent.indexOf("MSIE 5") != -1) document.write(code);
			else document.write(code);
}

function checkEmptyText(str) {
  if(str=='') return false;
  if(str.replace(/[\s]/g,'').length>0) return true;
  return false;
}
function checkNum(num,len){
  if(num=='') return false;
  if(num.replace(/[0-9]/g,'').length>0) return false;
    if(num.length!=len) return false;
 return true;
}
function checkPhone(num){
  if(num=='') return false;
  if(num.replace(/[0-9+\-()\s]/g,'').length>0) return false;
 return true;
}
function echeck(str) {
  if(str=='') return false;
  if(str.replace(/([a-z_\-\.\d]+)+@+([a-z\d]+)+\.+([a-z]{2,3})/gi,'').length>0) return false;
  return true;
}

function Combine(inputs,textareas){
var ary=[];
for (var zxc0=0;zxc0<inputs.length;zxc0++){
ary.push(inputs[zxc0]);
}
for (var zxc1=0;zxc1<textareas.length;zxc1++){
ary.push(textareas[zxc1]);
}
return ary;
}

function checkForm(formID)
{
var erColor='#E5E5E5';
var erTxtColor='#000000';
var rColor='#FFFFFF';
var rTxtColor='#4F585B';
var err=0;
var inp=null;
var stype=null;
var erMsgContainer=null;
erMsgContainer=document.getElementById('erMsgContainer');
if(erMsgContainer){
	document.getElementById('erMsgSub').style.display='none';
	erMsgContainer.style.display='none';
	erMsgContainer.innerHTML="";
}
textAreas=document.getElementById(formID).getElementsByTagName("TEXTAREA");
inputs=document.getElementById(formID).getElementsByTagName("INPUT");
inputs=Combine(inputs,textAreas);

for(i=0;i<=inputs.length;i++){
	inp=inputs[i];
	if(inp!=undefined)
	{
		stype=inp.getAttribute("stype");
		if(stype){
			inp.style.backgroundColor=rColor; //восстанавливаем цвета полей
			inp.style.color=rTxtColor;
			if(stype=="txt"){
				if(!checkEmptyText(inp.value) || inp.getAttribute("erMsg")==inp.value){
					err=1;
					if(erMsgContainer.innerHTML!="") erMsgContainer.innerHTML+=", ";
					erMsgContainer.innerHTML+=inp.getAttribute("erMsg");
					//inp.value=inp.getAttribute("erMsg");
					//inp.style.backgroundColor=erColor;
					//inp.style.color=erTxtColor;
				}
			}else if(stype=="phone"){
				if(!checkPhone(inp.value) || inp.getAttribute("erMsg")==inp.value){
					err=1;
					if(erMsgContainer.innerHTML!="") erMsgContainer.innerHTML+=", ";
					erMsgContainer.innerHTML+=inp.getAttribute("erMsg");
					/*inp.value=inp.getAttribute("erMsg");
					inp.style.backgroundColor=erColor;
					inp.style.color=erTxtColor;*/
				}
			}else if(stype=="email"){
				if(!echeck(inp.value) || inp.getAttribute("erMsg")==inp.value){
					err=1;
					if(erMsgContainer.innerHTML!="") erMsgContainer.innerHTML+=", ";
					erMsgContainer.innerHTML+=inp.getAttribute("erMsg");
					/*inp.value=inp.getAttribute("erMsg");
					inp.style.backgroundColor=erColor;
					inp.style.color=erTxtColor;*/
				}
			}
		}
	}
}
if(err){
 if(erMsgContainer){ erMsgContainer.style.display='inline';
	document.getElementById('erMsgSub').style.display='inline';
	document.getElementById('preEr').style.display='none';
 }
 return false;
 }
  document.getElementById(formID).submit();
}


$(document).ready(function(){
	$('.item').hover(
		function()
		{
			$(".pic2", this).css({'border':'5px solid #CAE5EE'});
			$("div", this).css({'background':'url(img/arrow_blue.gif) no-repeat 0px 12px', 'color':'#4EB8D2'});
		},
		function()
		{
			$(".pic2", this).css({'border':'5px solid #D7DCE3'});
			$("div", this).css({'background':'url(img/arrow_blue2.gif) no-repeat 0px 12px', 'color':'#385F6D'});
		}
	);
	$('#ico_mail').hover(
		function(){ $(this).attr('src', 'img/ico_mail1.gif'); },
		function(){ $(this).attr('src', 'img/ico_mail.gif'); }
	);
	$('#ico_search').hover(
		function(){ $(this).attr('src', 'img/ico_search1.gif'); },
		function(){ $(this).attr('src', 'img/ico_search.gif'); }
	);
	$('#ico_star').hover(
		function(){ $(this).attr('src', 'img/ico_star1.gif'); },
		function(){ $(this).attr('src', 'img/ico_star.gif'); }
	);
	$('#m1').hover(
		function(){ $(this).attr('src', 'img/roll_01.gif'); },
		function(){ $(this).attr('src', 'img/norm_01.gif'); }
	);
	$('#m2').hover(
		function(){ $(this).attr('src', 'img/roll_02.gif'); },
		function(){ $(this).attr('src', 'img/norm_02.gif'); }
	);
	$('#m3').hover(
		function(){ $(this).attr('src', 'img/roll_03.gif'); },
		function(){ $(this).attr('src', 'img/norm_03.gif'); }
	);
	$('#m4').hover(
		function(){ $(this).attr('src', 'img/roll_04.gif'); },
		function(){ $(this).attr('src', 'img/norm_04.gif'); }
	);
	$('#sotr_norm').hover(
		function(){ $(this).attr('src', 'img/sotr_rol.png'); },
		function(){ $(this).attr('src', 'img/sotr_norm.png'); }
	);
	$('#ban1').hover(
		function(){ $(this).attr('src', 'img/ban_1.gif'); },
		function(){ $(this).attr('src', 'img/ban.gif'); }
	);
	$('#start_m1').hover(
		function(){ $(this).attr('src', 'img/start_m1_1.gif'); },
		function(){ $(this).attr('src', 'img/start_m1.gif'); }
	);
	$('#start_m2').hover(
		function(){ $(this).attr('src', 'img/start_m2_1.gif'); },
		function(){ $(this).attr('src', 'img/start_m2.gif'); }
	);
	$('#start_m3').hover(
		function(){ $(this).attr('src', 'img/start_m3_1.gif'); },
		function(){ $(this).attr('src', 'img/start_m3.gif'); }
	);
	$('#start_m4').hover(
		function(){ $(this).attr('src', 'img/start_m4_1.gif'); },
		function(){ $(this).attr('src', 'img/start_m4.gif'); }
	);
	$('#_sant_').hover(
		function(){ $(this).attr('src', 'img/_send__02.gif'); },
		function(){ $(this).attr('src', 'img/_send__01.gif'); }
	);
	$('#opt').hover(
		function(){ $(this).attr('src', 'img/opt_pocup_r.gif'); },
		function(){ $(this).attr('src', 'img/opt_pocup_n.gif'); }
	);
	$('#ban_mag').hover(
		function(){ $(this).attr('src', 'img/ban_mag_1.gif'); },
		function(){ $(this).attr('src', 'img/ban_mag.gif'); }
 	);
 	$('.arr_link').hover(
		function(){ $(this).css({'background':'url(img/ico_arrow1.gif) no-repeat 100% 3px'}); },
		function(){ $(this).css({'background':'url(img/ico_arrow.gif) no-repeat 100% 3px'}); }
	);
	$('.arr_link2').hover(
		function(){ $(this).css({'background':'url(img/ico_arrow3.gif) no-repeat 0px 3px'}); },
		function(){ $(this).css({'background':'url(img/ico_arrow2.gif) no-repeat 0px 3px'}); }
	);
	$('.arr_link2').click(function(){
			$('#'+$(this).children().attr('wind')).fadeOut();
			return false;
	});
	$('.arr_link').click(function(){
			$('#'+$(this).children().attr('wind')).fadeIn();
			return false;
	});

});






