	function popup (ppage,wintype) {
		if (wintype==0) {
			w=400;
			h=250;
		}
		else {
			w=900;
			h=350*wintype;
			if (h>900) {
				h=900;
			}
		}
		window.open(ppage, '_blank', 'location=no, menubar=no, resizable=yes, scrollbars=yes, status=no, titlebar=no, toolbar=no, width=' +w+ ', height=' +h+ '', '');
	}

	
	$(document).ready( function () {
		
		
		
		
		
		$("div#slider b").click ( function () {
			$("div#slide-cats:visible").slideUp("slow");
		});
		$("div#slider b").click ( function () {
			$("div#slide-cats:hidden").slideDown("slow");
		});
	
	
	
		$("select#currency").change (function () {
			var selval= $("select#currency option:selected").attr("value");
			if (selval>0) {
				$("input.curlimit").removeAttr("disabled");
				$(this).parent().siblings("div").removeClass("passive");
			}
			else {
				$("input.curlimit").attr("disabled","disabled");
				$(this).parent().siblings("div").addClass("passive");
			}
		
		});
	
		$("div.paging a").click ( function () {
			var np = $(this).html();
			$("input#pag").attr("value",np);
			$("form#adlist-options").submit();
		
			return false;
		});
		
		$("a#multiopen").click( function () {
			var ads='';
			$("input.multi:checked").each( function () {
				ads=ads+','+$(this).attr("id");
			});
			var len=$("input.multi:checked").length;
			if (len>1) {
				popup('/pop.php?action=view&ads='+ads,len);
			}
			else {
				alert('Необходимо выбрать не менее 2-х объявлений.');
			}
			return false;
		});
		
		$("ul.thumbs li img").click ( function () {
			var thepic=$(this).attr("src");
			$(this).parent().parent().siblings("div.zoomed").children("img").attr("src",thepic);
			$(this).parent().siblings().removeClass("zooming");
			$(this).parent().addClass("zooming")
			//alert(thepic);
			return false;
		
		
		});
	
		$("span.commentshower").click( function () {
			$(this).parent().parent().parent().parent("td").parent("tr").next().children("td[colspan=2]").children("div.commentbox").toggle("slow");
		
		}); 
		
		$("table.tabled tr").mouseover ( function () {
			$(this).addClass("hovered");
		});
		$("table.tabled tr").mouseout ( function () {
			$(this).removeClass("hovered");
		});
		
		$("img.opener").click ( function () {
		
		});
	
		$("select#catparent").change ( function () {
			$("select.subcat").hide();
			$("span#rarr").show();
			var selval= $("select#catparent option:selected").attr("value");
			$("select#cat-"+selval).show();
			$("select#cat-"+selval).attr("name","category");
		
		});
		
	$("td.hot-arrow").click (function () {
		var slide=$("ul.hot-slider-list").attr("slide");
		slide=(slide*1);
		var totslides=$("ul.hot-slider-list").attr("totslides");
		totslides=(totslides*1);
		// item width = 192
		//alert(slide + ' + ' +totslides);
		var w=192*3;
		
		var vector=$(this).attr("vector");
		//alert(vector);
		if (vector=='rightarrow') {
			newslide=slide+1;
			//alert(newslide);
			$("ul.hot-slider-list").attr("slide",newslide);
			if (newslide<=totslides) {
			var offset=-w*slide;
			$("ul.hot-slider-list").animate (
				{left: offset},{
				duration: 'slow'
				}
			);
			}
			else {
				newslide=newslide-1;
			}
			$("ul.hot-slider-list").attr("slide",newslide);
		}
		else if (vector=='leftarrow') {
			
			newslide=slide-1;
			//alert(newslide);
			$("ul.hot-slider-list").attr("slide",newslide);
			
			if (newslide>0) {
			var offset=(newslide*w)-w;
			//alert(offset);
			$("ul.hot-slider-list").animate (
				{left: -offset},{
				duration: 'slow'
				}
			);
			}
			else {
				newslide=newslide+1;
			}
			$("ul.hot-slider-list").attr("slide",newslide);
		}
		
		if (newslide>=totslides) {
				$("td.rightarrow").addClass('inactive');
				$("td.rightarrow").children("img").attr("src",'/img/arrow-right-trans.jpg');
				//alert('pass');
			}
			else {
				$("td.rightarrow").removeClass("inactive");
				$("td.rightarrow").children("img").attr("src",'/img/arrow-right.jpg');
			}
			
			if (newslide>=2) {
				$("td.leftarrow").children("img").attr("src","/img/arrow-left.jpg");
				$("td.leftarrow").removeClass("inactive");
			}
			else {
				$("td.leftarrow").children("img").attr("src","/img/arrow-left-trans.jpg");
				$("td.leftarrow").addClass("inactive");
			}
			//alert('slide='+slide+'; newslide='+newslide);
	});
	
	
	
	
	});
	
	
function refreshParent() {
  window.opener.location.href = window.opener.location.href;

  if (window.opener.progressWindow)
		
 {
    window.opener.progressWindow.close()
  }
  window.close();
}

	
	
/* Modified To support Opera */
function bookmark(title,url){
var an=navigator.appName;
if (window.external) {
    window.external.AddFavorite(url, title);
	return false;
}

}
