$(document).ready(function(){


	
	$('.searchBox').focus(function(){  
		if($(this).attr('value') == 'search') $(this).attr('value', '');
	});
	     
	$('.searchBox').blur(function(){  
		if($(this).attr('value') == '') $(this).attr('value', 'search');  
	});
	$('.searchBox').click(function(){
		$(this).select();
	});  

	$('#info-side-closed').click(function(){
		$(this).removeAttr('id', 'info-side-closed');
		$(this).attr('id','info-side-open');
		$('#info-side-open').animate({ width: '560px' });
	});
	$('#info-side-open-close').click(function(){
		$('#info-side-open').css({ width: '41px' });
		$('#info-side-open').attr('id','info-side-closed');
		$('#info-side-open').removeAttr('id','info-side-open');

	});
	$('#container').click(function(){
		$('#info-side-open').css({ width: '41px' });
		$('#info-side-open').attr('id','info-side-closed');
		$('#info-side-open').removeAttr('id','info-side-open');
	});
	
	$('.classpagesbtn').click(function(){
		$('#events').hide();
		$('#classpages').show();
		$('#homecoming').hide();
		return false;
	});
	
	$('.homecomingbtn').click(function(){
		$('#events').hide();
		$('#homecoming').show();
		$('#classpages').hide();
		return false;
	});
	

 $('.confirm_holder').focus(function(){  
	if($(this).attr('value') != '/(confirm e-mail/)') $(this).removeClass('confirm'); 
});

$('.confirm_holder').blur(function(){  
	if($(this).attr('value') == '(confirm e-mail)') $(this).addClass('confirm'); 
});

$('.confirm').click(function(){
	$(this).select();
});

$("input.inputToggle").click(function() {
        if($(this).attr("value")=='yes'){
        $("#overnight").show("slow");
        }else {
        $("#overnight").hide("slow");
        $(".error").hide();
        }
 //for first set of visit options in visit_datails.php
 if($(this).attr("value")=='professor'){
        $("#prof").show("slow");
        $('#otheropt' ).attr('value','');
        $("#majoropt' option[value='select']").attr('selected','selected');

        }else {
        $("#prof").hide("slow");
        }
 if($(this).attr("value")=='classroom'){
        $("#classroom").show("slow");
        $("#visitopt' option[value='select']").attr('selected','selected');
        $('#otheropt' ).attr('value','');

        }else {
        $("#classroom").hide("slow");
        }
 if($(this).attr("value")=='other'){
        $("#other").show("slow");
        $("#visitopt' option[value='select']").attr('selected','selected');
        $("#majoropt' option[value='select']").attr('selected','selected');

        }else {
        $("#other").hide("slow");
        }
   
    
});

function searchNow(){
        //Determine the search term
        var searchFor=document.getElementById('txtSearchTerm').value;
        //Write out the url
        //<! [CDATA[
        document.location.href="http://www.cord.edu/search/?q="+searchFor+"&site=default_collection&client=concordia&output=xml_no_dtd&proxystylesheet=concordia";
        //]]-->
}


$("input.inputToggle2").click(function() {
 if($(this).attr("value")=='professor2'){
        $("#prof2").show("slow");
        $('#otheropt2' ).attr('value','');
        $("#majoropt2' option[value='select']").attr('selected','selected');

        }else {
        $("#prof2").hide("slow");
        }
    
 if($(this).attr("value")=='classroom2'){
        $("#classroom2").show("slow");
        $("#visitopt2' option[value='select']").attr('selected','selected');
        $('#otheropt2' ).attr('value','');

        }else {
        $("#classroom2").hide("slow");
        }
 if($(this).attr("value")=='other2'){
        $("#other2").show("slow");
        $("#visitopt2' option[value='select']").attr('selected','selected');
        $("#majoropt2' option[value='select']").attr('selected','selected');

        }else {
        $("#other2").hide("slow");
        }

    });   


Date.format = 'mm/dd/yyyy';
$(function(){$('.date-pick').datePicker();});


$(document).keyup(function(event) {

     if (event.keyCode == 27) {

        $('.close-popup').hide();
		$('.popup-info').hide('slow');
		$('.prev-date-info').hide('slow');
     }

    }

);
$('.close-popup').click(function(){
	$('.close-popup').hide();
	$('.popup-info').hide('slow');
	$('.prev-date-info').hide('slow');
	$('.present-date-info').hide('slow');
});
$('.select-day-close').click(function(){
	$('.close-popup').hide();
	$('.popup-info').hide('slow');
	$('.prev-date-info').hide('slow');
	$('.present-date-info').hide('slow');
	return false;
});
$('#visit-cal td.valid-date div.visit-image').click(function() {
	$('.prev-date-info').hide();
	$('.present-date-info').hide();
	$('div.close-popup').show();
	$(this).parent().find('div.popup-info').show();
	return false;
});
$('#visit-cal td.prev-date div.visit-image-past').click(function() {
	$('.popup-info').hide();
	$('.present-date-info').hide();
	$('div.close-popup').show();
	$('.prev-date-info').show();
	return false;
});
$('#visit-cal td.prev-date div.visit-image-present').click(function() {
	$('.popup-info').hide();
	$('.prev-date-info').hide();
	$('div.close-popup').show();
	$('.present-date-info').show();
	return false;
});

//$(".error").fadeTo(5000,1).fadeOut(2000);
});

