function misTub(){
	myID = document.getElementById('qsLid');
	myCo = myID.value;
	myID = document.getElementById('qsTid');
	myTo = myID.value;
	if ((myCo == "") || (myTo == "")){
		if ((myCo == "") && (myTo == "")){
			alert("Errors ! \u000a Please choose a Town\u000a Please choose a County ");
		} else if (myCo == "") {
			alert("Error ! \u000a Please choose a County ");
		} else {
			alert("Error ! \u000a Please choose a Town ");
		}
		return false;
	} else {
		cookieJar2("toCo", myTo + "@" + myCo);
	}
}


function cookieJar2(cookieName, cookieNumber){
	expireDate = new Date;
	expireDate.setDate(expireDate.getDate()+100);
	document.cookie = cookieName+" = "+cookieNumber+"; expires=" + expireDate.toGMTString() + "; path=/";
}

function setCookie(name, value, expires, path, domain, secure) {
  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}

function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}



function coChange(p1, p2){
	popDropDown(popArray(p1),p2);
	setVal('co',p1);
	var pok = document.getElementById('qsTid');
	setVal('to',pok.options[pok.selectedIndex].text);
}

function setVal(p1,p2){
	var pol = document.getElementById(p1);
	pol.value=p2;
}

function declMoreVars(){
findDims();
smallS=(winW>850?false:true);
if (smallS){
	setH("topRid", 1);
	setH("midDL", 89);
	setH("midDM", 89);
	setH("midDR", 89);
	setDi("topRid", "none")

    setLPt("myLog1", 238);
    setTPt("myLog1", 230);
	setBi("myLg", "url('./img/in_1/loxs.gif')");
    xmouse=376;                // co-ordinates of clock
    ymouse=373;                // co-ordinates of clock

    setLPt("myBLog", 10);
    setTPt("myBLog", 75);

    setLPt("myQD1", 181);
    setTPt("myQD1", 75);

    setLPt("myCLog", 400);
    setTPt("myCLog", 75);

    setDi("idBn1", "None");

   setW ("midDL", 1);
   setW ("midDM", 98);
   setW ("midDR", 1);
   setW ("botDL", 1);
   setW ("botDM", 98);
   setW ("botDR", 1);

    setLPt("idTn", 5);
    setLPt("idBn", 5);
    setTPt("idTn", -5);
    setTPt("idBn", 55);

    setLPt("myLg", 12);
    setTPt("myLg", -20);

    setWPt("idTn", 558);
    setWPt("idBn", 558);
    if (ff) {
		xmouse=364;		// co-ordinates of clock
		ymouse=355;		// co-ordinates of clock
	   setFsPt("myCLog", 11);
	   setFsPt("myBLog", 11);
	   setFsPt("qsLid", 11);
	   setFsPt("qsTid", 11);
	   setFsPt("qsCui", 11);
	   setFsPt("tdL1", 11);
	   setFsPt("tdL2", 11);
	   setFsPt("tdL3", 11);
		setLPt("idBn", 12);
		setLPt("idTn", 12);
      setLPt("myQD1", 189);
		setWPt("idBn", 562);
		setWPt("idTn", 562);
   	setW ("midDL", 1);
	   setW ("midDM", 96);
	   setW ("midDR", 3);
	   setW ("botDL", 1);
	   setW ("botDM", 96);
	   setW ("botDR", 3);
   }


} else {
	divD=1;		// width of blocks which make up hands
	size=1;		//
	ClockHeight=40;
	ClockWidth=40;
   yMOffset = 15;
   xMOffset = 25;
   if (ff) {
		xmouse=487;		// co-ordinates of clock
		ymouse=491;		// co-ordinates of clock
	   setFsPt("myCLog", 11);
	   setFsPt("myBLog", 11);
	   setFsPt("qsLid", 11);
	   setFsPt("qsTid", 11);
	   setFsPt("qsCui", 11);
	   setFsPt("tdL1", 11);
	   setFsPt("tdL2", 11);
	   setFsPt("tdL3", 11);
		setLPt("idBn", 81);
		setLPt("idTn", 81);
		setWPt("idBn", 604);
		setWPt("idTn", 604);
   } else {
		ymouse=506;		// co-ordinates of clock
		xmouse=497;		// co-ordinates of clock
   }
}

ClockFromMouseY=0;
ClockFromMouseX=100;
Face='1 2 3 4 5 6 7 8 9 10 11 12';
font='Arial';
HandHeight=ClockHeight/12;
HandWidth=ClockWidth/12;
d=new Array("SUNDAY","MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY");
m=new Array("JANUARY","FEBRUARY","MARCH","APRIL","MAY","JUNE","JULY","AUGUST","SEPTEMBER","OCTOBER","NOVEMBER","DECEMBER");
date=new Date();
day=date.getDate();
year=date.getYear();
if (year < 2000) year=year+1900;
TodaysDate=" "+d[date.getDay()]+" "+day+" "+m[date.getMonth()]+" "+year;
D=TodaysDate.split('');
    H='.........';
    M='...........';
    S='............';
H=H.split('');
M=M.split('');
S=S.split('');
Face=Face.split(' ');
n=Face.length;
a=size*10;
/*b*/
scrll=0;
props="<font face="+font+" size="+size+" color="+fCol+"><B>";
props2="<font face="+font+" size="+size+" color="+dCol+"><B>";
Split=360/n;
Dsplit=360/D.length;
HandY= 6;
HandX= 3 ; //-2.5;
scrll=0;
step=0.06;
currStep=0;
y=new Array();
x=new Array();
Y=new Array();
X=new Array();
for (i=0; i < n; i++){
/*y[i]=0;
x[i]=0;
Y[i]=0;
X[i]=0*/
//following change makes clock static
y[i]=ymouse;
x[i]=xmouse;
Y[i]=ymouse;
X[i]=xmouse;
}
Dy=new Array();Dx=new Array();DY=new Array();DX=new Array();
}

function tabBg(){

	if (ie) {
		for (i = 0; i < tDx.length; i++){
			tDx[i].style.backgroundImage = "url(\"./img/dot.gif\")";
			tDx[i].style.backgroundColor = "f8803e";
			tDx[i].style.backgroundRepeat = "repeat";
		}
	} else {
		var tDxes = document.getElementsByName("tDx");
		if ((navigator.vendorSub > 7) || !(ns)) {
	      for (i = 0; i < tDxes.length; i++){
	         tDxes[i].style.backgroundImage = "url(\"./img/dot.gif\")";
	         tDxes[i].style.backgroundRepeat = "repeat";
	      }
	   } else {
	      alert("Browser Error ! > "+tDxes.length);
	      for (i = 0; i < tDxes.length; i++){
//	         tDxes[i].Style.backgroundImage = "url(\"./img/dot.gif\")";
//	         tDxes[i].Style.backgroundColor = "f8803e";
//	         tDxes[i].Style.backgroundRepeat = "repeat";
	      }
	   }
	}
}

function declVars(){
hStr = 55;
wStr = 35;
my_si=randMe();
my_sj=randMe();
my_sk=randMe();
my_qd=1;
resetj();
resetk();
reseti();
my_gap = 1;
my_myArray = [0,1,2,3,4,5,6,7,8,9,'a','b','c','d','e','f'];
my_myVal = 10;
my_h=0;
}

function cuisineCh(){
var pol = 23;

}
function pickPic(){
	var myD1 = new Date();
	var myX = myD1.getMilliseconds()%3;
	setSo('imgn', './img/v08/in' + myX + '.png');
	var myD2 = new Date();
	var myY = myD2.getMilliseconds()%3;
	setSo('imgo', './img/v08/io' + myY + '.png');
	setDi("imgn", "block")
	setDi("imgo", "block")
}

function initTaf(){
	pickPic();
	popDropDown (popCounty(), "qsLid");
	popDropDown (popCuType(), "qsCui");
	popDropDown (popCuTo1(), "qsTid");
	myFoc = document.getElementById('qsLid');
	myFoc.focus();
	snapBiscuits();
	if (cookies["toCo"] != "") {
		var arVals = cookies["toCo"].split(/@/);
		if (arVals[1] != "") {
			if (ie) {
				repos('qsLid', arVals[1]);
			} else {
				reposF('qsLid', arVals[1]);
			}
			myFoc = document.getElementById('qsTid');
			myFoc.focus();
		}
		if (arVals[0] != "") {
			pol2 = document.getElementById('qsLid');
			if (ie) {
				repos('qsTid', arVals[0]);
			} else {
				reposF('qsTid', arVals[0]);
			}
			myFoc = document.getElementById('qsCui');
			myFoc.focus();
		}
	}
}

function snapBiscuits(){
	var nam, val;
	var beg, mid, end;
	for (nam in cookies){
		cookies = new Object();
		break;
	}
	beg = 0;
	while (beg < document.cookie.length) {
		mid = document.cookie.indexOf('=', beg);
		end = document.cookie.indexOf(';', beg);
		end = (end == -1?document.cookie.length:end);
		if ((mid > end) || (mid == -1)){
			nam = document.cookie.substring(beg, end);
			val = "";
		} else {
			nam = document.cookie.substring(beg, mid);
			val = document.cookie.substring(mid + 1, end);;
		}
		cookies[nam] = unescape(val);
		beg = end + 2;
	}
}

function repos(p1, p2){
		rPol = document.getElementById(p1);
		for (i=0; i<rPol.children.length; i++){
			rPol.children[i].selected = (rPol.children[i].value == p2 ? true : false);
		}
		if (p1 == "qsLid" ) {
			coChange(rPol.options[rPol.selectedIndex].text,'qsTid');
		}
}

function reposF(p1, p2){
		rPol = document.getElementById(p1);
		for (i=0; i<rPol.childNodes.length; i++){
			rPol.childNodes[i].selected = (rPol.childNodes[i].value == p2 ? true : false);
		}
		if (p1 == "qsLid" ) {
			coChange(rPol.options[rPol.selectedIndex].text,'qsTid');
		}
}

function setDi(myOb, myW){
	pol = document.getElementById(myOb);
   pol.style.display = myW;
}

function setSo(myOb, myW){
   pol = document.getElementById(myOb);
   pol.src = myW;
}

function setBi(myOb, myW){
	pol = document.getElementById(myOb);
   pol.style.backgroundImage = myW;
}

function setC(myOb, myW){
	pol = document.getElementById(myOb);
   pol.style.color = myW;
}
function setT(myOb, myW){
	pol = document.getElementById(myOb);
   pol.style.top = myW + "%";
}
function setTNoPc(myOb, myW){
	pol = document.getElementById(myOb);
   pol.style.top = myW;
}

function setTPt(myOb, myW){
	pol = document.getElementById(myOb);
   pol.style.top = myW + "pt";
}

function setW(myOb, myW){
	pol = document.getElementById(myOb);
   pol.style.width = myW + "%";
}

function setWPt(myOb, myW){
	pol = document.getElementById(myOb);
   pol.style.width = myW + "pt";
}


function setL(myOb, myW){
	pol = document.getElementById(myOb);
   pol.style.left = myW + "%";
}
function setLPt(myOb, myW){
	pol = document.getElementById(myOb);
   pol.style.left = myW + "pt";
}
function setH(myOb, myW){
	pol = document.getElementById(myOb);
   pol.style.height = myW + "%";
}
function setHPt(myOb, myW){
	pol = document.getElementById(myOb);
   pol.style.height = myW + "pt";
}


function setP(myOb, myW){
	pol = document.getElementById(myOb);
   pol.style.paddingTop = myW + "%";
}
function setPPt(myOb, myW){
	pol = document.getElementById(myOb);
   pol.style.paddingTop = myW + "px";
}

function setFs(myOb, myW){
	pol = document.getElementById(myOb);
   pol.style.fontSize = myW + "%";
}
function setFsPt(myOb, myW){
	pol = document.getElementById(myOb);
   pol.style.fontSize = myW + "pt";
}


function Mouse(evnt){
/*ymouse = (ff)?evnt.pageY+ClockFromMouseY-(window.pageYOffset):event.y+ClockFromMouseY;
xmouse = (ff)?evnt.pageX+ClockFromMouseX:event.x+ClockFromMouseX;*/
}

function ClockAndAssign(){
time = new Date ();
secs = time.getSeconds();
sec = -1.57 + Math.PI * secs/30;
mins = time.getMinutes();
min = -1.57 + Math.PI * mins/30;
hr = time.getHours();
hrs = -1.575 + Math.PI * hr/6+Math.PI*parseInt(time.getMinutes())/360;
if (ie || ff){
//Od.style.top=window.document.body.scrollTop;
/*Of.style.top=window.document.body.scrollTop;
Oh.style.top=window.document.body.scrollTop;
Om.style.top=window.document.body.scrollTop;
Os.style.top=window.document.body.scrollTop;*/
setTNoPc("Of",window.document.body.scrollTop);
setTNoPc("Oh",window.document.body.scrollTop);
setTNoPc("Om",window.document.body.scrollTop);
setTNoPc("Os",window.document.body.scrollTop);
	if (ff) {
	 var ffFace = document.getElementsByName("ffF");
	 var ffHours = document.getElementsByName("ffH");
	 var ffMinutes = document.getElementsByName("ffM");
	 var ffSeconds = document.getElementsByName("ffS");
	}
}
for (i=0; i < n; i++){
 var F=(ns)?document.layers['nsFace'+i]:(ff)?ffFace[i].style:ieFace[i].style;
 F.top=y[i] + ClockHeight*Math.sin(-1.0471 + i*Split*Math.PI/180)+scrll;
 F.left=x[i] + ClockWidth*Math.cos(-1.0471 + i*Split*Math.PI/180);
 }
for (i=0; i < H.length; i++){
 var HL=(ns)?document.layers['nsHours'+i]:(ff)?ffHours[i].style:ieHours[i].style;
 HL.top=y[i]+HandY+(i*HandHeight)*Math.sin(hrs)+scrll;
 HL.left=x[i]+HandX+(i*HandWidth)*Math.cos(hrs);
 }
for (i=0; i < M.length; i++){
 var ML=(ns)?document.layers['nsMinutes'+i]:(ff)?ffMinutes[i].style:ieMinutes[i].style;
 ML.top=y[i]+HandY+(i*HandHeight)*Math.sin(min)+scrll;
 ML.left=x[i]+HandX+(i*HandWidth)*Math.cos(min);
 }
for (i=0; i < S.length; i++){
 var SL=(ns)?document.layers['nsSeconds'+i]:(ff)?ffSeconds[i].style:ieSeconds[i].style;
 SL.top=y[i]+HandY+(i*HandHeight)*Math.sin(sec)+scrll;
 SL.left=x[i]+HandX+(i*HandWidth)*Math.cos(sec);
 }
/*for (i=0; i < D.length; i++){
 var DL=(ff)?document.layers['nsDate'+i]:ieDate[i].style;
 DL.top=Dy[i] + ClockHeight*1.5*Math.sin(currStep+i*Dsplit*Math.PI/180)+scrll;
 DL.left=Dx[i] + ClockWidth*1.5*Math.cos(currStep+i*Dsplit*Math.PI/180);
 }*/
currStep-=step;
}
function Delay(){
scrll=(ns)?window.pageYOffset:0;
Dy[0]=Math.round(DY[0]+=((ymouse)-DY[0])*speed);
Dx[0]=Math.round(DX[0]+=((xmouse)-DX[0])*speed);
for (i=1; i < D.length; i++){
Dy[i]=Math.round(DY[i]+=(Dy[i-1]-DY[i])*speed);
Dx[i]=Math.round(DX[i]+=(Dx[i-1]-DX[i])*speed);
}
y[0]=Math.round(Y[0]+=((ymouse)-Y[0])*speed);
x[0]=Math.round(X[0]+=((xmouse)-X[0])*speed);
for (i=1; i < n; i++){
y[i]=Math.round(Y[i]+=(y[i-1]-Y[i])*speed);
x[i]=Math.round(X[i]+=(x[i-1]-X[i])*speed);
}
ClockAndAssign();
//setTimeout('Delay()',myTO);
}

function reseti(){
  my_ei=randMe();
  my_idir = (my_si > my_ei ? -1 : 1)
  my_myVar = '1';
}

function resetj(){
  my_ej=randMe();
  my_jdir = (my_sj > my_ej ? -1 : 1)
  my_myVar = '2';
}

function resetk(){
  my_ek=randMe();
  my_kdir = (my_sk > my_ek ? -1 : 1)
  my_myVar = '3';
}


function randMe(){
return Math.round(Math.random() * 255)
}

function doit(){
    switch(my_myVar) {
      case '1' :
        chamelo(my_si, my_sj, my_sk);
        if (my_idir == 1) {
          my_si = my_si + my_gap;
          if (my_si >= my_ei) {
            my_si = my_ei;
            resetj();
          }
        } else {
          my_si = my_si - my_gap;
          if (my_si <= my_ei) {
            my_si = my_ei;
            resetj();
          }
        }
        break;
      case '2' :
        chamelo(my_si, my_sj, my_sk);
        if (my_jdir == 1) {
          my_sj = my_sj + my_gap;
          if (my_sj >= my_ej) {
            my_sj = my_ej;
            resetk();
          }
        } else {
          my_sj = my_sj - my_gap;
          if (my_sj <= my_ej) {
            my_sj = my_ej;
            resetk();
          }
        }
        break;
      case '3' :
        chamelo(my_si, my_sj, my_sk);
        if (my_jdir == 1) {
          my_sk = my_sk + my_gap;
          if (my_sk >= my_ek) {
            my_sk = my_ek;
            reseti();
          }
        } else {
          my_sk = my_sk - my_gap;
          if (my_sk <= my_ek) {
            my_sk = my_ek;
            reseti();
          }
        }
        break;
  }
// setTimeout("doit()",243);

}

function chamelo(my_i,my_j,my_k) {
 my_m = new String(my_myArray[Math.floor(16 * ((my_i/16)-Math.floor(my_i/16)))]);
 my_l = new String(my_myArray[Math.floor(my_i / 16)]);
 my_o = "#" + my_l + my_m;
 my_m = new String(my_myArray[Math.floor(16 * ((my_j/16)-Math.floor(my_j/16)))]);
 my_l = new String(my_myArray[Math.floor(my_j / 16)]);
 my_p = my_o + my_l + my_m;
 my_m = new String(my_myArray[Math.floor(16 * ((my_k/16)-Math.floor(my_k/16)))]);
 my_l = new String(my_myArray[Math.floor(my_k / 16)]);
 my_n = my_p + my_l + my_m;
 }

function findDims(){
 winW = 0;
 winH = 0;
 if (window.innerWidth){
 	winW = window.innerWidth;
 	}
 else if ((document.body) && (document.body.clientWidth)) {
 	winW = document.body.clientWidth;
 	}

 if (window.innerHeight)
 	winH = window.innerHeight;
 else if ((document.body) && (document.body.clientHeight))
 	winH = document.body.clientHeight;

 if (document.documentElement && document.documentElement.clientWidth && document.documentElement.clientHeight && winW == 0) {
 	winW = document.documentElement.clientWidth;
 	winH = document.documentElement.clientHeight;
 }
}

function popDropDown (aOfOpts,thisDropDown)
{	// this function populates dropdown
	var inMenu= document.getElementById( thisDropDown );
// BdeCMD [1.3] next line supercedes others
   inMenu.length = 0;
// BdeCMD [1.3] 	var intlength = inMenu.length;
// BdeCMD [1.3] 	for(i = 0; i < intlength  ; i ++ )
// BdeCMD [1.3] 	{
// BdeCMD [1.3] 			inMenu.options[i] = null;
// BdeCMD [1.3]	 /*	inMenu.options.remove(0);      //v0*/
// BdeCMD [1.3] 	}
	for(i = 0; i < aOfOpts.length ; i ++ )
	{
		var oOption=new Option(aOfOpts[i].caption, aOfOpts[i].value, false,false);
		inMenu.options[i]=oOption;
	}
}

function hTC( value,caption)
{
	this.value = value;
	this.caption = caption;
}

function popCuTo1() {
aTC = new Array();
aTC[aTC.length] = new hTC("","*Select County First");
return aTC;
}
