//ajax_url = 'http://www.hometownre.org/admin.php';
//ajax_url = 'http://76.178.211.223/hometownre.org/admin.php';
//ajax_url = 'http://192.168.1.3/hometownre.org/admin.php';
ajax_url = 'Tech/Gateway.php';

function print_r(theObj){
  if(theObj.constructor == Array || theObj.constructor == Object){
    document.write("<ul>")
    for(var p in theObj){
      if(theObj[p].constructor == Array|| theObj[p].constructor == Object){
		document.write("<li>["+p+"] => "+typeof(theObj)+"</li>");
        document.write("<ul>")
        print_r(theObj[p]);
        document.write("</ul>")
      } else {
		document.write("<li>["+p+"] => "+theObj[p]+"</li>");
      }
    }
    document.write("</ul>");
  }
}

function checkInput(which){
	pass=true
		if(which.elements['type'].selectedIndex == 0){
			pass = false	
		}
		if(which.elements['title'].value == ""){
			pass = false
		}
		if(which.elements['heat'].selectedIndex == 0){
			pass = false
		}			
		if(!pass){
			alert("One or more of the required elements are not completed. Please complete them, then submit again!")
			return false
		}
		else{
			return true
		}
}
function checkUpdate(which){
	if(which.elements['title'].value == ""){
			pass = false
	}
	if(!pass){
		alert("One or more of the required elements are not completed. Please complete them, then submit again!")
		return false
	}
	else{
		return true
	}
}
function lockDown(cBox) {
	if(cBox.checked == false){
		cBox.checked = true
	}else{
		cBox.checked = false
	}
}
function removeImg(id, img, img_orig, that) {
	aTag = that
	var agree = confirm('Are you sure you want to remove the image: \n\r ' + img_orig)
	if (agree) {
		var action = 'remove_img'
		var get_vars = '?action=' + action
		var url = ajax_url + get_vars
		url += '&callback=ModCurImgLst&id=' + id + '&img=' + img
		makePOSTRequest(url)
	}
}
function ModCurImgLst(toRemove) {
	document.getElementById('CurTxt-' + toRemove).innerHTML = ''
	document.getElementById('ThumbImg-' + toRemove).innerHTML = ''
}

function changeCoverImg(id, img, img_orig){
	cover = document.getElementById('coverImg')
	cover.src = 'Media/ListingPhotos/thumbs/' + img
	cover.title = img_orig
	var action = 'change_cover_img'
	var get_vars = '?action=' + action + '&id=' + id + '&img=' + img + '&orig=' + img_orig
	var url = ajax_url + get_vars
	makePOSTRequest(url)
}
/*
function changeImgVerify (img, img_orig) {
	alert('img: ' + img + 'orig: ' + img_orig)
}
*/





























