$(document).ready(function(){	// search form integration	var searchline = $("#searchLine");	var searchDefVal = searchline.attr('title');	if (searchline.val() == '') {searchline.val(searchDefVal);}	if (searchline.val() != searchDefVal) {searchline.addClass("focus").focus()};	searchline.bind("focus", function(){		if ($(this).val() == searchDefVal) {			$(this).val("").addClass("focus");		}	}).bind("blur", function(){		if ($(this).val() == searchDefVal || $(this).val() == '') {			$(this).val(searchDefVal).removeClass("focus");		}	});		$('#searchButton').click(function(){this.form.submit();});	// standart scheme handlers	$('.st-CRM').click(function(){ window.document.location.href = window.location.pathname + '/crm'; });	$('.st-SelfCare').click(function(){ window.document.location.href = window.location.pathname + '/selfcare'; });	$('.st-SDP').click(function(){ window.document.location.href = window.location.pathname + '/sdp'; });	$('.st-Inventory').click(function(){ window.document.location.href = window.location.pathname + '/inventory'; });	// the rest    if($("#map1").length) {initialize1();initialize2();}    if($(".xsuGalPic").length) {setUpGal();initGal();}    $(".xsuGalArrL, .xsuGalArrR").bind("mouseenter mouseleave", function(){        if (!$(this).is(".nact")) $(this).toggleClass("over");    }).bind("click",function(){        if ($(this).is(".over")) {            thumb = $(".xsuGalList li.xsuCurrent");            thumb.removeClass("xsuCurrent");            if ($(this).is(".xsuGalArrR")) {                src = thumb.next("li").addClass("xsuCurrent").children("a").attr("href");            }            else {                src = thumb.prev("li").addClass("xsuCurrent").children("a").attr("href");                if (src==firstImg) $(".xsuGalArrL").addClass("nact");                else $(".xsuGalArrL").removeClass("nact");            }            if (src) {                $(".xsuGalList li.xsuCurrent").append('<div class="loading"></div>');                loadImg(src);                            }        }    });    $(".xsuGalList img").click(function(){        thumbLink = $(this).parent();        if(thumbLink.parent().is(".xsuCurrent")) return false;        else thumbLink.parent().addClass("xsuCurrent").siblings("li").removeClass("xsuCurrent");        $(".xsuGalList li.xsuCurrent").append('<div class="loading"></div>');        src = thumbLink.attr("href");        loadImg(src);        return false;    });	$(".img_edit").click(function(){      thumbLink = $(this);	  id = thumbLink.attr("id");	  window.location.href = id;	  return false;    });    $("#sBoxSubmit").bind("mousedown mouseup", function(){        $(this).toggleClass("press");    }).bind("mouseout", function(){        $(this).removeClass("press");    });    $("div[id^='schBttn']").bind("mouseenter", function(){        $obj = $(this);        tipid = $obj.attr("id");        $obj.addClass("press");        if ($("#tip-"+tipid).length) $("#tipcontainer, #tip-"+tipid).show();        docw = $(document).width();        tipw = $("#tipcontainer").width();    }).bind("mouseleave", function(){        $obj.removeClass("press");        if ($("#tip-"+tipid).length) $("#tipcontainer, #tip-"+tipid).hide();    }).bind("mousemove", function(e) {        xOffset = 30;// x distance from mouse        yOffset = 25;// y distance from mouse        mtop = (e.pageY + yOffset);        mleft = (e.pageX + xOffset);        //console.info(mtop);        if ((mleft+tipw+xOffset)<docw) $("#tipcontainer").css({top:mtop, left:mleft});        else $("#tipcontainer").css({top:mtop, left:(mleft-tipw-xOffset)});    });    $("ul.xsuMarkerMenu a").click(function(){        object = $(this);        object.parent().addClass("xsuCurrent").siblings("li").removeClass("xsuCurrent");        marktext = object.attr("id");        $(".xsuSchemeBlock .mark").removeClass("mark");        $("div."+marktext).addClass("mark");        var point = ($(this.hash).offset().top)-25;        var speed=100*(point/100);        $("html, body").animate({scrollTop: point}, speed,'swing');        return false;    });});$(window).resize(function(){});function initialize1() {	var latlng1 = new google.maps.LatLng(50.460423,30.522346);	var myOptions1 = {zoom:16, center:latlng1, mapTypeId: google.maps.MapTypeId.ROADMAP};	var map1 = new google.maps.Map(document.getElementById("map1"), myOptions1);	var marker1 = new google.maps.Marker({position:latlng1, map: map1});}function initialize2() {	var latlng1 = new google.maps.LatLng(50.503849,30.44203);	var myOptions1 = {zoom:16, center:latlng1, mapTypeId: google.maps.MapTypeId.ROADMAP};	var map1 = new google.maps.Map(document.getElementById("map2"), myOptions1);	var marker1 = new google.maps.Marker({position:latlng1, map: map1});}function loadImg(src){    $(".xsuGalPic img").attr("src",src);    setUpGalArrs(src);    img = new Image();    $(img).load(function(){        $(".xsuGalPic img").attr({"src":src, "height":img.height}).css({'opacity':0}).animate({'opacity':1},300,function(){$(".xsuGalList li.xsuCurrent").children("div.loading").remove();});        setUpGal();    });    img.src = src;}function setUpGal(){    gph = $(".xsuGalPic img").attr("height");//.height();    gpw = $(".xsuGalPic img").attr("width");//.width();    $(".xsuGalArrL, .xsuGalArrR").height(gph).width(gpw/2);//.addClass("nact");    $(".xsuGalArrL img, .xsuGalArrR img").animate({top:(gph/2)-26},300);}function initGal() {    firstImg = $(".xsuGalList li:first a").attr("href");    lastImg = $(".xsuGalList li:last a").attr("href");    $(".xsuGalList li:first").addClass("xsuCurrent");    loadImg(firstImg);    $(".xsuGalArrL").addClass("nact");    }function setUpGalArrs(src){    if (src==firstImg) $(".xsuGalArrL").addClass("nact").removeClass("over");    else $(".xsuGalArrL").removeClass("nact");    if (src==lastImg) $(".xsuGalArrR").addClass("nact").removeClass("over");    else $(".xsuGalArrR").removeClass("nact");}function showtip(tipid) {}
