var DHTML = (document.getElementById || document.all || document.layers);
function findlayer(layerscollection, layerid) {
for(i=0; i 0) {
innerlayers = findlayer(layerscollection[i].document.layers, layerid);
if(innerlayers != false) return innerlayers;
}
if(i == layerscollection.length-1 && layerscollection[i].document.layers.length == 0) {
return false;
}
}
}
function getObj(name){
if (document.getElementById) {
if(document.getElementById(name)) {
return document.getElementById(name);
} else {
return false;
}
} else if (document.all) {
if(document.all[name]) {
return document.all[name];
} else {
return false;
}
} else if (document.layers) {
return findlayer(document.layers, name);
}
}
/*function right(e) {
if (navigator.appName == 'Netscape' && (e.which == 3 || e.which == 2)){
return false;
}else if (navigator.appName == 'Microsoft Internet Explorer' && (event.button == 2 || event.button == 3)) {
alert("Tee For Travel, the premier site for luxury golfing holidays!");
return false;
}
return true;
}
document.onmousedown=right;
document.onmouseup=right;
if (document.layers){
window.captureEvents(Event.MOUSEDOWN);
}
if (document.layers){
window.captureEvents(Event.MOUSEUP);
}
window.onmousedown=right;
window.onmouseup=right;*/
if (navigator.appName == "Microsoft Internet Explorer"){
isNavigator = "n";
}else{
isNavigator = "y";
}
//bookmark
function bookmark()
{
if (navigator.appName == 'Microsoft Internet Explorer' && parseInt(navigator.appVersion) >= 4)
{
window.external.AddFavorite('http://www.golfingtrips.co.uk/', 'Tee For Travel');
}
}
//top menu code
function MM_findObj(n, d) { //v4.0
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i 0 ) { // If Internet Explorer, return version number
// if(parseInt (ua.substring (msie+5, ua.indexOf (".", msie ))) <=3) {
// display = "false";
// }
//
// }
if (!DHTML) return;
thelayer = new getObj(layer);
if (thelayer == false) return;
if(action == 'show') {
thelayer.style.visibility = "visible";
} else {
thelayer.style.visibility = "hidden";
}
}
function popitup(imageid) {
itis = window.open("areamap.php?id="+imageid,"","toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=500,height=500,left=100,top=100");
itis.focus();
}
function MM_showHideLayers() { //v3.0
var i,p,v,obj,args=MM_showHideLayers.arguments;
it = args[0];
thing = it.visibility
if(thing == null) thing='show'
var ua = window.navigator.userAgent;
var msie = ua.indexOf ( "MSIE " );
var display = "true";
if ( msie > 0 ) { // If Internet Explorer, return version number
if(parseInt (ua.substring (msie+5, ua.indexOf (".", msie ))) <=4) {
display = "false";
}
}
if (display=="true") {
var i,p,v,obj,args=MM_showHideLayers.arguments;
for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
obj.visibility=v; }
}
//reset variables when layer is hidden
if (v=='hide')
{
var clipTop = 0;
var clipWidth = 210;
var clipBottom = 200;
var topper = 0;
var lyrheight = 0;
var amount = 0;
}
}
function getObj(name)
{
if (document.getElementById)
{
this.obj = document.getElementById(name);
this.style = document.getElementById(name).style;
}
else if (document.all)
{
this.obj = document.all[name];
this.style = document.all[name].style;
}
else if (document.layers)
{
this.obj = document.layers[name];
this.style = document.layers[name];
}
}
var clipTop = 0;
var clipWidth = 210;
var clipBottom = 200;
var topper = 0;
var lyrheight = 0;
var time,amount,theTime,theHeight,DHTML;
function prepLyr(layername)
{
DHTML = (document.getElementById || document.all || document.layers)
if (!DHTML) return;
var x = new getObj(layername);
if (document.layers)
{
lyrheight = x.style.clip.bottom;
lyrheight += 20;
x.style.clip.top = clipTop;
x.style.clip.left = 0;
x.style.clip.right = clipWidth;
x.style.clip.bottom = clipBottom;
}
else if (document.getElementById || document.all)
{
lyrheight = x.obj.offsetHeight;
x.style.clip = 'rect('+clipTop+' '+clipWidth+' '+clipBottom+' 0)'
}
}
function scrollayer(layername,amt,tim)
{
if (!DHTML) return;
thelayer = new getObj(layername);
if (!thelayer) return;
amount = amt;
theTime = tim;
realscroll();
}
function realscroll()
{
if (!DHTML) return;
clipTop += amount;
clipBottom += amount;
topper -= amount;
if (clipTop < 0 || clipBottom > (lyrheight + 10))
{
clipTop -= amount;
clipBottom -= amount;
topper += amount;
return;
}
if (document.getElementById || document.all)
{
clipstring = 'rect('+clipTop+' '+clipWidth+' '+clipBottom+' 0)'
thelayer.style.clip = clipstring;
thelayer.style.top = topper;
}
else if (document.layers)
{
thelayer.style.clip.top = clipTop;
thelayer.style.clip.bottom = clipBottom;
thelayer.style.top = topper;
}
time = setTimeout('realscroll()',theTime);
}
function stopScroll()
{
if (time) clearTimeout(time);
}
function resetLyr(layername)
{
clipTop = 0;
clipWidth = 210;
clipBottom = 200;
topper = 0;
lyrheight = 0;
amount = 0;
thelayer = new getObj(layername);
if (document.getElementById || document.all)
{
clipstring = 'rect('+clipTop+' '+clipWidth+' '+clipBottom+' 0)'
thelayer.style.clip = clipstring;
thelayer.style.top = topper;
}
else if (document.layers)
{
thelayer.style.clip.top = clipTop;
thelayer.style.clip.bottom = clipBottom;
thelayer.style.top = topper;
}
}
function changeborder(imagename, type)
{
if (!DHTML) return;
theimage = new getObj(imagename);
if (theimage == false) return;
if(type == 0) {
theimage.style.borderColor = "#66CC66";
} else {
theimage.style.borderColor = "#FDD55E";
}
}
function changebackground(id,type)
{
if(!DHTML) return;
thelayer = new getObj(id);
if (thelayer == false) return;
if(type == 0) {
thelayer.style.background = "#FFFFFF";
thelayer.style.color = "#339933";
} else {
thelayer.style.background = "#339933";
thelayer.style.color = "#ffffff";
}
}
function recalctotal(subtotal, rooms, maintotal, partysize, price, formname, perperson) {
//get new subtotal for the selected number of rooms of a certain type
numrooms = eval("document.forms."+formname+"."+rooms+".options[document.forms."+formname+"."+rooms+".selectedIndex].value"+";");
if(perperson == 'y') {
newsubtotal = partysize * price * numrooms;
} else {
newsubtotal = price * numrooms;
}
//get the difference in the new main total and the current main total - the complex string functions are used to remove the
//'£' sign from the beginning of the string.
oldsubtotal = eval("document.forms."+formname+"."+subtotal+".value;");
maintotaldiff = newsubtotal - (oldsubtotal.substring(1,(oldsubtotal.length)));
//get the new main total using the difference
currentmaintotal = eval("document.forms."+formname+"."+maintotal+".value;");
newmaintotal = parseInt(currentmaintotal.substring(1,(currentmaintotal.length)))+parseInt(maintotaldiff);
//write the new main total and sub total values to their appropriate boxes
eval("document.forms."+formname+"."+subtotal+".value=\"£\"+newsubtotal;");
eval("document.forms."+formname+"."+maintotal+".value=\"£\"+newmaintotal;");
}
function testforselections(formname, formnum, numberofrooms) {
formname = formname+formnum;
selectionmade=false;
for(i=1; i<=numberofrooms; i++) {
if(eval("document.forms."+formname+".norooms"+i+".options[document.forms."+formname+".norooms"+i+".options.selectedIndex].value;") > 0) {
selectionmade=true;
break;
}
}
if(selectionmade==false) {
alert("Please select some accommodation for this date");
return false;
} else {
return true;
}
}
function hideme()
{
if(document.getElementsByTagName){
var selNodes = document.getElementsByTagName('select')
if (!selNodes.item(0))
{
return false;
}
else
{
var len = selNodes.length;
if(len>1) selNodes.item(1).style.visibility = 'hidden';
if(len>2) selNodes.item(2).style.visibility = 'hidden';
if(len>3) selNodes.item(3).style.visibility = 'hidden';
if(len>4) selNodes.item(4).style.visibility = 'hidden';
if(len>5) selNodes.item(5).style.visibility = 'hidden';
if(len>6) selNodes.item(6).style.visibility = 'hidden';
if(len>7) selNodes.item(7).style.visibility = 'hidden';
if(len>8) selNodes.item(8).style.visibility = 'hidden';
if(len>9) selNodes.item(9).style.visibility = 'hidden';
if(len>10) selNodes.item(10).style.visibility = 'hidden';
}
}
}
function showme()
{
if(document.getElementsByTagName){
var selNodes = document.getElementsByTagName('select')
var i=0;
if (!selNodes.item(0))
{
return false;
}
else
{
var len = selNodes.length;
if(len>1) selNodes.item(1).style.visibility = 'visible';
if(len>2) selNodes.item(2).style.visibility = 'visible';
if(len>3) selNodes.item(3).style.visibility = 'visible';
if(len>4) selNodes.item(4).style.visibility = 'visible';
if(len>5) selNodes.item(5).style.visibility = 'visible';
if(len>6) selNodes.item(6).style.visibility = 'visible';
if(len>7) selNodes.item(7).style.visibility = 'visible';
if(len>8) selNodes.item(8).style.visibility = 'visible';
if(len>9) selNodes.item(9).style.visibility = 'visible';
if(len>10) selNodes.item(10).style.visibility = 'visible';
}
}
}
/*function DoClick() {
if (window.event.srcElement.className == "image" || window.event.srcElement.className == "parent") {
ExpandCollapse()
}
window.event.cancelBubble = true;
}*/
function ExpandCollapse() {
if (window.event.srcElement.className == "parent") {
var oTargetSpan = window.event.srcElement.children(1);
var oImage = window.event.srcElement.children(0);
}
else {
var oTargetSpan = window.event.srcElement.parentElement.children(1);
var oImage = window.event.srcElement;
}
if (oTargetSpan.style.display == "none") {
// expand
HideAll();
oTargetSpan.style.display = "";
oImage.src = "../images/bits/bullet_down.gif";
document.cookie = oTargetSpan.id + "=expand;";
}
else {
// collapse
oTargetSpan.style.display = "none";
oImage.src = "../images/bits/bullet_black.gif";
document.cookie = oTargetSpan.id + "=collapse;";
}
}