	function handleDivTag(divtag){
	   var divtag;
	   return divtag;
	}
	
   function createRequestObject() {
        var req;
        if(window.XMLHttpRequest){
            req = new XMLHttpRequest();
        } else if(window.ActiveXObject) {
            req = new ActiveXObject("Microsoft.XMLHTTP");
        } else {
            alert("There was a problem creating the XMLHttpRequest object");
        }
        return req;
    }
// Make the XMLHttpRequest object
    var http_account = createRequestObject();
	var divhandler_account = new handleDivTag(null);
	function sendRequest_account(more,divtag) {
		if (divtag == "check_email") {
			//document.getElementById(divtag).innerHTML = "Loading...";
			http_account.open("get", "validate_email.php?"+more);
		}
		if (divtag  == "shipping_div") {
			if (document.getElementById("bomb_floating")) document.getElementById("bomb_floating").style.display="none";
			document.getElementById(divtag).innerHTML = "<img src='filebin/images/loading_apple.gif' border='0' style='padding:0' />&nbsp;Loading...";
			http_account.open("get", "filebin/ajax/php/shipping_forms.php?"+more);
		}
		if (divtag  == "view_orders") {
			if (document.getElementById("bomb_floating")) document.getElementById("bomb_floating").style.display="none";
			document.getElementById(divtag).innerHTML = "<img src='filebin/images/loading_apple.gif' border='0' style='padding:0' />&nbsp;Loading...";
			http_account.open("get", "filebin/ajax/php/view_orders.php?"+more);
		}
		if (divtag  == "ajax_account") {
			if (document.getElementById("bomb_floating")) document.getElementById("bomb_floating").style.display="none";
			document.getElementById(divtag).innerHTML = "<img src='filebin/images/loading_apple.gif' border='0' style='padding:0' />&nbsp;Loading...";
			http_account.open("get", "filebin/ajax/php/mini_account.php?"+more);
		}
		if (divtag.substring(0,6) == "share_") {
			document.getElementById(divtag).innerHTML = "<img src='filebin/images/loading_apple.gif' border='0' style='padding:0' />";
			http_account.open("get", "filebin/ajax/php/share_registry.php?"+more);
		}
		if (divtag  == "registry") {
			if (document.getElementById("bomb_floating")) document.getElementById("bomb_floating").style.display="none";
			document.getElementById(divtag).innerHTML = "<img src='filebin/images/loading_apple.gif' border='0' style='padding:0' />&nbsp;Loading...";
			http_account.open("get", "filebin/ajax/php/ajax_registry.php?"+more);
		}
        http_account.onreadystatechange = handleResponse_account;
		divhandler_account.divtag = divtag;
        http_account.send(null);
    }

    function handleResponse_account() {
		//alert("in handle: "+http.readyState);
        if(http_account.readyState == 4 && http_account.status == 200){
            // Text returned FROM PHP script
            var response = http_account.responseText;
            if(response) {
                document.getElementById(divhandler_account.divtag).innerHTML = response;
				if (response == "&nbsp;not valid" && divhandler_account.divtag == "check_email") {
					document.getElementById("submit").disabled = true;
				}
				if (response == "&nbsp;" && divhandler_account.divtag == "check_email") {
					document.getElementById("submit").disabled = false;
				}
            }
        }
    }
	//
function simplePreload()
{ 
  var args = simplePreload.arguments;
  document.imageArray = new Array(args.length);
  for(var i=0; i<args.length; i++)
  {
    document.imageArray[i] = new Image;
    document.imageArray[i].src = args[i];
  }
}
simplePreload('connect.jpg','disconnect.jpg'); 
///////////////////////////////////////////////////

function moveObject(e, id) {

  // step 1
  var tempX = 0;
  var tempY = 0;
  var offset = 5;

  // step 2
  //obj = getObject( obj );
  //if (obj==null) return;

  // step 3
  if (document.all) {
    tempX = event.clientX + document.body.scrollLeft;
    tempY = event.clientY + document.body.scrollTop;
  } else {
    tempX = e.pageX;
    tempY = e.pageY;
  }
	//alert(tempX+" - "+tempY);
  // step 4
  if (tempX < 0){tempX = 0}
  if (tempY < 0){tempY = 0}
	document.getElementById("bomb_floating").style.left = tempX+"px";
	document.getElementById("bomb_floating").style.top = tempY+"px";
	document.getElementById("bomb_floating").style.display = "block";
	document.getElementById("mc_wishlist_id").value = id;
//alert(tempX+" ... "+tempY);
  // step 5
  //obj.style.top  = (tempY + offset) + 'px';
  //obj.style.left = (tempX + offset) + 'px';

  // step 6
  //displayObject( objHolder, true );
  }
function change_bomb(pr) {
	var mc_wishlist_id = document.getElementById("mc_wishlist_id").value;
	document.getElementById("bomb_floating").style.display="none";
	var more = "mc_wishlist_id="+mc_wishlist_id+"&share="+pr;
	sendRequest_account(more,"share_"+mc_wishlist_id);
}
function del(id) {
	var agree = confirm("Are you sure?");
	if (agree) {
		var more = "mc_wishlist_id="+id+"&action=delete";
		sendRequest_account(more,"registry");
	}
	else {
		return false;
	}	
}
function view_registry(id) {
	var more = "action=view&mc_wishlist_id="+id;
	sendRequest_account(more,"registry");
}
function remove_product_wl(wishlist_product_id, wl_id) {
	var more = "action=remove_product&mc_wishlist_product_id="+wishlist_product_id+"&wl_id="+wl_id;
	sendRequest_account(more,"registry");
}
function update_wl(wl_id) {
	var more = "action=update&wl_id="+wl_id;
	//get form object
	var objForm = document.update_full_cart;
	var length = objForm.length;
	var str = "";
	var arr = new Array();
	var z = 0;
	for(i=0;i<length;i++) {
		//str+=objForm.elements[i].name+"="+objForm.elements[i].value+"\n";
		if (objForm.elements[i].name.indexOf("qty") == 0) {
			var arr_num = objForm.elements[i].name.replace("qty[","");
			arr_num = arr_num.replace("]","");
			//arr_num = parseInt(arr_num);
			arr[z] = objForm.elements[i].value+"-"+arr_num;
			z++;
		}
	}
	more += "&arr_id="+arr;
	//alert(more);
	sendRequest_account(more,"registry");
}
function get_address(object) {
	var id = object.value;
	var prefx = "";
	if (object.name == "ship_address") prefx = "s_";
	if (object.name == "bill_address") prefx = "b_";
	//if (id != "") {
		var url = "jsaddress.php?id="+id;
		var xml = new JKL.ParseXML(url);
		var data = xml.parse();
		var output = "";
		var address = data.instance;
		for (field in address) {
			//output = output + field + ": " + address[field] + "\n";
			if (document.getElementById(prefx+field)) document.getElementById(prefx+field).value = address[field];
			//alert(prefx+field);
			if (prefx == "s_" && field == "zip") {
				ship_zip(address[field], null);
			}
		}
		if (id == "") document.getElementById(prefx+"state").value = "";
	//}
}
function cursor_on(obj) {
	obj.style.cursor="pointer";	
}
function cursor_out(obj) {
	obj.style.cursor="none";	
}