// get the contents of a file at the specified url.
function getUrl(url){
	var request = new Ajax.Request(url, {
		method: 'get',
		asynchronous: false
	});
	return request.transport.responseText;
}

// provides a function String.format(formatStr, arg1, arg2...) to format strings.
String.format = function() {
  if (arguments.length == 0)
    return null;

  var str = arguments[0];
  for (var i = 1; i < arguments.length; i++) {
    var re = new RegExp('\\{' + (i-1) + '\\}','gm');
    str = str.replace(re, arguments[i]);
  }
  return str;
}


//fades out item
function fadeIn(objId,opacity) {
  if (document.getElementById) {
    obj = document.getElementById(objId);
    if (opacity >= 0) {
      setOpacity(obj, opacity);
      opacity -= 10;
      window.setTimeout("fadeIn('"+objId+"',"+opacity+")", 800);

    }
  }
  window.setTimeout("document.getElementById('articlerating').style.display ='block';",7000); 
}

function setOpacity(obj, opacity) {
	opacity = (opacity == 0)?0.001:opacity;
	// IE/Win
	obj.style.filter = "alpha(opacity:"+opacity+")";
	// Safari<1.2, Konqueror
	obj.style.KHTMLOpacity = opacity/100;
	// Older Mozilla and Firefox
	obj.style.MozOpacity = opacity/100;
	// Safari 1.2, newer Firefox and Mozilla, CSS3
	obj.style.opacity = opacity/100;
}


