function checkBoxes(obj) {	
	checks = obj.split(",");
	for(i=0;i < 1;i++) {
			document.getElementById(checks[i]).checked = false;
			if (checks[i] == "terms") {
				document.getElementById('termsinfo').style.display = "none";
			} else if (checks[i] == "warranty") {
				document.getElementById('warrantyinfo').style.display = "none";
			}
	}		
}

function toggleBox(obj) {
	if(document.getElementById(obj).style.display == "none" | document.getElementById(obj).style.display == "") {
		if(window.ActiveXObject) {
			document.getElementById(obj).style.display = "block";
		} else {
			document.getElementById(obj).style.display = "table";
		}
	} else {			
		document.getElementById(obj).style.display = "none";
	}
}

function showLoading() {
	document.addform.submit();
	setTimeout('document.getElementById(\'content\').innerHTML = \"<div style=\'text-align: center; margin: 50px auto 50px auto;\'><img src=\'images/uploading.gif\' width=\'222\' height=\'25\' alt=\'Uploading Images\' />\"', 1000);
}

function removeConfirm(userID) {
	c = confirm("Are you sure you want to remove this?");
	
	if(c) {
		document.location.replace('remove.php?userid=' + userID);
	}
}

function removeAnimal(itemID,section,view) {
	c = confirm("Are you sure you want to remove this?");
	
	if(c) {
		document.location.replace('removeanimal.php?itemid=' + itemID +'&section=' + section + '&view=' + view);
	}
}

function changePhoto(photo,elementID) {
	document.getElementById(elementID).innerHTML = "<img src=\"pictures\\" + photo + "\" />"
}

function closeBox(obj) {
	document.getElementById(obj).style.display = "none";
}

function removePhoto(image,rowID,section,photo) {
	postContent('removephoto.php','image='+image+'&id='+rowID+'&section='+section+'&photo='+photo+'');
	setTimeout('window.location.reload()', 1000);
}

var xmlhttp;

function postContent(url,eventVar) {
	
	if (window.XMLHttpRequest) {
  
  		xmlhttp=new XMLHttpRequest();
		xmlhttp.onreadystatechange=state_Change;
		xmlhttp.open("POST",url,true);
		xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');
		xmlhttp.send(eventVar);
  
  } else if (window.ActiveXObject) {
	  
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    
	if (xmlhttp) {
		
		xmlhttp.onreadystatechange=state_Change;
		xmlhttp.open("POST",url,true);
		xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');
		xmlhttp.send(eventVar);
	}
  
  }

}

function state_Change() {
	if (xmlhttp.readyState==4&&xmlhttp.responseText) {
		if (xmlhttp.status==200) {
			contentLoaded = true;
		}
	}
}