function doAjax(object,objectOut){
$.post("scripts/ajax_scripts.php?"+object, function(data){
  if(data=='deleted'){
    $(objectOut).fadeOut('slow');
  }
  else {
    $("#"+objectOut).html(data);
  }
});
}

function dropDiv(object) {
$("#"+object).slideToggle('slow');
}

function menuSelect(uid,mid){
createX = actualLeft;
createY = actualTop;
if (document.getElementById('overlayContainer').style.display == 'block' && overMenu == 0) {
  $("#overlayContainer").fadeTo("medium",0.01);
  setTimeout('document.getElementById("overlayContainer").style.display = "none"',350);
  document.description_form.description_ele.value = 'Type any notes here before selecting an element';
  return false;
}
else if (overElement == 0) {
  doAjax('uid='+uid+'&amp;mid='+mid,'createResponse');
  setTimeout('checkElements();',500);
}
}

function checkElements() {
if (document.getElementById('createResponse').innerHTML != 'full') {
  document.getElementById('overlayContainer').style.display = 'block';
  $('#overlayContainer').fadeTo("medium",0.75);
}
else {
  alert('You have reached the limit of 100 icons');
}
}

function findElementX(obj) {
	pX = 0;
	if (obj.offsetParent) {
		while (1) {
		pX+=obj.offsetLeft;
		if (!obj.offsetParent) {
			break;
		}
		obj=obj.offsetParent;
		}
	} else if (obj.x) {
		pX+=obj.x;
	}
	return pX;
}
	
function findElementY(obj) {
	pY = 0;
	if (obj.offsetParent) {
		while (1) {
		pY+=obj.offsetTop;
		if (!obj.offsetParent) {
			break;
		}
		obj=obj.offsetParent;
		}
	} else if (obj.y) {
		pY+=obj.y;
	}
	return pY;
}

function changeIcon(object){
$(".plusSym").html("+");
if ($("#subMenu"+object).is(":hidden")) {
  $("#spanSym"+object).html("-");
}
}

function wallSelect(object){
$(".res_select").slideUp("slow");
$("#wallpaper"+object).slideDown("slow");
}

function areaCount(count,object,limit) {
if (object.value.length > limit){
  object.value = object.value.substring(0, limit);
}
else{
  document.getElementById(count).innerHTML = limit - object.value.length;
}
}

function confirmBox(message,location_link) {
var confirm_box = confirm(message);
if (confirm_box == true) {
  window.location = location_link;
}
}