function populate_date(month, day, year) {
  ge('date_month').value = month;
  ge('date_day').value = day;
  ge('date_year').value = year;
}

function ge(elem) {
  return document.getElementById(elem);
}

/*
 * Simple Ajax call method.
 *
 * From http://en.wikipedia.org/wiki/XMLHttpRequest
 */
function ajax(url, vars, callbackFunction) {
  var request =  new XMLHttpRequest();
  request.open("POST", url, true);
  request.setRequestHeader("Content-Type",
                           "application/x-www-form-urlencoded");

  request.onreadystatechange = function() {
    if (request.readyState == 4 && request.status == 200) {
      if (request.responseText) {
        callbackFunction(request.responseText);
      }
    }
  };
  request.send(vars);
}

function updatethums(val1,val2,val3,val4,json_data)
{	
	//alert(val1+"------"+val2+"------"+val3+"----"+val4);
	var	fbuid;
	var	id;
	var thumscount;
	var module;
	if(val2<1)
		alert("Please login for rate");
	else
	{
		$("#thums_"+val2).html("<center><img src='images/loader.gif' /></center>");
		$.get("rating.php",{fbuid:val1,id:val2,thumscount:val3,module:val4},function(data){ 
		//alert(data);
		if(data)
			/*alert("vote saved sucessfully ");*/
		$("#thums_"+val2).html(data);		
		facebook_publish_rating_feed_story('162352534838',json_data);
		})
	}
}

function loadcelebrity(ky,pag)
{	
	var	key; var page;
	$(document).ready(function(){
	$("#load_celebrity").html("<center><img src='images/loader.gif' /></center>");
	$.get("loadcelebrity.php",{key:ky,page:pag},function(data){ 
		//alert(data);
	$("#load_celebrity").html(data);
	})
	})
}

function addcelbe(val)
{
	if(val==true)
		document.getElementById('add_celebrity').style.display='block';
	else
		document.getElementById('add_celebrity').style.display='none';
}

function fbcomment(val) 
{ 
	var ajax = new Ajax(); 
	ajax.responseType = Ajax.FBML;
	ajax.ondone = function(data) {
        //document.getElementById('content').setInnerFBML(data);
		document.getElementById(val).setInnerFBML(data); 
    }
	
	//ajax.requireLogin = document.getElementById('requirelogin').getChecked(); 
	ajax.post('showcomment.php?ruid='+val); 
	//ajax.post('http://yoururl.com/ajax.php', {'param1':'value1', 'param2':'value2'});
}

function sharethums(json_data)
{	
	facebook_publish_rating_feed_story('159244386117',json_data);
}