// --- Opens an e-form in a new window
function LaunchView(FormID,ThemeID){
      wth=screen.width;
      ht=screen.height-45;
      lt=0;
      tp=0;
      if(Left(window.location,10) == "http://www"){
            winview=window.open ('https://www.doncaster.gov.uk/webforms/extSubmitForm.asp?FormID=' + FormID + '&ThemeID=' + ThemeID, 'SubmitForm', 'width=' + wth + ',height=' + ht + ',left=' + lt + ',top=' + tp + ',Status=1,scrollbars=1,resizable=0');
            winview.focus();
      }else {
           winview=window.open ('http://dmbcintranet2/webforms/SubmitForm.asp?FormID=' + FormID + '&ThemeID=' + ThemeID, 'SubmitForm', 'width=' + wth + ',height=' + ht + ',left=' + lt + ',top=' + tp + ',Status=1,scrollbars=1,resizable=0');
            winview.focus();
      }
}
// ---- Functions used by the LaunchView function to open an e-form in a new window
function Left(str, n){
	if (n <= 0)
	    return "";
	else if (n > String(str).length)
	    return str;
	else
	    return String(str).substring(0,n);
}
function Right(str, n){
    if (n <= 0)
       return "";
    else if (n > String(str).length)
       return str;
    else {
       var iLen = String(str).length;
       return String(str).substring(iLen, iLen - n);
    }
}
// --- end of opens an e-form in a new window



// -- Opens a new window 
// -- this function is called using the attribute rel="external" within the <a href> tag.
// -- this replaces the common target="_blank" attribute as it is not supported in xhtml strict.
function external() {
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") &&
       anchor.getAttribute("rel") == "external")
     anchor.target = "_blank";
 }
}
window.onload = external;