var isByID		= (document.getElementById)						? true : false;
var isAll		= (document.all)								? true : false;

var isIE4		= (isAll && !isByID)							? true : false;
var isIE5		= (isAll && isByID)								? true : false;
var isIE6		= (navigator.userAgent.indexOf('MSIE 6') > 0) 	? true : false;
var isIE		= (isIE4 || isIE5 || isIE6)						? true : false;
var isIECSS1	= (isAll && (isIE5 || isIE6) && document.compatMode && document.compatMode=='CSS1Compat') ? 
	true : false;

var isNS4	= (document.layers)								? true : false;
/* isNS4=(navigator.appName=='Netscape' && parseInt(navigator.appVersion)==4); ? */
var isNS6	= (!isIE && !isAll && isByID)					? true : false;
var isNS	= (isNS4 || isNS6)								? true : false;
if (isNS4) {
	var nsWinX=window.innerWidth;
	var nsWinY=window.innerHeight;
}

is4		= (isIE4 || isNS4)								? true : false;

var isOpera		= (navigator.userAgent.indexOf('Opera') > 0) 	? true : false;

var _ud = "undefined";
var _udi = -9381232;	// Undefined Integer (preserves type)

// JavaScript Document
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function Object_GetStyle(id)
{
	var x = null;
	if (isNS4) {
		x = document.filters.document.layers[id];
		if (x && x != _ud)
			return x;
	} else if (isIE4)
		x = document.all[id];
	else if (isByID)
		x = document.getElementById(id);
	if (x && x != _ud)
		return x.style;
	return null;
}

function toggle_arrow(id)
{
	var is_vis = Element.visible(id);
	var args = arguments[1] || {duration: 0.25};
	if(navigator.userAgent.indexOf("MSIE 7") > 0) {
		Element.toggle(id);
		if (is_vis) {
			$(id + "_img").src = "/images/white-arrow-right.gif"; 
		} else {
			$(id + "_img").src = "/images/white-arrow-down.gif";
		}
	} else {
		if (is_vis) {
			args.afterFinish = function () { $(id + "_img").src = "/images/white-arrow-right.gif"; }
		} else {
			args.afterFinish = function () { $(id + "_img").src = "/images/white-arrow-down.gif"; }
		}
		new Effect[is_vis ? 'BlindUp' : 'BlindDown'](id, args);
	}
}
function toggle_arrow2(id)
{
	var is_vis = Element.visible(id);
	var args = arguments[1] || {duration: 0.25};
	if (is_vis) {
		args.afterFinish = function () { $(id + "_img").src = "/share/images/toggle/small-right.gif"; }
	} else {
		args.afterFinish = function () { $(id + "_img").src = "/share/images/toggle/small-down.gif"; }
	}
	new Effect[is_vis ? 'BlindUp' : 'BlindDown'](id, args);
}

function survey(id,type,title)
{
	var w = window.open('/survey.asp?ID=' + id + '&ObjectType=' + type + '&title=' + escape(title), 'survey','width=500,height=600,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=no,resizable=no,alwaysRaised=yes');
	w.focus()
}


function forum_switch(u)
{
	var w = window.open('/forum-switch.asp?u=' + escape(u), 'forumswitch','width=450,height=327,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=no,resizable=no,alwaysRaised=yes');
	w.focus()
}
