<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>{echo: lp{m_u_center};/}</title>
<link rel="stylesheet" type="text/css" href="skin/{echo: $SYSINFO['templates'];/}/css/modules.css">
<link rel="stylesheet" type="text/css" href="skin/{echo: $SYSINFO['templates'];/}/css/layout.css">
<link rel="stylesheet" type="text/css" href="skin/{echo: $SYSINFO['templates'];/}/css/style.css">
<style type="text/css">
.red{color:red;}
.templageimg span{float:left; display:block; text-align:left; margin-left:1px;}
.templageimg img{border:2px solid #eee; cursor:pointer;}
</style>
</head>
<script type="text/javascript" src="servtools/jquery-1.3.2.min.js?v=1.3.2"></script>
<script type="text/javascript" src="servtools/xheditor/xheditor.min.js?v=1.0.0-final"></script>
<script type="text/javascript">
var introeditor;
$(function(){
	introeditor=$("#shop_intro").xheditor({skin:'vista',tools:"Cut,Copy,Paste,Pastetext,Separator,Blocktag,Fontface,FontSize,Bold,Italic,Underline,Strikethrough,FontColor,BackColor,SelectAll,Removeformat,Separator,Align,List,Outdent,Indent,Separator,Link,Unlink,Img,Table,Separator,Source,Fullscreen,About"});

});
</script>
<body>
	{inc: require("shop/index_header.php");/}
	<div class="site_map">
	  {echo:lp{m_current_position};/}<A href="index.php">{echo:$SYSINFO['sys_name'];/}</A>/<a href="modules.php">{echo:lp{m_u_center};/}</a>/&nbsp;&nbsp;{echo:lp{m_create_shop};/}
	</div>
    <div class="clear"></div>
    <div class="apart">
    	{inc: require("modules/left_menu.php");/}
        <div class="main_right">
        	<div class="right_top"></div>
            <div class="cont">
                <div class="cont_title">{echo: lp{m_create_shop};/}</div>
                <div id="stepTip">
			     <ul class="list_step clearfix">
			     <li>{echo: lp{m_u_first};/}:<br />{echo: lp{m_a_info};/}</li>
			     <li class="now">{echo: lp{m_u_secound};/}:<br />{echo: lp{m_a_shop_info};/}</li>
			     <li>{echo: lp{m_u_third};/}:<br />{echo: lp{m_a_manager_info};/}</li>
			     <li style="padding-right:0">{echo: lp{m_u_fore};/}:<br />{echo: lp{m_accomplish};/}</li>
			     </ul>
			     </div>
                <hr />
			<form action="do.php?act=shop_create" method="post" name="form_shop_create" onsubmit="return checkForm();">
			<table width="100%" border="0" cellspacing="0">
				<tr><td class="textright" width="15%">{echo: lp{m_shop_name};/}:</td>
					<td><input type="text" name="shop_name" value="{echo: $shop_info['shop_name'];/}" style="width:250px;" maxlength="50" />
						<span class="red">*</span></td></tr>
				<tr><td class="textright" width="15%">{echo: lp{m_shop_categories};/}:</td>
						<td style="float:none;">
							<span id="shop_country">
								<select name="categories_parent" onchange="categorieschanged(this.value)">
									<option value='0'>{echo: lp{m_select_categories};/}</option>
									{sta: foreach($shop_categories_parent as $v) [loop]}
										<option value="{echo: $v['cat_id'];/}">{echo: $v['cat_name'];/}</option>
									{end:foreach/}
								</select>
							</span>
							<span id="shop_categories">
	
							</span>
						<span class="red">*</span>
						</td>
				</tr>
				<tr>
					<td class="textright">{echo: lp{m_stayarea};/}:</td>
					<td>
						<span id="shop_country"><select name="country" onchange="areachanged(this.value,0);">
							<option value='0'>{echo: lp{m_select_country};/}</option>
						{sta: foreach($areas_info[0] as $v) [loop]}
							<option value="{echo: $v['area_id'];/}" {sta: if($v['area_id']==$shop_info['shop_country']){echo 'selected';if/}>
								{echo: $v['area_name'];/}</option>
						{end:foreach/}
						</select></span>
						<span id="shop_province">{sta: if($shop_info['shop_country'])[exc]}
						<select name="province" onchange="areachanged(this.value,1);">
							<option value='0'>{echo: lp{m_select_province};/}</option>
						{sta: foreach($areas_info[1] as $v) {
								if($v['parent_id'] == $shop_info['shop_country']) [exc]}
							<option value="{echo: $v['area_id'];/}" {sta: if($v['area_id']==$shop_info['shop_province']){echo 'selected';if/}>
								{echo: $v['area_name'];/}</option>
						  {end:if/}
							{end:foreach/}
						</select>
						{end:if/}</span>
						<span id="shop_city">{sta: if($shop_info['shop_province']) [exc]}
						<select name="city" onchange="areachanged(this.value,2);">
							<option value='0'>{echo: lp{m_select_city};/}</option>
						{sta: foreach($areas_info[2] as $v) {
								if($v['parent_id'] == $shop_info['shop_province'])[exc]}
							<option value="{echo: $v['area_id'];/}" {sta: if($v['area_id']==$shop_info['shop_city']){echo 'selected';if/}>
								{echo: $v['area_name'];/}</option>
						{end:if/}
						{end: foreach/}</select>
						{end:if/}</span>
						<span id="shop_district">{sta: if($shop_info['shop_city']) [exc]}
						<select name="district">
							<option value='0'>{echo: lp{m_select_district};/}</option>
						{sta:foreach($areas_info[3] as $v) {
								if($v['parent_id'] == $shop_info['shop_city']) [exc]}
							<option value="{echo: $v['area_id'];/}" {sta: if($v['area_id']==$shop_info['shop_district']){echo 'selected';if/}>{echo: $v['area_name'];/}</option>
						{end:if/}
						{end:foreach/}</select>
						{end:if/}</span>
					<span class="red">*</span></td>
				</tr>
				<tr><td class="textright">{echo: lp{m_address};/}:</td><td><input type="text" name="shop_address" value="{echo: $shop_info['shop_address'];/}" style="width:250px;" maxlength="200" /> <span class="red">*</span></td></tr>
				<tr><td class="textright">{echo: lp{m_shop_management};/}:</td><td><input type="text" name="shop_management" value="{echo: $shop_info['shop_management'];/}" style="width:250px;" maxlength="200" /> <span class="red">*</span></td></tr>
				<tr><td class="textright">{echo: lp{m_select_template};/}:</td><td class="templageimg">
				{sta: foreach($shoptemplate_arr as $v) [loop]}
					<span><img src="{echo: $v['imgurl'];/}" width="95" alt="{echo: $v['tplname'];/}" onclick="wshowimg('{echo: $v['bigimgurl'];/}')" onmouseover="imgmover(this)" onmouseout="imgmout(this)" onerror="this.src='skin/default/images/nopic.gif'"/><br /><input type="radio" name="shop_template" value="{echo: $v['tpltag'];/}" {sta: if($shop_info['shop_template']==$v['tpltag']) [exc]} checked{end:if/} /> {echo: $v['tplname'];/}</span>
				{end:foreach/}
				</td></tr>
				<tr style="line-height:18px;"><td class="textright">{echo: lp{m_shop_intro};/}:</td><td>
				<textarea name="shop_intro" id="shop_intro" cols="75" rows="5">{echo: $shop_info['shop_intro'];/}</textarea>
				</td></tr>
				<tr><td colspan="2" align="center"><input type="submit" name="submit" value="{echo: lp{m_create_shop};/}" /></td></tr>
			</table>
		</form>
            </div>
			<div class="right_bottom"></div>
			<div class="back_top"><a href="#"></a></div>
        </div>
    <div class="clear"></div>
    {inc: require("shop/index_footer.php");/}
<div id="showimg" style="display:none; width:408px; text-align:center; border:5px solid #F6A248; position:absolute; padding:4px; background:#fff; top:200px;"><img id="imgsrc" src="skin/default/images/shop_template_default_big.gif" width="400" /></div>
<div style="width:0px; height:0px; overflow:hidden;"><input type="input" id="hiddeninput" onblur="whideimg()" /></div>
<script language="JavaScript" src="servtools/ajax_client/ajax.js"></script>
<script language="JavaScript">
<!--
var utype = '';
function areachanged(value,type){
	utype = type;
	if(value > 0) {
		ajax("do.php?act=ajax_areas","POST","value="+value+"&type="+type);
	} else {
		if(type==2) {
			hide("shop_district");
		} else if(type==1) {
			hide("shop_district");
			hide("shop_city");
		} else if(type==0) {
			hide("shop_district");
			hide("shop_city");
			hide("shop_province");
		}
	}
}

function categorieschanged(value){
	if(value > 0) {
		ajax("do.php?act=ajax_categories","POST","value="+value,function(return_text){
			return_text = return_text.replace(/[\n\r]/g,"");
			document.getElementById("shop_categories").innerHTML = return_text;
			show("shop_categories");
		});
	}
}

function ajaxCallback (return_text){
	return_text = return_text.replace(/[\n\r]/g,"");
	if(return_text==""){
		alert("{echo: lp{m_select_again};/}");
	} else {
		if(utype==0) {
			document.getElementById("shop_province").innerHTML = return_text;
			show("shop_province");
			hide("shop_city");
			hide("shop_district");
		} else if(utype==1) {
			document.getElementById("shop_city").innerHTML = return_text;
			show("shop_city");
			hide("shop_district");
		} else if(utype==2) {
			document.getElementById("shop_district").innerHTML = return_text;
			show("shop_district");
		}
	}
}

function hide(id) {
	document.getElementById(id).style.display = 'none';
}
function show(id) {
	document.getElementById(id).style.display = '';
}

function checkForm() {
	var shop_name = document.getElementsByName("shop_name")[0];
	var shop_address = document.getElementsByName("shop_address")[0];
	var shop_management = document.getElementsByName("shop_management")[0];
	if(shop_name.value=='') {
		alert("{echo: lp{m_shopname_notnone};/}");
		shop_name.focus();
		return false;
	} else if(document.getElementsByName("country")[0].value==0) {
		alert("{echo: lp{m_select_countrypl};/}");
		return false;
	} else if(document.getElementsByName("province")[0].value==0) {
		alert("{echo: lp{m_select_provincepl};/}");
		return false;
	} else if(document.getElementsByName("city")[0].value==0) {
		alert("{echo: lp{m_select_citypl};/}");
		return false;
	} else if(document.getElementsByName("district")[0].value==0) {
		alert("{echo: lp{m_select_districtpl};/}");
		return false;
	} else if(shop_address.value=='') {
		alert("{echo: lp{m_address_notnone};/}");
		shop_address.focus();
		return false;
	} else if(shop_management.value=='') {
		alert("{echo: lp{m_shopmanagement_notnone};/}");
		shop_management.focus();
		return false;
	}
	return true;
}

function imgmover(obj) {
	obj.style.border = '2px solid #E38016';
}

function imgmout(obj) {
	obj.style.border = '2px solid #eee';
}

function wshowimg(v) {
	var width = document.body.clientWidth;
	var showimg = document.getElementById("showimg");
	var imgsrc = document.getElementById("imgsrc");

	var left = "100";
	if(width) {
		left = (width-400)/2;
	}
	showimg.style.left = left+"px";
	showimg.style.display = '';
	imgsrc.src = v;
	document.getElementById("hiddeninput").focus();
}

function whideimg() {
	var showimg = document.getElementById("showimg");
	showimg.style.display = 'none';
}
//-->
</script>
</body>
</html>