function Kassit(){
	this.isIE = (navigator.appVersion.indexOf("MSIE") != -1 || document.all) 
	this.isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) 

	this.keyHandler = function (e, key){
		var asc = document.all ? event.keyCode : e.which;
		if(asc == key)	return true;
		else	return false;
	}
	
	this.handle = function(e, key, func){
		if(this.keyHandler(e, key))	window.setTimeout(func, 0.1);
	}
	
	this.getViewport = function(){
		var w, h;
		if (self.innerWidth) {
			w = self.innerWidth;
			h = self.innerHeight;
		} else if (document.documentElement&&document.documentElement.clientWidth) {
			w = document.documentElement.clientWidth;
			h = document.documentElement.clientHeight;
		} else {
			w = document.body.clientWidth;
			h = document.body.clientHeight;
		}
		return {width: w, height: h};
	}
	
	this.actualSize = function(el){
		var w, h = 0;
		if(typeof el != 'object')
			el = document.getElementById(el);
		
		if (document.all) {
			w = (el.currentStyle['width'.replace(/-/g, '')]).replace('px', '');
			h = (el.currentStyle['height'.replace(/-/g, '')]).replace('px', '');
		} else {
			w = (document.defaultView.getComputedStyle(el, null).getPropertyValue('width')).replace('px', '');
			h = (document.defaultView.getComputedStyle(el, null).getPropertyValue('height')).replace('px', '');
		}
        
		if(w == NaN || w == 'auto') w = el.clientWidth || el.offsetWidth;
		if(h == NaN || h == 'auto') h = el.clientHeight || el.offsetHeight;
        
		return {width: w, height: h};
	}
	
	this.getStyle = function(el, styleProp) {
		if(typeof el != 'object')
			el = document.getElementById(el)
		if (el.currentStyle)
			var y = el.currentStyle[styleProp];
		else if (window.getComputedStyle)
			var y = document.defaultView.getComputedStyle(el,null).getPropertyValue(styleProp);
		return y;
	}
	
	this.getPosition = function(elm) {
		var posX, posY = 0;
		posX = elm.offsetLeft;
		posY = elm.offsetTop;
		elm = elm.offsetParent;
		while(elm != null) {
			posX = parseInt(posX) + parseInt(elm.offsetLeft);
			posY = parseInt(posY) + parseInt(elm.offsetTop);
			elm = elm.offsetParent;
		}
		return {x: posX, y: posY};
	}
	
	this.parseURL = function(Url){
		URL = new Array();
		var URLSeg = Url.split('?');
		URL['protocol'] = URLSeg[0].split(':')[0];
		var mainAdd = URLSeg[0].substring((URL['protocol'].length + 3),(URLSeg[0].length - 1))
		URL['domain'] = mainAdd.split('.')[mainAdd.split('.').length - 1];
		if(URL['domain'].toLowerCase() == 'localhost')
			URL['host'] = 'localhost';
		else
			URL['host'] = mainAdd.split('.')[mainAdd.split('.').length - 2];
			
		if(URLSeg.length > 1){
			var safeString = new String(URLSeg[1].split('#')[0]);
			var URLParams = safeString.split('&');
			for(i=0; i<URLParams.length; i++){
				if(URLParams[i].indexOf('=') != -1){
					var nv = URLParams[i].split('=');
					URL[nv[0]] = nv[1];
				}
			}
		}
		return URL;
	}
	this.i = 0;
	this.asTable = function (el, lw, rw){
		if(this.i++ == 0) alert(el.id);
		$(el).css('display', 'inline');

		try{
		    cn = parseFloat($(cn).css('width').replace('px', ''));
		} catch(err){el = 0;}
		
		try{
		    $(lw).css('display', 'inline');
		    lw = parseFloat($(lw).css('width').replace('px', ''));
		} catch(err){lw = 0;}
		
		try{
		    $(rw).css('display', 'inline');
		    rw = parseFloat($(rw).css('width').replace('px', ''));
		} catch(err){rw = 0;}
		
		return (cn - (lw+rw)) + 'px';
	}
	
	this.loadScripts = function(src){
		if (src != '' && src != null) {
			var S = new String(src);
			var Scrpt = S.split(';');
			for (j = 0; j < Scrpt.length; j++) {
				var index = this.scripts.length;
				this.scripts[index] = document.createElement('script');
				this.scripts[index].type = 'text/javascript';
				this.scripts[index].src = Scrpt[j];
				this.script.appendChild(this.scripts[index]);
				this.scripts[index].done = false;
				this.scripts[index].parent = this;
				if (!this.isIE)
					this.scripts[index].onload = function(){this.done = true};
				else
					this.scripts[index].onreadystatechange = function(){
						if (this.readyState == 'complete' ||
							this.readyState == 'loaded' ||
							this.readyState == 4){
							this.done = true;
						}
					}
			}
		}
	}
};

kassit = new Kassit();        