//NB Place at bottom of page so all HTML has been rendered before looking to see if anything //is available to print or email...**** var StuffToEmail = ""; var StuffToPrint = ""; var IsRankPage = ((document.location.href.toLowerCase().indexOf('ranking.aspx') != -1) || (document.location.href.toLowerCase().indexOf('ranking2.aspx') != -1)) var IsMetadataPage = (document.location.href.toLowerCase().indexOf('metadata.aspx') != -1) if (document.getElementById(ToolBarControlId)) { StuffToEmail = GetDataForUtility("EmailThis"); StuffToPrint = GetDataForUtility("PrintThis"); var strToolbarHtml = '' if(IsAllWhiteSpace(StuffToEmail)) { strToolbarHtml += 'No Email Content' } else { strToolbarHtml += 'Click to email these results' } if(IsAllWhiteSpace(StuffToPrint)) { strToolbarHtml += 'No Print Content' } else { strToolbarHtml += 'Click to Print these results' } if(IsRankPage) { if(!checkMetaContent()) { strToolbarHtml += 'No download Content' } else { strToolbarHtml += 'Click to download these results' } } if(IsMetadataPage) { if(!checkMetaContent()) { strToolbarHtml += 'No download Content' } else { strToolbarHtml += 'Click to download these results' } } if(!checkMetaContent()) { strToolbarHtml += 'No meta content' } else { strToolbarHtml += 'View metadata' } document.getElementById(ToolBarControlId).innerHTML = strToolbarHtml; } function stripHTML(oldString) { return oldString.replace(/<[^>]*>/g, ''); } function IsAllWhiteSpace(PassedString) { if((PassedString.toLowerCase().indexOf(' -1)||(PassedString.toLowerCase().indexOf(' -1)) { return false; } PassedString = stripHTML(PassedString); return PassedString.match(/^[\s]*$/); } function checkMetaContent() { return ((document.forms[0].elements['hdnIndicator_Spatial'] != null) && (document.forms[0].elements['hdnIndicator_Spatial'].value != '')); } function goToMeta() { if(checkMetaContent()) { var win = 'MetaDataIndicatorFocus.aspx?hdnIndicator_Spatial=' + document.forms[0].elements['hdnIndicator_Spatial'].value + '&From=' + document.forms[0].elements['hdnFrom'].value; openWindow(win,415,550,1); } } function goToDownload() { if(checkMetaContent()) { var win = 'DataDownload.aspx?hdnIndicator_Spatial=' + document.forms[0].elements['hdnIndicator_Spatial'].value; openWindow(win,700,800); } } function GetDataForUtility(KeyToLookFor) { var strResult = '\n'; var i; var blnAnItemWasFound = false; for (i=0; i -1) { if(!(IsAllWhiteSpace(document.getElementsByTagName("div")[i].innerHTML))) { blnAnItemWasFound = true; strResult += '\n \n \n' } } } for (i=0; i -1) { if(!(IsAllWhiteSpace(document.getElementsByTagName("span")[i].innerHTML))) { blnAnItemWasFound = true; strResult += '\n \n \n' } } } if(!blnAnItemWasFound) { return ""; } strResult += '
' strResult += document.getElementsByTagName("div")[i].innerHTML strResult += '
' strResult += document.getElementsByTagName("span")[i].innerHTML strResult += '
'; return strResult; } function ShowPrintWindow() { var sOption="toolbar=yes,location=no,directories=yes,menubar=yes,"; sOption+="scrollbars=yes,width=750,height=600,left=100,top=25"; if(IsAllWhiteSpace(StuffToPrint)) { alert("There is no content to print!") return; } var winprint=window.open("","",sOption); winprint.document.open(); //Top Of Page... winprint.document.write('\r\n\r\n\t\r\n\t\t\r\n\t\tPrint<\/title>\r\n\t\t<LINK href=\"css\/styles.css\" type=\"text\/css\" rel=\"stylesheet\">\t\r\n\t<\/head>\r\n\t<body bgcolor=\"#ffffff\" leftmargin=\"0\" topmargin=\"0\" marginheight=\"0\" marginwidth=\"0\"\r\n\t\tbottommargin=\"0\" onload=\"window.print();\">\r\n\t\t\t<table width=\"765\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" ID=\"Table1\">\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<td bgColor=\"#000000\"><IMG alt=\"Banner Image\" src=\"images\/derby_banner.gif\" width=\"765\" height=\"150\" border=\"0\"><\/td>\r\n\t\t\t\t<\/tr>\r\n\t\t\t\t<tr bgcolor=\"#999999\" align=\"right\">\r\n\t\t\t\t\t<td>\r\n\t\t\t\t\t\t<input type=\"button\" value=\"Print\" onclick=\"window.print();\" class=\"greenBut\"\/>\r\n\t\t\t\t\t\t<input type=\"button\" value=\"Close\" onclick=\"window.close();\" class=\"greenBut\"\/>\r\n\t\t\t\t\t\t    \r\n\t\t\t\t\t<\/td>\r\n\t\t\t\t<\/tr>\r\n\t\t\t<\/table>\r\n\t\t\t<table width=\"80%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" ID=\"Table2\" align=\"center\">\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<td><img src=\"images\/spacer.gif\" height=\"20px\"\/><\/td>\r\n\t\t\t\t<\/tr>\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<td bgColor=\"#ffffff\">\r\n\t\t\t\t\t\r\n'); //Custom print contents... winprint.document.write(StuffToPrint); //Bottom Of Page... winprint.document.write('\t\t\t\t\t<\/td>\r\n\t\t\t\t<\/tr>\r\n\t\t\t<\/table>\r\n\r\n\t<\/BODY>\r\n<\/HTML>\r\n') winprint.document.close(); winprint.focus(); } function ShowEmailWindow() { var sOption="toolbar=yes,location=no,directories=yes,menubar=yes,"; sOption+="width=750,height=250,left=100,top=25,scrollbars=0,menubar=0,status=0,titlebar=0"; if(IsAllWhiteSpace(StuffToEmail)) { alert("There is no content to Email!") return; } var winEmail=window.open("","",sOption); winEmail.document.open(); winEmail.document.write('<!DOCTYPE HTML PUBLIC \"-\/\/W3C\/\/DTD HTML 4.01 Trans') winEmail.document.write('itional\/\/EN\">\r\n<html>\r\n\t<head>\r\n\t\t<meta name=\"vs_t') winEmail.document.write('argetSchema\" content=\"http:\/\/schemas.microsoft.com') winEmail.document.write('\/intellisense\/ie5\">\r\n\t\t<title>Send Email<\/title>\r\n') winEmail.document.write('\t\t<LINK href=\"css\/styles.css\" type=\"text\/css\" rel=') winEmail.document.write('\"stylesheet\">\r\n\t\t<script language=\"javascript\">\r\n\t') winEmail.document.write('\t<!--\r\n\t\tvar IsOkToSubmit = true;\r\n\t\t\r\n\t\tfunction ') winEmail.document.write('form_submit()\r\n\t\t{\r\n\r\n\t\t if ((document.all) && !(d') winEmail.document.write('ocument.getElementById)) \t\t\t\t\/\/ IE4\r\n\t\t { \t\t\t\t\t\t') winEmail.document.write('\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t if(document.all(\"ErrorMessage\") !') winEmail.document.write('=null){\t\r\n\t\t\t\tdocument.all(\"ErrorMessage\").innerHT') winEmail.document.write('ML = \"Please Wait... <br>\"\r\n\t\t \t}\r\n\t\t } else if (d') winEmail.document.write('ocument.layers) {\t\t\t\t\t\t\t \t\t\t\t\t\/\/ NS4+ code \t\t \r\n\t\t') winEmail.document.write('\t \r\n\t\t\t if(document.layers[\"ErrorMessage\"] !=\'un') winEmail.document.write('defined\'){\r\n\t\t\t\t document.layers[\"ErrorMessage\"') winEmail.document.write('].innerHTML = \"Please Wait... <br>\"\r\n\t\t\t\t}\r\n\t\t\t\t\r\n') winEmail.document.write('\t\t } else if (document.getElementById) { \t\t\t\t\t\t\t\t\t') winEmail.document.write('\/\/IE5 NN6\r\n\t\t\t\t\r\n\t\t\t\tif(document.getElementById(\"E') winEmail.document.write('rrorMessage\") !=null){\r\n\t\t\t\t\tdocument.getElementBy') winEmail.document.write('Id(\"ErrorMessage\").innerHTML = \"Please Wait... <br') winEmail.document.write('>\"\r\n\t\t\t\t}\r\n\t\t\t} \t\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\tif(IsOkToSubmit') winEmail.document.write(')\r\n\t\t\t{\r\n\t\t\t\tIsOkToSubmit = false;\r\n\t\t\t\treturn tru') winEmail.document.write('e;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\talert(\'Please wait yo') winEmail.document.write('ur email is currently being generated!\')\r\n\t\t\t\tretu') winEmail.document.write('rn false;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\/\/-->\r\n\t\t<\/script>\r\n\t<\/hea') winEmail.document.write('d>\r\n\t<body bgcolor=\"#AAAAAA\" leftmargin=\"0\" topmar') winEmail.document.write('gin=\"0\" marginheight=\"0\" marginwidth=\"0\"\r\n\t\tbottom') winEmail.document.write('margin=\"0\" onLoad=\"document.forms[0].fmEmail.focus') winEmail.document.write('();\">\r\n\t\t<form action=\"Emailer.ashx\" method=\"post\"') winEmail.document.write(' ID=\"Form1\">\r\n\t\t\t<input type=\"hidden\" name=\"hdnVal') winEmail.document.write('ues\" value=\"\" ID=\"hdnValues\" \/>\r\n\t\t\t<table width=\"') winEmail.document.write('765\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" ID') winEmail.document.write('=\"Table1\">\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<td bgColor=\"#666666\"><') winEmail.document.write('IMG alt=\"Local Knowledge\" src=\"images\/derby_banner') winEmail.document.write('.gif\" width=\"765\" height=\"150\" border=\"0\"><\/td>\r\n\t') winEmail.document.write('\t\t\t<\/tr>\r\n\t\t\t<\/table>\r\n\t\t\t<table width=\"400\" cellp') winEmail.document.write('adding=\"0\" cellspacing=\"0\" border=\"0\" ID=\"Table2\">') winEmail.document.write('\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<td colspan=\"2\"><img src=\"\/images') winEmail.document.write('\/spacer.gif\" width=\"1\" height=\"10\" alt=\"\" border=\"') winEmail.document.write('0\" \/><\/td>\r\n\t\t\t\t<\/tr>\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<td class=\"c') winEmail.document.write('ontrols\"><img src=\"\/images\/spacer.gif\" width=\"10\" ') winEmail.document.write('height=\"1\" alt=\"\" border=\"0\" \/><\/td>\r\n\t\t\t\t\t<td cla') winEmail.document.write('ss=\"text\"><span id=\"ErrorMessage\"><\/span>Please en') winEmail.document.write('ter your email \r\n\t\t\t\t\t\taddress  <input t') winEmail.document.write('ype=\"text\" class=\"form\" name=\"fmEmail\" value=\"\" ID') winEmail.document.write('=\"fmEmail\" \/>   <input type=\"submit') winEmail.document.write('\" class=\"greenBut\" name=\"btnSubmit\" value=\"Send\" I') winEmail.document.write('D=\"Submit1\" \/><\/td>\r\n\t\t\t\t<\/tr>\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<td') winEmail.document.write(' colspan=\"2\" class=\"controls\" align=\"right\"><img s') winEmail.document.write('rc=\"\/images\/spacer.gif\" width=\"1\" height=\"10\" alt=') winEmail.document.write('\"\" border=\"0\" \/><\/td>\r\n\t\t\t\t<\/tr>\r\n\t\t\t<\/table>\r\n\t\t<') winEmail.document.write('\/form>\r\n\t<\/body>\r\n<\/html>\r\n') winEmail.document.close(); // winEmail.document.forms[0].hdnValues.value = StuffToEmail; winEmail.focus(); }