function getObj(name){if (document.getElementById) {this.obj = document.getElementById(name);this.style = document.getElementById(name).style;} else if (document.all) {this.obj = document.all[name];this.style = document.all[name].style;} else if (document.layers) {this.obj = document.layers[name];this.style = document.layers[name]; }}function feedback_toggle(){	var DHTML = (document.getElementById || document.all || document.layers);if (!DHTML) return;	var x = new getObj("feedback");	var vis = x.style.display;if(vis == "none" || vis == ""){x.style.visibility = "visible";x.style.display = "block";}else{x.style.visibility = "hidden";x.style.display = "none";}}
function trimString(theString) {while (theString.charAt(0) == " ") {theString = theString.substring(1,theString.length);}while (theString.charAt(theString.length - 1) == " ") {theString = theString.substring(0,theString.length - 1);}return theString;}
function checkFeedback(){if ((document.forms["feedback_form"].feedback_text.value.length == 0) || (trimString(document.forms["feedback_form"].feedback_text.value) == 0 )) {alert("Please enter some feedback or a question");	}else{document.forms["feedback_form"].submit();}}
function jumpToQuickLinks(){
	var title=document.searchform.headerQuickLinks.options[document.searchform.headerQuickLinks.selectedIndex].innerHTML;title=title.replace(" ","");
	var destination=document.searchform.headerQuickLinks.options[document.searchform.headerQuickLinks.selectedIndex].value;
	if(destination){
		if ( _gaq != null && typeof(_gaq)=='object'){
			_gaq.push(['_trackPageview', '/outgoing/'+title]);
		}
		/*
		if (typeof(pageTracker)=='object' && pageTracker != null){
			pageTracker._trackPageview('/outgoing/'+title);
		}
		*/
		location.href = destination;
	}
}
function checkEmail(email) {var reEmail=/^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/;if (email.search(reEmail)==-1){return false;}else{return true;}}
function checkUrl(s) {var regexp = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;return regexp.test(s);}
function checkSearch(){var theForm = document.forms["searchform"];if(theForm.q.value.length == 0 || theForm.q.value==theForm.q.defaultValue) {alert("Please enter the words to search for");theForm.q.focus();}else{document.searchform.submit();}}
function changePage(whatForm, scrollingInput, val) {scrollingInput.value = val;var ctnListname = scrollingInput.name.substring(10,scrollingInput.name.length);whatForm.elements['ctnlistpagination_' + ctnListname].value='true';whatForm.submit();}
function IsNumeric(strString){if(!/\D/.test(strString)) {return true;} else if(/^\d+\.\d+$/.test(strString)) {return true;} else return false;}
function checkBookingForm(theForm){var errorStr="";if(trimString(theForm.fullNameOfAttendee.value)==0){errorStr+="- Please enter your name \n"}if(trimString(theForm.emailAddressOfAttendee.value)==0){errorStr+="- Please enter email address \n"}if(!checkEmail(trimString(theForm.emailAddressOfAttendee.value))&&trimString(theForm.emailAddressOfAttendee.value)!=0){errorStr+="- Please enter valid email address \n"}if(trimString(theForm.phoneOfAttendee.value)==0){errorStr+="- Please enter phone number \n"}if(trimString(theForm.numberAttending.value)==0){errorStr+="- Please enter number of persons attending event \n"}if(!IsNumeric(trimString(theForm.numberAttending.value))&&trimString(theForm.numberAttending.value)!=0){errorStr+="- Number of persons attending should be a valid number. Please enter valid number. \n"}if(errorStr==""){return true}else{alert("Error: \n"+errorStr);return false}}
function resize_iframe(){var height=window.innerWidth;if(document.body.clientHeight){height=document.body.clientHeight}document.getElementById("thisIframe").style.height=parseInt(height-document.getElementById("thisIframe").offsetTop-8)+"px"}
function addIframeElement(replaceObjectID,srcVal,widthVal,heightVal,idVal,frameborderVal,scrollingVal,alignVal,className){if(document.getElementById(idVal)){return}var newIframeElement=document.createElement("iframe");newIframeElement.setAttribute("width",widthVal);newIframeElement.setAttribute("height",heightVal);newIframeElement.setAttribute("frameborder",frameborderVal);newIframeElement.setAttribute("scrolling",scrollingVal);newIframeElement.setAttribute("align",alignVal);newIframeElement.setAttribute("id",idVal);newIframeElement.setAttribute("name",idVal);newIframeElement.className=className;var replaceObject=document.getElementById(replaceObjectID);if(replaceObject){replaceObject.parentNode.replaceChild(newIframeElement,replaceObject);top[idVal].location.href=srcVal}top[idVal].name=idVal}
function SearchTools() {}
SearchTools.showHitDetails=function(frameHtmlElementId,labelHtmlElementId,onMsg,offMsg){var htmlEl=document.getElementById(labelHtmlElementId);if(htmlEl){if(!htmlEl.labelMsg){htmlEl.labelMsg="on"}if(htmlEl.labelMsg=="on"){htmlEl.innerHTML=offMsg;htmlEl.labelMsg="off"}else{htmlEl.innerHTML=onMsg;htmlEl.labelMsg="on"}}var frameHtmlEl=document.getElementById(frameHtmlElementId);if(frameHtmlEl){if(htmlEl.labelMsg=="off"){frameHtmlEl.style.display="block"}else{frameHtmlEl.style.display="none"}}}
SearchTools.resetSearchRefine=function(formName){var searchForm=document.forms[formName];searchForm.elements.searchRefineAttribute.value="reset";searchForm.submit()}
var getElementsByClassName=function(className,tag,elm){if(document.getElementsByClassName){getElementsByClassName=function(className,tag,elm){elm=elm||document;var elements=elm.getElementsByClassName(className),nodeName=(tag)?new RegExp("\\b"+tag+"\\b","i"):null,returnElements=[],current;for(var i=0,il=elements.length;i<il;i+=1){current=elements[i];if(!nodeName||nodeName.test(current.nodeName)){returnElements.push(current)}}return returnElements}}else if(document.evaluate){getElementsByClassName=function(className,tag,elm){tag=tag||"*";elm=elm||document;var classes=className.split(" "),classesToCheck="",xhtmlNamespace="http://www.w3.org/1999/xhtml",namespaceResolver=(document.documentElement.namespaceURI===xhtmlNamespace)?xhtmlNamespace:null,returnElements=[],elements,node;for(var j=0,jl=classes.length;j<jl;j+=1){classesToCheck+="[contains(concat(' ', @class, ' '), ' "+classes[j]+" ')]"}try{elements=document.evaluate(".//"+tag+classesToCheck,elm,namespaceResolver,0,null)}catch(e){elements=document.evaluate(".//"+tag+classesToCheck,elm,null,0,null)}while((node=elements.iterateNext())){returnElements.push(node)}return returnElements}}else{getElementsByClassName=function(className,tag,elm){tag=tag||"*";elm=elm||document;var classes=className.split(" "),classesToCheck=[],elements=(tag==="*"&&elm.all)?elm.all:elm.getElementsByTagName(tag),current,returnElements=[],match;for(var k=0,kl=classes.length;k<kl;k+=1){classesToCheck.push(new RegExp("(^|\\s)"+classes[k]+"(\\s|$)"))}for(var l=0,ll=elements.length;l<ll;l+=1){current=elements[l];match=false;for(var m=0,ml=classesToCheck.length;m<ml;m+=1){match=classesToCheck[m].test(current.className);if(!match){break}}if(match){returnElements.push(current)}}return returnElements}}return getElementsByClassName(className,tag,elm)};
function checkHighlight(id){var obj=document.getElementById(id);var items=getElementsByClassName("p","div",obj);if(items.length>=2){for(var i=0;i<items.length;i++){var item=items[i];if(i%3==1&&item.className=="p"){item.className=item.className+" mid"}if(i%3!=1&&item.className=="p mid"){item.className="p"}}}}
function PrintFriendlyPage(){var sOption="toolbar=no,location=no,directories=no,menubar=no,statusbar=no,scrollbars=yes,resizable=yes,width=800, height=600,left=10,top=10";var pFContentHTML=document.getElementById('middleBar').innerHTML;var pfpage=window.open("","",sOption);pfpage.document.open();pfpage.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');pfpage.document.write('<html xmlns="http://www.w3.org/1999/xhtml"><head>');pfpage.document.write('<link type="text/css" rel="stylesheet" href="/global/css/printpage.css"/> ');pfpage.document.write('<link type="text/css" rel="stylesheet" media="print" href="/global/css/printpage.css"/> ');pfpage.document.write('</head><body>');pfpage.document.write(pFContentHTML);pfpage.document.write('</body></html>');pfpage.document.close();pfpage.focus();pfpage.setTimeout("window.print();",400)}
function insertJS(src){var headID = document.getElementsByTagName("head")[0];var newScript = document.createElement('script');newScript.type = 'text/javascript';newScript.src = src;headID.appendChild(newScript);}
function insertCSS(src){var headID = document.getElementsByTagName("head")[0];var cssNode = document.createElement('link');cssNode.type = 'text/css';cssNode.rel = 'stylesheet';cssNode.href = src;cssNode.media = 'screen';headID.appendChild(cssNode);}
/*
 * jqModal - Minimalist Modaling with jQuery
 *   (http://dev.iceburg.net/jquery/jqModal/)
 *
 * Copyright (c) 2007,2008 Brice Burgess <bhb@iceburg.net>
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 * 
 * $Version: 03/01/2009 +r14
 */
(function($){$.fn.jqm=function(o){var p={overlay:50,overlayClass:'jqmOverlay',closeClass:'jqmClose',trigger:'.jqModal',ajax:F,ajaxText:'',target:F,modal:F,toTop:F,onShow:F,onHide:F,onLoad:F};return this.each(function(){if(this._jqm)return H[this._jqm].c=$.extend({},H[this._jqm].c,o);s++;this._jqm=s;H[s]={c:$.extend(p,$.jqm.params,o),a:F,w:$(this).addClass('jqmID'+s),s:s};if(p.trigger)$(this).jqmAddTrigger(p.trigger)})};$.fn.jqmAddClose=function(e){return hs(this,e,'jqmHide')};$.fn.jqmAddTrigger=function(e){return hs(this,e,'jqmShow')};$.fn.jqmShow=function(t){return this.each(function(){t=t||window.event;$.jqm.open(this._jqm,t)})};$.fn.jqmHide=function(t){return this.each(function(){t=t||window.event;$.jqm.close(this._jqm,t)})};$.jqm={hash:{},open:function(s,t){var h=H[s],c=h.c,cc='.'+c.closeClass,z=(parseInt(h.w.css('z-index'))),z=(z>0)?z:3000,o=$('<div></div>').css({height:'100%',width:'100%',position:'fixed',left:0,top:0,'z-index':z-1,opacity:c.overlay/100});if(h.a)return F;h.t=t;h.a=true;h.w.css('z-index',z);if(c.modal){if(!A[0])L('bind');A.push(s)}else if(c.overlay>0)h.w.jqmAddClose(o);else o=F;h.o=(o)?o.addClass(c.overlayClass).prependTo('body'):F;if(ie6){$('html,body').css({height:'100%',width:'100%'});if(o){o=o.css({position:'absolute'})[0];for(var y in{Top:1,Left:1})o.style.setExpression(y.toLowerCase(),"(_=(document.documentElement.scroll"+y+" || document.body.scroll"+y+"))+'px'")}}if(c.ajax){var r=c.target||h.w,u=c.ajax,r=(typeof r=='string')?$(r,h.w):$(r),u=(u.substr(0,1)=='@')?$(t).attr(u.substring(1)):u;r.html(c.ajaxText).load(u,function(){if(c.onLoad)c.onLoad.call(this,h);if(cc)h.w.jqmAddClose($(cc,h.w));e(h)})}else if(cc)h.w.jqmAddClose($(cc,h.w));if(c.toTop&&h.o)h.w.before('<span id="jqmP'+h.w[0]._jqm+'"></span>').insertAfter(h.o);(c.onShow)?c.onShow(h):h.w.show();e(h);return F},close:function(s){var h=H[s];if(!h.a)return F;h.a=F;if(A[0]){A.pop();if(!A[0])L('unbind')}if(h.c.toTop&&h.o)$('#jqmP'+h.w[0]._jqm).after(h.w).remove();if(h.c.onHide)h.c.onHide(h);else{h.w.hide();if(h.o)h.o.remove()}return F},params:{}};var s=0,H=$.jqm.hash,A=[],ie6=$.browser.msie&&($.browser.version=="6.0"),F=false,i=$('<iframe src="javascript:false;document.write(\'\');" class="jqm"></iframe>').css({opacity:0}),e=function(h){if(ie6)if(h.o)h.o.html('<p style="width:100%;height:100%"/>').prepend(i);else if(!$('iframe.jqm',h.w)[0])h.w.prepend(i);f(h)},f=function(h){try{$(':input:visible',h.w)[0].focus()}catch(_){}},L=function(t){$()[t]("keypress",m)[t]("keydown",m)[t]("mousedown",m)},m=function(e){var h=H[A[A.length-1]],r=(!$(e.target).parents('.jqmID'+h.s)[0]);if(r)f(h);return!r},hs=function(w,t,c){return w.each(function(){var s=this._jqm;$(t).each(function(){if(!this[c]){this[c]=[];$(this).click(function(){for(var i in{jqmShow:1,jqmHide:1})for(var s in this[i])if(H[this[i][s]])H[this[i][s]].w[i](this);return F})}this[c].push(s)})})}})(jQuery);


jQuery(function(){
	jQuery('.gallerySelector').bind('change',function(){
		var target = jQuery(this).val();
		var blockId = jQuery(this).attr('blockId');
		jQuery('#media_gallery_block_'+blockId).find('.mediaGalleryContainer').each(function(){
			var thisId = jQuery(this).attr('id');
			if ( thisId == 'media_gallery_'+target )
			{
				jQuery(this).show();
			} else {
				jQuery(this).hide();
			}
		});
	});
});

/*Fix for CMS-245: INC000000240496 - Graduate DB: Search proceeds whether or not checkbox is selected*/
function checkForm() {
    missinginfo = "";

    if (!document.acceptConditionsForm.acceptCheckbox.checked) {
            missinginfo += "Please accept the conditions of use";
            alert(missinginfo);
            return false;
    }
    else {
            return true;
    }
}


