$(document).ready(function(){

	$(".content").hide(); //Hide all content
	$("ul.solidblockmenu li:first").addClass("active").show(); //Activate first tab
	$(".content:first").show(); //Show first tab content

	//On Click Event
	$("ul.solidblockmenu li").click(function() {

		$("ul.solidblockmenu li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".content").hide(); //Hide all tab content

		var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active ID content
		return false;
	});

	$(".curcontent").hide(); //Hide all content
        $("ul#tod li:first").addClass("active").show(); //Activate first tab
        $(".curcontent:first").show(); //Show first tab content

        //On Click Event
        $("ul#tod li").click(function() {
                $("ul#tod li").removeClass("active"); //Remove any "active" class
                $(this).addClass("active"); //Add "active" class to selected tab
                $(".curcontent").hide(); //Hide all tab content

                var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
                $(activeTab).fadeIn(); //Fade in the active ID content
                return false;
        });


    $("#customize-your-experience-slidebutton").click(function() { 
                $("#entirePost:visible").slideUp("normal");$("#entirePost:hidden").slideDown("normal");
        });
    $("#custom_slide_button").click(function() {
                $("#custom_text:visible").slideUp("normal");$("#custom_text:hidden").slideDown("normal");
        });
 $("#customize-submit-button").click(function() {
 $("#entirePost:visible").slideUp("normal");
});

                $('li.headlink').hover(
                        function() { $('ul', this).css('display', 'block'); },
                        function() { $('ul', this).css('display', 'none'); });

     $(".takeacoursebutton").hover(function() {  
         $(this).attr("src","images/TakeACourseROGB4-21v1.gif");  
             }, function() {  
         $(this).attr("src","images/TakeACourseUPGB4-21v1.gif");  
     }); 
$('#checkcme').click(function(){
$('#content1').show('slow');
});

$(".onerow").each(function(){
var len = 310;
var p = $(this).find('span').text();
var textlength = p.length;
/* alert(p.length); */
/* alert(p.length); */
/* var q = p.substring(textlength - 20, textlength); */
var q = $(this).attr("id");
var o = $(this).attr("title");
/* alert(q); */
/* alert(q); */
    p = p.substring(0, len);
    p = p.replace(/\w+$/, '');
var r = "<h7>"+p+"</h7>";
    $(this).find('span').html(r);
});


$(".tworow").each(function(){
var len = 700;
var p = $(this).text();
var textlength = p.length;
/* alert(p.length); */
/* alert(p.length); */
/* var q = p.substring(textlength - 20, textlength); */
var q = $(this).attr("id");
var o = $(this).attr("title");
/* alert(q); */
    p = p.substring(0, len);
    p = p.replace(/\w+$/, '');
var r = "<h7>"+p +"</h7>";
    $(this).html(r);
});


  $('.ellipsis').each(function (i) {
var len = 100;
var p = $(this).text();
if (p) {

  var trunc = p.innerHTML;
  if (trunc.length > len) {

    /* Truncate the content of the P, then go back to the end of the
       previous word to ensure that we don't truncate in the middle of
       a word */
    trunc = trunc.substring(0, len);
    trunc = trunc.replace(/\w+$/, '');

    /* Add an ellipses to the end and make it a link that expands
       the paragraph back to its original size */
    trunc += '<a href="#" ' +
      'onclick="this.parentNode.innerHTML=' +
      'unescape(\''+escape(p.innerHTML)+'\');return false;">' +
      '...<\/a>';
    p.innerHTML = trunc;
  }
}

});


 });


$(function(){

   /*  Form Field Value Swap 
*/
//	$("#global-menu-backdrop").dropShadow();
    swapValues = [];
    $(".swap_value").each(function(i){
        swapValues[i] = $(this).val();
        $(this).focus(function(){
            if ($(this).val() == swapValues[i]) {
                $(this).val("");
            }
        }).blur(function(){
            if ($.trim($(this).val()) == "") {
                $(this).val(swapValues[i]);
            }
        });
    });
})

function toggleLayer( whichLayer )
{
  var elem, vis;
  if( document.getElementById ) // this is the way the standards work
    elem = document.getElementById( whichLayer );
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[whichLayer];
  else if( document.layers ) // this is the way nn4 works
    elem = document.layers[whichLayer];
  vis = elem.style;
  // if the style.display value is blank we try to figure it out here
  if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
    vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
  vis.display = (vis.display==''||vis.display=='block')?'none':'block';
}

function showDiv(divID)
{
       //alert("Test");
        getdiv=document.getElementById(divID);
        getdiv.style.display='block';
}

function closeDiv(divID)
{
        //alert("Test");
        getdiv= document.getElementById(divID);
        getdiv.style.display ='none';
}

/*****/
var win;
function newWin(lnk,dim)
{
// lnk = link from index; dim = dimensions for the window
// dim = dimensions / attributes for new Window;
if(typeof(win)=='undefined' || win.closed==true)
	{
	var win = window.open(lnk, 2, dim)
	}
else
	{win.close(2)
	var win = window.open(lnk, 2, dim)
	win.focus();
	}
}

function openWin()
{
var loc = '/terms_agreement.cfm';
	newWin(loc,'scrollbars=yes,status=yes,width=600,height=350,left=1,top=1');
}

