function $(id) {
	return document.getElementById(id);
}

function cssGetDisplay(id,val) {
	return (cssPropVal(id,'display') == val) ? true : false;
}

function cssSetDisplay(id,val) {
	$(id).style.display=val;
}

function initialCap(str) {
	var ini_cap = str.substr(0,1).toUpperCase();
	var new_str = ini_cap + str.substr(1);
	return new_str;
}

function cssFormatProperty(property,type) { //type = 'dom' (fontSize) or 'css' (font-size)
	var new_format = '';
	switch (type) {
	case 'dom' :
		if (property.indexOf('-') != -1) {
			var prop_array = property.split('-');
			var prop_len = prop_array.length;
			for (var i=0;i<prop_len;i++) {
				new_format += (i === 0) ? prop_array[i] : initialCap(prop_array[i]);
			}
		}
		break;
	case 'css' :
		if (property.indexOf('-') == -1) {
			if (property.search(/[A-Z]/) !== -1) {
				var prop_len = property.length;
				var ltr;
				for (var i=0;i<prop_len;i++) {
					ltr = property.charAt(i);
					new_format += (/[A-Z]/.test(ltr)) ? '-' + ltr.toLowerCase() : ltr;
				}
			}
		}
		break;
	}
	return (new_format == '') ? property : new_format;
}


function cssPropVal(id,property) {
	var style_val = '';
	var el = $(id);
	
	if (el.style[property] && (el.style[property] != '' && el.style[property] != null)) { //inline
		style_val = el.style[property];
		return style_val;
	} else if (el.currentStyle) { //IE
		property = cssFormatProperty(property,'dom');
		style_val = el.currentStyle[property];
		return style_val;
	} else if (document.defaultView && document.defaultView.getComputedStyle) {//Moz
		if (document.defaultView.getComputedStyle(el,"") != null) {
			style_val = document.defaultView.getComputedStyle(el,"").getPropertyValue(property);
			return style_val;
		} else { //Safari element style is "display:none"
			el.style.display='block';
			if (property == 'display') {
				style_val = 'none';
			} else {
				style_val = document.defaultView.getComputedStyle(el,"").getPropertyValue(property);
			}
			el.style.display='none';
			return style_val;
		}
	}
}
//encodeURIComponent()