var xmlhttp
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
  try {
  xmlhttp=new ActiveXObject("Msxml2.XMLHTTP")
 } catch (e) {
  try {
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
  } catch (E) {
   xmlhttp=false
  }
 }
@else
 xmlhttp=false
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
 try {
  xmlhttp = new XMLHttpRequest();
 } catch (e) {
  xmlhttp=false
 }
}
function myXMLHttpRequest() {
  var xmlhttplocal;
  try {
    xmlhttplocal= new ActiveXObject("Msxml2.XMLHTTP")
 } catch (e) {
  try {
    xmlhttplocal= new ActiveXObject("Microsoft.XMLHTTP")
  } catch (E) {
    xmlhttplocal=false;
  }
 }

if (!xmlhttplocal && typeof XMLHttpRequest!='undefined') {
 try {
  var xmlhttplocal = new XMLHttpRequest();
 } catch (e) {
  var xmlhttplocal=false;
  alert('couldn\'t create xmlhttp object');
 }
}
return(xmlhttplocal);
}
var hex = new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F");
var i, j, k;
k = 0;
for (i = 0; i < 16; i++) {
    for (j = 0; j < 16; j++) {
       rgb[k] = hex[i] + hex[j];
       k++;
   }
}
function rgb(r, g, b) {
   return('#'+rgb[r]+rgb[g]+rgb[b]);
}
var ColorIn= new Array();
for (i = 1; i <= 5; i++) {
	ColorIn[i] = new Array();
}

ColorIn[1][1] = rgb(248, 242, 198);
ColorIn[1][2] = rgb(234, 227, 181);
ColorIn[1][3] = rgb(220, 212, 164);
ColorIn[1][4] = rgb(206, 195, 147);
ColorIn[1][5] = rgb(192, 180, 130);
ColorIn[1][6] = rgb(178, 165, 113);
ColorIn[1][7] = "#A39A5D";

ColorIn[2][1] = rgb(247, 236, 172);
ColorIn[2][2] = rgb(231, 220, 158);
ColorIn[2][3] = rgb(215, 204, 140);
ColorIn[2][4] = rgb(199, 188, 122);
ColorIn[2][5] = rgb(183, 172, 104);
ColorIn[2][6] = rgb(167, 156, 86);
ColorIn[2][7] = "#998D43"; 

ColorIn[3][1] = rgb(247, 236, 158);
ColorIn[3][2] = rgb(229, 218, 140);
ColorIn[3][3] = rgb(211, 200, 122);
ColorIn[3][4] = rgb(193, 182, 104);
ColorIn[3][5] = rgb(175, 164, 86);
ColorIn[3][6] = rgb(157, 146, 68);
ColorIn[3][7] = "#897D2F";

ColorIn[4][1] = rgb(247, 232, 137);
ColorIn[4][2] = rgb(225, 210, 119);
ColorIn[4][3] = rgb(203, 188, 101);
ColorIn[4][4] = rgb(181, 166, 83);
ColorIn[4][5] = rgb(159, 144, 65);
ColorIn[4][6] = rgb(137, 122, 47);
ColorIn[4][7] = "#73681F"; 

ColorIn[5][1] = "#F6E26B";
ColorIn[5][2] = "#DAC85B";
ColorIn[5][3] = "#BEAE4B";
ColorIn[5][4] = "#A2943B";
ColorIn[5][5] = "#867A2B";
ColorIn[5][6] = "#6A6019";
ColorIn[5][7] = "#50470D";

ColorSpy = new Array();
ColorSpy[1] = "#FFFFFF";
ColorSpy[2] = "#F1F3F5";
ColorSpy[3] = "#EBEEF1";
ColorSpy[4] = "#DEE2E7";
ColorSpy[5] = "#CCD5DB";
ColorSpy[6] = "#BCC7CF";
ColorSpy[7] = "#ACB9C4";
var timeid = Array();
var responsestring = Array();
var myxmlhttp = Array()
var responseString = new String;
function isIE() {
	var useragent = navigator.userAgent;
	var pos = useragent.indexOf('MSIE');
	if (pos > -1) {
		return false;
	} else {
		return true;
	}

}

function enablebutton(button, target) {
	var string = target.value; 
	if (string.length > 0) {
		button.disabled = false;
	} else {
		button.disabled = true;
	}
}


function reportj(id, code) {
  url="/reportj?id="+id+"&code="+code;
  xmlhttp.open("GET",url,true);
  xmlhttp.onreadystatechange=function() {
    if (xmlhttp.readyState==4) {
      alert(xmlhttp.responseText);
    }
  }
  xmlhttp.send(null);
  return false;
}

function checkit(form) {
  url = '/checkloginname/'+form.login.value;
  checkitxmlhttp = new myXMLHttpRequest();
  checkitxmlhttp.open("GET",url,true);
  checkitxmlhttp.onreadystatechange=function() {
    if (checkitxmlhttp.readyState==4) {
      responsestring = checkitxmlhttp.responseText;
      if (responsestring == 'taken') {
	document.getElementById('checkitvalue').innerHTML = '<span style="color:red">"'+form.login.value+'" '+responsestring+'</span>';
	form.submit.disabled = 'disabled';
      } else {
	document.getElementById('checkitvalue').innerHTML = '<span style="color:black">"'+form.login.value+'" '+responsestring+'</span>';
	form.submit.disabled = '';
      }
    }
  }
  //  xmlhttp.setRequestHeader('Accept','message/x-formresult');
  checkitxmlhttp.send(null);
  return false;  
}

var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
 try {
 xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
 try {
 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
 } catch (E) {
 xmlhttp = false;
 }
 }
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
 xmlhttp = new XMLHttpRequest();
}

function loadFragmentInToElement(fragment_url, element_id) {
 var element = document.getElementById(element_id);
 element.innerHTML = '<center><img src=/files/images/loading.gif></center>';
 setTimeout('', 10000);
 xmlhttp.open("GET", fragment_url);
 xmlhttp.onreadystatechange = function() {
 if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
 element.innerHTML = xmlhttp.responseText;
 }
 }
 xmlhttp.send(null);
}

function loadFragmentInToElementSmall(fragment_url, element_id) {
 var element = document.getElementById(element_id);
 element.innerHTML = '<em>loading...</em>';
 setTimeout('', 10000);
 xmlhttp.open("GET", fragment_url);
 xmlhttp.onreadystatechange = function() {
 if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
 element.innerHTML = xmlhttp.responseText;
 }
 }
 xmlhttp.send(null);
}

function editFundraiserInfo(id, fieldname) {
loadFragmentInToElement("/_xml_edit_fundraiser_info/" + id, fieldname);
}