// JavaScript Document
//左边菜单切换效果
function changeMenu(o, name, state)
{
	o.className = state ? "focus" : "default" + name;
}

function popWin(catid, id)
{
	var _win = window.open("/pop.jsp?catid=" + catid + "&id=" + id, "news","");
	_win.focus();
}
//
function fPopUpCalendarDlg(ctrlobj)
{
	showx = event.screenX - event.offsetX - 4 - 210 ; // + deltaX;
	showy = event.screenY - event.offsetY + 18; // + deltaY;
	newWINwidth = 210 + 4 + 18;

	retval = window.showModalDialog("../js/CalendarDlg.htm", "", "dialogWidth:210px; dialogHeight:235px; dialogLeft:"+showx+"px; dialogTop:"+showy+"px; status:no; directories:yes;scrollbars:no;Resizable=no; "  );
	if( retval != null ){
		ctrlobj.value = retval;
	}else{
		//alert("canceled");
	}
}

	function newsItem(nId, nCatId, sTitle)
{
	this.id = nId;
	this.catid = nCatId;
	this.title = sTitle;
}
function newsHandler()
{
	this._newsList = [];
	if (typeof(newsHandler._initialized) == "undefined")
	{
		var nh = newsHandler.prototype;
		nh.addItem = function(nId, nCatId, sTitle)
		{
			this._newsList.push(new newsItem(nId, nCatId, sTitle));
		}
		nh.getIndex = function(nId)
		{
			var _length = this._newsList.length;
			for (var i = 0; i < _length; i ++)
			{
				if (this._newsList[i].id == nId)
				{
					return i;
				}
			}
			return -1;
		}
		nh.getNext = function(nId)
		{
			var _length = this._newsList.length;
			var _index = this.getIndex(nId);
			return _index == -1 || _index == _length - 1 ? null : this._newsList[_index + 1];
		}
		nh.getPrev = function(nId)
		{
			var _index = this.getIndex(nId);
			return _index == -1 || _index == 0 ? null : this._newsList[_index - 1];
		}
		newsHandler._initialized = true;
	}
}

//
function getOptions(index)
{
	var idList = [116, 180];
	if (document.frames["frame_option"] != null)
	{
		document.frames["frame_option"].location.href = "/index/getOptions.jsp?id=" + idList[index];
	}
	
}
function createOptions(aList)
{
	var list = ["", "-请选择产品型号-"];
	list = list.concat(aList);
	var _length = list.length / 2;
	var _o = document.getElementById("optioins_pro");
	if (_o != null)
	{
		_o.options.length = _length;
		for (var i = 0; i < _length; i ++)
		{
			_o.options[i] = new Option(list[i * 2 + 1], list[i * 2]);
		}
	}
}
