// BEGIN - code to bypass Symantic popup blocker
window.setTimeout('if((typeof(SymWinOpen)==\'function\')&&(typeof(SymRealWinOpen)!=\'undefined\')){if(typeof(window.onerror)==\'function\'){window.onerror=null};window.open=SymRealWinOpen;BodyOnLoadFunction();};',500);
// END  - code to bypass Symantic popup blocker

// BEGIN - EmailForm stuff
	function onclick_cblFreeTrialFor(ctrlBase) {
		if ((getElm(ctrlBase + '_FreeTrialFor_cbl_1').checked) || (getElm(ctrlBase + '_FreeTrialFor_cbl_2').checked)){
			getElm(ctrlBase + '_FreeTrialName_pnl').style.display='';
			try {
			    getElm(ctrlBase + '_FreeTrialName_valReq').enabled=true;
			} catch(e){}
	    } else {
			getElm(ctrlBase + '_FreeTrialName_pnl').style.display='none';
			try {
    			getElm(ctrlBase + '_FreeTrialName_valReq').enabled=false;
			} catch(e){}
		}
	}
// END -  BEGIN - EmailForm stuff

function RadioButtonCheckerByName(name,FalseAlert) {
	try {
        for (counter = 0; counter <  document.getElementsByName(name).length; counter++)
            if (document.getElementsByName(name)[counter].checked)
                return (true)
        alert(FalseAlert);
	}
	catch(e) {
        alert('Can not find radio buttons: ' + name);
	}
    return (false);
}
               


// BEGIN - expand and collapse code
	function setNavigatorType(){
		if ((navigator.userAgent.indexOf('Opera')!=-1) && (document.getElementById)) return('OP'); 
		if (document.all) return('IE'); 
		if (document.layers) return('NN'); 
		if (!document.all && document.getElementById) return('MO');
		return('')
	}
	var NavigatorType=null;
	function ShowTable(base_id, expanded){
		if (NavigatorType==null) NavigatorType=setNavigatorType();
		var expanded_display;
		var collapsed_display;
		if (expanded) {
			expanded_display='';
			collapsed_display='none';
		} else {
			expanded_display='none';
			collapsed_display='';
		}
		switch (NavigatorType){
		case 'IE':
  			eval("document.all." + base_id + "_ExpandedTable.style.display='" + expanded_display + "'");
  			eval("document.all." + base_id + "_CollapsedTable.style.display='" + collapsed_display + "'");
   		break;
		case 'OP':
		case 'MO':
			eval("document.getElementById('" + base_id + "_ExpandedTable').style.display='" + expanded_display + "'");
			eval("document.getElementById('" + base_id + "_CollapsedTable').style.display='" + collapsed_display + "'");
  			break;
		case 'NN':
		default: 
			eval("document." + base_id + "_ExpandedTable.display='" + expanded_display + "'");
			eval("document." + base_id + "_CollapsedTable.display='" + collapsed_display + "'");
  			break;
		}
	}
	var current_table_base_id='';
	function SetCurrentVariables(base_table) {
		current_table_base_id=base_table;
	}
	function ExpandText(base_table) {
		if (current_table_base_id!=''){
			ShowTable(current_table_base_id,false);
		}
		current_table_base_id=base_table;
		ShowTable(current_table_base_id,true);
	}
	function CollapseText(base_table) {
		current_table_base_id=base_table;
		ShowTable(current_table_base_id,false);
	}
// END - expand and collapse code



// BEGIN - expand and collapse code for RightNav
	function RightNav_ShowTable(base_id, expanded){
		if (NavigatorType==null) NavigatorType=setNavigatorType();
		var expanded_display;
		var collapsed_display;
		if (expanded) {
			expanded_display='';
			collapsed_display='none';
		} else {
			expanded_display='none';
			collapsed_display='';
		}
		switch (NavigatorType){
		case 'IE':
  			eval("document.all." + base_id + "_ExpandedTable.style.display='" + expanded_display + "'");
  			eval("document.all." + base_id + "_CollapsedTable.style.display='" + collapsed_display + "'");
   		break;
		case 'OP':
		case 'MO':
			eval("document.getElementById('" + base_id + "_ExpandedTable').style.display='" + expanded_display + "'");
			eval("document.getElementById('" + base_id + "_CollapsedTable').style.display='" + collapsed_display + "'");
  			break;
		case 'NN':
		default: 
			eval("document." + base_id + "_ExpandedTable.display='" + expanded_display + "'");
			eval("document." + base_id + "_CollapsedTable.display='" + collapsed_display + "'");
  			break;
		}
	}
	var RightNav_current_table_base_id='';
	function RightNav_SetCurrentVariables(base_table) {
		RightNav_current_table_base_id=base_table;
	}
	function RightNav_ExpandText(base_table) {
		if (RightNav_current_table_base_id!=''){
			RightNav_ShowTable(RightNav_current_table_base_id,false);
		}
		RightNav_current_table_base_id=base_table;
		RightNav_ShowTable(RightNav_current_table_base_id,true);
	}
	function RightNav_CollapseText(base_table) {
		RightNav_current_table_base_id=base_table;
		RightNav_ShowTable(RightNav_current_table_base_id,false);
	}
// END - expand and collapse code for RightNav





// BEGIN - expand and collapse code LINKS
	function ShowRow(row_id, visible){
		if (NavigatorType==null) NavigatorType=setNavigatorType();
		var display_value;
		if (visible) {
			display_value='';
		} else {
			display_value='none';
		}
		switch (NavigatorType){
			case 'IE':
  				eval("document.all." + row_id + ".style.display='" + display_value + "'");
   			break;
			case 'OP':
			case 'MO':
				eval("document.getElementById('" + row_id + "').style.display='" + display_value + "'");
  				break;
			case 'NN':
			default: 
				eval("document." + row_id + ".display='" + display_value + "'");
  				break;
		}
	}

	var current_row_id='';
	function ExpandRow(row_id) {
	    if (current_row_id==row_id){
			ShowRow(current_row_id,false);
		current_row_id='';
		return;
		} 
		if (current_row_id!=''){
			ShowRow(current_row_id,false);
		} 
		current_row_id=row_id;
		ShowRow(current_row_id,true);
	return;
	}
// END - expand and collapse code LINKS for RightNav



// BEGIN - 
	function RollOverLinkServerControl_display(imgName, imgUrl) {
		if (document.images && typeof imgUrl != 'undefined') {
			if (document[imgName]){
				document[imgName].src = imgUrl.src
			}
		}
	}
// END - 


// BEGIN - RollOverButtonServerControl_display
	function RollOverButtonServerControl_display(imgName, imgUrl) {
		if (document.images && typeof imgUrl != 'undefined'){
			if (document[imgName]){
				document[imgName].src = imgUrl.src
			}
		}
	}
// END - RollOverButtonServerControl_display


	function getElm(id){
		var elm = null;
		try{
			if (document.getElementById){
				elm = document.getElementById(id);
			} else {
				elm = document.all[id];
			}
			return elm;

		}catch(e){
		}
	}
	

	function doBlur(id){
		try{
			getElm(id).blur();
		}
		catch(e) {
		}	
	}


	function DoJoDirections(id) {
			windowFramedOpen('Directions.asp?SchoolLocation_ID=' + id, 350, 500);
	}	
	function DoJoSchedule(id) {
			windowFramedOpen('Schedule.asp?SchoolLocation_ID=' + id, 600, 800);
	}	
	function Online_Curriculum(id) {
			windowCurricFramedOpen('DojoCurriculum/guest/index.asp', 600, 800);
	}	
	function DojoCurriculum(id) {
			windowCurricFramedOpen('DojoCurriculum/web/index.asp', 600, 800);
	}	


	function center_window(h, w){
		var t = (window.screen.availHeight / 2) - (h / 2);
		var l = (window.screen.availWidth  / 2) - (w / 2);		
		return 'height=' + h + ',width=' + w + ',top=' + t + ',left=' + l;
	}

	function windowCurricFramedOpen(href, wHeight, wWidth) {
		windowOpen('CurricFrameWeb.asp?' + href, wHeight, wWidth);
	}
	function windowFramedOpen(href, wHeight, wWidth) {
		windowOpen('FrameWeb.asp?' + href, wHeight, wWidth);
	}
	function windowOpen(href, in_height, in_width) {
		var wHeight = in_height;
		var wWidth  = in_width;
		if (wHeight == 0) {
		   wHeight = window.screen.availHeight - 50;
		   wWidth  = window.screen.availWidth  - 50;
		}
		var wTop = (window.screen.availHeight / 2) - (wHeight / 2);
		var wLeft = (window.screen.availWidth  / 2) - (wWidth / 2);		
		var str = 'height=' + wHeight + ',width=' + wWidth + ',top=' + wTop + ',left=' + wLeft;
		var LocalDate=new Date();
		var winName = 'window_' + LocalDate.getMinutes() + '_' + LocalDate.getSeconds() + '_' + LocalDate.getMilliseconds() 
		window.open(href, winName, str + ',status=no,toolbar=no,menubar=no,location=yes,titlebar=no,directories=no,resizable=yes,scrollbars=yes', true);
	}
	function windowOtherOpen(href, in_height, in_width) {
		var wHeight = in_height;
		var wWidth  = in_width;
		if (wHeight == 0) {
		   wHeight = window.screen.availHeight - 50;
		   wWidth  = window.screen.availWidth  - 50;
		}
		var wTop = (window.screen.availHeight / 2) - (wHeight / 2);
		var wLeft = (window.screen.availWidth  / 2) - (wWidth / 2);		
		var str = 'height=' + wHeight + ',width=' + wWidth + ',top=' + wTop + ',left=' + wLeft;
		var LocalDate=new Date();
		var winName = 'window_' + LocalDate.getMinutes() + '_' + LocalDate.getSeconds() + '_' + LocalDate.getMilliseconds() 

		window.open(href, winName, str + ',status=no,toolbar=yes,menubar=yes,location=yes,titlebar=no,directories=no,resizable=yes,scrollbars=yes', true);
	}
	function windowOpenFixed(winName, href, in_height, in_width) {
		var wHeight = in_height;
		var wWidth  = in_width;
		if (wHeight == 0) {
		   wHeight = window.screen.availHeight - 50;
		   wWidth  = window.screen.availWidth  - 50;
		}
		var wTop = (window.screen.availHeight / 2) - (wHeight / 2);
		var wLeft = (window.screen.availWidth  / 2) - (wWidth / 2);		
		var str = 'height=' + wHeight + ',width=' + wWidth + ',top=' + wTop + ',left=' + wLeft;
		var LocalDate=new Date();
		if (winName=='') {
			winName = 'window_' + LocalDate.getMinutes() + '_' + LocalDate.getSeconds() + '_' + LocalDate.getMilliseconds()
		}
		window.open(href, winName, str + ',status=no,toolbar=no,menubar=no,location=no,titlebar=no,directories=no,resizable=no,scrollbars=no', true);
	}

	function showHelp(HelpMessage) {
		var href = 'HelpMessage.asp?HelpMessage=' + HelpMessage;
		var in_height = 300;
		var in_width  = 300;
		var wHeight = in_height;
		var wWidth  = in_width;
		if (wHeight == 0) {
		   wHeight = window.screen.availHeight - 50;
		   wWidth  = window.screen.availWidth  - 50;
		}
		var wTop = (window.screen.availHeight / 2) - (wHeight / 2);
		var wLeft = (window.screen.availWidth  / 2) - (wWidth / 2);		
		var str = 'height=' + wHeight + ',width=' + wWidth + ',top=' + wTop + ',left=' + wLeft;
		var LocalDate=new Date();
		var winName = 'DojoHelpMessage';
		var w = window.open(href, winName, str + ',status=no,toolbar=no,menubar=no,location=no,titlebar=no,directories=no,resizable=yes,scrollbars=yes', true);
		w.focus();
	}

	function doEmailThisPage() {
		var querystring = '';
		if (location.search.length > 1){
			querystring = '&' + location.search.substring(1,location.search.length)
		} 
		var spl_href = location.href.split('?');
		var href_url = spl_href[0];
		//window.location.href='Team_Dojo_Karate_Email_Tell_a_Friend.aspx?Tell_a_Friend_URL=' + href_url + querystring;
		windowOpen('http://www.TeamDojo.com/Team_Dojo_Karate_Email_Tell_a_Friend.aspx?Tell_a_Friend_URL=' + href_url + querystring, 800, 800);
	}	

	function replaceAll(str, find, repl){
		var re = new RegExp(find,"ig");
		return str.replace(re, repl);
	}
	function doDirections(_addr,_csz,_country,_taddr,_tcsz,_tcountry){
	    var addr    =getElm(_addr);
	    var csz     =getElm(_csz);
	    var country =getElm(_country);
	    var taddr   =getElm(_taddr);
	    var tcsz    =getElm(_tcsz);
	    var tcountry=getElm(_tcountry);
	    
		var href = new String('http://maps.yahoo.com/dd_result')
		if (addr.value==''){
			alert('Address field must be entered!');
			addr.focus();
			return false;
		}
		if (csz.value==''){
			alert('City-State-Zip field must be entered!');
			csz.focus();
			return false;
		}
		href += '?addr=' + addr.value +'&csz='+ csz.value + '&country=' + country.value;
		href += '&taddr=' + taddr.value +'&tcsz='+ tcsz.value + '&tcountry=' + tcountry.value;
		href = replaceAll(href," ","+");	
		href = replaceAll(href,",","%2C");	
		
		windowOpen(href,800,800);
	}
	
	
// BEGIN - Right click disabling code...	

  var message="Function Disabled!"; 
  function clickIE() 
    {
    if (document.all) 
      {
      alert(message);
      return false;
      }
    } 
  function clickNS(e) {
    if (document.layers||(document.getElementById&&!document.all))  { 
      if (e.which==2||e.which==3) {
        alert(message);
        return false;
      }
    }
  } 
  if (document.layers) {
    document.captureEvents(Event.MOUSEDOWN);
    document.onmousedown=clickNS;
    } 
  else  {
    document.onmouseup=clickNS;
    document.oncontextmenu=clickIE;
    } 
  document.oncontextmenu=new 
  Function("return false") 	


// END - Right click disabling code...	
  
  