//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) function RecalculateStuffToPrintAndEmail(){ StuffToEmail = GetDataForUtility("EmailThis"); StuffToPrint = GetDataForUtility("PrintThis"); } if (document.getElementById(ToolBarControlId)) { RecalculateStuffToPrintAndEmail(); 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\tHull City 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=\"#666666\"><IMG alt=\"Hull City Knowledge\" src=\"images\/banner.gif\" width=\"765\" height=\"89\" 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>Hull City Knowledge ') winEmail.document.write('- Send Email<\/title>\r\n\t\t<LINK href=\"css\/styles.css') winEmail.document.write('.ashx\" type=\"text\/css\" rel=\"stylesheet\">\r\n\t\t<scrip') winEmail.document.write('t language=\"javascript\">\r\n\t\t<!--\r\n\t\tvar IsOkToSubm') winEmail.document.write('it = true;\r\n\t\t\r\n\t\tfunction form_submit()\r\n\t\t{\r\n\r\n\t') winEmail.document.write('\t if ((document.all) && !(document.getElementById)') winEmail.document.write(') \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 if(doc') winEmail.document.write('ument.all(\"ErrorMessage\") !=null){\t\r\n\t\t\t\tdocument.') winEmail.document.write('all(\"ErrorMessage\").innerHTML = \"Please Wait... <b') winEmail.document.write('r>\"\r\n\t\t \t}\r\n\t\t } else if (document.layers) {\t\t\t\t\t\t') winEmail.document.write('\t \t\t\t\t\t\/\/ NS4+ code \t\t \r\n\t\t\t \r\n\t\t\t if(document.l') winEmail.document.write('ayers[\"ErrorMessage\"] !=\'undefined\'){\r\n\t\t\t\t doc') winEmail.document.write('ument.layers[\"ErrorMessage\"].innerHTML = \"Please W') winEmail.document.write('ait... <br>\"\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t } else if (document.') winEmail.document.write('getElementById) { \t\t\t\t\t\t\t\t\t\/\/IE5 NN6\r\n\t\t\t\t\r\n\t\t\t\tif') winEmail.document.write('(document.getElementById(\"ErrorMessage\") !=null){\r') winEmail.document.write('\n\t\t\t\t\tdocument.getElementById(\"ErrorMessage\").inne') winEmail.document.write('rHTML = \"Please Wait... <br>\"\r\n\t\t\t\t}\r\n\t\t\t} \t\t\r\n\t\t\r') winEmail.document.write('\n\t\t\r\n\t\t\r\n\t\t\tif(IsOkToSubmit)\r\n\t\t\t{\r\n\t\t\t\tIsOkToSubm') winEmail.document.write('it = false;\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{') winEmail.document.write('\r\n\t\t\t\talert(\'Please wait your email is currently b') winEmail.document.write('eing generated!\')\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t}\r\n\t') winEmail.document.write('\t\r\n\t\tfunction Loaded()\r\n\t\t{\r\n\t\t\tdocument.forms[0].') winEmail.document.write('hdnValues.value = window.opener.StuffToEmail;\r\n\t\t\t') winEmail.document.write('document.forms[0].fmEmail.focus();\r\n\t\t}\r\n\t\t\r\n\t\t\/\/-') winEmail.document.write('->\r\n\t\t<\/script>\r\n\t<\/head>\r\n\t<body bgcolor=\"#AAAAAA') winEmail.document.write('\" leftmargin=\"0\" topmargin=\"0\" marginheight=\"0\" ma') winEmail.document.write('rginwidth=\"0\"\r\n\t\tbottommargin=\"0\" onLoad=\"Loaded()') winEmail.document.write(';\">\r\n\t\t<form action=\"Emailer.ashx\" method=\"post\" I') winEmail.document.write('D=\"Form1\">\r\n\t\t\t<input type=\"hidden\" name=\"hdnValue') winEmail.document.write('s\" value=\"\" ID=\"hdnValues\" \/>\r\n\t\t\t<table width=\"76') winEmail.document.write('5\" 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\"><IM') winEmail.document.write('G alt=\"Hull City Knowledge\" src=\"images\/banner.gif') winEmail.document.write('\" width=\"765\" height=\"89\" border=\"0\"><\/td>\r\n\t\t\t\t<\/') winEmail.document.write('tr>\r\n\t\t\t<\/table>\r\n\t\t\t<table width=\"400\" cellpaddin') winEmail.document.write('g=\"0\" cellspacing=\"0\" border=\"0\" ID=\"Table2\">\r\n\t\t\t') winEmail.document.write('\t<tr>\r\n\t\t\t\t\t<td colspan=\"2\"><img src=\"\/images\/spac') winEmail.document.write('er.gif\" width=\"1\" height=\"10\" alt=\"\" border=\"0\" \/>') winEmail.document.write('<\/td>\r\n\t\t\t\t<\/tr>\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<td class=\"contro') winEmail.document.write('ls\"><img src=\"\/images\/spacer.gif\" width=\"10\" heigh') winEmail.document.write('t=\"1\" alt=\"\" border=\"0\" \/><\/td>\r\n\t\t\t\t\t<td class=\"t') winEmail.document.write('ext\"><span id=\"ErrorMessage\"><\/span>Please enter y') winEmail.document.write('our email \r\n\t\t\t\t\t\taddress  <input type=\"') winEmail.document.write('text\" class=\"form\" name=\"fmEmail\" value=\"\" ID=\"fmE') winEmail.document.write('mail\" \/>   <input type=\"submit\" cla') winEmail.document.write('ss=\"greenBut\" name=\"btnSubmit\" value=\"Send\" ID=\"Su') winEmail.document.write('bmit1\" \/><\/td>\r\n\t\t\t\t<\/tr>\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<td cols') winEmail.document.write('pan=\"2\" class=\"controls\" align=\"right\"><img src=\"\/') winEmail.document.write('images\/spacer.gif\" width=\"1\" height=\"10\" alt=\"\" bo') winEmail.document.write('rder=\"0\" \/><\/td>\r\n\t\t\t\t<\/tr>\r\n\t\t\t<\/table>\r\n\t\t<\/form') winEmail.document.write('>\r\n\t<\/body>\r\n<\/html>\r\n') winEmail.document.close(); // winEmail.document.forms[0].hdnValues.value = StuffToEmail; winEmail.focus(); }