//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(!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\tNottinghamshire Knowledge - Print<\/title>\r\n\t\t<LINK href=\"css\/styles.css.ashx\" type=\"text\/css\" rel=\"stylesheet\">\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=\"#0dad2b\"><IMG alt=\"Nottinghamshire Knowledge\" src=\"images\/logo1.gif\" width=\"273\" height=\"101\" 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>Nottinghamshire Know') winEmail.document.write('ledge - Send Email<\/title>\r\n\t\t<LINK href=\"css\/styl') winEmail.document.write('es.css.ashx\" type=\"text\/css\" rel=\"stylesheet\">\r\n\t\t') winEmail.document.write('<script language=\"javascript\">\r\n\t\t<!--\r\n\t\tvar IsOk') winEmail.document.write('ToSubmit = true;\r\n\t\t\r\n\t\tfunction form_submit()\r\n\t\t') winEmail.document.write('{\r\n\r\n\t\t if ((document.all) && !(document.getElemen') winEmail.document.write('tById)) \t\t\t\t\/\/ IE4\r\n\t\t { \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t ') winEmail.document.write('if(document.all(\"ErrorMessage\") !=null){\t\r\n\t\t\t\tdoc') winEmail.document.write('ument.all(\"ErrorMessage\").innerHTML = \"Please Wait') winEmail.document.write('... <br>\"\r\n\t\t \t}\r\n\t\t } else if (document.layers) {') winEmail.document.write('\t\t\t\t\t\t\t \t\t\t\t\t\/\/ NS4+ code \t\t \r\n\t\t\t \r\n\t\t\t if(docu') winEmail.document.write('ment.layers[\"ErrorMessage\"] !=\'undefined\'){\r\n\t\t\t\t ') winEmail.document.write(' document.layers[\"ErrorMessage\"].innerHTML = \"Pl') winEmail.document.write('ease Wait... <br>\"\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t } else if (doc') winEmail.document.write('ument.getElementById) { \t\t\t\t\t\t\t\t\t\/\/IE5 NN6\r\n\t\t\t\t\r\n') winEmail.document.write('\t\t\t\tif(document.getElementById(\"ErrorMessage\") !=n') winEmail.document.write('ull){\r\n\t\t\t\t\tdocument.getElementById(\"ErrorMessage\"') winEmail.document.write(').innerHTML = \"Please Wait... <br>\"\r\n\t\t\t\t}\r\n\t\t\t} \t') winEmail.document.write('\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\tif(IsOkToSubmit)\r\n\t\t\t{\r\n\t\t\t\tIsOk') winEmail.document.write('ToSubmit = false;\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t\telse') winEmail.document.write('\r\n\t\t\t{\r\n\t\t\t\talert(\'Please wait your email is curre') winEmail.document.write('ntly being generated!\')\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n') winEmail.document.write('\t\t}\r\n\t\t\r\n\t\tfunction Loaded()\r\n\t\t{\r\n\t\t\tdocument.for') winEmail.document.write('ms[0].hdnValues.value = window.opener.StuffToEmail') winEmail.document.write(';\r\n\t\t\tdocument.forms[0].fmEmail.focus();\r\n\t\t}\r\n\t\t\r') winEmail.document.write('\n\t\t\/\/-->\r\n\t\t<\/script>\r\n\t<\/head>\r\n\t<body bgcolor=\"#') winEmail.document.write('AAAAAA\" leftmargin=\"0\" topmargin=\"0\" marginheight=') winEmail.document.write('\"0\" marginwidth=\"0\"\r\n\t\tbottommargin=\"0\" onLoad=\"Lo') winEmail.document.write('aded();\">\r\n\t\t<form action=\"Emailer.ashx\" method=\"p') winEmail.document.write('ost\" ID=\"Form1\">\r\n\t\t\t<input type=\"hidden\" name=\"hd') winEmail.document.write('nValues\" value=\"\" ID=\"hdnValues\" \/>\r\n\t\t\t<table wid') winEmail.document.write('th=\"765\" border=\"0\" cellspacing=\"0\" cellpadding=\"0') winEmail.document.write('\" ID=\"Table1\">\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<td bgColor=\"#0dad2') winEmail.document.write('b\"><IMG alt=\"Nottinghamshire Knowledge\" src=\"image') winEmail.document.write('s\/logo1.gif\" width=\"273\" height=\"101\" border=\"0\"><') winEmail.document.write('\/td>\r\n\t\t\t\t<\/tr>\r\n\t\t\t<\/table>\r\n\t\t\t<table width=\"400') winEmail.document.write('\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" ID=\"T') winEmail.document.write('able2\">\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<td colspan=\"2\"><img src=\"') winEmail.document.write('\/images\/spacer.gif\" width=\"1\" height=\"10\" alt=\"\" b') winEmail.document.write('order=\"0\" \/><\/td>\r\n\t\t\t\t<\/tr>\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<td c') winEmail.document.write('lass=\"controls\"><img src=\"\/images\/spacer.gif\" widt') winEmail.document.write('h=\"10\" height=\"1\" alt=\"\" border=\"0\" \/><\/td>\r\n\t\t\t\t\t') winEmail.document.write('<td class=\"text\"><span id=\"ErrorMessage\"><\/span>Pl') winEmail.document.write('ease enter your email \r\n\t\t\t\t\t\taddress  <') winEmail.document.write('input type=\"text\" class=\"form\" name=\"fmEmail\" valu') winEmail.document.write('e=\"\" ID=\"fmEmail\" \/>   <input type=') winEmail.document.write('\"submit\" class=\"greenBut\" name=\"btnSubmit\" value=\"') winEmail.document.write('Send\" ID=\"Submit1\" \/><\/td>\r\n\t\t\t\t<\/tr>\r\n\t\t\t\t<tr>\r\n\t') winEmail.document.write('\t\t\t\t<td colspan=\"2\" class=\"controls\" align=\"right\"') winEmail.document.write('><img src=\"\/images\/spacer.gif\" width=\"1\" height=\"1') winEmail.document.write('0\" alt=\"\" border=\"0\" \/><\/td>\r\n\t\t\t\t<\/tr>\r\n\t\t\t<\/tabl') winEmail.document.write('e>\r\n\t\t<\/form>\r\n\t<\/body>\r\n<\/html>\r\n') winEmail.document.close(); // winEmail.document.forms[0].hdnValues.value = StuffToEmail; winEmail.focus(); }