jQuery.noConflict();

jQuery(document).ready(function() {
								
	jQuery("div.scrollable .items a").each(function(i, domElement){
		jQuery(domElement).click(function() {
			var location = new String();
			location = jQuery(this).attr("href");
			document.location = "http://wa.net.ua" + location.substr(location.indexOf("#") + 1);
		});
	});
	jQuery("div.scrollable").scrollable({
		vertical:true,
		size:3,
		next: "#next-client",
		prev: "#previous-client"
		//api: true,
		//onSeek: function() { 
			//var location = new String();
			//location = jQuery("div.scrollable .items a").eq(this.getPageIndex()).attr("href");
			//document.location = "http://wa.net.ua" + location.substr(location.indexOf("#") + 1);
    	//}
	}).mousewheel().autoscroll({ autoplay: true, interval: 5000 });
	/*api.onClick(function(event) {
		var location = new String();
		alert("aaaa");
		
	});*/
	jQuery("#next-client").click(function() {return false;});
	jQuery("#previous-client").click(function() {return false;});
	
	jQuery("ul.tabs").tabs("div.panes > div",{effect: 'default', onClick: function() {return false;},onBeforeClick: function(event, tabIndex) {
        //i = this.getCurrentTab(); 
		jQuery("ul.tabs a").removeClass("current").eq(tabIndex).addClass("current");
    }}); 
	//jQuery("ul.tabs a").click(function() {return false;});
	jQuery("div.tabs-holder > div").scrollable({item:"li", size:3, clickable: true }).mousewheel();
	
	var sl = setInterval(function(){
		var item = jQuery('.slider .active');
		var next;
		item.removeClass('active').animate({opacity:0},700,function(){
			if(!item.next().length)
				next = jQuery('.slider a:first');
			else
				next = item.next();
			//console.log(next.attr('href'));
			next.addClass('active').css({display:'block'}).animate({opacity:1},700);
			jQuery(this).hide();
		});
	},5000);
});

function change_city(city){
	jQuery("span[id$='_city']").hide();
	jQuery("span[id$='_code']").hide();
	jQuery("span[id$='_phone']").hide();
	jQuery("span#" + city + "_code").show();
	jQuery("span#" + city + "_phone").show();
	jQuery("span#" + city + "_city").show();
	jQuery("span#" + city + "_code").css('display','block');
	jQuery("span#" + city + "_phone").css('display','block');
	jQuery("span#" + city + "_city").css('display','block');
}
function externalLinks() {
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a");
for (var i=0; i < anchors.length; i++) {
	if (anchors[i].getAttribute("href") &&

	anchors[i].getAttribute("class") == "blank") {
		anchors[i].target = "_blank";
	}
}
}
window.onload = externalLinks;
