// *********************************************************************
// this script is copyright PL Collett 2002, 2003
// *********************************************************************

var zyq = false;  // debug flag eg. for local testing
var pathToRoot = "../";  // default
var mainImg = "dorset1x.gif";  // default
var mainWidth = "100%";
var mainColor = "#ffeecc";
var bordColor = "#555555";

// various image depositories note also image popup scripts
var bt = "http://www.dorsetshire.btinternet.co.uk/images/";
var du = "http://www.durotriges.com/images/d/";
var dc = "http://www.dorsetshire.com/images/";
var dn = "http://www.dorsetshire.net/images/";
var sb = "http://www.somersetshire.biz/images/dcom/";
var duroot = "http://www.durotriges.com/images/";
var dushop = "http://www.durotriges.com/images/shop/";
var sbshop = "http://www.somersetshire.biz/images/shop/";

// image popup scripts 
var popa = "p.asp";
var popp = "p.php";

// global settings - change if site off air
// use one of the above urls for each of these
var imxi = sb;
var impi = sb;
// note this setting is where this script is located
var impop = popa;

// *********************************************************************

function setPathToRoot(pth)
{
pathToRoot = pth;
}

function setWidth(wdth)
{
mainWidth = wdth;
}

// standard header
// title, header image: filename, width, height 
function addHdr(nam,pic,w,h)
{
   var str=" ";
   var dotPos=0;

   str += "<table width='" + mainWidth + "' border='1' align='center' ";
   str += "rows='1' columns='1' cellspacing='0' cellpadding='0' ";
   str += "bordercolor='" + bordColor + "' bgcolor='"+mainColor+"'>";
   str += "<tr><td>";
   document.write(str);

   str = "<table width='" + mainWidth + "' border='0' align='center'>";
   str += "<tr>";
   str += "<td width='175'><a href='" + pathToRoot + "index.html'><img src='" + pathToRoot; 
   str += "images/" + mainImg;
   str += "' width='145' height='20' align='left' border='0' alt='site home'></a></td>";
   str += "<td align=\"center\"><font color='#117711'><br><b>" + nam + "</b></font></td>";

   if ((pic != "") && (pic != 0)) {
     str += "<td width='205'>";
     str += "<img src='" + pathToRoot + "images/icons/";
     str += pic;
     str += "' align='right'";
     if (w>0 && h>0) {
       str += " width='" + w + "' height='" + h + "'";
     }
     str += "></td>";
   } else {
     str += "<td width='205'><img src='" + pathToRoot + "images/dorset0.gif'></td>";
   }

   str += "</tr></table>";
   //str += "<hr align='center' color='#55cc55' width='" + mainWidth + "'>";
   // alert(str);
   document.write(str);
}  // end addHdr



// standard footer 
// subject gives the feedback email title
function addFtr(subject)
{
   var str=" ";
   var dotPos=0;

   str += "<hr align='center' color='" + bordColor + "' width='" + mainWidth + "'>";
   str += "<table width='" + mainWidth + "' border='0' align='center'>";
   str += "<tr><td align='left'><a href='" + pathToRoot + "index.html'>";
   str += "<img src='" + pathToRoot + "images/homet.gif' border='0'></a></td>";
   str += "<td class='pc75'><center>Please ";
   str += "<a href='http://www.dorsetshire.com/feedback.asp?subject=";
   str += subject + "'>";
   str += " send questions/comments/suggestions</A>";
   str += "</center></td><td class='pc50' align='right'>";
   str += "Last Updated: ";
   str += document.lastModified;
   str += "</td></tr></table>";
   document.write(str);

   str = "</td></tr></table>";
   document.write(str);
}  // end addFtr


// original popup image
// image: filename, window title, width, height, add close button
function openimg(src,tit,w,h,wantclosebutton)
{
     var actualw = w+11;
     var actualh = h+11;
     var winid = Math.round(10000*Math.random());
     if (wantclosebutton>0) {
             actualh = actualh + 24;
     }
     if (actualw>800) {
             actualw = 800;
     }
     if (actualh>600) {
             actualh = 600;
     }
     //alert(src);
     winstring = "width="+actualw+",height="+actualh+",menubar=no,toolbar=no";
     newWin = window.open("",winid,winstring);
     newWin.document.open("text/html");
     with (newWin.document) {
         writeln("<head><title>",tit,"</title>");
         writeln("<script language='Javascript'>function closeme(){parent.close();}</script>");
         writeln("</head>");
         writeln("<body topmargin=1 leftmargin=1 bgcolor=white>");
         writeln("<table cellpadding='0' cellspacing='1'><tr><td>");
         writeln("<img src='",impi,src,"'");
	 if ((w>0) && (h>0)) {
           writeln(" width='",w,"' height='",h,"'");
	 }
         writeln("></td></tr>");
	 if (wantclosebutton>0) {
             writeln("<tr><td><form><input type=image src='http://www.dorsetshire.com/images/close2.gif' onclick='closeme();'></form></td></tr>");
         }
         writeln("</table></body>");
         close();
     }
 return;
}

// standard image: filename, width, height
function putImg(src,w,h)
{
   var s=" ";
   s += "<img src='" + imxi + src + "'";
   if ((w>0) && (h>0)) {
     s += " width='" + w + "' height='" + h + "'";
   }
   s += ">";
   document.write(s);
}


function putHR(thick)
{
   var s="<hr";
   s += " width='" + mainWidth + "'";
   s += " color='" + bordColor + "'";
   s += " size='" + thick + "'";
   s += ">";
   document.write(s);
}

function putPopupImgForm(src,dst,txt,w2,h2,clsbutton)
{
   var s = '<form>';
   s += '<input type=image src="' + imxi + src + '" onclick="openimg(\'' + dst + '\',\'' + txt + '\',' + w2 + ',' + h2 + ',' + clsbutton + ')">'
   s += '</form>';
   document.write(s);
}

function putPopupImgForm2(src,dst,txt,w2,h2,clsbutton)
{
   var s = '<form onsubmit=\"openimg(\"'+impi+src+'\",\"'+txt+'\",';
   s += w2+','+h2+','+clsbutton+');\">';
   s += '<input type=image src="' + imxi + dst + '">';
   s += '</form>';
   document.write(s);
}

function putPopupImgForm3(src,dst,txt,w2,h2,clsbutton)
{
   var s = " ";
   s += '<img src=\"' + imxi + src + '\" ';
   s += 'onclick=\"openimg(\''+dst+'\',\''+txt+'\',';
   s += w2+','+h2+','+clsbutton+');\"';
   s += ' OnMouseOver=\"this.className=\'cursor\';\"';
   //s += ' OnMouseOver=\'alert(\"mouseover\");\'';
   s += '>';
   document.write(s);
}

function openartimg2(imgurl,caption) {
window.open( "/"+impop+"?img="+imxi+imgurl+"&caption="+caption, "","resizable=1,height=200,width=200"); 
}

