/* <![CDATA[ */	
	$(document).ready(function() {	
	$('.searchbtn').hover(
      function(){ // Change the input image's source when we "roll on"
        $(this).attr({ src : '/imgs/img3_1.gif'});		},
      function(){ // Change the input image's source back to the default on "roll off"
        $(this).attr({ src : '/imgs/img3_2.gif'});    }
    );
	/* for focus/blur search fields */
	$('input[type="text"]').addClass("idleField");
       		$('input[type="text"]').focus(function() {
       			$(this).removeClass("idleField").addClass("focusField");
    		    if (this.value == this.defaultValue){ 
    		    	this.value = '';
				}
				if(this.value != this.defaultValue){
	    			this.select();
	    		}
    		});
    		$('input[type="text"]').blur(function() {
    			$(this).removeClass("focusField").addClass("idleField");
    		    if ($.trim(this.value) == ''){
			    	this.value = (this.defaultValue ? this.defaultValue : '');
				}
    		});
	// $("#maincontent li") //add span tags between bullets for easier styling but not needed with bullet image replacement
	// .wrapInner("<span>" + "</span>");
	//$("li").click(function(){
	//$(this).toggleClass("selected"); });
	$('ul > li:first-child').addClass('first');
	$('ul > li:last-child').addClass('last');
	//$('ul.sf-menu').superfish();
	$('ul.sf-menu').superfish({	animation: {opacity:'show',height:'show'},speed: 'fast'});
  $('ul > li:odd').addClass('odd');
  $('ul > li:even').addClass('even');
  $('li').hover(function(){
         $(this).addClass('hover');},
        function() {
         $(this).removeClass('hover');}
          );
  $('table tr:first-child').addClass('first');
  $('table tr:last-child').addClass('last');
  $('table tr:odd').addClass('odd');
  $('table tr:even').addClass('even');
    $('tr').hover(function(){
         $(this).addClass('hover');},
        function() {
         $(this).removeClass('hover');}
          );
		$('.pillarthemes').equalHeights();
		$('.tabcol').equalHeights();	
		$('.topicscol').equalHeights();
		$('.eqcol').equalHeights();
		$('#page').corner("15px cc:#676867 top");
		$('#featurewrap').corner();
		$('#middlewrap').corner();
		$('.pagetabcontain').corner("tr");
		$('.pagetabs > ul > li > a').corner("tl tr 5px");
		//selected tab for init
		//$('.bottomtabs').tabs({ selected: 1 });
		$('.pagetabs').tabs({ cookie: { expires: 365 }});
		$('.bottomtabcontain').corner("tr bottom");
		$('.bottomtabs > ul > li > a').corner("tl tr 5px");
		$('.bottomtabs').tabs({ cookie: { expires: 365 }});	
		$('.child_sidebartabs').tabs();
		$('.child_sidebarcontainer').corner("tr bottom");
		$('.child_sidebartabs > ul > li > a').corner("tl tr 5px cc:#fff");
		});	

/* older js functions from v1 of site */
function valCi() {
   if (document.QForm.SearchString.value == "") {
       alert("Invalid Search");
        }
       else {
        document.QForm.submit();
      }
   }
function increaseFontSize() {
   var p = document.getElementsByTagName('p');
   for(i=0;i<p.length;i++) {
      if(p[i].style.fontSize) {
         var s = parseInt(p[i].style.fontSize.replace("px",""));
      } else {
         var s = 11;
      }
      if(s!=max) {
         s += 1;
      }
      p[i].style.fontSize = s+"px"
   }
}

function decreaseFontSize() {
   var p = document.getElementsByTagName('p');
   for(i=0;i<p.length;i++) {
      if(p[i].style.fontSize) {
         var s = parseInt(p[i].style.fontSize.replace("px",""));
      } else {
         var s = 11;
      }
      if(s!=min) {
         s -= 1;
      }
      p[i].style.fontSize = s+"px"
   }   
}

var buildings = [
  ['OAS Administration Building (ADM)', 38.89246913193413,-77.04308831678645, 4,'<strong>OAS Administration Building (ADM)</strong><br />19th Street and Constitution Ave., N.W., Washington, D.C. 20006, USA'],
  ['The Casita', 38.8933542824528,-77.04152190672175, 5,'<strong>The Casita</strong><br>18th and C Streets, N.W., Washington, D.C. 20006, USA'],
  ['Art Museum of the Americas', 38.89281985327045,-77.04150044904964, 3,'<strong>Art Museum of the Americas</strong><br />201 18th Street, N.W., Washington, D.C. 20006, USA'],
  ['OAS Main Building (MNB)', 38.89280315229372,-77.0398911236407, 2,'<strong>OAS Main Building (MNB)</strong><br />17th Street and Constitution Ave., N.W., Washington, D.C. 20006, USA'],
  ['OAS General Services Building (GSB)', 38.89747927238919,-77.04313123213069, 1,'<strong>OAS General Services Building (GSB)</strong><br />1889 F Street, N.W., Washington, D.C. 20006, USA']
];
var map;
 function initialize() {
    var latlng = new google.maps.LatLng(38.89532495530785, -77.04173648344295);
    var myOptions = {
      zoom: 16,
      center: latlng,
      mapTypeControl: false,
      mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR},
      navigationControl: true,
      navigationControlOptions: {style: google.maps.NavigationControlStyle.DEFAULT},
      mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
    setMarkers(map, buildings);
 }

 function setMarkers(map, locations) {
  for (var i = 0; i < locations.length; i++) {
    var b = locations[i];
    var myLatLng = new google.maps.LatLng(b[1], b[2]); 
    var marker = new google.maps.Marker({
        position: myLatLng,
        map: map,
        title: b[0],
        zIndex: b[3]
    });
    attachMessage(marker,i,b[4]);
  }
 }  
 function attachMessage(marker, number, text) {
  var infowindow = new google.maps.InfoWindow(
      { content: text,
        size: new google.maps.Size(250,50)
      });
  google.maps.event.addListener(marker, 'click', function() {
    infowindow.open(map,marker);
  });
 }


var picnumber = 1;

function startPix(spicname) {
var timeDelay = 3; // change delay time in seconds
timeDelay *= 1500;
setInterval("slideshow('" + spicname + "')", timeDelay);
}

function slideshow(spicname) {
	if (picnumber==4)
	{
		picnumber = 0 ;
	}
	picnumber +=1;	
	document.getElementById('rotatepic').src = '/imgs/' + spicname + picnumber + '.jpg';
}

	/* ]]> */
