/*
 * Jax (jQuery activity extend) 0.3
 *
 * Copyright (c) 2008 Hoya Kim
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 * 
 * http://jax.ixcore.co.kr
 *
 * Depends:
 *	jQuery.js
 *
 * version: 0.3
 */
var Jax;
if(Jax && (typeof Jax != 'object' || Jax.Name)){
	throw new Error('Module "Jax" already exists!');
}
Jax = {};
Jax.Name = 'Jax';
Jax.Version = '0.3';
Jax.isIE6lte = $.browser.msie && (parseInt($.browser.version) <= 6);
Jax.getImageExtension = function(){
	return Jax.isIE6lte ? 'gif' : 'png';
}
Jax.writeBr = function(html){
	document.write(html + '<br />\r\n');
};
Jax.getNumber = function(n, d){
	return (n.constructor == Number) ? n : d;
};
Jax.toId = function(s){
	if(!s || typeof s != 'string') throw new Error('Argument must be string.');
	if(!/^#(\w+)$/.test(s)) s = '#' + s;
	return s;
};
Jax.toClassName = function(s){
	if(!s || typeof s != 'string') throw new Error('Argument must be string.');
	if(!/^[.](\w+)$/.test(s)) s = '.' + s;
	return s;
};
Jax.toValueUnit = function(v) {
	var _r = {value: v, unit: 'px'};
	$.each( ['px','em','pt','%'], function(i, u){
		if(v.indexOf(u) > 0)
			_r = {value: parseFloat(v), unit: u};
	});
	return _r;
};

// remove css image flicker
if(Jax.isIE6lte){
	try{
		document.execCommand("BackgroundImageCache", false, true);
	}catch(e){}
}

