﻿function ExportToExcel(tableId, reportDetails) {
    var grid = document.getElementById(tableId);
    if (grid != null) {
    	/*var html = grid.outerHTML;*/
    	// clean the table first, and transform to csv
    	var csv = "";
    	if (reportDetails != null) { // insert any report details at the top, like date report was run, etc. this must be comma delimited
    		csv = reportDetails;
    	}
    	for (i=0;i<grid.rows.length;i++) {
    		for (j=0;j<grid.rows[i].cells.length;j++) {
    			if (isIE()) {
    				if (j==grid.rows[i].cells.length-1) {
    					csv = csv + "\"" + grid.rows[i].cells[j].innerText + "\"";
    				}
    				else {
    					csv = csv + "\"" + grid.rows[i].cells[j].innerText + "\",";
    				}	
    			}
    			else {
    				if (j==grid.rows[i].cells.length-1) {
    					csv = csv + "\"" + grid.rows[i].cells[j].textContent + "\"";
    				}
    				else {
     					csv = csv + "\"" + grid.rows[i].cells[j].textContent + "\",";
     				}
  				}
    		}
    		csv = csv + "\n";
    	}
    	var frmWnd = getIFrameWnd();
    	var txt = frmWnd.document.getElementById("body");
    	txt.value = encodeURI(csv);
    	var frm = frmWnd.document.getElementById("exportForm");
   		frm.submit();
    }
}
function getIFrameWnd(){
    var ifr = document.getElementById("xslFrame");
    if(!ifr) {
      createFrame();
    }           
    var wnd = window.frames["xslFrame"];        
    return wnd;
} 
function createFrame() {
  var frame = document.createElement("iframe");
  frame.name = "xslFrame";
  frame.id = "xslFrame"; 
  document.body.appendChild(frame);
  generateIFrameContent(); 
  frame.style.width = "0px";
  frame.style.height = "0px";
  frame.style.border = "0px";
} 
function generateIFrameContent(){
    var frameWnd = window.frames["xslFrame"];
    var content = "<form id='exportForm' method='post' enctype='application/data' action='http://www.platteriverprogram.org/_layouts/PRRIP/ExportHandler.ashx'><input type='text' id='body' name='body' /></form>";
    frameWnd.document.open();
    frameWnd.document.write(content);
    frameWnd.document.close();
} 
function isIE() 
{
	return /msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent);
}

function UpdatePropertyFilterControl(PropRestValue,InputControl) {
	//var welcomeMenu = $(".ms-globallinks a[id$=_Menu]").text();
	//if (welcomeMenu.toLowerCase().indexOf("welcome") > -1) {
	$("input[name$=" + InputControl + "]").val("");
	$("select[name$=" + InputControl + "]").before("<input name=\"" +  $("select[name$=" + InputControl + "]").attr("name") + "\" id=\"" +  $("select[name$=" + InputControl + "]").attr("id") + "\"  title=\"Enter Search Phrase\" class=\"ms-advsrchPropValue\" type=\"text\" maxLength=\"200\"/>");
	$("select[name$=" + InputControl + "]").remove();
	var siteurl="http://www.platteriverprogram.org";
	var listname = "AdvancedSearchPropertyRestrictions";
	var items = jP.Lists.setSPObject(siteurl,listname).getSPView();
	var fields = jP.Lists.setSPObject(siteurl,listname).getSPListFields();
	for (i=0;i<fields.Schema.length;i++) {
		if (PropRestValue.toLowerCase() == fields.Schema[i].FieldName.toLowerCase()) {
			if (fields.Schema[i].FieldDefault.length > 0) {
				var inputName = $("input[name$=" + InputControl + "]").attr("name");
				var inputID = $("input[name$=" + InputControl + "]").attr("id");
				var fieldValues = fields.Schema[i].FieldDefault;
				var fieldValuesArray = fieldValues.split(";");
				var options = "";
				for (k=0;k<fieldValuesArray.length;k++) {
					options = options.concat("<option value=\"" + fieldValuesArray[k] + "\">" + fieldValuesArray[k] + "</option>");
				}
				// another loop to add options > 255 chars (i.e., "water category 1" field)
				// assumes select list for first set of options < 255 has already been added in previous loop
				for (j=0;j<fields.Schema.length;j++) {
					if (PropRestValue.toLowerCase() + " 1" == fields.Schema[j].FieldName.toLowerCase()) {
						if (fields.Schema[j].FieldDefault.length > 0) {
							var fieldValues = fields.Schema[j].FieldDefault;
							var fieldValuesArray = fieldValues.split(";");
							for (l=0;l<fieldValuesArray.length;l++) {
								options = options.concat("<option value=\"" + fieldValuesArray[l] + "\">" + fieldValuesArray[l] + "</option>");
							}
						}
					}
				}

				$("input[name$=" + InputControl + "]").before("<select name=\"" + inputName + "\" id=\"" + inputID + "\">" + options + "</select>");
				$("input[name$=" + InputControl + "]").remove();
			}
			else {
				$("input[name$=" + InputControl + "]").val("");
				$("select[name$=" + InputControl + "]").before("<input name=\"" +  $("select[name$=" + InputControl + "]").attr("name") + "\" id=\"" +  $("select[name$=" + InputControl + "]").attr("id") + "\"  title=\"Enter Search Phrase\" class=\"ms-advsrchPropValue\" type=\"text\" maxLength=\"200\"/>");
				$("select[name$=" + InputControl + "]").remove();
			}
		}
	}

	//}
}

$(document).ready(function() {
	
	/* GLOBAL NAV - SWAP OUT BLACK DOWN ARROW FOR WHITE */
	$(".ms-globallinks img[src$=menudark.gif]").attr("src","/_layouts/images/whitearrow.gif");
	
	/* GLOBAL NAV - EXPLICIT LOGOUT */
	if ($("menu[id$=PersonalActionMenu]").css("display")=="block") {
		$("#custom-Logout").css("display","block");
	}
	if ($("a[id$=ExplicitLogin]").css("display")=="block") {
		$("#custom-Logout").css("display","none");
	}

	/* TOP NAVIGATION - MAKE SURE CORRECT TOP NAV ITEM IS HIGHLIGHTED */
	/** About the Program **/
	if (location.href.toLowerCase().indexOf("/aboutprrip") > -1) {
		$("#zz1_topNav1n0 table:nth-child(1)").addClass("topNav1Selected");
	}
	/** News and Events **/
	if (location.href.toLowerCase().indexOf("/news") > -1) {
		$("#zz1_topNav1n1 table:nth-child(1)").addClass("topNav1Selected");
	}
	/** Public Involvement **/
	if (location.href.toLowerCase().indexOf("/publicinvolvement") > -1) {
		$("#zz1_topNav1n2 table:nth-child(1)").addClass("topNav1Selected");
	}
	/** Publications and Data **/
	if (location.href.toLowerCase().indexOf("/pubsanddata") > -1) {
		$("#zz1_topNav1n3 table:nth-child(1)").addClass("topNav1Selected");
	}
	/** Contractors **/
	if (location.href.toLowerCase().indexOf("/contractors") > -1) {
		$("#zz1_topNav1n4 table:nth-child(1)").addClass("topNav1Selected");
	}
	
	/* SUB NAVIGATION - MAKE SURE CORRECT SUB NAV ITEM IS HIGHLIGHTED */
	/** Public Calendar **/
	if (location.href.toLowerCase().indexOf("publiccalendar") > -1) {
		$("#zz2_topNav2n0 table:nth-child(1)").addClass("topNav2Selected");
	}
	if (location.href.toLowerCase().indexOf("publiccalendar/allitems.aspx") > -1) {
		$("#zz2_topNav2n0 table:nth-child(1)").removeClass("topNav2Selected");
		$("#zz2_topNav2n4 table:nth-child(1)").addClass("topNav2Selected");
	}
	/** Landowner Acquisition Forms **/	
	if (location.href.toLowerCase().indexOf("laifs") > -1) {
		$("#zz2_topNav2n2 table:nth-child(1)").addClass("topNav2Selected");
	}
	if (location.href.toLowerCase().indexOf("laifs/allitems.aspx") > -1) {
		$("#zz2_topNav2n2 table:nth-child(1)").removeClass("topNav2Selected");
		$("#zz2_topNav2n5 table:nth-child(1)").addClass("topNav2Selected");
	}
	/** Contact Us **/	
	if (location.href.toLowerCase().indexOf("contactus") > -1) {
		$("#zz2_topNav2n3 table:nth-child(1)").addClass("topNav2Selected");
	}
	if (location.href.toLowerCase().indexOf("contactus/allitems.aspx") > -1) {
		$("#zz2_topNav2n3 table:nth-child(1)").removeClass("topNav2Selected");
		$("#zz2_topNav2n6 table:nth-child(1)").addClass("topNav2Selected");
	}
	/** Program Library **/
	if (location.href.toLowerCase().indexOf("/programlibrary") > -1) {
		$("#zz2_topNav2n1 table:nth-child(1)").addClass("topNav2Selected");
	}
	/** Contractor Documents **/	
	if (location.href.toLowerCase().indexOf("/contractor%20documents/forms/rfps.aspx") > -1) {
		$("#zz2_topNav2n0 table:nth-child(1)").addClass("topNav2Selected");
	}	
	if (location.href.toLowerCase().indexOf("/contractor%20documents/forms/bid%20invitations.aspx") > -1) {
		$("#zz2_topNav2n1 table:nth-child(1)").addClass("topNav2Selected");
	}	
	if (location.href.toLowerCase().indexOf("/contractor%20documents/forms/contractor%20prequalifications.aspx") > -1) {
		$("#zz2_topNav2n2 table:nth-child(1)").addClass("topNav2Selected");
	}	
	if (location.href.toLowerCase().indexOf("/contractor%20documents/forms/managecontractordocuments.aspx") > -1) {
		$("#zz2_topNav2n3 table:nth-child(1)").addClass("topNav2Selected");
	}	
	if (location.href.toLowerCase().indexOf("/rfpnotifications/allitems.aspx") > -1) {
		$("#zz2_topNav2n4 table:nth-child(1)").addClass("topNav2Selected");
	}	
	if (location.href.toLowerCase().indexOf("/biddinginvitenotifications/allitems.aspx") > -1) {
		$("#zz2_topNav2n5 table:nth-child(1)").addClass("topNav2Selected");
	}	
		
	/* TOP NAVIGATION - SELECTED ITEM FIX FOR FIREFOX */
	$("table[class*=topNav1Selected]").parents("td:first").css("background-image","url('/_layouts/PRRIP_Images/PRRIP_Selected_Nav_Left.jpg')");
	
	/* TOP NAVIGATION - MAKE ENTIRE HOVER CLICKABLE */
	$("a[class*=topNavFlyOutsItem]").parent().click(function() { 
		var navlink = $(this).children("a").attr("href");
		location.href=navlink;
	});
	
	/* SEARCH AREA */
	$(".search span[title=Search]").addClass("searchDropDownText");
	$(".search select[name$=SBScopesDDL]").addClass("searchDropDownList");
	$(".search span[title=For]").addClass("searchTermText");
	$(".search input[name$=InputKeywords]").addClass("searchTermTextbox");
	$(".search img[title=Go Search]").addClass("searchButton");
	
	/* REMOVE CONTEXTUAL SEARCH SCOPES */
	$("select[name$=SBScopesDDL] option[value*=This]").remove();
	
	/* SEARCH RESULTS */
	if (location.href.toLowerCase().indexOf("/pubsanddata/pages/results.aspx") > -1) {
		$(".srch-Description").each(function() {
			if ($(this).html().toLowerCase().indexOf("<p class=srch-metadata>") > -1) {
				var nested = $(this).html();
				$(this).before(nested);
				$(this).remove();
			}
		});
	}
	
	/* LOGIN */
	$("a[id$=ExplicitLogin]").addClass("signIn");
	$("label[for$=UserName]").parents("table:first").addClass("loginBox");
	$("label[for$=UserName]").addClass("loginUsernameLabel");
	$("label[for$=Password]").addClass("loginPasswordLabel");
	$("label[for$=RememberMe]").addClass("loginRememberMeLabel");
	$("input[name$=UserName]").addClass("loginUsernameTextbox");
	$("input[name$=Password]").addClass("loginPasswordTextbox");
	$("input[name$=RememberMe]").addClass("loginRememberMeCheckbox");
	$("input[name$=RememberMe]").attr("checked",true);
	$("input[name$=RememberMe]").css("display","none");		
	$("label[for$=RememberMe]").css("display","none");
	$("input[name$=LoginImageButton]").addClass("loginImageButton");
	$("input[name$=LoginButton]").addClass("loginButton");
	$("a[id$=CreateUserLink]").addClass("resetPasswordLink");

	
	/* CHANGE PASSWORD */
	if (location.href.toLowerCase().indexOf("_layouts/userdisp.aspx") > -1) {
		var changePasswordLink = "<div class=\"prrip-separator\" style=\"color: #83b0ec; font-size: 10pt; display: inline;\" > | </div><a href=\"/Custom%20FBA%20User%20Management/FBAPasswordChange.aspx\">Change My Password</a>";
		$("table[class=ms-toolbar] td:last").html(changePasswordLink);
	}
	if (location.href.toLowerCase().indexOf("fbapasswordchange.aspx") > -1) {
		$(".loginBox tr:nth-child(2) td:nth-child(1)").addClass("loginBoxInstructions");
		$("input[name$=ContinuePushButton]").before("<input name=\"CustomContinueButton\" id=\"CustomContinueButton\" type=\"button\" value=\"Continue\" onclick=\"javascript:location.href='http://www.platteriverprogram.org';\" />");
		$("input[name$=ContinuePushButton]").css("display","none");
	}
	
	/* RESET PASSWORD */
	if (location.href.toLowerCase().indexOf("fbapasswordreset.aspx") > -1) {
		$(".loginBox tr:nth-child(2) td:nth-child(1)").addClass("loginBoxInstructions");
		$("input[name$=SubmitButton]").addClass("resetButton");
	}

	/* RECOVER PASSWORD */
	if (location.href.toLowerCase().indexOf("passwordrecovery.aspx") > -1) {
		$("table.loginBox").addClass("recoveryBox");
		$(".recoveryBox tr:nth-child(2) td:nth-child(1)").addClass("loginBoxInstructions");
		$("input[name$=SubmitButton]").addClass("recoverButton");
	}
	
	/* REMOVE LINKS FROM PAGE TITLES (FOUND ON NEW FORM PAGES) */
	$("div[class=pageTitle]").html($("div[class=pageTitle]").text())
	
	/* CONTACT US PAGE */
	if (location.href.toLowerCase().indexOf("/lists/contactus/newform.aspx") > -1) {
		$("div[class=pageTitle]").html($("div[class=pageTitle]").text().replace(": New Item",""))
		$("a[id=topOfPage]").focus();
	}	

	/* PROGRAM INFORMATION PAGE */
	if (location.href.toLowerCase().indexOf("programinformation.aspx") > -1) {
		$(".ms-WPTitle nobr").css("white-space","nowrap");
	}	

	/* PUBLIC INVOLVEMENT PAGE */
	if (location.href.toLowerCase().indexOf("/publicinvolvement/pages/default.aspx") > -1) {
		$("#OuterRightCellL2 tr:nth-child(1) td:nth-child(1) .ms-PartSpacingVertical").css("display","none");
	}	

	/* VISIT PLATTE PAGE */
	if (location.href.toLowerCase().indexOf("/publicinvolvement/pages/visitplatte.aspx") > -1) {
		$(".groupheader").css("display","none");
		$("a[href=http://www.rowesanctuary.org]").attr("target","_blank");
	}	

	/* NEWS AND EVENTS PAGE */
	if (location.href.toLowerCase().indexOf("/news/pages/default.aspx") > -1) {
		/*$("table[xmlns:twip$=ThisWeekInPicturesWebPart] .ms-addnew").css("display","none");
		$("table[xmlns:twip$=ThisWeekInPicturesWebPart] .ms-partline").css("display","none");*/
	}	

	/* WATER PLAN PAGE */
	if (location.href.toLowerCase().indexOf("/aboutprrip/pages/waterplan.aspx") > -1) {
		$(".ms-PartSpacingVertical").css("margin-top","0px");
	}	

	/* LAND PLAN PAGE */
	if (location.href.toLowerCase().indexOf("/aboutprrip/pages/landplan.aspx") > -1) {
		$(".ms-PartSpacingVertical").css("margin-top","0px");
	}	

	/* ADAPTIVE MANAGEMENT PAGE */
	if (location.href.toLowerCase().indexOf("/aboutprrip/pages/adaptivemanagement.aspx") > -1) {
		$(".ms-PartSpacingVertical").css("margin-top","0px");
	}	

	/* ADVANCED SEARCH PAGE */
	if (location.href.toLowerCase().indexOf("/pubsanddata/pages/advanced.aspx") > -1) {
		$("select[name$=ASB_PS_plb_0]").val("(Pick Property)");
		$("select[name$=ASB_PS_plb_1]").val("(Pick Property)");
		$("select[name$=ASB_PS_plb_2]").val("(Pick Property)");
		$("select[name$=ASB_PS_plb_3]").val("(Pick Property)");
		$("select[name$=ASB_PS_plb_4]").val("(Pick Property)");
		
		$("select[name$=ASB_PS_plb_0]").change(function() {
			UpdatePropertyFilterControl($("select[name$=ASB_PS_plb_0] option:selected").text(),"ASB_PS_pvtb_0");
		})
		$("select[name$=ASB_PS_plb_1]").change(function() {
			UpdatePropertyFilterControl($("select[name$=ASB_PS_plb_1] option:selected").text(),"ASB_PS_pvtb_1");
		})
		$("select[name$=ASB_PS_plb_2]").change(function() {
			UpdatePropertyFilterControl($("select[name$=ASB_PS_plb_2] option:selected").text(),"ASB_PS_pvtb_2");
		})
		$("select[name$=ASB_PS_plb_3]").change(function() {
			UpdatePropertyFilterControl($("select[name$=ASB_PS_plb_3] option:selected").text(),"ASB_PS_pvtb_3");
		})
		$("select[name$=ASB_PS_plb_4]").change(function() {
			UpdatePropertyFilterControl($("select[name$=ASB_PS_plb_4] option:selected").text(),"ASB_PS_pvtb_4");
		})
				    
     }
     
     /* CALENDAR DISPLAY PAGE AND ALL DAY EVENTS */
	if (location.href.toLowerCase().indexOf("/calendar/dispform.aspx") > -1) {
		if ($("#SPFieldAllDayEvent").text().toLowerCase().indexOf("yes") > -1) {
			$("a[name=SPBookmark_EventDate]").parent().parent().next().text($("a[name=SPBookmark_EventDate]").parent().parent().next().text().replace("12:00 AM",""));
			$("a[name=SPBookmark_EndDate]").parent().parent().next().text($("a[name=SPBookmark_EndDate]").parent().parent().next().text().replace("11:59 PM",""));
		}
	}

	/* SIGN IN PAGE */
	if (location.href.toLowerCase().indexOf("_layouts/login.aspx") > -1) {
		$("input[name$=RememberMe]").attr("checked",true);
		$("input[name$=RememberMe]").css("display","none");
		$("label[for$=RememberMe]").css("display","none");
		$("body").addClass("body");
		$("body").css("text-align","center");
		$("table[class=ms-main]").wrap("<table class=\"master\" cellspacing=\"0\" cellpadding=\"0\"><tr><td vAlign=\"top\" id=\"masterContentContainer\"></td></tr></table>");
		$("table[class=ms-main]").removeClass("ms-main").addClass("masterContent");
		$("td[id=masterContentContainer]").before("<td height=\"100%\" class=\"shadowLeft\"><div class=\"spacer\"></div></td>");
		$("td[id=masterContentContainer]").after("<td height=\"100%\" class=\"shadowRight\"><div class=\"spacer\"></div></td>");
		$("td[class=ms-globalbreadcrumb]").removeClass("ms-globalbreadcrumb").addClass("authoringRegion");
		$("td[class=ms-globalTitleArea]").removeClass("ms-globalTitleArea").addClass("bannerArea");
		$("td[id=GlobalTitleAreaImage]").css("display","none");
		$("td[id=onetIdTopNavBarContainer]").css("display","none");
		$(".ms-titlearealeft").css("background-image","none");
		$(".ms-titlearealeft").css("background-color","#FFFFFF");
		$(".ms-titleareaframe").css("background-image","none");
		$(".ms-titleareaframe").css("background-color","#FFFFFF");
		$(".ms-areaseparator").css("background-image","none");
		$(".ms-areaseparator").css("background-color","#FFFFFF");
		$(".ms-areaseparator").css("border","none");
		$(".ms-areaseparator").css("height","50px");
		$(".ms-titlearearight").css("background-image","none");
		$(".ms-titlearearight").css("background-color","#FFFFFF");
		$(".ms-leftareacell").css("background-image","none");
		$(".ms-leftareacell").css("background-color","#FFFFFF");
		$(".ms-nav").css("background-image","none");
		$(".ms-nav").css("background-color","#FFFFFF");
		$(".ms-areaseparatorleft").css("background-image","none");
		$(".ms-areaseparatorleft").css("background-color","#FFFFFF");
		$(".ms-areaseparatorleft").css("border","none");
		$(".ms-rightareacell").css("background-image","none");
		$(".ms-rightareacell").css("background-color","#FFFFFF");
		$(".ms-areaseparatorright").css("background-image","none");
		$(".ms-areaseparatorright").css("background-color","#FFFFFF");
		$(".ms-areaseparatorright").css("border","none");
		$(".ms-pagebottommarginleft").css("background-color","#FFFFFF");
		$(".ms-pagebottommargin").css("background-color","#FFFFFF");
		$(".ms-bodyareapagemargin").css("background-color","#FFFFFF");
		$(".ms-bodyareapagemargin").css("border","none");
		$(".ms-pagebottommarginright").css("background-color","#FFFFFF");
		$(".ms-pagetitle").css("color","#1873a0");
		$(".ms-pagetitle").css("font-size","16px");	
		$(".ms-pagetitle").css("font-weight","bold");	
		$(".ms-input").css("width","300px");
		$(".ms-input col:nth-child(1)").css("width","35%");
		$(".ms-input col:nth-child(2)").css("width","65%");
		$(".ms-input tr:nth-child(1) td:nth-child(1)").text("Username:");
		$("input[name$=password]").addClass("loginPasswordTextbox");
		$("input[name$=login]").css("margin-right","58");
		$(".ms-input tr:nth-child(4)").after("<tr><td colspan=\"2\"><a href=\"/Pages/PasswordRecovery.aspx\" class=\"resetPasswordLinkNoFloat\" target=\"_blank\">Recover My Password</a></td></tr>");
	}
	
	/* INTRANET PAGES */
	if (location.href.toLowerCase().indexOf("/intranet") > -1) {
		/* REMOVE WORKSPACES FROM CALENDAR FORMS */
		if (location.href.toLowerCase().indexOf("calendar/dispform.aspx") > -1) {
			$("a[name$=WorkspaceLink]").parent().parent().parent().css("display","none");
		}
		if (location.href.toLowerCase().indexOf("calendar/editform.aspx") > -1) {
			$("h3").each(function() {
				if ($(this).html().toLowerCase().indexOf("workspace") > -1) {
					$(this).parent().parent().css("display","none");
				}
			});
		}
		if (location.href.toLowerCase().indexOf("calendar/newform.aspx") > -1) {
			$("h3").each(function() {
				if ($(this).html().toLowerCase().indexOf("workspace") > -1) {
					$(this).parent().parent().css("display","none");
				}
			});
		}
		
		/* REMOVE "The internal site for PRRIP Members." FROM  HOW-TO PAGES */
		if (location.href.toLowerCase().indexOf("/howtos") > -1) {
			$(".ms-bodyareaframe").html($(".ms-bodyareaframe").html().replace("The internal site for PRRIP Members.",""));
		}
	}
	

	/* MAP VIEWERS */
	/*if (location.href.toLowerCase().indexOf("/pubsanddata/pages/mapviewer.aspx") > -1) {
		$(".prrip-legend-item:first").before("<div id=\"prrip-instructions\" style=\"width: 228px;\">To show/hide one or more survey data<br />locations on the map, check/uncheck<br />its corresponding checkbox.<br /><br />Click on a survey data location (its row<br />will become higlighted), then click on a<br />location on the map to view its data. If<br />no data is returned, then nothing is<br />available at this time.<br /><br />* Requires a zoom level of 9 or less.<br />** Requires a zoom level of 5 or less.<br /><br /><div style=\"font-weight: bold; font-size: 14px; \">Survey Data Locations</div></div>");
	}*/
	if (location.href.toLowerCase().indexOf("/pubsanddata/pages/riverflowdata.aspx") > -1) {
		$("h1").css("padding-bottom","15px");
		/*$(".prrip-legend-item:first").before("<div id=\"prrip-instructions\" style=\"width: 228px;\">Click on a stream gage on the map or<br />in the list below to view its data. If no<br />data is returned, then nothing is<br />available at this time.<br /><br />Stream gage data includes the last 8<br />weeks of data, all in cubic feet per<br />second (CFS).<br /><br /><div style=\"font-weight: bold; font-size: 14px; \">Stream Gage Locations</div></div>");*/
		$("#custom-DataViewerInfo").addClass("custom-programRiverMapInfo");
		$("#custom-DataViewerData").addClass("custom-programRiverMapData");
	}
	if (location.href.toLowerCase().indexOf("/intranet/programdata/pages/mapviewer.aspx") > -1) {
		$("#custom-DataViewerInfo").addClass("custom-programSentryMapInfo");
		$("#custom-DataViewerData").addClass("custom-programSentryMapData");
		$("#custom-DataViewerInfo").css("padding-left","11px");
		$("#custom-DataViewerInfo").css("width","246px");
	}
	
	/* HIDE/DISPLAY FORM FIELDS FOR MAPMARKER LAYERS LIST */ 
	if ($("select[title=Coordinate System]").val() != null) {
	
	    if ($("select[title=Coordinate System]").val().toLowerCase().indexOf("utm") < 0) {
	    	$("input[title=UTM Zone]").parent().parent().parent().css("display","none"); 
	    }
	    if ($("select[title=Data Source]").val().toLowerCase().indexOf("georss") < 0 && $("select[title=Data Source]").val().toLowerCase().indexOf("kml") < 0) {
	    	$("input[title=XML Location]").parent().parent().parent().css("display","none"); 
	    }
	    if ($("select[title=Data Source]").val().toLowerCase().indexOf("custom") < 0) {
	    	$("input[title=Custom JavaScript URL]").parent().parent().parent().css("display","none"); 
	    }
	    if ($("select[title=Data Source]").val().toLowerCase().indexOf("sql") < 0) {
	    	$("input[title=SQL Connection String]").parent().parent().parent().css("display","none"); 
	    	$("input[title=SQL Stored Procedure]").parent().parent().parent().css("display","none"); 
	    }
	    if ($("select[title=Data Source]").val().toLowerCase().indexOf("sharepoint") < 0) {
	    	$("input[title=SharePoint Geo Data List Name]").parent().parent().parent().css("display","none"); 
	    	$("input[title=SharePoint UTMy/Latitude Field Name]").parent().parent().parent().css("display","none"); 
	    	$("input[title=SharePoint UTMx/Longitude Field Name]").parent().parent().parent().css("display","none"); 
	    }
	    if ($("select[title=Data Source]").val().toLowerCase().indexOf("sql") < 0 && $("select[title=Data Source]").val().toLowerCase().indexOf("sharepoint") < 0) {
	    	$("input[title=Title Field]").parent().parent().parent().css("display","none"); 
	    	$("input[title=Description Field]").parent().parent().parent().css("display","none");  
	    }   
	    if ($("select[title=Data Source]").val().toLowerCase().indexOf("geoserver") < 0) {
	    	$("input[title=GeoServer Layer ID]").parent().parent().parent().css("display","none"); 
	   	 	$("input[title=GeoServer Layer Name]").parent().parent().parent().css("display","none"); 
	    	$("input[title=GeoServer Service URL]").parent().parent().parent().css("display","none"); 
	    	$("input[title=GeoServer Opacity]").parent().parent().parent().css("display","none"); 
	    }
		
		
		$("select[title=Coordinate System]").change(function() {
	    	if ($(this).val().toLowerCase().indexOf("utm") > -1) {
	    		$("input[title=UTM Zone]").parent().parent().parent().css("display","block"); 
	    	}
			else if ($(this).val().toLowerCase().indexOf("latlng") > -1) {
	    		$("input[title=UTM Zone]").parent().parent().parent().css("display","none"); 
			}
	    });
	    
	    $("select[title=Data Source]").change(function() {
	    	if ($(this).val().toLowerCase().indexOf("custom") > -1) {
				$("input[title=XML Location]").parent().parent().parent().css("display","none"); 
				$("input[title=Custom JavaScript URL]").parent().parent().parent().css("display","block"); 
				$("input[title=SQL Connection String]").parent().parent().parent().css("display","none"); 
				$("input[title=SQL Stored Procedure]").parent().parent().parent().css("display","none"); 
				$("input[title=SharePoint Geo Data List Name]").parent().parent().parent().css("display","none"); 
				$("input[title=SharePoint UTMy/Latitude Field Name]").parent().parent().parent().css("display","none"); 
				$("input[title=SharePoint UTMx/Longitude Field Name]").parent().parent().parent().css("display","none"); 
				$("input[title=Title Field]").parent().parent().parent().css("display","none"); 
				$("input[title=Description Field]").parent().parent().parent().css("display","none");     
				$("input[title=GeoServer Layer ID]").parent().parent().parent().css("display","none"); 
				$("input[title=GeoServer Layer Name]").parent().parent().parent().css("display","none"); 
				$("input[title=GeoServer Service URL]").parent().parent().parent().css("display","none"); 
				$("input[title=GeoServer Opacity]").parent().parent().parent().css("display","none"); 
	    	}
	    	if ($(this).val().toLowerCase().indexOf("georss") > -1) {
				$("input[title=XML Location]").parent().parent().parent().css("display","block"); 
				$("input[title=Custom JavaScript URL]").parent().parent().parent().css("display","none"); 
				$("input[title=SQL Connection String]").parent().parent().parent().css("display","none"); 
				$("input[title=SQL Stored Procedure]").parent().parent().parent().css("display","none"); 
				$("input[title=SharePoint Geo Data List Name]").parent().parent().parent().css("display","none"); 
				$("input[title=SharePoint UTMy/Latitude Field Name]").parent().parent().parent().css("display","none"); 
				$("input[title=SharePoint UTMx/Longitude Field Name]").parent().parent().parent().css("display","none"); 
				$("input[title=Title Field]").parent().parent().parent().css("display","none"); 
				$("input[title=Description Field]").parent().parent().parent().css("display","none");     
				$("input[title=GeoServer Layer ID]").parent().parent().parent().css("display","none"); 
				$("input[title=GeoServer Layer Name]").parent().parent().parent().css("display","none"); 
				$("input[title=GeoServer Service URL]").parent().parent().parent().css("display","none"); 
				$("input[title=GeoServer Opacity]").parent().parent().parent().css("display","none"); 
	    	}
			else if ($(this).val().toLowerCase().indexOf("geoserver") > -1) {
				$("input[title=XML Location]").parent().parent().parent().css("display","none"); 
				$("input[title=Custom JavaScript URL]").parent().parent().parent().css("display","none"); 
				$("input[title=SQL Connection String]").parent().parent().parent().css("display","none"); 
				$("input[title=SQL Stored Procedure]").parent().parent().parent().css("display","none"); 
				$("input[title=SharePoint Geo Data List Name]").parent().parent().parent().css("display","none"); 
				$("input[title=SharePoint UTMy/Latitude Field Name]").parent().parent().parent().css("display","none"); 
				$("input[title=SharePoint UTMx/Longitude Field Name]").parent().parent().parent().css("display","none"); 
				$("input[title=Title Field]").parent().parent().parent().css("display","none"); 
				$("input[title=Description Field]").parent().parent().parent().css("display","none");     
				$("input[title=GeoServer Layer ID]").parent().parent().parent().css("display","block"); 
				$("input[title=GeoServer Layer Name]").parent().parent().parent().css("display","block"); 
				$("input[title=GeoServer Service URL]").parent().parent().parent().css("display","block"); 
				$("input[title=GeoServer Opacity]").parent().parent().parent().css("display","block"); 
			}
			else if ($(this).val().toLowerCase().indexOf("kml") > -1) {
				$("input[title=XML Location]").parent().parent().parent().css("display","block"); 
				$("input[title=Custom JavaScript URL]").parent().parent().parent().css("display","none"); 
				$("input[title=SQL Connection String]").parent().parent().parent().css("display","none"); 
				$("input[title=SQL Stored Procedure]").parent().parent().parent().css("display","none"); 
				$("input[title=SharePoint Geo Data List Name]").parent().parent().parent().css("display","none"); 
				$("input[title=SharePoint UTMy/Latitude Field Name]").parent().parent().parent().css("display","none"); 
				$("input[title=SharePoint UTMx/Longitude Field Name]").parent().parent().parent().css("display","none"); 
				$("input[title=Title Field]").parent().parent().parent().css("display","none"); 
				$("input[title=Description Field]").parent().parent().parent().css("display","none");     
				$("input[title=GeoServer Layer ID]").parent().parent().parent().css("display","none"); 
				$("input[title=GeoServer Layer Name]").parent().parent().parent().css("display","none"); 
				$("input[title=GeoServer Service URL]").parent().parent().parent().css("display","none"); 
				$("input[title=GeoServer Opacity]").parent().parent().parent().css("display","none"); 
			}
			else if ($(this).val().toLowerCase().indexOf("sharepoint") > -1) {
				$("input[title=XML Location]").parent().parent().parent().css("display","none"); 
				$("input[title=Custom JavaScript URL]").parent().parent().parent().css("display","none"); 
				$("input[title=SQL Connection String]").parent().parent().parent().css("display","none"); 
				$("input[title=SQL Stored Procedure]").parent().parent().parent().css("display","none"); 
				$("input[title=SharePoint Geo Data List Name]").parent().parent().parent().css("display","block"); 
				$("input[title=SharePoint UTMy/Latitude Field Name]").parent().parent().parent().css("display","block"); 
				$("input[title=SharePoint UTMx/Longitude Field Name]").parent().parent().parent().css("display","block"); 
				$("input[title=Title Field]").parent().parent().parent().css("display","block"); 
				$("input[title=Description Field]").parent().parent().parent().css("display","block");     
				$("input[title=GeoServer Layer ID]").parent().parent().parent().css("display","none"); 
				$("input[title=GeoServer Layer Name]").parent().parent().parent().css("display","none"); 
				$("input[title=GeoServer Service URL]").parent().parent().parent().css("display","none"); 
				$("input[title=GeoServer Opacity]").parent().parent().parent().css("display","none"); 
			}
			else if ($(this).val().toLowerCase().indexOf("sql") > -1) {
				$("input[title=XML Location]").parent().parent().parent().css("display","none"); 
				$("input[title=Custom JavaScript URL]").parent().parent().parent().css("display","none"); 
				$("input[title=SQL Connection String]").parent().parent().parent().css("display","block"); 
				$("input[title=SQL Stored Procedure]").parent().parent().parent().css("display","block"); 
				$("input[title=SharePoint Geo Data List Name]").parent().parent().parent().css("display","none"); 
				$("input[title=SharePoint UTMy/Latitude Field Name]").parent().parent().parent().css("display","none"); 
				$("input[title=SharePoint UTMx/Longitude Field Name]").parent().parent().parent().css("display","none"); 
				$("input[title=Title Field]").parent().parent().parent().css("display","block"); 
				$("input[title=Description Field]").parent().parent().parent().css("display","block");     
				$("input[title=GeoServer Layer ID]").parent().parent().parent().css("display","none"); 
				$("input[title=GeoServer Layer Name]").parent().parent().parent().css("display","none"); 
				$("input[title=GeoServer Service URL]").parent().parent().parent().css("display","none"); 
				$("input[title=GeoServer Opacity]").parent().parent().parent().css("display","none"); 
			}
	    });
    }


	/* TITLE FIELD EDIT MENU */
	if ((location.href.toLowerCase().indexOf("pubsanddata/programlibrary/forms") > -1) || (location.href.toLowerCase().indexOf("intranet") > -1 && location.href.toLowerCase().indexOf("/forms/allitems.aspx") > -1)) {
		var isFormattedCorrectly = false;
		
		if (isIE()) {
			if ($("#onetidDoclibViewTbl0 tr.ms-viewheadertr td").hasClass("ms-vh-group")) { // list is grouped
				var colOneText = $("#onetidDoclibViewTbl0 tr.ms-viewheadertr th:nth-child(3)").text();
				var colTwoText = $("#onetidDoclibViewTbl0 tr.ms-viewheadertr th:nth-child(4)").text();
				var colThreeText = $("#onetidDoclibViewTbl0 tr.ms-viewheadertr th:nth-child(5)").text();
			}
			else {
				var colOneText = $("#onetidDoclibViewTbl0 tr.ms-viewheadertr th:nth-child(2)").text();
				var colTwoText = $("#onetidDoclibViewTbl0 tr.ms-viewheadertr th:nth-child(3)").text();
				var colThreeText = $("#onetidDoclibViewTbl0 tr.ms-viewheadertr th:nth-child(4)").text();
			}
			if (colOneText.toLowerCase().indexOf("type") > -1 && colTwoText.toLowerCase().indexOf("name") > -1 && colThreeText.toLowerCase().indexOf("title") > -1) {
				isFormattedCorrectly = true;
			}
			
		}
		else {
			if ($("#onetidDoclibViewTbl0 tr.ms-viewheadertr td").hasClass("ms-vh-group")) { // list is grouped
				var colOneText = $("#onetidDoclibViewTbl0 tr.ms-viewheadertr th:nth-child(2)").text();
				var colTwoText = $("#onetidDoclibViewTbl0 tr.ms-viewheadertr th:nth-child(3)").text();
				var colThreeText = $("#onetidDoclibViewTbl0 tr.ms-viewheadertr th:nth-child(4)").text();
			}
			else {
				var colOneText = $("#onetidDoclibViewTbl0 tr.ms-viewheadertr th:nth-child(1)").text();
				var colTwoText = $("#onetidDoclibViewTbl0 tr.ms-viewheadertr th:nth-child(2)").text();
				var colThreeText = $("#onetidDoclibViewTbl0 tr.ms-viewheadertr th:nth-child(3)").text();
			}
			if (colOneText.toLowerCase().indexOf("type") > -1 && colTwoText.toLowerCase().indexOf("name") > -1 && colThreeText.toLowerCase().indexOf("title") > -1) {
				isFormattedCorrectly = true;
			}
		}
		
		if (isFormattedCorrectly) { // make sure the doc lib's first 3 columns are type/name/title
			if ($("#onetidDoclibViewTbl0 tr.ms-viewheadertr td").hasClass("ms-vh-group")) { // list is grouped
				$("#onetidDoclibViewTbl0 td.ms-vb-title").each(function () {
					var editMenu = $(this).html().replace("<IMG","<img");
					var editMenuText = $(this).text() + "<img";
					var docTitleText = $(this).parent().children("td:nth-child(4)").text();
					if (docTitleText.length > 0) {
						$(this).parent().children("td:nth-child(4)").addClass("ms-vb-title");
						$(this).parent().children("td:nth-child(4)").html(editMenu.replace(editMenuText,docTitleText + "<img"));
					}
					else {
						$(this).parent().children("td:nth-child(4)").addClass("ms-vb-title");
						$(this).parent().children("td:nth-child(4)").html(editMenu);
					}
					$(this).css("display","none");
				});
				if (isIE()) {
					$("tr.ms-viewheadertr th:nth-child(4)").css("display","none");
				}
				else {
					$("tr.ms-viewheadertr th:nth-child(3)").css("display","none");
				}
			
			}
			else {
				$("#onetidDoclibViewTbl0 td.ms-vb-title").each(function () {
					var editMenu = $(this).html().replace("<IMG","<img");
					var editMenuText = $(this).text() + "<img";
					var docTitleText = $(this).parent().children("td:nth-child(3)").text();
					if (docTitleText.length > 0) {
						$(this).parent().children("td:nth-child(3)").addClass("ms-vb-title");
						$(this).parent().children("td:nth-child(3)").html(editMenu.replace(editMenuText,docTitleText + "<img"));
					}
					else {
						$(this).parent().children("td:nth-child(3)").addClass("ms-vb-title");
						$(this).parent().children("td:nth-child(3)").html(editMenu);
					}
					$(this).css("display","none");
				});
				if (isIE()) {
					$("tr.ms-viewheadertr th:nth-child(3)").css("display","none");
				}
				else {
					$("tr.ms-viewheadertr th:nth-child(2)").css("display","none");
				}
			}	
		}
	}	
	
	/* SET SELECTED DROP DOWN LIST VALUES ON EDITNEST FORM AND OTHER FORMATTING TWEAKS */
		if (location.href.toLowerCase().indexOf("/intranet/programdata/sdrdatamanagement/ltpp/editnest.aspx") > -1) {
			var siteID = $("#siteID").val();
			var species = $("#species").val();
			var substrate = $("#substrate").val();
			var nestFurniture = $("#nestFurniture").val();
			var finalNestStatus = $("#finalNestStatus").val();
			var finalChickStatus = $("#finalChickStatus").val();
			
			$("#ctl00_m_g_018e21fb_8eb5_4516_b936_46ab3536d73e_ff1_1 option[value='" + siteID + "']").attr("selected", "selected");
			$("#ctl00_m_g_018e21fb_8eb5_4516_b936_46ab3536d73e_ff4_1 option[value='" + species + "']").attr("selected", "selected");
			$("#ctl00_m_g_018e21fb_8eb5_4516_b936_46ab3536d73e_ff8_1 option[value='" + substrate + "']").attr("selected", "selected");
			if (nestFurniture.toLowerCase().indexOf("true") > -1) {
				$("#ctl00_m_g_018e21fb_8eb5_4516_b936_46ab3536d73e_ff9_1_1").removeAttr("checked");
				$("#ctl00_m_g_018e21fb_8eb5_4516_b936_46ab3536d73e_ff9_1_0").attr("checked", "checked");
			}
			else {
				$("#ctl00_m_g_018e21fb_8eb5_4516_b936_46ab3536d73e_ff9_1_0").removeAttr("checked");
				$("#ctl00_m_g_018e21fb_8eb5_4516_b936_46ab3536d73e_ff9_1_1").attr("checked", "checked");
			}
			$("#ctl00_m_g_018e21fb_8eb5_4516_b936_46ab3536d73e_ff15_1 option[value='" + finalNestStatus + "']").attr("selected", "selected");
			$("#ctl00_m_g_018e21fb_8eb5_4516_b936_46ab3536d73e_ff16_1 option[value='" + finalChickStatus + "']").attr("selected", "selected");
		
		}
		
	/* SDR REPORTS */
	if (location.href.toLowerCase().indexOf("/intranet/programdata/sdr%20reports/report.aspx") > -1) {
        $("img[id$=imgExport]").css("cursor","pointer");
        $("img[id$=imgExport]").click(function(x) {
            var today = new Date();
            var reportDetails = "Date of Report," + today.toDateString() + "\n";
            reportDetails = reportDetails + "Protocol," + $("select[name$=ddlProtocol]").val() + "\n";
            reportDetails = reportDetails + "Location," + $("select[name$=ddlLocation] :selected").text() + "\n";
            reportDetails = reportDetails + "Data Type," + $("select[name$=ddlDataType]").val() + "\n";
            reportDetails = reportDetails + "Start Date," + $("input[name$=tbStartDate]").val() + "\n";
            reportDetails = reportDetails + "End Date," + $("input[name$=tbEndDate]").val() + "\n\n";
            ExportToExcel("ctl00_PlaceHolderMain_GridView1", reportDetails);
        });
		if ($("select[name$=ddlProtocol]").val()==0 || $("select[name$=ddlLocation] option").size()==0) {
			$("select[name$=ddlLocation]").append("<option value='0'>-- Select a Location --</option>");
			$("select[name$=ddlDataType]").append("<option value='0'>-- Select a Data Type --</option>");
			$("select[name$=ddlLocation]").attr("disabled","disabled");
			$("select[name$=ddlDataType]").attr("disabled","disabled");
		}		
		if ($("input[name$=tbStartDate]").val().length==0) {
			var today = new Date();
			$("input[name$=tbStartDate]").val((today.getMonth()+1) + "/" + today.getDate() + "/" + (today.getFullYear()-2));
		}
		if ($("input[name$=tbEndDate]").val().length==0) {
			var today = new Date();
			$("input[name$=tbEndDate]").val((today.getMonth()+1) + "/" + today.getDate() + "/" + today.getFullYear());
		}
	}
	
	if (location.href.toLowerCase().indexOf("/intranet/programdata/sdrdatamanagement/whcr/1-clickreports.aspx") > -1) {
        $("img[id$=imgExport]").css("cursor","pointer");
        $("img[id$=imgExport]").click(function(x) {
            var today = new Date();
            var reportDetails = "Date of Report," + today.toDateString() + "\n\n";
            ExportToExcel("ctl00_PlaceHolderMain_GridView1", reportDetails);
        });
	}

		
	if (location.href.toLowerCase().indexOf("/intranet/programdata/sdrreports/quick.aspx") > -1) {
        $("img[id$=imgExport]").css("cursor","pointer");
        $("img[id$=imgExport]").click(function(x) {
            var today = new Date();
            var reportDetails = "Date of Report," + today.toDateString() + "\n";
            reportDetails = reportDetails + "Protocol," + $("select[name$=ddlProtocol] :selected").text() + "\n";
            reportDetails = reportDetails + "Survey," + $("select[name$=ddlSurvey]").val() + "\n";
            reportDetails = reportDetails + "Report," + $("select[name$=ddlReport] :selected").text() + "\n\n";
           	ExportToExcel("ctl00_PlaceHolderMain_GridView1", reportDetails);
        });
		if ($("select[name$=ddlProtocol]").val()==0) {
			$("select[name$=ddlSurvey]").attr("disabled","disabled");
			$("select[name$=ddlReport]").attr("disabled","disabled");
		}	
	}
		
	if (location.href.toLowerCase().indexOf("/intranet/programdata/sdrreports/ad%20hoc.aspx") > -1) {
        $("img[id$=imgExport]").css("cursor","pointer");
        $("img[id$=imgExport]").click(function(x) {
            myExport = new Object();
            myExport.protocol = $("select[name$=ddlProtocol] :selected").text();
            myExport.report = $("select[name$=ddlReport]").val();
            myExport.startYear = $("select[name$=ddlDateStartYear] :selected").text();
            myExport.endYear = $("select[name$=ddlDateStartYear] :selected").text();
            myExport.surveyName = $("select[name$=ddlSurvey]").val();
            myExport.siteID = $("select[name$=ddlSite]").val();
            myExport.siteType = $("select[name$=ddlHabitat]").val();
            myExport.species = $("select[name$=ddlSpecies]").val();
            myExport.confirmedAs = $("select[name$=ddlConfirmedAs]").val();
            myExport.flightType = $("select[name$=ddlFlightType]").val();
            myExport.anchorPoint = $("select[name$=ddlAnchorPt]").val();
            myExport.transect = $("select[name$=ddlTransect]").val();
            
            /*var today = new Date();
            var reportDetails = "Date of Report," + today.toDateString() + "\n";   
            reportDetails = reportDetails + "Protocol," + $("select[name$=ddlProtocol] :selected").text() + "\n";
            reportDetails = reportDetails + "Date Range," + $("select[name$=ddlDateStartYear] :selected").text() + "-" + $("select[name$=ddlDateStartYear] :selected").text() + "\n";
            if ($("select[name$=ddlSurvey]").val()==0) {
            	reportDetails = reportDetails + "Survey,All\n"; 
            }
            else { 
            	reportDetails = reportDetails + "Survey," + $("select[name$=ddlSurvey]").val() + "\n"; 
            }  
            reportDetails = reportDetails + "Report," + $("select[name$=ddlReport] :selected").text() + "\n\n";*/

           	ExportPagedGridToExcel(myExport);
        });
		if ($("select[name$=ddlProtocol]").val()==0) {
			$("select[name$=ddlDateStartYear]").attr("disabled","disabled");
			$("select[name$=ddlDateEndYear]").attr("disabled","disabled");
			$("select[name$=ddlSurvey]").attr("disabled","disabled");
			$("select[name$=ddlReport]").attr("disabled","disabled");
		}	
		if ($("select[name$=ddlReport]").val()=='sproc_AdHoc_GetAllAerialFlightLogsBySurvey') {
			$("select[name$=ddlConfirmedAs]").attr("disabled","disabled");
		}	
		if ($("select[name$=ddlReport]").val()=='sproc_AdHoc_GetAllGroundSearchEffortsBySurvey') {
			$("select[name$=ddlFlightType]").attr("disabled","disabled");
		}	
		if ($("select[name$=ddlReport]").val()=='sproc_AdHoc_GetAllICUseSiteMonitoringLogsBySurvey' || $("select[name$=ddlReport]").val()=='sproc_AdHoc_GetAllUseSiteCharacteristicsBySurvey' || $("select[name$=ddlReport]").val()=='sproc_AdHoc_GetAllUseSiteProfilesBySurvey') {
			$("select[name$=ddlConfirmedAs]").attr("disabled","disabled");
			$("select[name$=ddlFlightType]").attr("disabled","disabled");
		}	

	}	

});

function ExportPagedGridToExcel(myExport) {
	var myUrl = "http://www.platteriverprogram.org/_layouts/PRRIP/ExportHandler.ashx?r=" + myExport.report + "&sy=" + myExport.startYear + "&ey=" + myExport.endYear + "&s=" + myExport.species + "&sn=" + myExport.surveyName + "&sid=" + myExport.siteID + "&st=" + myExport.siteType + "&ca=" + myExport.confirmedAs + "&ft=" + myExport.flightType + "&ap=" + myExport.anchorPoint + "&t=" + myExport.transect;
 	/*$.ajax({
 		type: "GET",
 		url: myUrl
 	});*/
 	
	var exportPopup = window.open(myUrl, 'Export', 'width=100,height=100,toolbar=0,resizable=0,left=0,top=0,location=0,directories=0,status=0,menubar=0,scrollbars=0'); 	
	if (exportPopup == null || typeof(exportPopup) == 'undefined') {
		alert("Please disable your popup blocker to export the report.");
	}
	else {
		exportPopup.focus();
	}
}


