// JavaScript Document

var selectedInput = null;
$(document).ready(function() {
	
	// Search box bit
	$('input, textarea, select').focus(function() {
		selectedInput = this;
     });
			//Examples of how to assign the ColorBox event to elements
			$("a[rel='example1']").colorbox();
			$("a[rel='example2']").colorbox({transition:"fade"});
			$("a[rel='example3']").colorbox({transition:"none", width:"75%", height:"75%"});
			$("a[rel='example4']").colorbox({slideshow:true});
			$(".single").colorbox({}, function(){
				alert('Howdy, this is an example callback.');
			});
			$(".colorbox").colorbox();
			$(".youtube").colorbox({iframe:true, width:650, height:550});
			$(".iframe").colorbox({width:"550px", height:"450px", iframe:true});
			$(".inline").colorbox({width:"50%", inline:true, href:"#inline_example1"});
			
			//Example of preserving a JavaScript event for inline calls.
			$("#click").click(function(){ 
				$('#click').css({"background-color":"#f00", "color":"#fff", "cursor":"inherit"}).text("Open this window again and this message will still be here.");
				return false;
			});
			
			
			$('.eventscal').cycle({
				fx: 'scrollHorz',
				timeout: 0,
				nowrap: 1,
				next: '#calnextbtn', 
				prev: '#calback'
			});			

			$(".eventscal a[title]").tooltip({ opacity: 0.8, position: "top right", offset: [-12, -6] });
			
			$('.polslide').cycle({
				fx: 'scrollHorz',
				timeout: 0,
				next: '#polslidenextbtn', 
				prev: '#polslidebackbtn'
			});
			
			if(window.location.hash.indexOf('#slide2') > -1){
				$('.polslide').cycle(1); 
				return false; 
			}
			if(window.location.hash.indexOf('#slide3') > -1){
				$('.polslide').cycle(2); 
				return false; 
			}



});

// Search box bit
//$(function() {  
//        $("form input").keypress(function (e) {
//            if (((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13)) && ((selectedInput.id == "ctl00_ctl00_ctl00_ContentPlaceHolderDefault_ChildContent_JobSearchBox_4_tbKeywords") || (selectedInput.id == "ctl00_ctl00_ctl00_ContentPlaceHolderDefault_ChildContent_JobSearchBox_5_tbKeywords") || (selectedInput.id == "ctl00_ctl00_ctl00_ContentPlaceHolderDefault_ChildContent_ctl03_JobSearchForm_5_tbKeywords") || (selectedInput.id == "ctl00_ctl00_ctl00_ContentPlaceHolderDefault_ChildContent_JobSearchBox_6_tbKeywords"))  ) {  
                //alert("keypress");
//				$('input.jobsearchbutton').click();  
//                return false;  
//            } else {  		
//                return true;  
//            }  
//        });
//});  

$(function() {  
        $("form input").keypress(function (e) {
		
            if (((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13)) && ((selectedInput.id == "ctl00_ctl00_ctl00_ContentPlaceHolderDefault_SearchBox_2_searchText") )  ) {  
                //alert("keypress");
				$('input.sitesearchbutton').click();  
                return false;  
            } else {  
			
                return true;  
            }  
        });
});

//png fix
$(function(){
	$('#subnav, #cutoff, img').pngFix();
});


