$(document).ready(function(){
	$('#searchTabs > ul').tabs();

	$("#news").newsticker(); 
	$('.link_quicklinks')
	.one('click',function(){
		$('.quickLinks').css({position:'relative',left:0}).slideDown('fast');
		$(this)
		.click(function(){
			$('.quickLinks').slideToggle('fast');
			return false;
		});
		return false;
	});
	
	$('.link_banner_send').click(function(){
		var href = "http://admissions.gmu.edu/postcard/sendpostcard.asp";// $(this).attr('href');
		
		myRef = window.open(href,'mywin', 'left=20,top=20,width=615,height=770,toolbar=0,resizable=0,location=0,status=0');
		return false;
	});
	
	var whyMasonLargeImage = $('#whyMasonLargeImage');
	var whyMasonTxt = $('#whyMasonTxt');
	var whyMasonQuicktxt = $('#whyMasonQuicktxt');
	var whyMasonImages = $('#whyMasonImages');
	var whyMasonLargeImageimg = $('<img src="" width="100%" style="display:none"/>').appendTo(whyMasonLargeImage);
	var loading = $('<div class="loading">Loading...</div>').appendTo(whyMasonLargeImage);
	
	
	$('#whyMasonImages a')
	.click(function(){return false;})
	.mouseover(function(){
		var el = $(this);
		var path = el.attr('href');
		var title = el.attr('title');
		var p = el.siblings('p');
		
		var img = new Image();
		
		loading.show();
		
		img.onload = function(){
			img.onload = null;
			whyMasonLargeImageimg.fadeOut(function(){
				whyMasonLargeImageimg.attr('src',path).fadeIn();
			});
		
			whyMasonTxt.empty();
			
			
			var div = $('<div>').appendTo(whyMasonTxt).append('<h3>'+title+'</h3>').append(p.clone())
			
			//var h = div.height();//.css('opacity',0)
			
			//whyMasonTxt.animate({height:h+20},'fast');
			//div.animate({opacity:100},2000);
			loading.fadeOut();
		};
		img.src = path;
		
		return false;
	});
	/*
	.mouseover(function(){
		var el =  $(this);
		var dl = el.siblings('dl');
		whyMasonQuicktxt
		.html(dl.clone())
	});
	*/
	
	$('#whyMasonImages a:eq(0)').trigger('mouseover');
	
	var runCnt = 0;
	$('.carousel-next').hover(function(){$(this).addClass('active-next');},function(){$(this).removeClass('active-next');})
	.click(function(){
		if( runCnt == 3  ) return false;
		runCnt++;
		whyMasonImages.stop().animate({
									  	marginLeft: -(runCnt*450)
									  },'fast');
		 return false;
	});
	$('.carousel-prev').hover(function(){$(this).addClass('active-prev');},function(){$(this).removeClass('active-prev');})
	.click(function(){
		if( runCnt == 0  ) return false;
		runCnt--;
		whyMasonImages.stop().animate({
									  	marginLeft: -(runCnt*450)
									  },'fast');
		 return false;
	});
	var Q = quotes.length;
	var whichQuotation=Math.round(Math.random()*(Q-1));
	$('blockquote.home').html(quotes[whichQuotation]);
});
if( 1 == 2 ){
	$(document).ready(function(){
							   
		if($.browser.msie && $.browser.version < 7){
			$('.holder').width(960);
			/*if($(window).width()>990){
				
			}*/
		}
	});
}
var quotes = Array(
	'"The Health and Strategic Communication PhD program has given me the opportunity to develop my research skills and experience not only through working on federally and privately funded research grants but by also pursuing my own research projects with the guidance and support of leading health communication researchers."<blockquote>Christy Ledford<br/>PhD Communication, May 2008</blockquote>',
	'"George Mason was the perfect convergence of factors - location, price, evening classes and of course an outstanding education. Not only do I utilize skills from my degree daily, it has enabled me to rise rapidly in the defense industry."<blockquote>Robin Davis<br/>MPP in Public Policy, May 2006</blockquote>',
	'"Mason Graduate School has allowed me to balance my real-life experiences with the foundations provided by the academic world."<blockquote>David Olave<br/>MA International Commerce and Policy, May 2009</blockquote>',
	'"Mason\'s Counseling and Development program has given me great insight into the field beyond traditional counseling. Its forward-thinking approach to teaching and its\' program foundation enables future counselors to be proactive while considering a diverse scope of issues."<blockquote>Emily Welty<br/>MEd, Counseling and Development, School Counseling Concentration, May 2010</blockquote>',
	'"The interdisciplinary approach to health and security in Mason\'s Biodefense program gives students the tools to succeed in preparing to deal with any form of global health issue."<blockquote>Matthew Jaquith<br/>MS, Biodefense, May 2009</blockquote>',
	'"I chose Mason because its software engineering degree seemed more applicable to the needs I\'d seen in D.C. area industry than a pure computer science degree, while being more technical than an MIS degree. I believe Mason has a strong, student-focused faculty and some outstanding opportunities for pursuing practical research."<blockquote>Thad Humphries<br />MS in Software Engineering Alumnus</blockquote>',
	'"The PhD in Information Technology program exactly matched my career goals and work schedule.  The program provided the freedom to pursue my individual research interests, and my advisor, committee, and professors were extraordinarily supportive.  My GMU/IT&E degree is viewed as a great achievement and positive value  to my employer and its customers."<blockquote>Harry J. Foxwell<br />PhD in Information Technology Alumnus</blockquote>',
	'"I chose the Volgenau School at George Mason for the convenient location and for the instructors with real-world experience in industry and all of the insight that comes with that. The knowledge and experience that I am acquiring at GMU are already applicable to projects at my current job and will be essential with the direction I want to take my career."<blockquote>Greg Zumbrook<br />MS in Computer Engineering, Candidate</blockquote>', 
	'"While in the program, I found that all of the courses in civil engineering were interesting and challenging. The professors I encountered went out of their way to get to know their students and work with them to be successful. The real-world applications in all of the courses proved to be beneficial in enhancing my knowledge and abilities to do well in my career."<blockquote>Amy Houser<br />MS in Civil and Infrastructure Engineering, Alumnus</blockquote>',
	'"My program at Mason exposed me to individuals who were employed in the field. The faculty and students combined gave me a strong theoretical understanding of topics with innovative application of the concepts taught". Class discussions were lively, and my time at the university provided me with great networking opportunities."<blockquote>Barbara Dreon Canody<br />MS in Operations Research Alumnus</blockquote>'
);


	function page1_button_onclick(){
	
	newWin = window.open("PriorSch_2.asp?level='" + document.forms[0].SearchLevel.value + "'","School","scrollbars=1,height=300, width=400,screenX=400,screenY=400,top=200,left=400', alwaysRaised=1, z-lock=0, dependent=1, fullscreen=0, channelmode=0")
	}
	
	function FormValidator(theForm)
	{

  if (theForm.FirstName.value == "")
  {
    alert("Please enter a value for the \"First Name\" field.");
    theForm.FirstName.focus();
    return (false);
  }

  if (theForm.FirstName.value.length < 2)
  {
    alert("Please enter at least 2 characters in the \"First Name\" field.");
    theForm.FirstName.focus();
    return (false);
  }

  if (theForm.FirstName.value.length > 15)
  {
    alert("Please enter at most 15 characters in the \"First Name\" field.");
    theForm.FirstName.focus();
    return (false);
  }

  if (theForm.LastName.value == "")
  {
    alert("Please enter a value for the \"Last Name\" field.");
    theForm.LastName.focus();
    return (false);
  }

  if (theForm.LastName.value.length < 2)
  {
    alert("Please enter at least 2 characters in the \"Last Name\" field.");
    theForm.LastName.focus();
    return (false);
  }

  if (theForm.LastName.value.length > 25)
  {
    alert("Please enter at most 25 characters in the \"Last Name\" field.");
    theForm.LastName.focus();
    return (false);
  }

  if (theForm.Street1.value == "")
  {
    alert("Please enter a value for the \"Street1\" field.");
    theForm.Street1.focus();
    return (false);
  }

  if (theForm.Street1.value.length < 2)
  {
    alert("Please enter at least 2 characters in the \"Street1\" field.");
    theForm.Street1.focus();
    return (false);
  }

  if (theForm.Street1.value.length > 30)
  {
    alert("Please enter at most 30 characters in the \"Street1\" field.");
    theForm.Street1.focus();
    return (false);
  }

  if (theForm.City.value == "")
  {
    alert("Please enter a value for the \"City\" field.");
    theForm.City.focus();
    return (false);
  }

  if (theForm.City.value.length < 2)
  {
    alert("Please enter at least 2 characters in the \"City\" field.");
    theForm.City.focus();
    return (false);
  }

  if (theForm.City.value.length > 30)
  {
    alert("Please enter at most 30 characters in the \"City\" field.");
    theForm.City.focus();
    return (false);
  }

  
  
  if (theForm.SATE_PKID.selectedIndex < 0)
  {
    alert("Please select one of the \"State\" options.");
    theForm.SATE_PKID.focus();
    return (false);
  }

  if (theForm.SATE_PKID.selectedIndex == 0)
  {
    alert("The first \"State\" option is not a valid selection.  Please choose one of the other options.");
    theForm.SATE_PKID.focus();
    return (false);
  }

  if (theForm.ZipCode.value == "")
  {
    alert("Please enter a value for the \"Zip Code\" field.");
    theForm.ZipCode.focus();
    return (false);
  }

  if (theForm.ZipCode.value.length < 5)
  {
    alert("Please enter at least 5 characters in the \"Zip Code\" field.");
    theForm.ZipCode.focus();
    return (false);
  }

  if (theForm.ZipCode.value.length > 10)
  {
    alert("Please enter at most 10 characters in the \"Zip Code\" field.");
    theForm.ZipCode.focus();
    return (false);
  }


  
  	var checkOK = "0123456789-- \t\r\n\f";
  	var checkStr = theForm.ZipCode.value;
  	var allValid = true;
  	var validGroups = true;
  	for (i = 0;  i < checkStr.length;  i++)
  	{
  	  ch = checkStr.charAt(i);
  	  for (j = 0;  j < checkOK.length;  j++)
  	    if (ch == checkOK.charAt(j))
  	      break;
  	  if (j == checkOK.length)
  	  {
  	    allValid = false;
  	    break;
  	  }
  	}
  	if (!allValid)
  	{
  	  alert("Please enter only digit, whitespace and \"-\" characters in the \"Zip Code\" field.");
  	  theForm.ZipCode.focus();
  	  return (false);
  	}



  if (theForm.Comm2Number.value == "")
  {
    alert("Please enter a value for the \"Email Address\" field.");
    theForm.Comm2Number.focus();
    return (false);
  }

  if (theForm.Comm2Number.value.length < 3)
  {
    alert("Please enter at least 3 characters in the \"Email Address\" field.");
    theForm.Comm2Number.focus();
    return (false);
  }

  if (theForm.Comm2Number.value.length > 75)
  {
    alert("Please enter at most 75 characters in the \"Email Address\" field.");
    theForm.Comm2Number.focus();
    return (false);
  }




  if (theForm.CollegeCode.value == "")
  {
    alert("Please enter a value for the \"College Code\" field.");
    theForm.CollegeCode.focus();
    return (false);
  }

  if (theForm.CollegeCode.value.length < 2)
  {
    alert("Please enter at least 2 characters in the \"College Code\" field.");
    theForm.CollegeCode.focus();
    return (false);
  }

  if (theForm.CollegeCode.value.length > 7)
  {
    alert("Please enter at most 7 characters in the \"College Code\" field.");
    theForm.CollegeCode.focus();
    return (false);
  }
  
  if (theForm.Hous_PKID.selectedIndex < 0)
  {
    alert("Please select one of the \"Prefered Class Location\" options.");
    theForm.Hous_PKID.focus();
    return (false);
  }

  if (theForm.Hous_PKID.selectedIndex == 0)
  {
    alert("The first \"Prefered Class Location\" option is not a valid selection.  Please choose one of the other options.");
    theForm.Hous_PKID.focus();
    return (false);
  }


  if (theForm.Interest1.selectedIndex < 0)
  {
    alert("Please select one of the \"Interest 1\" options.");
    theForm.Interest1.focus();
    return (false);
  }

  if (theForm.Interest1.selectedIndex == 0)
  {
    alert("The first \"Interest 1\" option is not a valid selection.  Please choose one of the other options.");
    theForm.Interest1.focus();
    return (false);
  }

  if (theForm.Term_PKID.selectedIndex < 0)
  {
    alert("Please select one of the \"Entry Term\" options.");
    theForm.Term_PKID.focus();
    return (false);
  }

  if (theForm.Term_PKID.selectedIndex == 0)
  {
    alert("The first \"Entry Term\" option is not a valid selection.  Please choose one of the other options.");
    theForm.Term_PKID.focus();
    return (false);
  }
  return (true);
}
