function $_(n) {
	if(!n) return false;
	if(!document.getElementById(n)) return false;
	return document.getElementById(n)
}

/*
var splash = new Array();
splash[0] = "#URL#images/i/splash/bussines_inner.jpg";
splash[1] = "#URL#images/i/splash/love_inner.jpg";
splash[2] = "#URL#images/i/splash/friends_inner.jpg";
  
function random_splash() {
	if (typeof(splash) != "undefined" && splash.length > 0) {
		i = Math.round(Math.random() * (splash.length - 1));
		$_("splash").style.backgroundImage = "url(" + splash[i] + ")";
	}
}
	
onload=function () {
	//if ($_("splash")) random_splash();
}
*/

function locator(url) {
	pos_left = (screen.width) ? (screen.width-670)/2 : 0;
	pos_top  = (screen.height) ? (screen.height-520)/3 : 0;

	settings = "width=670,height=520,top=" + pos_top + ",left=" + pos_left + ",scrollbars=yes";
	win = window.open(url,"locator",settings)
	win.focus();
}

function mycup(url) {
	pos_left = (screen.width) ? (screen.width-650)/2 : 0;
	pos_top  = (screen.height) ? (screen.height-605)/3 : 0;

	settings = "width=770,height=605,top=" + pos_top + ",left=" + pos_left + ",scrollbars=no";
	win = window.open(url,"mycup",settings)
	win.focus();
}

function winpop(url) {
	pos_left = (screen.width) ? (screen.width-650)/2 : 0;
	pos_top  = (screen.height) ? (screen.height-520)/3 : 0;

	settings = "width=770,height=620,top=" + pos_top + ",left=" + pos_left + ",scrollbars=yes";
	win = window.open(url,"popup",settings)
	win.focus();
}

function select_show(this_el) {
	this_el.className = "select select-show";
}

function select_hide(this_el) {
	this_el.className = "select select-hide";
}

function toggle_dlist(_this, id, g) {
	if($_(g) && $_(id)) {
		if(_this.parentNode.className.indexOf("active") == -1) {
			$("#"+g+" dt").removeClass("active");
			$("#"+g+" dd").css({display:"none"});
			$("#"+id).slideDown("slow");
			$(_this.parentNode).addClass("active");
		} else {
			$("#"+id).slideUp("slow");
			$(_this.parentNode).removeClass("active");
		}
	}
}


$(document).ready(
	function() {	
		$("#shop-address h3 span").click(
			function()	{
				this.className = this.className == "" ? "hide" : "";
				$("#address_" + this.id).slideToggle("slow");
			}
		);
		
		$("div.contacts-list h3 span").click(
			function()	{
				if ($("#contacts_" + this.id).css("display") == "block") {
					this.className = "";
					$("#contacts_" + this.id).css({display:"none"});
				} else {
					this.className = "hide";
					$("#contacts_" + this.id).css({display:"block"});
				}
			}
		);
	}
);

