/* <? include 'js.php' ?>  */
// JavaScript Document
// THIS IS FOR ANY SCRIPT THAT NEED TO LOAD FIRST

//RATING RELATED SCRIPT
//observing all starboxes

var currentPath = document.location.hostname;
var paths = currentPath.split('/');


//var webroot = "/"+paths[1]+"/";
/* need to change this path after done with removing "jujups3" from url */
var webroot = "/jujups3/";
	
saveStar = function(event) {
new Ajax.Request(webroot + 'ratings/ajax_save/', {parameters: event.memo, onComplete: Prototype.emptyFunction});};
	
document.observe('starbox:rated', saveStar);	

//L: function to be called after uploading
function done_upload(webroot, type, id, user_id, file_id, div_update, id_div, thumb_size, part)
{
	switch (type)
	{
		case 20:
			//new Effect.toggle('file_upload_' + type + '_' + id);
			if(id_div == 'iu_20_default_banner_uploader') {
				window.location = webroot + 'admin/banners/list';
			}
			else {
				new Effect.toggle(id_div);
				new Ajax.Updater('banner', webroot + 'users/banner/' + id, {asynchronous:true, evalScripts:true});
			}

			break;
		case 90:
			new Effect.toggle('file_upload_'+type+'_'+id);
			
			new Ajax.Updater('files_'+id, webroot+'items/ajax_get_files/id:'+id,{asynchronous:true, evalScripts:true});
			new Effect.Appear('files_'+id);
			break;
		case 60:
			if(part == 'thumb')
			{
				new Effect.toggle(id_div);
				new Ajax.Updater(div_update, webroot+'MyFiles/image_upload/chosen_id:'+file_id+'/object_id:'+id+'/object_type:'+type+'/div_update:'+div_update+'/id_div:'+id_div+'/thumb_size:'+thumb_size,{asynchronous:true, evalScripts:true});
			}
			else
			{
				new Effect.toggle(div_update);
				
				new Ajax.Updater('files_'+id,webroot+'frames/ajax_get_files/id:'+id,{asynchronous:true, evalScripts:true});
				new Effect.Appear('files_'+id);
			}
			break;
		case 210:
			new Effect.toggle(id_div);
			new Ajax.Updater('avatar',webroot+'users/avatar/'+id,{asynchronous:true, evalScripts:true});
			break;
		case 100:
			new Effect.toggle(id_div);
			new Ajax.Updater(div_update,webroot+'users/headergraphic/'+id,{asynchronous:true, evalScripts:true});
			break;
		default:
			new Effect.toggle(id_div);
			new Ajax.Updater(div_update, webroot+'MyFiles/image_upload/chosen_id:'+file_id+'/object_id:'+id+'/object_type:'+type+'/div_update:'+div_update+'/id_div:'+id_div+'/thumb_size:'+thumb_size,{asynchronous:true, evalScripts:true});
			break;
			//alert(thumb_size);
			//if (id_div !== undefined)
				//this.document.getElementById(id_div).value = id;
		
	}
										
}

/*
* Really easy field validation with Prototype
* http://tetlaw.id.au/view/javascript/really-easy-field-validation
* Andrew Tetlaw
* Version 1.5.4.1 (2007-01-05)
* 
* Copyright (c) 2007 Andrew Tetlaw
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* 
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
* 
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
* 
*/
var Validator = Class.create();

Validator.prototype = {
	initialize : function(className, error, test, options) {
		if(typeof test == 'function'){
			this.options = $H(options);
			this._test = test;
		} else {
			this.options = $H(test);
			this._test = function(){return true};
		}
		this.error = error || 'Validation failed.';
		this.className = className;
	},
	test : function(v, elm) {
		return (this._test(v,elm) && this.options.all(function(p){
			return Validator.methods[p.key] ? Validator.methods[p.key](v,elm,p.value) : true;
		}));
	}
}
Validator.methods = {
	pattern : function(v,elm,opt) {return Validation.get('IsEmpty').test(v) || opt.test(v)},
	minLength : function(v,elm,opt) {return v.length >= opt},
	maxLength : function(v,elm,opt) {return v.length <= opt},
	min : function(v,elm,opt) {return v >= parseFloat(opt)}, 
	max : function(v,elm,opt) {return v <= parseFloat(opt)},
	notOneOf : function(v,elm,opt) {return $A(opt).all(function(value) {
		return v != value;
	})},
	oneOf : function(v,elm,opt) {return $A(opt).any(function(value) {
		return v == value;
	})},
	is : function(v,elm,opt) {return v == opt},
	isNot : function(v,elm,opt) {return v != opt},
	equalToField : function(v,elm,opt) {return v == $F(opt)},
	notEqualToField : function(v,elm,opt) {return v != $F(opt)},
	include : function(v,elm,opt) {return $A(opt).all(function(value) {
		return Validation.get(value).test(v,elm);
	})}
}

var Validation = Class.create();

Validation.prototype = {
	initialize : function(form, options){
		this.options = Object.extend({
			onSubmit : true,
			stopOnFirst : false,
			immediate : false,
			focusOnError : true,
			useTitles : false,
			onFormValidate : function(result, form) {},
			onElementValidate : function(result, elm) {}
		}, options || {});
		this.form = $(form);
		if(this.options.onSubmit) Event.observe(this.form,'submit',this.onSubmit.bind(this),false);
		if(this.options.immediate) {
			var useTitles = this.options.useTitles;
			var callback = this.options.onElementValidate;
			Form.getElements(this.form).each(function(input) { // Thanks Mike!
				Event.observe(input, 'blur', function(ev) { Validation.validate(Event.element(ev),{useTitle : useTitles, onElementValidate : callback}); });
			});
		}
	},
	onSubmit :  function(ev){
		if(!this.validate()) Event.stop(ev);
	},
	validate : function() {
		var result = false;
		var useTitles = this.options.useTitles;
		var callback = this.options.onElementValidate;
		if(this.options.stopOnFirst) {
			result = Form.getElements(this.form).all(function(elm) { return Validation.validate(elm,{useTitle : useTitles, onElementValidate : callback}); });
		} else {
			result = Form.getElements(this.form).collect(function(elm) { return Validation.validate(elm,{useTitle : useTitles, onElementValidate : callback}); }).all();
		}
		if(!result && this.options.focusOnError) {
			Form.getElements(this.form).findAll(function(elm){return $(elm).hasClassName('validation-failed')}).first().focus()
		}
		this.options.onFormValidate(result, this.form);
		return result;
	},
	reset : function() {
		Form.getElements(this.form).each(Validation.reset);
	}
}

Object.extend(Validation, {
	validate : function(elm, options){
		options = Object.extend({
			useTitle : false,
			onElementValidate : function(result, elm) {}
		}, options || {});
		elm = $(elm);
		var cn = elm.classNames();
		return result = cn.all(function(value) {
			var test = Validation.test(value,elm,options.useTitle);
			options.onElementValidate(test, elm);
			return test;
		});
	},
	test : function(name, elm, useTitle) {
		var v = Validation.get(name);
		var prop = '__advice'+name.camelize();
		try {
		if(Validation.isVisible(elm) && !v.test($F(elm), elm)) {
			if(!elm[prop]) {
				var advice = Validation.getAdvice(name, elm);
				if(advice == null) {
					var errorMsg = useTitle ? ((elm && elm.title) ? elm.title : v.error) : v.error;
					advice = '<div class="validation-advice" id="advice-' + name + '-' + Validation.getElmID(elm) +'" style="display:none">' + errorMsg + '</div>'
					switch (elm.type.toLowerCase()) {
						case 'checkbox':
						case 'radio':
							var p = elm.parentNode;
							if(p) {
								new Insertion.Bottom(p, advice);
							} else {
								new Insertion.After(elm, advice);
							}
							break;
						default:
							new Insertion.After(elm, advice);
				    }
					advice = Validation.getAdvice(name, elm);
				}
				if(typeof Effect == 'undefined') {
					advice.style.display = 'block';
				} else {
					new Effect.Appear(advice, {duration : 1 });
				}
			}
			elm[prop] = true;
			elm.removeClassName('validation-passed');
			elm.addClassName('validation-failed');
			return false;
		} else {
			var advice = Validation.getAdvice(name, elm);
			if(advice != null) advice.hide();
			elm[prop] = '';
			elm.removeClassName('validation-failed');
			elm.addClassName('validation-passed');
			return true;
		}
		} catch(e) {
			throw(e)
		}
	},
	isVisible : function(elm) {
		while(elm.tagName != 'BODY') {
			if(!$(elm).visible()) return false;
			elm = elm.parentNode;
		}
		return true;
	},
	getAdvice : function(name, elm) {
		return $('advice-' + name + '-' + Validation.getElmID(elm)) || $('advice-' + Validation.getElmID(elm));
	},
	getElmID : function(elm) {
		return elm.id ? elm.id : elm.name;
	},
	reset : function(elm) {
		elm = $(elm);
		var cn = elm.classNames();
		cn.each(function(value) {
			var prop = '__advice'+value.camelize();
			if(elm[prop]) {
				var advice = Validation.getAdvice(value, elm);
				advice.hide();
				elm[prop] = '';
			}
			elm.removeClassName('validation-failed');
			elm.removeClassName('validation-passed');
		});
	},
	add : function(className, error, test, options) {
		var nv = {};
		nv[className] = new Validator(className, error, test, options);
		Object.extend(Validation.methods, nv);
	},
	addAllThese : function(validators) {
		var nv = {};
		$A(validators).each(function(value) {
				nv[value[0]] = new Validator(value[0], value[1], value[2], (value.length > 3 ? value[3] : {}));
			});
		Object.extend(Validation.methods, nv);
	},
	get : function(name) {
		return  Validation.methods[name] ? Validation.methods[name] : Validation.methods['_LikeNoIDIEverSaw_'];
	},
	methods : {
		'_LikeNoIDIEverSaw_' : new Validator('_LikeNoIDIEverSaw_','',{})
	}
});

Validation.add('IsEmpty', '', function(v) {
				return  ((v == null) || (v.length == 0)); // || /^\s+$/.test(v));
			});

Validation.addAllThese([
	['required', 'This is a required field.', function(v) {
				return !Validation.get('IsEmpty').test(v);
			}],
	['validate-number', 'Please enter a valid number in this field.', function(v) {
				return Validation.get('IsEmpty').test(v) || (!isNaN(v) && !/^\s+$/.test(v));
			}],
	['validate-digits', 'Please use numbers only in this field. please avoid spaces or other characters such as dots or commas.', function(v) {
				return Validation.get('IsEmpty').test(v) ||  !/[^\d]/.test(v);
			}],
	['validate-alpha', 'Please use letters only (a-z) in this field.', function (v) {
				return Validation.get('IsEmpty').test(v) ||  /^[a-zA-Z]+$/.test(v)
			}],
	['validate-alphanum', 'Please use only letters (a-z) or numbers (0-9) only in this field. No spaces or other characters are allowed.', function(v) {
				return Validation.get('IsEmpty').test(v) ||  !/\W/.test(v)
			}],
	['validate-color', 'Please use only letters (a-f) or numbers (0-9) only in this field. No spaces or other characters are allowed.', function(v) {
				return !Validation.get('IsEmpty').test(v) && ( v.length==6 || v.length==3 ) && !/[^0-9a-fA-F]+/.test(v);
			}],
	['validate-date', 'Please enter a valid date.', function(v) {
				var test = new Date(v);
				return Validation.get('IsEmpty').test(v) || !isNaN(test);
			}],
	['validate-email', 'Please enter a valid email address. For example fred@domain.com .', function (v) {
				return Validation.get('IsEmpty').test(v) || /\w{1,}[@][\w\-]{1,}([.]([\w\-]{1,})){1,3}$/.test(v)
			}],
	['validate-url', 'Please enter a valid URL.', function (v) {
				return Validation.get('IsEmpty').test(v) || /^(http|https|ftp):\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+)(:(\d+))?\/?/i.test(v)
			}],
	['validate-date-au', 'Please use this date format: dd/mm/yyyy. For example 17/03/2006 for the 17th of March, 2006.', function(v) {
				if(Validation.get('IsEmpty').test(v)) return true;
				var regex = /^(\d{2})\/(\d{2})\/(\d{4})$/;
				if(!regex.test(v)) return false;
				var d = new Date(v.replace(regex, '$2/$1/$3'));
				return ( parseInt(RegExp.$2, 10) == (1+d.getMonth()) ) && 
							(parseInt(RegExp.$1, 10) == d.getDate()) && 
							(parseInt(RegExp.$3, 10) == d.getFullYear() );
			}],
	['validate-currency-dollar', 'Please enter a valid $ amount. For example $100.00 .', function(v) {
				// [$]1[##][,###]+[.##]
				// [$]1###+[.##]
				// [$]0.##
				// [$].##
				return Validation.get('IsEmpty').test(v) ||  /^\$?\-?([1-9]{1}[0-9]{0,2}(\,[0-9]{3})*(\.[0-9]{0,2})?|[1-9]{1}\d*(\.[0-9]{0,2})?|0(\.[0-9]{0,2})?|(\.[0-9]{1,2})?)$/.test(v)
			}],
	['validate-selection', 'Please make a selection', function(v,elm){
				return elm.options ? elm.selectedIndex > 0 : !Validation.get('IsEmpty').test(v);
			}],
	['validate-one-required', 'Please select one of the above options.', function (v,elm) {
				var p = elm.parentNode;
				var options = p.getElementsByTagName('INPUT');
				return $A(options).any(function(elm) {
					return $F(elm);
				});
			}]
]);

/********************************/
//  Starbox 1.1.0 - 01-04-2008
//  Copyright (c) 2008 Nick Stakenburg (http://www.nickstakenburg.com)
//
//  Licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Unported License
//  http://creativecommons.org/licenses/by-nc-nd/3.0/

//  More information on this project:
//  http://www.nickstakenburg.com/projects/starbox/

var Starboxes = {
  options: {
    buttons: 5,                                  // amount of clickable areas
    className : 'default',                       // default class
    color: false,                                // would overwrite the css style to set color on the stars
    duration: 0.6,                               // the duration of the revert effect, when effects are used
    effect: {
      mouseover: false,                          // use effects on mouseover, default false
      mouseout: (window.Effect && Effect.Morph)  // use effects on mouseout, default when available
    },
    hoverColor: false,                           // overwrites the css hover color
    hoverClass: 'hover',                         // the css hover class color
    ghostColor: false,                           // the color of the ghost stars, if used
    ghosting: false,                             // ghosts the previous vote
    identity: false,                             // a unique value you can give each starbox
    indicator: false,                            // use an indicator, default false
												 // can use: #{total}, #{max}, #{average}
    inverse: false,                              // inverse the stars, right to left
    locked: false,                               // lock the starbox to prevent voting
    max: 5,                                      // the maximum rating of the starbox
    onRate: Prototype.emptyFunction,             // default onRate, function(element, memo) {}
    rated: false,                                // or a rating to indicate a vote has been cast
    ratedClass: 'rated',                         // class when rated
    rerate: false,                               // allow rerating
    overlay: 'default.png',                      // default star overlay image
    overlayImages: '/jujups3/images/starbox/',         // directory of images relative to this file
    stars: 5,                                    // the amount of stars
    total: 0                                     // amount of votes cast
  }
};

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}('Y.1b(i,{3j:"1.6.0.2",3h:"1.8.1",1S:9(){3.1p("17");3.Z.2b=1;b A=/14(?:-[\\w\\d.]+)?\\.2Z(.*)/;3.1W=(($$("2Q 2J[v]").2k(9(B){h B.v.3I(A)})||{}).v||"").2j(A,"")+3.5.3A},1p:9(A){a((3l 1j[A]=="3k")||(3.1B(1j[A].3g)<3.1B(3["20"+A]))){3e("3c 3a "+A+" >= "+3["20"+A]);}},1B:9(A){b B=A.2j(/1v.*|\\./g,"");B=1t(B+"0".1r(4-B.2T));h A.2P("1v")>-1?B-1:B},2c:(9(B){b A=f 2G("2D ([\\\\d.]+)").2z(B);h A?(2w(A[1])<7):1M})(2p.2o),Z:9(B){B=$(B);b C=B.3H("2n"),A=1K.3D;a(C){h C}3C{C="3B"+A.2b++}3z($(C));B.3s("2n",C);h C},1G:[],3n:9(A){a(!3.1E(A.v)){3.1G.1a(A)}h A},1E:9(A){h 3.1G.2k(9(B){h B.v==A})},I:[],28:9(A){3.I.1a(A)},1i:9(){a(!3.I[0]){3.27=26;h}3.23(3.I[0])},23:9(C){b E=[],B=C.5.21,A=3.1E(B);3.I.G(9(F){a(F.5.21==B){E.1a(F);3.I=3.I.3d(F)}}.t(3));a(!A){b D=f 3b();D.39=9(){3.1w(E,{v:B,L:D.L,K:D.K,1V:D.v})}.t(3);D.v=i.1W+B}1T{3.1w(E,A)}},1w:9(B,A){B.G(9(C){C.1g=A;C.1R()});3.1i()},1s:(9(A){h{1e:"1e",R:"R",J:(A?"2S":"J")}})(17.1d.1m),2d:9(A){a(!17.1d.1m){A=A.2M(9(E,D){b C=Y.2K(3)?3:3.m,B=D.2H;a(B!=C&&!$A(C.2F("*")).2E(B)){E(D)}})}h A}});i.1S();2C.2e("2y:2x",i.1i.t(i));b 2v=2t.2s({2r:9(A,B){3.m=$(A);3.j=B;3.5=Y.1b(Y.2q(i.5),1K[2]||{});$w("M e u q").G(9(C){3[C]=3.5[C]}.t(3));3.X=3.5.X||(3.e&&!3.5.1n);a(!3.M){3.M=i.Z(3.m)}a(3.5.n&&(3.5.n.R||3.5.n.J)){i.1p("3G")}i.28(3);a(i.27){i.1i()}},2m:9(){$w("J R 1e").G(9(C){b B=C.2l(),A=3["1l"+B].3E(3);3["1l"+B+"1J"]=(C=="J"&&!17.1d.1m)?i.2d(A):A;3.16.2e(i.1s[C],3["1l"+B+"1J"])}.t(3));3.N.2i("c",{2h:"3y"})},2f:9(){$w("R J 1e").G(9(A){3.16.3r(i.1s[A],3["1l"+A.2l()+"1J"])}.t(3));3.N.2i("c",{2h:"3o"})},1R:9(){3.18=3.1g.K;3.15=3.1g.L;3.1F=3.1g.1V;3.O=3.18*3.5.1o;3.11=3.O/3.5.N;3.1c=3.5.u/3.5.N;a(3.5.n){3.2a=3.12(0);3.29=3.12(3.5.u)}b A={H:{U:"H",19:0,s:0,K:3.O+"k",L:3.15+"k"},1C:{U:"25",K:3.O+"k",L:3.15+"k"},24:{U:"H",19:0,s:0,K:3.18+"k",L:3.15+"k"}};3.m.Q("14");3.22=f l("o",{W:3.5.W||""}).c({U:"25"}).p(3.13=f l("o").p(3.1h=f l("o").p(3.1z=f l("o",{W:"1o"}).c(Y.1b({3f:"1Y"},A.1C)))));a(3.e){3.13.Q("e")}a(3.X){3.13.Q("X")}a(3.5.1O){3.1z.p(3.z=f l("o",{W:"z"}).c(A.H));a(3.5.1X){3.z.c({V:3.5.1X})}a(3.5.n){3.z.y=3.z.Z()}3.T(3.z,3.j,(1j.S&&S.1y))}3.1z.p(3.r=f l("o",{W:"r"}).c(A.H)).p(f l("o").c(A.H).p(3.16=f l("o").c(A.1C)));a(3.5.1x){3.r.c({V:3.5.1x})}a(3.5.n){3.r.y=3.r.Z()}3.5.1o.1r(9(B){b C;3.16.p(C=f l("o").c(Y.1b({V:"38("+3.1F+") 19 s 37-36",s:3.18*B+"k"},A.24)));C.c({s:3.18*B+"k"});a(i.2c){C.c({V:"35",34:"33:32.31.30(v=\'"+3.1F+"\'\', 2Y=\'2X\')"})}}.t(3));3.N=[];3.5.N.1r(9(D){b C,B=3.5.1U?3.O-3.11*(D+1):3.11*D;3.16.p(C=f l("o").c({U:"H",19:0,s:B+"k",K:3.11+(17.1d.1m?1:0)+"k",L:3.15+"k"}));C.x=3.1c*D+3.1c;3.N.1a(C)}.t(3));3.T(3.r,3.j);3.m.1Q(3.22);3.1u={};$w("j u e 1f q").G(9(B){3.m.p(3.1u[B]=f l("2W",{2V:"1Y",2U:3.M+"1v"+B,1P:""+(B=="1f"?!!3[B]:3[B])}))}.t(3));a(3.5.P){3.1h.p(3.P=f l("o",{W:"P"}));3.1A()}a(!3.X){3.2m()}},1Z:9(A){a(3.e&&3.5.1n){3.j=(3.q*3.j-3.e)/(3.q-1||1)}b B=3.e?3.q:3.q++;3.j=(3.j==0)?A:(3.j*(3.e?B-1:B)+A)/(3.e?B:B+1)},1A:9(){3.P.1Q(f 2R(3.5.P).3i({u:3.5.u,q:3.q,j:(3.j*10).2O()/10}))},12:9(B){b A=(3.O-(B/3.1c)*3.11);h 1t(3.5.1U?A.2N():-1*A.3m())},T:9(A,B){a(3.5.n&&3["1D"+A.y]){S.2L.3p(A.y).3q(3["1D"+A.y])}b D=3.12(B);a(1K[2]){b C=1t(A.2I("s")),F=3.12(B);a(C==F){h}b E=((3.29-(C-F).1q()).1q()/3.2a.1q()).3t(2);3["1D"+A.y]=f S.1y(A,{3u:{s:D+"k"},3v:{U:"3w",3x:1,y:A.y},2g:(3.5.2g*E)})}1T{A.c({s:D+"k"})}},2B:9(C){b B=C.m();a(!B.x){h}3.1Z(B.x);a(3.5.P){3.1A()}a(3.5.1O){3.T(3.z,3.j,(1j.S&&S.1y))}a(!3.e){3.13.Q("e")}3.1f=!!3.e;3.e=B.x;a(!3.5.1n){3.2f();3.13.Q("X");3.1N(C)}b A={};$w("j M u e 1f q").G(9(D){a(D!="M"){3.1u[D].1P=3[D]}A[D]=3[D]}.t(3));3.5.2A(3.m,A);3.m.1I("14:e",A)},1N:9(A){3.T(3.r,3.j,(3.5.n&&3.5.n.J));3.1H=1M;a(3.5.1k){3.1h.3F(3.5.1k)}a(3.5.1L){3.r.c({V:3.5.1x})}3.m.1I("14:s")},2u:9(B){b A=B.m();a(!A.x){h}3.T(3.r,A.x,(3.5.n&&3.5.n.R));a(!3.1H&&3.5.1k){3.1h.Q(3.5.1k)}3.1H=26;a(3.5.1L){3.r.c({V:3.5.1L})}3.m.1I("14:3J",{Z:3.5.M,u:3.5.u,x:A.x,q:3.q})}});',62,232,'|||this||options||||function|if|var|setStyle||rated|new||return|Starboxes|average|px|Element|element|effect|div|insert|total|colorbar|left|bind|max|src||rating|scope|ghost|||||||each|absolute|buildQueue|mouseout|width|height|identity|buttons|boxWidth|indicator|addClassName|mouseover|Effect|setBarPosition|position|background|className|locked|Object|identify||buttonWidth|getBarPosition|status|starbox|starHeight|starbar|Prototype|starWidth|top|push|extend|buttonRating|Browser|click|rerated|imageInfo|hover|processBuildQueue|window|hoverClass|on|IE|rerate|stars|require|abs|times|useEvent|parseInt|inputs|_|buildBatch|color|Morph|wrapper|updateIndicator|convertVersionString|base|activeEffect_|getCachedImage|starSrc|imagecache|hovered|fire|_cached|arguments|hoverColor|false|onMouseout|ghosting|value|update|build|load|else|inverse|fullsrc|imageSource|ghostColor|hidden|updateAverage|REQUIRED_|overlay|container|cacheBuildBatch|star|relative|true|batchLoading|queueBuild|maxPosition|zeroPosition|counter|fixIE|capture|observe|disable|duration|cursor|invoke|replace|find|capitalize|enable|id|userAgent|navigator|clone|initialize|create|Class|onMouseover|Starbox|parseFloat|loaded|dom|exec|onRate|onClick|document|MSIE|member|select|RegExp|relatedTarget|getStyle|script|isElement|Queues|wrap|ceil|round|indexOf|head|Template|mouseleave|length|name|type|input|scale|sizingMethod|js|AlphaImageLoader|Microsoft|DXImageTransform|progid|filter|none|repeat|no|url|onload|requires|Image|Lightview|without|throw|overflow|Version|REQUIRED_Scriptaculous|evaluate|REQUIRED_Prototype|undefined|typeof|floor|cacheImage|auto|get|remove|stopObserving|writeAttribute|toFixed|style|queue|end|limit|pointer|while|overlayImages|starbox_|do|callee|bindAsEventListener|removeClassName|Scriptaculous|readAttribute|match|changed'.split('|'),0,{}));

/*****************************/
/*
Created By: Chris Campbell
Website: http://particletree.com
Date: 2/1/2006

Inspired by the lightbox implementation found at http://www.huddletogether.com/projects/lightbox/
*/

/*-------------------------------GLOBAL VARIABLES------------------------------------*/

var detect = navigator.userAgent.toLowerCase();
var OS,browser,version,total,thestring;

/*-----------------------------------------------------------------------------------------------*/

//Browser detect script origionally created by Peter Paul Koch at http://www.quirksmode.org/

function getBrowserInfo() {
	if (checkIt('konqueror')) {
		browser = "Konqueror";
		OS = "Linux";
	}
	else if (checkIt('safari')) browser 	= "Safari"
	else if (checkIt('omniweb')) browser 	= "OmniWeb"
	else if (checkIt('opera')) browser 		= "Opera"
	else if (checkIt('webtv')) browser 		= "WebTV";
	else if (checkIt('icab')) browser 		= "iCab"
	else if (checkIt('msie')) browser 		= "Internet Explorer"
	else if (!checkIt('compatible')) {
		browser = "Netscape Navigator"
		version = detect.charAt(8);
	}
	else browser = "An unknown browser";

	if (!version) version = detect.charAt(place + thestring.length);

	if (!OS) {
		if (checkIt('linux')) OS 		= "Linux";
		else if (checkIt('x11')) OS 	= "Unix";
		else if (checkIt('mac')) OS 	= "Mac"
		else if (checkIt('win')) OS 	= "Windows"
		else OS 								= "an unknown operating system";
	}
}

function checkIt(string) {
	place = detect.indexOf(string) + 1;
	thestring = string;
	return place;
}

/*-----------------------------------------------------------------------------------------------*/

Event.observe(window, 'load', initialize, false);
Event.observe(window, 'load', getBrowserInfo, false);
Event.observe(window, 'unload', Event.unloadCache, false);

var lightbox = Class.create();

lightbox.prototype = {

	yPos : 0,
	xPos : 0,

	initialize: function(ctrl) {
		this.content = ctrl.rel;//modify by lazy,source code is:this.content = ctrl.href;
		Event.observe(ctrl, 'click', this.activate.bindAsEventListener(this), false);
		ctrl.onclick = function(){return false;};
	},
	
	// Turn everything on - mainly the IE fixes
	activate: function(){
		if (browser == 'Internet Explorer'){
			this.getScroll();
			this.prepareIE('100%', 'hidden');
			this.setScroll(0,0);
			this.hideSelects('hidden');
		}
		this.displayLightbox("block");
	},
	
	// Ie requires height to 100% and overflow hidden or else you can scroll down past the lightbox
	prepareIE: function(height, overflow){
		bod = document.getElementsByTagName('body')[0];
		bod.style.height = height;
		bod.style.overflow = overflow;
  
		htm = document.getElementsByTagName('html')[0];
		htm.style.height = height;
		htm.style.overflow = overflow; 
	},
	
	// In IE, select elements hover on top of the lightbox
	hideSelects: function(visibility){
		selects = document.getElementsByTagName('select');
		for(i = 0; i < selects.length; i++) {
			selects[i].style.visibility = visibility;
		}
	},
	
	// Taken from lightbox implementation found at http://www.huddletogether.com/projects/lightbox/
	getScroll: function(){
		if (self.pageYOffset) {
			this.yPos = self.pageYOffset;
		} else if (document.documentElement && document.documentElement.scrollTop){
			this.yPos = document.documentElement.scrollTop; 
		} else if (document.body) {
			this.yPos = document.body.scrollTop;
		}
	},
	
	setScroll: function(x, y){
		window.scrollTo(x, y); 
	},
	/*
	displayLightbox: function(display){
		$('overlay').style.display = display;
		$('lightbox').style.display = display;
		if(display != 'none') this.loadInfo();
	},
	*/
	 
      displayLightbox: function(display) {
 
              $('overlay').style.display = display;
 
              $('lightboxFixed').style.display = display;
  
              $('lightbox').style.display = display;
  
              if(display != 'none') this.loadInfo();
  
      },


	// Begin Ajax request based off of the href of the clicked linked
	loadInfo: function() {
		var myAjax = new Ajax.Request(
        this.content,
        {method: 'post', parameters: "", onComplete: this.processInfo.bindAsEventListener(this)}
		);
		
	},
	
	// Display Ajax response
	processInfo: function(response){
		info = "<div id='lbContent'>" + response.responseText + "</div>";
		new Insertion.Before($('lbLoadMessage'), info)
		$('lightbox').className = "done";	
		this.actions();			
	},
	
	// Search through new links within the lightbox, and attach click event
	actions: function(){
		lbActions = document.getElementsByClassName('lbAction');

		for(i = 0; i < lbActions.length; i++) {
			Event.observe(lbActions[i], 'click', this[lbActions[i].rel].bindAsEventListener(this), false);
			lbActions[i].onclick = function(){return false;};
		}

	},
	
	// Example of creating your own functionality once lightbox is initiated
	insert: function(e){
	   link = Event.element(e).parentNode;
	   Element.remove($('lbContent'));
	 
	   var myAjax = new Ajax.Request(
			  link.href,
			  {method: 'post', parameters: "", onComplete: this.processInfo.bindAsEventListener(this)}
	   );
	 
	},
	
	// Example of creating your own functionality once lightbox is initiated
	deactivate: function(){
		Element.remove($('lbContent'));
		if (browser == "Internet Explorer"){
			this.setScroll(0,this.yPos);
			this.prepareIE("auto", "auto");
			this.hideSelects("visible");
		}
		
		this.displayLightbox("none");
	}
}

/*-----------------------------------------------------------------------------------------------*/

// Onload, make all links that need to trigger a lightbox active
function initialize(){
	addLightboxMarkup();
	lbox = document.getElementsByClassName('lbOn');
	for(i = 0; i < lbox.length; i++) {
		valid = new lightbox(lbox[i]);
	}
}

// Add in markup necessary to make this work. Basically two divs:
// Overlay holds the shadow
// Lightbox is the centered square that the content is put into.
/*
function addLightboxMarkup() {
	bod 				= document.getElementsByTagName('body')[0];
	overlay 			= document.createElement('div');
	overlay.id		= 'overlay';
	lb					= document.createElement('div');
	lb.id				= 'lightbox';
	lb.className 	= 'loading';
	lb.innerHTML	= '<div id="lbLoadMessage">' +
						  '<p>Loading</p>' +
						  '</div>';
	bod.appendChild(overlay);
	bod.appendChild(lb);
}

*/


      function addLightboxMarkup() { bod = document.getElementsByTagName('body')[0];

              lightboxFixed = document.createElement('div');

              lightboxFixed.id ='lightboxFixed';

              overlay = document.createElement('div');

              overlay.id ='overlay';

              lb = document.createElement('div');

              lb.id ='lightbox';

              lb.className ='loading';

              lb.innerHTML    ='<div id="lbLoadMessage" align="center" style="margin-top:120px">' +

                     '<p>Loading</p>' +

                     '</div>';

              bod.appendChild(lightboxFixed);

              lightboxFixed.appendChild(overlay);

              lightboxFixed.appendChild(lb);

      }

/****************************/
function initPage()
{
	var uls = document.getElementsByTagName("div");
	for (var j=0; j<uls.length; j++)
	{			
		if (uls[j].className.indexOf("fly") != -1)  {
			var nodes = uls[j].getElementsByTagName("div");
			for (var i = 0; i < nodes.length; i++)
			{
				nodes[i].onmouseover = function () 
				{
					this.className += " hover";
				}
				nodes[i].onmouseout = function ()
				{
					this.className = this.className.replace("hover", "");
				}
			}
		}
	}
}
if (window.attachEvent)
	window.attachEvent("onload", initPage);
/********************************/
// JavaScript Document
var Fabtabs = Class.create();
Fabtabs.prototype = {
   initialize : function(element) {
          this.element = $(element);
                var options = Object.extend({}, arguments[1] || {});
              this.menu = $A(this.element.getElementsByTagName('a'));
           this.show(this.getInitialTab());
          this.menu.each(this.setupTab.bind(this));
 },
        setupTab : function(elm) {
                Event.observe(elm,'click',this.activate.bindAsEventListener(this),false)
  },
        activate :  function(ev) {
                var elm = Event.findElement(ev, "a");
           Event.stop(ev);
           this.show(elm);
           this.menu.without(elm).each(this.hide.bind(this));
        },
        hide : function(elm) {
            $(elm).removeClassName('active-tab');
             $(this.tabID(elm)).removeClassName('active-tab-body');
    },
        show : function(elm) {
            $(elm).addClassName('active-tab');
                $(this.tabID(elm)).addClassName('active-tab-body');
  },
        tabID : function(elm) {
           return elm.href.match(/#(\w.+)/)[1];
      },
        getInitialTab : function() {
              if(document.location.href.match(/#(\w.+)/)) {
                     var loc = RegExp.$1;
                      var elm = this.menu.find(function(value) { return value.href.match(/#(\w.+)/)[1] == loc; });
                      return elm || this.menu.first();
          } else {
                  return this.menu.first();
         }
 }
}