<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="tgproAdd.aspx.cs" Inherits="web.admin.tgproAdd" %>

<%@ Register Assembly="FredCK.FCKeditorV2" Namespace="FredCK.FCKeditorV2" TagPrefix="FCKeditorV2" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
	
	<HEAD>
		<title>ProductAdd</title><meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />

		<LINK href="images/adminstyle.css" type="text/css" rel="stylesheet">


<style type="text/css">
body {margin:0px; height:768px}
</style>

	<script>
/*
 *加入人： ocean chou 
 *使用方法：
 * (1)只选择日期   <input type="text" name="date"   readOnly onClick="setDay(this);">
 * (2)选择日期和小时  <input type="text" name="dateh"  readOnly onClick="setDayH(this);">
 * (3)选择日期和小时及分钟 <input type="text" name="datehm" readOnly onClick="setDayHM(this);">
 *设置参数的方法
 * (1)设置日期分隔符    setDateSplit(strSplit);默认为"-"
 * (2)设置日期与时间之间的分隔符  setDateTimeSplit(strSplit);默认为" "
 * (3)设置时间分隔符    setTimeSplit(strSplit);默认为":"
 * (4)设置(1),(2),(3)中的分隔符  setSplit(strDateSplit,strDateTimeSplit,strTimeSplit);
 * (5)设置开始和结束年份    setYearPeriod(intDateBeg,intDateEnd)
 *说明：
 * 默认返回的日期时间格式类似：2005-02-02 08:08
 */
 
//------------------ 样式定义 ---------------------------//
//功能按钮同样样式
var s_sss_turn_base = "height:16px;font-size:9pt;color:#000000;border:1 solid #CCCCCC;cursor:hand;background-color:#333;";
//翻年、月等的按钮
var s_sss_turn = "width:28px;" + s_sss_turn_base;
//关闭、清空等按钮样式
var s_sss_turn2 = "width:22px;" + s_sss_turn_base;
//年选择下拉框
var s_sss_select = "width:64px;display:none;";
//月、时、分选择下拉框
var s_sss_select2 = "width:46px;display:none;";
//日期选择控件体的样式
var s_sss_body = "width:150;background-color:#2650A6;display:none;z-index:9998;position:absolute;" +
  "border-left:1 solid #CCCCCC;border-top:1 solid #CCCCCC;border-right:1 solid #999999;border-bottom:1 solid #999999;";
//显示日的td的样式
var s_sss_day = "width:21px;height:20px;background-color:#D8F0FC;font-size:10pt;";
//字体样式
var s_sss_font = "color:#FFCC00;font-size:9pt;cursor:hand;";
//链接的样式
var s_sss_link = "text-decoration:none;font-size:9pt;color:#2650A6;";
//横线
var s_sss_line = "border-bottom:1 solid #6699CC";
//------------------ 变量定义 ---------------------------//

var sssYearSt = 1950;//可选择的开始年份
var sssYearEnd = 2050;//可选择的结束年份
var sssDateNow = new Date();
var sssYear = sssDateNow.getFullYear(); //定义年的变量的初始值
var sssMonth = sssDateNow.getMonth()+1; //定义月的变量的初始值
var sssDay = sssDateNow.getDate();
var sssHour = 8;//sssDateNow.getHours();
var sssMinute = 0;//sssDateNow.getMinutes();
var sssArrDay=new Array(42);          //定义写日期的数组
var sssDateSplit = "-";     //日期的分隔符号
var sssDateTimeSplit = " ";    //日期与时间之间的分隔符
var sssTimeSplit = ":";     //时间的分隔符号
var sssOutObject;      //接收日期时间的对象
var arrsssHide = new Array();//被强制隐藏的标签
var m_bolShowHour = false;//是否显示小时
var m_bolShowMinute = false;//是否显示分钟

var m_aMonHead = new Array(12);         //定义阳历中每个月的最大天数
    m_aMonHead[0] = 31; m_aMonHead[1] = 28; m_aMonHead[2] = 31; m_aMonHead[3] = 30; m_aMonHead[4]  = 31; m_aMonHead[5]  = 30;
    m_aMonHead[6] = 31; m_aMonHead[7] = 31; m_aMonHead[8] = 30; m_aMonHead[9] = 31; m_aMonHead[10] = 30; m_aMonHead[11] = 31;
// ---------------------- 用户可调用的函数 -----------------------------//
//用户主调函数－只选择日期
function setDay(obj){
 sssOutObject = obj;
 //如果标签中有值，则将日期初始化为当前值
 var strValue = sssTrim(sssOutObject.value);
 if( strValue != "" ){
  sssInitDate(strValue);
 }
 sssPopCalendar();
}
//用户主调函数－选择日期和小时
function setDayH(obj){
 sssOutObject = obj;
 m_bolShowHour = true;
 //如果标签中有值，则将日期和小时初始化为当前值
 var strValue = sssTrim(sssOutObject.value);
 if( strValue != "" ){
  sssInitDate(strValue.substring(0,10));
  var hour = strValue.substring(11,13);
  if( hour < 10 ) sssHour = hour.substring(1,2);
 }
 sssPopCalendar();
}
//用户主调函数－选择日期和小时及分钟
function setDayHM(obj){
 sssOutObject = obj;
 m_bolShowHour = true;
 m_bolShowMinute = true;
 //如果标签中有值，则将日期和小时及分钟初始化为当前值
 var strValue = sssTrim(sssOutObject.value);
 if( strValue != "" ){
  sssInitDate(strValue.substring(0,10));
  var time = strValue.substring(11,16);
  var arr = time.split(sssTimeSplit);
  sssHour = arr[0];
  sssMinute = arr[1];
  if( sssHour < 10 ) sssHour = sssHour.substring(1,2);
  if( sssMinute < 10 ) sssMinute = sssMinute.substring(1,2);
 }
 sssPopCalendar();
}
//设置开始日期和结束日期
function  setYearPeriod(intDateBeg,intDateEnd){
 sssYearSt = intDateBeg;
 sssYearEnd = intDateEnd;
}
//设置日期分隔符。默认为"-"
function setDateSplit(strDateSplit){
 sssDateSplit = strDateSplit;
}
//设置日期与时间之间的分隔符。默认为" "
function setDateTimeSplit(strDateTimeSplit){
 sssDateTimeSplit = strDateTimeSplit;
}
//设置时间分隔符。默认为":"
function setTimeSplit(strTimeSplit){
 sssTimeSplit = strTimeSplit;
}
//设置分隔符
function setSplit(strDateSplit,strDateTimeSplit,strTimeSplit){
 sssDateSplit(strDateSplit);
 sssDateTimeSplit(strDateTimeSplit);
 sssTimeSplit(strTimeSplit);
}
//设置默认的日期。格式为：YYYY-MM-DD
function setDefaultDate(strDate){
 sssYear = strDate.substring(0,4);
 sssMonth = strDate.substring(5,7);
 sssDay = strDate.substring(8,10);
}
//设置默认的时间。格式为：HH24:MI
function setDefaultTime(strTime){
 sssHour = strTime.substring(0,2);
 sssMinute = strTime.substring(3,5);
}
// ---------------------- end 用户可调用的函数 -----------------------------//
//------------------ begin 页面显示部分 ---------------------------//
var weekName = new Array("日","一","二","三","四","五","六");
document.write('<div id="divsssDate" style="'+s_sss_body+'" >');
document.write('<div align="center" id="divsssDateText" isControled="true" style="padding-top:2px;">');
document.write('<span id="sssYearHead" isControled="true" style="'+s_sss_font+'" '+
    'onclick="spanYearCEvent();">&nbsp;年</span>');
document.write('<select id="selTianYear" style="'+s_sss_select+'" isControled="true"  '+
    ' onChange="sssYear=this.value;sssSetDay(sssYear,sssMonth);document.all.sssYearHead.style.display=\'\';'+
    'this.style.display=\'none\';">');
for(var i=sssYearSt;i <= sssYearEnd;i ++){
 document.writeln('<option value="' + i + '">' + i + '年</option>');
}
document.write('</select>');
document.write('<span id="sssMonthHead" isControled="true" style="'+s_sss_font+'" '+
    'onclick="spanMonthCEvent();">&nbsp;&nbsp;月</span>');
document.write('<select id="selTianMonth" style="'+s_sss_select2+'" isControled="true" '+
    'onChange="sssMonth=this.value;sssSetDay(sssYear,sssMonth);document.all.sssMonthHead.style.display=\'\';'+
    'this.style.display=\'none\';">');
for(var i=1;i <= 12;i ++){
 document.writeln('<option value="' + i + '">' + i + '月</option>');
}
document.write('</select>');
//document.write('</div>');
//document.write('<div align="center" id="divsssTimeText" isControled="true">');
document.write('<span id="sssHourHead" isControled="true" style="'+s_sss_font+'display:none;" '+
    'onclick="spanHourCEvent();">&nbsp;时</span>');
document.write('<select id="selTianHour" style="'+s_sss_select2+'display:none;" isControled="true" '+
    ' onChange="sssHour=this.value;sssWriteHead();document.all.sssHourHead.style.display=\'\';' +
    'this.style.display=\'none\';">');
for(var i=0;i <= 23;i ++){
 document.writeln('<option value="' + i + '">' + i + '时</option>');
}
document.write('</select>');
document.write('<span id="sssMinuteHead" isControled="true" style="'+s_sss_font+'display:none;" '+
    'onclick="spanMinuteCEvent();">&nbsp;&nbsp;分</span>');
document.write('<select id="selTianMinute" style="'+s_sss_select2+'display:none;" isControled="true" '+
    '  onChange="sssMinute=this.value;sssWriteHead();document.all.sssMinuteHead.style.display=\'\';'+
    'this.style.display=\'none\';">');
for(var i=0;i <= 59;i ++){
 document.writeln('<option value="' + i + '">' + i + '分</option>');
}
document.write('</select>');
document.write('</div>');
//输出一条横线
document.write('<div style="'+s_sss_line+'"></div>');
document.write('<div align="center" id="divsssTurn" style="border:0;" isControled="true">');
document.write('<input type="button" style="'+s_sss_turn+'" value="年↑" title="上一年" onClick="sssPrevYear();">');
document.write('<input type="button" style="'+s_sss_turn+'" value="年↓" title="下一年" onClick="sssNextYear();">&nbsp;');
document.write('<input type="button" style="'+s_sss_turn+'" value="月↑" title="上一月" onClick="sssPrevMonth();">');
document.write('<input type="button" style="'+s_sss_turn+'" value="月↓" title="下一月" onClick="sssNextMonth();">');
document.write('</div>');
//输出一条横线
document.write('<div style="'+s_sss_line+'"></div>');
document.write('<table border=0 cellspacing=0 cellpadding=0  bgcolor=white onselectstart="return false">');
document.write(' <tr style="background-color:#2650A6;font-size:10pt;color:white;height:22px;" isControled="true">');
for(var i =0;i < weekName.length;i ++){
 //输出星期
 document.write('<td width="21" align="center" isControled="true">' + weekName[i] + '</td>');
}
document.write(' </tr>');
document.write('</table>');
//输出天的选择
document.write('<table border=0 cellspacing=1 cellpadding=0  bgcolor=white onselectstart="return false">');
var n = 0;
for (var i=0;i<5;i++) { 
 document.write (' <tr align=center id="trsssDay' + i + '" >');
 for (var j=0;j<7;j++){
  document.write('<td align="center" id="tdsssDay' + n + '" '+
    'onClick="sssDay=this.innerText;sssSetValue(true);" ' 
   +' style="' + s_sss_day + '">&nbsp;</td>');
  n ++;
 }
 document.write (' </tr>');
}
document.write (' <tr align=center id="trsssDay5" >');
document.write('<td align="center" id="tdsssDay35" onClick="sssDay=this.innerText;sssSetValue(true);" ' 
    +' style="' + s_sss_day + '">&nbsp;</td>');
document.write('<td align="center" id="tdsssDay36" onClick="sssDay=this.innerText;sssSetValue(true);" ' 
    +' style="' + s_sss_day + '">&nbsp;</td>');
document.write('<td align="right" colspan="5"><a href="javascript:sssClear();" style="' + s_sss_link + '">清空</a>'+
    '&nbsp;<a href="javascript:sssHideControl();" style="' + s_sss_link + '">关闭</a>' +
    '&nbsp;<a href="javascript:sssSetValue(true);" style="' + s_sss_link + '">确定</a>&nbsp;' +
    '</td>');
document.write (' </tr>');
document.write('</table>');
document.write('</div>');
//------------------ end 页面显示部分 ---------------------------//
//------------------ 显示日期时间的span标签响应事件 ---------------------------//
//单击年份span标签响应
function spanYearCEvent(){
 hideElementsById(new Array("selTianYear","sssMonthHead"),false);
 if(m_bolShowHour) hideElementsById(new Array("sssHourHead"),false);
 if(m_bolShowMinute) hideElementsById(new Array("sssMinuteHead"),false);
 hideElementsById(new Array("sssYearHead","selTianMonth","selTianHour","selTianMinute"),true);
}
//单击月份span标签响应
function spanMonthCEvent(){
 hideElementsById(new Array("selTianMonth","sssYearHead"),false);
 if(m_bolShowHour) hideElementsById(new Array("sssHourHead"),false);
 if(m_bolShowMinute) hideElementsById(new Array("sssMinuteHead"),false);
 hideElementsById(new Array("sssMonthHead","selTianYear","selTianHour","selTianMinute"),true);
}
//单击小时span标签响应
function spanHourCEvent(){
 hideElementsById(new Array("sssYearHead","sssMonthHead"),false);
 if(m_bolShowHour) hideElementsById(new Array("selTianHour"),false);
 if(m_bolShowMinute) hideElementsById(new Array("sssMinuteHead"),false);
 hideElementsById(new Array("sssHourHead","selTianYear","selTianMonth","selTianMinute"),true);
}
//单击分钟span标签响应
function spanMinuteCEvent(){
 hideElementsById(new Array("sssYearHead","sssMonthHead"),false);
 if(m_bolShowHour) hideElementsById(new Array("sssHourHead"),false);
 if(m_bolShowMinute) hideElementsById(new Array("selTianMinute"),false);
 hideElementsById(new Array("sssMinuteHead","selTianYear","selTianMonth","selTianHour"),true);
}
//根据标签id隐藏或显示标签
function hideElementsById(arrId,bolHide){
 var strDisplay = "";
 if(bolHide) strDisplay = "none";
 for(var i = 0;i < arrId.length;i ++){
  var obj = document.getElementById(arrId[i]);
  obj.style.display = strDisplay;
 }
}
//------------------ end 显示日期时间的span标签响应事件 ---------------------------//
//判断某年是否为闰年
function isPinYear(year){
 var bolRet = false;
 if (0==year%4&&((year%100!=0)||(year%400==0))) {
  bolRet = true;
 }
 return bolRet;
}
//得到一个月的天数，闰年为29天
function getMonthCount(year,month){
 var c=m_aMonHead[month-1];
 if((month==2)&&isPinYear(year)) c++;
 return c;
}
//重新设置当前的日。主要是防止在翻年、翻月时，当前日大于当月的最大日
function setRealDayCount() {
 if( sssDay > getMonthCount(sssYear,sssMonth) ) {
  //如果当前的日大于当月的最大日，则取当月最大日
  sssDay = getMonthCount(sssYear,sssMonth);
 }
}
//在个位数前加零
function addZero(value){
 if(value < 10 ){
  value = "0" + value;
 }
 return value;
}
//取出空格
function sssTrim(str) {
 return str.replace(/(^\s*)|(\s*$)/g,"");
}
//为select创建一个option
function createOption(objSelect,value,text){
 var option = document.createElement("OPTION");
 option.value = value;
 option.text = text;
 objSelect.options.add(option);
}
//往前翻 Year
function sssPrevYear() {
 if(sssYear > 999 && sssYear <10000){sssYear--;}
 else{alert("年份超出范围（1000-9999）！");}
 sssSetDay(sssYear,sssMonth);
 //如果年份小于允许的最小年份，则创建对应的option
 if( sssYear < sssYearSt ) {
  sssYearSt = sssYear;
  createOption(document.all.selTianYear,sssYear,sssYear + "年");
 }
 checkSelect(document.all.selTianYear,sssYear);
 sssWriteHead();
}

//往后翻 Year
function sssNextYear() {
 if(sssYear > 999 && sssYear <10000){sssYear++;}
 else{alert("年份超出范围（1000-9999）！");return;}
 sssSetDay(sssYear,sssMonth);
 //如果年份超过允许的最大年份，则创建对应的option
 if( sssYear > sssYearEnd ) {
  sssYearEnd = sssYear;
  createOption(document.all.selTianYear,sssYear,sssYear + "年");
 }
 checkSelect(document.all.selTianYear,sssYear);
 sssWriteHead();
}

//选择今天
function sssToday() {
 sssYear = sssDateNow.getFullYear();
 sssMonth = sssDateNow.getMonth()+1;
 sssDay = sssDateNow.getDate();
 sssSetValue(true);
 //sssSetDay(sssYear,sssMonth);
 //selectObject();
}
//往前翻月份
function sssPrevMonth() {
 if(sssMonth>1){sssMonth--}else{sssYear--;sssMonth=12;}
 sssSetDay(sssYear,sssMonth);
 checkSelect(document.all.selTianMonth,sssMonth);
 sssWriteHead();
}
//往后翻月份
function sssNextMonth() {
 if(sssMonth==12){sssYear++;sssMonth=1}else{sssMonth++}
 sssSetDay(sssYear,sssMonth);
 checkSelect(document.all.selTianMonth,sssMonth);
 sssWriteHead();
}
//向span标签中写入年、月、时、分等数据
function sssWriteHead(){
 document.all.sssYearHead.innerText = sssYear + "年";
 document.all.sssMonthHead.innerText = sssMonth + "月";
 if( m_bolShowHour )  document.all.sssHourHead.innerText = " "+sssHour + "时";
 if( m_bolShowMinute ) document.all.sssMinuteHead.innerText = sssMinute + "分";
 sssSetValue(false);//给文本框赋值，但不隐藏本控件
}
//设置显示天
function sssSetDay(yy,mm) {
  
 setRealDayCount();//设置当月真实的日
 sssWriteHead();
 var strDateFont1 = "", strDateFont2 = "" //处理日期显示的风格
 for (var i = 0; i < 37; i++){sssArrDay[i]=""};  //将显示框的内容全部清空
 var day1 = 1;
 var firstday = new Date(yy,mm-1,1).getDay();  //某月第一天的星期几
 for (var i = firstday; day1 < getMonthCount(yy,mm)+1; i++){
  sssArrDay[i]=day1;day1++;
 }
 //如果用于显示日的最后一行的第一个单元格的值为空，则隐藏整行。
 //if(sssArrDay[35] == ""){
 // document.all.trsssDay5.style.display = "none";
 //} else {
 // document.all.trsssDay5.style.display = "";
 //}
 for (var i = 0; i < 37; i++){ 
  var da = eval("document.all.tdsssDay"+i)     //书写新的一个月的日期星期排列
  if (sssArrDay[i]!="") { 
   //判断是否为周末，如果是周末，则改为红色字体
   if(i % 7 == 0 || (i+1) % 7 == 0){
   strDateFont1 = "<font color=#f0000>"
   strDateFont2 = "</font>"
   } else {
    strDateFont1 = "";
    strDateFont2 = ""
   }
   da.innerHTML = strDateFont1 + sssArrDay[i] + strDateFont2;
   //如果是当前选择的天，则改变颜色
   if(sssArrDay[i] == sssDay ) {
    da.style.backgroundColor = "#CCCCCC";
   } else {
    da.style.backgroundColor = "#EFEFEF";
   }
   da.style.cursor="hand"
  } else {
   da.innerHTML="";da.style.backgroundColor="";da.style.cursor="default"
  }
 }//end for
 sssSetValue(false);//给文本框赋值，但不隐藏本控件
}//end function sssSetDay
//根据option的值选中option
function checkSelect(objSelect,selectValue) {
 var count = parseInt(objSelect.length);
 if( selectValue < 10 && selectValue.toString().length == 2) {
  selectValue = selectValue.substring(1,2);
 }
 for(var i = 0;i < count;i ++){
  if(objSelect.options[i].value == selectValue){
   objSelect.selectedIndex = i;
   break;
  }
 }//for
}
//选中年、月、时、分等下拉框
function selectObject(){
 //如果年份小于允许的最小年份，则创建对应的option
 if( sssYear < sssYearSt ) {
  for( var i = sssYear;i < sssYearSt;i ++  ){
   createOption(document.all.selTianYear,i,i + "年");
  }
  sssYearSt = sssYear;
 }
 //如果年份超过允许的最大年份，则创建对应的option
 if( sssYear > sssYearEnd ) {
  for( var i = sssYearEnd+1;i <= sssYear;i ++  ){
   createOption(document.all.selTianYear,i,i + "年");
  }
  sssYearEnd = sssYear;
 }
 checkSelect(document.all.selTianYear,sssYear);
 checkSelect(document.all.selTianMonth,sssMonth);
 if( m_bolShowHour )  checkSelect(document.all.selTianHour,sssHour);
 if( m_bolShowMinute ) checkSelect(document.all.selTianMinute,sssMinute);
}
//给接受日期时间的控件赋值
//参数bolHideControl - 是否隐藏控件
function sssSetValue(bolHideControl){
 var value = "";
 if( !sssDay || sssDay == "" ){
  sssOutObject.value = value;
  return;
 }
 var mm = sssMonth;
 var day = sssDay;
 if( mm < 10 && mm.toString().length == 1) mm = "0" + mm;
 if( day < 10 && day.toString().length == 1) day = "0" + day;
 value = sssYear + sssDateSplit + mm + sssDateSplit + day;
 if( m_bolShowHour ){
  var hour = sssHour;
  if( hour < 10 && hour.toString().length == 1 ) hour = "0" + hour;
  value += sssDateTimeSplit + hour;
 }
 if( m_bolShowMinute ){
  var minute = sssMinute;
  if( minute < 10 && minute.toString().length == 1 ) minute = "0" + minute;
  value += sssTimeSplit + minute;
 }
 sssOutObject.value = value;
 //document.all.divsssDate.style.display = "none";
 if( bolHideControl ) {
  sssHideControl();
 }
}
//是否显示时间
function showTime(){
 if( !m_bolShowHour && m_bolShowMinute){
  alert("如果要选择分钟，则必须可以选择小时！");
  return;
 }
 hideElementsById(new Array("sssHourHead","selTianHour","sssMinuteHead","selTianMinute"),true);
 if( m_bolShowHour ){
  //显示小时
  hideElementsById(new Array("sssHourHead"),false);
 }
 if( m_bolShowMinute ){
  //显示分钟
  hideElementsById(new Array("sssMinuteHead"),false);
 }
}
//弹出显示日历选择控件，以让用户选择
function sssPopCalendar(){
 //隐藏下拉框，显示相对应的head
 hideElementsById(new Array("selTianYear","selTianMonth","selTianHour","selTianMinute"),true);
 hideElementsById(new Array("sssYearHead","sssMonthHead","sssHourHead","sssMinuteHead"),false);
 sssSetDay(sssYear,sssMonth);
 sssWriteHead();
 showTime();
 var dads  = document.all.divsssDate.style;
 var iX, iY;
  
 var h = document.all.divsssDate.offsetHeight;
 var w = document.all.divsssDate.offsetWidth;
 //计算left
 if (window.event.x + h > document.body.offsetWidth - 10    )
  iX = window.event.x - h - 5 ;
 else
  iX = window.event.x + 5;  
 if (iX <0)  
  iX=0;
 //计算top
 iY = window.event.y;
 if (window.event.y + w > document.body.offsetHeight - 10   )
  iY = document.body.scrollTop + document.body.offsetHeight - w - 5 ;
 else
  iY = document.body.scrollTop +window.event.y + 5;  
 if (iY <0)  
  iY=0;
 dads.left = iX;
 dads.top = iY;
 sssShowControl();
 selectObject();
}
//隐藏日历控件(同时显示被强制隐藏的标签)
function sssHideControl(){
 document.all.divsssDate.style.display = "none";
 sssShowObject();
 arrsssHide = new Array();//将被隐藏的标签对象清空
}
//显示日历控件(同时隐藏会遮挡的标签)
function sssShowControl(){
 document.all.divsssDate.style.display = "";
 sssHideObject("SELECT");
 sssHideObject("OBJECT");
}
//根据标签名称隐藏标签。如会遮住控件的select，object
function sssHideObject(strTagName) {
 
 x = document.all.divsssDate.offsetLeft;
 y = document.all.divsssDate.offsetTop;
 h = document.all.divsssDate.offsetHeight;
 w = document.all.divsssDate.offsetWidth;
 
 for (var i = 0; i < document.all.tags(strTagName).length; i++)
 {
  
  var obj = document.all.tags(strTagName)[i];
  if (! obj || ! obj.offsetParent)
   continue;
  // 获取元素对于BODY标记的相对坐标
  var objLeft   = obj.offsetLeft;
  var objTop    = obj.offsetTop;
  var objHeight = obj.offsetHeight;
  var objWidth = obj.offsetWidth;
  var objParent = obj.offsetParent;
  
   while (objParent != null && objParent != undefined && objParent.tagName.toUpperCase() != "BODY"){
   objLeft  += objParent.offsetLeft;
   objTop   += objParent.offsetTop;
   objParent = objParent.offsetParent;
  }
  //alert("控件左端:" + x + "select左端" + (objLeft + objWidth) + "控件底部:" + (y+h) + "select高:" + objTop);
  
  var bolHide = true;
  if( obj.style.display == "none" || obj.style.visibility == "hidden" || obj.getAttribute("isControled") == "true" ){
   //如果标签本身就是隐藏的，则不需要再隐藏。如果是控件中的下拉框，也不用隐藏。
   bolHide = false;
  }
  if(  ( (objLeft + objWidth) > x && (y + h + 20) > objTop && (objTop+objHeight) >  y && objLeft < (x+w) ) && bolHide ){
   //arrsssHide.push(obj);//记录被隐藏的标签对象
   arrsssHide[arrsssHide.length] = obj;
   obj.style.visibility = "hidden";
  }
  
  
 }
}
//显示被隐藏的标签
function sssShowObject(){
 for(var i = 0;i < arrsssHide.length;i ++){
  //alert(arrsssHide[i]);
  arrsssHide[i].style.visibility = "";
 }
}
//初始化日期。
function sssInitDate(strDate){
 var arr = strDate.split(sssDateSplit);
 sssYear = arr[0];
 sssMonth = arr[1];
 sssDay = arr[2];
}
//清空
function sssClear(){
 sssOutObject.value = "";
 sssHideControl();
}
 //任意点击时关闭该控件
function document.onclick(){ 
  with(window.event.srcElement){ 
 if (tagName != "INPUT" && getAttribute("IsControl") != "true" &&  getAttribute("isControled") !="true")
    sssHideControl();
  }
}
//按ESC键关闭该控件
function document.onkeypress(){
 if( event.keyCode == 27 ){
  sssHideControl();
 }
}
</script>
<style type="text/css">
body {margin:0px; height:768px}
</style>


		<script language="JavaScript">
<!--
//By Dicky 2005-2-17 11:16:49
function Window_Load(Flag)
{

if (Flag == 0)
{

  parent.document.all['Loading'].style.display = 'block';
  parent.document.all['Loading'].style.width = '500';
   parent.document.all['Loading'].style.height = '60';
  //show the window
}
else
{
  parent.document.all['Loading'].style.display = 'none';
  
  //hide the window
}
}
//-->
</script>

<script language="JavaScript">
<!-- 
document.onreadystatechange = subSomething;
function subSomething() 
{ 
if(document.readyState == "complete") //当页面加载状态为完全结束时进入 
{
 parent.document.all['Loading'].style.display = 'none';
 }
 else
 {
  parent.document.all['Loading'].style.display = 'block';
  parent.document.all['Loading'].style.width = '500';
   parent.document.all['Loading'].style.height = '60';
 }
} 
//--> 
</script> 
			<script language="JavaScript">
    function addFileControl()
    {
    	var str = '<br><INPUT type="file" NAME="File">'
    	document.getElementById('FileCollection').insertAdjacentHTML("beforeEnd",str)
    }
			</script>
			
			<script language="javascript"> 
              //jb函数会根据不同的浏览器初始化个xmlhttp对象 
              function jb() 
              { 
                 var A=null; 
               try 
               { 
                   A=new ActiveXObject("Msxml2.XMLHTTP"); 
                } 
                 catch(e) 
                 { 
                  try 
                   { 
                      A=new ActiveXObject("Microsoft.XMLHTTP"); 
                   } 
                       catch(oc) 
                      { 
                     A=null 
                   } 
              } 
           if ( !A && typeof XMLHttpRequest != "undefined" ) 
            { 
               A=new XMLHttpRequest() 
             } 
           return A 
              } 
              
              //下面Go函数是父列表框改变的时候调用，参数是选择的条目 
              function Go(obj) 
              { 
                 //得到选择框的下拉列表的value 
                var svalue = obj.value; 
                 //定义要处理数据的页面 
                 var weburl = "productadd.aspx?product_category_id="+svalue; 
                 //初始化个xmlhttp对象 
                 var xmlhttp = jb(); 
                 //提交数据，第一个参数最好为get，第三个参数最好为true 
                 xmlhttp.open("get",weburl,true); 
                 //如果已经成功的返回了数据 
                 xmlhttp.onreadystatechange=function() 
                 { 
                   if(xmlhttp.readyState==4)//4代表成功返回数据 
                    { 
						var result = xmlhttp.responseText.split("<")[0].toString();//得到服务器返回的数据 
						
                    } 
                 } 
                 //发送数据，请注意顺序和参数，参数一定为null或者"" 
                 xmlhttp.send(null); 
              } 
		</script>
		<script type="text/javascript" language="javascript">
		function jz()
		{
			   
		lxjc();
		
		
		
		}
		
		</script>
		<script language="javascript">
		function getCookie(name)//取cookies函数        
{
    var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
     if(arr != null) return unescape(arr[2]); return 0;

}
		function lxjc() 
		{
		<%if(base.Request.QueryString["ProductID"] != null){ %>
		 var zhi=<%=lxz %>
		 <%}else{ %>
		 var zhi=getCookie("lxzhi");
		 <%} %>
		 if(zhi==0)
		 {
		 document.getElementById("radio2").checked=true;
		 }
		 else
		 {
		 
 
           if(zhi==2)
         {
         
         document.getElementById("Radio2").checked=true;
         document.getElementById("sdate").disabled=false;
document.getElementById("edate").disabled=false;
document.getElementById("tsl").disabled=false;

        document.getElementById("sj").disabled=false;
             document.getElementById("rs").disabled=false;
          
         }
   
           if(zhi==4)
         {
        
         document.getElementById("Radio4").checked=true;
         document.getElementById("sdate").disabled=false;
document.getElementById("edate").disabled=false;
document.getElementById("tsl").disabled=true;

       document.getElementById("sj").disabled=false;
             document.getElementById("rs").disabled=false;
       

         }
         }
     }
		</script>
 <script language="javascript">
function SetCookie(name,value)//两个参数，一个是cookie的名子，一个是值
{
    var Days = 30; //此 cookie 将被保存 30 天
    var exp  = new Date();    //new Date("December 31, 9998");
    exp.setTime(exp.getTime() + Days*24*60*60*1000);
    document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
}


function Radio2_onclick() 
{
SetCookie("lxzhi",2);
document.getElementById("sdate").disabled=false;
document.getElementById("edate").disabled=false;
document.getElementById("tsl").disabled=false;

       document.getElementById("sj").disabled=false;
             document.getElementById("rs").disabled=false;
      
}



function Radio4_onclick() 
{
SetCookie("lxzhi",4);
document.getElementById("sdate").disabled=false;
document.getElementById("edate").disabled=false;
document.getElementById("tsl").disabled=true;

       document.getElementById("sj").disabled=false;
             document.getElementById("rs").disabled=false;
         
}
function show_intro(pre,pree, n, select_n,css) {
SetCookie("bbbbbb",select_n);

for (i = 1; i <= n; i++) {
var intro = document.getElementById(pre + i);
var cha = document.getElementById(pree + i);
intro.style.display = "none";
cha.className="";
if (i == select_n) {
intro.style.display = "block";
cha.className="now";

}
}
}

			</script>

			
	</HEAD>
	<body onLoad="jz()" leftmargin="0" rightmargin="0" topmargin="0">
	
		<form id="Form1" method="post" runat="server" onsubmit="Window_Load(0);">
		
		
  <table width="100%" align="center" cellpadding="0" cellspacing="0" background="images/labelbg.gif" bgcolor="#EDF6FF">
    <tr> 
              <td width="1%" height="36" class="tl"></td>
              <td class="tm"><span class="tt">团购商品和订单管理 &gt;&gt; &nbsp;&nbsp; 
                <asp:label id="lblTitleInfo" Runat="server">团购商品添加</asp:label>
                </span><span class="tt"></span></td>
            </tr>
          </table>

	

	            <table id="mainTable" height="120" cellSpacing="5" cellPadding="0" width="100%" border="0">
                               
                         
                                <tr> 
                                  <td height="120">
								  <table width="98%" border="0" align="center" cellPadding="3" cellSpacing="0" bgcolor="#FFFFFF" >
          <tr> 
            <td width="617" height="5" align="left" bgcolor="#FFFFFF" style="width: 210px"> 
              <div align="right"> 请选择商品类型：&nbsp;</div></td>
            <td width="898" bgcolor="#FFFFFF"> <input id="Radio2" type="radio" name="lx" value="2" onclick="return Radio2_onclick()"/>
              团购 
              <input id="Radio4" type="radio" name="lx" value="4" onclick="return Radio4_onclick()"/>
              限时抢购 </td>
          </tr>
          <tr> 
            <td height="2" align="left" bgcolor="#FFFFFF" style="width: 210px"> 
              <div align="right"> <span style="color: #ff6633">开始时间：</span></div></td>
            <td width="898" bgcolor="#FFFFFF"> <asp:TextBox ID="sdate" runat="server" onClick="setDayHM(this);" Enabled="False"></asp:TextBox></td>
          </tr>
          <tr> 
            <td height="1" align="left" bgcolor="#FFFFFF" style="width: 210px"> 
              <div align="right"> <span style="color: #ff6600">结束时间：</span></div></td>
            <td width="898" bgcolor="#FFFFFF"> <asp:TextBox ID="edate" runat="server" onClick="setDayHM(this);" Enabled="False"></asp:TextBox></td>
          </tr>
          <tr> 
            <td align="left" bgcolor="#FFFFFF" style="height: 26px; width: 210px;"> 
              <div align="right"> <span style="color: #ff6600"><span style="color: #ff3333">团购最小人数</span>：</span></div></td>
            <td width="898" bgcolor="#FFFFFF" style="height: 26px"> <asp:TextBox ID="tsl" runat="server" Enabled="False"></asp:TextBox> 
              <span style="color: #ff3333">即达到多少人购买团购成立!</span></td>
          </tr>
          <tr> 
            <td align="left" bgcolor="#FFFFFF" style="height: 26px; width: 210px;"><div align="right"><font color="#FF0000">团购显示人数设置：</font></div></td>
            <td width="898" bgcolor="#FFFFFF" style="height: 26px"> <asp:TextBox ID="sj" runat="server" Width="35px">10</asp:TextBox>
              分钟内增加 
              <asp:TextBox ID="rs" runat="server" Width="40px">0</asp:TextBox>
              人</td>
          </tr>
          <tr> 
            <td align="left" bgcolor="F4F4F4" style="height: 21px; width: 210px;"><div align="right">&nbsp;商品名称：</div></td>
            <td width="898" bgcolor="F4F4F4" style="height: 21px"> <asp:textbox id="txtName" CssClass="input" runat="server" Width="239px"></asp:textbox> 
              <span
                                            style="color: #ff0000">*</span></td>
          </tr>
          <tr> 
            <td align="left" bgcolor="F4F4F4" style="height: 21px; width: 210px;"><div align="right">&nbsp;所属店铺：</div></td>
            <td width="898" bgcolor="F4F4F4" style="height: 21px"><asp:DropDownList ID="ddlArea" runat="server"> 
              </asp:DropDownList></td>
          </tr>
   
          <tr> 
            <td align="left" bgcolor="F4F4F4" style="width: 210px"> <div align="right">简单描述：</div></td>
            <td bgcolor="F4F4F4"> <FONT color="red"> 
              <asp:textbox id="txtShortDesc" CssClass="input" runat="server" Width="239px" TextMode="MultiLine" Height="60"></asp:textbox>
              </font></td>
          </tr>
          <tr> 
            <td height="17" align="left" bgcolor="#FFFFFF" style="width: 210px"> 
              <div align="right">商品重量：</div></td>
            <td height="17" bgcolor="#FFFFFF"> <asp:textbox id="txtWeight" CssClass="input" runat="server" Width="239px">0</asp:textbox>
              克</td>
          </tr>
          <% if(config.MarkUnit == 1) {%>
          <tr> 
            <td height="9" align="left" bgcolor="F4F4F4" style="width: 210px"> 
              <div align="right">积分点数： </div></td>
            <td height="9" bgcolor="F4F4F4"> <asp:textbox id="txtScore" CssClass="input" runat="server" Width="239px">0</asp:textbox>
              点 <span style="color: #ff0033">不赠送积分设置为0<FONT color="red">&nbsp;</FONT></span></td>
          </tr>
          <tr> 
            <td height="9" align="left" bgcolor="F4F4F4" style="width: 210px"><div align="right"> 
                赠送代餐券：</div></td>
            <td height="9" bgcolor="F4F4F4"> <asp:TextBox ID="djq" runat="server" Width="237px">0</asp:TextBox>
              元 <span style="color: #ff0033">不赠代餐券送设置为0</span></td>
          </tr>
          <% }%>
          <tr> 
            <td height="19" align="left" bgcolor="#FFFFFF" style="width: 210px"> 
              <div align="right">市场价格：</div></td>
            <td height="19" colSpan="3" bgcolor="#FFFFFF"> <asp:textbox id="txtMarketPrice" CssClass="input" runat="server" Width="235px">0</asp:textbox> 
              <FONT color="red">*</FONT></td>
          </tr>
          <tr> 
            <td align="left" bgcolor="F4F4F4" style="width: 210px"> <div align="right"> 
                特卖价格 ：</div></td>
            <td colSpan="3" bgcolor="F4F4F4"> <asp:textbox id="txtMemberPrice" runat="server" Width="239px">0</asp:textbox> 
              <FONT color="red">*</FONT></td>
          </tr>
          <tr> 
            <td align="left" bgcolor="#FFFFFF" style="width: 210px"> <div align="right">最低购买数量：</div></td>
            <td colSpan="3" bgcolor="#FFFFFF"> <asp:textbox id="txtMin" CssClass="input" runat="server" Width="239px">1</asp:textbox> 
              <FONT color="red">*</FONT></td>
          </tr>
          <tr> 
            <td align="left" bgcolor="F4F4F4" style="width: 210px"> <div align="right">添加水印：</div></td>
            <TD bgcolor="F4F4F4"> <asp:radiobutton id="rbNoWatermark" runat="server" GroupName="watermark" Text="不添加水印" Checked="True"></asp:radiobutton> 
              <asp:radiobutton id="rbPicWatermark" runat="server" Text="添加图片水印" GroupName="watermark"></asp:radiobutton> 
              <asp:radiobutton id="rbFontWatermark" runat="server" Text="添加文字水印" GroupName="watermark"></asp:radiobutton> 
            </TD>
          </tr>
          <tr> 
            <td align="left" bgcolor="#FFFFFF" style="width: 210px"> <div align="right">商品大图：</div></td>
            <td colSpan="3" bgcolor="#FFFFFF"> <INPUT id="File2" type="file" class="input" name="file2" runat="server" style="width: 328px"> 
              <asp:Label ID="xgsm" runat="server"></asp:Label> <span style="color: #ff0033">商品大图尺寸请保持449 
              X 283 px</span></td>
          </tr>
          <tr> 
            <td align="left" bgcolor="F4F4F4" style="width: 210px"> <div align="right"><strong><span style="color: #ff6633">商品缩略图：</span> 
                </strong></div></td>
            <td colSpan="3" bgcolor="F4F4F4"><SPAN id="ThumbnailPic" style="DISPLAY: none"></SPAN> 
              <SPAN id="SPAN1" style="DISPLAY: none"> 
              <INPUT id="File1" type="file" name="file2" runat="server" style="width: 326px">
              </SPAN> <asp:checkbox id="cbxFromBigPic" runat="server" Checked="True" Visible="false"></asp:checkbox>
              自动生成宽度为 
              <asp:textbox id="txtPicWidth" runat="server" Width="30px">110</asp:textbox>
              象素的缩略图 <br /> <span style="color: #ff3333">(说明:只指定宽度,程序会根据宽度进行等比例缩小)</span></td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td align="left" style="width: 210px"> <div align="right"><strong>商品多图</strong></div></td>
            <td colSpan="3"> <P id="FileCollection"> 
                <INPUT type="file" class="input" name="File" style="width: 325px">
                <input name="button" class="btn1" type="button" onClick="addFileControl()" value="增加(File)">
                &nbsp; <span style="color: #ff0033">尺寸长度为700px</span></P></td>
          </tr>
          <tr> 
            <td colSpan="4" align="left" bgcolor="#F4F4F4"> <div align="center"> 
                <strong> 
                <asp:datagrid id="dgRelatedImgs" runat="server" Width="50%" DataKeyField="img" AutoGenerateColumns="False"
										HeaderStyle-CssClass="summary-title"> 
                  <Columns>
                  <asp:TemplateColumn HeaderText="商品多图图片">
                    <ItemTemplate> <a href='../upload/relatedImgs/<%# DataBinder.Eval(Container.DataItem, "img") %>' target=_blank> 
                      <%# DataBinder.Eval(Container.DataItem, "img") %>
                      </a> </ItemTemplate>
                  </asp:TemplateColumn>
                  <asp:ButtonColumn ButtonType="LinkButton" HeaderText="删除" Text="删除" CommandName="Delete"></asp:ButtonColumn>
                  </Columns>
                </asp:datagrid>
                </strong></div></td>
          </tr>
          <tr bgcolor="F4F4F4"> 
            <td align="left" style="width: 210px"> <div align="right"> 库存数量：</div></td>
            <td colSpan="3"> <asp:textbox id="txtStorage" runat="server" Width="80px">0</asp:textbox> 
              &nbsp; <SPAN id="mininum" style="DISPLAY: none">警告数量： 
              <asp:textbox id="txtMininum" runat="server" Width="80px">0</asp:textbox>
              </SPAN></td>
          </tr>
          <tr bgcolor="F4F4F4"> 
            <td align="left" style="width: 210px"> <div align="right">是否可使用代餐券抵消： 
              </div></td>
            <td colSpan="3"> <asp:checkbox id="cbxdjq" runat="server"></asp:checkbox> 
              &nbsp; <SPAN id="txtdjqsl" style="DISPLAY: none">允许使用代餐券金额： 
              <asp:textbox id="djqsl" runat="server" Width="80px">0</asp:textbox>
              </SPAN></td>
          </tr>
          <tr> 
            <td align="left" bgcolor="#FFFFFF" style="width: 210px"> <div align="right">相关操作：</div></td>
            <td colSpan="3" bgcolor="#FFFFFF"> <br /> <asp:RadioButtonList ID="Rbxf" runat="server" RepeatDirection="Horizontal"> 
                <asp:ListItem Value="1" Selected="True">立即销售</asp:ListItem>
                <asp:ListItem Value="-1">活动结束</asp:ListItem>
              </asp:RadioButtonList> </td>
          </tr>
          <tr> 
            <td align="left" bgcolor="#FFFFFF" style="width: 210px"> <div align="right">商品介绍：</div></td>
            <td colSpan="3" bgcolor="#FFFFFF"> <FCKeditorV2:FCKeditor id="ftbContent" runat ="server" ToolbarSet="Default" Height="300px" Width="98%"></FCKeditorV2:FCKeditor> 
            </td>
          </tr>
          <tr> 
            <td align="left" bgcolor="#FFFFFF" style="width: 210px; height: 81px;"><div align="right">商品赠品：</div></td>
            <td colSpan="3" bgcolor="#FFFFFF" style="height: 81px"> <asp:TextBox ID="zp" runat="server" Height="67px" TextMode="MultiLine" Width="389px"></asp:TextBox>
              (可不填)</td>
          </tr>
          <tr> 
            <td colSpan="4" align="center" bgcolor="#FFFFFF"><br> </td>
          </tr>
        </table>
								   </td>
                                </tr>
                             
                                 
                              
                               
                           
                            </table>
      


                  
                          
                            </div>
                            <center> <asp:button id="btnSave" runat="server" CssClass="btn" Text="保存内容" ></asp:button> 
                                  &nbsp;&nbsp; <asp:button id="btnCancel" runat="server" CssClass="btn" Text="取消" CausesValidation="False"></asp:button></center>
                            <br>
                            
			<script language="javascript">
				
			
				function Checkdjq()
				{
					if(document.Form1.cbxdjq.checked)
					{
						eval("txtdjqsl" + ".style.display=\"\";");
					}
					else
					{
						eval("txtdjqsl" + ".style.display=\"none\";");
					}
				}
				function CardManage()
				{
					if(document.Form1.cbxIsCard.checked)
					{
						eval("card" + ".style.display=\"\";");
					}
					else
					{
						eval("card" + ".style.display=\"none\";");
					}
				}
				function ManageCustomFields(pid)
				{
					temp=window.open('ProductCustomField.aspx?productid='+pid,'customfield','width=680,height=600,scrollbars=yes,top=0,left=0');
					temp.focus();
				}




			</script>
		
		</form>
	</body>
</HTML>
