function searchClicked(se) {
	document.getElementById("videoResultsDiv").innerHTML = '<br><br><br><font style="font-weight:bold;font-size:11px;">Loading YouTube video ...</font>';
	//create a JavaScript element that returns our JSON data.
	var script = document.createElement('script');
	script.setAttribute('id', 'jsonScript');
	script.setAttribute('type', 'text/javascript');
	script.setAttribute('src', 'http://gdata.youtube.com/feeds/' +
		'videos?vq='+se+'&max-results=1&' +
    'alt=json-in-script&callback=showMyVideos&' +
    'format=5&fmt=18');
 
	//attach script to current page -  this will submit asynchronous
	//search request, and when the results come back callback
	//function showMyVideos(data) is called and the results passed to it
	document.documentElement.firstChild.appendChild(script);
}

function showMyVideos(data) {
	var feed = data.feed;
	var entries = feed.entry || [];
	var html = [''];
	for (var i = 0; i < entries.length; i++) {
		var entry = entries[i];
    //dump(entry.id);
    //dump(entry.link[0]);
    var lastpos = entry.id.$t.lastIndexOf("/");
    var dlina=entry.id.$t.length;
    video_id=entry.id.$t.substr(lastpos+1,dlina-lastpos);
    //var playCount = entry.yt$statistics.viewCount.valueOf() + ' views';
    //var title = entry.title.$t;
    //var lnk = '<a href = \"' + entry.link[0].href + '\">link</a>';
    html.push('<object width="448" height="272"><param name="movie" value="http://www.youtube.com/v/',video_id,'&amp;hl=en_US&amp;fs=1&amp;color1=DEEDFB&amp;color2=A2B6CB"></param><param name="wmode" value="opaque"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/',video_id,'&amp;hl=en_US&amp;fs=1&amp;color1=DEEDFB&amp;color2=A2B6CB" wmode="opaque" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="448" height="272" ></embed></object>');
	}
	html.push('');
	document.getElementById('videoResultsDiv').innerHTML = html.join('');
}

var tt;
function show_emb_dm(vid)
{
	clearTimeout(tt);
	show_wait();
	el=document.getElementById("big_em_span");
	el.innerHTML='<object width="500" height="303"><param name="movie" value="http://www.dailymotion.com/swf/video/'+vid+'?additionalInfos=0"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><embed type="application/x-shockwave-flash" src="http://www.dailymotion.com/swf/video/'+vid+'?additionalInfos=0" width="500" height="303" allowfullscreen="true" allowscriptaccess="always"></embed></object>';
    	hide_link('2');
	tt=setTimeout("hide_wait()",2000);
 
}
function show_emb_tube(vid)
{
	clearTimeout(tt);
	show_wait();
	el=document.getElementById("big_em_span");
	el.innerHTML='<object width="500" height="303"><param name="movie" value="http://www.youtube.com/v/'+vid+'&amp;hl=en_US&amp;fs=1&amp;color1=9AD2FA&amp;color2=8DD0FF"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/'+vid+'&amp;hl=en_US&amp;fs=1color1=9AD2FA&amp;color2=8DD0FF" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="500" height="303" ></embed></object>';
   	hide_link('1');
	tt=setTimeout("hide_wait()",2000);
}
function show_emb_ms(vid)
{
	clearTimeout(tt);
	show_wait();
	el=document.getElementById("big_em_span");
	el.innerHTML='<object width="500px" height="303px" ><param name="allowScriptAccess" value="always"/><param name="allowFullScreen" value="true"/><param name="wmode" value="transparent"/><param name="movie" value="http://mediaservices.myspace.com/services/media/embed.aspx/m='+vid+',t=1,mt=video"/><embed src="http://mediaservices.myspace.com/services/media/embed.aspx/m='+vid+',t=1,mt=video" width="500" height="303" allowFullScreen="true" type="application/x-shockwave-flash" wmode="transparent" allowScriptAccess="always"></embed></object>';
 	hide_link('3');
	tt=setTimeout("hide_wait()",2000);
}
function hide_wait()
{
	el=document.getElementById("wait_gif");
	el.style.display= 'none';
	el.style.visibility= 'hidden';
}
function show_wait()
{
	el=document.getElementById("wait_gif");
	el.style.display= '';
	el.style.visibility= 'visible';
}
function hide_link(n)
{
	for(i=1;i<4;i++)
	{
		if(el=document.getElementById('emb_link_'+i))
		{
			if(n==i)
			{
				el.className="sel";
			}else{
 
				el.className="nonsel";
 
			}
		}
	}
}

