/*  Prototype JavaScript framework
 *  (c) 2005 Sam Stephenson <sam@conio.net>
 *  Prototype is freely distributable under the terms of an MIT-style license.
 *  For details, see the Prototype web site: http://prototype.conio.net/
 *--------------------------------------------------------------------------*/

//note: modified & stripped down version of prototype, to be used with moo.fx by mad4milk (http://moofx.mad4milk.net).

var Class = {
	create: function() {
		return function() {
			this.initialize.apply(this, arguments);
		}
	}
}

Object.extend = function(destination, source) {
	for (property in source) destination[property] = source[property];
	return destination;
}

Function.prototype.bind = function(object) {
	var __method = this;
	return function() {
		return __method.apply(object, arguments);
	}
}

Function.prototype.bindAsEventListener = function(object) {
var __method = this;
	return function(event) {
		__method.call(object, event || window.event);
	}
}

function $() {
	if (arguments.length == 1) return get$(arguments[0]);
	var elements = [];
	$c(arguments).each(function(el){
		elements.push(get$(el));
	});
	return elements;

	function get$(el){
		if (typeof el == 'string') el = document.getElementById(el);
		return el;
	}
}

if (!window.Element) var Element = new Object();

Object.extend(Element, {
	remove: function(element) {
		element = $(element);
		element.parentNode.removeChild(element);
	},

	hasClassName: function(element, className) {
		element = $(element);
		if (!element) return;
		var hasClass = false;
		element.className.split(' ').each(function(cn){
			if (cn == className) hasClass = true;
		});
		return hasClass;
	},

	addClassName: function(element, className) {
		element = $(element);
		Element.removeClassName(element, className);
		element.className += ' ' + className;
	},
  
	removeClassName: function(element, className) {
		element = $(element);
		if (!element) return;
		var newClassName = '';
		element.className.split(' ').each(function(cn, i){
			if (cn != className){
				if (i > 0) newClassName += ' ';
				newClassName += cn;
			}
		});
		element.className = newClassName;
	},

	cleanWhitespace: function(element) {
		element = $(element);
		$c(element.childNodes).each(function(node){
			if (node.nodeType == 3 && !/\S/.test(node.nodeValue)) Element.remove(node);
		});
	},

	find: function(element, what) {
		element = $(element)[what];
		while (element.nodeType != 1) element = element[what];
		return element;
	}
});

var Position = {
	cumulativeOffset: function(element) {
		var valueT = 0, valueL = 0;
		do {
			valueT += element.offsetTop  || 0;
			valueL += element.offsetLeft || 0;
			element = element.offsetParent;
		} while (element);
		return [valueL, valueT];
	}
};

document.getElementsByClassName = function(className) {
	var children = document.getElementsByTagName('*') || document.all;
	var elements = [];
	$c(children).each(function(child){
		if (Element.hasClassName(child, className)) elements.push(child);
	});  
	return elements;
}

//useful array functions
Array.prototype.iterate = function(func){
	for(var i=0;i<this.length;i++) func(this[i], i);
}
if (!Array.prototype.each) Array.prototype.each = Array.prototype.iterate;

function $c(array){
	var nArray = [];
	for (var i=0;i<array.length;i++) nArray.push(array[i]);
	return nArray;
}

/*
cssQuery, version 2.0.2 (2005-08-19)
Copyright: 2004-2005, Dean Edwards (http://dean.edwards.name/)
License: http://creativecommons.org/licenses/LGPL/2.1/
Packed by Steffen Rusitschka; included modules: css level2 and standard.
*/
eval(function(p,a,c,k,e,d){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--){d[e(c)]=k[c]||e(c)}k=[(function(e){return d[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}('6 B=7(){6 1j="2.0.2ruzee";6 $23=/\\s*,\\s*/;6 B=7($9,$$a){6 $c=[];6 $1h=o.2q.1Q&&!$$a;6 $1k=($$a)?($$a.2g==1t)?$$a:[$$a]:[z];6 $$u=14($9).1w($23),i;m(i=0;i<$$u.p;i++){$9=1q($$u[i]);b(P&&$9.Z(0,3).1R("")==" *#"){$9=$9.Z(2);$$a=24([],$1k,$9[1])}1s $$a=$1k;6 j=0,$I,$x,$o,$M="";H(j<$9.p){$I=$9[j++];$x=$9[j++];$M+=$I+$x;$o="";b($9[j]=="("){H($9[j++]!=")"&&j<$9.p){$o+=$9[j]}$o=$o.Z(0,-1);$M+="("+$o+")"}$$a=($1h&&O[$M])?O[$M]:1u($$a,$I,$x,$o);b($1h)O[$M]=$$a}$c=$c.2i($$a)}1S B.2k;8 $c};B.1B=7(){8"7 B() {\\n  [1j "+1j+"]\\n}"};6 O={};B.1Q=R;B.2l=7($9){b($9){$9=1q($9).1R("");1S O[$9]}1s O={}};6 28={};6 1g=R;B.2m=7($J,$15){b(1g)1f("$15="+21($15));28[$J]=17 $15()};B.2n=7($F){8 $F?1f($F):l};6 u={};6 L={};6 t={c:/\\[([\\w-]+(\\|[\\w-]+)?)\\s*(\\W?=)?\\s*([^\\]]*)\\]/};6 E=[];u[" "]=7($f,$a,$k,$h){6 $5,i,j;m(i=0;i<$a.p;i++){6 $10=T($a[i],$k,$h);m(j=0;($5=$10[j]);j++){b(D($5)&&16($5,$h))$f.q($5)}}};u["#"]=7($f,$a,$v){6 $5,j;m(j=0;($5=$a[j]);j++)b($5.v==$v)$f.q($5)};u["."]=7($f,$a,$N){$N=17 1M("(^|\\\\s)"+$N+"(\\\\s|$)");6 $5,i;m(i=0;($5=$a[i]);i++)b($N.d($5.N))$f.q($5)};u[":"]=7($f,$a,$1V,$o){6 $d=L[$1V],$5,i;b($d)m(i=0;($5=$a[i]);i++)b($d($5,$o))$f.q($5)};L["2p"]=7($5){6 $z=X($5);b($z.1m)m(6 i=0;i<$z.1m.p;i++){b($z.1m[i]==$5)8 18}};L["2B"]=7($5){};6 D=7($5){8($5&&$5.1v==1&&$5.k!="!")?$5:1T};6 1d=7($5){H($5&&($5=$5.2s)&&!D($5))1W;8 $5};6 12=7($5){H($5&&($5=$5.2t)&&!D($5))1W;8 $5};6 1Z=7($5){8 D($5.1Y)||12($5.1Y)};6 2v=7($5){8 D($5.1X)||1d($5.1X)};6 U=7($5){6 $U=[];$5=1Z($5);H($5){$U.q($5);$5=12($5)}8 $U};6 P=18;6 1o=7($5){6 $z=X($5);8(2y $z.20=="2A")?/\\.26$/i.d($z.2C):2D($z.20=="2F 2G")};6 X=7($5){8 $5.2H||$5.z};6 T=7($5,$k){8($k=="*"&&$5.1l)?$5.1l:$5.T($k)};6 1b=7($5,$k,$h){b($k=="*")8 D($5);b(!16($5,$h))8 R;b(!1o($5))$k=$k.2J();8 $5.k==$k};6 16=7($5,$h){8!$h||($h=="*")||($5.2K==$h)};6 1J=7($5){8 $5.1K};7 24($f,$a,v){6 $c,i,j;m(i=0;i<$a.p;i++){b($c=$a[i].1l.2L(v)){b($c.v==v)$f.q($c);1s b($c.p!=1T){m(j=0;j<$c.p;j++){b($c[j].v==v)$f.q($c[j])}}}}8 $f};b(![].q)1t.29.q=7(){m(6 i=0;i<o.p;i++){l[l.p]=o[i]}8 l.p};6 $19=/\\|/;7 1u($$a,$I,$x,$o){b($19.d($x)){$x=$x.1w($19);$o=$x[0];$x=$x[1]}6 $f=[];b(u[$I]){u[$I]($f,$$a,$x,$o)}8 $f};6 $1y=/^[^\\s>+~]/;6 $$1z=/[\\s#.:>+~()@]|[^\\s#.:>+~()@]+/g;7 1q($9){b($1y.d($9))$9=" "+$9;8 $9.c($$1z)||[]};6 $1A=/\\s*([\\s>+~(),]|^|$)\\s*/g;6 $22=/([\\s>+~,]|[^(]\\+|^)([#.:@])/g;6 14=7($9){8 $9.C($1A,"$1").C($22,"$1*$2")};6 1p={1B:7(){8"\'"},c:/^(\'[^\']*\')|("[^"]*")$/,d:7($y){8 l.c.d($y)},1D:7($y){8 l.d($y)?$y:l+$y+l},1C:7($y){8 l.d($y)?$y.Z(1,-1):$y}};6 1U=7($1F){8 1p.1C($1F)};6 $1G=/([\\/()[\\]?{}|*+-])/g;7 1a($y){8 $y.C($1G,"\\\\$1")};u[">"]=7($f,$a,$k,$h){6 $5,i,j;m(i=0;i<$a.p;i++){6 $10=U($a[i]);m(j=0;($5=$10[j]);j++)b(1b($5,$k,$h))$f.q($5)}};u["+"]=7($f,$a,$k,$h){m(6 i=0;i<$a.p;i++){6 $5=12($a[i]);b($5&&1b($5,$k,$h))$f.q($5)}};u["@"]=7($f,$a,$1H){6 $d=E[$1H].d;6 $5,i;m(i=0;($5=$a[i]);i++)b($d($5))$f.q($5)};L["2c-2d"]=7($5){8!1d($5)};L["1e"]=7($5,$F){$F=17 1M("^"+$F,"i");H($5&&!$5.Q("1e"))$5=$5.2e;8 $5&&$F.d($5.Q("1e"))};t.1O=/\\\\:/g;t.1i="@";t.K={};t.C=7($c,$r,$h,$1N,$A){6 $13=l.1i+$c;b(!E[$13]){$r=l.1P($r,$1N||"",$A||"");E[$13]=$r;E.q($r)}8 E[$13].v};t.1L=7($9){$9=$9.C(l.1O,"|");6 $c;H($c=$9.c(l.c)){6 $C=l.C($c[0],$c[1],$c[2],$c[3],$c[4]);$9=$9.C(l.c,$C)}8 $9};t.1P=7($1n,$d,$A){6 $S={};$S.v=l.1i+E.p;$S.J=$1n;$d=l.K[$d];$d=$d?$d(l.Q($1n),1U($A)):R;$S.d=17 2r("e","8 "+$d);8 $S};t.Q=7($J){27($J.2u()){G"v":8"e.v";G"2z":8"e.N";G"m":8"e.2E";G"25":b(P){8"21((e.2I.c(/25=\\\\1r?([^\\\\s\\\\1r]*)\\\\1r?/)||[])[1]||\'\')"}}8"e.Q(\'"+$J.C($19,":")+"\')"};t.K[""]=7($r){8 $r};t.K["="]=7($r,$A){8 $r+"=="+1p.1D($A)};t.K["~="]=7($r,$A){8"/(^| )"+1a($A)+"( |$)/.d("+$r+")"};t.K["|="]=7($r,$A){8"/^"+1a($A)+"(-|$)/.d("+$r+")"};6 1I=14;14=7($9){8 1I(t.1L($9))};P=1f("R;/*@2f@b(@\\2h)P=18@2j@*/");b(!P){T=7($5,$k,$h){8 $h?$5.2o("*",$k):$5.T($k)};16=7($5,$h){8!$h||($h=="*")||($5.2w==$h)};1o=z.1x?7($5){8/26/i.d(X($5).1x)}:7($5){8 X($5).2a.k!="2b"};1J=7($5){8 $5.Y||$5.1K||1c($5)};7 1c($5){6 $Y="",$V,i;m(i=0;($V=$5.2x[i]);i++){27($V.1v){G 11:G 1:$Y+=1c($V);1E;G 3:$Y+=$V.2M;1E}}8 $Y}}1g=18;8 B}();',62,173,'|||||element|var|function|return|selector|from|if|match|test||results||namespace|||tagName|this|for||arguments|length|push|attribute||AttributeSelector|selectors|id||filter|string|document|value|cssQuery|replace|thisElement|attributeSelectors|code|case|while|token|name|tests|pseudoClasses|cacheSelector|className|cache|isMSIE|getAttribute|false|attributeSelector|getElementsByTagName|childElements|node||getDocument|textContent|slice|subset||nextElementSibling|key|parseSelector|script|compareNamespace|new|true|NAMESPACE|regEscape|compareTagName|_getTextContent|previousElementSibling|lang|eval|loaded|useCache|PREFIX|version|base|all|links|propertyName|isXML|Quote|_toStream|x22|else|Array|select|nodeType|split|contentType|STANDARD_SELECT|STREAM|WHITESPACE|toString|remove|add|break|text|ESCAPE|attributeSelectorID|_parseSelector|getTextContent|innerText|parse|RegExp|compare|NS_IE|create|caching|join|delete|null|getText|pseudoClass|continue|lastChild|firstChild|firstElementChild|mimeType|String|IMPLIED_ALL|COMMA|_msie_selectById|href|xml|switch|modules|prototype|documentElement|HTML|first|child|parentNode|cc_on|constructor|x5fwin32|concat|end|error|clearCache|addModule|valueOf|getElementsByTagNameNS|link|callee|Function|previousSibling|nextSibling|toLowerCase|lastElementChild|prefix|childNodes|typeof|class|unknown|visited|URL|Boolean|htmlFor|XML|Document|ownerDocument|outerHTML|toUpperCase|scopeName|item|nodeValue'.split('|'),0,{}))

/*
moo.fx, simple effects library built with prototype.js (http://prototype.conio.net).
by Valerio Proietti (http://mad4milk.net) MIT-style LICENSE.
for more info (http://moofx.mad4milk.net).
Sunday, March 05, 2006
v 1.2.3
*/

var fx = new Object();
//base
fx.Base = function(){};
fx.Base.prototype = {
	setOptions: function(options) {
	this.options = {
		duration: 500,
		onComplete: '',
		transition: fx.sinoidal
	}
	Object.extend(this.options, options || {});
	},

	step: function() {
		var time  = (new Date).getTime();
		if (time >= this.options.duration+this.startTime) {
			this.now = this.to;
			clearInterval (this.timer);
			this.timer = null;
			if (this.options.onComplete) setTimeout(this.options.onComplete.bind(this), 10);
		}
		else {
			var Tpos = (time - this.startTime) / (this.options.duration);
			this.now = this.options.transition(Tpos) * (this.to-this.from) + this.from;
		}
		this.increase();
	},

	custom: function(from, to) {
		if (this.timer != null) return;
		this.from = from;
		this.to = to;
		this.startTime = (new Date).getTime();
		this.timer = setInterval (this.step.bind(this), 13);
	},

	hide: function() {
		this.now = 0;
		this.increase();
	},

	clearTimer: function() {
		clearInterval(this.timer);
		this.timer = null;
	}
}

//stretchers
fx.Layout = Class.create();
fx.Layout.prototype = Object.extend(new fx.Base(), {
	initialize: function(el, options) {
		this.el = $(el);
		this.el.style.overflow = "hidden";
		this.iniWidth = this.el.offsetWidth;
		this.iniHeight = this.el.offsetHeight;
		this.setOptions(options);
	}
});

fx.Height = Class.create();
Object.extend(Object.extend(fx.Height.prototype, fx.Layout.prototype), {	
	increase: function() {
		this.el.style.height = this.now + "px";
	},

	toggle: function() {
		if (this.el.offsetHeight > 0) this.custom(this.el.offsetHeight, 0);
		else this.custom(0, this.el.scrollHeight);
	}
});

fx.Width = Class.create();
Object.extend(Object.extend(fx.Width.prototype, fx.Layout.prototype), {	
	increase: function() {
		this.el.style.width = this.now + "px";
	},

	toggle: function(){
		if (this.el.offsetWidth > 0) this.custom(this.el.offsetWidth, 0);
		else this.custom(0, this.iniWidth);
	}
});

//fader
fx.Opacity = Class.create();
fx.Opacity.prototype = Object.extend(new fx.Base(), {
	initialize: function(el, options) {
		this.el = $(el);
		this.now = 1;
		this.increase();
		this.setOptions(options);
	},

	increase: function() {
		if (this.now == 1 && (/Firefox/.test(navigator.userAgent))) this.now = 0.9999;
		this.setOpacity(this.now);
	},
	
	setOpacity: function(opacity) {
		if (opacity == 0 && this.el.style.visibility != "hidden") this.el.style.visibility = "hidden";
		else if (this.el.style.visibility != "visible") this.el.style.visibility = "visible";
		if (window.ActiveXObject) this.el.style.filter = "alpha(opacity=" + opacity*100 + ")";
		this.el.style.opacity = opacity;
	},

	toggle: function() {
		if (this.now > 0) this.custom(1, 0);
		else this.custom(0, 1);
	}
});

//transitions
fx.sinoidal = function(pos){
	return ((-Math.cos(pos*Math.PI)/2) + 0.5);
	//this transition is from script.aculo.us
}
fx.linear = function(pos){
	return pos;
}
fx.cubic = function(pos){
	return Math.pow(pos, 3);
}
fx.circ = function(pos){
	return Math.sqrt(pos);
}

/*##################### Villa 10 starts #######################*/
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

//break frames
if (top.location != self.location) {
top.location=self.location;
}

RUZEE.Borders.add({
  '#wrap': { borderType:'shadow', cornerRadius:5, shadowWidth: 5 }
});


function init()  {	
	if (arguments.callee.done) return;
	arguments.callee.done = true;
	
	//Round off corners
	RUZEE.Borders.render();
	try {initLightbox();}
	catch(ex) {/*nothing important so just leave it*/}
	new Image().src = '/images/blue-stripe.gif';
	new Image().src = '/images/red-stripe.gif';
}

/* for Mozilla */
if (document.addEventListener) {
	document.addEventListener("DOMContentLoaded", init, false);
}

/* for Internet Explorer */
/*@cc_on @*/
/*@if (@_win32)
document.write("<script defer src=ie-onload.js><"+"/script>");
/*@end @*/

/* for other browsers */
addLoadEvent(init);