﻿function changeSym(element, tab)
{
	try
	{
		Effect.toggle(element, 'slide');
		var panel = $(element);
		var tab = $(tab);
	
		if(panel.style.display == 'none')
		{
		   tab.src = 'images/tree-close.gif';
	
		}
		else if (panel.style.display == 'block')
		{
			tab.src = 'images/tree-open.gif';
		}
		else
		{
			tab.src = 'images/tree-open.gif';
		}
	}
	catch(err)
	{
	}
}﻿



function delete_cookie ( cookie_name )
{
      var cookie_date = new Date ( );  // current date & time
      cookie_date.setTime ( cookie_date.getTime() - 1 );
      document.cookie = cookie_name += "=; expires=" + cookie_date.toGMTString();
}
	
function setCookie(c, value, expiredays)
{
    var exdate = new Date();
    exdate.setDate(exdate.getDate()+expiredays);
    document.cookie = c+ "=" + escape(value)+((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
} 

function getCookie(c_name)
{
    if (document.cookie.length>0)
  {
      c_start=document.cookie.indexOf(c_name + "=");
      if (c_start!=-1)
        { 
            c_start=c_start + c_name.length+1; 
            c_end=document.cookie.indexOf(";",c_start);
            if (c_end==-1) c_end=document.cookie.length;
            return unescape(document.cookie.substring(c_start,c_end));
        } 
  }
    return "";
} 



function showTab(tabid)
{
	try
	{
		 
		var tbs2 = $('ctl00_pageMainContent_lblShowInstruction');
		
		if(tabid == "1"){
		tbs2.innerHTML = "Please Click on the (+) icon next to a specific product to view available classes.";
		}else if(tabid == "2"){
		tbs2.innerHTML = "Please Click on the (+) icon next to a specific product to view any certification exams available.";
		}else if(tabid == "3"){
		tbs2.innerHTML = "Please Click on the (+) icon next to a specific product to view available classes offering CLE credit hours.";
		}else if(tabid =="4"){
		tbs2.innerHTML = "Please Click on the (+) icon next to a specific product to view available classes offering CPE credit hours.";
		}else if(tabid =="5"){
		tbs2.innerHTML = "Please click on the (+) icon next to a specific product to view available classes offered for free to current customers with an annual maintenance plan.";
		}
		//TabbedPanels1
		var tbs = $('alltabs');
		var d = tbs.childElements();
		var tabs = $$('.TabbedPanelsContent');
		
		
		var tc = $('tabmain_' + tabid);
		var t = $('tab_' + tabid);
		//setCookie("tab_selected", tabid, 100);
		tc.style.display = 'block';
		t.className = "TabbedPanelsTabSelected";
		
		if(d.length > 0)
		{
			for (var i = 0; i < d.length; ++i) 
			{
				if(d[i].id != 'tab_' + tabid)
				{
					d[i].className = "TabbedPanelsTab";
				}
			}
		}
		
		if(tabs.length > 0)
		{
			for (var i = 0; i < tabs.length; ++i) 
			{
				if(tabs[i].id != 'tabmain_' + tabid)
				{
					tabs[i].style.display = 'none';
				}
			}
		}
		
		
		//if(tabid == "tabmain_1")
//		{
//			$('tabmain_2').style.display = 'none';
//			$('tabmain_3').style.display = 'none';
//			$('cleTab').className = "TabbedPanelsTab";
//			$('certTab').className = "TabbedPanelsTab";
//		}
//		else if(tabid == 'tabmain_2')
//		{
//			$('tabmain_1').style.display = 'none';
//			$('tabmain_3').style.display = 'none';
//			$('courseTab').className = "TabbedPanelsTab";
//			$('cleTab').className = "TabbedPanelsTab";
//		}
//		else
//		{
//			$('tabmain_1').style.display = 'none';
//			$('tabmain_2').style.display = 'none';
//			$('courseTab').className = "TabbedPanelsTab";
//			$('certTab').className = "TabbedPanelsTab";
//		}
	}
	catch(err)
	{
	}
}



function readTabSelectedCookie()
{
	var cVal = getCookie('tab_selected');
	if(cVal.length > 0)
	{
		try
		{
			showTab(cVal);
		}
		catch(err)
		{
			delete_cookie ('tab_selected');
		}
	}
}

function setimagecache()
{	
	try {
  		document.execCommand("BackgroundImageCache", false, true);
	} catch(err) {}
}


 cr_oldOnLoad = window.onload;
  if (typeof window.onload != 'function') {
			window.onload = function()
			{
				readTabSelectedCookie();
				setimagecache();
			}
  } else {
    window.onload = function() {
      cr_oldOnLoad();
	  readTabSelectedCookie();
	  setimagecache();
    };
  }



