function jscss(action,obj,class1,class2) {
	switch (action) {
		case 'swap':
			obj.className = !jscss('check',obj,class1) ? obj.className.replace(class2,class1) : obj.className.replace(class1,class2);
			break;
		case 'add':
			if (!jscss('check',obj,class1)) { obj.className += obj.className ? ' ' + class1 : class1; }
			break;
		case 'remove':
			var rep = obj.className.match(' '+class1) ? ' '+class1 : class1;
			obj.className = obj.className.replace(rep,'');
			break;
		case 'check':
			return new RegExp('\\b'+class1+'\\b').test(obj.className);
			break;
	}
}

function logVideoEvent(accountID,action,category) {
	var logEvents = {
		uri: '', action: '', type: '', title: '', show: '', category: '', concept: '', position: '',
		length: '', sequence: ''
	};
	
	// call hitbox first
	//try {
	//	_hbSet('hb', accountID);
		// call page view
	//	_hbPageView(action,category);
	//} catch(e) { }

	// split category into relavent data
	//logEvents.uri = category;
	//logEvents.action = action;

	//if (!category.match(/^\/fsp\//)) {
		// this is a video event
	//	details = category.split("/");
	//	logEvents.show = details[2];
	//	logEvents.type = details[1];
	//	logEvents.title = details[3];
	//	try {
	//		if (clipIndex || clipIndex == 0) logEvents.position = clipIndex + 1;
	//	} catch (e) {}
	//}
	// now call webtrends
	//try { 
		// have to use a timeout because IE will abort the call otherwise
	//	setTimeout("dcsMultiTrack('DCS.dcsuri','" + logEvents.uri + "','DCSext.wt_vidType','" + logEvents.type + "','WT.ti','" + logEvents.title + "','DCSext.wt_vidShow','" + logEvents.show + "','DCSext.wt_vidCat','" + logEvents.category + "', 'DCSext.wt_vidConcept','" + logEvents.concept + "','DCSext.wt_vidPos','" + logEvents.position + "','DCSext.wt_vidLen','" + logEvents.length + "','DCSext.wt_vidSeq','" + logEvents.sequence + "','DCSext.wt_vidAction','" + logEvents.action + "','WT.dl','6')",300);
	//} catch (e) { }
}

var Popup = {
  open: function(options)
  {
    this.options = {
      url: '#',
      width: 300,
      height: 300
    }
    Object.extend(this.options, options || {});
    window.open(this.options.url, '', 'width='+this.options.width+',height='+this.options.height);
  }
}

function changeGalleryImage(obj,url) {
	try {
		if (obj) {
			var index = obj.selectedIndex;

			var imageNum = obj.options[index].value;

			if (imageNum != '') {
				url = url + imageNum;
				
				window.location = url;
			}
		}
	} catch (e) { }
}
