// remote scripting library // (c) copyright 2005 modernmethod, inc var sajax_debug_mode = false; var sajax_request_type = "GET"; function sajax_debug(text) { if (sajax_debug_mode) alert("RSD: " + text) } function sajax_init_object() { sajax_debug("sajax_init_object() called..") var A; try { A=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { A=new ActiveXObject("Microsoft.XMLHTTP"); } catch (oc) { A=null; } } if(!A && typeof XMLHttpRequest != "undefined") A = new XMLHttpRequest(); if (!A) sajax_debug("Could not create connection object."); return A; } function sajax_do_call(func_name, args) { var i, x, n; var uri; var post_data; uri = ""; if (sajax_request_type == "GET") { if (uri.indexOf("?") == -1) uri = uri + "?rs=" + escape(func_name); else uri = uri + "&rs=" + escape(func_name); for (i = 0; i < args.length-1; i++) uri = uri + "&rsargs[]=" + escape(args[i]); uri = uri + "&rsrnd=" + new Date().getTime(); post_data = null; } else { post_data = "rs=" + escape(func_name); for (i = 0; i < args.length-1; i++) post_data = post_data + "&rsargs[]=" + escape(args[i]); } x = sajax_init_object(); x.open(sajax_request_type, uri, true); if (sajax_request_type == "POST") { x.setRequestHeader("Method", "POST " + uri + " HTTP/1.1"); x.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); } x.onreadystatechange = function() { if (x.readyState != 4) return; sajax_debug("received " + x.responseText); var status; var data; status = x.responseText.charAt(0); data = x.responseText.substring(2); if (status == "-") alert("Error: " + data); else args[args.length-1](data); } x.send(post_data); sajax_debug(func_name + " uri = " + uri + "/post = " + post_data); sajax_debug(func_name + " waiting.."); delete x; } // wrapper for add_to_cart function x_add_to_cart() { sajax_do_call("add_to_cart", x_add_to_cart.arguments); } // wrapper for update_cart function x_update_cart() { sajax_do_call("update_cart", x_update_cart.arguments); } // wrapper for cancel_item function x_cancel_item() { sajax_do_call("cancel_item", x_cancel_item.arguments); } // wrapper for get_cities function x_get_cities() { sajax_do_call("get_cities", x_get_cities.arguments); } // wrapper for get_barangays function x_get_barangays() { sajax_do_call("get_barangays", x_get_barangays.arguments); } // wrapper for get_zipcode function x_get_zipcode() { sajax_do_call("get_zipcode", x_get_zipcode.arguments); } // wrapper for calculate_shipping function x_calculate_shipping() { sajax_do_call("calculate_shipping", x_calculate_shipping.arguments); } // wrapper for get_email function x_get_email() { sajax_do_call("get_email", x_get_email.arguments); } // wrapper for get_password function x_get_password() { sajax_do_call("get_password", x_get_password.arguments); } // wrapper for delete_order_history function x_delete_order_history() { sajax_do_call("delete_order_history", x_delete_order_history.arguments); } // wrapper for confirm_payment function x_confirm_payment() { sajax_do_call("confirm_payment", x_confirm_payment.arguments); } // wrapper for get_products_attributes_image function x_get_products_attributes_image() { sajax_do_call("get_products_attributes_image", x_get_products_attributes_image.arguments); } // wrapper for set_payment_method function x_set_payment_method() { sajax_do_call("set_payment_method", x_set_payment_method.arguments); } // wrapper for create_session function x_create_session() { sajax_do_call("create_session", x_create_session.arguments); } // wrapper for delete_address_book function x_delete_address_book() { sajax_do_call("delete_address_book", x_delete_address_book.arguments); } // wrapper for set_default_address function x_set_default_address() { sajax_do_call("set_default_address", x_set_default_address.arguments); } // wrapper for save_address_book function x_save_address_book() { sajax_do_call("save_address_book", x_save_address_book.arguments); } // wrapper for get_new_products function x_get_new_products() { sajax_do_call("get_new_products", x_get_new_products.arguments); } // wrapper for reorder_add_to_cart function x_reorder_add_to_cart() { sajax_do_call("reorder_add_to_cart", x_reorder_add_to_cart.arguments); } // wrapper for get_user_links function x_get_user_links() { sajax_do_call("get_user_links", x_get_user_links.arguments); } // wrapper for get_user_links_footer function x_get_user_links_footer() { sajax_do_call("get_user_links_footer", x_get_user_links_footer.arguments); } // wrapper for set_category_session function x_set_category_session() { sajax_do_call("set_category_session", x_set_category_session.arguments); } // wrapper for get_category_imgdetails function x_get_category_imgdetails() { sajax_do_call("get_category_imgdetails", x_get_category_imgdetails.arguments); } // wrapper for quickview function x_quickview() { sajax_do_call("quickview", x_quickview.arguments); } // wrapper for change_attributes function x_change_attributes() { sajax_do_call("change_attributes", x_change_attributes.arguments); } // wrapper for add_to_shopping_cart function x_add_to_shopping_cart() { sajax_do_call("add_to_shopping_cart", x_add_to_shopping_cart.arguments); } // wrapper for add_to_quickview_cart function x_add_to_quickview_cart() { sajax_do_call("add_to_quickview_cart", x_add_to_quickview_cart.arguments); } // wrapper for get_last_category_url function x_get_last_category_url() { sajax_do_call("get_last_category_url", x_get_last_category_url.arguments); } // wrapper for show_shopping_cart function x_show_shopping_cart() { sajax_do_call("show_shopping_cart", x_show_shopping_cart.arguments); } // wrapper for update_shopping_cart_count function x_update_shopping_cart_count() { sajax_do_call("update_shopping_cart_count", x_update_shopping_cart_count.arguments); } // wrapper for update_shopping_cart_item_price function x_update_shopping_cart_item_price() { sajax_do_call("update_shopping_cart_item_price", x_update_shopping_cart_item_price.arguments); } // wrapper for update_shopping_cart_price function x_update_shopping_cart_price() { sajax_do_call("update_shopping_cart_price", x_update_shopping_cart_price.arguments); } // wrapper for remove_cart_item function x_remove_cart_item() { sajax_do_call("remove_cart_item", x_remove_cart_item.arguments); } // wrapper for send_notification function x_send_notification() { sajax_do_call("send_notification", x_send_notification.arguments); } // wrapper for notify_me function x_notify_me() { sajax_do_call("notify_me", x_notify_me.arguments); } // wrapper for notify_me_loading function x_notify_me_loading() { sajax_do_call("notify_me_loading", x_notify_me_loading.arguments); } // wrapper for set_elapsed function x_set_elapsed() { sajax_do_call("set_elapsed", x_set_elapsed.arguments); } // wrapper for set_new_html function x_set_new_html() { sajax_do_call("set_new_html", x_set_new_html.arguments); } // wrapper for get_products_by_filters function x_get_products_by_filters() { sajax_do_call("get_products_by_filters", x_get_products_by_filters.arguments); } // wrapper for get_filters_by_products function x_get_filters_by_products() { sajax_do_call("get_filters_by_products", x_get_filters_by_products.arguments); } // wrapper for set_attribute_price function x_set_attribute_price() { sajax_do_call("set_attribute_price", x_set_attribute_price.arguments); } // wrapper for update_products_quantity function x_update_products_quantity() { sajax_do_call("update_products_quantity", x_update_products_quantity.arguments); } // wrapper for clear_filters function x_clear_filters() { sajax_do_call("clear_filters", x_clear_filters.arguments); } // wrapper for get_zipcodes_rates function x_get_zipcodes_rates() { sajax_do_call("get_zipcodes_rates", x_get_zipcodes_rates.arguments); }