var Class = {
create: function() {
return function() {
this.initialize.apply(this, arguments);
}
}
}
function number_format( number, decimals, dec_point, thousands_sep )
{
var n = number, c = isNaN(decimals = Math.abs(decimals)) ? 2 : decimals;
var d = dec_point == undefined ? "." : dec_point;
var t = thousands_sep == undefined ? "," : thousands_sep, s = n < 0 ? "-" : "";
var i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "", j = (j = i.length) > 3 ? j % 3 : 0;
return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : "");
}
function getParentTag(obj, tag)
{
var tmp = obj;
while (tmp = tmp.parentNode) {
if (tmp.nodeName == tag) {
return tmp;
}
}
return null;
}
function getPreviousTag(obj, tag)
{
var tmp = obj;
while (tmp = tmp.previousSibling) {
if (tmp.nodeName == tag) {
return tmp;
}
}
return null;
}
function openPopupByLocation(location, target, pW, pH)
{
if (typeof pW != 'numeric') {
pW = screen.width/2;
}
if (typeof pH != 'numeric') {
pH = screen.height - screen.height/3;
}
var top = screen.height/2-pH/2;
var left = screen.width/2-pW/2;
var params = 'toolbar=0,location=0,menubar=0,resizable=1,status=0,scrollbars=yes,screenX='
+left+',screenY='+top+',top='+top+',left='+left
+',width='+pW+',height='+pH;
var wnd = window.open(location, target, params);
wnd.opener = self;
wnd.focus();
}
function openPopup(a, pW, pH)
{
openPopupByLocation(a.href, a.getAttribute('target'), pW, pH);
return false;
}
function searchkeyword()
{
$('#textkeyword').html('Search our site or enter a site keyword: Searching... ');
$.post('keyword', { keyword:$('#keywordinput').val()}, function(data) {
if (data=='error') {
$('#textkeyword').html('Search our site or enter a site keyword: There is no such keyword at our web site ');
} else {
$('#textkeyword').html('Search our site or enter a site keyword: Found. Redirecting... ');
window.location=data;
}
});
}
function initClickRow(linkSelector)
{
if (!$(linkSelector).size()) {
return false;
}
$(linkSelector).each(function(){
var td = getParentTag(this, 'TD');
var obj = this;
while (td = getPreviousTag(td, 'TD')) {
var a_cnt = $('a', td).size();
var a_href = '';
var a_target = '';
if (a_cnt == 0) {
a_href = obj.href;
a_target = obj.target;
} else if (a_cnt == 1) {
a_href = $('a', td).attr('href');
a_target = $('a', td).attr('target');
}
if (a_href != '') {
$(td).attr('_href', a_href);
$(td).attr('_target', a_target);
$(td).mouseup(function(event){
if ($.browser.msie) {
middleButtonCode = 4;
} else {
middleButtonCode = 1;
}
if ($(this).attr('_target') == '_blank' || event.button == middleButtonCode) {
window.open($(this).attr('_href'));
} else {
document.location = $(this).attr('_href');
}
});
$(td).addClass('cursorPointer');
}
}
});
}