
function toggleit() { 
	$(".keys").hide();
	$(".leftblock").hide();
	$(".lefthead").hide();
	$(".leftblock").hide();
	$(".righthead").hide();
	$(".rightblock").hide();
	$(".headstatic").hide();
	$(".admin").hide();
	$(".phonebg").show();
	$(".pagersico").hide();
	$(".logobg").show();
	$(".bottom").hide();
	$(".staticinfo").hide();
	$(".idinput").hide();
	$("#map_canvas").show();
}

function showit() { 
	$(".keys").show();
	$(".leftblock").show();
	$(".lefthead").show();
	$(".leftblock").show();
	$(".righthead").show();
	$(".rightblock").show();
	$(".headstatic").show();
	$(".admin").show();
	$(".bottom").show();
	$(".phonebg").hide();
	$(".pagersico").show();
	$(".logobg").hide();
	$("#map_canvas").hide();
	$(".search").html('<div class="searchimg"><img src="img/search.png"></div><span class="searchtext"><a href="#" id=\"gmapsearch\">search on map</a> | <a href="#" id=\"idsearch\">search by id</a></span>');
}

$(document).ready(function(){ 

$("#gmapsearch").live("click", function(){  

	toggleit();
	$(".search").html('<div class=\"backtotext\">&larr; <a href=\"#\">Close map</a></div>');
	initialize();
	
	$("#iw_kml a").live("click", function(){ $("#iw_kml a").attr("target", "_self"); });
	
	
	
});
	
$(".backtotext").live("click", function(){ 
	showit();
	
});

$("#idsearch").live("click", function(){
	$(".idinput").show();
	$(".idinputtext").focus();
	$(this).hide();
	return(false);
});

function searchap() {
	/*если кто надумает фиксить эту функцию пусть помнит что еще есть точно такой же MOVEIT для index.php*/
	$(".keys img").attr("src", "img/searchlogo.png");
	$('.cards').hide();
	$('.formsearch').show();
	$('#2ndlink').html("<a href=\"#\" id=\"hotprice\">Hot offers</a> ");
	$('.righthead').text('Apartment search');
}

function hotprice() {
	/*если кто надумает фиксить эту функцию пусть помнит что еще есть точно такой же MOVEIT для index.php*/
	$(".keys img").attr("src", "img/burn.png");
	$('.cards').show();
	$('.formsearch').hide();
	$('#2ndlink').html("<a href=\"#\" id=\"searchap\">Apartment search</a> ");
	$('.righthead').text('Hot offers');
}

$("#searchap").live("click", function(){
	showit();
	searchap();
	return(false);
});

$("#hotprice").live("click", function(){
	showit();
	hotprice();
	return(false);
});

$(".maplink").hover(function () {
    $(this).css("border-bottom","0px dashed");
  }, function () {
    $(this).css("border-bottom","1px dashed");
  });

$("#aboutstatic").click(function(){
	$(".staticinfo").hide();
	$(".insstaticinfo").load("static/about.htm");
	$(".staticinfo").show();
});

$(".contactsstatic").click(function(){
	$(".staticinfo").hide();
	$(".insstaticinfo").load("static/contacts.htm");
	$(".staticinfo").show();
});

$("#partnersstatic").click(function(){
	$(".staticinfo").hide();
	$(".insstaticinfo").load("static/partners.htm");
	$(".staticinfo").show();
});

$("#closestatic").live("click", function(){
	$(".staticinfo").hide();
});

$(".thumbhref").live("click", function(){  
	$("#photopopup").show();
	var thishref=$(this).attr("href");
	$("#photolarge").attr("src",thishref);
	return(false);
});

$(".maplink").live("click", function(){
	$("#mappopup").show();
	$(".keys img").attr("src", "img/maplogo.jpg");
	initialize();
	});

$(".closebut").live("click", function(){
	$("#photolarge").attr("src","http://www.stars5.ru/pub/wait.gif");
	$(".keys img").attr("src", "img/keys.jpg");
	$("#photopopup").hide();
	$("#mappopup").hide();
	$("#zakazpopup").hide();
	return(false);
});

$(".cart a").live("click",function(){
	$("#zakazpopup").show();
	$(".keys img").attr("src", "img/cartlogo.png");
	});

$("#zakazsubmit").live("click",function(){
	$(".zakazinput span").css("color","black");
	$(".zakazadres").text();
	var id = $(this).parent().attr("id");
	var adres = $(".zakazadres").text();
	var fio = $("#inputfio").attr("value");
	var tel = $("#inputtel").attr("value");
	var email = $("#inputemail").attr("value");
	var fromnum = $("select[name=fromnum] option:selected").val();
	var frommonth = $("select[name=frommonth] option:selected").val();
	var fromyear = $("select[name=fromyear] option:selected").val();
	var tonum = $("select[name=tonum] option:selected").val();
	var tomonth = $("select[name=tomonth] option:selected").val();
	var toyear = $("select[name=toyear] option:selected").val();
	var inputother = $("#inputother").attr("value");
	
	$.post("sendzakaz.php", {"id": id,"adres": adres,"fio": fio,"tel": tel,"email": email,"fromnum": fromnum,"frommonth": frommonth,"fromyear": fromyear,"tonum": tonum,"tomonth": tomonth,"toyear": toyear,"inputother": inputother}, function(data){ 
	//alert (data);
	sendval = eval("("+data+")");
	
	if (sendval.fio[0]==0){ $("#labelfio").css("color","red"); } else {  }
	if (sendval.tel[0]==0){ $("#labeltel").css("color","red"); } else {  }
	if (sendval.email[0]==0){ $("#labelemail").css("color","red"); } else {  }
	
	if (sendval.send[0]==0) {  $("#zakazalert").text('Fields marked in red have been filled correctly'); }
	
	if (sendval.send[0]==1) {  
		$("#zakazalert").css("color","blue"); 
		$("#zakazalert").text('Application sent! In the near future you will contact our manager.'); 
		$(".zakazhead").text('Your request was successfully sent!');
		$("#zakazsubmit").remove();
		}
	
	});
	
	});

$(".goback").live("click", function(){ javascript:history.go(-1); return(false); });

})

var shadowedBorderStaticinfo = RUZEE.ShadedBorder.create({ corner:12, shadow:27 });
var shadowedBorderTextt = RUZEE.ShadedBorder.create({ corner:14, shadow:25 });
var shadowedBorderTextt2 = RUZEE.ShadedBorder.create({ corner:14, shadow:25 });
var shadowedBorderThumb = RUZEE.ShadedBorder.create({ corner:1, shadow: 5 });
var shadowedBorderPhoto = RUZEE.ShadedBorder.create({ corner:1, shadow: 7 });


























