function callReport(war_id, day_num, more, from, err_msg, err_title, err_ok){
	var req = new Request({
							method: 'get',
							url: 'ajax_index.php?aj=guildwar',
							data: { warid : war_id,daynum : day_num, more : more, from : from },
							onRequest: function() {
								if (more == '1'){
									$('report_table').innerHTML = '<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td colspan="7" class="separationBarThink">&nbsp;</td></tr><tr style="height:150px;"><td class="warreport_loading"><img src="images/alliance/loading_icon.gif" alt="" /><br/>Loading</td></tr><tr><td colspan="7" class="separationBarThink">&nbsp;</td></tr><tr><td colspan="7">&nbsp;</td></tr></table>';
								}else{
									$('report_table').getLast().destroy();
									$('report_table').innerHTML += '<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td colspan="7" class="separationBarThink">&nbsp;</td></tr><tr style="height:150px;"><td class="warreport_loading"><img src="images/alliance/loading_icon.gif" alt="" /><br/>Loading</td></tr><tr><td colspan="7" class="separationBarThink">&nbsp;</td></tr><tr><td colspan="7">&nbsp;</td></tr></table>';
								}
							},
							onFailure: function(){ alert(err_title, err_msg, err_ok); },
							onException: function(){ alert(err_title, err_msg, err_ok); },
							onSuccess: function(response){ postReport(response, more);}
	}).send();

	var is_ie     = !!(window.attachEvent && !window.opera);
	var className = (! is_ie) ? 'class' : 'className';
	if (checkVersion())
	{
		className = 'class';
	}
	//set the tab
	for (var i=0;i<7 ;i++ ){
		var the_left = $('awar_button_left_' + i);
		var the_center = $('awar_button_center_' + i);
		var the_right = $('awar_button_right_' + i);

		var war_date = $('war_date_'+i);

		if (i == day_num){
			the_left.setAttribute(className, 'awar_button_reading_left');
			the_center.setAttribute(className, 'awar_button_reading_center active_date');
			the_right.setAttribute(className, 'awar_button_reading_right');
			war_date.setAttribute(className, 'show_date');
		}else{
			the_left.setAttribute(className, 'awar_button_left');
			the_center.setAttribute(className, 'awar_button_center');
			the_right.setAttribute(className, 'awar_button_right');
			war_date.setAttribute(className, 'hide_date');
		}
	}
}

function postReport(response, more){
	if (more == '1'){
		$('report_table').set('html', response);
	}else{
		$('report_table').getLast().destroy();
		$('report_table').innerHTML += response;
	}

	var the_url = window.location.href;
	var the_anchor_index = the_url.indexOf("#", 0);
	if(the_anchor_index > 0){
		window.location = the_url.substr(0, the_anchor_index) + "#content_anchor";
	}else{
		window.location = the_url + "#content_anchor";
	}

	init_tooltip();
}

function getInternetExplorerVersion()
{
	// Returns the version of Internet Explorer or a -1
// (indicating the use of another browser).
  var rv = -1; // Return value assumes failure.
  if (navigator.appName == 'Microsoft Internet Explorer')
  {
    var ua = navigator.userAgent;
    var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
    if (re.exec(ua) != null)
      rv = parseFloat( RegExp.$1 );
  }
  return rv;
}
function checkVersion()
{
  var msg = "You're not using Internet Explorer.";
  var ver = getInternetExplorerVersion();

  if ( ver > -1 )
  {
    if ( ver >= 8.0 )
      return true;
    else
      return false;
  }

}

