var fx_config = new Array();
fx_config['images'] = new Array();
fx_config['images']['constraint'] = new Array;
fx_config['images']['zoom'] = new Array;

/* config area */
fx_config['images']['constraint']['mini'] 		= 100;
fx_config['images']['constraint']['thumb'] 		= 175;
fx_config['images']['constraint']['fullsize'] 		= 390;
fx_config['images']['constraint']['zoom'] 		= 800;
fx_config['images']['constraint']['constrainBy'] 	= 'w';		// width (w) or height (h)

fx_config['images']['zoom']['step']			= 7;		// number pixels to jump with each expand/contract
fx_config['images']['zoom']['speed']			= 1;		// delay in milliseconds between jumps
fx_config['images']['zoom']['runout']			= 1000;		// maximum number of iterations to expand
fx_config['images']['zoom']['tween']			= 10;		// positive number tweens out
/* end config area */

var defaultSpeed = 20;

/* transitions */
function slideIn(obj, speed) {
	if(!obj.style.top) obj.style.top = obj.offsetHeight*-1;
	if(speed==undefined)	speed = defaultSpeed;
	obj.style.display='block';
	obj.style.visiblity='visible';
	obj.style.top = (parseFloat(obj.style.top)+speed)+'px';
	if(parseInt(obj.style.top) <= 0) {
		setTimeout('slideIn($("'+obj.id+'"));', 50);
	} else	obj.style.top = 0;
} 
function slideOut(obj, speed) {
	if(!obj.style.top) obj.style.top = 0;
	if(speed==undefined)	speed = defaultSpeed;
	obj.style.display='block';
	obj.style.visiblity='visible';
	obj.style.top = (parseFloat(obj.style.top)-speed)+'px';
	if(parseInt(obj.style.top) > obj.offsetHeight*-1) {
		setTimeout('slideOut($("'+obj.id+'"));', 50);
	} else	obj.style.top = obj.offsetHeight*-1;
}

var curGrowObj = false;
function grow(obj, to, speed) {
	if(obj) curGrowObj = obj;
	if(!obj.style.height) obj.style.height = obj.offsetHeight;
	if(speed==undefined)	speed = defaultSpeed*1.5;
	obj.style.height = (parseFloat(obj.style.height)+speed)+'px';
	if(parseInt(obj.style.height) < to) {
		setTimeout('grow(curGrowObj, '+to+', '+(speed*.9)+');', 50);
	} else	{
		obj.style.height = to+'px';
	}
} 
function shrink(obj, to, speed) {
	if(to==undefined)	
		to = 0;
	if(!obj.id)	
		obj.id = 'shrnk|'+Math.round(Math.random()*10000000000);
	if(obj.style.height) 
		obj.style.height = obj.offsetHeight+'px';

	if(speed==undefined)	speed = defaultSpeed;
	obj.style.overflow='hidden';
	obj.style.visiblity='visible';
	obj.style.height = (parseFloat(obj.style.height)-speed)+'px';
	if(parseInt(obj.style.height) > (speed+to)) { 
		setTimeout('shrink($("'+obj.id+'"),'+to+','+speed+');', 50);
	} else	obj.style.height = to+'px';
}

var unique_counter = 0;
var currentlyFading = Array();
function fade_in(obj, to) {
	if(!obj || !obj.style)	return;
	if(!obj.id) obj.id = 'anonymous|'+(unique_counter++);

	if(to==undefined) 	to = 1;

	if(!obj.style.opacity) {
		obj.style.opacity=0;
		obj.style.filter='alpha(opacity=0)';
	}
	obj.style.opacity = parseFloat(obj.style.opacity)+.2;
	obj.style.filter='alpha(opacity='+(parseFloat(obj.style.opacity)*100)+')';
	if(obj.style.opacity >= to) {
		obj.style.filter='alpha(opacity='+(to*100)+')';
		obj.style.opacity=to;
		currentlyFading[obj.id] = false;
	} else {
		currentlyFading[obj.id] = true;
		setTimeout('fade_in($("'+obj.id+'"),'+to+');', 100);
	}
} function fade_out(obj) {
	if(!obj.style.opacity || (obj.style.opacity==undefined)) {
		obj.style.opacity=1;
		obj.style.filter='alpha(opacity=100)';
	}
	obj.style.opacity = parseFloat(obj.style.opacity)-.1;
	obj.style.filter='alpha(opacity='+(parseFloat(obj.style.opacity)*100)+')';
	if(obj.style.opacity <= 0) {
		//obj.style.display='none';
		return;
	} else {
		setTimeout('fade_out($("'+obj.id+'"));', 50);
	}
}

/* functionality */
var _lightboxObj = false;
var _lightboxTopOffset = 25;
var _lightboxBodyPadding = 20;
var _lightboxConstrainWidth = 800;	// pixels
var _lightboxConstrainHeight = .8;	// percentage of window
function lightbox(src, width, type, className, height) {
	if(className==undefined)	className = '';
	if(_lightboxObj) {
		_lightboxObj.closeButton.onclick();
       		if(src==undefined)	return;
	}
	if(type==undefined)	type = 'img';
	var scrollTop = isNaN(window.pageYOffset) ? document.body.scrollTop : window.pageYOffset;
	var scrollLeft = isNaN(window.pageXOffset) ? document.body.scrollLeft : window.pageXOffset;
	var closeButtonLeftOffset = 2;

	/* lightbox container */
	_lightboxObj = document.createElement('div');
	_lightboxObj.id = 'lightbox';
	_lightboxObj.className = className;
	_lightboxObj.style.position = 'absolute';
	_lightboxObj.style.top = '0px';
	_lightboxObj.style.left = '0px';
	_lightboxObj.style.width='100%';
	_lightboxObj.style.zIndex='9';

	_lightboxObj.style.height=getFullWinHeight()+'px';
	document.body.appendChild(_lightboxObj);

	/* create background */
	var bg = document.createElement('div');
	bg.style.position = 'absolute';
	bg.style.top = getScrollHeight()+'px';
	window.onscroll = function() { 
		var scrollTop = getScrollHeight();
		_lightboxObj.bg.style.top = scrollTop+'px'; 
		_lightboxObj.container.style.top = scrollTop+(getWinHeight()/2-(width?width:_lightboxObj.container.offsetHeight)/2 + _lightboxTopOffset)+'px'; 
		_lightboxObj.closeButton.style.top = scrollTop+(getWinHeight()/2-(h?h:lbContainer.offsetHeight)/2 + _lightboxTopOffset)+_lightboxObj.closeButton.offsetHeight+'px';
	};
	bg.style.left = '0px';
	bg.style.width='100%';

	bg.style.height='100%';
	bg.lb = _lightboxObj;
	bg.className = 'lightboxBG';
	bg.onclick = function() { this.lb.closeButton.onclick(); };
	_lightboxObj.bg = bg;
	_lightboxObj.appendChild(bg);

	/* setup img width */
	_lightboxObj.className = _lightboxObj.className +' blackbox';
	if(type=='img') {
		var imgXML = load('/boss/getImageInfo.php?src='+src);
		var imgProps = new Array();
		if(ParseXML(imgXML, Array('response','w'))) {
			imgProps['w'] = ParseXML(imgXML, Array('response','w'));		// size is appropriate
			imgProps['h'] = ParseXML(imgXML, Array('response','h'));
                        if(imgProps['h'] > (getWinHeight()*_lightboxConstrainHeight)) {		// size needs to be adjusted
				height = imgProps['h'];
				imgProps['h'] = getWinHeight()*_lightboxConstrainHeight;	// recalc height
				imgProps['w'] = imgProps['h']/height * imgProps['w'];		// recalc width
			}
			if(imgProps['w']>_lightboxConstrainWidth) {
				var oldWidth = imgProps['w'];
				imgProps['w'] = _lightboxConstrainWidth;
				imgProps['h'] = imgProps['w']/oldWidth * imgProps['h'];
			}
			height = imgProps['h'];
			width = imgProps['w'];
		} else	imgProps['w'] = 450;
	}

	/* create container */
	var lbContainer = document.createElement('div');					// create container
	lbContainer.className = 'lightboxContainer';
	lbContainer.style.position = 'absolute';
	if(width==false)	width = 0;
	lbContainer.style.width = width+'px';
	lbContainer.style.left = (parseInt(getWinWidth()/2)-lbContainer.offsetWidth/2)+'px';	// center
	lbContainer.style.height = (height!=undefined) ? (height!=undefined ? height : width)+'px' : 'auto';
	_lightboxObj.container = lbContainer;
	_lightboxObj.appendChild(lbContainer);
	lbContainer.style.visiblity = 'hidden';
	
	_lightboxObj.style.opacity = .4;
	_lightboxObj.style.filter='alpha(opacity=40)';


	/* setup html */
	if(type=='img') {
		var dv = document.createElement('img');
		dv.style.opacity = .4;
		dv.style.filter='alpha(opacity=40)';
		dv.style.width = imgProps['w']+'px';
		dv.style.height = (imgProps['h']!=undefined) ? imgProps['h']+'px' : 'auto';
		//dv.style.visibility = 'hidden';
		dv.lb = _lightboxObj;
		dv.className = 'lightboxBody';
		dv.onload = function() { 		// onload modify sizing
			if(dv.offsetHeight > (getWinHeight()*_lightboxConstrainHeight)) {	// adjust if larger than 90% of screen
				dv.style.width = 'auto';
				dv.style.height = Math.round(getWinHeight()*_lightboxConstrainHeight)+'px';
			}
			fade_in(this);
			this.lb.container.style.visibility='visible'; 
			dv.style.visibility = 'visible';
			this.lb.container.style.left = (parseInt(getWinWidth()/2)-this.width/2)+'px'; 
			this.lb.closeButton.style.top = Top(this.lb.closeButton)+'px';
			this.lb.closeButton.style.left = Left(this.lb.container)+this.lb.container.offsetWidth-this.lb.closeButton.offsetWidth-1+'px';
		};
		dv.src = src;
		lbContainer.appendChild(dv);
	} else if(type == 'obj') {			// load from an html node obj
		var dv = document.createElement('div');
		dv.appendChild(src);
		dv.className = 'lightboxBody';
		lbContainer.appendChild(dv);
		lbContainer.style.height = (height!=undefined ? height : dv.offsetHeight)+'px';
		lbContainer.style.width = dv.offsetWidth+'px';
		var clrDiv = document.createElement('div');
		clrDiv.style.clear='both';
		lbContainer.appendChild(clrDiv);
		if(dv.offsetHeight > (getWinHeight()*.7)) {			// adjust if larger than 70% of screen
			dv.style.height = Math.round(getWinHeight()*.7)+'px';
			lbContainer.style.height = Math.round(getWinHeight()*.7)+40+'px';	
		}
	} else {					// load from a url
		var html = load(src);
		var dv = document.createElement('div');
		dv.innerHTML = html;
		dv.className = 'lightboxBody';
		dv.style.width = (width-40)+'px';
		lbContainer.appendChild(dv);
		lbContainer.style.height = (height!=undefined ? height : dv.offsetHeight)+'px';
		lbContainer.style.height = '0px';
		if(dv.offsetHeight > (getWinHeight()*.7)) {
			dv.style.height = Math.round(getWinHeight()*.7)+'px';	// adjust if larger than 70% of screen
		}
		lbContainer.style.height = dv.offsetHeight+'px';
	}
	lbContainer.style.left = (parseInt(getWinWidth()/2)-(width?width:lbContainer.offsetWidth)/2)+'px';
	lbContainer.style.top = (scrollTop+(getWinHeight()/2)-((height&&(height!=undefined))?height:lbContainer.offsetHeight)/2 + _lightboxTopOffset)+'px';

	/* create close button */
	_lightboxObj.closeButton = document.createElement('div');
	_lightboxObj.closeButton.innerHTML = 'close &times;';
	//_lightboxObj.closeButton.style.top = scrollTop+(getWinHeight()/2-(h?h:lbContainer.offsetHeight)/2 + _lightboxTopOffset)+1+'px';
	_lightboxObj.closeButton.style.top = (scrollTop+(getWinHeight()/2)-((height&&(height!=undefined))?height:lbContainer.offsetHeight)/2 + _lightboxTopOffset)+'px';
	_lightboxObj.closeButton.style.cursor='pointer';
	_lightboxObj.closeButton.style.position = 'absolute';
	_lightboxObj.closeButton.className = 'lightboxButton';
	_lightboxObj.appendChild(_lightboxObj.closeButton);
	_lightboxObj.closeButton.style.left = Left(lbContainer)+lbContainer.offsetWidth-_lightboxObj.closeButton.offsetWidth-closeButtonLeftOffset+'px';
	_lightboxObj.closeButton.onclick=function() { this.parentNode.parentNode.removeChild(this.parentNode); _lightboxObj=false; };
	if(type=='img') _lightboxObj.closeButton.style.visible = 'hidden';

	bg.closeButton = _lightboxObj.closeButton;

	//lbContainer.innerHTML = '<table class="lbTable" cellspacing="0" cellpadding="0" width="100%" height="100%"><tr><td class="tl"></td><td class="tr"></td></tr><tr><td colspan="2">'+lbContainer.innerHTML+'</td></tr><tr><td class="bl"></td><td class="br"></td></tr></table>';
	//fade_in(lbContainer);
	fade_in(_lightboxObj);
	return _lightboxObj;
}
var _loading;
function setLoad(dv, isLoading) {
	if(_loading) {
		_loading.parentNode.removeChild(_loading);	// remove old
		_loading=false;
	}
	if(isLoading) {
		_loading = document.createElement('div');
		_loading.className = 'load';
		_loading.style.left = Left(dv)+'px';
		_loading.style.top = Top(dv)+'px';
		_loading.style.width = dv.offsetWidth+'px';
		_loading.style.height = dv.offsetHeight+'px';
		_loading.style.zIndex = 99;
		document.body.appendChild(_loading);
	}
}
function showLoad(dv) {	return setLoad(dv); }			// alias for setLoad function

/* misc */
function setCSS(fileTitle, selector, prop, val) {
	var rulesVar = document.styleSheets[0].cssRules ? 'cssRules' : 'rules';
	var file = false;
	var styleSheets = document.styleSheets;
	var x,y,z;
	for(file in styleSheets) {
		if(styleSheets[file].title==fileTitle) {	// found file
			var rules = styleSheets[file][rulesVar];
			for(x in rules) {
				if(rules[x].selectorText == selector) {
					rules[x].style[prop] = val;
					return;
				}
			}
		}
	}
}
function loadCSS(file) {
	var headID = document.getElementsByTagName("head")[0];         
	var cssNode = document.createElement('link');
	cssNode.type = 'text/css';
	cssNode.rel = 'stylesheet';
	cssNode.href = '/css/'+file;
	cssNode.media = 'screen';
	headID.appendChild(cssNode);
	return cssNode;
}


function imageProperties(src) {	
	src = replace(replace(src,'&','%26'),' ','%20');
	var xml = load('/boss/getImageInfo.php?src='+src); 
	var ary = new Array();
	ary['w'] = ParseXML(xml,Array('response','w'));
	ary['h'] = ParseXML(xml,Array('response','h'));
	return ary;
}
function generateEmbedCode(type,src,w,h, autostart, transparent) {
	var code = '';
	var rand = Math.random(0,100000);
	//src = 'http://girls.boss32.com'+src;
	src = ''+src;
	autostart = (!autostart || (autostart==undefined)) ? 0 : 1;
	transparent = (!transparent || (transparent==undefined)) ? 0 : 1;
	if(w==undefined) w='320';
	if(h==undefined) h='240';
	w = Math.round(w);
	h = Math.round(h);
	switch(type) {
		case 'img':
			code = '<img onclick="lightbox(this.src);" src="'+src+'" />';
			break;
		case 'flv':
			code = '<object class="flv" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,115,0" width="'+w+'" height="'+h+'" id="videoViewer" align="middle">'+
				'<param name="allowScriptAccess" value="sameDomain" />'+
				'<param name="vSrc"="'+src+'" />'+
				'<param name="FlashVars" value="vSrc='+src+'" />'+
				'<param name="wmode" value="transparent" />'+
				'<param name="allowFullScreen" value="true" />'+
				'<param name="movie" value="/images/swf/videoPlayer.swf?autostart='+autostart+'&vSrc='+src+'&transparent='+transparent+'&'+rand+'" /><param name="quality" value="high" /><embed src="/images/swf/videoPlayer.swf?autostart='+autostart+'&vSrc='+src+'" &transparent='+transparent+'&'+rand+'" FlashVars="autostart='+autostart+'&vSrc='+src+'" allowFullScreen="true" quality="high" wmode="transparent" width="'+w+'" height="'+h+'" name="videoViewer" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />'+
			'</object>';
			break;
		case 'swf':
			code = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,115,0" width="'+w+'" height="'+h+'" id="videoViewer" align="middle">'+
				'<param name="allowScriptAccess" value="sameDomain" />'+
				'<param name="wmode" value="transparent" />'+
				'<param name="allowFullScreen" value="true" />'+
				'<param name="movie" value="'+src+'" /><param name="quality" value="high" /><embed src="'+src+'" allowFullScreen="true" quality="high" wmode="transparent" width="'+w+'" height="'+h+'" name="videoViewer" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />'+
			'</object>';
			break;
	}
	return code;
}

function switchInlineTab(active) {
	var holder = active.parentNode;
	for(var x in holder.childNodes)	
		holder.childNodes[x].className = holder.childNodes[x].className ? holder.childNodes[x].className.replace('active','') : '';
	active.className = active.className + ' active';
}
/* end misc functions */

/* glossary functions */
var definitionDV = false;
function def(obj, specificTo, overrideTerm, overrideWidth) {
	obj = (obj!=undefined)	? obj : false; 
	var term = overrideTerm ? overrideTerm : obj.innerHTML;
	var html = load('/boss/definition.php?s='+term+'&cat='+specificTo);

	return showMore(obj, html, overrideWidth);
}
var moreDV = false;
function showMore(anchorTo, html, overrideWidth) {
	if(moreDV) {
		moreDV.parentNode.removeChild(moreDV);
		moreDV = false;
	}
	if(anchorTo) {
		moreDV = document.createElement('div');
		moreDV.innerHTML = html;
		moreDV.className = 'more';
		if(overrideWidth) moreDV.style.width = overrideWidth+'px';
		moreDV.style.left='0px';
		document.body.appendChild(moreDV);

		moreDV.style.top=Top(anchorTo)-moreDV.offsetHeight+'px';
		var x = Left(anchorTo);
		if(x+moreDV.offsetWidth > getWinWidth())	x = getWinWidth()-moreDV.offsetWidth-10;
		moreDV.style.left=x+'px';
		fade_in(moreDV);
	}
}
/**/

/* map functions */
if(window.GIcon) {
	var defaultIcon = new GIcon(G_DEFAULT_ICON);

	var onlineIcon = new GIcon(defaultIcon, 'http://beartopia.com/images/ui/marker_online.png');
	var iconSize = new GSize(20,34);
	onlineIcon.iconSize=iconSize;

	var offlineIcon = new GIcon(defaultIcon, 'http://beartopia.com/images/ui/marker_offline.png');
	var iconSize = new GSize(20,34);
	offlineIcon.iconSize=iconSize;
}

function plotAddress(map_obj, address, html, status, mapType, panning, point) {
	if (GBrowserIsCompatible()) {
		if(!map_obj.canvas)	map_obj.canvas = new GMap2(map_obj);

		geocoder = new GClientGeocoder();
		if(mapType==undefined) mapType=G_NORMAL_MAP;
		if(!point || point==undefined) {
			var bounds = geocoder.getLatLng(address,function(point) { 
							//map_obj.canvas.setZoom(13);
							map_obj.canvas.addControl(new GSmallMapControl());
							plotPoint(map_obj.canvas, point,address,html, status,false,panning);
							//map_obj.canvas.setMapType(mapType);
						} );
						map_obj.canvas.addControl(new GSmallMapControl());
						plotPoint(map_obj.canvas, point,address,html, status,false,panning);
		} else {
			map_obj.canvas.addControl(new GSmallMapControl());
			plotPoint(map_obj.canvas, point,address,html, status,false,panning);
		}
	}
	//return 
}
var lastPoint = false;
function plotAddresses(map_obj, ary, x, geocoder, holderTag,  latLong, recurse) {
	if(!map_obj.canvas)	map_obj.canvas = new GMap2(map_obj);
	if(geocoder==undefined) geocoder = new GClientGeocoder();
	var map = map_obj.canvas;

	var holder = false;
	if(!recurse && (holderTag != undefined)) {
		holder = mapMarkerHolders[holderTag];

		// clear old results
		var k;
		if(holder)for(k in holder) {
			map_obj.canvas.clearOverlays(holder[k]);
		}
		mapMarkerHolders[holderTag] = new Array();
		mapMarkerHTML[holderTag] = new Array();
		usedMarkers = new Array();
	}
	
	if(!x || x==undefined)	x = 0;
	if(!ary[x]) {
		return;
	}
	var tmp = ary[x].split('|');
	var address = tmp[0];
	var status = tmp[1];
	var html = tmp[2];
	var markerID = tmp[3];

	if(!markerID)	markerID = x;
	if((latLong!=undefined) && (latLong!=undefined)) {
		var latLongAry = address.split(',');
		if(latLongAry[0]*1 && latLongAry[1]*1) {
			var point = new GLatLng(latLongAry[0],latLongAry[1]);
			plotPoint(map_obj.canvas, point,markerID,html, status, holderTag);
			//map_obj.canvas.addControl(new GSmallMapControl());
			lastPoint = point;
		}
		if(ary[x++]) plotAddresses(map_obj, ary,x, geocoder, holderTag, latLong, true);
	}
}

function clearMap(map_obj) {
	var x,k;
	usedMarkers = Array();
	for(x in mapMarkers) 
		map_obj.canvas.clearOverlays(mapMarkerHolders[x]);
}
var usedMarkers = new Array();
var usedMarkersHTML = new Array();
var mapMarkerHolders = new Array();
var mapMarkerHTML = new Array();
var mapMarkers = new Array();
function plotPoint(map, point,id, html, status, holderTag, panning) {
	if(point) {
		/**/
		while(usedMarkers[point]) { 	// marker already placd in this spot
			var tmp = point;
			point = new GLatLng(parseFloat(point.y)+.0007, parseFloat(point.x)+.0007);
		}
		/**/
		usedMarkers[point] = true;
		mapMarkers[id] = new GMarker(point,(status==1) ? onlineIcon : offlineIcon);
		if(holderTag) {
			mapMarkerHolders[holderTag][id] = mapMarkers[id];
			mapMarkerHTML[holderTag][id] = html;
			//mapMarkerHolders[holderTag][mapMarkerHolders[holderTag].length] = mapMarkers[id];
		}
		mapMarkers[id].html = html;

		if(!map.isLoaded()) {
			map.setCenter(point, 7);
		} else if(panning) {
			map.panTo(point);
		}
		map.addOverlay(mapMarkers[id]);
		if(html) GEvent.addListener(mapMarkers[id], "click", function(){  this.openInfoWindow(this.html);}  );
	}
}
/* end map functions */

/* video generator functions */
var maxVideoW = 960;
var videoRatio = 320/240;
var videoRatio = 475/350;
//var videoRatio = 320/180;
function setupVideoPlayer(initialSrc, holderObj, autostart, w, h, rent, keywords) {
	if(!autostart || (autostart==undefined))	autostart = true;
	if(!w || (w==undefined) || !h || (h==undefined)) {	// set to max width
		if(!w || (w==undefined)) 
			w = (getWinWidth() > maxVideoW) ? maxVideoW : getWinWidth();
		h = w / videoRatio;
		if(h > getWinHeight()*.8) {	// greater than win height, set to max height
			h = getWinHeight()*.8;
			w = h * videoRatio;
		}
	}

	var mainDV = document.createElement('div');
	mainDV.style.overflow='hidden';
	mainDV.style.height=h+'px';
	mainDV.innerHTML = generateEmbedCode('flv', initialSrc, w, h, autostart);

	var previewsDV = document.createElement('div');
	previewsDV.className = 'videoPreviewHolder lightboxVideoPreviews';
	mainDV.appendChild(previewsDV);
	previewsDV.innerHTML = holderObj.innerHTML.replace('more videos...','');

	lightbox(mainDV, w+40, 'obj', 'blackbox', h+50);
}
/* end video generator functions */

/* setup preview over video / images */
function initPreview(icon, type) {
	switch(type) {
		case 'video':
			/*
			icon.preview = document.createElement('div');
			icon.preview.className = 'previewOverlay';
			icon.preview.style.top = Top(icon)+'px';
			icon.preview.style.left = Left(icon)+'px';
			icon.preview.style.width = icon.offsetWidth+'px';	// leave room for border
			icon.preview.style.height = icon.offsetHeight+'px';
			icon.preview.icon = icon;

			if(!icon.onclick) icon.onclick = function() { document.location.href=this.parentNode.href;	};
			icon.preview.onclick = function() { this.icon.onclick(); 	};
			icon.preview.onmouseout = function() { this.icon.onmouseout(); 	};
			icon.onmouseover = function() { this.preview.onmouseover(); 	};
			icon.onmouseout = function() { this.preview.onmouseout(); 	};
			icon.preview.onmouseover = function() { this.className = this.className.replace('over','')+' over';		
								this.style.top = Top(this.icon)+'px';
								this.style.left = Left(this.icon)+'px';
								this.style.height = this.icon.offsetHeight+'px';
								this.style.width = this.icon.offsetWidth+'px';
			};
			icon.preview.onmouseout = function() { this.className = this.className.replace('over','');			};
			document.body.appendChild(icon.preview);
			//debug(icon.preview);
			*/
			break;
		case 'image':
			break;
	}
}
