/*
* Vladimir K Urushev (urushev@yandex.ru)
* (c) MagicGold.ru, 2009-2010
*/

function StartAjax(transaction,controlname,sync){$.ajax({type:"POST",url:'/index.php',data:{'hash':transaction},success:function(loader){if(controlname){$('#'+controlname).empty();$('#'+controlname).html(loader)}else{if(loader)alert(loader)}}})};jQuery.fn.setWait=function(options){this.html('<div class="waiticon"></div>')};function extend_find_check_price(object_name,default_value,default_caption){var obj=$('#'+object_name);if(default_value){obj.val(default_value);obj.css('color','#893851')}else{obj.val(default_caption);obj.css('color','#888888')};obj.click(function(){if(!isNumber(obj.val())){obj.val('');obj.css('color','#893851')}});obj.blur(function(){if(!isNumber(obj.val())){obj.val(default_caption);obj.css('color','#888888')}else{if(obj.val()<100)obj.val(obj.val()*1000)}})};function AddToBasket(e,id,form){if(id){$.ajax({type:"POST",url:'/index.php',data:{m:'list','buy':id},success:function(data){$(e).unbind("click").html('Добавлено');e.onclick=null;BasketUpdate()}})}else{$.ajax({type:"POST",url:'/index.php',data:$('#'+form).serialize(),success:function(data){BasketUpdate()}});$(e).parent().children('.addinfo').html("Товар добавлен в <a class='link' href='/service/basket'>корзину</a>")}};function AddToCompare(e,id,ondiv){$.ajax({type:"POST",url:'/index.php',data:{m:'list','compare':id},success:function(data){if(!ondiv){$(e).unbind("click").html('Добавлено');e.onclick=null}else $(e).parent().children('.addinfo').html("Товар добавлен для <a class='link' href='/service/compare'>сравнения</a>");CompareUpdate()}})};function OpenWindow(url,w,h){open(url,"",'menubar=no,directories=no,location=no,resizable=no, target=viv scrollbars=yes,width='+w+',height='+h)}function getBrowserInfo(){var t,v=undefined;if(window.opera)t='Opera';else if(document.all){t='IE';var nv=navigator.appVersion;var s=nv.indexOf('MSIE')+5;v=nv.substring(s,s+1)}else if(navigator.appName)t='Netscape';return{type:t,version:v}};function bookmark(a){var url=window.document.location;var title=window.document.title;var b=getBrowserInfo();if(b.type=='IE'&&7>b.version&&b.version>=4)window.external.AddFavorite(url,title);else if(b.type=='Opera'){a.href=url;a.rel="sidebar";a.title=url+','+title;return true}else if(b.type=="Netscape")window.sidebar.addPanel(title,url,"");else alert("Нажмите CTRL-D, чтобы добавить страницу в закладки.");return false};$(document).ready(function(){$('#citys div.btnUp:first').hover(function(e){$('#citys div.oblast .plavalka').stop().animate({top:"0px"},{queue:false,duration:3000})},function(){$('#citys div.oblast .plavalka').stop()});$('#citys div.btnDown:first').hover(function(e){$('#citys div.oblast .plavalka').stop().animate({top:"-"+($('#citys div.oblast .plavalka').height()-50)+"px"},{queue:false,duration:3000})},function(){$('#citys div.oblast .plavalka').stop()});var of1=$('#citys div.oblast:first').offset().top;var of2=$('#citys div.staticselection:first').offset().top;var h1=$('#citys div.oblast:first').height();if((of2-of1)>(h1-70)){$('#citys div.oblast .plavalka').animate({top:"-=60px"},{queue:false,duration:500})};$('#citys div.element').hover(function(e){$(this).addClass('selection')},function(){$(this).removeClass('selection')});var opacity=0.4;var toOpacity=1;var duration=350;$(".specccccc").css("display","block").css("opacity",opacity).hover(function(){$(this).fadeTo(duration,toOpacity)},function(){$(this).fadeTo(duration,opacity)})});