$(document).ready(function() {



	/* New function to get querystring */
				var after_type_cast = {};
				var before_type_cast = {};
				var cached = false;
			
				jQuery.query = function(cast) {
					if(!cached) {
						// remove leading ? and trailing &
						var q = 
							location.search.replace(/^\?/,'').replace(/\&$/,'').split('&'); 
							for( var i = q.length - 1; i >= 0; i-- ) {
							var p = q[i].split('='), key = p[0], val = p[1];
								before_type_cast[key] = val;
								// convert floats
									if(/^[0-9.]+$/.test(val))
										val = parseFloat(val);
									// convert booleans
									if(/^(true|false)$/.test(val))
											val = (val == 'true');
									// ingnore empty values
									if(val)
										after_type_cast[key] = val;
							}
							cached = true;
					}
					return cast === false ? before_type_cast : after_type_cast;
				};
		
	//set default state for addto area based on querystring
	if ($.query().ee == 1 || $.query().te == 1 || $.query().re == 1)
	{		
		$('#com-addto span.readthrough').show();
		$('#com-addto').addClass("roll-border");
	}
	else
	{
		$('#com-addto span.readthrough').hide();
	}

	//set default states
	//$('#com-addto span.readthrough').hide();
	$('#com-sharethis span.readthrough').hide();

	// shows the slickbox on rolling over the link 
	$('#com-addto a.link').mouseover(function() {
		$('#com-addto span.readthrough').show();
		$('#com-addto').addClass("roll-border");
	});

	// shows the slickbox on rolling over the link 
	$('#com-sharethis .stbuttontext').mouseover(function() {
		$('#com-sharethis span.readthrough').show();
		$('#com-sharethis').addClass("roll-border");
	});
	

	// close addto
	$('#addto-close').click(function() {
		$('#com-addto span.readthrough').hide();
		$('#com-addto').removeClass("roll-border");
	});

	// close addto
	$('#sharethis-close').click(function() {
		$('#com-sharethis span.readthrough').hide();
		$('#com-sharethis').removeClass("roll-border");
	});


	// For community weekly submit your page added October 2010
	$("#show-form-link").click(function(e) {
		e.preventDefault();
		$("#submit-yours-form").show();
		$(this).hide();
	});
	$("#submit-yours-form a.close").click(function(e) {
		e.preventDefault();
		$("#submit-yours-form").hide();
		$("#show-form-link").show();
	});

});
