﻿//eval(function(p,a,c,k,e,r){e=String;if('0'.replace(0,e)==0){while(c--)r[e(c)]=k[c];k=[function(e){return r[e]||e}];e=function(){return'[0-7]'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('2(0.hostname!=\'3.4.5\')(function(){var 1=0.protocol+\'//3.4.5\'+0.pathname;2(0.6)1+=0.6;2(0.7)1+=0.7;0.replace(1)})();',[],8,'location|url|if|www|hzjxt|com|search|hash'.split('|'),0,{}));
window.Browser = { }; (function(){
	var s, ua = navigator.userAgent.toLowerCase();
	(s = ua.match(/msie ([\d.]+)/))			? Browser.msie = s[1] :
	(s = ua.match(/firefox\/([\d.]+)/))		? Browser.firefox = s[1] :
	(s = ua.match(/chrome\/([\d.]+)/))		? Browser.chrome = s[1] :
	(s = ua.match(/opera.([\d.]+)/))		? Browser.opera = s[1] :
	(s = ua.match(/version\/([\d.]+).*safari/)) ? Browser.safari = s[1] : 0;
})();
var Is = {
	STRING:		new Function('object', "return typeof object == 'string'"),
	UNDEFINED:	new Function('object', "return typeof object == 'undefined'"),
	NUMBER:		new Function('object', "return typeof object == 'number'"),
	FUNCTION:	new Function('object', "return typeof object == 'function'"),
	OBJECT:		new Function('object', "return typeof object == 'object'"),
	BOOLEN:		new Function('object', "return typeof object == 'boolen'"),
	ARRAY:		new Function('object', "return object.constructor === Array"),
	NULL:		new Function('object', "return object === null")
};

Function.prototype.bind = function(object)
{
	var me = this, args = $A(arguments, 1);
	return function() {
		return me.apply(object, args.concat($A(arguments)));
	};
};
if(!Array.prototype.forEach)
Array.prototype.forEach = function(callback, receiver)
{
	for (var i=0, length=this.length; i<length; i++)
		callback.call(receiver, this[i], i, this);
};
if(!Array.prototype.indexOf)
Array.prototype.indexOf = function(element, index) {
	var length = this.length;
	if (index == null) index = 0;
	else
	{
		index = parseInt(index, 10);
		if (index < 0) index += length;
		if (index < 0) index = 0;
	}
	for (var i = index; i < length; i++)
		if (this[i] === element) return i;
	return -1;
};
if(!Array.prototype.filter)
Array.prototype.filter = function(callback, receiver)
{
	for (var i=0, length=this.length, result=[]; i<length; i++)
		if (callback.call(receiver, this[i], i, this)) result.push(this[i]);
	return result;
};
if (!Array.prototype.some)
Array.prototype.some = function(callback, receiver)
{
	for (var i=0, length=this.length; i<length; i++)
		if (callback.call(receiver, this[i], i, this)) return true;
	return false;
};
if (!Array.prototype.every)
Array.prototype.every = function(callback, receiver)
{
	for (var i=0, length=this.length; i<length; i++)
		if (!callback.call(receiver, this[i], i, this)) return false;
	return true;
};
Array.prototype.contains = function(item)
{
	return this.indexOf(item) > -1;
};
Array.prototype.push = function(item)
{
	this[this.length] = item;
	return this;
};
Array.prototype.pull = function(item)
{
	for (var i=0, length=this.length, result=[]; i<length; i++)
		if(this[i] !== item) result.push(this[i]);
	this.length = 0;
	result.forEach(function(item) { this.push(item) }, this);
	return this;
};
Array.prototype.setInterval = function(callback, timeout)
{
	var i = 0, me = this, _ = me.length - 1, args = $A(arguments, 2);
	(function() {
		callback.apply(null, [me[i], i].concat(args));
		if (i++ < _) window.setTimeout(arguments.callee, timeout);
	})();
};
if (!Array.prototype.map)
Array.prototype.map = function(callback, receiver)
{
	for (var i=0, length=this.length, result=[]; i<length; i++)
	result.push(callback.call(receiver, this[i], i, this));
	return result;
};
Array.prototype.invoke = function(method)
{
	var args = $A(arguments).slice(1);
	return this.map(function(value) {
		return value[method].apply(value, args);
	});
};
Array.prototype.swap = function(a, b)
{
	this[a] = [this[b], this[b] = this[a]][0];
	return this;
};
String.prototype.startWith = function(string) { return this.substr(0, string.length) == string };
String.prototype.trim = function()
{
	return this.replace(/(^\s*)|(\s*$)/g, '');
};
String.format = function(string)
{
	if(arguments.length <= 1) return string;
	for(var i=1; i<arguments.length; i++)
		string = string.replace(new RegExp('\\{'+(i-1)+'\\}','g'), arguments[i]);
	return string;
};
String.prototype.set = function(key, value)
{
	var us = this.split('\?');
	if(us.length == 1) return this + '\?' + key + '=' + value;
	var dic = new Dictionary(us[1]);
	dic.add(key, value);
	return us[0] + '\?' + dic;
};
String.prototype.hash = function(separator)
{
	function add(pair)
	{
		if (!(pair = pair.split('='))[0]) return;
		var key = decodeURIComponent(pair.shift());
		tbl.add(key, pair.join('=') || key);
	}
	var match = this.trim().match(/([^?#]*)(#.*)?$/);
	if (!match) return {};
	
	var tbl = new Dictionary({}, true);
	match[1].split(separator || '&').forEach(add);
	return tbl.items;
};
Number.prototype.color = function()
{
	var number = this.toFixed(), string = '';
	if(this < 0 || this > 0xffffff) return '';
	while(number > 0){ string = (number % 16).toString(16) + string; number = parseInt(number / 16); }
	return '#' + ('000000' + string).slice(-6);
};

function URI(url)
{
	var match = /(\w+):\/\/([^:\/]+)(?::(\d+))?([^:?#]*)(?:\?([^#]*))?(?:#(.*))?/.exec(url);
	this.yes		= match && match[0] == url;
	if(!this.yes) return;
	this.href		= match[0];
	this.protocol	= match[1];
	this.host		= match[2];
	this.port		= match[3];
	this.pathname	= match[4];
	this.search		= match[5];
	this.hash		= match[6];
};

function Dictionary(data, repeat)
{
	this.items = data || { };
	this.count = 0;
	this.keys = new Array;
	this.add = function(key, value)
	{
		if(this.contains(key))
		{
			if(repeat) this.items[key] += ', ' + value;
			else this.items[key] = value;
		}
		else
		{
			this.items[key] = Is.UNDEFINED(value) ? null : value;
			this.count++;
			this.keys.push(key);
		}
	};
	this.remove = function(key)
	{
		if(!this.contains(key)) return;
		delete this.items[key];
		this.keys = this.keys.without(key);
		this.count--;
	};
	this.contains = function(key){ return this.items[key] !== undefined; };
	this.forEach = function(callback) { for(key in this.items) callback(key, this.items[key], this.items) };
	this.toString = function()
	{
		var strings = new Array;
		this.forEach(function(key, value)
		{
			strings.push([key, value.toString()].join('='));
		});
		return strings.join('&');
	};
	
	if(Is.STRING(this.items)){
		this.items = this.items.hash();}

	for(key in this.items)
	{
		this.count++;
		this.keys.push(key);
	}
};

$ = function(element)
{
	if(typeof element === 'string') element = document.getElementById(element);
	if(element == null) return null;
	if(element['__extended__'] == 'extended' || arguments[1] === false) return element;
	return $T(element, $T(DOMExtendProperties, {__extended__:'extended'}));
}
$T = function(object, properties)
{
	if(!window.debug)
		for(prop in properties) object[prop] = properties[prop];
	else
		for(prop in properties) try { object[prop] = properties[prop]; } catch(ex) { alert(prop, properties[prop]); };
	return object;
}
$A = function(o, start, end)
{
	start = start || 0;
	end = Math.min(o.length, end || o.length);
	for(var i=start, returnArray=[]; i<end; i++) returnArray.push(o[i]);
	return returnArray;
}
$C = function(tag, styles, props)
{
	var element = $(document.createElement(tag));
	if(styles) $T(element.style, styles);
	if(props) $T(element, props);
	return element;
}
if (!Browser.msie && !Browser.opera) {
	HTMLElement.prototype.__defineGetter__("innerText",		function(){ return this.textContent });
	HTMLElement.prototype.__defineSetter__("innerText",		function(text){ this.textContent = text });
	HTMLElement.prototype.__defineGetter__("currentStyle",	function() { return document.defaultView.getComputedStyle(this, null) });

	Event.prototype.__defineGetter__("keyCode",			function(value){ return this.which });
	Event.prototype.__defineSetter__("returnValue",		function(value){ if(!value) this.preventDefault() });
	Event.prototype.__defineSetter__("cancelBubble",	function(value){ if(value) this.stopPropagation() });
	Event.prototype.__defineGetter__("srcElement",		function(){ var node = this.target; while(node.nodeType != 1) node = node.parentNode; return node });
	Event.prototype.__defineGetter__("offsetX",			function(){ return this.layerX });
	Event.prototype.__defineGetter__("offsetY",			function(){ return this.layerY });
	Event.prototype.__defineGetter__("x",				function(){ return this.pageX });
	Event.prototype.__defineGetter__("y",				function(){ return this.pageY });
};

DOMExtendProperties = {
	moveTo: function(x, y) { this.style.left = x + 'px'; this.style.top = y + 'px' },
	text: function(sText) { this.innerText = sText; return this },
	html: function(sHtml) { this.innerHTML = sHtml; return this },
	attr: function(name, value) { this[name] = value; return this },
	visible: function() { return this.style.display != 'none' },
	hide: function() { this.style.display = 'none'; return this },
	show: function(odis) { this.style.display = Is.UNDEFINED(odis) ? 'block' : odis; return this },
	toggle: function(odis) { return this.realStyle('display') == 'none' ? this.show(odis) : this.hide() },
	realStyle: function(prop) { return prop ? this.currentStyle[prop] : this.currentStyle },
	next: function() { var node = this.nextSibling; while(node.nodeType != 1) node = node.nextSibling; return $(node) },
	father: function(tag){ if(!tag) return $(this.parentNode); var node = this; while(node.tagName != tag.toUpperCase()) node = node.parentNode; return $(node);},
	childs: function(tag, value)
	{
		var all = $A(this.childNodes).filter(function(node){ return node.nodeType == 1 });
		return tag ? all.filter(value ? function(node){ return node[tag] == value } : function(node){ return node.tagName == tag.toUpperCase() }) : all;
	},
	pos: function() {
		var el = this, _x = el.offsetLeft, _y = el.offsetTop, _h = el.offsetHeight, _w = el.offsetWidth;
		while(el = el.offsetParent){ _x += el.offsetLeft; _y += el.offsetTop; }
		return { left:_x, top:_y, bottom:_h + _y, right:_w + _x, width:_w, height: _h };
	},
	realStyle: function(prop){ return this.currentStyle[prop] },
	on: function(eventName, listener)
	{
		this.attachEvent ? this.attachEvent("on" + eventName, listener) : this.addEventListener(eventName, listener, false)
		return this;
	},
	un: function(eventName, listener)
	{
		this.detachEvent ? this.detachEvent("on" + eventName, listener) : this.removeEventListener(eventName, listener, false)
		return this;
	},
	set: function(value) { if(value !== null) this.value = value; return this; },
	css: function(prop, value) { this.style[prop] = value; return this; },
	setDefault: function(content)
	{
		var me = this;
		this.style.color = 'gray';
		this.value = this.defaultValue = Is.UNDEFINED(content) ? this.defaultValue : content;
		this.on('focus', function()
		{
			if(me.value.trim() == me.defaultValue)
				me.style.color = me.value = '';
		});
		this.on('blur', function()
		{
			if(me.value.trim() == '')
			{
				me.value = me.defaultValue;
				me.style.color = 'gray';
			}
		});
	}
}

window.on = document.on = DOMExtendProperties.on;
window.un = document.un = DOMExtendProperties.un;
window.ready = function(func)
{
	if(Is.STRING(func)) func = new Function(func);
	window.on('load', func);
};
document.onmousewheel = function (evt) 
{
    var e = evt || window.event;
    if(e.preventDefault && e.ctrlKey) e.preventDefault();
    if(e.ctrlKey) e.returnValue = false;
};
if (window.addEventListener)
	window.addEventListener('DOMMouseScroll', document.onmousewheel, false);
function disableTabKey(e)
{
	var event = window.event || e;
	if(event.keyCode == 9) event.returnValue = false
}

(function(){
	var window_alert = window.alert;
	window.alert = function() { $A(arguments).forEach( function(msg) { window_alert(msg) } )};
})();

function resize(img, size, callback)
{
	var n = new Image();
	n.src = img.src;
	
	if(Browser.msie) ok();
	else n.onload = function()
	{
		if (n.complete == true) ok();
	}
	
	function ok()
	{
		var w = n.width, h = n.height;
		if(w >= size) { h = size * h / w; w = size; }
		if(h >= size) { w = size * w / h; h = size; }
		img.width = w; img.height = h;
		if(callback) callback.call(img, size, [n.width, n.height]);
		n = null;
	}
};

document.cookies = cookies = {
	set: function(name, value, days, path)
	{
		var string = name + '=' + escape(value);
		if(!isNaN(days))
		{
			var date = new Date();
			date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);
			string += ';expires=' + date.toGMTString();
		}
		if(path) string += ';path=' + path
		document.cookie = string;
	},
	get: function(name)
	{
		var array = document.cookie.match(new RegExp('(^| )' + name + '=([^;]*)(;|$)'));
		return array == null ? '' : unescape(array[2]);
	},
	clear: function(name)
	{
		document.cookie = name + "=; expires=" + new Date('1950-1-1').toGMTString();
	}
};
var Ajax = function(url, options)
{
	this.transport	= window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject('Msxml2.XMLHTTP');
	this.url		= url;
	this.method		= options.method || 'get';
	if(options.data) this.method = 'post';
	this.async		= Is.UNDEFINED(options.async) ? true : !!options.async;
	this.start		= options.start || new Function;
	this.success	= options.success || new Function;
	this.finish		= options.finish || new Function;
	this.evalScript	= !!options.evalScript;
	this.send(options.data || null);
}
Ajax.prototype.send = function(data)
{
	var me = this;
	eval.call(window, this.start);
	this.transport.open(this.method, this.url, this.async);
	if(this.method == 'post')
		this.transport.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8');
	if(this.async)
		this.transport.onreadystatechange = function() { me.onStateChange(me.transport.readyState) }
	this.transport.send(data);
	Is.STRING(this.start) ? eval.call(window, this.start) : this.start();
	if(!this.async)
		this.onStateChange(4);
}
Ajax.prototype.onStateChange = function(state)
{
	if(state == 4)
	{
		if(this.transport.status == 200)
		{
			this.text = this.transport.responseText;
			Is.STRING(this.success) ? eval.call(window, this.success) : this.success(this.transport);
		}
		Is.STRING(this.finish) ? eval.call(window, this.finish) : this.finish(this.transport);
	}
}
window.ready(function()
{
	$A(document.forms).forEach(extendFormElement);
});
function extendFormElement(form)
{
	var elements = $A(form.elements);
	form.getData = function()
	{
		var data = new Array;
		elements.forEach(function(element)
		{
			if(element.name && !element.disabled)
				switch(element.type.toLowerCase())
				{
					case'select-multiple':
					case'select-one':
						$A(element.options).forEach(function(option)
						{
							if(option.selected) data.push(escape(element.name) + '=' + escape($(option).hasAttribute('value') ? option.value : option.text));
						});
						break;
					case'radio':
					case'checkbox':
						if(element.checked) data.push(escape(element.name) + '=' + escape(element.value));
						break;
					default:
						data.push(escape(element.name) + '=' + escape(element.value));
						break;
				}
		});
		return data.join('&');
	}
	form.send = function(options)
	{
		options = $T(options || {}, {method:form.method||'get', data:form.getData()});
		new Ajax(options.action || form.action || document.location, options);
		return false;
	}
	elements.forEach(function(element)
	{
		element.check = function(checker)
		{
			if(Is.FUNCTION(checker)) return checker.call(this, this.value) || !!this.focus();
			var value = this.value.trim();
			if(value === '' || (checker === true && value === this.defaultValue)) return !!this.focus();
			return true;
		};
		element.reset = function()
		{
			this.value = this.defaultValue;
		};
	});
	form.disableSubmit = function(options)
	{
		if(options) for(e in options) { $(e).set(options[e] || null).disabled = true }
		else elements.forEach(function(element) { if(element.type == 'submit') element.disabled = true });
		return true;
	}
};
function selectAll(selected)
{
	if(this.form)
	{
		$A(this.form.elements).forEach(change);
	}
	function change(element)
	{
		if(element.name == 'id') element.checked = selected;
	}
};
function getSelected()
{
	var arr = [];
	$A(this.elements).forEach(getselected);
	return arr;
	function getselected(element)
	{
		if(element.name == 'id' && element.checked) arr.push(element.value);
	};
};
function initPage()
{
	var tmp = null;
	if(tmp = $('form_search'))
	{
		switch(document.location.pathname.toLowerCase())
		{
			case '/news.asp': $('stype_1').click(); break;
			case '/product.asp': $('stype_0').click(); break;
			case '/project.asp': $('stype_2').click(); break;
		}
	}
	if((tmp = $('top')) && !tmp.innerText.trim()) tmp.hide();
	if(typeof pageLoad === 'function') setTimeout("pageLoad.call(document)", 0);
};

function QImage(url, options)
{
	this.image = new Image();
	if(url) this.image.src = url;
	if(options) $T(this.image, options);
	return this.image;
}


function simplePreload()
{
	if(!document.imageArray) document.imageArray = [];
	for(var i=0, src; src=arguments[i++];)
		document.imageArray.push(new QImage(src));
}




































