
function aa_pop( href, name, width, height, top, left, resizable, scrollbars )
{
	wnd = window.open( href, name, 'width='+width+', height='+height+', top='+top+', left='+left+', toolbar=no, menubar=no, location=no, resizable='+resizable+', scrollbars='+scrollbars+', status=yes, statusbar=yes');
	wnd.focus();
	return false;
}

function aa_pop_static( href, name, width, height )
{
	return aa_pop( href, name, width, height, 100, 100, 'no', 'yes' );
}

function aa_pop_max( href, name )
{
	return aa_pop( href, name, screen.availWidth, screen.availHeight, 0, 0, 'yes', 'yes' );
}

function aa_pop_tool( href, name, width, mheight )
{
	var scW = screen.availWidth ? screen.availWidth : screen.width;
	var scH = screen.availHeight ? screen.availHeight : screen.height;

	var height = scH - mheight;

	var defL = (width && !window.opera) ? Math.round((scW-width)/2) : 100;
	var defT = (height && !window.opera) ? Math.round((scH-height)/2) : 100;

	return aa_pop( href, name, width, height, defT, defL, 'no', 'yes' );
}

function aa_pop_centered( href, name, width, height )
{
	var scW = screen.availWidth ? screen.availWidth : screen.width;
	var scH = screen.availHeight ? screen.availHeight : screen.height;

	var defL = (width && !window.opera) ? Math.round((scW-width)/2) : 100;
	var defT = (height && !window.opera) ? Math.round((scH-height)/2) : 100;

	return aa_pop( href, name, width, height, defT, defL, 'no', 'yes' );
}

function aa_pop_image( href, title )
{
	var i = new Image; i.src = href;

	var defW = (i.width) ? i.width : 300;
	var defH = (i.height) ? i.height : 200;

	var scW = screen.availWidth ? screen.availWidth : screen.width;
	var scH = screen.availHeight ? screen.availHeight : screen.height;
	var defL = (i.width && !window.opera) ? Math.round((scW-i.width)/2) : 100;
	var defT = (i.height && !window.opera) ? Math.round((scH-i.height)/2) : 100;

	var wnd = window.open('','_blank','scrollbars=no,resizable=1,width='+defW+',height='+defH+',left='+defL+',top='+defT);
	if( !wnd ) { return true; } //popup blockers should not cause errors
	wnd.document.write('<html><head><title>'+title+'<\/title><script type="text\/javascript">\n'+
		'function resizeWinTo() {\n'+
		'if( !document.images.length ) { document.images[0] = document.layers[0].images[0]; }'+
		'var oH = document.images[0].height, oW = document.images[0].width;\n'+
		'if( !oH || window.doneAlready ) { return; }\n'+ //in case images are disabled
		'window.doneAlready = true;\n'+ //for Safari and Opera
		'var rabW = 100, rabH = 100;\n'+
		'var x = window; x.resizeTo( oW + rabW, oH + rabH );\n'+
		'var myW = 0, myH = 0, d = x.document.documentElement, b = x.document.body;\n'+
		'if( x.innerWidth ) { myW = x.innerWidth; myH = x.innerHeight; }\n'+
		'else if( d && d.clientWidth ) { myW = d.clientWidth; myH = d.clientHeight; }\n'+
		'else if( b && b.clientWidth ) { myW = b.clientWidth; myH = b.clientHeight; }\n'+
		'if( window.opera && !document.childNodes ) { myW += 16; }\n'+
		'x.resizeTo( oW = oW + ( ( oW + rabW ) - myW ), oH = oH + ( (oH + rabH ) - myH ) );\n'+
		'var scW = screen.availWidth ? screen.availWidth : screen.width;\n'+
		'var scH = screen.availHeight ? screen.availHeight : screen.height;\n'+
		'if( !window.opera ) { x.moveTo(Math.round((scW-oW)/2),Math.round((scH-oH)/2)); }\n'+
		'}\n'+
		'<\/script>'+
		'<\/head><body onload="resizeWinTo();">'+
		(document.layers?('<layer left="0" top="0">'):('<div style="position:absolute;left:0px;top:0px;">'))+
		'<a href="javascript:self.close();"><img src="'+href+'" onload="resizeWinTo();" border="0" /></a>'+
		(document.layers?'<\/layer>':'<\/div>')+'<\/body><\/html>');
	wnd.document.close();
	if( wnd.focus ) { wnd.focus(); }
	return false;
}

function aa_copy_clipboard( id )
{
	o = document.getElementById(id);
	if( o && o.createTextRange ) o.createTextRange().execCommand("Copy");
}

function aa_paste_clipboard( id )
{
	o = document.getElementById(id);
	if( o && o.createTextRange ) o.createTextRange().execCommand("Paste");
}

//Tests if element is a PNG image, and if so fixes it
function aa_pngfix(element){
	if (/\.png$/i.test(element.src)) {
		element.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + element.src + "')";
		element.src = '/icons/blank.gif';
	}
}

var aa_ifh_div;
var aa_ifh_top;
var aa_ifh_target;

function aa_ifh_scroll_()
{
	aa_ifh_target = parseInt(document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
	aa_ifh_top = ( 4*aa_ifh_top + aa_ifh_target ) / 5;
	aa_ifh_div.style.top = ( aa_ifh_target < aa_ifh_top ) ? Math.floor(aa_ifh_top) : Math.ceil(aa_ifh_top);
}

function aa_ifh_scroll()
{
	if((navigator.appVersion.indexOf("MSIE")!= -1)&&!window.opera)
	{
		aa_ifh_div = document.all ? document.all.aa_header : document.getElementById ? document.getElementById("aa_header") : document.aa_header;
		aa_ifh_top = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop;
		aa_ifh_target = aa_ifh_top;
		setInterval("aa_ifh_scroll_()",10);
	}
}

function aa_ifh_select( o )
{
	var si = o.selectedIndex; o.selectedIndex = 0; var url = o.options[si].value;

	if( si == o.options.length - 1 || si == o.options.length - 2 ) aa_pop_static(url,'support', 500, 550);
	else if( url ) window.open(url,'_blank');
}
