
function ajax_update(url,params,update) {


	 $.post(url, params, function(data){
        
		
			$(update).html(data);
			hidefooter();
									  
	});
	 
}
function view_pdf(filename, name) {
new_window = window.open(filename, name, 'width=1200, height=1020, location=no, resizeable=1');
new_window.focus();
 return false; // return false so that the browser will not follow the link that this event is tied to
}
function switchnews(items, container) {
	
	$('#'+container+' #news-menu a').removeClass('active');
	$('#'+container+' #'+items).addClass('active');
	
	if (items=='aa') {
		$('#'+container+' .ii').show();
		$('#'+container+' .pp').show();
		$('#'+container+' .cc').show();
		$('#'+container+' .tt').show();
		$('#'+container+' .bb').show();
		$('#'+container+' .ee').show();
		$('#'+container+' .asia').show();
	}
	else {
		$('#'+container+' .ii').hide();
		$('#'+container+' .pp').hide();
		$('#'+container+' .cc').hide();
		$('#'+container+' .tt').hide();
		$('#'+container+' .bb').hide();
		$('#'+container+' .ee').hide();
		$('#'+container+' .asia').hide();
		
		
		$('#'+container+' .'+items).show();
		
	}

	/*if ((items == 'aa') || (items == 'ii')) {
		document.getElementById('news-release-text').style.display = 'block';
	}
	else {
		document.getElementById('news-release-text').style.display = 'none';
	}*/

}

function showbio(bio) {

	$('#'+bio).show().parent().children('.biolink').children('.showfull').hide();
	//$('#'+bio).next().next('.showfull').hide();
	$('#'+bio).parent().children('.biolink').children('.contract').show();
	
	//$('#'+bio).parent().css('background-color','#');
	//setTimeout("$('#"+bio+"').parent().css('background-color','');", 1300);

	//$('#'+bio).parent().find('strong.blueone').animate({fontSize:'22px'}, 600).animate({fontSize:'14px'}, 100);

	
	//fix footer!
	hidefooter();
}
function hidebio(bio) {

	$('#'+bio).hide().parent().children('.biolink').children('.showfull').show();
	//$('#'+bio).next().next('.showfull').hide();
	$('#'+bio).parent().children('.biolink').children('.contract').hide();
	hidefooter();
}
function hidefooter() {
	$('div.footer').hide();
	$('div.footer').css('bottom','0px');
		$('div.footer').show();
	}




function showLogin ()
{
  $("#xntLogin").show();


  var focusControl = document.forms["xntLoginDD"].elements["email"];

  if (focusControl.style.visibility != "hidden" && focusControl.style.display != "none" && !focusControl.disabled && focusControl.type != "hiden") {
     focusControl.focus();
  }

}
function hideLogin ()
{
  $("#xntLogin").hide();

}

function submitOnEnter(myfield,e)
{
  var keycode;
  if (window.event) 
  {
    keycode = window.event.keyCode;
  }
  else if (e) 
  {
    keycode = e.which;
  }
  else 
  {
    return true;
  }

  if (keycode == 13)
  {
    myfield.form.submit();
    return false;
  }
  else
  {
    return true;
  }
}

function checkLoginBox (event)
{
  
  var elem;

  if (document.addEventListener)
  {
    elem = event.relatedTarget;
    //alert(event.relatedTarget.nodeName);
  }
  else if (document.attachEvent)
  {
    elem = event.toElement;
    //alert(event.toElement.nodeName);
  }

 // var blah = elem.getAttribute("blah");
  //alert(elem.id + ", " + blah);

  if (elem && elem.getAttribute("lang") == "blah")
  {
    //still inside - do nothing
  }
  else
  {
    hideLogin();
  }

  return true;
}

function SearchSubmit ()
{
  document.forms["barSearch"].submit();
}

var sortables = new Array();
var lastSort = 'desc';
function sortitems() {
	var set = $('#news-container > div');
	var i = 0;
	for(i=0; i<set.length;i++) {

		//if($(set[i]).css('display') != 'none') {

			sortables[i] = new createSort(set[i], Date.parse($(set[i]).find('.date').html()));
		//}
	}
	if(lastSort=='desc') {
		sortables.sort(byDateAsc);
		lastSort = 'asc';
	}
	else {
		sortables.sort(byDateDesc);
		lastSort = 'desc';
	}
	
	$('#news-container').html('');
	
	for(i=0; i<sortables.length;i++) {
		//alert(sortables[i].element);
		$('#news-container').append(sortables[i].element);
	}
}

function createSort(element, timestamp) {
	this.element = element;
	this.timestamp = timestamp;
}

function byDateAsc(a, b) {
	return ((a.timestamp < b.timestamp) ? -1 : ((a.timestamp > b.timestamp) ? 1 : 0));
}
function byDateDesc(a, b) {
	return ((a.timestamp > b.timestamp) ? -1 : ((a.timestamp < b.timestamp) ? 1 : 0));
}

function openVideo(url, title, windowWidth, windowHeight) {
	
		ajaxwin=dhtmlwindow.open("ajaxbox", "inline", '<object width="'+windowWidth+'px" height="'+windowHeight+'px"><param name="movie" value="'+url+'"></param><param name="allowFullScreen" value="false"></param><param name="allowscriptaccess" value="always"></param><embed src="'+url+'" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="'+windowWidth+'" height="'+windowHeight+'"></embed></object>', title, "width="+(windowWidth+15)+"px,height="+(windowHeight+15)+"px,left=300px,top=100px,resize=1,scrolling=1")
	
		
		return false;
	
}
