



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

 *  

 *  footerFixed.js

 *  

 *  MIT-style license. 

 *  

 *  2007 Kazuma Nishihata [to-R]

 *  http://blog.webcreativepark.net

 *  

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



new function(){

	

	var footerId = "footer";

	//メイン

	function footerFixed(){

		// 15/01/2008 OB: add test if footer exist before manipulating it

		var footerEl = null;

		footerEl = document.getElementById(footerId);

		if (footerEl) {

			//ドキュメントの高さ

			var dh = document.getElementsByTagName("body")[0].clientHeight;

			//フッターのtopからの位置

			footerEl.style.top = "0px";

			var ft = footerEl.offsetTop;

			//フッターの高さ

			var fh = footerEl.offsetHeight;

			//ウィンドウの高さ

			if (window.innerHeight){

				var wh = window.innerHeight;

			}else if(document.documentElement && document.documentElement.clientHeight != 0){

				var wh = document.documentElement.clientHeight;

			}

			if(ft+fh<wh){

				footerEl.style.position = "relative";

				footerEl.style.top = (wh-fh-ft-1)+"px";

			}

		}

	}

	

	//文字サイズ

	function checkFontSize(func){

	

		//判定要素の追加	

		var e = document.createElement("div");

		var s = document.createTextNode("S");

		e.appendChild(s);

		e.style.visibility="hidden"

		e.style.position="absolute"

		e.style.top="0"

		document.body.appendChild(e);

		var defHeight = e.offsetHeight;

		

		//判定関数

		function checkBoxSize(){

			if(defHeight != e.offsetHeight){

				func();

				defHeight= e.offsetHeight;

			}

		}

		setInterval(checkBoxSize,1000)

	}

	

	//イベントリスナー

	function addEvent(elm,listener,fn){

		try{

			elm.addEventListener(listener,fn,false);

		}catch(e){

			elm.attachEvent("on"+listener,fn);

		}

	}



	addEvent(window,"load",footerFixed);

	addEvent(window,"load",function(){

		checkFontSize(footerFixed);

	});

	addEvent(window,"resize",footerFixed);

	

}



// clear default value in forms

function doClear(theText) {

	if (theText.value == theText.defaultValue) {

		theText.value = "";

	}

}

// undo clear of default value

function undoClear(theText) {

	if (theText.value == "") {

		theText.value = theText.defaultValue;

	}

}



// ----------------------------------------------------------------------------

// general url

// ----------------------------------------------------------------------------



// goto an url

function gotoUrl(u) {

	document.location=u;

}



// open the link in a new window

// return false if the popup is shown, true otherwise

function openWindow(oLink, name, width, height, params) {

	var href = '';

	if (oLink.getAttribute) href = oLink.getAttribute('href');

	if (href=='') href = oLink.href;

	if (!href || href=='') href = oLink;

	var all_params = '';

	all_params += 'width=' + width + ',height=' + height;

	if (params && params!='') all_params += ','+params;

	// all is ready, open the popup and focus on it

	var oPopup = window.open(href, (name && name!='' ? name : 'popup'), all_params);

	if (oPopup) oPopup.focus();

	return (oPopup?false:true);

}


// open subscription page

function openSubscribe(f) {

	var u = "newsletterform.php?email="+f.elements['email'].value;

	var anchor = this.document.createElement('a');

	anchor.setAttribute('href', u);

	anchor.setAttribute('rel', 'lyteframe');

	anchor.setAttribute('title', '');

	anchor.setAttribute('rev', 'width: 630px; height: 380px; scrolling: auto;');

	myLytebox.start(anchor, false, true);

	return false;

}



// show an element

function show(id) {

	if (document.getElementById) {

		var el = document.getElementById(id);

		el.style.display = "block";

	}

}

// hide an element

function hide(id) {

	if (document.getElementById) {

		var el = document.getElementById(id);

		el.style.display = "none";

	}

}





// trim the left and right spaces of a string

function trim(str) {

	return str.replace(/^\s+|\s+$/, '');

};



// returns true if the string is empty

function isEmpty(str) {

	return (str == null) || (str.length == 0);

}



// returns true if the string is a valid email

function isEmail(str) {

	if (isEmpty(str)) return false;

	var re = /^[^\s()<>@,;:\/]+@\w[\w\.-]+\.[a-z]{2,}$/i

	return re.test(str);

}





function y2k(number) { return (number < 1000) ? number + 1900 : number; }



function daysElapsed(date1,date2) {

    var difference =

        Date.UTC(y2k(date1.getYear()),date1.getMonth(),date1.getDate(),0,0,0)

      - Date.UTC(y2k(date2.getYear()),date2.getMonth(),date2.getDate(),0,0,0);

    return difference/1000/60/60/24;

}



// TODO check this

function checkDate(f) {

	a_d = f.elements['booking_date'].split("/");

	if (a_d.length == 3) {

		var d = a_d[0];

		var m = a_d[1];

		var y = a_d[2];

		var days = daysElapsed(new Date(d+" "+m+" "+y), new Date());

		if (days < 2) {

			alert("Unfortunately we cannot take reservations online within 48 hours of the time requested.");

			return false;

		} else {

			return true;

		}

	} else {

		return false;

	}

}



function checkTime(f) {

	var h_min = 19; var m_min = 30; // change these 4 constants to modify the time boundaries

	var h_max = 22; var m_max = 00; 

	var h = f.elements['hour'].value;

	var m = f.elements['minute'].value;

	if (h == "" || m == "") {

		// Don't warn; the formmail will warn about the missing fields.

		return true;

	}

	h = parseInt(h); // to avoid the + operator on strings (see h*60+m below)

	m = parseInt(m);

	if (((h*60+m) < (h_min*60+m_min)) || ((h*60+m) > (h_max*60+m_max))) {

		alert("Unfortunately we can only take reservations online between "+h_min+":"+m_min+" and "+h_max+":"+m_max+".");

		return false;

	} else {

		return true;

	}

}



function checkMandatory(f) {

	// get the required fields and split them to check them

	var i, s, rf, a_rf, retval;

	rf = f.elements['require'].value;

	a_rf = rf.split(",");

	retval = true;

	

	// loop the fields to check them

	i=0;

	while (i < a_rf.length && retval) {

		// get type of field

		if (f.elements[a_rf[i]].type == 'text' || 

			f.elements[a_rf[i]].type == 'textarea' ||

			f.elements[a_rf[i]].type == 'radio' ||

			f.elements[a_rf[i]].type == 'checkbox' ||

			f.elements[a_rf[i]].type == 'select-one') {

			

			s = '';

			if (f.elements[a_rf[i]].type == "select-one") {

				var si = f.elements[a_rf[i]].selectedIndex;

                if (si >= 0) {

                    s = f.elements[a_rf[i]].options[si].value;

                }

			} else if (f.elements[a_rf[i]].type == 'radio') {

				if (f.elements[a_rf[i]].checked) {

					s = f.elements[a_rf[i]].value;

				}

			} else if (f.elements[a_rf[i]].type == 'checkbox') {

				if (f.elements[a_rf[i]].checked) {

					s = '1';

				}

			} else {

				s = f.elements[a_rf[i]].value;

			}

			s = trim(s);

			if (isEmpty(s)) {

				f.elements[a_rf[i]].value = s;

				f.elements[a_rf[i]].focus();

				retval = false;

			}

			

		} else if ((f.elements[a_rf[i]].length > 0) && 

				(f.elements[a_rf[i]][0].type == 'radio' || 

				f.elements[a_rf[i]][0].type == 'checkbox')) {

			

				var loop, isChecked=-1;

            for (loop=0;loop < f.elements[a_rf[i]].length;loop++) {

                if (f.elements[a_rf[i]][loop].checked) {

                    isChecked=loop;

                    break; // only one needs to be checked

                }

            }

            if (isChecked < 0) {

                f.elements[a_rf[i]][0].focus();

					retval = false;

            }

			

		}

		i++;

	}

	// warn the user

	if (!retval)

		alert("We cannot process your reservation if you don't fill all mandatory fields.");

	

	return retval;	

}



function checkReservationFields(f) {

	return checkMandatory(f) && checkDate(f) && checkTime(f);

}



// check if the field is filled to enable the button

// params: form object, field name, button name

function checkActSearch(f, fn, bn) {

	if (f.elements[fn] && f.elements[bn]) {

		var s = f.elements[fn].value.trim();

		if (s.length < 2) {

			f.elements[bn].disabled = true;

			f.elements[bn].setStyle('background', '#cccccc');

			return false;

		} else {

			f.elements[bn].disabled = false;

			f.elements[bn].setStyle('background', '#cb4f55');

			return true;

		}

	} else

		return false;

}





/*	sIFR 2.0.2

	Copyright 2004 - 2006 Mike Davidson, Shaun Inman, Tomas Jogin and Mark Wubben



	This software is licensed under the CC-GNU LGPL <http://creativecommons.org/licenses/LGPL/2.1/>

*/



var hasFlash=function(){var a=6;if(navigator.appVersion.indexOf("MSIE")!=-1&&navigator.appVersion.indexOf("Windows")>-1){document.write('<script language="VBScript"\> \non error resume next \nhasFlash = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & '+a+'))) \n</script\> \n');if(window.hasFlash!=null)return window.hasFlash}if(navigator.mimeTypes&&navigator.mimeTypes["application/x-shockwave-flash"]&&navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin){var b=(navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"]).description;return parseInt(b.charAt(b.indexOf(".")-1))>=a}return false}();String.prototype.normalize=function(){return this.replace(/\s+/g," ")};if(Array.prototype.push==null){Array.prototype.push=function(){var i=0,a=this.length,b=arguments.length;while(i<b){this[a++]=arguments[i++]}return this.length}}if(!Function.prototype.apply){Function.prototype.apply=function(a,b){var c=[];var d,e;if(!a)a=window;if(!b)b=[];for(var i=0;i<b.length;i++){c[i]="b["+i+"]"}e="a.__applyTemp__("+c.join(",")+");";a.__applyTemp__=this;d=eval(e);a.__applyTemp__=null;return d}}function named(a){return new named.Arguments(a)}named.Arguments=function(a){this.oArgs=a};named.Arguments.prototype.constructor=named.Arguments;named.extract=function(a,b){var c,d;var i=a.length;while(i--){d=a[i];if(d!=null&&d.constructor!=null&&d.constructor==named.Arguments){c=a[i].oArgs;break}}if(c==null)return;for(e in c)if(b[e]!=null)b[e](c[e]);return};var parseSelector=function(){var a=/^([^#.>`]*)(#|\.|\>|\`)(.+)$/;function r(s,t){var u=s.split(/\s*\,\s*/);var v=[];for(var i=0;i<u.length;i++)v=v.concat(b(u[i],t));return v}function b(c,d,e){c=c.normalize().replace(" ","`");var f=c.match(a);var g,h,i,j,k,n;var l=[];if(f==null)f=[c,c];if(f[1]=="")f[1]="*";if(e==null)e="`";if(d==null)d=document;switch(f[2]){case "#":k=f[3].match(a);if(k==null)k=[null,f[3]];g=document.getElementById(k[1]);if(g==null||(f[1]!="*"&&!o(g,f[1])))return l;if(k.length==2){l.push(g);return l}return b(k[3],g,k[2]);case ".":if(e!=">")h=m(d,f[1]);else h=d.childNodes;for(i=0,n=h.length;i<n;i++){g=h[i];if(g.nodeType!=1)continue;k=f[3].match(a);if(k!=null){if(g.className==null||g.className.match("(\\s|^)"+k[1]+"(\\s|$)")==null)continue;j=b(k[3],g,k[2]);l=l.concat(j)}else if(g.className!=null&&g.className.match("(\\s|^)"+f[3]+"(\\s|$)")!=null)l.push(g)}return l;case ">":if(e!=">")h=m(d,f[1]);else h=d.childNodes;for(i=0,n=h.length;i<n;i++){g=h[i];if(g.nodeType!=1)continue;if(!o(g,f[1]))continue;j=b(f[3],g,">");l=l.concat(j)}return l;case "`":h=m(d,f[1]);for(i=0,n=h.length;i<n;i++){g=h[i];j=b(f[3],g,"`");l=l.concat(j)}return l;default:if(e!=">")h=m(d,f[1]);else h=d.childNodes;for(i=0,n=h.length;i<n;i++){g=h[i];if(g.nodeType!=1)continue;if(!o(g,f[1]))continue;l.push(g)}return l}}function m(d,o){if(o=="*"&&d.all!=null)return d.all;return d.getElementsByTagName(o)}function o(p,q){return q=="*"?true:p.nodeName.toLowerCase().replace("html:", "")==q.toLowerCase()}return r}();var sIFR=function(){var a="http://www.w3.org/1999/xhtml";var b=false;var c=false;var d;var ah=[];var al=document;var ak=al.documentElement;var am=window;var au=al.addEventListener;var av=am.addEventListener;var f=function(){var g=navigator.userAgent.toLowerCase();var f={a:g.indexOf("applewebkit")>-1,b:g.indexOf("safari")>-1,c:navigator.product!=null&&navigator.product.toLowerCase().indexOf("konqueror")>-1,d:g.indexOf("opera")>-1,e:al.contentType!=null&&al.contentType.indexOf("xml")>-1,f:true,g:true,h:null,i:null,j:null,k:null};f.l=f.a||f.c;f.m=!f.a&&navigator.product!=null&&navigator.product.toLowerCase()=="gecko";if(f.m&&g.match(/.*gecko\/(\d{8}).*/))f.j=new Number(g.match(/.*gecko\/(\d{8}).*/)[1]);f.n=g.indexOf("msie")>-1&&!f.d&&!f.l&&!f.m;f.o=f.n&&g.match(/.*mac.*/)!=null;if(f.d&&g.match(/.*opera(\s|\/)(\d+\.\d+)/))f.i=new Number(g.match(/.*opera(\s|\/)(\d+\.\d+)/)[2]);if(f.n||(f.d&&f.i<7.6))f.g=false;if(f.a&&g.match(/.*applewebkit\/(\d+).*/))f.k=new Number(g.match(/.*applewebkit\/(\d+).*/)[1]);if(am.hasFlash&&(!f.n||f.o)){var aj=(navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"]).description;f.h=parseInt(aj.charAt(aj.indexOf(".")-1))}if(g.match(/.*(windows|mac).*/)==null||f.o||f.c||(f.d&&(g.match(/.*mac.*/)!=null||f.i<7.6))||(f.b&&f.h<7)||(!f.b&&f.a&&f.k<312)||(f.m&&f.j<20020523))f.f=false;if(!f.o&&!f.m&&al.createElementNS)try{al.createElementNS(a,"i").innerHTML=""}catch(e){f.e=true}f.p=f.c||(f.a&&f.k<312);return f}();function at(){return{bIsWebKit:f.a,bIsSafari:f.b,bIsKonq:f.c,bIsOpera:f.d,bIsXML:f.e,bHasTransparencySupport:f.f,bUseDOM:f.g,nFlashVersion:f.h,nOperaVersion:f.i,nGeckoBuildDate:f.j,nWebKitVersion:f.k,bIsKHTML:f.l,bIsGecko:f.m,bIsIE:f.n,bIsIEMac:f.o,bUseInnerHTMLHack:f.p}}if(am.hasFlash==false||!al.getElementsByTagName||!al.getElementById||(f.e&&(f.p||f.n)))return{UA:at()};function af(e){if((!k.bAutoInit&&(am.event||e)!=null)||!l(e))return;b=true;for(var i=0,h=ah.length;i<h;i++)j.apply(null,ah[i]);ah=[]}var k=af;function l(e){if(c==false||k.bIsDisabled==true||((f.e&&f.m||f.l)&&e==null&&b==false)||(al.body==null||al.getElementsByTagName("body").length==0))return false;return true}function m(n){if(f.n)return n.replace(new RegExp("%\d{0}","g"),"%25");return n.replace(new RegExp("%(?!\d)","g"),"%25")}function as(p,q){return q=="*"?true:p.nodeName.toLowerCase().replace("html:", "")==q.toLowerCase()}function o(p,q,r,s,t){var u="";var v=p.firstChild;var w,x,y,z;if(s==null)s=0;if(t==null)t="";while(v){if(v.nodeType==3){z=v.nodeValue.replace("<","&lt;");switch(r){case "lower":u+=z.toLowerCase();break;case "upper":u+=z.toUpperCase();break;default:u+=z}}else if(v.nodeType==1){if(as(v,"a")&&!v.getAttribute("href")==false){if(v.getAttribute("target"))t+="&sifr_url_"+s+"_target="+v.getAttribute("target");t+="&sifr_url_"+s+"="+m(v.getAttribute("href")).replace(/&/g,"%26");u+='<a href="asfunction:_root.launchURL,'+s+'">';s++}else if(as(v,"br"))u+="<br/>";if(v.hasChildNodes()){y=o(v,null,r,s,t);u+=y.u;s=y.s;t=y.t}if(as(v,"a"))u+="</a>"}w=v;v=v.nextSibling;if(q!=null){x=w.parentNode.removeChild(w);q.appendChild(x)}}return{"u":u,"s":s,"t":t}}function A(B){if(al.createElementNS&&f.g)return al.createElementNS(a,B);return al.createElement(B)}function C(D,E,z){var p=A("param");p.setAttribute("name",E);p.setAttribute("value",z);D.appendChild(p)}function F(p,G){var H=p.className;if(H==null)H=G;else H=H.normalize()+(H==""?"":" ")+G;p.className=H}function aq(ar){var a=ak;if(k.bHideBrowserText==false)a=al.getElementsByTagName("body")[0];if((k.bHideBrowserText==false||ar)&&a)if(a.className==null||a.className.match(/\bsIFR\-hasFlash\b/)==null)F(a, "sIFR-hasFlash")}function j(I,J,K,L,M,N,O,P,Q,R,S,r,T){if(!l())return ah.push(arguments);aq();named.extract(arguments,{sSelector:function(ap){I=ap},sFlashSrc:function(ap){J=ap},sColor:function(ap){K=ap},sLinkColor:function(ap){L=ap},sHoverColor:function(ap){M=ap},sBgColor:function(ap){N=ap},nPaddingTop:function(ap){O=ap},nPaddingRight:function(ap){P=ap},nPaddingBottom:function(ap){Q=ap},nPaddingLeft:function(ap){R=ap},sFlashVars:function(ap){S=ap},sCase:function(ap){r=ap},sWmode:function(ap){T=ap}});var U=parseSelector(I);if(U.length==0)return false;if(S!=null)S="&"+S.normalize();else S="";if(K!=null)S+="&textcolor="+K;if(M!=null)S+="&hovercolor="+M;if(M!=null||L!=null)S+="&linkcolor="+(L||K);if(O==null)O=0;if(P==null)P=0;if(Q==null)Q=0;if(R==null)R=0;if(N==null)N="#FFFFFF";if(T=="transparent")if(!f.f)T="opaque";else N="transparent";if(T==null)T="";var p,V,W,X,Y,Z,aa,ab,ac;var ad=null;for(var i=0,h=U.length;i<h;i++){p=U[i];if(p.className!=null&&p.className.match(/\bsIFR\-replaced\b/)!=null)continue;V=p.offsetWidth-R-P;W=p.offsetHeight-O-Q;aa=A("span");aa.className="sIFR-alternate";ac=o(p,aa,r);Z="txt="+m(ac.u).replace(/\+/g,"%2B").replace(/&/g,"%26").replace(/\"/g, "%22").normalize() + S + "&w=" + V + "&h=" + W + ac.t;F(p,"sIFR-replaced");if(ad==null||!f.g){if(!f.g){if(!f.n)p.innerHTML=['<embed class="sIFR-flash" type="application/x-shockwave-flash" src="http://id3.co.th/clients/bscv3/',J,'" quality="best" wmode="',T,'" bgcolor="',N,'" flashvars="',Z,'" width="',V,'" height="',W,'" sifr="true"></embed>'].join("");else p.innerHTML=['<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" sifr="true" width="',V,'" height="',W,'" class="sIFR-flash"><param name="movie" value="',J,"?",Z,'"></param><param name="quality" value="best"></param><param name="wmode" value="',T,'"></param><param name="bgcolor" value="',N,'"></param> </object>'].join('')}else{if(f.d){ab=A("object");ab.setAttribute("data",J);C(ab,"quality","best");C(ab,"wmode",T);C(ab,"bgcolor",N)}else{ab=A("embed");ab.setAttribute("src",J);ab.setAttribute("quality","best");ab.setAttribute("flashvars",Z);ab.setAttribute("wmode",T);ab.setAttribute("bgcolor",N)}ab.setAttribute("sifr","true");ab.setAttribute("type","application/x-shockwave-flash");ab.className="sIFR-flash";if(!f.l||!f.e)ad=ab.cloneNode(true)}}else ab=ad.cloneNode(true);if(f.g){if(f.d)C(ab,"flashvars",Z);else ab.setAttribute("flashvars",Z);ab.setAttribute("width",V);ab.setAttribute("height",W);ab.style.width=V+"px";ab.style.height=W+"px";p.appendChild(ab)}p.appendChild(aa);if(f.p)p.innerHTML+=""}if(f.n&&k.bFixFragIdBug)setTimeout(function(){al.title=d},0)}function ai(){d=al.title}function ae(){if(k.bIsDisabled==true)return;c=true;if(k.bHideBrowserText)aq(true);if(am.attachEvent)am.attachEvent("onload",af);else if(!f.c&&(al.addEventListener||am.addEventListener)){if(f.a&&f.k>=132&&am.addEventListener)am.addEventListener("load",function(){setTimeout("sIFR({})",1)},false);else{if(al.addEventListener)al.addEventListener("load",af,false);if(am.addEventListener)am.addEventListener("load",af,false)}}else if(typeof am.onload=="function"){var ag=am.onload;am.onload=function(){ag();af()}}else am.onload=af;if(!f.n||am.location.hash=="")k.bFixFragIdBug=false;else ai()}k.UA=at();k.bAutoInit=true;k.bFixFragIdBug=true;k.replaceElement=j;k.updateDocumentTitle=ai;k.appendToClassName=F;k.setup=ae;k.debug=function(){aq(true)};k.debug.replaceNow=function(){ae();k()};k.bIsDisabled=false;k.bHideBrowserText=true;return k}();



if(typeof sIFR == "function" && !sIFR.UA.bIsIEMac){

	sIFR.setup();

};



/**

 * SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/

 *

 * SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License:

 * http://www.opensource.org/licenses/mit-license.php

 *

 */

if(typeof deconcept=="undefined"){var deconcept=new Object();}if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\"";_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1a=this.getParams();for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}var _1c=this.getVariablePairs().join("&");if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\">";_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _1d=this.getParams();for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false;}if(this.major>fv.major){return true;}if(this.minor<fv.minor){return false;}if(this.minor>fv.minor){return true;}if(this.rev<fv.rev){return false;}return true;};deconcept.util={getRequestParameter:function(_2b){var q=document.location.search||document.location.hash;if(_2b==null){return q;}if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return "";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;



/*

    This file is part of JonDesign's SmoothGallery v2.0.



    JonDesign's SmoothGallery is free software; you can redistribute it and/or modify

    it under the terms of the GNU General Public License as published by

    the Free Software Foundation; either version 3 of the License, or

    (at your option) any later version.



    JonDesign's SmoothGallery is distributed in the hope that it will be useful,

    but WITHOUT ANY WARRANTY; without even the implied warranty of

    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

    GNU General Public License for more details.



    You should have received a copy of the GNU General Public License

    along with JonDesign's SmoothGallery; if not, write to the Free Software

    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA



    Main Developer: Jonathan Schemoul (JonDesign: http://www.jondesign.net/)

    Contributed code by:

    - Christian Ehret (bugfix)

	- Nitrix (bugfix)

	- Valerio from Mad4Milk for his great help with the carousel scrolling and many other things.

	- Archie Cowan for helping me find a bugfix on carousel inner width problem.

	- Tomocchino from #mootools for the preloader class

	Many thanks to:

	- The mootools team for the great mootools lib, and it's help and support throughout the project.

*/



// declaring the class

var gallery = {

	initialize: function(element, options) {

		this.setOptions({

			showArrows: false,

			showCarousel: true,

			showInfopane: true,

			embedLinks: true,

			fadeDuration: 500,

			timed: true,

			delay: 9000,

			preloader: false,

			preloaderImage: false,

			preloaderErrorImage: false,

			/* Data retrieval */

			manualData: [],

			populateFrom: false,

			populateData: true,

			destroyAfterPopulate: true,

			elementSelector: "div.imageElement",

			titleSelector: "h3",

			subtitleSelector: "p",

			linkSelector: "",

			imageSelector: "img.full",

			thumbnailSelector: "",

			defaultTransition: "fade",

			/* InfoPane options */

			slideInfoZoneOpacity: 0.5,

			slideInfoZoneSlide: true,

			/* Carousel options */

			carouselMinimizedOpacity: 0,

			carouselMinimizedHeight: 0,

			carouselMaximizedOpacity: 0,

			thumbHeight: 0,

			thumbWidth: 0,

			thumbSpacing: 0,

			thumbIdleOpacity: 0,

			textShowCarousel: '',

			showCarouselLabel: true,

			thumbCloseCarousel: true,

			useThumbGenerator: false,

			useExternalCarousel: false,

			carouselElement: false,

			carouselHorizontal: true,

			activateCarouselScroller: true,

			carouselPreloader: false,

			textPreloadingCarousel: '',

			/* CSS Classes */

			baseClass: 'jdGallery',

			withArrowsClass: 'withArrows',

			/* Plugins: HistoryManager */

			useHistoryManager: false,

			customHistoryKey: false

		}, options);

		this.fireEvent('onInit');

		this.currentIter = 0;

		this.lastIter = 0;

		this.maxIter = 0;

		this.galleryElement = element;

		this.galleryData = this.options.manualData;

		this.galleryInit = 1;

		this.galleryElements = Array();

		this.thumbnailElements = Array();

		this.galleryElement.addClass(this.options.baseClass);

		

		this.populateFrom = element;

		if (this.options.populateFrom)

			this.populateFrom = this.options.populateFrom;		

		if (this.options.populateData)

			this.populateData();

		element.style.display="block";

		

		if (this.options.useHistoryManager)

			this.initHistory();

		

		if (this.options.embedLinks)

		{

			this.currentLink = new Element('a').addClass('open').setProperties({

				href: '#',

				title: ''

			}).injectInside(element);

			if ((!this.options.showArrows) && (!this.options.showCarousel))

				this.galleryElement = element = this.currentLink;

			else

				this.currentLink.setStyle('display', 'none');

		}

		

		this.constructElements();

		if ((this.galleryData.length>1)&&(this.options.showArrows))

		{

			var leftArrow = new Element('a').addClass('left').addEvent(

				'click',

				this.prevItem.bind(this)

			).injectInside(element);

			var rightArrow = new Element('a').addClass('right').addEvent(

				'click',

				this.nextItem.bind(this)

			).injectInside(element);

			this.galleryElement.addClass(this.options.withArrowsClass);

		}

		this.loadingElement = new Element('div').addClass('loadingElement').injectInside(element);

		if (this.options.showInfopane) this.initInfoSlideshow();

		if (this.options.showCarousel) this.initCarousel();

		this.doSlideShow(1);

	},

	populateData: function() {

		currentArrayPlace = this.galleryData.length;

		options = this.options;

		var data = $A(this.galleryData);

		data.extend(this.populateGallery(this.populateFrom, currentArrayPlace));

		if (this.options.rande) data.sort(randOrd);

		this.galleryData = data;

		this.fireEvent('onPopulated');

	},

	populateGallery: function(element, startNumber) {

		var data = [];

		options = this.options;

		currentArrayPlace = startNumber;

		element.getElements(options.elementSelector).each(function(el) {

			elementDict = {

				image: el.getElement(options.imageSelector).getProperty('src'),

				number: currentArrayPlace,

				transition: this.options.defaultTransition

			};

			elementDict.extend = $extend;

			if ((options.showInfopane) | (options.showCarousel))

				elementDict.extend({

					title: el.getElement(options.titleSelector).innerHTML,

					description: el.getElement(options.subtitleSelector).innerHTML

				});

			if (options.embedLinks)

				elementDict.extend({

					link: el.getElement(options.linkSelector).href||false,

					linkTitle: el.getElement(options.linkSelector).title||false,

					linkTarget: el.getElement(options.linkSelector).getProperty('target')||false

				});

			if ((!options.useThumbGenerator) && (options.showCarousel))

				elementDict.extend({

					thumbnail: el.getElement(options.thumbnailSelector).getProperty('src')

				});

			else if (options.useThumbGenerator)

				elementDict.extend({

					thumbnail: options.thumbGenerator + '?imgfile=' + elementDict.image + '&max_width=' + options.thumbWidth + '&max_height=' + options.thumbHeight

				});

			

			data.extend([elementDict]);

			currentArrayPlace++;

			if (this.options.destroyAfterPopulate)

				el.remove();

		});

		return data;

	},

	constructElements: function() {

		el = this.galleryElement;

		this.maxIter = this.galleryData.length;

		var currentImg;

		for(i=0;i<this.galleryData.length;i++)

		{

			var currentImg = new Fx.Styles(

				new Element('div').addClass('slideElement').setStyles({

					'position':'absolute',

					'left':'0px',

					'right':'0px',

					'margin':'0px',

					'padding':'0px',

					'backgroundPosition':"center center",

					'opacity':'0'

				}).injectInside(el),

				'opacity',

				{duration: this.options.fadeDuration}

			);

			if (this.options.preloader)

			{

				currentImg.source = this.galleryData[i].image;

				currentImg.loaded = false;

				currentImg.load = function(imageStyle) {

					if (!imageStyle.loaded)	{

						new Asset.image(imageStyle.source, {

		                            'onload'  : function(img){

													img.element.setStyle(

													'backgroundImage',

													"url('" + img.source + "')")

													img.loaded = true;

												}.bind(this, imageStyle)

						});

					}

				}.pass(currentImg, this);

			} else {

				currentImg.element.setStyle('backgroundImage',

									"url('" + this.galleryData[i].image + "')");

			}

			this.galleryElements[parseInt(i)] = currentImg;

		}

	},

	destroySlideShow: function(element) {

		var myClassName = element.className;

		var newElement = new Element('div').addClass('myClassName');

		element.parentNode.replaceChild(newElement, element);

	},

	startSlideShow: function() {

		this.fireEvent('onStart');

		this.loadingElement.style.display = "none";

		this.lastIter = this.maxIter - 1;

		if (this.options.rande){

this.currentIter=Math.floor(Math.random()*this.maxIter)

} else {

this.currentIter = 0;

}

		this.galleryInit = 0;

		this.galleryElements[parseInt(this.currentIter)].set({opacity: 1});

		if (this.options.showInfopane)

			this.showInfoSlideShow.delay(1000, this);

		var textShowCarousel = formatString(this.options.textShowCarousel, this.currentIter+1, this.maxIter);

		if (this.options.showCarousel&&(!this.options.carouselPreloader))

			this.carouselBtn.setHTML(textShowCarousel).setProperty('title', textShowCarousel);

		this.prepareTimer();

		if (this.options.embedLinks)

			this.makeLink(this.currentIter);

	},

	nextItem: function() {

        this.fireEvent('onNextCalled');

        if (this.options.rande){            

            this.nextIter = Math.floor(Math.random()*this.maxIter);

            this.goTo(this.nextIter);

        } else {

        this.nextIter = this.currentIter+1;

        if (this.nextIter >= this.maxIter)

            this.nextIter = 0;

        this.galleryInit = 0;

        this.goTo(this.nextIter);

        }

    },

	prevItem: function() {

		this.fireEvent('onPreviousCalled');

		this.nextIter = this.currentIter-1;

		if (this.nextIter <= -1)

			this.nextIter = this.maxIter - 1;

		this.galleryInit = 0;

		this.goTo(this.nextIter);

	},

	goTo: function(num) {

		this.clearTimer();

		if(this.options.preloader)

		{

			this.galleryElements[num].load();

			if (num==0)

				this.galleryElements[this.maxIter - 1].load();

			else

				this.galleryElements[num - 1].load();

			if (num==(this.maxIter - 1))

				this.galleryElements[0].load();

			else

				this.galleryElements[num + 1].load();

				

		}

		if (this.options.embedLinks)

			this.clearLink();

		if (this.options.showInfopane)

		{

			this.slideInfoZone.clearChain();

			this.hideInfoSlideShow().chain(this.changeItem.pass(num, this));

		} else

			this.currentChangeDelay = this.changeItem.delay(500, this, num);

		if (this.options.embedLinks)

			this.makeLink(num);

		this.prepareTimer();

		/*if (this.options.showCarousel)

			this.clearThumbnailsHighlights();*/

	},

	changeItem: function(num) {

		this.fireEvent('onStartChanging');

		this.galleryInit = 0;

		if (this.currentIter != num)

		{

			for(i=0;i<this.maxIter;i++)

			{

				if ((i != this.currentIter)) this.galleryElements[i].set({opacity: 0});

			}

			gallery.Transitions[this.galleryData[num].transition].pass([

				this.galleryElements[this.currentIter],

				this.galleryElements[num],

				this.currentIter,

				num], this)();

			this.currentIter = num;

		}

		var textShowCarousel = formatString(this.options.textShowCarousel, num+1, this.maxIter);

		if (this.options.showCarousel)

			this.carouselBtn.setHTML(textShowCarousel).setProperty('title', textShowCarousel);

		this.doSlideShow.bind(this)();

		this.fireEvent('onChanged');

	},

	clearTimer: function() {

		if (this.options.timed)

			$clear(this.timer);

	},

	prepareTimer: function() {

		if (this.options.timed)

			this.timer = this.nextItem.delay(this.options.delay, this);

	},

	doSlideShow: function(position) {

		if (this.galleryInit == 1)

		{

			imgPreloader = new Image();

			imgPreloader.onload=function(){

				this.startSlideShow.delay(10, this);

			}.bind(this);

			imgPreloader.src = this.galleryData[0].image;

			if(this.options.preloader)

				this.galleryElements[0].load();

		} else {

			if (this.options.showInfopane)

			{

				if (this.options.showInfopane)

				{

					this.showInfoSlideShow.delay((500 + this.options.fadeDuration), this);

				} else

					if ((this.options.showCarousel)&&(this.options.activateCarouselScroller))

						this.centerCarouselOn(position);

			}

		}

	},

	createCarousel: function() {

		var carouselElement;

		if (!this.options.useExternalCarousel)

		{

			var carouselContainerElement = new Element('div').addClass('carouselContainer').injectInside(this.galleryElement);

			this.carouselContainer = new Fx.Styles(carouselContainerElement, {transition: Fx.Transitions.expoOut});

			this.carouselContainer.normalHeight = carouselContainerElement.offsetHeight;

			this.carouselContainer.set({'opacity': this.options.carouselMinimizedOpacity, 'top': (this.options.carouselMinimizedHeight - this.carouselContainer.normalHeight)});

			this.carouselBtn = new Element('a').addClass('carouselBtn').setProperties({

				title: this.options.textShowCarousel

			}).injectInside(carouselContainerElement);

			if(this.options.carouselPreloader)

				this.carouselBtn.setHTML(this.options.textPreloadingCarousel);

			else

				this.carouselBtn.setHTML(this.options.textShowCarousel);

			this.carouselBtn.addEvent(

				'click',

				function () {

					this.carouselContainer.clearTimer();

					this.toggleCarousel();

				}.bind(this)

			);

			this.carouselActive = false;

	

			carouselElement = new Element('div').addClass('carousel').injectInside(carouselContainerElement);

			this.carousel = new Fx.Styles(carouselElement);

		} else {

			carouselElement = $(this.options.carouselElement).addClass('jdExtCarousel');

		}

		this.carouselElement = new Fx.Styles(carouselElement, {transition: Fx.Transitions.expoOut});

		this.carouselElement.normalHeight = carouselElement.offsetHeight;

		if (this.options.showCarouselLabel)

			this.carouselLabel = new Element('p').addClass('label').injectInside(carouselElement);

		carouselWrapper = new Element('div').addClass('carouselWrapper').injectInside(carouselElement);

		this.carouselWrapper = new Fx.Styles(carouselWrapper, {transition: Fx.Transitions.expoOut});

		this.carouselWrapper.normalHeight = carouselWrapper.offsetHeight;

		this.carouselInner = new Element('div').addClass('carouselInner').injectInside(carouselWrapper);

		if (this.options.activateCarouselScroller)

		{

			this.carouselWrapper.scroller = new Scroller(carouselWrapper, {

				area: 100,

				velocity: 0.2

			})

			

			this.carouselWrapper.elementScroller = new Fx.Scroll(carouselWrapper, {

				duration: 400,

				onStart: this.carouselWrapper.scroller.stop.bind(this.carouselWrapper.scroller),

				onComplete: this.carouselWrapper.scroller.start.bind(this.carouselWrapper.scroller)

			});

		}

	},

	fillCarousel: function() {

		this.constructThumbnails();

		this.carouselInner.normalWidth = ((this.maxIter * (this.options.thumbWidth + this.options.thumbSpacing + 2))+this.options.thumbSpacing) + "px";

		this.carouselInner.style.width = this.carouselInner.normalWidth;

	},

	initCarousel: function () {

		this.createCarousel();

		this.fillCarousel();

		if (this.options.carouselPreloader)

			this.preloadThumbnails();

	},

	flushCarousel: function() {

		this.thumbnailElements.each(function(myFx) {

			myFx.element.remove();

			myFx = myFx.element = null;

		});

		this.thumbnailElements = [];

	},

	toggleCarousel: function() {

		if (this.carouselActive)

			this.hideCarousel();

		else

			this.showCarousel();

	},

	showCarousel: function () {

		this.fireEvent('onShowCarousel');

		this.carouselContainer.start({

			'opacity': this.options.carouselMaximizedOpacity,

			'top': 0

		}).chain(function() {

			this.carouselActive = true;

			this.carouselWrapper.scroller.start();

			this.fireEvent('onCarouselShown');

			this.carouselContainer.options.onComplete = null;

		}.bind(this));

	},

	hideCarousel: function () {

		this.fireEvent('onHideCarousel');

		var targetTop = this.options.carouselMinimizedHeight - this.carouselContainer.normalHeight;

		this.carouselContainer.start({

			'opacity': this.options.carouselMinimizedOpacity,

			'top': targetTop

		}).chain(function() {

			this.carouselActive = false;

			this.carouselWrapper.scroller.stop();

			this.fireEvent('onCarouselHidden');

			this.carouselContainer.options.onComplete = null;

		}.bind(this));

	},

	constructThumbnails: function () {

		element = this.carouselInner;

		for(i=0;i<this.galleryData.length;i++)

		{

			var currentImg = new Fx.Style(new Element ('div').addClass("thumbnail").setStyles({

					backgroundImage: "url('" + this.galleryData[i].thumbnail + "')",

					backgroundPosition: "center center",

					backgroundRepeat: 'no-repeat',

					marginLeft: this.options.thumbSpacing + "px",

					width: this.options.thumbWidth + "px",

					height: this.options.thumbHeight + "px"

				}).injectInside(element), "opacity", {duration: 200}).set(this.options.thumbIdleOpacity);

			currentImg.element.addEvents({

				'mouseover': function (myself) {

					myself.clearTimer();

					myself.start(0.99);

					if (this.options.showCarouselLabel)

						$(this.carouselLabel).setHTML('<span class="number">' + (myself.relatedImage.number + 1) + "/" + this.maxIter + ":</span> " + myself.relatedImage.title);

				}.pass(currentImg, this),

				'mouseout': function (myself) {

					myself.clearTimer();

					myself.start(this.options.thumbIdleOpacity);

				}.pass(currentImg, this),

				'click': function (myself) {

					this.goTo(myself.relatedImage.number);

					if (this.options.thumbCloseCarousel)

						this.hideCarousel();

				}.pass(currentImg, this)

			});

			

			currentImg.relatedImage = this.galleryData[i];

			this.thumbnailElements[parseInt(i)] = currentImg;

		}

	},

	log: function(value) {

		if(console.log)

			console.log(value);

	},

	preloadThumbnails: function() {

		var thumbnails = [];

		for(i=0;i<this.galleryData.length;i++)

		{

			thumbnails[parseInt(i)] = this.galleryData[i].thumbnail;

		}

		this.thumbnailPreloader = new Preloader();

		this.thumbnailPreloader.addEvent('onComplete', function() {

			var textShowCarousel = formatString(this.options.textShowCarousel, this.currentIter+1, this.maxIter);

			this.carouselBtn.setHTML(textShowCarousel).setProperty('title', textShowCarousel);

		}.bind(this));

		this.thumbnailPreloader.load(thumbnails);

	},

	clearThumbnailsHighlights: function()

	{

		for(i=0;i<this.galleryData.length;i++)

		{

			this.thumbnailElements[i].clearTimer();

			this.thumbnailElements[i].start(0.2);

		}

	},

	changeThumbnailsSize: function(width, height)

	{

		for(i=0;i<this.galleryData.length;i++)

		{

			this.thumbnailElements[i].clearTimer();

			this.thumbnailElements[i].element.setStyles({

				'width': width + "px",

				'height': height + "px"

			});

		}

	},

	centerCarouselOn: function(num) {

		if (!this.carouselWallMode)

		{

			var carouselElement = this.thumbnailElements[num];

			var position = carouselElement.element.offsetLeft + (carouselElement.element.offsetWidth / 2);

			var carouselWidth = this.carouselWrapper.element.offsetWidth;

			var carouselInnerWidth = this.carouselInner.offsetWidth;

			var diffWidth = carouselWidth / 2;

			var scrollPos = position-diffWidth;

			this.carouselWrapper.elementScroller.scrollTo(scrollPos,0);

		}

	},

	initInfoSlideshow: function() {

		/*if (this.slideInfoZone.element)

			this.slideInfoZone.element.remove();*/

		this.slideInfoZone = new Fx.Styles(new Element('div').addClass('slideInfoZone').injectInside($(this.galleryElement))).set({'opacity':0});

		var slideInfoZoneTitle = new Element('h2').injectInside(this.slideInfoZone.element);

		var slideInfoZoneDescription = new Element('p').injectInside(this.slideInfoZone.element);

		this.slideInfoZone.normalHeight = this.slideInfoZone.element.offsetHeight;

		this.slideInfoZone.element.setStyle('opacity',0);

	},

	changeInfoSlideShow: function()

	{

		this.hideInfoSlideShow.delay(10, this);

		this.showInfoSlideShow.delay(500, this);

	},

	showInfoSlideShow: function() {

		this.fireEvent('onShowInfopane');

		this.slideInfoZone.clearTimer();

		element = this.slideInfoZone.element;

		element.getElement('h2').setHTML(this.galleryData[this.currentIter].title);

		element.getElement('p').setHTML(this.galleryData[this.currentIter].description);

		if(this.options.slideInfoZoneSlide)

			this.slideInfoZone.start({'opacity': [0, this.options.slideInfoZoneOpacity], 'height': [0, this.slideInfoZone.normalHeight]});

		else

			this.slideInfoZone.start({'opacity': [0, this.options.slideInfoZoneOpacity]});

		if (this.options.showCarousel)

			this.slideInfoZone.chain(this.centerCarouselOn.pass(this.currentIter, this));

		return this.slideInfoZone;

	},

	hideInfoSlideShow: function() {

		this.fireEvent('onHideInfopane');

		this.slideInfoZone.clearTimer();

		if(this.options.slideInfoZoneSlide)

			this.slideInfoZone.start({'opacity': 0, 'height': 0});

		else

			this.slideInfoZone.start({'opacity': 0});

		return this.slideInfoZone;

	},

	makeLink: function(num) {

		this.currentLink.setProperties({

			href: this.galleryData[num].link,

			title: this.galleryData[num].linkTitle

		})

		if (!((this.options.embedLinks) && (!this.options.showArrows) && (!this.options.showCarousel)))

			this.currentLink.setStyle('display', 'block');

	},

	clearLink: function() {

		this.currentLink.setProperties({href: '', title: ''});

		if (!((this.options.embedLinks) && (!this.options.showArrows) && (!this.options.showCarousel)))

			this.currentLink.setStyle('display', 'none');

	},

	/* To change the gallery data, those two functions : */

	flushGallery: function() {

		this.galleryElements.each(function(myFx) {

			myFx.element.remove();

			myFx = myFx.element = null;

		});

		this.galleryElements = [];

	},

	changeData: function(data) {

		this.galleryData = data;

		this.clearTimer();

		this.flushGallery();

		if (this.options.showCarousel) this.flushCarousel();

		this.constructElements();

		if (this.options.showCarousel) this.fillCarousel();

		if (this.options.showInfopane) this.hideInfoSlideShow();

		this.galleryInit=1;

		this.lastIter=0;

		this.currentIter=0;

		this.doSlideShow(1);

	},

	/* Plugins: HistoryManager */

	initHistory: function() {

		this.fireEvent('onHistoryInit');

		this.historyKey = this.galleryElement.id + '-picture';

		if (this.options.customHistoryKey)

			this.historyKey = this.options.customHistoryKey();

		this.history = HistoryManager.register(

			this.historyKey,

			[1],

			function(values) {

				if (parseInt(values[0])-1 < this.maxIter)

					this.goTo(parseInt(values[0])-1);

			}.bind(this),

			function(values) {

				return [this.historyKey, '(', values[0], ')'].join('');

			}.bind(this),

			this.historyKey + '\\((\\d+)\\)');

		this.addEvent('onChanged', function(){

			this.history.setValue(0, this.currentIter+1);

		}.bind(this));

		this.fireEvent('onHistoryInited');

	}

};

gallery = new Class(gallery);

gallery.implement(new Events);

gallery.implement(new Options);



gallery.Transitions = new Abstract ({

	fade: function(oldFx, newFx, oldPos, newPos){

		oldFx.options.transition = newFx.options.transition = Fx.Transitions.linear;

		oldFx.options.duration = newFx.options.duration = this.options.fadeDuration;

		if (newPos > oldPos) newFx.start({opacity: 1});

		else

		{

			newFx.set({opacity: 1});

			oldFx.start({opacity: 0});

		}

	},

	crossfade: function(oldFx, newFx, oldPos, newPos){

		oldFx.options.transition = newFx.options.transition = Fx.Transitions.linear;

		oldFx.options.duration = newFx.options.duration = this.options.fadeDuration;

		newFx.start({opacity: 1});

		oldFx.start({opacity: 0});

	},

	fadebg: function(oldFx, newFx, oldPos, newPos){

		oldFx.options.transition = newFx.options.transition = Fx.Transitions.linear;

		oldFx.options.duration = newFx.options.duration = this.options.fadeDuration / 2;

		oldFx.start({opacity: 0}).chain(newFx.start.pass([{opacity: 1}], newFx));

	}

});



/* All code copyright 2007 Jonathan Schemoul */



/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

 * Follows: Preloader (class)

 * Simple class for preloading images with support for progress reporting

 * Copyright 2007 Tomocchino.

 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */



var Preloader = new Class({

  

  Implements: [Events, Options],



  options: {

    root        : '',

    period      : 100

  },

  

  initialize: function(options){

    this.setOptions(options);

  },

  

  load: function(sources) {

    this.index = 0;

    this.images = [];

    this.sources = this.temps = sources;

    this.total = this. sources.length;

    

    this.fireEvent('onStart', [this.index, this.total]);

    this.timer = this.progress.periodical(this.options.period, this);

    

    this.sources.each(function(source, index){

      this.images[index] = new Asset.image(this.options.root + source, {

        'onload'  : function(){ this.index++; if(this.images[index]) this.fireEvent('onLoad', [this.images[index], index, source]); }.bind(this),

        'onerror' : function(){ this.index++; this.fireEvent('onError', [this.images.splice(index, 1), index, source]); }.bind(this),

        'onabort' : function(){ this.index++; this.fireEvent('onError', [this.images.splice(index, 1), index, source]); }.bind(this)

      });

    }, this);

  },

  

  progress: function() {

    this.fireEvent('onProgress', [Math.min(this.index, this.total), this.total]);

    if(this.index >= this.total) this.complete();

  },

  

  complete: function(){

    $clear(this.timer);

    this.fireEvent('onComplete', [this.images]);

  },

  

  cancel: function(){

    $clear(this.timer);

  }

  

});



Preloader.implement(new Events, new Options);



/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

 * Follows: formatString (function)

 * Original name: Yahoo.Tools.printf

 * Copyright Yahoo.

 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */



function formatString() {

	var num = arguments.length;

	var oStr = arguments[0];

	for (var i = 1; i < num; i++) {

		var pattern = "\\{" + (i-1) + "\\}"; 

		var re = new RegExp(pattern, "g");

		oStr = oStr.replace(re, arguments[i]);

	}

	return oStr; 

}

/* random order addon

from http://smoothgallery.jondesign.net/forums/viewtopic.php?id=98

*/



function randOrd(){

      return (Math.round(Math.random())-0.5);

}



//***********************************************************************************************************************************/

//	LyteBox v3.22

//

//	 Author: Markus F. Hay

//  Website: http://www.dolem.com/lytebox

//	   Date: October 2, 2007

//	License: Creative Commons Attribution 3.0 License (http://creativecommons.org/licenses/by/3.0/)

// Browsers: Tested successfully on WinXP with the following browsers (using no DOCTYPE and Strict/Transitional/Loose DOCTYPES):

//				* Firefox: 2.0.0.7, 1.5.0.12

//				* Internet Explorer: 7.0, 6.0 SP2, 5.5 SP2

//				* Opera: 9.23

//

// Releases: For up-to-date and complete release information, visit http://www.dolem.com/forum/showthread.php?tid=62

//				* v3.22 (10/02/07)

//				* v3.21 (09/30/07)

//				* v3.20 (07/12/07)

//				* v3.10 (05/28/07)

//				* v3.00 (05/15/07)

//				* v2.02 (11/13/06)

//

//   Credit: LyteBox was originally derived from the Lightbox class (v2.02) that was written by Lokesh Dhakar. For more

//			 information please visit http://huddletogether.com/projects/lightbox2/

//***********************************************************************************************************************************/

Array.prototype.removeDuplicates = function () { for (var i = 1; i < this.length; i++) { if (this[i][0] == this[i-1][0]) { this.splice(i,1); } } }

Array.prototype.empty = function () { for (var i = 0; i <= this.length; i++) { this.shift(); } }

String.prototype.trim = function () { return this.replace(/^\s+|\s+$/g, ''); }



function LyteBox() {

	/*** Start Global Configuration ***/

		this.theme				= 'kaifa';	// themes: (default), red, green, gold

		this.hideFlash			= true;		// controls whether or not Flash objects should be hidden

		this.outerBorder		= false;	// controls whether to show the outer grey (or theme) border

		this.resizeSpeed		= 8;		// controls the speed of the image resizing (1=slowest and 10=fastest)

		this.maxOpacity			= 80;		// higher opacity = darker overlay, lower opacity = lighter overlay

		this.navType			= 1;		// 1 = "Prev/Next" buttons on top left and left (default), 2 = "<< prev | next >>" links next to image number

		this.autoResize			= true;		// controls whether or not images should be resized if larger than the browser window dimensions

		this.doAnimations		= true;		// controls whether or not "animate" Lytebox, i.e. resize transition between images, fade in/out effects, etc.

		

		this.borderSize			= 15;		// if you adjust the padding in the CSS, you will need to update this variable -- otherwise, leave this alone...

	/*** End Global Configuration ***/

	

	/*** Configure Slideshow Options ***/

		this.slideInterval		= 4000;		// Change value (milliseconds) to increase/decrease the time between "slides" (10000 = 10 seconds)

		this.showNavigation		= true;		// true to display Next/Prev buttons/text during slideshow, false to hide

		this.showClose			= false;		// true to display the Close button, false to hide

		this.showDetails		= true;		// true to display image details (caption, count), false to hide

		this.showPlayPause		= true;		// true to display pause/play buttons next to close button, false to hide

		this.autoEnd			= true;		// true to automatically close Lytebox after the last image is reached, false to keep open

		this.pauseOnNextClick	= false;	// true to pause the slideshow when the "Next" button is clicked

        this.pauseOnPrevClick 	= true;		// true to pause the slideshow when the "Prev" button is clicked

	/*** End Slideshow Configuration ***/

	

	if(this.resizeSpeed > 10) { this.resizeSpeed = 10; }

	if(this.resizeSpeed < 1) { resizeSpeed = 1; }

	this.resizeDuration = (11 - this.resizeSpeed) * 0.15;

	this.resizeWTimerArray		= new Array();

	this.resizeWTimerCount		= 0;

	this.resizeHTimerArray		= new Array();

	this.resizeHTimerCount		= 0;

	this.showContentTimerArray	= new Array();

	this.showContentTimerCount	= 0;

	this.overlayTimerArray		= new Array();

	this.overlayTimerCount		= 0;

	this.imageTimerArray		= new Array();

	this.imageTimerCount		= 0;

	this.timerIDArray			= new Array();

	this.timerIDCount			= 0;

	this.slideshowIDArray		= new Array();

	this.slideshowIDCount		= 0;

	this.imageArray	 = new Array();

	this.activeImage = null;

	this.slideArray	 = new Array();

	this.activeSlide = null;

	this.frameArray	 = new Array();

	this.activeFrame = null;

	this.checkFrame();

	this.isSlideshow = false;

	this.isLyteframe = false;

	/*@cc_on

		/*@if (@_jscript)

			this.ie = (document.all && !window.opera) ? true : false;

		/*@else @*/

			this.ie = false;

		/*@end

	@*/

	this.ie7 = (this.ie && window.XMLHttpRequest);	

	this.initialize();

}

LyteBox.prototype.initialize = function() {

	this.updateLyteboxItems();

	var objBody = this.doc.getElementsByTagName("body").item(0);	

	if (this.doc.getElementById('lbOverlay')) {

		objBody.removeChild(this.doc.getElementById("lbOverlay"));

		objBody.removeChild(this.doc.getElementById("lbMain"));

	}

	var objOverlay = this.doc.createElement("div");

		objOverlay.setAttribute('id','lbOverlay');

		objOverlay.setAttribute((this.ie ? 'className' : 'class'), this.theme);

		if ((this.ie && !this.ie7) || (this.ie7 && this.doc.compatMode == 'BackCompat')) {

			objOverlay.style.position = 'absolute';

		}

		objOverlay.style.display = 'none';

		objBody.appendChild(objOverlay);

	var objLytebox = this.doc.createElement("div");

		objLytebox.setAttribute('id','lbMain');

		objLytebox.style.display = 'none';

		objBody.appendChild(objLytebox);

	var objOuterContainer = this.doc.createElement("div");

		objOuterContainer.setAttribute('id','lbOuterContainer');

		objOuterContainer.setAttribute((this.ie ? 'className' : 'class'), this.theme);

		objLytebox.appendChild(objOuterContainer);

	var objIframeContainer = this.doc.createElement("div");

		objIframeContainer.setAttribute('id','lbIframeContainer');

		objIframeContainer.style.display = 'none';

		objOuterContainer.appendChild(objIframeContainer);

	var objIframe = this.doc.createElement("iframe");

		objIframe.setAttribute('id','lbIframe');

		objIframe.setAttribute('name','lbIframe');

		objIframe.style.display = 'none';

		objIframeContainer.appendChild(objIframe);

	var objImageContainer = this.doc.createElement("div");

		objImageContainer.setAttribute('id','lbImageContainer');

		objOuterContainer.appendChild(objImageContainer);

	var objLyteboxImage = this.doc.createElement("img");

		objLyteboxImage.setAttribute('id','lbImage');

		objImageContainer.appendChild(objLyteboxImage);

	var objLoading = this.doc.createElement("div");

		objLoading.setAttribute('id','lbLoading');

		objOuterContainer.appendChild(objLoading);

	var objDetailsContainer = this.doc.createElement("div");

		objDetailsContainer.setAttribute('id','lbDetailsContainer');

		objDetailsContainer.setAttribute((this.ie ? 'className' : 'class'), this.theme);

		objLytebox.appendChild(objDetailsContainer);

	var objDetailsData =this.doc.createElement("div");

		objDetailsData.setAttribute('id','lbDetailsData');

		objDetailsData.setAttribute((this.ie ? 'className' : 'class'), this.theme);

		objDetailsContainer.appendChild(objDetailsData);

	var objDetails = this.doc.createElement("div");

		objDetails.setAttribute('id','lbDetails');

		objDetailsData.appendChild(objDetails);

	var objCaption = this.doc.createElement("span");

		objCaption.setAttribute('id','lbCaption');

		objDetails.appendChild(objCaption);

	var objHoverNav = this.doc.createElement("div");

		objHoverNav.setAttribute('id','lbHoverNav');

		objImageContainer.appendChild(objHoverNav);

	var objBottomNav = this.doc.createElement("div");

		objBottomNav.setAttribute('id','lbBottomNav');

		objDetailsData.appendChild(objBottomNav);

	var objPrev = this.doc.createElement("a");

		objPrev.setAttribute('id','lbPrev');

		objPrev.setAttribute((this.ie ? 'className' : 'class'), this.theme);

		objPrev.setAttribute('href','#');

		objHoverNav.appendChild(objPrev);

	var objNext = this.doc.createElement("a");

		objNext.setAttribute('id','lbNext');

		objNext.setAttribute((this.ie ? 'className' : 'class'), this.theme);

		objNext.setAttribute('href','#');

		objHoverNav.appendChild(objNext);

	var objNumberDisplay = this.doc.createElement("span");

		objNumberDisplay.setAttribute('id','lbNumberDisplay');

		objDetails.appendChild(objNumberDisplay);

	var objNavDisplay = this.doc.createElement("span");

		objNavDisplay.setAttribute('id','lbNavDisplay');

		objNavDisplay.style.display = 'none';

		objDetails.appendChild(objNavDisplay);

	var objClose = this.doc.createElement("a");

		objClose.setAttribute('id','lbClose');

		objClose.setAttribute((this.ie ? 'className' : 'class'), this.theme);

		objClose.setAttribute('href','#');

		objBottomNav.appendChild(objClose);

	var objPause = this.doc.createElement("a");

		objPause.setAttribute('id','lbPause');

		objPause.setAttribute((this.ie ? 'className' : 'class'), this.theme);

		objPause.setAttribute('href','#');

		objPause.style.display = 'none';

		objBottomNav.appendChild(objPause);

	var objPlay = this.doc.createElement("a");

		objPlay.setAttribute('id','lbPlay');

		objPlay.setAttribute((this.ie ? 'className' : 'class'), this.theme);

		objPlay.setAttribute('href','#');

		objPlay.style.display = 'none';

		objBottomNav.appendChild(objPlay);

};

LyteBox.prototype.updateLyteboxItems = function() {	

	var anchors = (this.isFrame) ? window.parent.frames[window.name].document.getElementsByTagName('a') : document.getElementsByTagName('a');

	for (var i = 0; i < anchors.length; i++) {

		var anchor = anchors[i];

		var relAttribute = String(anchor.getAttribute('rel'));

		if (anchor.getAttribute('href')) {

			if (relAttribute.toLowerCase().match('lytebox')) {

				anchor.onclick = function () { myLytebox.start(this, false, false); return false; }

			} else if (relAttribute.toLowerCase().match('lyteshow')) {

				anchor.onclick = function () { myLytebox.start(this, true, false); return false; }

			} else if (relAttribute.toLowerCase().match('lyteframe')) {

				anchor.onclick = function () { myLytebox.start(this, false, true); return false; }

			}

		}

	}

};

LyteBox.prototype.start = function(imageLink, doSlide, doFrame) {

	if (this.ie && !this.ie7) {	this.toggleSelects('hide');	}

	if (this.hideFlash) { this.toggleFlash('hide'); }

	this.isLyteframe = (doFrame ? true : false);

	var pageSize	= this.getPageSize();

	var objOverlay	= this.doc.getElementById('lbOverlay');

	var objBody		= this.doc.getElementsByTagName("body").item(0);

	objOverlay.style.height = pageSize[1] + "px";

	objOverlay.style.display = '';

	this.appear('lbOverlay', (this.doAnimations ? 0 : this.maxOpacity));

	var anchors = (this.isFrame) ? window.parent.frames[window.name].document.getElementsByTagName('a') : document.getElementsByTagName('a');

	if (this.isLyteframe) {

		this.frameArray = [];

		this.frameNum = 0;

		if ((imageLink.getAttribute('rel') == 'lyteframe')) {

			var rev = imageLink.getAttribute('rev');

			this.frameArray.push(new Array(imageLink.getAttribute('href'), imageLink.getAttribute('title'), (rev == null || rev == '' ? 'width: 400px; height: 400px; scrolling: auto;' : rev)));

		} else {

			if (imageLink.getAttribute('rel').indexOf('lyteframe') != -1) {

				for (var i = 0; i < anchors.length; i++) {

					var anchor = anchors[i];

					if (anchor.getAttribute('href') && (anchor.getAttribute('rel') == imageLink.getAttribute('rel'))) {

						var rev = anchor.getAttribute('rev');

						this.frameArray.push(new Array(anchor.getAttribute('href'), anchor.getAttribute('title'), (rev == null || rev == '' ? 'width: 400px; height: 400px; scrolling: auto;' : rev)));

					}

				}

				this.frameArray.removeDuplicates();

				while(this.frameArray[this.frameNum][0] != imageLink.getAttribute('href')) { this.frameNum++; }

			}

		}

	} else {

		this.imageArray = [];

		this.imageNum = 0;

		this.slideArray = [];

		this.slideNum = 0;

		if ((imageLink.getAttribute('rel') == 'lytebox')) {

			this.imageArray.push(new Array(imageLink.getAttribute('href'), imageLink.getAttribute('title')));

		} else {

			if (imageLink.getAttribute('rel').indexOf('lytebox') != -1) {

				for (var i = 0; i < anchors.length; i++) {

					var anchor = anchors[i];

					if (anchor.getAttribute('href') && (anchor.getAttribute('rel') == imageLink.getAttribute('rel'))) {

						this.imageArray.push(new Array(anchor.getAttribute('href'), anchor.getAttribute('title')));

					}

				}

				this.imageArray.removeDuplicates();

				while(this.imageArray[this.imageNum][0] != imageLink.getAttribute('href')) { this.imageNum++; }

			}

			if (imageLink.getAttribute('rel').indexOf('lyteshow') != -1) {

				for (var i = 0; i < anchors.length; i++) {

					var anchor = anchors[i];

					if (anchor.getAttribute('href') && (anchor.getAttribute('rel') == imageLink.getAttribute('rel'))) {

						this.slideArray.push(new Array(anchor.getAttribute('href'), anchor.getAttribute('title')));

					}

				}

				this.slideArray.removeDuplicates();

				while(this.slideArray[this.slideNum][0] != imageLink.getAttribute('href')) { this.slideNum++; }

			}

		}

	}

	var object = this.doc.getElementById('lbMain');

		object.style.top = (this.getPageScroll() + (pageSize[3] / 15)) + "px";

		object.style.display = '';

	if (!this.outerBorder) {

		this.doc.getElementById('lbOuterContainer').style.border = 'none';

		this.doc.getElementById('lbDetailsContainer').style.border = 'none';

	} else {

		this.doc.getElementById('lbOuterContainer').style.borderBottom = '';

		this.doc.getElementById('lbOuterContainer').setAttribute((this.ie ? 'className' : 'class'), this.theme);

	}

	this.doc.getElementById('lbOverlay').onclick = function() { myLytebox.end(); return false; }

	this.doc.getElementById('lbMain').onclick = function(e) {

		var e = e;

		if (!e) {

			if (window.parent.frames[window.name] && (parent.document.getElementsByTagName('frameset').length <= 0)) {

				e = window.parent.window.event;

			} else {

				e = window.event;

			}

		}

		var id = (e.target ? e.target.id : e.srcElement.id);

		if (id == 'lbMain') { myLytebox.end(); return false; }

	}

	this.doc.getElementById('lbClose').onclick = function() { myLytebox.end(); return false; }

	this.doc.getElementById('lbPause').onclick = function() { myLytebox.togglePlayPause("lbPause", "lbPlay"); return false; }

	this.doc.getElementById('lbPlay').onclick = function() { myLytebox.togglePlayPause("lbPlay", "lbPause"); return false; }	

	this.isSlideshow = doSlide;

	this.isPaused = (this.slideNum != 0 ? true : false);

	if (this.isSlideshow && this.showPlayPause && this.isPaused) {

		this.doc.getElementById('lbPlay').style.display = '';

		this.doc.getElementById('lbPause').style.display = 'none';

	}

	if (this.isLyteframe) {

		this.changeContent(this.frameNum);

	} else {

		if (this.isSlideshow) {

			this.changeContent(this.slideNum);

		} else {

			this.changeContent(this.imageNum);

		}

	}

};

LyteBox.prototype.changeContent = function(imageNum) {

	if (this.isSlideshow) {

		for (var i = 0; i < this.slideshowIDCount; i++) { window.clearTimeout(this.slideshowIDArray[i]); }

	}

	this.activeImage = this.activeSlide = this.activeFrame = imageNum;

	if (!this.outerBorder) {

		this.doc.getElementById('lbOuterContainer').style.border = 'none';

		this.doc.getElementById('lbDetailsContainer').style.border = 'none';

	} else {

		this.doc.getElementById('lbOuterContainer').style.borderBottom = '';

		this.doc.getElementById('lbOuterContainer').setAttribute((this.ie ? 'className' : 'class'), this.theme);

	}

	this.doc.getElementById('lbLoading').style.display = '';

	this.doc.getElementById('lbImage').style.display = 'none';

	this.doc.getElementById('lbIframe').style.display = 'none';

	this.doc.getElementById('lbPrev').style.display = 'none';

	this.doc.getElementById('lbNext').style.display = 'none';

	this.doc.getElementById('lbIframeContainer').style.display = 'none';

	this.doc.getElementById('lbDetailsContainer').style.display = 'none';

	this.doc.getElementById('lbNumberDisplay').style.display = 'none';

	if (this.navType == 2 || this.isLyteframe) {

		object = this.doc.getElementById('lbNavDisplay');

		object.innerHTML = '&nbsp;&nbsp;&nbsp;<span id="lbPrev2_Off" style="display: none;" class="' + this.theme + '">&laquo; prev</span><a href="#" id="lbPrev2" class="' + this.theme + '" style="display: none;">&laquo; prev</a> <b id="lbSpacer" class="' + this.theme + '">||</b> <span id="lbNext2_Off" style="display: none;" class="' + this.theme + '">next &raquo;</span><a href="#" id="lbNext2" class="' + this.theme + '" style="display: none;">next &raquo;</a>';

		object.style.display = 'none';

	}

	if (this.isLyteframe) {

		var iframe = myLytebox.doc.getElementById('lbIframe');

		var styles = this.frameArray[this.activeFrame][2];

		var aStyles = styles.split(';');

		for (var i = 0; i < aStyles.length; i++) {

			if (aStyles[i].indexOf('width:') >= 0) {

				var w = aStyles[i].replace('width:', '');

				iframe.width = w.trim();

			} else if (aStyles[i].indexOf('height:') >= 0) {

				var h = aStyles[i].replace('height:', '');

				iframe.height = h.trim();

			} else if (aStyles[i].indexOf('scrolling:') >= 0) {

				var s = aStyles[i].replace('scrolling:', '');

				iframe.scrolling = s.trim();

			} else if (aStyles[i].indexOf('border:') >= 0) {

				// Not implemented yet, as there are cross-platform issues with setting the border (from a GUI standpoint)

				//var b = aStyles[i].replace('border:', '');

				//iframe.style.border = b.trim();

			}

		}

		this.resizeContainer(parseInt(iframe.width), parseInt(iframe.height));

	} else {

		imgPreloader = new Image();

		imgPreloader.onload = function() {

			var imageWidth = imgPreloader.width;

			var imageHeight = imgPreloader.height;

			if (myLytebox.autoResize) {

				var pagesize = myLytebox.getPageSize();

				var x = pagesize[2] - 150;

				var y = pagesize[3] - 150;

				if (imageWidth > x) {

					imageHeight = Math.round(imageHeight * (x / imageWidth));

					imageWidth = x; 

					if (imageHeight > y) { 

						imageWidth = Math.round(imageWidth * (y / imageHeight));

						imageHeight = y; 

					}

				} else if (imageHeight > y) { 

					imageWidth = Math.round(imageWidth * (y / imageHeight));

					imageHeight = y; 

					if (imageWidth > x) {

						imageHeight = Math.round(imageHeight * (x / imageWidth));

						imageWidth = x;

					}

				}

			}

			var lbImage = myLytebox.doc.getElementById('lbImage')

			lbImage.src = (myLytebox.isSlideshow ? myLytebox.slideArray[myLytebox.activeSlide][0] : myLytebox.imageArray[myLytebox.activeImage][0]);

			lbImage.width = imageWidth;

			lbImage.height = imageHeight;

			myLytebox.resizeContainer(imageWidth, imageHeight);

			imgPreloader.onload = function() {};

		}

		imgPreloader.src = (this.isSlideshow ? this.slideArray[this.activeSlide][0] : this.imageArray[this.activeImage][0]);

	}

};

LyteBox.prototype.resizeContainer = function(imgWidth, imgHeight) {

	this.wCur = this.doc.getElementById('lbOuterContainer').offsetWidth;

	this.hCur = this.doc.getElementById('lbOuterContainer').offsetHeight;

	this.xScale = ((imgWidth  + (this.borderSize * 2)) / this.wCur) * 100;

	this.yScale = ((imgHeight  + (this.borderSize * 2)) / this.hCur) * 100;

	var wDiff = (this.wCur - this.borderSize * 2) - imgWidth;

	var hDiff = (this.hCur - this.borderSize * 2) - imgHeight;

	if (!(hDiff == 0)) {

		this.hDone = false;

		this.resizeH('lbOuterContainer', this.hCur, imgHeight + this.borderSize*2, this.getPixelRate(this.hCur, imgHeight));

	} else {

		this.hDone = true;

	}

	if (!(wDiff == 0)) {

		this.wDone = false;

		this.resizeW('lbOuterContainer', this.wCur, imgWidth + this.borderSize*2, this.getPixelRate(this.wCur, imgWidth));

	} else {

		this.wDone = true;

	}

	if ((hDiff == 0) && (wDiff == 0)) {

		if (this.ie){ this.pause(250); } else { this.pause(100); } 

	}

	this.doc.getElementById('lbPrev').style.height = imgHeight + "px";

	this.doc.getElementById('lbNext').style.height = imgHeight + "px";

	this.doc.getElementById('lbDetailsContainer').style.width = (imgWidth + (this.borderSize * 2) + (this.ie && this.doc.compatMode == "BackCompat" && this.outerBorder ? 2 : 0)) + "px";

	this.showContent();

};

LyteBox.prototype.showContent = function() {

	if (this.wDone && this.hDone) {

		for (var i = 0; i < this.showContentTimerCount; i++) { window.clearTimeout(this.showContentTimerArray[i]); }

		if (this.outerBorder) {

			this.doc.getElementById('lbOuterContainer').style.borderBottom = 'none';

		}

		this.doc.getElementById('lbLoading').style.display = 'none';

		if (this.isLyteframe) {

			this.doc.getElementById('lbIframe').style.display = '';

			this.appear('lbIframe', (this.doAnimations ? 0 : 100));

		} else {

			this.doc.getElementById('lbImage').style.display = '';

			this.appear('lbImage', (this.doAnimations ? 0 : 100));

			this.preloadNeighborImages();

		}

		if (this.isSlideshow) {

			if(this.activeSlide == (this.slideArray.length - 1)) {

				if (this.autoEnd) {

					this.slideshowIDArray[this.slideshowIDCount++] = setTimeout("myLytebox.end('slideshow')", this.slideInterval);

				}

			} else {

				if (!this.isPaused) {

					this.slideshowIDArray[this.slideshowIDCount++] = setTimeout("myLytebox.changeContent("+(this.activeSlide+1)+")", this.slideInterval);

				}

			}

			this.doc.getElementById('lbHoverNav').style.display = (this.showNavigation && this.navType == 1 ? '' : 'none');

			this.doc.getElementById('lbClose').style.display = (this.showClose ? '' : 'none');

			this.doc.getElementById('lbDetails').style.display = (this.showDetails ? '' : 'none');

			this.doc.getElementById('lbPause').style.display = (this.showPlayPause && !this.isPaused ? '' : 'none');

			this.doc.getElementById('lbPlay').style.display = (this.showPlayPause && !this.isPaused ? 'none' : '');

			this.doc.getElementById('lbNavDisplay').style.display = (this.showNavigation && this.navType == 2 ? '' : 'none');

		} else {

			this.doc.getElementById('lbHoverNav').style.display = (this.navType == 1 && !this.isLyteframe ? '' : 'none');

			if ((this.navType == 2 && !this.isLyteframe && this.imageArray.length > 1) || (this.frameArray.length > 1 && this.isLyteframe)) {

				this.doc.getElementById('lbNavDisplay').style.display = '';

			} else {

				this.doc.getElementById('lbNavDisplay').style.display = 'none';

			}

			this.doc.getElementById('lbClose').style.display = '';

			this.doc.getElementById('lbDetails').style.display = '';

			this.doc.getElementById('lbPause').style.display = 'none';

			this.doc.getElementById('lbPlay').style.display = 'none';

		}

		this.doc.getElementById('lbImageContainer').style.display = (this.isLyteframe ? 'none' : '');

		this.doc.getElementById('lbIframeContainer').style.display = (this.isLyteframe ? '' : 'none');

		try {

			this.doc.getElementById('lbIframe').src = this.frameArray[this.activeFrame][0];

		} catch(e) { }

	} else {

		this.showContentTimerArray[this.showContentTimerCount++] = setTimeout("myLytebox.showContent()", 200);

	}

};

LyteBox.prototype.updateDetails = function() {

	var object = this.doc.getElementById('lbCaption');

	var sTitle = (this.isSlideshow ? this.slideArray[this.activeSlide][1] : (this.isLyteframe ? this.frameArray[this.activeFrame][1] : this.imageArray[this.activeImage][1]));

	object.style.display = '';

	object.innerHTML = (sTitle == null ? '' : sTitle);

	this.updateNav();

	this.doc.getElementById('lbDetailsContainer').style.display = '';

	object = this.doc.getElementById('lbNumberDisplay');

	if (this.isSlideshow && this.slideArray.length > 1) {

		object.style.display = '';

		object.innerHTML = "Image " + eval(this.activeSlide + 1) + " of " + this.slideArray.length;

		this.doc.getElementById('lbNavDisplay').style.display = (this.navType == 2 && this.showNavigation ? '' : 'none');

	} else if (this.imageArray.length > 1 && !this.isLyteframe) {

		object.style.display = '';

		object.innerHTML = "Image " + eval(this.activeImage + 1) + " of " + this.imageArray.length;

		this.doc.getElementById('lbNavDisplay').style.display = (this.navType == 2 ? '' : 'none');

	} else if (this.frameArray.length > 1 && this.isLyteframe) {

		object.style.display = '';

		object.innerHTML = "Page " + eval(this.activeFrame + 1) + " of " + this.frameArray.length;

		this.doc.getElementById('lbNavDisplay').style.display = '';

	} else {

		this.doc.getElementById('lbNavDisplay').style.display = 'none';

	}

	this.appear('lbDetailsContainer', (this.doAnimations ? 0 : 100));

};

LyteBox.prototype.updateNav = function() {

	if (this.isSlideshow) {

		if (this.activeSlide != 0) {

			var object = (this.navType == 2 ? this.doc.getElementById('lbPrev2') : this.doc.getElementById('lbPrev'));

				object.style.display = '';

				object.onclick = function() {

					if (myLytebox.pauseOnPrevClick) { myLytebox.togglePlayPause("lbPause", "lbPlay"); }

					myLytebox.changeContent(myLytebox.activeSlide - 1); return false;

				}

		} else {

			if (this.navType == 2) { this.doc.getElementById('lbPrev2_Off').style.display = ''; }

		}

		if (this.activeSlide != (this.slideArray.length - 1)) {

			var object = (this.navType == 2 ? this.doc.getElementById('lbNext2') : this.doc.getElementById('lbNext'));

				object.style.display = '';

				object.onclick = function() {

					if (myLytebox.pauseOnNextClick) { myLytebox.togglePlayPause("lbPause", "lbPlay"); }

					myLytebox.changeContent(myLytebox.activeSlide + 1); return false;

				}

		} else {

			if (this.navType == 2) { this.doc.getElementById('lbNext2_Off').style.display = ''; }

		}

	} else if (this.isLyteframe) {

		if(this.activeFrame != 0) {

			var object = this.doc.getElementById('lbPrev2');

				object.style.display = '';

				object.onclick = function() {

					myLytebox.changeContent(myLytebox.activeFrame - 1); return false;

				}

		} else {

			this.doc.getElementById('lbPrev2_Off').style.display = '';

		}

		if(this.activeFrame != (this.frameArray.length - 1)) {

			var object = this.doc.getElementById('lbNext2');

				object.style.display = '';

				object.onclick = function() {

					myLytebox.changeContent(myLytebox.activeFrame + 1); return false;

				}

		} else {

			this.doc.getElementById('lbNext2_Off').style.display = '';

		}		

	} else {

		if(this.activeImage != 0) {

			var object = (this.navType == 2 ? this.doc.getElementById('lbPrev2') : this.doc.getElementById('lbPrev'));

				object.style.display = '';

				object.onclick = function() {

					myLytebox.changeContent(myLytebox.activeImage - 1); return false;

				}

		} else {

			if (this.navType == 2) { this.doc.getElementById('lbPrev2_Off').style.display = ''; }

		}

		if(this.activeImage != (this.imageArray.length - 1)) {

			var object = (this.navType == 2 ? this.doc.getElementById('lbNext2') : this.doc.getElementById('lbNext'));

				object.style.display = '';

				object.onclick = function() {

					myLytebox.changeContent(myLytebox.activeImage + 1); return false;

				}

		} else {

			if (this.navType == 2) { this.doc.getElementById('lbNext2_Off').style.display = ''; }

		}

	}

	this.enableKeyboardNav();

};

LyteBox.prototype.enableKeyboardNav = function() { document.onkeydown = this.keyboardAction; };

LyteBox.prototype.disableKeyboardNav = function() { document.onkeydown = ''; };

LyteBox.prototype.keyboardAction = function(e) {

	var keycode = key = escape = null;

	keycode	= (e == null) ? event.keyCode : e.which;

	key		= String.fromCharCode(keycode).toLowerCase();

	escape  = (e == null) ? 27 : e.DOM_VK_ESCAPE;

	if ((key == 'x') || (key == 'c') || (keycode == escape)) {

		myLytebox.end();

	} else if ((key == 'p') || (keycode == 37)) {

		if (myLytebox.isSlideshow) {

			if(myLytebox.activeSlide != 0) {

				myLytebox.disableKeyboardNav();

				myLytebox.changeContent(myLytebox.activeSlide - 1);

			}

		} else if (myLytebox.isLyteframe) {

			if(myLytebox.activeFrame != 0) {

				myLytebox.disableKeyboardNav();

				myLytebox.changeContent(myLytebox.activeFrame - 1);

			}

		} else {

			if(myLytebox.activeImage != 0) {

				myLytebox.disableKeyboardNav();

				myLytebox.changeContent(myLytebox.activeImage - 1);

			}

		}

	} else if ((key == 'n') || (keycode == 39)) {

		if (myLytebox.isSlideshow) {

			if(myLytebox.activeSlide != (myLytebox.slideArray.length - 1)) {

				myLytebox.disableKeyboardNav();

				myLytebox.changeContent(myLytebox.activeSlide + 1);

			}

		} else if (myLytebox.isLyteframe) {

			if(myLytebox.activeFrame != (myLytebox.frameArray.length - 1)) {

				myLytebox.disableKeyboardNav();

				myLytebox.changeContent(myLytebox.activeFrame + 1);

			}

		} else {

			if(myLytebox.activeImage != (myLytebox.imageArray.length - 1)) {

				myLytebox.disableKeyboardNav();

				myLytebox.changeContent(myLytebox.activeImage + 1);

			}

		}

	}

};

LyteBox.prototype.preloadNeighborImages = function() {

	if (this.isSlideshow) {

		if ((this.slideArray.length - 1) > this.activeSlide) {

			preloadNextImage = new Image();

			preloadNextImage.src = this.slideArray[this.activeSlide + 1][0];

		}

		if(this.activeSlide > 0) {

			preloadPrevImage = new Image();

			preloadPrevImage.src = this.slideArray[this.activeSlide - 1][0];

		}

	} else {

		if ((this.imageArray.length - 1) > this.activeImage) {

			preloadNextImage = new Image();

			preloadNextImage.src = this.imageArray[this.activeImage + 1][0];

		}

		if(this.activeImage > 0) {

			preloadPrevImage = new Image();

			preloadPrevImage.src = this.imageArray[this.activeImage - 1][0];

		}

	}

};

LyteBox.prototype.togglePlayPause = function(hideID, showID) {

	if (this.isSlideshow && hideID == "lbPause") {

		for (var i = 0; i < this.slideshowIDCount; i++) { window.clearTimeout(this.slideshowIDArray[i]); }

	}

	this.doc.getElementById(hideID).style.display = 'none';

	this.doc.getElementById(showID).style.display = '';

	if (hideID == "lbPlay") {

		this.isPaused = false;

		if (this.activeSlide == (this.slideArray.length - 1)) {

			this.end();

		} else {

			this.changeContent(this.activeSlide + 1);

		}

	} else {

		this.isPaused = true;

	}

};

LyteBox.prototype.end = function(caller) {

	var closeClick = (caller == 'slideshow' ? false : true);

	if (this.isSlideshow && this.isPaused && !closeClick) { return; }

	this.disableKeyboardNav();

	this.doc.getElementById('lbMain').style.display = 'none';

	this.fade('lbOverlay', (this.doAnimations ? this.maxOpacity : 0));

	this.toggleSelects('visible');

	if (this.hideFlash) { this.toggleFlash('visible'); }

	if (this.isSlideshow) {

		for (var i = 0; i < this.slideshowIDCount; i++) { window.clearTimeout(this.slideshowIDArray[i]); }

	}

	if (this.isLyteframe) {

		 this.initialize();

	}

};

LyteBox.prototype.checkFrame = function() {

	if (window.parent.frames[window.name] && (parent.document.getElementsByTagName('frameset').length <= 0)) {

		this.isFrame = true;

		this.lytebox = "window.parent." + window.name + ".myLytebox";

		this.doc = parent.document;

	} else {

		this.isFrame = false;

		this.lytebox = "myLytebox";

		this.doc = document;

	}

};

LyteBox.prototype.getPixelRate = function(cur, img) {

	var diff = (img > cur) ? img - cur : cur - img;

	if (diff >= 0 && diff <= 100) { return 10; }

	if (diff > 100 && diff <= 200) { return 15; }

	if (diff > 200 && diff <= 300) { return 20; }

	if (diff > 300 && diff <= 400) { return 25; }

	if (diff > 400 && diff <= 500) { return 30; }

	if (diff > 500 && diff <= 600) { return 35; }

	if (diff > 600 && diff <= 700) { return 40; }

	if (diff > 700) { return 45; }

};

LyteBox.prototype.appear = function(id, opacity) {

	var object = this.doc.getElementById(id).style;

	object.opacity = (opacity / 100);

	object.MozOpacity = (opacity / 100);

	object.KhtmlOpacity = (opacity / 100);

	object.filter = "alpha(opacity=" + (opacity + 10) + ")";

	if (opacity == 100 && (id == 'lbImage' || id == 'lbIframe')) {

		try { object.removeAttribute("filter"); } catch(e) {}	/* Fix added for IE Alpha Opacity Filter bug. */

		this.updateDetails();

	} else if (opacity >= this.maxOpacity && id == 'lbOverlay') {

		for (var i = 0; i < this.overlayTimerCount; i++) { window.clearTimeout(this.overlayTimerArray[i]); }

		return;

	} else if (opacity >= 100 && id == 'lbDetailsContainer') {

		try { object.removeAttribute("filter"); } catch(e) {}	/* Fix added for IE Alpha Opacity Filter bug. */

		for (var i = 0; i < this.imageTimerCount; i++) { window.clearTimeout(this.imageTimerArray[i]); }

		this.doc.getElementById('lbOverlay').style.height = this.getPageSize()[1] + "px";

	} else {

		if (id == 'lbOverlay') {

			this.overlayTimerArray[this.overlayTimerCount++] = setTimeout("myLytebox.appear('" + id + "', " + (opacity+20) + ")", 1);

		} else {

			this.imageTimerArray[this.imageTimerCount++] = setTimeout("myLytebox.appear('" + id + "', " + (opacity+10) + ")", 1);

		}

	}

};

LyteBox.prototype.fade = function(id, opacity) {

	var object = this.doc.getElementById(id).style;

	object.opacity = (opacity / 100);

	object.MozOpacity = (opacity / 100);

	object.KhtmlOpacity = (opacity / 100);

	object.filter = "alpha(opacity=" + opacity + ")";

	if (opacity <= 0) {

		try {

			object.display = 'none';

		} catch(err) { }

	} else if (id == 'lbOverlay') {

		this.overlayTimerArray[this.overlayTimerCount++] = setTimeout("myLytebox.fade('" + id + "', " + (opacity-20) + ")", 1);

	} else {

		this.timerIDArray[this.timerIDCount++] = setTimeout("myLytebox.fade('" + id + "', " + (opacity-10) + ")", 1);

	}

};

LyteBox.prototype.resizeW = function(id, curW, maxW, pixelrate, speed) {

	if (!this.hDone) {

		this.resizeWTimerArray[this.resizeWTimerCount++] = setTimeout("myLytebox.resizeW('" + id + "', " + curW + ", " + maxW + ", " + pixelrate + ")", 100);

		return;

	}

	var object = this.doc.getElementById(id);

	var timer = speed ? speed : (this.resizeDuration/2);

	var newW = (this.doAnimations ? curW : maxW);

	object.style.width = (newW) + "px";

	if (newW < maxW) {

		newW += (newW + pixelrate >= maxW) ? (maxW - newW) : pixelrate;

	} else if (newW > maxW) {

		newW -= (newW - pixelrate <= maxW) ? (newW - maxW) : pixelrate;

	}

	this.resizeWTimerArray[this.resizeWTimerCount++] = setTimeout("myLytebox.resizeW('" + id + "', " + newW + ", " + maxW + ", " + pixelrate + ", " + (timer+0.02) + ")", timer+0.02);

	if (parseInt(object.style.width) == maxW) {

		this.wDone = true;

		for (var i = 0; i < this.resizeWTimerCount; i++) { window.clearTimeout(this.resizeWTimerArray[i]); }

	}

};

LyteBox.prototype.resizeH = function(id, curH, maxH, pixelrate, speed) {

	var timer = speed ? speed : (this.resizeDuration/2);

	var object = this.doc.getElementById(id);

	var newH = (this.doAnimations ? curH : maxH);

	object.style.height = (newH) + "px";

	if (newH < maxH) {

		newH += (newH + pixelrate >= maxH) ? (maxH - newH) : pixelrate;

	} else if (newH > maxH) {

		newH -= (newH - pixelrate <= maxH) ? (newH - maxH) : pixelrate;

	}

	this.resizeHTimerArray[this.resizeHTimerCount++] = setTimeout("myLytebox.resizeH('" + id + "', " + newH + ", " + maxH + ", " + pixelrate + ", " + (timer+.02) + ")", timer+.02);

	if (parseInt(object.style.height) == maxH) {

		this.hDone = true;

		for (var i = 0; i < this.resizeHTimerCount; i++) { window.clearTimeout(this.resizeHTimerArray[i]); }

	}

};

LyteBox.prototype.getPageScroll = function() {

	if (self.pageYOffset) {

		return this.isFrame ? parent.pageYOffset : self.pageYOffset;

	} else if (this.doc.documentElement && this.doc.documentElement.scrollTop){

		return this.doc.documentElement.scrollTop;

	} else if (document.body) {

		return this.doc.body.scrollTop;

	}

};

LyteBox.prototype.getPageSize = function() {	

	var xScroll, yScroll, windowWidth, windowHeight;

	if (window.innerHeight && window.scrollMaxY) {

		xScroll = this.doc.scrollWidth;

		yScroll = (this.isFrame ? parent.innerHeight : self.innerHeight) + (this.isFrame ? parent.scrollMaxY : self.scrollMaxY);

	} else if (this.doc.body.scrollHeight > this.doc.body.offsetHeight){

		xScroll = this.doc.body.scrollWidth;

		yScroll = this.doc.body.scrollHeight;

	} else {

		xScroll = this.doc.getElementsByTagName("html").item(0).offsetWidth;

		yScroll = this.doc.getElementsByTagName("html").item(0).offsetHeight;

		xScroll = (xScroll < this.doc.body.offsetWidth) ? this.doc.body.offsetWidth : xScroll;

		yScroll = (yScroll < this.doc.body.offsetHeight) ? this.doc.body.offsetHeight : yScroll;

	}

	if (self.innerHeight) {

		windowWidth = (this.isFrame) ? parent.innerWidth : self.innerWidth;

		windowHeight = (this.isFrame) ? parent.innerHeight : self.innerHeight;

	} else if (document.documentElement && document.documentElement.clientHeight) {

		windowWidth = this.doc.documentElement.clientWidth;

		windowHeight = this.doc.documentElement.clientHeight;

	} else if (document.body) {

		windowWidth = this.doc.getElementsByTagName("html").item(0).clientWidth;

		windowHeight = this.doc.getElementsByTagName("html").item(0).clientHeight;

		windowWidth = (windowWidth == 0) ? this.doc.body.clientWidth : windowWidth;

		windowHeight = (windowHeight == 0) ? this.doc.body.clientHeight : windowHeight;

	}

	var pageHeight = (yScroll < windowHeight) ? windowHeight : yScroll;

	var pageWidth = (xScroll < windowWidth) ? windowWidth : xScroll;

	return new Array(pageWidth, pageHeight, windowWidth, windowHeight);

};

LyteBox.prototype.toggleFlash = function(state) {

	var objects = this.doc.getElementsByTagName("object");

	for (var i = 0; i < objects.length; i++) {

		objects[i].style.visibility = (state == "hide") ? 'hidden' : 'visible';

	}

	var embeds = this.doc.getElementsByTagName("embed");

	for (var i = 0; i < embeds.length; i++) {

		embeds[i].style.visibility = (state == "hide") ? 'hidden' : 'visible';

	}

	if (this.isFrame) {

		for (var i = 0; i < parent.frames.length; i++) {

			try {

				objects = parent.frames[i].window.document.getElementsByTagName("object");

				for (var j = 0; j < objects.length; j++) {

					objects[j].style.visibility = (state == "hide") ? 'hidden' : 'visible';

				}

			} catch(e) { }

			try {

				embeds = parent.frames[i].window.document.getElementsByTagName("embed");

				for (var j = 0; j < embeds.length; j++) {

					embeds[j].style.visibility = (state == "hide") ? 'hidden' : 'visible';

				}

			} catch(e) { }

		}

	}

};

LyteBox.prototype.toggleSelects = function(state) {

	var selects = this.doc.getElementsByTagName("select");

	for (var i = 0; i < selects.length; i++ ) {

		selects[i].style.visibility = (state == "hide") ? 'hidden' : 'visible';

	}

	if (this.isFrame) {

		for (var i = 0; i < parent.frames.length; i++) {

			try {

				selects = parent.frames[i].window.document.getElementsByTagName("select");

				for (var j = 0; j < selects.length; j++) {

					selects[j].style.visibility = (state == "hide") ? 'hidden' : 'visible';

				}

			} catch(e) { }

		}

	}

};

LyteBox.prototype.pause = function(numberMillis) {

	var now = new Date();

	var exitTime = now.getTime() + numberMillis;

	while (true) {

		now = new Date();

		if (now.getTime() > exitTime) { return; }

	}

};



function initLytebox() { myLytebox = new LyteBox(); }



if (typeof(MooTools)!='undefined') {

	window.addEvent('domready', initLytebox);

} else {

	if (window.addEventListener) {

		window.addEventListener("load",initLytebox,false);

	} else if (window.attachEvent) {

		window.attachEvent("onload",initLytebox);

	} else {

		window.onload = function() {initLytebox();}

	}

}


