debug("video functions");
function getElementsByClassName(className) { 
	var retnode = [];
	var myclass = className;
 	var elem = document.getElementsByTagName('*');
	for (var i = 0; i < elem.length; i++) {
		if (elem[i].id == null || elem[i].id == '') {
			continue;
		}
		var classes =elem[i].className.split(' ');
		for (var j = 0; j < classes.length; j++) {
			
			if (classes[j] == className) {
				retnode.push(elem[i].id);
				continue;
			}
		}
	}  
	return retnode; 
}

function showType(feedType) {
// make all my competitors invisible
	var cdivs = getElementsByClassName('youtubefeed');
	for (var el in cdivs) {
		var d = document.getElementById(cdivs[el]);
		d.style.visibility = 'hidden';
		d.style.display = 'none';
		// el.style.visibility = 'hidden';
		// el.style.display = 'none';
	}

// show the type
	var tdive = document.getElementById(feedType);
	if (tdive) {
		tdive.style.visibility = 'visible';
		tdive.style.display = 'block';
	} else {
		alert("feed type: " + feedType + " does not exist");

	}
}


function showYTVideo(where, which, site, videoUrl, vimeo) {

	var height = 388;
	var width = 690;


	var d = document.getElementById(where);
	if(!d) {
		// alert("no " + where);
		return;
	}
	if (which) {
		// alert("which: '" + which + "'");
	} else {
		// d.innerHTML = 'no video at "' + which + '"';
		// return;
	}
	var info;
	debug("getting data for: " + which);
	/* var src = srcGet('?service=getasset&type=video&output_format=json&url=' + which);
	try { 
       		info = JSON.parse(src);
	} catch (erro) {
		d.innerHTML = "could not parse : <pre>" + src + " </pre>";
		debug("bad json: " + src);
		return; 
	}
	debug('info: ' + info);
	 */
	if (!which) {
		// alert("no video id");
		// 	
		// 		
		return;
	}
	var attributes = new Object();
	var params = new Object();
	var flashvars = new Object();
	// flashvars.extid = info.extid;
	flashvars.youtube = 'true';
	flashvars.linkTextColor = '#cccccc';
	flashvars.linkTextRolloverColor = '#cc00cc';
	flashvars.bronsonOrb = window.location.hostname;
	flashvars.videoUrl = videoUrl;
	// flashvars.videoUrl = info['url'];
	flashvars.extid = which;
	flashvars.which = which;
	flashvars.vimeo = vimeo;
	flashvars.orbUrl = window.location.hostname;
	

	params.menu = "true";
	params.allowFullScreen = 'true';
	params.allowScriptAccess = 'always';
	try { 
		swfobject.embedSWF('http://genghis-uploads-new.s3.amazonaws.com/bhq_new.swf', where, width, height, '10.0.0', false, flashvars, params, attributes);
	} catch (e) {
		debug("error embedding swf: " + e);
	}

}
