$(document).ready(function(){
	/*
	// Quick Search - Submit
	$('#quickSearch p.search').click(function(){
		$('#quickSearchFrm').trigger('submit');
	});
	*/
	
	// Quick Search - Jump Action
	$("#quickSearchFrm select").change(function () {
		var url = $(this).val();
		if(url != ''){
			document.location.href=url;
		}
	});
	
	/* AJax Search */
	$('#ajSearch input').keyup(function(){
		if(($(this).val()) && ($(this).val() != ' ')){
			showResult($(this).val());
		}else{
			$('#livesearch').fadeOut('slow').html('');
		}
	});
	// Blurs out quick search box when not in use
	$('#ajSearch input').blur(function(){
		$('#livesearch').fadeOut('slow');
	});

	
	// Collapsible Panels
	$('.CollapsiblePanelContent').slideUp('fast');
	$('.CollapsiblePanel .CollapsiblePanelTab').click(function(){
		$(this).siblings(".CollapsiblePanelContent").toggle('slow')
	});
	
	/*
	// TRC
	$('.trcbut').click(function(){
		$('#schoolIcons').toggle('fast');
		$(this).toggleClass('trcbut_ovr');
	})
	*/
	
	// School Icon Slider
    $('.logoslides').cycle({
		fx:     'fade', 
		timeout: 7000
	});
	
	
});


function showResult(str){
	if (str.length==0){
	  $('#livesearch').html="";
	  return;
	  }
	if (window.XMLHttpRequest){
		// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp=new XMLHttpRequest();
	}else{
		// code for IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	xmlhttp.onreadystatechange=function(){
		if (xmlhttp.readyState==4 && xmlhttp.status==200){
			$('#livesearch').html(xmlhttp.responseText).fadeIn('fast');
		}
	}
	var domain = document.domain;
	xmlhttp.open("GET", "http://"+domain + "/quicksearch.php?q="+str,true);
	xmlhttp.send();
}


function getQuote(){
	var r_text = new Array ();
	var r_auth = new Array ();
	r_text[0] = "Happiness... it lies in the joy of achievement, in the thrill of creative effort.";
	r_auth[0] = "-- Franklin D. Roosevelt";
	
	r_text[1] = "A dream is your creative vision for your life in the future. It's what you would like life to become.";
	r_auth[1] = "-- Denis Waitley, from 'Timing is Everything";
	
	r_text[2] = "Since predicting the future is difficult, perhaps the best way to control your destiny is to create your own future.";
	r_auth[2] = "-- Stephen Shapiro, in '24/7 Innovation";
	
	r_text[3] = "Don't be afraid to make a big step if one is indicated. You can't cross a chasm with two small jumps.";
	r_auth[3] = "-- D. Lloyd George";
	
	r_text[4] = "What's missing isn't the ideas... it's the will to execute them.";
	r_auth[4] = "-- Seth Godin";
	
	r_text[5] = "Your persistence is your belief in yourself.";
	r_auth[5] = "-- Brian Tracy";
	
	r_text[6] = "Everyone can benefit from looking beyond what they are doing today to anticipate the future and to develop ideas that will bring stronger results.";
	r_auth[6] = "-- Elaine Dundon, from 'The Seeds of Innovation";
	
	r_text[7] = "Destiny is no matter of chance. It is a matter of choice: It is not a thing to be waited for, it is a thing to be achieved";
	r_auth[7] = "-- William Jennings Bryan";
	
	r_text[8] = "If you can imagine it, you can achieve it; if you can dream it, you can become it";
	r_auth[8] = "-- William Arthur Ward";
	
	r_text[9] = "The roots of true achievement lie in the will to become the best that you can become.";
	r_auth[9] = "-- Harold Taylor";
	
	r_text[10] = "The human spirit needs to accomplish, to achieve, to triumph to be happy.";
	r_auth[10] = "-- Ben Stein";
	
	r_text[11] = "Cherish your visions and your dreams as they are the children of your soul; the blueprints of your ultimate achievements.";
	r_auth[11] = "-- Anonymous";
	
	
	var b = Math.round(11*Math.random());

	document.write('<blockquote class="withquote"><p class="withunquote">' + r_text[b] + ' &nbsp;&nbsp;&nbsp;</p></blockquote><p class="head_auth">' + r_auth[b] + '</p>');
}


function getHeadPic(){
	var r_Hpic = new Array ();
	r_Hpic[0] = 'head_pic_01.jpg';
	r_Hpic[1] = 'head_pic_02.jpg';
	r_Hpic[2] = 'head_pic_03.jpg';
	r_Hpic[3] = 'head_pic_04.jpg';
	r_Hpic[4] = 'head_pic_05.jpg';
	r_Hpic[5] = 'head_pic_06.jpg';
	r_Hpic[6] = 'head_pic_07.jpg';
	
	var i = Math.round(6*Math.random());

	document.write('<img src="http://www.accredited-online-colleges.com/pages/static/luna/images/' + r_Hpic[i] + '" alt="Accredited Online Colleges & Universities" width="776" height="108" align="right">');
	
}

function getHeadPic2(){
	var r_Hpic = new Array ();
	r_Hpic[0] = 'head_pic_01.jpg';
	r_Hpic[1] = 'head_pic_02.jpg';
	r_Hpic[2] = 'head_pic_03.jpg';
	r_Hpic[3] = 'head_pic_04.jpg';
	r_Hpic[4] = 'head_pic_05.jpg';
	r_Hpic[5] = 'head_pic_06.jpg';
	r_Hpic[6] = 'head_pic_07.jpg';
	
	var i = Math.round(6*Math.random());
	
	document.write('background:url(http://www.accredited-online-colleges.com/pages/static/luna/images/' + r_Hpic[i]+') no-repeat right;');
}

function getHMpic(){
	var hp = new Array ();
	hp[0] = 'content_head_01.jpg';
	hp[1] = 'content_head_01_b.jpg';
	
	var i = Math.round(1*Math.random());

	document.write('<img src="http://www.accredited-online-colleges.com/pages/static/luna/images/' + hp[i] + '" alt="Accredited Online Colleges & Universities" width="252" height="367" />');
}

function getSearchPic(){
	var r_Hpic = new Array ();
	r_Hpic[0] = 'searchPic_1.png';
	r_Hpic[1] = 'searchPic_2.png';
	r_Hpic[2] = 'searchPic_3.png';
	r_Hpic[3] = 'searchPic_4.png';
	r_Hpic[4] = 'searchPic_5.png';

	
	var i = Math.round(4*Math.random());

	document.write('<img class="serchPic" src="http://www.accredited-online-colleges.com/pages/static/luna/images/' + r_Hpic[i] + '" alt="Accredited Online Colleges & Universities" title="Accredited Online Colleges & Universities" width="200" height="195" />');
}


function schoolDd(){
	document.write('');
	}




function getAd(){
	var g_Ad = new Array ();
	var g_LK = new Array ();
	g_Ad[0] = 'ad_02.jpg'; 
	g_LK[0] = 'http://www.accredited-online-colleges.com/school_info/index.php?id=68';
	
	g_Ad[1] = 'ad_08.jpg'; 
	g_LK[1] = 'http://www.accredited-online-colleges.com/school_info/index.php?id=150';
	
	g_Ad[2] = 'ad_04.jpg'; 
	g_LK[2] = 'http://www.accredited-online-colleges.com/school_info/index.php?id=360';
	
	g_Ad[3] = 'ad_09.jpg'; 
	g_LK[3] = 'http://www.accredited-online-colleges.com/school_info/index.php?id=802';
	
	g_Ad[4] = 'ad_01.jpg'; 
	g_LK[4] = 'http://www.accredited-online-colleges.com/school_info/index.php?id=872';
	
	g_Ad[5] = 'ad_12.jpg'; 
	g_LK[5] = 'http://www.accredited-online-colleges.com/school_info/index.php?id=347';
		
	
	var a = Math.round(5*Math.random());

	document.write('<a href="javascript:open_window(\'' + g_LK[a] + '\');" target="_self"><img src="http://www.accredited-online-colleges.com/pages/static/luna/images/ads/' + g_Ad[a] + '" alt="Accredited Online Colleges & Universities" width="150" height="200"></a>');
}


function getBodyPic(){
	var r_Bpic = new Array ();
	r_Bpic[0] = 'aoc_01.jpg';
	r_Bpic[1] = 'aoc_02.jpg';
	r_Bpic[2] = 'aoc_03.jpg';
	r_Bpic[3] = 'aoc_04.jpg';
	r_Bpic[4] = 'aoc_05.jpg';
	r_Bpic[5] = 'aoc_06.jpg';
	r_Bpic[6] = 'aoc_07.jpg';
	
	var t = Math.round(6*Math.random());
	
	/* Removed */
	//document.write('<img src="http://www.accredited-online-colleges.com/pages/static/luna/images/' + r_Bpic[t] + '" alt="Accredited Online Colleges & Universities" width="125" height="187" align="right">');
}

function open_window (url) {
	width = screen.width - 10;
	height = screen.height - 80;
	window.open (url,"mywindow","top=0,left=0,location=no,directories=yes,toolbar=yes,menubar=yes,scrollbars=yes,status=yes,width="+width+",height="+height);
}


function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


//---------------  Search Tabs  ----------------------------------------
//EASY TABS 1.1 - MENU SETTINGS
//Set the id names of your tablink (without a number at the end)
var tablink_idname = new Array("tablink")
//Set the id name of your tabcontentarea (without a number at the end)
var tabcontent_idname = new Array("tabcontent") 
//Set the number of your tabs
var tabcount = new Array("3")
//Set the Tab wich should load at start (In this Example:Tab 2 visible on load)
var loadtabs = new Array("1")  



function easytabs(menunr, active) {
menunr = menunr-1;
	for (i=1; i <= tabcount[menunr]; i++){
		document.getElementById(tablink_idname[menunr]+i).className='tab'+i;
		document.getElementById(tabcontent_idname[menunr]+i).style.display = 'none';
	}
	document.getElementById(tablink_idname[menunr]+active).className='tab'+active+' tabactive';
	document.getElementById(tabcontent_idname[menunr]+active).style.display = 'block';
}



//--------  Category Rollover  -------------------------------------------
function cOn(thisdiv){
if(document.getElementById||(document.all && !(document.getElementById))){
thisdiv.style.backgroundColor="#DFE7F2";
}
}
function cOut(thisdiv){
if(document.getElementById||(document.all && !(document.getElementById))){
thisdiv.style.backgroundColor="#F9FAFC";
}
}
function pageWidth() {
	if (screen.width<= 850) {
		document.write("<link type=\"text/css\" rel=\"stylesheet\" href=\"http://www.accredited-online-colleges.com/pages/static/luna/stylesSS.css\" />");
	}
}


function setStyle(x){
	document.getElementById(x).className='over';
	document.getElementById(x).value='';
}
function returnStyle(x){
	if(document.getElementById(x).value==""){
		document.getElementById(x).className='';
		document.getElementById(x).value='i.e. "nursing" or "criminal justice"  etc.';
	}
}




//v1.0
//Copyright 2006 Adobe Systems, Inc. All rights reserved.
function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?'); 
  else
    return src + ext;
}

function AC_Generateobj(objAttrs, params, embedAttrs) 
{ 
  var str = '<object ';
  for (var i in objAttrs)
    str += i + '="' + objAttrs[i] + '" ';
  str += '>';
  for (var i in params)
    str += '<param name="' + i + '" value="' + params[i] + '" /> ';
  str += '<embed ';
  for (var i in embedAttrs)
    str += i + '="' + embedAttrs[i] + '" ';
  str += ' ></embed></object>';

  document.write(str);
}

function AC_FL_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_SW_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
     , null
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();    

    switch (currArg){	
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":	
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblClick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "width":
      case "height":
      case "align":
      case "vspace": 
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "id":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}















