function reset_div(theid)
{
	document.getElementById(theid).innerHTML='';
}
function hide(theid)
{
	if (document.getElementById(theid))
		document.getElementById(theid).style.display='none';
	else if (window.opener.document.getElementById(theid))
		window.opener.document.getElementById(theid).style.display='none';
}

function show(theid)
{
	if (document.getElementById(theid))
		document.getElementById(theid).style.display='';
	else if (window.opener.document.getElementById(theid))
		window.opener.document.getElementById(theid).style.display='';

}
function setstyle(theid, classname)
{
	document.getElementById(theid).className=classname;
}
function setvalue(theid, value)
{
	document.getElementById(theid).value=value;
}

function sethtml(theid, html)
{
	document.getElementById(theid).innerHTML=html;
}
function gethtml(theid, html)
{
	return document.getElementById(theid).innerHTML;
}
function setsrc(theid, thesrc)
{
	document.getElementById(theid).src=thesrc;
}
function getsrc(theid)
{
	return document.getElementById(theid).src;
}
function toggle_display(theid)
{
	if (document.getElementById(theid).style.display=='none')
		show(theid);
	else
		hide(theid);
}

var newwindow = '';
function popup(url, scrollbars, the_anchor)
{
	if (!scrollbars)
		scrollbars="no";
		
	url = "/popup.php?p="+url;
	if (the_anchor)
		url += "#"+the_anchor;
	newwindow = window.open(url, 'popup', 'toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,scrollbars='+scrollbars+',width=777,height=637');
	if (window.focus) {newwindow.focus()}
}

function redirect(url)
{
	window.location.replace(url);
}

function load(divId,url,param)
{
	ajax_loadContent(divId,url,param);
}

function loadparent(divId,url,param)
{
	ajax_loadContentParent(divId,url,param);
}

function open_coach_video()
{
	var the_combo = document.getElementById('coach_tips_combo'); 
	drill_id = the_combo.options[the_combo.selectedIndex].value;
	if (drill_id)
		popup("video&id="+drill_id+"&coach=1");
	else
		alert('There is no drill selected');
}

function open_motto_video()
{
	var the_combo = document.getElementById('motto_combo_id'); 
	drill_id = the_combo.options[the_combo.selectedIndex].value;
	if (drill_id)
		popup("videor&id="+drill_id);
	else
		alert('There is no motto selected');
}

function open_video(drill_id)
{
	popup("video&id="+drill_id);
}

function open_intro_video()
{
	popup("introvideo");
}

function open_v1deo(drill_id, follow)
{
	popup("video&id="+drill_id+"&f="+follow);
}

function open_videor(drill_id)
{
	popup("videor&id="+drill_id);
}

function open_videof(video_id)
{
	popup("videof&id="+video_id);
}
