function $(e){return document.getElementById(e);}

function addEventSimple(o,e,f) {
	if (o.addEventListener)
		o.addEventListener(e,f,false);
	else if (o.attachEvent)	{
		o['e'+e+f] = f;
		o[e+f] = function(){o['e'+e+f](window.event);}
		o.attachEvent('on'+e,o[e+f]);
	}
}
<!--// DIV CLOSING SCRIPT //-->
function switchMenu(obj) 
	{
		var el = document.getElementById(obj);
		if ( el.style.display != 'none' ) 
			{
				el.style.display = 'none';
			}
		else 
			{
				el.style.display = '';
			}
	}
<!--// SHOW ANSWER DIV //-->
function sAns(obj)
	{
		var el = document.getElementById(obj);
		if ( el.style.display == 'none' )
			{
				el.style.display = '';
			}
	}
<!--// TWITTER LOGIN //-->
function twLogin()
	{
		alert('You need to be logged in to do this.\nClick the "Sign in with Twitter" button above\n');
	}
<!--// ARE YOU SURE? //-->
function proceedy(wlocation,confirmMsg) {
	var answer = confirm(confirmMsg);
	if (answer){
		window.location = wlocation;
	}
	else
	{
	}
}
<!--// COUNT-DOWN CHARS SCRIPT //-->
<!--// Script by hscripts.com //-->
var count = "140";   //Example: var count = "175";
function twLimiter()
	{
		var tex = document.twform.tw_comment.value;
		var len = tex.length;
		if(len > count)
			{
		        tex = tex.substring(0,count);
       			 document.twform.tw_comment.value = tex;
		        return false;
			}
		document.twform.tw_limit.value = count-len;
}
<!--// IN-REPLY-TO SCRIPT //-->
function twInReply(tw_id,recipientRep,tw_text)
	{
		document.getElementById( 'whatIs' ).innerHTML = tw_text;
		document.twform.inreply.value = tw_id;
		if (recipientRep != '')
			{
				var lenRec = recipientRep.length;
				document.twform.tw_limit.value = 140-lenRec;
				document.twform.tw_comment.focus();
				document.twform.tw_comment.value = recipientRep;
			}
		document.twform.tw_comment.focus();
	}
<!--// RETWEET SCRIPT //-->
function twReTweet( twMsg,twType )
	{
		document.twform.tw_type.value = twType;
		
		document.getElementById( 'tw_message' ).style.display = '';
		document.twform.tw_comment.focus();
		
		if (twMsg != '')
			{
				var lenMsg = twMsg.length;
				document.twform.tw_limit.value = 140-lenMsg;
				document.twform.tw_comment.focus();
				document.twform.tw_comment.value = twMsg;
			}
	}
<!--// CLEAR TEXTFIELD //-->
function clField(t,st)
	{
		var s = document.getElementById(t);
		if (s.value == st)
			{
				s.value = '';
				s.style.color = '#333';
			}
	}
<!--// REDO TEXTFIELD //-->
function rdField(t,st)
	{
		var s = document.getElementById(t);
		if (s.value == '')
			{
				s.value = st;
				s.style.color = '#CCC';
			}
	}
<!--// AUTOTWEET //-->
function autoTweet(i_t,t_t)
	{
		var i = document.getElementById( 'span_pic' );
		var t = document.getElementById( 'span_txt' );
		document.auto_tweet_form.tw.value = t_t;
		i.innerHTML = '<img src="' + i_t + '" />';
		t.innerHTML = t_t;
	}
<!--// JUSTANSWER SUBMIT //-->
function submitLimit()
	{
		var d = document.getElementById( 'ja_question' ).value;
		if (d.length > 1000)
			{
				document.getElementById( 'qb_submit' ).style.display = 'none';
				document.getElementById('ja_length').innerHTML = '<span class="red">Your question should be less than 1000 characters</span>';
				document.getElementById('ja_length').style.height = '24px';
			}
		else
			{
				document.getElementById( 'qb_submit' ).style.display = '';
				document.getElementById('ja_length').innerHTML = '';
				document.getElementById('ja_length').style.height = '';
			}
	}
<!--// ATTACHING PHP SCRIPT //-->
function attach_file( p_script_url ) 
	{
		// create new script element, set its relative URL, and load it
		script = document.createElement( 'script' );
		script.src = p_script_url;
		document.getElementsByTagName( 'head' )[0].appendChild( script );
	}
<!--// SELECT ALL //-->
function selectAll(id)
	{
    	document.getElementById(id).focus();
	    document.getElementById(id).select();
	}
<!--// CHANGE CODE FOR WIDGET //-->
function changeCodeWidget(uname,uid,o_source,l_source,h_source,k_source)
	{
    	var dd = document.getElementById( 'type_sel' ).value;
		var t = document.getElementById( 'get_code' );
		var t_img = document.getElementById( 't_img' );
		
		t.value = '<a href="http://twithelp.me/profile/' + uname + '/" title="Give and get help with anything you want"><img src="http://twithelp.me/widget.php?i=' + uid + '&t=' + dd + '" alt="" /></a>';
		
		if (dd == 'o')
			{
				var img_src = 'ownership-' + o_source;
			}
		else if (dd == 'l')
			{
				var img_src = 'loyalty-' + l_source;
			}
		else if (dd == 'h')
			{
				var img_src = 'helper-' + h_source;
			}
		else if (dd == 'k')
			{
				var img_src = 'karmicpanda-' + k_source;
			}
		else
			{
				if (o_source != '')
					{
						var img_src = 'ownership-' + o_source;
					}
				else if (l_source != '')
					{
						var img_src = 'loyalty-' + l_source;
					}
				else if (h_source != '')
					{
						var img_src = 'helper-' + h_source;
					}
				else if (k_source != '')
					{
						var img_src = 'karmicpanda-' + k_source;
					}
			}
		t_img.src = '/assets/widget-' + img_src + '.jpg';
	}
