
function printwindow(printdocument){
if(!printdocument) printdocument = document;
w = 600;
h = 400;
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
var printwindow = window.open ('', 'printwindow', config='height='+h+',width='+w+' , left='+LeftPosition+' , top='+TopPosition+' , toolbar=no, menubar=no, scrollbars=yes, resizable=yes,location=no, directories=no, status=no');
var head = printdocument.getElementsByTagName('head')[0].innerHTML;
var html = '<html><head>'+ head + '</head><body><div id="noprint"><center style="clear:both"><input type="button" value="_t_print_t_" onclick="window.print()" /></center><hr /></div>'+ printdocument.getElementById('print_body').innerHTML;
/* html    += "<script>window.print()</script>"; */
html    += "</body></html>";
//variable name of window must be included for all three of the following methods so that
//javascript knows not to write the string to this window, but instead to the new window
printwindow.document.open();
printwindow.document.write(html);
printwindow.document.close();
return false;
}
function quickpopup(url , name , w, h){
if(!w) w = 300;
if(!h) h = 250;
if(!name) name = 'quickpopup';
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
var printwindow = window.open (url, name , config='height='+h+',width='+w+' , left='+LeftPosition+' , top='+TopPosition+' , toolbar=no, menubar=no, scrollbars=yes, resizable=yes,location=no, directories=no, status=no');
//variable name of window must be included for all three of the following methods so that
//javascript knows not to write the string to this window, but instead to the new window
return false;
}	
function $() {
var elements = new Array();
for (var i = 0; i < arguments.length; i++) {
var element = arguments[i];
if (typeof element == 'string')
element = document.getElementById(element);
if (arguments.length == 1)
return element;
elements.push(element);
}
return elements;
}
function fieldAlert(myFields , myAlerts){
window.onload = function() {
to_alert = "";
for(i=0 ; i< myFields.length ; i++){
if(document.getElementsByName(myFields[i]).item(0)){
var newPara = document.createElement("div");
newPara.className = 'input-error';
newPara.innerHTML = myAlerts[i];
var insertHere = document.getElementsByName(myFields[i]).item(0);
insertHere.parentNode.appendChild(newPara);
insertHere.style.border = '1px red solid';
}else
to_alert = to_alert + myFields[i] + ": "+ myAlerts[i] + "\n";
}
if(to_alert != "")
alert(to_alert);
}
}
// Example:
// alert( readCookie("myCookie") );
function readCookie(name)
{
var cookieValue = "";
var search = name + "=";
if(document.cookie.length > 0)
{ 
offset = document.cookie.indexOf(search);
if (offset != -1)
{ 
offset += search.length;
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
cookieValue = unescape(document.cookie.substring(offset, end))
}
}
return cookieValue;
}
// Example:
// writeCookie("myCookie", "my name", 24);
// Stores the string "my name" in the cookie "myCookie" which expires after 24 hours.
function writeCookie(name, value, hours)
{
var expire = "";
if(hours != null)
{
expire = new Date((new Date()).getTime() + hours * 3600000);
expire = "; expires=" + expire.toGMTString();
}
document.cookie = name + "=" + escape(value) + expire;
}
function hl_blinker(objID){
if(!$(objID)) return false;
var oldBg   = $(objID).style.background;  for(i=0; i<=6; i++) {   if (i%2 == 0)    clr = "#FFFFFF";   else  clr = "#FFFFCC";    timeOut = (250+(i*250));  setTimeout("$('"+objID+"').style.background='"+clr+
"'",timeOut);  }  setTimeout("$('"+objID+"').style.background='"+oldBg
+"'",(timeOut+100));   }
function hl_dimmer(objID){ 
if(!$(objID)) return false;
var arrTemp = 
["0","1","2","3","4","5","6","7", "8" ,"9","A","B","C","D","E","F"];
var oldBg   = $(objID).style.background;  var timeOut; for(i=0; i<arrTemp.length; i++) {  clr = "#FFFF"+arrTemp[i]+""+arrTemp[i];  timeOut = (i*80);  setTimeout("$('"+objID+"').style.background='"+clr+
"'",timeOut);  }  setTimeout("$('"+objID+"').style.background='"+oldBg
+"'",(timeOut+100)); }

function disable(id){
var nodes;
	if($(id)){
nodes = $(id).childNodes;
for(i in nodes)
{
if($(id).childNodes[i] && $(id).childNodes[i].nodeType==1){
$(id).childNodes[i].disabled = true;
}
}
$(id).disabled = true;	 
	}
}
function enable(id){
var nodes;
	if($(id)){
nodes = $(id).childNodes;
for(i in nodes)
{
if($(id).childNodes[i] && $(id).childNodes[i].nodeType==1)
$(id).childNodes[i].disabled = false;
}
$(id).disabled = false;		
	}
}
function switch_disable(checked, element){
	if(checked) disable(element);
	else		 enable(element);
}
function switch_enable(checked, element){
	if(checked) enable(element);
	else		 disable(element);
}
function display(id){
	if($(id)){
$(id).style.visibility = 'visible';	 
$(id).style.display    = 'block';	 
	}
}
function hide(id){
	if($(id)){
$(id).style.visibility = 'hidden';	 
$(id).style.display    = 'none';		
	}
}
function switch_display(checked, element){
	if(checked) display(element);
	else		 hide(element);
}
function switch_hide(checked, element){
	if(checked) hide(element);
	else		 display(element);
}
//specify whether contents should be auto copied to clipboard (memory)
//Applies only to IE 4+
//0=no, 1=yes
var copytoclip=1
function HighlightAll(tempval) {
tempval.focus();
tempval.select();
if (document.all&&copytoclip==1){
therange=tempval.createTextRange();
therange.execCommand("Copy");
}
}

  function clearMsg(element , msg){
	  if(element.value == msg)
   		element.value = "";
  }
  function setMsg(element , msg){
	  if(element.value == "")
   		element.value = msg;
  }  
function disable_contribution_button(){
	disable($('contribution_submit'));	
}





