// My Java
/*
 Version: 1.2
 
 ----------
 
 Changelog:
 - TODO: xxx
 
 ----------
 
 Version 1.2
 
 - Lightbox style java: overlay.js, assets.js, multibox.js
 - +this.options.path+'flvplayer.swf -> /images/flvplayer.swf
 - +this.options.path+'mp3player.swf -> /images/mp3player.swf
 
 Version 1.1
 
 - Commented out the Stylesheet Selection for now (not being used)
 
 Version 1.0
 
 - Initial release
 */








// Stylesheet selection


/*
 function setActiveStyleSheet(title) {
 var i, a, main;
 for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
 if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
 a.disabled = true;
 if(a.getAttribute("title") == title) a.disabled = false;
 }
 }
 }
 
 function getActiveStyleSheet() {
 var i, a;
 for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
 if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
 }
 return null;
 }
 
 function getPreferredStyleSheet() {
 var i, a;
 for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
 if(a.getAttribute("rel").indexOf("style") != -1
 && a.getAttribute("rel").indexOf("alt") == -1
 && a.getAttribute("title")
 ) return a.getAttribute("title");
 }
 return null;
 }
 
 function createCookie(name,value,days) {
 if (days) {
 var date = new Date();
 date.setTime(date.getTime()+(days*24*60*60*1000));
 var expires = "; expires="+date.toGMTString();
 }
 else expires = "";
 document.cookie = name+"="+value+expires+"; path=/";
 }
 
 function readCookie(name) {
 var nameEQ = name + "=";
 var ca = document.cookie.split(';');
 for(var i=0;i < ca.length;i++) {
 var c = ca[i];
 while (c.charAt(0)==' ') c = c.substring(1,c.length);
 if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
 }
 return null;
 }
 
 window.onload = function(e) {
 var cookie = readCookie("style");
 var title = cookie ? cookie : getPreferredStyleSheet();
 setActiveStyleSheet(title);
 }
 
 window.onunload = function(e) {
 var title = getActiveStyleSheet();
 createCookie("style", title, 365);
 }
 
 var cookie = readCookie("style");
 var title = cookie ? cookie : getPreferredStyleSheet();
 setActiveStyleSheet(title);
 */







//** Featured Content Slider script- (c) Dynamic Drive DHTML code library: http://www.dynamicdrive.com.
//** May 2nd, 08'- Script rewritten and updated to 2.0.
//** June 12th, 08'- Script updated to v 2.3, which adds the following features:
//1) Changed behavior of script to actually collapse the previous content when the active one is shown, instead of just tucking it underneath the later.
//2) Added setting to reveal a content either via "click" or "mouseover" of pagination links (default is former).
//3) Added public function for jumping to a particular slide within a Featured Content instance using an arbitrary link, for example.

//** July 11th, 08'- Script updated to v 2.4:
//1) Added ability to select a particular slide when the page first loads using a URL parameter (ie: mypage.htm?myslider=4 to select 4th slide in "myslider")
//2) Fixed bug where the first slide disappears when the mouse clicks or mouses over it when page first loads.

var featuredcontentslider={
	
	//3 variables below you can customize if desired:
ajaxloadingmsg: '<div style="margin: 20px 0 0 20px"><img src="loading.gif" /> Fetching slider Contents. Please wait...</div>',
bustajaxcache: true, //bust caching of external ajax page after 1st request?
enablepersist: true, //persist to last content viewed when returning to page?
	
settingcaches: {}, //object to cache "setting" object of each script instance
	
jumpTo:function(fcsid, pagenumber){ //public function to go to a slide manually.
	this.turnpage(this.settingcaches[fcsid], pagenumber)
},
	
ajaxconnect:function(setting){
	var page_request = false
	if (window.ActiveXObject){ //Test for support for ActiveXObject in IE first (as XMLHttpRequest in IE7 is broken)
		try {
			page_request = new ActiveXObject("Msxml2.XMLHTTP")
		} 
		catch (e){
			try{
				page_request = new ActiveXObject("Microsoft.XMLHTTP")
			}
			catch (e){}
		}
	}
	else if (window.XMLHttpRequest) // if Mozilla, Safari etc
		page_request = new XMLHttpRequest()
		else
			return false
			var pageurl=setting.contentsource[1]
			page_request.onreadystatechange=function(){
				featuredcontentslider.ajaxpopulate(page_request, setting)
			}
			document.getElementById(setting.id).innerHTML=this.ajaxloadingmsg
			var bustcache=(!this.bustajaxcache)? "" : (pageurl.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()
			page_request.open('GET', pageurl+bustcache, true)
			page_request.send(null)
			},
	
ajaxpopulate:function(page_request, setting){
	if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1)){
		document.getElementById(setting.id).innerHTML=page_request.responseText
		this.buildpaginate(setting)
	}
},
	
buildcontentdivs:function(setting){
	var alldivs=document.getElementById(setting.id).getElementsByTagName("div")
	for (var i=0; i<alldivs.length; i++){
		if (this.css(alldivs[i], "contentdiv", "check")){ //check for DIVs with class "contentdiv"
			setting.contentdivs.push(alldivs[i])
			alldivs[i].style.display="none" //collapse all content DIVs to begin with
		}
	}
},
	
buildpaginate:function(setting){
	this.buildcontentdivs(setting)
	var sliderdiv=document.getElementById(setting.id)
	var pdiv=document.getElementById("paginate-"+setting.id)
	var phtml=""
	var toc=setting.toc
	var nextprev=setting.nextprev
	if (typeof toc=="string" && toc!="markup" || typeof toc=="object"){
		for (var i=1; i<=setting.contentdivs.length; i++){
			phtml+='<a href="#'+i+'" class="toc">'+(typeof toc=="string"? toc.replace(/#increment/, i) : toc[i-1])+'</a> '
		}
		phtml=(nextprev[0]!=''? '<a href="#prev" class="prev">'+nextprev[0]+'</a> ' : '') + phtml + (nextprev[1]!=''? '<a href="#next" class="next">'+nextprev[1]+'</a>' : '')
		pdiv.innerHTML=phtml
	}
	var pdivlinks=pdiv.getElementsByTagName("a")
	var toclinkscount=0 //var to keep track of actual # of toc links
	for (var i=0; i<pdivlinks.length; i++){
		if (this.css(pdivlinks[i], "toc", "check")){
			if (toclinkscount>setting.contentdivs.length-1){ //if this toc link is out of range (user defined more toc links then there are contents)
				pdivlinks[i].style.display="none" //hide this toc link
				continue
			}
			pdivlinks[i].setAttribute("rel", ++toclinkscount) //store page number inside toc link
			pdivlinks[i][setting.revealtype]=function(){
				featuredcontentslider.turnpage(setting, this.getAttribute("rel"))
				return false
			}
			setting.toclinks.push(pdivlinks[i])
		}
		else if (this.css(pdivlinks[i], "prev", "check") || this.css(pdivlinks[i], "next", "check")){ //check for links with class "prev" or "next"
			pdivlinks[i].onclick=function(){
				featuredcontentslider.turnpage(setting, this.className)
				return false
			}
		}
	}
	this.turnpage(setting, setting.currentpage, true)
	if (setting.autorotate[0]){ //if auto rotate enabled
		pdiv[setting.revealtype]=function(){
			featuredcontentslider.cleartimer(setting, window["fcsautorun"+setting.id])
		}
		sliderdiv["onclick"]=function(){ //stop content slider when slides themselves are clicked on
			featuredcontentslider.cleartimer(setting, window["fcsautorun"+setting.id])
		}
		setting.autorotate[1]=setting.autorotate[1]+(1/setting.enablefade[1]*50) //add time to run fade animation (roughly) to delay between rotation
		this.autorotate(setting)
	}
},
	
urlparamselect:function(fcsid){
	var result=window.location.search.match(new RegExp(fcsid+"=(\\d+)", "i")) //check for "?featuredcontentsliderid=2" in URL
	return (result==null)? null : parseInt(RegExp.$1) //returns null or index, where index (int) is the selected tab's index
},
	
turnpage:function(setting, thepage, autocall){
	var currentpage=setting.currentpage //current page # before change
	var totalpages=setting.contentdivs.length
	var turntopage=(/prev/i.test(thepage))? currentpage-1 : (/next/i.test(thepage))? currentpage+1 : parseInt(thepage)
	turntopage=(turntopage<1)? totalpages : (turntopage>totalpages)? 1 : turntopage //test for out of bound and adjust
	if (turntopage==setting.currentpage && typeof autocall=="undefined") //if a pagination link is clicked on repeatedly
		return
		setting.currentpage=turntopage
		setting.contentdivs[turntopage-1].style.zIndex=++setting.topzindex
		this.cleartimer(setting, window["fcsfade"+setting.id])
		setting.cacheprevpage=setting.prevpage
		if (setting.enablefade[0]==true){
			setting.curopacity=0
			this.fadeup(setting)
		}
	if (setting.enablefade[0]==false){ //if fade is disabled, fire onChange event immediately (verus after fade is complete)
		setting.contentdivs[setting.prevpage-1].style.display="none" //collapse last content div shown (it was set to "block")
		setting.onChange(setting.prevpage, setting.currentpage)
	}
	setting.contentdivs[turntopage-1].style.visibility="visible"
	setting.contentdivs[turntopage-1].style.display="block"
	if (setting.prevpage<=setting.toclinks.length) //make sure pagination link exists (may not if manually defined via "markup", and user omitted)
		this.css(setting.toclinks[setting.prevpage-1], "selected", "remove")
		if (turntopage<=setting.toclinks.length) //make sure pagination link exists (may not if manually defined via "markup", and user omitted)
			this.css(setting.toclinks[turntopage-1], "selected", "add")
			setting.prevpage=turntopage
			if (this.enablepersist)
				this.setCookie("fcspersist"+setting.id, turntopage)
				},
	
setopacity:function(setting, value){ //Sets the opacity of targetobject based on the passed in value setting (0 to 1 and in between)
	var targetobject=setting.contentdivs[setting.currentpage-1]
	if (targetobject.filters && targetobject.filters[0]){ //IE syntax
		if (typeof targetobject.filters[0].opacity=="number") //IE6
			targetobject.filters[0].opacity=value*100
			else //IE 5.5
				targetobject.style.filter="alpha(opacity="+value*100+")"
				}
	else if (typeof targetobject.style.MozOpacity!="undefined") //Old Mozilla syntax
		targetobject.style.MozOpacity=value
		else if (typeof targetobject.style.opacity!="undefined") //Standard opacity syntax
			targetobject.style.opacity=value
			setting.curopacity=value
			},
	
fadeup:function(setting){
	if (setting.curopacity<1){
		this.setopacity(setting, setting.curopacity+setting.enablefade[1])
		window["fcsfade"+setting.id]=setTimeout(function(){featuredcontentslider.fadeup(setting)}, 50)
	}
	else{ //when fade is complete
		if (setting.cacheprevpage!=setting.currentpage) //if previous content isn't the same as the current shown div (happens the first time the page loads/ script is run)
			setting.contentdivs[setting.cacheprevpage-1].style.display="none" //collapse last content div shown (it was set to "block")
			setting.onChange(setting.cacheprevpage, setting.currentpage)
			}
},
	
cleartimer:function(setting, timervar){
	if (typeof timervar!="undefined"){
		clearTimeout(timervar)
		clearInterval(timervar)
		if (setting.cacheprevpage!=setting.currentpage){ //if previous content isn't the same as the current shown div
			setting.contentdivs[setting.cacheprevpage-1].style.display="none"
		}
	}
},
	
css:function(el, targetclass, action){
	var needle=new RegExp("(^|\\s+)"+targetclass+"($|\\s+)", "ig")
	if (action=="check")
		return needle.test(el.className)
		else if (action=="remove")
			el.className=el.className.replace(needle, "")
			else if (action=="add")
				el.className+=" "+targetclass
				},
	
autorotate:function(setting){
	window["fcsautorun"+setting.id]=setInterval(function(){featuredcontentslider.turnpage(setting, "next")}, setting.autorotate[1])
},
	
getCookie:function(Name){ 
	var re=new RegExp(Name+"=[^;]+", "i"); //construct RE to search for target name/value pair
	if (document.cookie.match(re)) //if cookie found
		return document.cookie.match(re)[0].split("=")[1] //return its value
		return null
		},
	
setCookie:function(name, value){
	document.cookie = name+"="+value
	
},
	
	
init:function(setting){
	var persistedpage=this.getCookie("fcspersist"+setting.id) || 1
	var urlselectedpage=this.urlparamselect(setting.id) //returns null or index from: mypage.htm?featuredcontentsliderid=index
	this.settingcaches[setting.id]=setting //cache "setting" object
	setting.contentdivs=[]
	setting.toclinks=[]
	setting.topzindex=0
	setting.currentpage=urlselectedpage || ((this.enablepersist)? persistedpage : 1)
	setting.prevpage=setting.currentpage
	setting.revealtype="on"+(setting.revealtype || "click")
	setting.curopacity=0
	setting.onChange=setting.onChange || function(){}
	if (setting.contentsource[0]=="inline")
		this.buildpaginate(setting)
		if (setting.contentsource[0]=="ajax")
			this.ajaxconnect(setting)
			}
	
}






//** Tab Content script v2.0- © Dynamic Drive DHTML code library (http://www.dynamicdrive.com)
//** Updated Oct 7th, 07 to version 2.0. Contains numerous improvements:
//   -Added Auto Mode: Script auto rotates the tabs based on an interval, until a tab is explicitly selected
//   -Ability to expand/contract arbitrary DIVs on the page as the tabbed content is expanded/ contracted
//   -Ability to dynamically select a tab either based on its position within its peers, or its ID attribute (give the target tab one 1st)
//   -Ability to set where the CSS classname "selected" get assigned- either to the target tab's link ("A"), or its parent container
//** Updated Feb 18th, 08 to version 2.1: Adds a "tabinstance.cycleit(dir)" method to cycle forward or backward between tabs dynamically
//** Updated April 8th, 08 to version 2.2: Adds support for expanding a tab using a URL parameter (ie: http://mysite.com/tabcontent.htm?tabinterfaceid=0) 

////NO NEED TO EDIT BELOW////////////////////////

function ddtabcontent(tabinterfaceid){
	this.tabinterfaceid=tabinterfaceid //ID of Tab Menu main container
	this.tabs=document.getElementById(tabinterfaceid).getElementsByTagName("a") //Get all tab links within container
	this.enabletabpersistence=true
	this.hottabspositions=[] //Array to store position of tabs that have a "rel" attr defined, relative to all tab links, within container
	this.currentTabIndex=0 //Index of currently selected hot tab (tab with sub content) within hottabspositions[] array
	this.subcontentids=[] //Array to store ids of the sub contents ("rel" attr values)
	this.revcontentids=[] //Array to store ids of arbitrary contents to expand/contact as well ("rev" attr values)
	this.selectedClassTarget="link" //keyword to indicate which target element to assign "selected" CSS class ("linkparent" or "link")
}

ddtabcontent.getCookie=function(Name){ 
	var re=new RegExp(Name+"=[^;]+", "i"); //construct RE to search for target name/value pair
	if (document.cookie.match(re)) //if cookie found
		return document.cookie.match(re)[0].split("=")[1] //return its value
		return ""
		}

ddtabcontent.setCookie=function(name, value){
	document.cookie = name+"="+value+";path=/" //cookie value is domain wide (path=/)
}

ddtabcontent.prototype={
	
expandit:function(tabid_or_position){ //PUBLIC function to select a tab either by its ID or position(int) within its peers
	this.cancelautorun() //stop auto cycling of tabs (if running)
	var tabref=""
	try{
		if (typeof tabid_or_position=="string" && document.getElementById(tabid_or_position).getAttribute("rel")) //if specified tab contains "rel" attr
			tabref=document.getElementById(tabid_or_position)
			else if (parseInt(tabid_or_position)!=NaN && this.tabs[tabid_or_position].getAttribute("rel")) //if specified tab contains "rel" attr
				tabref=this.tabs[tabid_or_position]
				}
	catch(err){alert("Invalid Tab ID or position entered!")}
	if (tabref!="") //if a valid tab is found based on function parameter
		this.expandtab(tabref) //expand this tab
		},
	
cycleit:function(dir, autorun){ //PUBLIC function to move foward or backwards through each hot tab (tabinstance.cycleit('foward/back') )
	if (dir=="next"){
		var currentTabIndex=(this.currentTabIndex<this.hottabspositions.length-1)? this.currentTabIndex+1 : 0
	}
	else if (dir=="prev"){
		var currentTabIndex=(this.currentTabIndex>0)? this.currentTabIndex-1 : this.hottabspositions.length-1
	}
	if (typeof autorun=="undefined") //if cycleit() is being called by user, versus autorun() function
		this.cancelautorun() //stop auto cycling of tabs (if running)
		this.expandtab(this.tabs[this.hottabspositions[currentTabIndex]])
		},
	
setpersist:function(bool){ //PUBLIC function to toggle persistence feature
	this.enabletabpersistence=bool
},
	
setselectedClassTarget:function(objstr){ //PUBLIC function to set which target element to assign "selected" CSS class ("linkparent" or "link")
	this.selectedClassTarget=objstr || "link"
},
	
getselectedClassTarget:function(tabref){ //Returns target element to assign "selected" CSS class to
	return (this.selectedClassTarget==("linkparent".toLowerCase()))? tabref.parentNode : tabref
},
	
urlparamselect:function(tabinterfaceid){
	var result=window.location.search.match(new RegExp(tabinterfaceid+"=(\\d+)", "i")) //check for "?tabinterfaceid=2" in URL
	return (result==null)? null : parseInt(RegExp.$1) //returns null or index, where index (int) is the selected tab's index
},
	
expandtab:function(tabref){
	var subcontentid=tabref.getAttribute("rel") //Get id of subcontent to expand
	//Get "rev" attr as a string of IDs in the format ",john,george,trey,etc," to easily search through
	var associatedrevids=(tabref.getAttribute("rev"))? ","+tabref.getAttribute("rev").replace(/\s+/, "")+"," : ""
	this.expandsubcontent(subcontentid)
	this.expandrevcontent(associatedrevids)
	for (var i=0; i<this.tabs.length; i++){ //Loop through all tabs, and assign only the selected tab the CSS class "selected"
		this.getselectedClassTarget(this.tabs[i]).className=(this.tabs[i].getAttribute("rel")==subcontentid)? "selected" : ""
	}
	if (this.enabletabpersistence) //if persistence enabled, save selected tab position(int) relative to its peers
		ddtabcontent.setCookie(this.tabinterfaceid, tabref.tabposition)
		this.setcurrenttabindex(tabref.tabposition) //remember position of selected tab within hottabspositions[] array
		},
	
expandsubcontent:function(subcontentid){
	for (var i=0; i<this.subcontentids.length; i++){
		var subcontent=document.getElementById(this.subcontentids[i]) //cache current subcontent obj (in for loop)
		subcontent.style.display=(subcontent.id==subcontentid)? "block" : "none" //"show" or hide sub content based on matching id attr value
	}
},
	
expandrevcontent:function(associatedrevids){
	var allrevids=this.revcontentids
	for (var i=0; i<allrevids.length; i++){ //Loop through rev attributes for all tabs in this tab interface
		//if any values stored within associatedrevids matches one within allrevids, expand that DIV, otherwise, contract it
		document.getElementById(allrevids[i]).style.display=(associatedrevids.indexOf(","+allrevids[i]+",")!=-1)? "block" : "none"
	}
},
	
setcurrenttabindex:function(tabposition){ //store current position of tab (within hottabspositions[] array)
	for (var i=0; i<this.hottabspositions.length; i++){
		if (tabposition==this.hottabspositions[i]){
			this.currentTabIndex=i
			break
		}
	}
},
	
autorun:function(){ //function to auto cycle through and select tabs based on a set interval
	this.cycleit('next', true)
},
	
cancelautorun:function(){
	if (typeof this.autoruntimer!="undefined")
		clearInterval(this.autoruntimer)
		},
	
init:function(automodeperiod){
	var persistedtab=ddtabcontent.getCookie(this.tabinterfaceid) //get position of persisted tab (applicable if persistence is enabled)
	var selectedtab=-1 //Currently selected tab index (-1 meaning none)
	var selectedtabfromurl=this.urlparamselect(this.tabinterfaceid) //returns null or index from: tabcontent.htm?tabinterfaceid=index
	this.automodeperiod=automodeperiod || 0
	for (var i=0; i<this.tabs.length; i++){
		this.tabs[i].tabposition=i //remember position of tab relative to its peers
		if (this.tabs[i].getAttribute("rel")){
			var tabinstance=this
			this.hottabspositions[this.hottabspositions.length]=i //store position of "hot" tab ("rel" attr defined) relative to its peers
			this.subcontentids[this.subcontentids.length]=this.tabs[i].getAttribute("rel") //store id of sub content ("rel" attr value)
			this.tabs[i].onclick=function(){
				tabinstance.expandtab(this)
				tabinstance.cancelautorun() //stop auto cycling of tabs (if running)
				return false
			}
			if (this.tabs[i].getAttribute("rev")){ //if "rev" attr defined, store each value within "rev" as an array element
				this.revcontentids=this.revcontentids.concat(this.tabs[i].getAttribute("rev").split(/\s*,\s*/))
			}
			if (selectedtabfromurl==i || this.enabletabpersistence && selectedtab==-1 && parseInt(persistedtab)==i || !this.enabletabpersistence && selectedtab==-1 && this.getselectedClassTarget(this.tabs[i]).className=="selected"){
				selectedtab=i //Selected tab index, if found
			}
		}
	} //END for loop
	if (selectedtab!=-1) //if a valid default selected tab index is found
		this.expandtab(this.tabs[selectedtab]) //expand selected tab (either from URL parameter, persistent feature, or class="selected" class)
		else //if no valid default selected index found
			this.expandtab(this.tabs[this.hottabspositions[0]]) //Just select first tab that contains a "rel" attr
			if (parseInt(this.automodeperiod)>500 && this.hottabspositions.length>1){
				this.autoruntimer=setInterval(function(){tabinstance.autorun()}, this.automodeperiod)
			}
} //END int() function
	
} //END Prototype assignment









// http://www.html.it/articoli/niftycube/index.html
/* Nifty Corners Cube - rounded corners with CSS and Javascript
 Copyright 2006 Alessandro Fulciniti (a.fulciniti@html.it)
 
 This program 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 2 of the License, or
 (at your option) any later version.
 
 This program 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 this program; if not, write to the Free Software
 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */

var niftyOk=(document.getElementById && document.createElement && Array.prototype.push);
var niftyCss=false;

String.prototype.find=function(what){
	return(this.indexOf(what)>=0 ? true : false);
}

var oldonload=window.onload;
if(typeof(NiftyLoad)!='function') NiftyLoad=function(){};
if(typeof(oldonload)=='function')
window.onload=function(){oldonload();AddCss();NiftyLoad()};
else window.onload=function(){AddCss();NiftyLoad()};

function AddCss(){
	niftyCss=true;
	var l=CreateEl("link");
	l.setAttribute("type","text/css");
	l.setAttribute("rel","stylesheet");
	l.setAttribute("href","niftyCorners.css");
	l.setAttribute("media","screen");
	document.getElementsByTagName("head")[0].appendChild(l);
}

function Nifty(selector,options){
	if(niftyOk==false) return;
	if(niftyCss==false) AddCss();
	var i,v=selector.split(","),h=0;
	if(options==null) options="";
	if(options.find("fixed-height"))
		h=getElementsBySelector(v[0])[0].offsetHeight;
	for(i=0;i<v.length;i++)
		Rounded(v[i],options);
	if(options.find("height")) SameHeight(selector,h);
}

function Rounded(selector,options){
	var i,top="",bottom="",v=new Array();
	if(options!=""){
		options=options.replace("left","tl bl");
		options=options.replace("right","tr br");
		options=options.replace("top","tr tl");
		options=options.replace("bottom","br bl");
		options=options.replace("transparent","alias");
		if(options.find("tl")){
			top="both";
			if(!options.find("tr")) top="left";
        }
		else if(options.find("tr")) top="right";
		if(options.find("bl")){
			bottom="both";
			if(!options.find("br")) bottom="left";
        }
		else if(options.find("br")) bottom="right";
    }
	if(top=="" && bottom=="" && !options.find("none")){top="both";bottom="both";}
	v=getElementsBySelector(selector);
	for(i=0;i<v.length;i++){
		FixIE(v[i]);
		if(top!="") AddTop(v[i],top,options);
		if(bottom!="") AddBottom(v[i],bottom,options);
    }
}

function AddTop(el,side,options){
	var d=CreateEl("b"),lim=4,border="",p,i,btype="r",bk,color;
	d.style.marginLeft="-"+getPadding(el,"Left")+"px";
	d.style.marginRight="-"+getPadding(el,"Right")+"px";
	if(options.find("alias") || (color=getBk(el))=="transparent"){
		color="transparent";bk="transparent"; border=getParentBk(el);btype="t";
    }
	else{
		bk=getParentBk(el); border=Mix(color,bk);
    }
	d.style.background=bk;
	d.className="niftycorners";
	p=getPadding(el,"Top");
	if(options.find("small")){
		d.style.marginBottom=(p-2)+"px";
		btype+="s"; lim=2;
    }
	else if(options.find("big")){
		d.style.marginBottom=(p-10)+"px";
		btype+="b"; lim=8;
    }
	else d.style.marginBottom=(p-5)+"px";
	for(i=1;i<=lim;i++)
		d.appendChild(CreateStrip(i,side,color,border,btype));
	el.style.paddingTop="0";
	el.insertBefore(d,el.firstChild);
}

function AddBottom(el,side,options){
	var d=CreateEl("b"),lim=4,border="",p,i,btype="r",bk,color;
	d.style.marginLeft="-"+getPadding(el,"Left")+"px";
	d.style.marginRight="-"+getPadding(el,"Right")+"px";
	if(options.find("alias") || (color=getBk(el))=="transparent"){
		color="transparent";bk="transparent"; border=getParentBk(el);btype="t";
    }
	else{
		bk=getParentBk(el); border=Mix(color,bk);
    }
	d.style.background=bk;
	d.className="niftycorners";
	p=getPadding(el,"Bottom");
	if(options.find("small")){
		d.style.marginTop=(p-2)+"px";
		btype+="s"; lim=2;
    }
	else if(options.find("big")){
		d.style.marginTop=(p-10)+"px";
		btype+="b"; lim=8;
    }
	else d.style.marginTop=(p-5)+"px";
	for(i=lim;i>0;i--)
		d.appendChild(CreateStrip(i,side,color,border,btype));
	el.style.paddingBottom=0;
	el.appendChild(d);
}

function CreateStrip(index,side,color,border,btype){
	var x=CreateEl("b");
	x.className=btype+index;
	x.style.backgroundColor=color;
	x.style.borderColor=border;
	if(side=="left"){
		x.style.borderRightWidth="0";
		x.style.marginRight="0";
    }
	else if(side=="right"){
		x.style.borderLeftWidth="0";
		x.style.marginLeft="0";
    }
	return(x);
}

function CreateEl(x){
	return(document.createElement(x));
}

function FixIE(el){
	if(el.currentStyle!=null && el.currentStyle.hasLayout!=null && el.currentStyle.hasLayout==false)
		el.style.display="inline-block";
}

function SameHeight(selector,maxh){
	var i,v=selector.split(","),t,j,els=[],gap;
	for(i=0;i<v.length;i++){
		t=getElementsBySelector(v[i]);
		els=els.concat(t);
    }
	for(i=0;i<els.length;i++){
		if(els[i].offsetHeight>maxh) maxh=els[i].offsetHeight;
		els[i].style.height="auto";
    }
	for(i=0;i<els.length;i++){
		gap=maxh-els[i].offsetHeight;
		if(gap>0){
			t=CreateEl("b");t.className="niftyfill";t.style.height=gap+"px";
			nc=els[i].lastChild;
			if(nc.className=="niftycorners")
				els[i].insertBefore(t,nc);
			else els[i].appendChild(t);
        }
    }
}

function getElementsBySelector(selector){
	var i,j,selid="",selclass="",tag=selector,tag2="",v2,k,f,a,s=[],objlist=[],c;
	if(selector.find("#")){ //id selector like "tag#id"
		if(selector.find(" ")){  //descendant selector like "tag#id tag"
			s=selector.split(" ");
			var fs=s[0].split("#");
			if(fs.length==1) return(objlist);
			f=document.getElementById(fs[1]);
			if(f){
				v=f.getElementsByTagName(s[1]);
				for(i=0;i<v.length;i++) objlist.push(v[i]);
            }
			return(objlist);
        }
		else{
			s=selector.split("#");
			tag=s[0];
			selid=s[1];
			if(selid!=""){
				f=document.getElementById(selid);
				if(f) objlist.push(f);
				return(objlist);
            }
        }
    }
	if(selector.find(".")){      //class selector like "tag.class"
		s=selector.split(".");
		tag=s[0];
		selclass=s[1];
		if(selclass.find(" ")){   //descendant selector like tag1.classname tag2
			s=selclass.split(" ");
			selclass=s[0];
			tag2=s[1];
        }
    }
	var v=document.getElementsByTagName(tag);  // tag selector like "tag"
	if(selclass==""){
		for(i=0;i<v.length;i++) objlist.push(v[i]);
		return(objlist);
    }
	for(i=0;i<v.length;i++){
		c=v[i].className.split(" ");
		for(j=0;j<c.length;j++){
			if(c[j]==selclass){
				if(tag2=="") objlist.push(v[i]);
				else{
					v2=v[i].getElementsByTagName(tag2);
					for(k=0;k<v2.length;k++) objlist.push(v2[k]);
                }
            }
        }
    }
	return(objlist);
}

function getParentBk(x){
	var el=x.parentNode,c;
	while(el.tagName.toUpperCase()!="HTML" && (c=getBk(el))=="transparent")
		el=el.parentNode;
	if(c=="transparent") c="#FFFFFF";
	return(c);
}

function getBk(x){
	var c=getStyleProp(x,"backgroundColor");
	if(c==null || c=="transparent" || c.find("rgba(0, 0, 0, 0)"))
		return("transparent");
	if(c.find("rgb")) c=rgb2hex(c);
	return(c);
}

function getPadding(x,side){
	var p=getStyleProp(x,"padding"+side);
	if(p==null || !p.find("px")) return(0);
	return(parseInt(p));
}

function getStyleProp(x,prop){
	if(x.currentStyle)
		return(x.currentStyle[prop]);
	if(document.defaultView.getComputedStyle)
		return(document.defaultView.getComputedStyle(x,'')[prop]);
	return(null);
}

function rgb2hex(value){
	var hex="",v,h,i;
	var regexp=/([0-9]+)[, ]+([0-9]+)[, ]+([0-9]+)/;
	var h=regexp.exec(value);
	for(i=1;i<4;i++){
		v=parseInt(h[i]).toString(16);
		if(v.length==1) hex+="0"+v;
		else hex+=v;
    }
	return("#"+hex);
}

function Mix(c1,c2){
	var i,step1,step2,x,y,r=new Array(3);
	if(c1.length==4)step1=1;
	else step1=2;
	if(c2.length==4) step2=1;
	else step2=2;
	for(i=0;i<3;i++){
		x=parseInt(c1.substr(1+step1*i,step1),16);
		if(step1==1) x=16*x+x;
		y=parseInt(c2.substr(1+step2*i,step2),16);
		if(step2==1) y=16*y+y;
		r[i]=Math.floor((x*50+y*50)/100);
		r[i]=r[i].toString(16);
		if(r[i].length==1) r[i]="0"+r[i];
    }
	return("#"+r[0]+r[1]+r[2]);
}













// Lightbox javascript files


/**************************************************************
 
 Script		: overlay
 Version		: 1.2
 Authors		: Samuel birch
 Desc		: Covers the window with a semi-transparent layer.
 Licence		: Open Source MIT Licence
 
 **************************************************************/

var overlay = new Class({
						
						getOptions: function(){
						return {
						colour: '#000',
						opacity: 0.7,
						zIndex: 1,
						container: document.body,
						_onClick: $empty
						};
						},
						
						initialize: function(options){
						this.setOptions(this.getOptions(), options);
						
						this.options.container = $(this.options.container);
						
						this.container = new Element('div').setProperty('id', 'OverlayContainer').setStyles({
																											position: 'absolute',
																											left: '0px',
																											top: '0px',
																											width: '100%',
																											zIndex: this.options.zIndex
																											}).injectInside(this.options.container);
						
						this.iframe = new Element('iframe').setProperties({
																		  'id': 'OverlayIframe',
																		  'name': 'OverlayIframe',
																		  'src': 'javascript:void(0);',
																		  'frameborder': 0,
																		  'scrolling': 'no'
																		  }).setStyles({
																					   'position': 'absolute',
																					   'top': 0,
																					   'left': 0,
																					   'width': '100%',
																					   'height': '100%',
																					   'filter': 'progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)',
																					   'opacity': 0,
																					   'zIndex': 1
																					   }).injectInside(this.container);
						
						this.overlay = new Element('div').setProperty('id', 'Overlay').setStyles({
																								 position: 'absolute',
																								 left: '0px',
																								 top: '0px',
																								 width: '100%',
																								 height: '100%',
																								 zIndex: 2,
																								 backgroundColor: this.options.colour
																								 }).injectInside(this.container);
						
						if(this.options._onClick){
						this.container.addEvent('click', function(){
												this.options._onClick.call(this)
												}.bind(this));
						}
						
						//this.fade = new Fx.Tween(this.container).set('opacity', 0);
						this.container.fade('hide');
						this.position();
						
						window.addEvent('resize', this.position.bind(this));
						},
						
						setOnClick: function(func){
						this.container.addEvent('click', func);
						},
						
						position: function(){ 
						if(this.options.container == document.body){ 
						var h = window.getScrollHeight()+'px'; 
						this.container.setStyles({top: '0px', height: h}); 
						}else{ 
						var myCoords = this.options.container.getCoordinates(); 
						this.container.setStyles({
												 top: myCoords.top+'px', 
												 height: myCoords.height+'px', 
												 left: myCoords.left+'px', 
												 width: myCoords.width+'px'
												 }); 
						} 
						},
						
						show: function(){
						//this.fade.start(0,this.options.opacity);
						this.container.fade(this.options.opacity);
						},
						
						hide: function(){
						//this.fade.start(this.options.opacity,0);
						this.container.fade('out');
						}
						
						});
overlay.implement(new Options);

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


/*
 Script: Assets.js
 Provides methods to dynamically load JavaScript, CSS, and Image files into the document.
 
 License:
 MIT-style license.
 */

var Asset = new Hash({
					 
					 javascript: function(source, properties){
					 properties = $extend({
										  onload: $empty,
										  document: document,
										  check: $lambda(true)
										  }, properties);
					 
					 var script = new Element('script', {'src': source, 'type': 'text/javascript'});
					 
					 var load = properties.onload.bind(script), check = properties.check, doc = properties.document;
					 delete properties.onload; delete properties.check; delete properties.document;
					 
					 script.addEvents({
									  load: load,
									  readystatechange: function(){
									  if (['loaded', 'complete'].contains(this.readyState)) load();
									  }
									  }).setProperties(properties);
					 
					 
					 if (Browser.Engine.webkit419) var checker = (function(){
																  if (!$try(check)) return;
																  $clear(checker);
																  load();
																  }).periodical(50);
					 
					 return script.inject(doc.head);
					 },
					 
					 css: function(source, properties){
					 return new Element('link', $merge({
													   'rel': 'stylesheet', 'media': 'screen', 'type': 'text/css', 'href': source
													   }, properties)).inject(document.head);
					 },
					 
					 image: function(source, properties){
					 properties = $merge({
										 'onload': $empty,
										 'onabort': $empty,
										 'onerror': $empty
										 }, properties);
					 var image = new Image();
					 var element = $(image) || new Element('img');
					 ['load', 'abort', 'error'].each(function(name){
													 var type = 'on' + name;
													 var event = properties[type];
													 delete properties[type];
													 image[type] = function(){
													 if (!image) return;
													 if (!element.parentNode){
													 element.width = image.width;
													 element.height = image.height;
													 }
													 image = image.onload = image.onabort = image.onerror = null;
													 event.delay(1, element, element);
													 element.fireEvent(name, element, 1);
													 };
													 });
					 image.src = element.src = source;
					 if (image && image.complete) image.onload.delay(1);
					 return element.setProperties(properties);
					 },
					 
					 images: function(sources, options){
					 options = $merge({
									  onComplete: $empty,
									  onProgress: $empty
									  }, options);
					 if (!sources.push) sources = [sources];
					 var images = [];
					 var counter = 0;
					 sources.each(function(source){
								  var img = new Asset.image(source, {
															'onload': function(){
															options.onProgress.call(this, counter, sources.indexOf(source));
															counter++;
															if (counter == sources.length) options.onComplete();
															}
															});
								  images.push(img);
								  });
					 return new Elements(images);
					 }
					 
					 });


/**************************************************************
 
 Script		: multiBox
 Version		: 1.4
 Authors		: Samuel Birch
 Desc		: Supports jpg, gif, png, flash, flv, mov, wmv, mp3, html, iframe
 Licence		: Open Source MIT Licence
 
 
 **************************************************************/

var multiBox = new Class({
						 
						 getOptions: function(){
						 return {
						 initialWidth: 250,
						 initialHeight: 250,
						 container: document.body, //this will need to be setup to the box open in relation to this.
						 overlay: false, //this will be a reference to an overlay instance. - TODO: implement below.
						 contentColor: '#FFF',
						 showNumbers: true,
						 showControls: true,
						 //showThumbnails: false,
						 //autoPlay: false,
						 //waitDuration: 2000,
						 descClassName: false,
						 descMinWidth: 400,
						 descMaxWidth: 600,
						 movieWidth: 400,
						 movieHeight: 300,
						 offset: {x:0, y:0},
						 fixedTop: false,
						 path: 'files/',
						 _onOpen: $empty,
						 _onClose: $empty,
						 openFromLink: true
						 //relativeToWindow: true
						 };
						 },
						 
						 initialize: function(className, options){
						 this.setOptions(this.getOptions(), options);
						 
						 this.openClosePos = {};
						 this.timer = 0;
						 this.contentToLoad = {};
						 this.index = 0;
						 this.opened = false;
						 this.contentObj = {};
						 this.containerDefaults = {};
						 this.createArray = [];
						 
						 if(this.options.useOverlay){
						 this.overlay = new Overlay({container: this.options.container, onClick:this.close.bind(this)});
						 }
						 this.overlay = this.options.overlay;
						 if(this.overlay){
						 this.overlay.setOnClick(this.close.bind(this));
						 }
						 
						 this.content = $$('.'+className);
						 if(this.options.descClassName){
						 this.descriptions = $$('.'+this.options.descClassName);
						 this.descriptions.each(function(el){
												el.setStyle('display', 'none');
												});
						 }
						 
						 this.container = new Element('div').addClass('MultiBoxContainer').injectInside(this.options.container);
						 this.iframe = new Element('iframe').setProperties({
																		   'id': 'multiBoxIframe',
																		   'name': 'mulitBoxIframe',
																		   'src': 'javascript:void(0);',
																		   'frameborder': 0,
																		   'scrolling': 'no'
																		   }).setStyles({
																						'position': 'absolute',
																						'top': -20,
																						'left': -20,
																						'filter': 'progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)',
																						'opacity': 0
																						}).inject(this.container);
						 this.box = new Element('div').addClass('MultiBoxContent').inject(this.container);
						 
						 this.closeButton = new Element('div').addClass('MultiBoxClose').inject(this.container).addEvent('click', this.close.bind(this));
						 
						 this.controlsContainer = new Element('div').addClass('MultiBoxControlsContainer').inject(this.container);
						 this.controls = new Element('div').addClass('MultiBoxControls').inject(this.controlsContainer);
						 
						 this.previousButton = new Element('div').addClass('MultiBoxPrevious').inject(this.controls).addEvent('click', this.previous.bind(this));
						 this.nextButton = new Element('div').addClass('MultiBoxNext').inject(this.controls).addEvent('click', this.next.bind(this));
						 
						 this.title = new Element('div').addClass('MultiBoxTitle').inject(this.controls);
						 this.titleMargin = this.title.getStyle('margin-left');
						 this.number = new Element('div').addClass('MultiBoxNumber').inject(this.controls);
						 this.description = new Element('div').addClass('MultiBoxDescription').inject(this.controls);
						 
						 
						 
						 if(this.content.length == 1){
						 this.title.setStyles({
											  'margin-left': 0
											  });
						 this.description.setStyles({
													'margin-left': 0
													});
						 this.previousButton.setStyle('display', 'none');
						 this.nextButton.setStyle('display', 'none');
						 this.number.setStyle('display', 'none');
						 }
						 
						 new Element('div').setStyle('clear', 'both').inject(this.controls);
						 
						 this.content.each(function(el,i){
										   el.index = i;
										   el.addEvent('click', function(e){
													   new Event(e).stop();
													   this.open(el);
													   }.bind(this));
										   if(el.href.indexOf('#') > -1){
										   el.content = $(el.href.substr(el.href.indexOf('#')+1));
										   if(el.content){el.content.setStyle('display','none');}
										   }
										   }, this);
						 
						 this.containerEffects = new Fx.Morph(this.container, {duration: 400, transition: Fx.Transitions.Sine.easeInOut});
						 this.iframeEffects = new Fx.Morph(this.iframe, {duration: 400, transition: Fx.Transitions.Sine.easeInOut});
						 this.controlEffects = new Fx.Morph(this.controlsContainer, {duration: 300, transition: Fx.Transitions.Sine.easeInOut});
						 
						 this.reset();
						 },
						 
						 setContentType: function(link){
						 var str = link.href.substr(link.href.lastIndexOf('.')+1).toLowerCase();
						 var contentOptions = {};
						 if($chk(link.rel)){
						 var optArr = link.rel.split(',');
						 optArr.each(function(el){
									 var ta = el.split(':');
									 contentOptions[ta[0]] = ta[1];
									 });
						 }
						 
						 if(contentOptions.type != undefined){
						 str = contentOptions.type;
						 }
						 
						 this.contentObj = {};
						 this.contentObj.url = link.href;
						 this.contentObj.src = link.href;
						 this.contentObj.xH = 0;
						 
						 if(contentOptions.width){
						 this.contentObj.width = contentOptions.width;
						 }else{
						 this.contentObj.width = this.options.movieWidth;
						 }
						 if(contentOptions.height){
						 this.contentObj.height = contentOptions.height;	
						 }else{
						 this.contentObj.height = this.options.movieHeight;
						 }
						 if(contentOptions.panel){
						 this.panelPosition = contentOptions.panel;
						 }else{
						 this.panelPosition = this.options.panel;
						 }
						 
						 switch(str){
						 case 'jpg':
						 case 'image':
						 case 'gif':
						 case 'png':
						 this.type = 'image';
						 break;
						 case 'swf':
						 this.type = 'flash';
						 break;
						 case 'youtube':
						 this.type = 'youtube';
						 break;
						 case 'flv':
						 this.type = 'flashVideo';
						 this.contentObj.xH = 70;
						 break;
						 case 'mov':
						 this.type = 'quicktime';
						 break;
						 case 'wmv':
						 this.type = 'windowsMedia';
						 break;
						 case 'rv':
						 case 'rm':
						 case 'rmvb':
						 this.type = 'real';
						 break;
						 case 'mp3':
						 this.type = 'flashMp3';
						 this.contentObj.width = 320;
						 this.contentObj.height = 70;
						 break;
						 case 'element':
						 this.type = 'htmlelement';
						 this.elementContent = link.content;
						 this.elementContent.setStyles({
													   display: 'block',
													   opacity: 0
													   })
						 
						 if(this.elementContent.getStyle('width') != 'auto'){
						 this.contentObj.width = this.elementContent.getStyle('width');
						 }
						 
						 this.contentObj.height = this.elementContent.getSize().y;
						 this.elementContent.setStyles({
													   display: 'none',
													   opacity: 1
													   })
						 break;
						 
						 default:
						 
						 this.type = 'iframe';
						 if(contentOptions.ajax){
						 this.type = 'ajax';
						 }
						 break;
						 }
						 },
						 
						 reset: function(){
						 this.container.setStyles({
												  'opacity': 0,
												  'display': 'none'
												  });
						 this.controlsContainer.setStyles({
														  'height': 0
														  });
						 this.removeContent();
						 this.previousButton.removeClass('MultiBoxButtonDisabled');
						 this.nextButton.removeClass('MultiBoxButtonDisabled');
						 this.opened = false;
						 },
						 
						 getOpenClosePos: function(el){
						 if (this.options.openFromLink) {
						 if (el.getFirst()) {
						 var w = el.getFirst().getCoordinates().width - (this.container.getStyle('border').toInt() * 2);
						 if (w < 0) {
						 w = 0
						 }
						 var h = el.getFirst().getCoordinates().height - (this.container.getStyle('border').toInt() * 2);
						 if (h < 0) {
						 h = 0
						 }
						 this.openClosePos = {
						 width: w,
						 height: h,
						 top: el.getFirst().getCoordinates().top,
						 left: el.getFirst().getCoordinates().left
						 };
						 }
						 else {
						 var w = el.getCoordinates().width - (this.container.getStyle('border').toInt() * 2);
						 if (w < 0) {
						 w = 0
						 }
						 var h = el.getCoordinates().height - (this.container.getStyle('border').toInt() * 2);
						 if (h < 0) {
						 h = 0
						 }
						 this.openClosePos = {
						 width: w,
						 height: h,
						 top: el.getCoordinates().top,
						 left: el.getCoordinates().left
						 };
						 }
						 }else{
						 var border = this.container.getStyle('border').toInt();
						 
						 if(this.options.fixedTop){
						 var top = this.options.fixedTop;
						 }else{
						 var top = ((window.getHeight()/2)-(this.options.initialHeight/2) - border)+this.options.offset.y;
						 }
						 this.openClosePos = {
						 width: this.options.initialWidth,
						 height: this.options.initialHeight,
						 top: top,
						 left: ((window.getWidth()/2)-(this.options.initialWidth/2)-border)+this.options.offset.x
						 };
						 }
						 return this.openClosePos;
						 },
						 
						 open: function(el){
						 this.options._onOpen();
						 
						 this.index = this.content.indexOf(el);
						 
						 this.openId = el.getProperty('id');
						 
						 var border = this.container.getStyle('border').toInt();
						 
						 if(!this.opened){
						 this.opened = true;
						 
						 if(this.options.overlay){
						 this.overlay.show();
						 }
						 
						 this.container.setStyles(this.getOpenClosePos(el));
						 this.container.setStyles({
												  opacity: 0,
												  display: 'block'
												  });
						 
						 if(this.options.fixedTop){
						 var top = this.options.fixedTop;
						 }else{
						 var top = ((window.getHeight()/2)-(this.options.initialHeight/2) - border)+this.options.offset.y;
						 }
						 
						 
						 this.containerEffects.start({
													 width: this.options.initialWidth,
													 height: this.options.initialHeight,
													 top: top,
													 left: ((window.getWidth()/2)-(this.options.initialWidth/2)-border)+this.options.offset.x,
													 opacity: [0, 1]
													 });
						 
						 this.load(this.index);
						 
						 }else{
						 if (this.options.showControls) {
						 this.hideControls();
						 }
						 this.getOpenClosePos(this.content[this.index]);
						 this.timer = this.hideContent.bind(this).delay(500);
						 this.timer = this.load.pass(this.index, this).delay(1100);
						 
						 }
						 
						 },
						 
						 create: function(obj){
						 /*
						  obj = {
						  url: 'myurl',  *
						  title: 'my title',
						  description: 'my description',
						  type: 'image',
						  width: 400,
						  height: 300
						  }
						  */
						 if(this.createArray.contains(obj.url)){
						 var index = this.createArray.indexOf(obj.url);
						 var a = this.content[index];
						 }else{
						 
						 var id = 'mbDirect_' + $time();
						 var rel = [];
						 if(obj.type){rel.push('type:'+obj.type)}
						 if(obj.width){rel.push('width:'+obj.width)}
						 if(obj.height){rel.push('height:'+obj.height)}
						 
						 var a = new Element('a', {
											 'href': obj.url,
											 'id': id,
											 'title': obj.title || '',
											 'rel': rel.join(',')
											 });
						 var desc = new Element('div', {
												'class': id,
												'html': obj.description || ''
												})
						 
						 this.createArray.push(obj.url);
						 this.content.push(a);
						 var index = this.content.length-1;
						 
						 if(this.options.descClassName){
						 this.descriptions.include(desc);
						 }
						 }
						 this.open(a);
						 },
						 
						 getContent: function(index){
						 this.setContentType(this.content[index]);
						 var desc = false;
						 if(this.options.descClassName){
						 this.descriptions.each(function(el,i){
												if(el.hasClass(this.openId)){
												desc = el.clone();
												}
												},this);
						 }
						 this.contentToLoad = {
						 title: this.content[index].title || '&nbsp;',
						 desc: desc,
						 number: index+1
						 };
						 },
						 
						 close: function(){
						 if(this.options.overlay){
						 this.overlay.hide();
						 }
						 if (this.options.showControls) {
						 this.hideControls();
						 }
						 this.hideContent();
						 this.containerEffects.cancel();
						 this.zoomOut.bind(this).delay(500);
						 this.options._onClose();
						 },
						 
						 zoomOut: function(){
						 this.iframeEffects.start({
												  width: this.openClosePos.width,
												  height: this.openClosePos.height
												  });
						 this.containerEffects.start({
													 width: this.openClosePos.width,
													 height: this.openClosePos.height,
													 top: this.openClosePos.top,
													 left: this.openClosePos.left,
													 opacity: 0
													 });
						 this.reset.bind(this).delay(500);
						 },
						 
						 load: function(index){
						 this.box.addClass('MultiBoxLoading');
						 this.getContent(index);
						 if(this.type == 'image'){
						 var xH = this.contentObj.xH;
						 this.contentObj = new Asset.image(this.content[index].href, {onload: this.resize.bind(this)});
						 this.contentObj.xH = xH;
						 }else{
						 this.resize();
						 }
						 },
						 
						 resize: function(){
						 if(this.tempSRC != this.contentObj.src){
						 
						 var border = this.container.getStyle('border').toInt();
						 
						 if (this.options.fixedTop) {
						 var top = this.options.fixedTop;
						 }
						 else {
						 var top = ((window.getHeight() / 2) - ((Number(this.contentObj.height) + this.contentObj.xH) / 2) - border + window.getScrollTop()) + this.options.offset.y;
						 }
						 var left = ((window.getWidth() / 2) - (this.contentObj.width.toInt() / 2) - border) + this.options.offset.x;
						 if (top < 0) {
						 top = 0
						 }
						 if (left < 0) {
						 left = 0
						 }
						 
						 this.containerEffects.cancel();
						 this.containerEffects.start({
													 width: this.contentObj.width,
													 height: Number(this.contentObj.height) + this.contentObj.xH,
													 top: top,
													 left: left,
													 opacity: 1
													 });
						 this.iframeEffects.start({
												  width: Number(this.contentObj.width) + (border*2),
												  height: Number(this.contentObj.height) + this.contentObj.xH + (border*2)
												  });
						 this.timer = this.showContent.bind(this).delay(500);
						 this.tempSRC = this.contentObj.src;
						 }
						 },
						 
						 showContent: function(){
						 this.tempSRC = '';
						 this.box.removeClass('MultiBoxLoading');
						 this.removeContent();
						 
						 this.contentContainer = new Element('div').setProperties({id: 'MultiBoxContentContainer'}).setStyles({opacity: 0, width: this.contentObj.width, height: (Number(this.contentObj.height)+this.contentObj.xH)}).injectInside(this.box);
						 
						 if(this.type == 'image'){
						 this.contentObj.injectInside(this.contentContainer);
						 
						 }else if(this.type == 'iframe'){
						 new Element('iframe').setProperties({
															 id: 'iFrame'+new Date().getTime(), 
															 width: this.contentObj.width,
															 height: this.contentObj.height,
															 src: this.contentObj.url,
															 frameborder: 0,
															 scrolling: 'auto'
															 }).injectInside(this.contentContainer);
						 
						 }else if(this.type == 'htmlelement'){
						 this.elementContent.clone().setStyle('display','block').injectInside(this.contentContainer);
						 
						 }else if(this.type == 'ajax'){
						 new Request.HTML({
										  update: $('MultiBoxContentContainer'),
										  autoCancel: true
										  }).get(this.contentObj.url);
						 
						 }else{
						 var obj = this.createEmbedObject().injectInside(this.contentContainer);
						 if(this.str != ''){
						 $('MultiBoxMediaObject').innerHTML = this.str;
						 }
						 }
						 
						 this.contentEffects = new Fx.Morph(this.contentContainer, {duration: 500, transition: Fx.Transitions.linear});
						 this.contentEffects.start({
												   opacity: 1
												   });
						 
						 this.title.set('html', this.contentToLoad.title);
						 if(this.content.length > 1){
						 this.number.set('html', this.contentToLoad.number+' of '+this.content.length);
						 }else{
						 this.number.set('html','');
						 }
						 if (this.options.descClassName) {
						 if (this.description.getFirst()) {
						 this.description.getFirst().destroy();
						 }
						 if(this.contentToLoad.desc){
						 this.contentToLoad.desc.inject(this.description).setStyles({
																					display: 'block'
																					});
						 }
						 }
						 //this.removeContent.bind(this).delay(500);
						 if (this.options.showControls) {
						 if(this.contentToLoad.title != '&nbsp;' || this.content.length > 1){
						 this.timer = this.showControls.bind(this).delay(800);
						 }
						 }
						 },
						 
						 hideContent: function(){
						 this.box.addClass('MultiBoxLoading');
						 this.contentEffects.start({
												   opacity: 0
												   });
						 this.removeContent.bind(this).delay(500);
						 },
						 
						 removeContent: function(){
						 if($('MultiBoxMediaObject')){
						 $('MultiBoxMediaObject').empty();
						 $('MultiBoxMediaObject').destroy();
						 }
						 if($('MultiBoxContentContainer')){
						 //$('MultiBoxContentContainer').empty();
						 $('MultiBoxContentContainer').destroy();	
						 }
						 },
						 
						 showControls: function(){
						 this.clicked = false;
						 
						 if(this.container.getStyle('height') != 'auto'){
						 this.containerDefaults.height = this.container.getStyle('height')
						 this.containerDefaults.backgroundColor = this.options.contentColor;
						 }
						 
						 this.container.setStyles({
												  //'backgroundColor': this.controls.getStyle('backgroundColor'),
												  'height': 'auto'
												  });
						 
						 if(this.content.length > 1){
						 this.previousButton.setStyle('visibility', 'visible');
						 this.nextButton.setStyle('visibility', 'visible');
						 this.title.setStyle('margin-left', this.titleMargin);
						 
						 if(this.contentToLoad.number == 1){
						 this.previousButton.addClass('MultiBoxPreviousDisabled');
						 }else{
						 this.previousButton.removeClass('MultiBoxPreviousDisabled');
						 }
						 if(this.contentToLoad.number == this.content.length){
						 this.nextButton.addClass('MultiBoxNextDisabled');
						 }else{
						 this.nextButton.removeClass('MultiBoxNextDisabled');
						 }
						 }else{
						 this.previousButton.setStyle('visibility', 'hidden');
						 this.nextButton.setStyle('visibility', 'hidden');
						 this.title.setStyle('margin-left', 0);
						 }
						 
						 this.controlEffects.start({'height': this.controls.getCoordinates().height});
						 this.iframeEffects.start({'height': this.iframe.getStyle('height').toInt()+this.controls.getStyle('height').toInt()});
						 
						 if(this.options.overlay){
						 this.options.overlay.position();
						 }
						 
						 },
						 
						 hideControls: function(num){
						 this.iframeEffects.start({'height': this.iframe.getStyle('height').toInt()-this.controls.getStyle('height').toInt()});
						 this.controlEffects.start({'height': 0}).chain(function(){
																		this.container.setStyles(this.containerDefaults);
																		}.bind(this));
						 },
						 
						 showThumbnails: function(){
						 
						 },
						 
						 next: function(){
						 if(this.index < this.content.length-1){
						 this.index++;
						 this.openId = this.content[this.index].getProperty('id');
						 if (this.options.showControls) {
						 this.hideControls();
						 }
						 this.getOpenClosePos(this.content[this.index]);
						 //this.getContent(this.index);
						 this.timer = this.hideContent.bind(this).delay(500);
						 this.timer = this.load.pass(this.index, this).delay(1100);
						 }
						 },
						 
						 previous: function(){
						 if(this.index > 0){
						 this.index--;
						 this.openId = this.content[this.index].getProperty('id');
						 if (this.options.showControls) {
						 this.hideControls();
						 }
						 this.getOpenClosePos(this.content[this.index]);
						 //this.getContent(this.index);
						 this.timer = this.hideContent.bind(this).delay(500);
						 this.timer = this.load.pass(this.index, this).delay(1000);
						 }
						 },
						 
						 createEmbedObject: function(){
						 if(this.type == 'flash'){
						 var url = this.contentObj.url;
						 
						 var obj = new Element('div').setProperties({id: 'MultiBoxMediaObject'});
						 this.str = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" '
						 this.str += 'width="'+this.contentObj.width+'" ';
						 this.str += 'height="'+this.contentObj.height+'" ';
						 this.str += 'title="MultiBoxMedia">';
						 this.str += '<param name="movie" value="'+url+'" />'
						 this.str += '<param name="quality" value="high" />';
						 this.str += '<embed src="'+url+'" ';
						 this.str += 'quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" ';
						 this.str += 'width="'+this.contentObj.width+'" ';
						 this.str += 'height="'+this.contentObj.height+'"></embed>';
						 this.str += '</object>';
						 
						 }
						 
						 if(this.type == 'youtube'){
						 var url = this.contentObj.url;
						 
						 var obj = new Element('div').setProperties({id: 'MultiBoxMediaObject'});
						 this.str = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" '
						 this.str += 'width="'+this.contentObj.width+'" ';
						 this.str += 'height="'+this.contentObj.height+'" ';
						 this.str += 'title="MultiBoxMedia">';
						 this.str += '<param name="movie" value="'+url+'" />'
						 this.str += '<param name="quality" value="high" />';
						 this.str += '<param name="allowFullScreen" value="true"></param>';
						 this.str += '<embed src="'+url+'" ';
						 this.str += 'quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" ';
						 this.str += 'allowfullscreen="true" ';
						 this.str += 'width="'+this.contentObj.width+'" ';
						 this.str += 'height="'+this.contentObj.height+'"></embed>';
						 this.str += '</object>';
						 
						 }
						 
						 if(this.type == 'flashVideo'){
						 //var url = this.contentObj.url.substring(0, this.contentObj.url.lastIndexOf('.'));
						 var url = this.contentObj.url;
						 
						 var obj = new Element('div').setProperties({id: 'MultiBoxMediaObject'});
						 this.str = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" '
						 this.str += 'width="'+this.contentObj.width+'" ';
						 this.str += 'height="'+(Number(this.contentObj.height)+this.contentObj.xH)+'" ';
						 this.str += 'title="MultiBoxMedia">';
						 this.str += '<param name="movie" value="/images/flvplayer.swf" />'
						 this.str += '<param name="quality" value="high" />';
						 this.str += '<param name="salign" value="TL" />';
						 this.str += '<param name="scale" value="noScale" />';
						 this.str += '<param name="FlashVars" value="path='+url+'" />';
						 this.str += '<embed src="/images/flvplayer.swf" ';
						 this.str += 'quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" ';
						 this.str += 'width="'+this.contentObj.width+'" ';
						 this.str += 'height="'+(Number(this.contentObj.height)+this.contentObj.xH)+'"';
						 this.str += 'salign="TL" ';
						 this.str += 'scale="noScale" ';
						 this.str += 'FlashVars="path='+url+'"';
						 this.str += '></embed>';
						 this.str += '</object>';
						 
						 }
						 
						 if(this.type == 'flashMp3'){
						 var url = this.contentObj.url;
						 
						 var obj = new Element('div').setProperties({id: 'MultiBoxMediaObject'});
						 this.str = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" '
						 this.str += 'width="'+this.contentObj.width+'" ';
						 this.str += 'height="'+this.contentObj.height+'" ';
						 this.str += 'title="MultiBoxMedia">';
						 this.str += '<param name="movie" value="/images/mp3player.swf" />'
						 this.str += '<param name="quality" value="high" />';
						 this.str += '<param name="salign" value="TL" />';
						 this.str += '<param name="scale" value="noScale" />';
						 this.str += '<param name="FlashVars" value="path='+url+'" />';
						 this.str += '<embed src="/images/mp3player.swf" ';
						 this.str += 'quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" ';
						 this.str += 'width="'+this.contentObj.width+'" ';
						 this.str += 'height="'+this.contentObj.height+'"';
						 this.str += 'salign="TL" ';
						 this.str += 'scale="noScale" ';
						 this.str += 'FlashVars="path='+url+'"';
						 this.str += '></embed>';
						 this.str += '</object>';
						 }
						 
						 if(this.type == 'quicktime'){
						 var obj = new Element('div').setProperties({id: 'MultiBoxMediaObject'});
						 this.str = '<object  type="video/quicktime" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab"';
						 this.str += ' width="'+this.contentObj.width+'" height="'+this.contentObj.height+'">';
						 this.str += '<param name="src" value="'+this.contentObj.url+'" />';
						 this.str += '<param name="autoplay" value="true" />';
						 this.str += '<param name="controller" value="true" />';
						 this.str += '<param name="enablejavascript" value="true" />';
						 this.str += '<embed src="'+this.contentObj.url+'" autoplay="true" pluginspage="http://www.apple.com/quicktime/download/" width="'+this.contentObj.width+'" height="'+this.contentObj.height+'"></embed>';
						 this.str += '<object/>';
						 
						 }
						 
						 if(this.type == 'windowsMedia'){
						 var obj = new Element('div').setProperties({id: 'MultiBoxMediaObject'});
						 this.str = '<object  type="application/x-oleobject" classid="CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112"';
						 this.str += ' width="'+this.contentObj.width+'" height="'+this.contentObj.height+'">';
						 this.str += '<param name="filename" value="'+this.contentObj.url+'" />';
						 this.str += '<param name="Showcontrols" value="true" />';
						 this.str += '<param name="autoStart" value="true" />';
						 this.str += '<embed type="application/x-mplayer2" src="'+this.contentObj.url+'" Showcontrols="true" autoStart="true" width="'+this.contentObj.width+'" height="'+this.contentObj.height+'"></embed>';
						 this.str += '<object/>';
						 
						 }
						 
						 if(this.type == 'real'){
						 var obj = new Element('div').setProperties({id: 'MultiBoxMediaObject'});
						 this.str = '<object classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA"';
						 this.str += ' width="'+this.contentObj.width+'" height="'+this.contentObj.height+'">';
						 this.str += '<param name="src" value="'+this.contentObj.url+'" />';
						 this.str += '<param name="controls" value="ImageWindow" />';
						 this.str += '<param name="autostart" value="true" />';
						 this.str += '<embed src="'+this.contentObj.url+'" controls="ImageWindow" autostart="true" width="'+this.contentObj.width+'" height="'+this.contentObj.height+'"></embed>';
						 this.str += '<object/>';
						 
						 }
						 
						 return obj;
						 }
						 
						 });
multiBox.implement(new Options);
multiBox.implement(new Events);








