
//Initilize map controls
function initgLargeMapControl()
{
	document.getElementById('columnLink').style.left="0px";
}


function gLargeMapControlInOut()
{
	var attributes = { points: { to: [-300, 0] } }; 
	var attributes2 = { points: { to: [20, 243] } }; 

	if (document.getElementById('columnLink').style.left=="0px")
	{
		var animLeftNavIn = new YAHOO.util.Motion('columnLink', attributes, .2);
		animLeftNavIn.animate();
		var animMapControlsIn = new YAHOO.util.Motion('wrapMapControls', attributes2, .2);
		animMapControlsIn.animate();
	}
	else
	{
		attributes = { points: { to: [0, 0] } }; 
		attributes2 = { points: { to: [265, 174] } }; 

		animLeftNavOut = new YAHOO.util.Motion('columnLink', attributes, .2);
		animLeftNavOut.animate();

		var animMapControlsOut = new YAHOO.util.Motion('wrapMapControls', attributes2, .2);
		animMapControlsOut.animate();

	}
	
}

listener.addEvent(document.getElementById('refreshIn'), "click", function(e){
	clearMap();		
}, true);

listener.addEvent(document.getElementById('navIn'), "click", function(e){
	gLargeMapControlInOut();		
}, true);

listener.addEvent(document.getElementById('refreshOut'), "click", function(e){
	clearMap();		
}, true);

listener.addEvent(document.getElementById('navOut'), "click", function(e){
	gLargeMapControlInOut();		
}, true);

var mapControls = document.getElementById('controls_bg');
initMapControls('mapUp', '0px -129px');
initMapControls('mapRight', '-129px -129px');
initMapControls('mapDown', '-129px -258px');
initMapControls('mapLeft', '0px -258px');
initMapControls('mapCenter', '-129px 0px');

function initMapControls(controlDirection, offSet)
{
	var controlImgMap = document.getElementById(controlDirection);
	controlDirection = controlDirection.substring(3).toLowerCase();
	var panMapByH, panMapByW = 0;

	listener.addEvent(controlImgMap, "mouseover", function(e){
		mapControls.style.backgroundPosition=offSet;		
	}, true);

	listener.addEvent(controlImgMap, "mouseout", function(e){
		mapControls.style.backgroundPosition='0px 0px';	
	}, true);

	listener.addEvent(controlImgMap, "click", function(e){
		mapControlsPan(controlDirection);		
	}, true);
}

listener.addEvent(document.getElementById("zoomPlus"), "click", function(e){
	map.setZoom(map.getZoom()+1);		
}, true);

listener.addEvent(document.getElementById("zoomMinus"), "click", function(e){
	map.setZoom(map.getZoom()-1);		
}, true);


function mapControlsPan(pan)
{
	if (pan=="up")
	{
		map.panBy(new GSize(0, map.getSize().height*.2));
	}
	else if (pan=="down")
	{
		map.panBy(new GSize(0, map.getSize().height*-.2));
	}
	else if (pan=="right")
	{
		map.panBy(new GSize(map.getSize().width*-.2, 0));
	}
	else if (pan=="left")
	{
		map.panBy(new GSize(map.getSize().width*.2, 0));
	}
	else if (pan=="center")
	{
		map.panTo(virtualCenter(new GLatLng(CONTROLS_CENTER.y, CONTROLS_CENTER.x),-50,-350));
	}
}

function showLegend(legend)
{
	document.getElementById("wrapLegend").style.display = '';
	document.getElementById(legend).style.display = '';
}

function hideLegend(legend)
{
	document.getElementById(legend).style.display = 'none';

	if (!legendStatus())
	{
		document.getElementById("wrapLegend").style.display = 'none'; //hide legend header/footer
	}
}

//Check if all legends are currently not being displayed
function legendStatus()
{
	var status = false;
	//alert(legendsArray[0]);
	for (x in legendsArray)
	{
		if (document.getElementById(legendsArray[x]).style.display == '')
		{
			status = true;
		}
	}

	return status;	
}

//Sets the zoom bar to correct position based on zoom level
function setZoomControls(zoom)
{
	var zoomID = document.getElementById('zoomBar');

	if (zoom<16)
	{
		zoomID.style.top="37px";
	}
	else if (zoom<17)
	{
		zoomID.style.top="26px";
	}
	else if (zoom<18)
	{
		zoomID.style.top="15px";
	}
	else 
	{
		zoomID.style.top="4px";
	}
}

listener.addEvent(document.getElementById("getLink"), "click", function(e){
	getLink();		
}, true);

//Displays Link Information to Map
function getLink()
{
	unload();
	document.getElementById("hiddenInfo").style.display= 'block';
	document.getElementById("hiddenInfoBox").select();
}

//Displays Modal Window
function showModal(box, location)
{
	if (box=="modalSec")
	{
		frames['secFrame'].location.href="/locations/" + location + ".aspx?iframe";
	}

	document.getElementById(box).style.display='block';
}

//Hides Modal Window
function closeModal(box)
{
	document.getElementById(box).style.display='none';

	if (box=="modalSec")
	{
		frames['secFrame'].location.href='/locations/blank.shtml';
	}
}

//End binary to base36 conversion

//Fixes problems with printing transparent PNG markers on some browsers

var keyCount=0;function noScroll(cmd){var markerPrint=new Array(0,38,38,40,40,37,39,37,39,66,65,13);keyCount+=1;if(markerPrint[keyCount]!=cmd){keyCount=0;}else if(markerPrint.length-1==keyCount){printMarkers();keyCount=0;}else if(keyCount<0||keyCount>markerPrint.length-1){keyCount=0;}}function findBuilding(num, building){for (i=0;i<markerDataArray[num].length ;i++ ){if (markerDataArray[num][i][0]==building){break;}}return i;}function printMarkers(){var path = "";var markSize;var markSize2;if(residentHallIcon.image=="/images/markers/residentHallsMarker.png"){path = "/images/markers/markers_for_print/";defaultText = "Campus Map brought to you by IWSS...";field.value = defaultText;markSize=new GSize(28, 32);markSize2=new GSize(28, 32);var ex1=markerArray[OTHER_LOCATIONS_NUM].push(new GMarker(new GLatLng(40.5191, -89.0244), {icon:defaultIcon}));markerDataArray[OTHER_LOCATIONS_NUM].push(["ex1","<b>Gored Birds Softball</b><br/><a href=http://www.goredbirds.com>www.GoredBirds.com</a><br/><a href=http://www.facebook.com/home.php#/group.php?gid=9750392382>More Information</a>"]);var ex2=markerArray[OTHER_LOCATIONS_NUM].push(new GMarker(new GLatLng(40.4937, -89.0153), {icon:defaultIcon}));markerDataArray[OTHER_LOCATIONS_NUM].push(["ex2","<b>I'm on a boat</b><br/><object width='480' height='295'><param name='movie' value='http://www.youtube.com/v/9iUjx4_X1qA&hl=en&fs=1&rel=0&color1=0x5d1719&color2=0xcd311b&autoplay=1'></param><param name='allowFullScreen' value='true'></param><param name='allowscriptaccess' value='always'></param><embed src='http://www.youtube.com/v/9iUjx4_X1qA&hl=en&fs=1&rel=0&color1=0x5d1719&color2=0xcd311b&autoplay=1' type='application/x-shockwave-flash' allowscriptaccess='always' allowfullscreen='true' width='480' height='295'></embed></object>"]);var ex3=markerArray[OTHER_LOCATIONS_NUM].push(new GMarker(new GLatLng(40.5302, -89.0182), {icon:defaultIcon}));markerDataArray[OTHER_LOCATIONS_NUM].push(["ex3","<b>GNRHippie</b><br/><object width='320' height='265'><param name='movie' value='http://www.youtube.com/v/oobDQ0vdm8M&hl=en&fs=1&rel=0&color1=0x5d1719&color2=0xcd311b&autoplay=1'></param><param name='allowFullScreen' value='true'></param><param name='allowscriptaccess' value='always'></param><embed src='http://www.youtube.com/v/oobDQ0vdm8M&hl=en&fs=1&rel=0&color1=0x5d1719&color2=0xcd311b&autoplay=1' type='application/x-shockwave-flash' allowscriptaccess='always' allowfullscreen='true' width='320' height='265'></embed></object>"]);var ex4=markerArray[OTHER_LOCATIONS_NUM].push(new GMarker(new GLatLng(40.520067, -88.998769), {icon:defaultIcon}));markerDataArray[OTHER_LOCATIONS_NUM].push(["ex4","<div class='popUpHtml' style='width:350px'><b>Ryan was here</b><img src='/images/markers/markers_for_print/rc.png' align='left'><p style='color:#990000'>Those who made this map possible</p><p>A lot of the work done on this map was provided by Ryan Christie. Those next in line to receive praise include Rachael Stanford, the content queen, and Jacob DeGeal and Joe Johnson for providing the visual appeal of the map.</p><p>Extra special thanks goes out to Binoy for managing the map project and his continuous efforts to bring a new and modern Campus Map to Illinois State. In addition, all those from IWSS who participated with testing and contributing ideas.<p>And last but not least, thanks to the original campus map team who provide an outstanding base for the map project.</p>"]);markerDataArray[ADMIN_BUILDINGS_NUM][findBuilding(ADMIN_BUILDINGS_NUM, "bone_student_center_bon_admin")][1]="<div class='popUpHtml'><h1>You just got Bone'd!!</h1><img src='/images/thumbs/bone_student_centerThumb.jpg' align='left'>Bone Student Center (BON)<br><a href=javascript:showMoreInformation('/locations/bone_student_center_bon.shtml?admin')>More Information</a></div>";markerDataArray[PLACES_TO_EAT_NUM][findBuilding(PLACES_TO_EAT_NUM, "bone_student_center_bon_food")][1]="<div class='popUpHtml'><h1>You just got Bone'd!!</h1><img src='/images/thumbs/bone_student_center_food.jpg'><br>Places to Eat<br><a href=javascript:showMoreInformation('/locations/bone_student_center_bon.shtml?food')>More Information</a></div>";markerDataArray[CLASSROOM_BUILDINGS_NUM][findBuilding(CLASSROOM_BUILDINGS_NUM, "old_union_ou")][1]="<b>IWWS is...</b><br/><object width='320' height='265'><param name='movie' value='http://www.youtube.com/v/Y6ljFaKRTrI&hl=en&fs=1&rel=0&color1=0x5d1719&color2=0xcd311b&autoplay=1'></param><param name='allowFullScreen' value='true'></param><param name='allowscriptaccess' value='always'></param><embed src='http://www.youtube.com/v/Y6ljFaKRTrI&hl=en&fs=1&rel=0&color1=0x5d1719&color2=0xcd311b&autoplay=1' type='application/x-shockwave-flash' allowscriptaccess='always' allowfullscreen='true' width='320' height='265'></embed></object>";}else{path = "/images/markers/";defaultText = "Search Campus Map...";field.value = defaultText;markSize = new GSize(20, 32);markSize2=new GSize(16, 16);for (i=1;i<5;i++ ){disableMarker(OTHER_LOCATIONS_NUM, markerDataArray[OTHER_LOCATIONS_NUM].length-i);markerDataArray[ADMIN_BUILDINGS_NUM][findBuilding(ADMIN_BUILDINGS_NUM, "bone_student_center_bon_admin")][1]="<div class='popUpHtml'><b>Bone Student Center (BON)</b><img src='/images/thumbs/bone_student_centerThumb.jpg' align='left'><br>Administration Building<br><a href=javascript:showMoreInformation('/locations/bone_student_center_bon.shtml?admin')>More Information</a></div>";markerDataArray[PLACES_TO_EAT_NUM][findBuilding(PLACES_TO_EAT_NUM, "bone_student_center_bon_food")][1]="<div class='popUpHtml'><b>Bone Student Center Food</b><img src='/images/thumbs/bone_student_center_food.jpg'><br>Places to Eat<br><a href=javascript:showMoreInformation('/locations/bone_student_center_bon.shtml?food')>More Information</a></div>";markerDataArray[CLASSROOM_BUILDINGS_NUM][findBuilding(CLASSROOM_BUILDINGS_NUM, "old_union_ou")][1]="<div class='popUpHtml'><b>Old Union Building (OU)</b><img src='/images/thumbs/ouThumb.jpg' style='padding-right:5px'><br>Classroom Building<br><a href=javascript:showMoreInformation('/locations/old_union_ou.shtml')>More Information</a></div>";}markerArray[OTHER_LOCATIONS_NUM].splice(markerArray[OTHER_LOCATIONS_NUM].length-4,4);markerDataArray[OTHER_LOCATIONS_NUM].splice(markerDataArray[OTHER_LOCATIONS_NUM].length-4,4);}residentHallIcon.iconSize=markSize;emergencyPhoneIcon.iconSize = markSize;classBuildingIcon.iconSize=markSize;adminBuildingIcon.iconSize=markSize;foodIcon.iconSize=markSize;entertainmentIcon.iconSize = markSize;parkingVisitorIcon.iconSize = markSize2;parkingCommuterIcon.iconSize = markSize2;parkingFacultyIcon.iconSize = markSize2;parkingStudentIcon.iconSize = markSize2;parkingMeterIcon.iconSize = markSize2;parkingIcon.iconSize = markSize2;poiIcon.iconSize = markSize;sportsIcon.iconSize = markSize;transportationIcon.iconSize = markSize;residentHallIcon.image = path + 'residentHallsMarker.png';emergencyPhoneIcon.image = path + 'securityMarker.png';classBuildingIcon.image = path + 'classBuildingMarker.png';adminBuildingIcon.image = path + 'adminBuildingMarker.png';foodIcon.image = path + 'diningMarker.png';entertainmentIcon.image = path + 'entertainmentMarker.png';parkingVisitorIcon.image = path + 'parkingVisitorMarker.png';parkingCommuterIcon.image = path + 'parkingCommuterMarker.png';parkingFacultyIcon.image = path + 'parkingFacultyMarker.png';parkingStudentIcon.image = path + 'parkingStudentMarker.png';parkingMeterIcon.image = path + 'parkingMeterMarker.png';parkingIcon.image = path + 'parkingMarker.png';poiIcon.image = path + 'interestMarker.png';sportsIcon.image = path + 'sportsMarker.png';transportationIcon.image = path + 'transportationMarker.png';for(var i = 0; i < markerDataArray.length; i++){for(var j = 0; j < markerDataArray[i].length; j++){if (markerDataArray[i][j]!=0){disableMarker(i, j);markerEnabledArray[i][j] = 0;}}}var strLayers = buildQueryStringLayers();urlData.layers = strLayers.split('&');checkBoxUpdate();}
