// JavaScript Document
function Loader(name){
	var t = this;
	t.name = name || "js";
	
	//begin init new jsObjects
	t.setObject = function(hash){
		if((typeof hash).toLowerCase() != 'object') hash = {};
		for(var i in hash){
			try {
				eval('t.'+i+' = '+'new '+hash[i]+'();');//"'+t.name+'.'+i+'"
			}
			catch(e) {
				var msg = (e.message) ? e.message : e.description;//remove after publication
				alert(msg);
			}
		}
	};
	//end init new jsObjects
};


function Global(){
	var t = this;

	t.billy = (document.all)? true : false;
	t.opera = (window.opera)? true : false;
	
	t.reg = {
			"getOneNum" : new RegExp("[0-9]+", "i"),
			"getTwoNum"	: new RegExp(".+?([0-9]+).+?([0-9]+).+?", "i")
			};	
	
	//tools
	t.setEvent = function(id, evt, func){
		if(!id || !evt || !func) return false;
		if(t.billy && !t.opera) document.getElementById(id).setAttribute(evt, function(){eval(func+";")});
		else document.getElementById(id).setAttribute(evt, func+";");
	};
	
	t.getLikeElements = function(tagName, attrName, attrValue) {
		var startSet;
		var endSet = new Array();
		if (tagName) {
			startSet = document.getElementsByTagName(tagName);    
		} else {
			startSet = (document.all) ? document.all : document.getElementsByTagName("*");
		}
		if (attrName) {
			for (var i = 0; i < startSet.length; i++) {
				if (startSet[i].getAttribute(attrName)) {
					if (attrValue) {
						if (startSet[i].getAttribute(attrName).substring(0,attrValue.length) == attrValue) {
							endSet[endSet.length] = startSet[i];
						}
					} else {
						endSet[endSet.length] = startSet[i];
					}
				}
			}
		} else {
			endSet = startSet;
		}
		return endSet;
	};
	
	t.debug = function(txt, clear){
		var clear = clear || false;//true - clear!
		if(!t.output) {
			t.output = document.createElement("div");
			t.output.setAttribute("id", "debugDiv");
			t.output.className = "debug";
			document.body.appendChild(t.output);			
		};		
		if(clear) t.output.innerHTML = "";
		t.output.innerHTML += txt;
	};
	
};