$(document).ready(function () {
	var pathToTpl = "/tpl/img/";
	
	$("#socialnet li").css("opacity", 0.3);
	$("#socialnet li").hover(
		function() { $(this).animate( { opacity: 0 } ); },
		function() { $(this).animate( { opacity: 0.3 } ); }
	);
	
	popupGif = new Image();
	popupGif.src = pathToTpl + "popup.gif";
	
	popupPng = new Image();
	popupPng.src = pathToTpl + "popup.png";
	
	arPng = new Image();
	arPng.src = pathToTpl + "redp.gif";
	
	
	$(".linktel a").click(function(){
		$('#alltel').fadeIn();
		$(this).css("border","none");
		return false; 
	});
	
	$('body').click(function(){
		$("#alltel").fadeOut();
		$(".linktel a").css("border-bottom","1px dotted #ffffff");
	});
	

	$(".pflink").hover(
		function(){ 
			$(this).css("background-color", "#eeeeee");
			$(this).find(".pfred").css("display", "block");
		},
		function(){ 
			$(this).css("background-color", "transparent");
			$(this).find(".pfred").css("display", "none");
		}
	);
	
	$('.city').click(function(){
		$(this).children('a').toggleClass('clicked');
		$(this).next('.tel_email').toggleClass('tel_email_color');
		$(this).next('.tel_email').children('#detail').slideToggle('slow');
		return false;
	});
	
	toggleCity(location.hash);
		
	$('#alltel a, #alltel div.city').click(function(){
		contUrl = this.href;
		contHash = this.hash;
		if(!contUrl){
			var aObj = $(this).parent();
			contUrl = aObj.attr('href');
			contHash = aObj.attr('hash');

		}
		toggleCity(location.hash);
		toggleCity(contHash);
		location.href = contUrl;
		return false;
	});
});

function toggleCity(str){
	var citySel = $(str);
	citySel.children('a').toggleClass('clicked');
	citySel.next('.tel_email').toggleClass('tel_email_color');
	citySel.next('.tel_email').children('#detail').slideToggle('slow');
}
