// hover state for image buttons
function toggle(id, on) {
	var elem = document.getElementById(id);
	
	if(on) {
		elem.src = elem.src.replace(/_off/, "_on");
	} else
		elem.src = elem.src.replace(/_on/, "_off");
}

// redirect top search box to the search page
function searchSite(value) {
    var searchlocation = "/search.aspx";
    if(value != "")
        searchlocation += "?searchtext=" + value;
    
    document.location.href = searchlocation;
    return false;
}

function searchCatalog(value, folderid) {
	var searchlocation = "/searchcatalog.aspx";
    if(value != "")
        searchlocation += "?searchtext=" + value;
	
    if(folderid != "") {
		var join = (value != "") ? "&" : "?";
		searchlocation += join + "folderid=" + folderid
	}
	
    document.location.href = searchlocation;
    return false;
}

function toggleFuller(elementID)
{
	theDiv = document.getElementById(elementID);
	if(theDiv.style.visibility == "visible")
	{
		theDiv.style.visibility = "hidden";
		theDiv.style.display = "none";
	}
	else
	{
		theDiv.style.visibility = "visible";
		theDiv.style.display = "block";
	}
}

function loadGMap() {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map"));
        map.setCenter(new GLatLng(37.4419, -122.1419), 13);
      }
    }




//Function to pop a vimeo video on the screen
//Works only with JQuery

function embedVimeo(vidID) {	

	$(document.body).append('<div id="vidCont"><div id="innerVid"></div></div>');
		$('#vidCont').css({
		'padding':'5px',
		'display':'none',
		'position':'absolute',
		'top':'400px',
		'left':'400px',
		'width':'400px',
		'background-color':'rgb(204, 204, 204)',
		'z-index':'100'
		//'cursor' : 'move'
		});
		//works only with Jquery UI active, doesn't seem to work in CMS
		//$('#vidCont').draggable({ cancel: '#vimeo' });

	var embVid = '<div id="innerVid" ><div style="height:20px;"><img style="float:left;" src="http://www.fuller.edu/uploadedImages/draggable.gif" /><a onclick="$(\'#vidCont\').hide();"><img style="float:right; cursor: pointer;"src="http://www.fuller.edu/uploadedImages/close-button.gif" /></a></div><div id="vimeo"><object width="400" height="300"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=' + vidID + '&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=' + vidID + '&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="300"></embed></object></div><div style="display:none;>text under video</div></div>';

	$('#innerVid').replaceWith(embVid);
	$('#vidCont').show();
	
};

// Used with the Catagory Year Go to dropdown
function goToYear(year) {
	if(year != "") {
		location.href = "/Catalog/" + year + "/welcome.aspx";
	}
}