function sc_getTimestamp()
{
	var t = new Date();
	var r = "" + t.getFullYear() + t.getMonth() + t.getDate() + t.getHours() + t.getMinutes() + t.getSeconds(); 

	return(r);
}

function rateComment(comment_id, rating)
{	
	var url = '/wp-content/plugins/strangercomments/services/ratecomment.php';
	var pars = 'c=' + comment_id + '&r=' + rating + '&ts=' + sc_getTimestamp();	
	
	var stars = $('stars_'+comment_id);	
	stars.innerHTML = '<center style="font-weight: normal; size: 10px;"><blink>updating</blink></center>';
	stars.style.display = "";
	
	var myAjax = new Ajax.Updater( 'stars_'+comment_id, url, { method: 'get', parameters: pars, evalScripts: true}); 
}

function toggleContent(target, opened, closed)
{
	//find target
	var root;
	if(target.substring(0, 1) == '.')
	{
		root = target.substr(1,target.length);		
		var otarget = target;
	}
	else
	{
		root = target;
	}
		
	var eSwitch = $('switch_' + root);
	var target = $('content_' + root);
	
	//todo: add code to handle images for opened and closed
		
	//hide/show
	if (eSwitch.innerHTML == closed)
	{
		eSwitch.innerHTML = opened;

		eSwitch.className = eSwitch.className.replace(' openswitch', '');
		eSwitch.className = eSwitch.className + ' closeswitch';
		
		//if open = close, just hide the switch
		if(opened == closed)
			eSwitch.hide();
		
		//new Effect.BlindDown(target, {});
		if(otarget)
			$$(otarget).each(function(e) {e.show();});
		else
			$(target).show();					
	}
	else
	{
		eSwitch.innerHTML = closed;
		
		eSwitch.className = eSwitch.className.replace(' closeswitch', '');
		eSwitch.className = eSwitch.className + ' openswitch';
		
		//new Effect.BlindUp(target, {});
		if(otarget)
			$$(otarget).each(function(e) {e.hide();});
		else
			$(target).hide();		
	}		
}