$(document).ready(function(){
	$('.open_blocks a').each(function(index){
		$(this).attr('alt',$(this).attr('href')).attr('href','javascript:;');
		if(!$(this).hasClass('block_active'))	$('.open_blocks .sub_links').eq(index).slideUp(0);
	});
	
	$('.open_blocks a').click(function(){
		$(this).toggleClass('block_active');
		$('#'+$(this).attr('alt')).stop(true,true).slideToggle('fast');
	});
	
});

$(document).ready(function() {
  $('#citiesNav a').click(function(e) {
    e.preventDefault();
    $('#citiesNav a, #citiesInfo .itm').removeClass('active');
    $(this).addClass('active');
    $('#cityItm_'+$(this).attr('id').replace('cityNav_', '')).addClass('active');
	$.get('',{new_city: $(this).attr('id').replace('cityNav_', '')});
	})	
  });

function anchorScroller(el, duration) {
	if (this.criticalSection) {
		return false;
	}
 
	if ((typeof el != 'object') || (typeof el.href != 'string')) return true;
 
	var address = el.href.split('#');
	if (address.length < 2)	return true;
 
	address = address[address.length-1];
	el = 0;
 
	for (var i=0; i<document.anchors.length; i++) {
		if (document.anchors[i].name == address) {
			el = document.anchors[i];
			break;
		}
	}
	
	if (el === 0) return true;
 
	this.stopX = 0;
	this.stopY = 0;
	do {
		this.stopX += el.offsetLeft;
		this.stopY += el.offsetTop;
		} while (el = el.offsetParent);
 
	this.startX = document.documentElement.scrollLeft || window.pageXOffset || document.body.scrollLeft;
	this.startY = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop;
 
	this. stopX = this.stopX - this.startX;
	this.stopY = this.stopY - this.startY;
 
	if ( (this.stopX == 0) && (this.stopY == 0) )return false;
 
	this.criticalSection = true;
	if (typeof duration == 'undefined')
		this.duration = 500;
	else
		this.duration = duration;
 
	var date = new Date();
	this.start = date.getTime();
	this.timer = setInterval(function () {
		var date = new Date();
		var X = (date.getTime() - this.start) / this.duration;
		if (X > 1)
			X = 1;
		var Y = ((-Math.cos(X*Math.PI)/2) + 0.5);
 
		cX = Math.round(this.startX + this.stopX*Y);
		cY = Math.round(this.startY + this.stopY*Y);
 
		document.documentElement.scrollLeft = cX;
		document.documentElement.scrollTop = cY;
		document.body.scrollLeft = cX;
		document.body.scrollTop = cY;
	
		if (X == 1) {
			clearInterval( this.timer);
			this.criticalSection = false;
		}
	}, 10);
	return false;
}

function doClear(theText) { if (theText.value == theText.defaultValue) { theText.value = "" } }
function doDefault(theText) { if (theText.value == "") { theText.value = theText.defaultValue } }


 $(function() {
	$("#triggers a[rel]").overlay({effect: 'apple'});
});  


(function($) {
$(function() {

	$('ul.tab_tabs').delegate('li:not(.tab_current)', 'click', function() {
		$(this).addClass('tab_current').siblings().removeClass('tab_current')
			.parents('div.tab_section').find('div.tab_box').hide().eq($(this).index()).fadeIn(150);
		$.get('',{new_city: $(this).attr('id')});
	})
	/* map.redraw(); */

})
})(jQuery)

/* (function($) {
$(function() {

	function createCookie(name,value,days) {
		if (days) {
			var date = new Date();
			date.setTime(date.getTime()+(days*24*60*60*1000));
			var expires = "; expires="+date.toGMTString();
		}
		else var expires = "";
		document.cookie = name+"="+value+expires+"; path=/";
	}
	function readCookie(name) {
		var nameEQ = name + "=";
		var ca = document.cookie.split(';');
		for(var i=0;i < ca.length;i++) {
			var c = ca[i];
			while (c.charAt(0)==' ') c = c.substring(1,c.length);
			if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
		}
		return null;
	}
	function eraseCookie(name) {
		createCookie(name,"",-1);
	}

	$('ul.tab_tabs').each(function(i) {
		var cookie = readCookie('tabCookie'+i);
		if (cookie) $(this).find('li').eq(cookie).addClass('tab_current').siblings().removeClass('tab_current')
			.parents('div.tab_section').find('div.tab_box').hide().eq(cookie).fadeIn(150).show();
	})

	$('ul.tab_tabs').delegate('li:not(.tab_current)', 'click', function() {
		$(this).addClass('tab_current').siblings().removeClass('tab_current')
			.parents('div.tab_section').find('div.tab_box').hide().eq($(this).index()).show();
		var ulIndex = $('ul.tab_tabs').index($(this).parents('ul.tab_tabs'));
		eraseCookie('tabCookie'+ulIndex);
		createCookie('tabCookie'+ulIndex, $(this).index(), 365);
	})

})
})(jQuery) */
