//toggle{ id , n|b|i|t , b|i}
function tog(id,typ,tog){
	var o = document.getElementById(id);
	var x = o.style.display;
	switch(typ){
		case 'n':
			x="none";
			break;
		case 'b':
			x="block";
			break;
		case 'i':
			x="inline";
			break;
		default:
			if(tog=="b"&&x!="block"){x="block"}
			else if(tog=="i"&&x!="inline"){x="inline"}
			else{x="none"};
	}
	o.style.display=x;
}
//emotion
function grin(tag) {
    	var myField;
    	tag = ' ' + tag + ' ';
        if (document.getElementById('comment') && document.getElementById('comment').type == 'textarea') {
    		myField = document.getElementById('comment');
    	} else {
    		return false;
    	}
    	if (document.selection) {
    		myField.focus();
    		sel = document.selection.createRange();
    		sel.text = tag;
    		myField.focus();
    	}
    	else if (myField.selectionStart || myField.selectionStart == '0') {
    		var startPos = myField.selectionStart;
    		var endPos = myField.selectionEnd;
    		var cursorPos = endPos;
    		myField.value = myField.value.substring(0, startPos)
    					  + tag
    					  + myField.value.substring(endPos, myField.value.length);
    		cursorPos += tag.length;
    		myField.focus();
    		myField.selectionStart = cursorPos;
    		myField.selectionEnd = cursorPos;
    	}
    	else {
    		myField.value += tag;
    		myField.focus();
    	}
    }

//jquery subFunctions
$().ready(function (){
	//feedMe
	$("#feedAll").hover(
		function() {
			$("#feedMe").show("fast");
		}
		,function() {
			$("#feedMe").hide("slow");
		}
		);
	//loading state
	$("#loading").hide(2000);
	//strict.dtd
	$("a[rel='external']").attr("target","_blank");
})
