// JavaScript Document

var open_or_close = "open";
var speed = 5;
var step = 20;
var area;
var timer1;
var timer2;
var list_div;

function init() {
	// nothing to do
}
function get_shop(ar, ac) {
	list_div = document.getElementById('shoplist');
	open_or_close = ac;
	clearTimeout(timer1);
	clearTimeout(timer2);
	if (open_or_close == "open") {
		area = ar;
		list_div.innerHTML = get_html(area);
		list_div.style.display = 'block';
		open_shop_list();
	} else if (open_or_close == "close") {
		timer2 = setTimeout("close_shop_list()", 2000);
	}
}
function open_shop_list() {
	if (list_div.style.height < 1) {
		list_div.style.height = 1;
	}
	if (list_div.offsetHeight < list_div.scrollHeight) {
        if (list_div.scrollHeight - list_div.offsetHeight >= step) {
		    list_div.style.height = list_div.offsetHeight + step;
        }
        if (list_div.scrollHeight - list_div.offsetHeight < step) {
            list_div.style.height = list_div.offsetHeight + (list_div.scrollHeight - list_div.offsetHeight);
        }
		timer1 = setTimeout("open_shop_list()", speed);
	}
}
function close_shop_list() {
	list_div.style.display = 'block';
	if (list_div.offsetHeight > step) {
		list_div.style.height = list_div.offsetHeight - step;
		timer1 = setTimeout("close_shop_list()", speed);
	}
	if (list_div.offsetHeight <= step) {
		list_div.style.display = "none";
	}
	
}
function get_html(area) {
	html = "";
	if (area == "shanghai") {
		html += '<div style="border:1px solid #6c8aba;margin-top:-1px;">';
		html += '<p style="margin-left:20px;padding-top:10px;"><strong>上海知名美发沙龙</strong></p>';
		html += '<p style="margin:1px 15px 0 15px;margin-top:1px;font-size:1px;width:100%;line-height:2px;border-bottom:1px solid #cccccc;"></p>';
		html += '<p style="margin:5px 0 5px 15px;"><span>卢湾区: </span><span style="margin:0 0 0 5px;"><a href="/silu/shop/200/dongtian.html" target="_blank">东田造型</a></span><span style="margin:0 0 0 10px;"><a href="/silu/shop/200/xinzhizao.html" target="_blank">新制造</a></span></p>';
		html += '<p style="margin:5px 0 5px 15px;"><span>静安区: </span><span style="margin:0 0 0 5px;"><a href="/silu/shop/200/exy.html" target="_blank">EXY</a></span></p>';
		html += '<p style="margin:5px 0 5px 15px;"><span>闸北区: </span><span style="margin:0 0 0 5px;"><a href="/silu/shop/200/fayi.html" target="_blank">发艺联盟</a></span></p>';
		html += '<p style="margin:5px 0 5px 15px;"><span>徐汇区: </span><span style="margin:0 0 0 5px;"><a href="/silu/shop/200/modu.html" target="_blank">摩都发艺</a></span><span style="margin:0 0 0 10px;"><a href="/silu/shop/200/dada.html" target="_blank">DADA</a></span></p>';
		html += '<p style="margin:5px 0 5px 15px;"><span>浦东新区: </span><span style="margin:0 0 0 5px;"><a href="/silu/shop/200/miso.html" target="_blank">MISO</a></span></p>';
		html += '</div>';
	}
	if (area == "beijing") {
		html += '<div style="border:1px solid #6c8aba;margin-top:-1px;">';
		html += '<p style="margin-left:20px;padding-top:10px;"><strong>北京知名美发沙龙</strong></p>';
		html += '<p style="margin:1px 15px 0 15px;margin-top:1px;font-size:1px;width:100%;line-height:2px;border-bottom:1px solid #cccccc;"></p>';
		html += '<p style="margin:5px 0 5px 15px;"><span>朝阳区: </span><span style="margin:0 0 0 5px;"><a href="/silu/shop/100/kilala.html" target="_blank">KILALA</a></span></p>';
		
		html += '</div>';
	}
	return html;
}