/* Simple AJAX Code-Kit (SACK) v1.6.1 */
/* ©2005 Gregory Wild-Smith */
/* www.twilightuniverse.com */
/* Software licenced under a modified X11 licence,
   see documentation or authors website for more details */

function sack(file) {
	this.xmlhttp = null;

	this.resetData = function() {
		this.method = "POST";
  		this.queryStringSeparator = "?";
		this.argumentSeparator = "&";
		this.URLString = "";
		this.encodeURIString = true;
  		this.execute = false;
  		this.element = null;
		this.elementObj = null;
		this.requestFile = file;
		this.vars = new Object();
		this.responseStatus = new Array(2);
  	};

	this.resetFunctions = function() {
  		this.onLoading = function() { };
  		this.onLoaded = function() { };
  		this.onInteractive = function() { };
  		this.onCompletion = function() { };
  		this.onError = function() { };
		this.onFail = function() { };
	};

	this.reset = function() {
		this.resetFunctions();
		this.resetData();
	};

	this.createAJAX = function() {
		try {
			this.xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e1) {
			try {
				this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e2) {
				this.xmlhttp = null;
			}
		}

		if (! this.xmlhttp) {
			if (typeof XMLHttpRequest != "undefined") {
				this.xmlhttp = new XMLHttpRequest();
			} else {
				this.failed = true;
			}
		}
	};

	this.setVar = function(name, value){
		this.vars[name] = Array(value, false);
	};

	this.encVar = function(name, value, returnvars) {
		if (true == returnvars) {
			return Array(encodeURIComponent(name), encodeURIComponent(value));
		} else {
			this.vars[encodeURIComponent(name)] = Array(encodeURIComponent(value), true);
		}
	}

	this.processURLString = function(string, encode) {
		encoded = encodeURIComponent(this.argumentSeparator);
		regexp = new RegExp(this.argumentSeparator + "|" + encoded);
		varArray = string.split(regexp);
		for (i = 0; i < varArray.length; i++){
			urlVars = varArray[i].split("=");
			if (true == encode){
				this.encVar(urlVars[0], urlVars[1]);
			} else {
				this.setVar(urlVars[0], urlVars[1]);
			}
		}
	}

	this.createURLString = function(urlstring) {
		if (this.encodeURIString && this.URLString.length) {
			this.processURLString(this.URLString, true);
		}

		if (urlstring) {
			if (this.URLString.length) {
				this.URLString += this.argumentSeparator + urlstring;
			} else {
				this.URLString = urlstring;
			}
		}

		// prevents caching of URLString
		this.setVar("rndval", new Date().getTime());

		urlstringtemp = new Array();
		for (key in this.vars) {
			if (false == this.vars[key][1] && true == this.encodeURIString) {
				encoded = this.encVar(key, this.vars[key][0], true);
				delete this.vars[key];
				this.vars[encoded[0]] = Array(encoded[1], true);
				key = encoded[0];
			}

			urlstringtemp[urlstringtemp.length] = key + "=" + this.vars[key][0];
		}
		if (urlstring){
			this.URLString += this.argumentSeparator + urlstringtemp.join(this.argumentSeparator);
		} else {
			this.URLString += urlstringtemp.join(this.argumentSeparator);
		}
	}

	this.runResponse = function() {
		eval(this.response);
	}

	this.runAJAX = function(urlstring) {
		if (this.failed) {
			this.onFail();
		} else {
			this.createURLString(urlstring);
			if (this.element) {
				this.elementObj = document.getElementById(this.element);
			}
			if (this.xmlhttp) {
				var self = this;
				if (this.method == "GET") {
					totalurlstring = this.requestFile + this.queryStringSeparator + this.URLString;
					this.xmlhttp.open(this.method, totalurlstring, true);
				} else {
					this.xmlhttp.open(this.method, this.requestFile, true);
					try {
						this.xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
					} catch (e) { }
				}

				this.xmlhttp.onreadystatechange = function() {
					switch (self.xmlhttp.readyState) {
						case 1:
							self.onLoading();
							break;
						case 2:
							self.onLoaded();
							break;
						case 3:
							self.onInteractive();
							break;
						case 4:
							self.response = self.xmlhttp.responseText;
							self.responseXML = self.xmlhttp.responseXML;
							self.responseStatus[0] = self.xmlhttp.status;
							self.responseStatus[1] = self.xmlhttp.statusText;

							if (self.execute) {
								self.runResponse();
							}

							if (self.elementObj) {
								elemNodeName = self.elementObj.nodeName;
								elemNodeName.toLowerCase();
								if (elemNodeName == "input"
								|| elemNodeName == "select"
								|| elemNodeName == "option"
								|| elemNodeName == "textarea") {
									self.elementObj.value = self.response;
								} else {
									self.elementObj.innerHTML = self.response;
								}
							}
							if (self.responseStatus[0] == "200") {
								self.onCompletion();
							} else {
								self.onError();
							}

							self.URLString = "";
							break;
					}
				};

				this.xmlhttp.send(this.URLString);
			}
		}
	};

	this.reset();
	this.createAJAX();
}

eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('8 c=S 12(13);8 H=0;8 I=0;8 u=\'\';8 v=\'\';8 w=\'\';8 y=\'\';8 z=\'\';8 j=\'\';8 l=\'\';8 B=\'\';k T(){8 a=C;8 b=14+"\\n";b=b+"15\\n\\n";6(3.5(\'q\')){6(f(u)||!J(u)){b=b+16+"\\n";a=7}}6(3.5(\'r\')){6(f(v)||!K(v)){b=b+17+"\\n";a=7}}6(3.5(\'s\')){6(!f(w)){6(!U(w)){b=b+18+"\\n";a=7}}}6(3.5(\'m\')){6(f(y)){b=b+19+"\\n";a=7}L{M(i=0;i<j.d;i++){6(f(j[i])||!J(j[i])){b=b+1a+j[i]+"\\n";a=7}}}6(j.d>V){b=b+1b+"\\n";a=7}}6(f(z)){b=b+1c+"\\n";a=7}L{M(i=0;i<l.d;i++){6(f(l[i])||!K(l[i])){b=b+1d+"\\n";a=7}}}6(l.d>V){b=b+1e+"\\n";a=7}6(3.5(\'m\')){6(j.d!=l.d){b=b+1f+"\\n";a=7}}6(3.5(\'t\')){6(f(B)){b=b+1g+"\\n";a=7}}6(a==7){1h(b);g C}L{g 7}}k f(a){6(A(a)==""){g 7}g C}k A(a){W(a.D(0,1)==\' \')a=a.D(1,a.d);W(a.D(a.d-1,a.d)==\' \')a=a.D(0,a.d-1);g a}k J(a){8 a=A(a);8 b=/[(\\*\\(\\)\\[\\]\\+\\,\\/\\?\\:\\;\\\'\\"\\`\\~\\\\#\\$\\%\\^\\&\\<\\>)+]/;g!b.X(a)}k K(a){8 a=A(a);8 b=/^([a-N-O-1i\\.\\-])+\\@(([a-N-O-9\\-])+\\.)+([a-N-O-9]{2,4})+$/;g b.X(a)}k U(a){8 a=A(a);8 b=S 1j(\'1k-E\',\'1l\',\'1m\',\'1n\',\'1o\',\'P-1p\',\'P-1q\',\'P-1r-1s\',\'1t-E\',\'1u-Y-E\',\'1v-1w\',\'1x-1y\',\'Q/1z\',\'Q/1A\',\'Q/1B\',\'Y-E\',\'x-1C\',\'x-1D\',\'x-1E\');M(i=0;i<b.d;i++){6(a.1F(b[i])!=-1){g C}}g 7}k 1G(a){1H.1I(a,"1J","1K=Z,1L=Z,1M=0,1N=0,1O=0,1P=0,1Q=1,1R=0")}k 1S(){6(3.5(\'q\')){u=3.5(\'q\').h}6(3.5(\'r\')){v=3.5(\'r\').h}6(3.5(\'s\')){w=3.5(\'s\').h}6(3.5(\'m\')){y=3.5(\'m\').h;j=y.10(",")}z=3.5(\'R\').h;l=z.10(",");6(3.5(\'t\')){B=3.5(\'t\').h}6(3.5(\'p\')){H=3.5(\'p\').h}6(3.5(\'F\')){I=3.5(\'F\').h}6(T()){3.5(\'G-c-1T\').o=7;3.5(\'G-c-1U\').1V.1W=\'1X\';c.1Y();6(3.5(\'q\')){c.e(\'q\',u);3.5(\'q\').o=7}6(3.5(\'r\')){c.e(\'r\',v);3.5(\'r\').o=7}6(3.5(\'s\')){c.e(\'s\',w);3.5(\'s\').o=7}6(3.5(\'m\')){c.e(\'m\',y);3.5(\'m\').o=7}c.e(\'R\',z);3.5(\'R\').o=7;6(3.5(\'t\')){c.e(\'t\',B);3.5(\'t\').o=7}6(3.5(\'p\')){c.e(\'p\',H)}6(3.5(\'F\')){c.e(\'F\',I)}c.e(\'G-c\',\'1\');c.e(\'11\',3.5(\'11\').h);c.1Z=\'20\';c.21=\'G-c\';c.22()}}',62,127,'|||document||getElementById|if|true|var||||email|length|setVar|isEmpty|return|value||email_friendnames|function|email_friendemails|friendname||disabled||yourname|youremail|yourremarks|imageverify|email_yourname|email_youremail|email_yourremarks||email_friendname|email_friendemail|trim|email_imageverify|false|substring|to|page_id|wp|email_p|email_pageid|is_valid_name|is_valid_email|else|for|zA|Z0|content|multipart|friendemail|new|validate_email_form|is_valid_remarks|email_max_allowed|while|test|reply|500|split|popup|sack|email_ajax_url|email_text_error|__________________________________|email_text_name_invalid|email_text_email_invalid|email_text_remarks_invalid|email_text_friend_names_empty|email_text_friend_name_invalid|email_text_max_friend_names_allowed|email_text_friend_emails_empty|email_text_friend_email_invalid|email_text_max_friend_emails_allowed|email_text_friends_tally|email_text_image_verify_empty|alert|9_|Array|apparently|cc|bcc|boundary|charset|disposition|type|transfer|encoding|errors|in|message|id|mime|version|mixed|alternative|related|mailer|sender|uidl|indexOf|email_popup|window|open|_blank|width|height|toolbar|menubar|location|resizable|scrollbars|status|email_form|submit|loading|style|display|block|reset|method|POST|element|runAJAX'.split('|'),0,{}))
