	document.write('<div id="viewlinkbox"></div>');
	var vbtimer;
	var inTouch=false;
	if(typeof(loading)==='undefined'){var loading='';}
	var wind=window.location;
	var mainDomain= "http://admission.wsu.edu/viewbook/";
	if(wind.toString().indexOf('admission.wsu.edu')>0){mainDomain="http://admission.wsu.edu/viewbook/";}
	if(wind.toString().indexOf('about.wsu.edu')>0){mainDomain="http://about.wsu.edu/about/viewbook/";}	

	//alert(mainDomain);
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
// jeremy's utility funtions
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
	function async_load_css(url){var headID = document.getElementsByTagName("head")[0], node = document.createElement('link');node.type = 'text/css';node.rel = 'stylesheet';node.href = url;node.media = 'screen';headID.appendChild(node);}
	function async_load_js(url){
		var headID = document.getElementsByTagName("head")[0]
		var s = document.createElement('script');
		s.type = 'text/javascript';
		s.async = true;
		s.src = url;
		var x = document.getElementsByTagName('script')[0];
		//x.parentNode.insertBefore(s, x);
		headID.appendChild(s);
	}
	function param( name ){name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");var regexS = "[\\?&]"+name+"=([^&#]*)";var regex = new RegExp( regexS );var results = regex.exec( window.location.href );if( results == null ) return false; else return results[1];}
	function isTouch() {if (navigator.userAgent.indexOf('iPad') != -1 || navigator.userAgent.indexOf('iPhone') != -1 || navigator.userAgent.indexOf('Android') != -1 ) {return true;}return false;}
	function isIpad() {if (navigator.userAgent.indexOf('iPad') != -1) {return true;}return false;}
	var timers_arr = new Array(),c=0,t,timer_is_on=0;
	function clearCount(timer){clearTimeout(timers_arr[timer]);timers_arr[''+timer+'']=0;delete timers_arr[''+timer+''];}
	function setCount(timer,time,func){clearCount(timer);if(timers_arr[timer]==0||typeof(timers_arr[timer]) === 'undefined'){timers_arr[timer]=setTimeout(function(){func();},time);}}
//ENDOF
	
	
	function load_ViewBook_base() {
		vbtimer=setCount('vbtimer_jqueryCheck',50,function(){				   
			if(typeof(jQuery) === 'undefined'||typeof($) === 'undefined'){
				load_ViewBook_base();
			}else{
					if(typeof($.ui) === 'undefined' && loading.indexOf('jqueryui') == -1){
						async_load_js('https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.14/jquery-ui.min.js');
						loading=loading+',jqueryui';
						load_ViewBook_base();
					}else{
						if(typeof($.colorbox) === 'undefined'&&loading.indexOf('colorbox') == -1){
							async_load_js('http://images.wsu.edu/javascripts/jquery.colorbox.js');
							loading=loading+',colorbox';
							load_ViewBook_base();
						}else{
							if(typeof(flowplayer) === 'undefined'&&loading.indexOf('flowplayer') == -1){
								async_load_js(mainDomain+'JS/flowplayer-3.2.6.min.js');
								loading=loading+',flowplayer';
								load_ViewBook_base();
							}else{
								if(typeof($.fn.cycle) === 'undefined'&&loading.indexOf('cycle') == -1){
									async_load_js(mainDomain+'JS/cycle.2.9995.js');
									loading=loading+',cycle';
									load_ViewBook_base();
								}else{
									if(
										typeof(flowplayer)!=='undefined'
										&&typeof($.fn.cycle)!=='undefined'
										&&typeof(jQuery)!=='undefined'
										&&typeof($.ui)!=='undefined'
										&&typeof($.colorbox)!=='undefined'
										){
											if($('meta[name=viewport]').length==0 && isIpad()){$('head').append('<meta name="viewport" content="minimum-scale=1.0; maximum-scale=1.0; user-scalable=false; initial-scale=1.0;" />');}
													  
											 if($('.viewbooklink').length==0){
												 $('#viewlinkbox').append("<a href='"+mainDomain+"viewbook.html' class='viewbooklink'  style='background:transparent url("+mainDomain+"images/viewBook_btn.png) no-repeat left top;height:96px;text-indent:-9999px;width:180px;display:block;border: medium none;'>Open our interactive viewbook -- WS&bull;YOU</a>");
											 }
											//async_load_js('https://use.typekit.com/ooz4tkh.js');
											async_load_js(mainDomain+'JS/jquery.mousewheel.min.js');
											async_load_js(mainDomain+'JS/flowplayer.ipad-3.2.2.js');
											async_load_js(mainDomain+'JS/jlb_photogrider.js');
											
											$.fn.preload = function() {
												if($('#preloader').length==0){$('body').append('<div id="preloader" style="position:absolute;top:-9999px;left:-9999px;"></div>')}
												this.each(function(){
													$('#preloader').append('<img src="'+this+'" style="position:absolute;top:-9999px;left:-9999px;"/>');
												});
											}  
											if(param('viewbook')!='true'){
												$([ mainDomain+'images/content_l.jpg',
													mainDomain+'images/scrollbar.png',
													mainDomain+'images/nav.png',
													mainDomain+'images/academic_next-prev.png',
													mainDomain+'images/why_wsu_text_overlay.png',
													mainDomain+'images/money_slide_area.png',
													mainDomain+'images/cricle_nav.png',
													mainDomain+'images/Life-At-WSU/thumb_/060102176_L.jpg',
													mainDomain+'images/Life-At-WSU/thumb_/ButchFlag9660_L.jpg',
													mainDomain+'images/Life-At-WSU/thumb_/Slack_Roping0240_L.jpg',
													mainDomain+'images/Life-At-WSU/thumb_/Parade6707_L.jpg',
													mainDomain+'images/Life-At-WSU/thumb_/090103219_L.jpg',
													mainDomain+'images/Life-At-WSU/thumb_/080102758_L.jpg',
													mainDomain+'images/Life-At-WSU/thumb_/060102176_L.jpg',
													mainDomain+'images/Life-At-WSU/thumb_/090103239_L.jpg',
													mainDomain+'images/Life-At-WSU/thumb_/080502932_L.jpg',
													mainDomain+'images/Life-At-WSU/thumb_/GoCougs4362_L.jpg',
													mainDomain+'images/Life-At-WSU/thumb_/MallConcert7444_L.jpg',
													mainDomain+'images/ws-you_buttons.jpg',
													mainDomain+'images/logo.png'
												]).preload(); 
											}else{
												$([ mainDomain+'images/content_l.jpg',
													mainDomain+'images/scrollbar.png',
													mainDomain+'images/nav.png',
													mainDomain+'images/why_wsu_text_overlay.png'
												]).preload(); 
											}
											async_load_js(mainDomain+'JS/init.js');
											clearCount('vbtimer_jqueryCheck');
									}else{
										load_ViewBook_base();
									}
								}
							}
						}
					}
			}
		});
	}

	async_load_css(mainDomain+'CSS/viewbook.css');



	if((loading.indexOf('jQuery') == -1)&&(typeof(jQuery) === 'undefined'||typeof($) === 'undefined')){
		async_load_js('https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js');
		loading='jQuery';
	}	
	
	load_ViewBook_base();
