W = window;

window.W = window;

window.WD = W.document;

var navIE = WD.all && !W.opera, F = false, T = true;

	
function swapImage(img, url) { 

	if ($(img).outerHtml().substring(1,5) == 'SPAN')
		$(img).css('filter', "progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'" + url + "\', sizingMethod='scale'");
	else
		$(img).attr('src', url);
	
	if (typeof correctPNG == 'function') 
		correctPNG();	


//alert('swap ' + img + ' ' + url);
/*$(img).attr({ 
          src: url,
          title: url,
          alt: url
//		  id: img,
//			name: img
        });
*/
	
//	alert(img);
//	alert(document[img]);
//	document.getElementById(img).src = url;
}

W.fzz = function(f, r) {
	return new Function('a', 'b', 'c', 'd', 'e', 'f', 'g', (r == 1 ? 'return '
			: '')
			+ (f || 'F').toString())
};

W.dge = function(a, b) {
	return W.document.getElementById(a)
}

W.dr = function(a, b) {
	return dge(a).innerHTML = b
}

W.swf = function(a, b, c, d, e) {
	

	this.H = 0;
	this.varz = '';
	this.draw = function(nuu, varz, chain) {
		var mw = this.w == '100%', mh = this.h == '100%', cls = (mw ? 'wide tac'
				: '');
		if (chain && varz == swf.varz)
			return false;
		var wh = ' width="'
				+ this.w
				+ '" '
				+ (typeof (this.h) == 'number' || mh ? 'height="' + this.h + '"'
						: '');
		if (varz)
			this.varz = varz;
		if (nuu)
			this.u = nuu;
		if (cls)
			cls = ' class="' + cls + '"';
		else if (this.H && !varz) {
			return dr(this.H, 'swf_' + this.n) || '<div' + cls + ' id="swf_'
					+ this.n + '">' + this.H + '</div>'
		}
		var h = [ , ], i = 2;
		while (i--) {
			var pm = i ? fzz("'<param name=\"'+a+'\" value=\"'+b+'\">'", 1) : fzz("' '+a+'=\"'+b+'\"'", 1);
			
			h[i] = i ? '<object id="swfob_' + this.n + '"' + wh
						+ ' CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,65,0">'
						+ pm('Movie', this.u + '.swf?' + this.varz)
					: '\n<embed src="' + this.u + '.swf?' + this.varz + '" name="swfNM_' + this.n + '" id="swfob_' + this.n + '" wmode="transparent"' + wh;
				
			h[i] += pm('allowScriptAccess', 'always')
					+ (parseInt(this.w, 10) > 1 ? pm('quality', 'high') : '')
					+ (i ? ''
							: ' type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"/>')
		} 
		h = (navIE ? h[1] + '<param name="wmode" value="transparent"> <font color="white"> <br><br><br><br> <big>You need to install Adobe Flash Player to play Garden Party.</big>  </div> </object> ' : h[0] ) ;  // <embed><noembed> <img src="http://gardenpartyworld.com/images/home/GP_home_button_account2.png"></noembed> </embed>
		this.H = h;
		if (dge('swf_' + this.n))
			return dr(h, 'swf_' + this.n);
		return '<div' + cls + ' id="swf_' + this.n + '">' + h + '</div>'
	}


	if (a)
		this.n = a;
	this.u = b ? b : this.n;
	this.w = c || 1;
	this.h = d || 1;
	if (e)
		this.varz = e;
	if (!W['swfob_' + this.n])
		W['swfob_' + this.n] = true;
	var iam = "dge('swfob_" + this.n + "')", sj = "if(typeof(" + iam
			+ ")=='function')if(" + iam + ".GotoFrame){" + iam;
	this.frame = fzz(sj + ".GotoFrame(a);" + iam
			+ ".Play();return true}return false");
	this.stop = fzz(sj + ".StopPlay()}");
	return this
};

W.c00k = {
	set : fzz("if(!c)c=365;d=new Date();d.setTime(d.getTime()+c*24*60*60*1000);WD.cookie=a+'='+b+'; expires='+d.toGMTString()+'; path=/';return''"),
	get : fzz("b='';c=WD.cookie.split('; ');d=c.length;while(d--){e=c[d].split('=');if(e[0]==a)return e[1]}return''")
};

W.call = function(a, b, c, d) {
	this.url = a;
	if (b == 'HEAD') {
		this.type = b;
		this.data = null
	} else {
		if (b)
			this.data = b;
		this.type = this.data ? 'POST' : 'GET'
	}
	;
	this.lf = typeof (c) == 'string' ? fzz(c) : c;
	this.errtxt = d ? d : 'Not available';
	this.req()
};

call.prototype = {
	XML : null,
	text : '',
	state : 1,
	status : 0,
	header : {},
	headers : [],
	url : '',
	data : null,
	lf : 0,
	req : function() {
		if (W.XMLHttpRequest)
			this.XML = new XMLHttpRequest();
		else {
			try {
				this.XML = new ActiveXObject("Msxml2.XMLHTTP")
			} catch (c) {
				try {
					this.XML = new ActiveXObject("Microsoft.XMLHTTP")
				} catch (cc) {
				}
			}
		}
		if (this.XML && this.url) {
			this.XML.open(this.type, this.url, this.lf ? T : F);
			var Rs = this.data === T;
			if (Rs)
				this.data = F;
			else if (this.data)
				try {
					this.XML.setRequestHeader('Content-Type',
							'application/x-www-form-urlencoded;')
				} catch (e) {
				}
			;
			this.XML.send(this.data || null);
			if (this.lf) {
				var o = this;
				this.XML.onreadystatechange = function() {
					o.state = o.XML.readyState;
					if ((o.state == 4 || o.state == 1) && o.XML) {
						var ss = 500;
						try {
							ss = o.XML.status
						} catch (e) {
						}
						o.status = ss;
						var ttt;
						try {
							ttt = o.XML.responseText
						} catch (e) {
						}
						if (ttt)
							o.errtxt = ttt;
						if (o.status == 200 || o.status == 304)
							o.text = (o.XML.responseText || '');
						else
							o.text = o.errtxt;
						if (o.text.indexOf('\uFEFF') != -1)
							o.text = o.text.substr(1);
						if (o.text.indexOf('\uFEFF') != -1)
							o.text = o.text.substr(1);
						if (!Rs)
							o.text = o.text.split('\r').join('');
						if (o.lf)
							o.lf(o)
					}
				}
				this.state = this.XML.readyState;
				if (this.state == 4) {
					var ss = 500;
					try {
						ss = this.XML.status
					} catch (e) {
					}
					this.status = ss;
					try {
						ss = this.XML.responseText
					} catch (e) {
					}
					if (this.status == 200) {
						this.text = ss;
						if (this.lf)
							this.lf(o)
					} else
						this.text = this.errtxt
				}
			}
		}
	}
};

var x1, y1, init, onsize, sizer = function() {
/*	if (navIE) {
		x1 = W.document.body.offsetWidth;
		y1 = W.document.body.offsetHeight
	} else {
		x1 = W.innerWidth;
		y1 = W.innerHeight
	}*/
	
	x1 = $(window).innerWidth();
	y1 = $(window).innerHeight(); 
		
	if (onsize) {
		if (!onsize())
			return
	} else
		return;
	if (init || !x1 || !y1)
		return;
	init = true;
	// new
	// call('/inc/brwsr.php?x='+x1+'&y='+y1+'&r='+escape(W.document.referrer))
}

var membershipPrices = {
		GBP : [ '&pound;', '3.95', '10.95', '19.95', '37.95' ],
		EUR : [ '&euro;', '4.95', '12.95', '24.95', '49.95' ],
		USD : [ '$', '5.25', '13.95', '26.95', '50.00' ]
	};

function getMembershipPrice(currency, period) {
	var id = 0;
	switch (period) {
		case '1_month':
			id = 1;
			break;
		case '3_months':
			id = 2;
			break;
		case '6_months':
			id = 3;
			break;
		case '1_year':
			id = 4;
			break;
	}
	
	var amount = membershipPrices[currency][id];
	
	if (amount != "999")
		var price = membershipPrices[currency][0] + amount;
	else
		var price = 'N/A';
	
	return price;
}



ScrollFreeze = /*2843293230303620532E4368616C6D657273*/
{
	propFlag : true,
	Ydisp : 0,
	Xdisp : 0,

	on : function()
	{
		if(this.getProp())
		window.onscroll=function(){ ScrollFreeze.setXY(); }
	},

	off : function(){window.onscroll=null;},

	getProp : function()
	{
		if( typeof window.pageYOffset != 'undefined' )
		{
			this.Ydisp=window.pageYOffset;
			this.Xdisp=window.pageXOffset;
		}
		else
			if(document.documentElement)
			{
				this.Ydisp=document.documentElement.scrollTop;
				this.Xdisp=document.documentElement.scrollLeft;
			}
			else
				if(document.body && typeof document.body.scrollTop != 'undefined')
				{
					this.Ydisp=document.body.scrollTop;
					this.Xdisp=document.body.scrollLeft;
				}
				else
					this.propFlag=false;

		return this.propFlag;
	},

	setXY : function()
	{
		window.scrollTo( this.Xdisp, this.Ydisp );
	}
}



/*
if (/MSIE/i.test(navigator.userAgent)) {
	document.attachEvent('onmousewheel', function(e){
	    if (!e) var e = window.event;
	    if (e.originalTarget.id == 'lightwindow_overlay') {
			 e.returnValue = false;
		     e.cancelBubble = true;
		     return false;
		}
	}, false);
}else if (/Safari/i.test(navigator.userAgent)) {
	document.addEventListener('mousewheel', function(e){
	    if (e.originalTarget.id == 'lightwindow_overlay') {
		    e.stopPropagation();
		    e.preventDefault();
		    e.cancelBubble = false;
		    return false;
		}
	}, false);
}else if (/Opera/i.test(navigator.userAgent)) {
	document.attachEvent('mousewheel', function(e){
	    if (!e) var e = window.event;
	    if (e.originalTarget.id == 'lightwindow_overlay') {
		    e.returnValue = false;
		    e.cancelBubble = true;
		    return false;
		}
	}, false);
}else 
*/
if (/Firefox/i.test(navigator.userAgent) ) {     // || /Chrome/i.test(navigator.userAgent)
	document.addEventListener('DOMMouseScroll', function(e){
		
		//alert(document.documentElement.scrollTop);
		//alert(document.documentElement.scrollHeight);
		//alert(document.documentElement.offsetTop);
		//alert(document.documentElement.offsetHeight);
		//alert(document.documentElement.clientHeight);
		//alert($('#lightwindow').css("display") );
		
		var lightWindowVisible = false;
		
		if (window.parent.lightWindowVisible)
			lightWindowVisible = true;
		
		if (window.parent.parent.lightWindowVisible)
			lightWindowVisible = true;
		
		
		if (
				lightWindowVisible
				&&( 
					( e.axis == e.VERTICAL_AXIS 
						&& ( 
								(e.detail>0 && document.documentElement.scrollTop + document.documentElement.clientHeight == document.documentElement.scrollHeight)
								|| (e.detail<0 && document.documentElement.scrollTop == 0)  
							)
					)
					
					|| window.dontScrollMe
				  )
			)
			
		{   
		    e.stopPropagation();
		    e.preventDefault();
		    e.cancelBubble = false;
		    return false;
		}
	}, false);
}



if (typeof jQuery == 'undefined') {}
else
{ 
	jQuery.preloadImages = function() {   
		 for(var i = 0; i<arguments.length; i++)   
		{
			  jQuery("<img>").attr("src", arguments[i]);   
		}
	}

	jQuery.fn.extend( {

		outerHtml: function( replacement )
		{
		    // We just want to replace the entire node and contents with
		    // some new html value
		    if (replacement)
		    {
		      return this.each(function (){ $(this).replaceWith(replacement); });
		    }

		    /*
		     * Now, clone the node, we want a duplicate so we don't remove
		     * the contents from the DOM. Then append the cloned node to
		     * an anonymous div.
		     * Once you have the anonymous div, you can get the innerHtml,
		     * which includes the original tag.
		     */
		    var tmp_node = $("<div></div>").append( $(this).clone() );
		    var markup = tmp_node.html();

		    // Don't forget to clean up or we will leak memory.
		    tmp_node.remove();
		    return markup;
		}
	});

	sizer();
	window.onresize = sizer;
}


