function findInnerText(objControl,innerText,nestingLevel){if(typeof objControl.innerText !="undefined"){return objControl.innerText;}
if((typeof nestingLevel !="undefined")&&(nestingLevel>100)){return innerText;}
if(typeof innerText=="undefined"){innerText="";}
if(typeof nestingLevel=="undefined"){nestingLevel=0;}
if(!objControl){return innerText;}
var text=objControl.nodeValue;if(!text){text="";}
if(objControl.nodeName.toLowerCase()=="br"){return "\n";}
for(var i=0;i<objControl.childNodes.length;i++){text +=findInnerText(objControl.childNodes[i],objControl.childNodes[i].nodeValue,nestingLevel + 1);}
return text;}
function sortArray(arr,alpha,ascending){if(alpha){arr.sort(function(x,y){var a=String(x).toUpperCase();var b=String(y).toUpperCase();if(a>b)return 1;if(a<b)return -1;return 0;}
);}
else{arr.sort(function(a,b){return a.replace(/\D/g,"")- b.replace(/\D/g,"")});}
if(!ascending){arr.reverse();}
return arr;}
function sortArrayBySortValue(arr,alpha,ascending){if(alpha){arr.sort(function(x,y){var a=String(x.SortValue);var b=String(y.SortValue);if(a>b)return 1;if(a<b)return -1;return 0;}
);}
else{arr.sort(function(a,b){return a.SortValue - b.SortValue});}
if(!ascending){arr.reverse();}
return arr;}
function MapSlider(div,opts){var me=this;if(typeof div=="string"){this.div=document.getElementById(div);}
else{this.div=div};this.img=document.createElement("img");this.div.appendChild(this.img);if(opts.arrowclass){this.img.className=opts.arrowclass;}
this.openDelayMS=opts.opendelay || 0;this.closeDelayMS=opts.closedelay || 0;this.openTimeMS=opts.opentime || 200;this.closeTimeMS=opts.closetime || 200;this.tickMS=opts.ticktime || 20;this.openImage=opts.openimage;this.closeImage=opts.closeimage;this.timer=undefined;this.startTime=undefined;this.opening=undefined;this.action=opts.action;this.setTargetProperty=function(value){me.div.style.left=value;}
this.getTargetProperty=function(){return me.div.style.left;}
this.getTargetValue=function(){return -this.div.offsetWidth + "px";}
this.openedValue=-this.div.offsetWidth + "px";this.closedValue=(opts.closedValue || 0)+ "px";if(opts.closed){this.CloseDone();}
else{this.OpenDone();}}
MapSlider.prototype.AbortAction=function(){if(this.timer){var delay=(new Date()).getTime()- this.startTime;if(delay<=0){window.clearTimeout(this.timer);this.timer=undefined;this.img.style.visibility="inherit";}}}
MapSlider.prototype.Open=function(){var me=this;if(this.getTargetProperty()==this.openedValue){return;}
this.targetValue=this.getTargetValue();if(!this.timer){this.img.style.visibility="hidden";this.startTime=(new Date()).getTime()+ this.openDelayMS;this.timer=window.setInterval(function(){me.OpenTick()},this.tickMS);}}
MapSlider.prototype.OpenTick=function(){var delay=(new Date()).getTime()- this.startTime;if(delay>0){if(delay>this.openTimeMS){this.OpenDone();}
else{var prop=delay / this.openTimeMS;if(prop>1){prop=1};var bezier=3 *(1 - prop)* prop * prop + prop * prop * prop;this.setTargetProperty(parseInt(this.closedValue)+(bezier *(parseInt(this.targetValue)- parseInt(this.closedValue)))+ "px");}}}
MapSlider.prototype.OpenDone=function(){var me=this;this.setTargetProperty(this.openedValue);this.img.style.visibility="inherit";this.img.src=this.closeImage;this.img.title="Hide this panel";this.img.onclick=function(){me.Close();}
if(this.timer){window.clearInterval(this.timer);this.timer=undefined;}}
MapSlider.prototype.Close=function(){var me=this;if(this.getTargetProperty()==this.closedValue){return;}
this.targetValue=this.getTargetValue();if(!this.timer){this.img.style.visibility="hidden";this.startTime=(new Date()).getTime()+ this.closeDelayMS;this.timer=window.setInterval(function(){me.CloseTick()},this.tickMS);}}
MapSlider.prototype.CloseTick=function(){var delay=(new Date()).getTime()- this.startTime;if(delay>0){if(delay>this.closeTimeMS){this.CloseDone();}
else{var prop=1 -(delay / this.closeTimeMS);if(prop<0){prop=0};var bezier=3 *(1 - prop)* prop * prop + prop * prop * prop;this.setTargetProperty(parseInt(this.closedValue)+(bezier *(parseInt(this.targetValue)- parseInt(this.closedValue)))+ "px");}}}
MapSlider.prototype.CloseDone=function(){var me=this;this.setTargetProperty(this.closedValue);this.img.style.visibility="inherit";this.img.src=this.openImage;this.img.title="Show this panel";this.img.onclick=function(){me.Open();}
if(this.timer){window.clearInterval(this.timer);this.timer=undefined;}}
function ProductTable(){this.HeaderRow;this.Class_SortColumn;this.Class_OddRow;this.Class_EvenRow;this.Class_NumberColumn;this.Class_AlphaColumn;this.Class_CheckBoxColumn;this.Class_SelectedClass;this.Class_BookmarkedRow;this.Class_BookmarkColumn;this.Class_DistanceColumn;this.Image_SortUp;this.Image_SortDown;this.Selectors=new Array(0);this.Bookmarks;this.Table;this.LocList;this.GeoMapManager=undefined;this.FooterDiv=undefined;this.Sorting_LastSortAscending=false;this.Sorting_LastSortColumnIndex=-1;this.Sorting_LastSortType="";this.Initialise=function(tableid,selectedclass,sortcolclass,oddrowclass,evenrowclass,numbercolclass,alphacolclass,checkboxcolclass,distancecolclass,sortup,sortdown){this.Table=document.getElementById(tableid);this.HeaderRow=this.Table.getElementsByTagName("TR")[0];this.Class_SortColumn=sortcolclass;this.Class_OddRow=oddrowclass;this.Class_EvenRow=evenrowclass;this.Class_NumberColumn=numbercolclass;this.Class_AlphaColumn=alphacolclass;this.Class_CheckBoxColumn=checkboxcolclass;this.Class_DistanceColumn=distancecolclass;this.Image_SortUp=sortup;this.Image_SortDown=sortdown;this.Class_SelectedClass=selectedclass;for(cix=0;cix<this.Columns();cix++){this.Cell(0,cix).OriginalText=findInnerText(this.Cell(0,cix));this.Cell(0,cix).OriginalClasses=this.Cell(0,cix).className;}
this.FooterDiv=document.createElement("div");this.FooterDiv=this.Table.parentNode.insertBefore(this.FooterDiv,this.Table.nextSibling);this.FooterDiv.style.display="none";this.FooterDiv.style.padding="5px";this.FooterDiv.style.textAlign="center";this.FooterDiv.style.fontSize="10px";}
this.Columns=function(){return this.HeaderRow.cells.length;}
this.Rows=function(){return this.HeaderRow.parentNode.rows.length;}
this.Row=function(row){return this.HeaderRow.parentNode.rows[row];}
this.Cell=function(row,col){return this.HeaderRow.parentNode.rows[row].cells[col];}
this.MoveRowToEnd=function(row){this.HeaderRow.parentNode.appendChild(this.HeaderRow.parentNode.rows[row]);}
this.MoveRowToEndDirect=function(row){this.HeaderRow.parentNode.appendChild(row);}
this.FixColumnWidths=function(){var total=0;for(cix=0;cix<this.Columns();cix++){total +=this.Cell(0,cix).offsetWidth;}
for(cix=1;cix<this.Columns();cix++){this.Cell(0,cix).style.width=parseInt(1 +(this.Cell(0,cix).offsetWidth * 100)/ total)+ "%";}}
this.ApplyHeaderClassesToCells=function(){for(cix=0;cix<this.Columns();cix++){var headerclasses=this.Cell(0,cix).className;for(rix=1;rix<this.Rows();rix++){this.Cell(rix,cix).className=headerclasses;}}}
this.ColumnHeader=function(col){return findInnerText(this.Cell(0,col).childNodes[0]).trim();}
this.CellValues=function(row,col){var cell=this.Cell(row,col);if(!cell.cellvalues){cell.cellvalues=this.CreateCellValues(row,col);}
return cell.cellvalues;}
this.CreateCellValues=function(row,col){var cell=this.Cell(row,col);var output=new Array(0);for(var i=0;i<cell.childNodes.length;i++){if(cell.childNodes[i].nodeName.toLowerCase()!="br"){var text=findInnerText(cell.childNodes[i]).trim();if(text.length>0){output[output.length]=text;}}}
cell.cellvalues=output;return output;}
this.ColumnValues=function(col){var output=new Array(0);for(rix=1;rix<this.Rows();rix++){var values=this.CellValues(rix,col);for(var j in values){var found=false;for(var k in output){if(output[k]==values[j]){found=true;}}
if(!found){output[output.length]=values[j];}}}
return output;}
this.CreateSortButtons=function(){for(cix=0;cix<this.Columns();cix++){var cell=this.Cell(0,cix);hdiv=cell.childNodes[0];if(cell.className){if(cell.className.indexOf(this.Class_SortColumn)>=0){hdiv.title="Click once to sort by the '"+ this.ColumnHeader(cix)+ "' column. Click again to reverse the sorting order.";hdiv.ProductTable=this;hdiv.ColumnIndex=cix;hdiv.onclick=function(){this.ProductTable.Sort(this.ColumnIndex);};}
else{hdiv.title="You cannot sort by the '"+ this.ColumnHeader(cix)+ "' column.";}}
hdiv.onfocus=function(){blur();}}}
this.Sort=function(col){document.body.style.cursor="wait";if(this.Cell(0,col).className.indexOf(this.Class_SortColumn)>=0){for(i=0;i<this.Columns();i++){var c=this.Cell(0,i);var divs=c.getElementsByTagName("div");if(divs.length>0){divs[0].style.backgroundImage="";}}
if(this.Cell(0,col).className.indexOf(this.Class_NumberColumn)>=0){this.Sorting_LastSort_Type=this.Class_NumberColumn;}
else{this.Sorting_LastSort_Type=this.Class_AlphaColumn;}
if(this.Sorting_LastSortColumnIndex==col){this.Sorting_LastSortAscending=!this.Sorting_LastSortAscending;}
else{this.Sorting_LastSortAscending=true;this.Sorting_LastSortColumnIndex=col;}
var rows=new Array(0);var founditems=0;for(rix=1;rix<this.Rows();rix++){var row=this.Row(rix);rows[rows.length]=row;var optionlist=this.CellValues(rix,col);if(optionlist.length>0){founditems +=optionlist.length;sortArray(optionlist,(this.Sorting_LastSort_Type==this.Class_AlphaColumn),this.Sorting_LastSortAscending);if(this.Sorting_LastSort_Type==this.Class_AlphaColumn){row.SortValue=optionlist[0].toUpperCase();}
else{row.SortValue=optionlist[0].replace(/\D/g,"");}}
else{if(this.Sorting_LastSort_Type==this.Class_AlphaColumn){row.SortValue="";}
else{row.SortValue=0;}}}
if(founditems>0){var c=this.Cell(0,col);var divs=c.getElementsByTagName("div");if(this.Sorting_LastSortAscending){if(divs.length>0){divs[0].style.backgroundImage="url(\"" + this.Image_SortUp + "\")";}}
else{if(divs.length>0){divs[0].style.backgroundImage="url(\"" + this.Image_SortDown + "\")";}}
sortArrayBySortValue(rows,(this.Sorting_LastSort_Type==this.Class_AlphaColumn),this.Sorting_LastSortAscending);for(rix=1;rix<rows.length;rix++){this.MoveRowToEndDirect(rows[rix]);}}}
this.ColorRows();document.body.style.cursor="default";}
this.ColorRows=function(){for(rix=1;rix<this.Rows();rix++){var row=this.Row(rix);if((rix % 2)==1){row.className=this.Class_EvenRow;}
else{row.className=this.Class_OddRow;}
if(this.Bookmarks){if(this.Bookmarks.Contains(row.getAttribute("tag"))){row.className=this.Class_BookmarkedRow;}}
if(row.Illuminated){row.className=this.Class_SelectedClass;}}}
this.IlluminateRow=function(target){for(rix=1;rix<this.Rows();rix++){this.Row(rix).Illuminated=false;}
if(target>0){this.Row(target).Illuminated=true;}
this.ColorRows();}
this.FindRowWithHRef=function(url){for(rix=1;rix<this.Rows();rix++){for(cix=0;cix<this.Columns();cix++){var cell=this.Cell(rix,cix);var els=cell.getElementsByTagName("A");if(els){for(eix=0;eix<els.length;eix++){if(els[eix].href==url){return rix;}}}}}
return -1;}
this.UpdateTable=function(){var bAny=false;for(rix=1;rix<this.Rows();rix++){var row=this.Row(rix);var visible=true;if(!row.enabled){visible=false}
if(visible==false){row.style.display="none";}
else{row.style.display="";bAny=true;}}
while(this.FooterDiv.hasChildNodes()){this.FooterDiv.removeChild(this.FooterDiv.lastChild);}
var tableitems=new Array(0);var i=0;var s=0;var message="";var maplimited=false;var selectedmarkers;var value;for(i=0;i<this.Selectors.length;i++){if(this.Selectors[i]){if(this.Selectors[i].selectedIndex==-1){value="*";}
else{value=this.Selectors[i].options[this.Selectors[i].selectedIndex].value;}
if(value !="*"){tableitems[tableitems.length]=this.Selectors[i].options[this.Selectors[i].selectedIndex].text;}}}
if(!bAny){message="No experience days were found";this.FooterDiv.style.color="#FF0000";this.FooterDiv.style.fontWeight="bold";}
else{if((tableitems.length>0)||(maplimited==true)){message="Table showing experience days";}
this.FooterDiv.style.color="#606060";this.FooterDiv.style.fontWeight="normal";}
if(message>""){if((tableitems.length>0)||(maplimited==true)){message +=" that match the options you have selected";if(tableitems.length>0){message +=" here ("+ tableitems.join(", ")+ ")";if(maplimited==true){message +=" and";}}
if(maplimited==true){message +=" on the map";}}
message +=".";this.FooterDiv.appendChild(document.createTextNode(message));this.FooterDiv.style.display="block";}
else{this.FooterDiv.style.display="none";}}
this.UpdateDistances=function(distancesexist,venueonly){var distancecix=undefined;var cell;for(cix=0;cix<this.Columns();cix++){cell=this.Cell(0,cix);if(cell.className.indexOf(this.Class_DistanceColumn)>=0){distancecix=cix;break;}}
if(!distancecix){return;}
for(rix=1;rix<this.Rows();rix++){var row=this.Row(rix);cell=this.Cell(rix,distancecix);while(cell.hasChildNodes()){cell.removeChild(cell.lastChild);}
if(distancesexist){if(this.LocList){var nearest=this.LocList.getNearestLocation(row.getAttribute("tag"));if(nearest){cell.appendChild(document.createTextNode(nearest.distance + " miles"));cell.title="Closest location is "+ nearest.name;cell.cellvalues=undefined;}}
cell.style.display="";}
else{cell.cellvalues=undefined;cell.style.display="none";}}
if(distancesexist){this.Cell(0,distancecix).style.display="";}
else{this.Cell(0,distancecix).style.display="none";if(this.Selectors[distancecix].selectedIndex !=0){this.Selectors[distancecix].selectedIndex=0;}
if(this.GeoMapManager){this.GeoMapManager.clearMaxDistance();}}
if(venueonly){if(this.Selectors[distancecix].selectedIndex !=1){this.Selectors[distancecix].selectedIndex=1;this.Selectors[distancecix].onchange();}
else{this.SetRowState();this.UpdateTable();}}
else{if(this.Selectors[distancecix].selectedIndex==1){this.Selectors[distancecix].selectedIndex=0;this.Selectors[distancecix].onchange();}
else{this.SetRowState();this.UpdateTable();}}
if(this.Sorting_LastSortColumnIndex==distancecix){this.Sorting_LastSortColumnIndex=undefined;this.Cell(0,distancecix).style.backgroundImage="";}}
this.SetRowState=function(){var enabledproducts=new Array(0);for(rix=1;rix<this.Rows();rix++){var foundval=true;for(var i in this.Selectors){if(this.Selectors[i]){if(this.Cell(0,i).style.display !="none"){var cix=this.Selectors[i].ColumnIndex;var number=(this.Cell(0,cix).className.indexOf(this.Class_NumberColumn)>=0);var value;if(this.Selectors[i].selectedIndex==-1){value="*";}
else{value=this.Selectors[i].options[this.Selectors[i].selectedIndex].value;}
if(value !="*"){if(number){value=parseInt(value.replace(/\D/g,""));}
var colfound=false;var values=this.CellValues(rix,cix);var j;if(number){for(j in values){if(parseInt(values[j].replace(/\D/g,""))<=value){colfound=true;break;}}}
else{for(j in values){if(values[j].match("^"+ value)==value){colfound=true;break;}}}
if(!colfound){foundval=false;break;}}}}}
this.Row(rix).enabled=foundval;if(foundval){enabledproducts[enabledproducts.length]=this.Row(rix).getAttribute("tag");}}
if(this.GeoMapManager){this.GeoMapManager.setMarkersEnabledState(enabledproducts);}}
this.CreateSelectors=function(){for(cix=0;cix<this.Columns();cix++){var cell=this.Cell(0,cix);if(cell.className.indexOf(this.Class_CheckBoxColumn)>=0){this.CreateColumnSelector(cix);}}
this.SetRowState();}
this.CreateColumnSelector=function(cix){var me=this;var cell=this.Cell(0,cix);while(cell.getElementsByTagName("select").length>0){cell.removeChild(cell.getElementsByTagName("select")[0]);}
this.Selectors[cix]=undefined;var sel=document.createElement("select");sel.ColumnIndex=cix;this.Selectors[cix]=sel;var distancecol=(cell.className.indexOf(this.Class_DistanceColumn)>=0);var opt;if(distancecol){sel.style.textAlign="right";sel.onchange=function(){if(this.options[this.selectedIndex].value=="*"){this.style.borderColor="#000000";if(me.GeoMapManager){me.GeoMapManager.clearMaxDistance();}}
else{this.style.borderColor="#FF0000";if(me.GeoMapManager){var maxdistance=parseInt(this.options[this.selectedIndex].value.replace(/\D/g,""));me.GeoMapManager.setMaxDistance(maxdistance);}}
me.SetRowState();me.UpdateTable();};opt=sel.appendChild(document.createElement("option"));opt.appendChild(document.createTextNode("Show All"));opt.value="*";opt.style.textAlign="right";opt=sel.appendChild(document.createElement("option"));opt.appendChild(document.createTextNode("0 miles"));opt.value="0";opt.style.textAlign="right";var ranges=new Array(2,5,10,15,20,30,50,75,100,150,200);for(var i in ranges){opt=document.createElement("option");opt.style.textAlign="right";opt.appendChild(document.createTextNode(ranges[i]+ " miles"));opt.value=ranges[i];sel.appendChild(opt);}
sel.SelectedIndex=0;cell.appendChild(sel);}
else{var values=this.ColumnValues(cix);sortArray(values,(cell.className.indexOf(this.Class_AlphaColumn)>=0),true);if(values.length>0){sel.onchange=function(){if(this.options[this.selectedIndex].value=="*"){this.style.borderColor="#000000";}
else{this.style.borderColor="#FF0000";}
me.SetRowState();me.UpdateTable();};opt=sel.appendChild(document.createElement("option"));opt.appendChild(document.createTextNode("Show All"));opt.value="*";var blankopt=undefined;for(var vix in values){opt=document.createElement("option");opt.value=values[vix];if(values[vix].length==0){opt.appendChild(document.createTextNode("[Blank]"));blankopt=opt;}
else{opt.appendChild(document.createTextNode(values[vix]));sel.appendChild(opt);}}
if(blankopt){sel.appendChild(blankopt);}
cell.appendChild(sel);sel.SelectedIndex=0;}}}
this.GetBookmarkedHeaderCells=function(){var headercells=new Array(0);for(cix=0;cix<this.Columns();cix++){var cell=this.Cell(0,cix);if(cell.className.indexOf(this.Class_BookmarkColumn)>=0){headercells[headercells.length]=cell;}}
return headercells;}
this.BuildProductCards=function(popupboxclass){for(rix=1;rix<this.Rows();rix++){for(cix=0;cix<this.Columns();cix++){cell=this.Cell(rix,cix);if(cell.getElementsByTagName("div").length==1){if(cell.getElementsByTagName("div")[0].className==popupboxclass){var div=cell.getElementsByTagName("div")[0];var link=div.getElementsByTagName("a")[0];var img=link.getElementsByTagName("img")[0];var carddiv=document.createElement("div");var newimg=document.createElement("img");newimg.src=img.src;newimg.setAttribute("alt",img.getAttribute("alt"));newimg.setAttribute("style","float:right;max-width:300px;max-height:300px");carddiv.appendChild(newimg);for(zz=0;zz<this.Columns();zz++){if(zz !=cix){if(this.ColumnHeader(zz)=="Product"){var header=document.createElement("h2");var anchor=header.appendChild(document.createElement("a"));anchor.appendChild(document.createTextNode(this.CellValues(rix,zz)));anchor.setAttribute("href",link.href);carddiv.appendChild(header);}
else{var text="";text=this.ColumnHeader(zz)+ ": ";if(findInnerText(this.Cell(rix,zz)).trim().length==0){text +="-";}
else{text +=this.CellValues(rix,zz).join(", ")+ ".";}
var para=document.createElement("p");para.appendChild(document.createTextNode(text));carddiv.appendChild(para);}}}
div.appendChild(carddiv);}}}}}
this.AddLocationList=function(locationlist){this.LocList=locationlist;}
this.BuildBookmarking=function(tableid,bookmarkcolclass,bookmarkedrowclass,bookmarkbutton,bookmarkinput){this.Class_BookmarkedRow=bookmarkedrowclass;this.Class_BookmarkColumn=bookmarkcolclass;this.Bookmarks=new Bookmarks(tableid);this.Bookmarks.Load();for(rix=1;rix<this.Rows();rix++){if(this.Row(rix).getAttribute("tag")){for(cix=0;cix<this.Columns();cix++){var cell=this.Cell(rix,cix);if(cell.getElementsByTagName("a").length==1){var link=cell.getElementsByTagName("a")[0];link.ProductTable=this;link.Row=this.Row(rix);link.onclick=function(){this.ProductTable.AddBookmark(this.Row);};}}}}
this.DisplayBookmarks();var button=document.getElementById(bookmarkbutton);if(button){button.ProductTable=this;button.onclick=function(){this.ProductTable.SendBookmarks();}}
if(bookmarkinput){this.InputEmail=document.getElementById(bookmarkinput);if(this.Bookmarks.Email){this.InputEmail.value=this.Bookmarks.Email;}}}
this.AddBookmark=function(row){this.Bookmarks.Add(new Bookmark(row,this));this.ColorRows();this.DisplayBookmarks();}
this.RemoveBookmark=function(tag){this.Bookmarks.Remove(tag);this.ColorRows();this.DisplayBookmarks();}
this.DisplayBookmarks=function(){this.Bookmarks.Display(this);}
this.ClearBookmarks=function(){this.Bookmarks.Clear();this.ColorRows();this.DisplayBookmarks();}
this.SendBookmarks=function(){if(this.Bookmarks.TagList().length==0){alert("No products have been bookmarked.\nProducts are automatically bookmarked when you click on a product link");return;}
var result=this.InputEmail.value;if(this.Bookmarks.Email !=result){this.Bookmarks.Email=result;this.Bookmarks.Save();}
if(!result){alert("Please enter your e-mail address");this.InputEmail.focus();return;}
var img=new Image();img.setAttribute('type','text/plain');img.onload=function(){alert("An email was successfully sent to '"+ result + "'.");};img.onerror=function(){alert("ERROR. We were unable to send an email to '"+ result + "'.");};var target="http://www.findexperiencedays.com/productlistmerge.htm";target +="?address="+ escape(result);target +="&template=emailtemplate.htm";target +="&pids="+ escape(this.Bookmarks.TagList().join(","));img.setAttribute('src',target);}}
String.prototype.trim=function(){return this.replace(/(^[\s\xA0]+|[\s\xA0]+$)/g,'');}
function findMouse(e){if(!e)var e=window.event;var mouse=new Point(0,0);if(e.pageX || e.pageY){mouse.x=e.pageX;mouse.y=e.pageY;}
else if(e.clientX || e.clientY){mouse.x=e.clientX + document.body.scrollLeft
+ document.documentElement.scrollLeft;mouse.y=e.clientY + document.body.scrollTop
+ document.documentElement.scrollTop;}
return mouse;}
function getScreenSize(){var output=new Size();if(!window.innerWidth){if(!(document.documentElement.clientWidth==0)){output.width=document.documentElement.clientWidth;output.height=document.documentElement.clientHeight;}
else{output.width=document.body.clientWidth;output.height=document.body.clientHeight;}}
else{output.width=window.innerWidth;output.height=window.innerHeight;}
return output;}
function Size(width,height){this.width=width;this.height=height;return this;}
function Bookmarks(tableid){this.List=new Array(0);this.Table=document.getElementById(tableid);this.Email="";this.Add=function(bm){if(!this.Contains(bm.Tag)){this.List[this.List.length]=bm;this.Save();}}
this.Remove=function(tag){if(!tag)return false;var newlist=new Array(0);for(var l in this.List){if(this.List[l].Tag !=tag){newlist[newlist.length]=this.List[l];}}
this.List=newlist;this.Save();}
this.TagList=function(){var tags=new Array(0);for(var l in this.List){tags[tags.length]=this.List[l].Tag;}
return tags;}
this.Display=function(ptable){while(this.Table.hasChildNodes()){this.Table.removeChild(this.Table.lastChild);}
var tbody=this.Table.appendChild(document.createElement("tbody"));if(this.List.length==0){var tr=tbody.appendChild(document.createElement("tr"));var td=tr.appendChild(document.createElement("td"));td.appendChild(document.createTextNode("No products have been bookmarked."));}
else{var trheader=tbody.appendChild(document.createElement("tr"));var headercells=ptable.GetBookmarkedHeaderCells();for(var i in headercells){var thi=trheader.appendChild(document.createElement("th"));thi.appendChild(document.createTextNode(headercells[i].OriginalText));thi.className=headercells[i].OriginalClasses;}
var th=trheader.appendChild(document.createElement("th"));var button=th.appendChild(document.createElement("button"));button.innerHTML="Clear All";button.ProductTable=ptable;button.onclick=function(){this.ProductTable.ClearBookmarks();}
for(var l in this.List){var trlist=tbody.appendChild(document.createElement("tr"));this.List[l].AppendTableCells(trlist,headercells);var tdlist=trlist.appendChild(document.createElement("td"));var buttonlist=tdlist.appendChild(document.createElement("button"));buttonlist.innerHTML="Remove";buttonlist.ProductTable=ptable;buttonlist.Tag=this.List[l].Tag;buttonlist.onclick=function(){this.ProductTable.RemoveBookmark(this.Tag);}}}}
this.Contains=function(tag){if(!tag)return false;for(var l in this.List){if(this.List[l].Tag==tag){return true;}}
return false;}
this.Save=function(){setCookie("CountBookmarks",this.List.length,2);for(var l in this.List){this.List[l].Save(l);}
setCookie("UserEmail",this.Email,2);}
this.Load=function(){this.Email=getCookie("UserEmail");if(this.Email==undefined){this.Email="";}
if(this.Email=="undefined"){this.Email="";}
var count=getCookie("CountBookmarks");if(count){for(var i=0;i<count;i++){var bm=new Bookmark();bm.Load(i);this.Add(bm);}}}
this.Clear=function(){this.List=new Array(0);this.Save();}}
function Bookmark(row,ptable){this.Cells=new Array(0);this.Email=undefined;if(ptable){this.Tag=row.getAttribute("tag");for(cix=0;cix<ptable.Columns();cix++){var cell=row.cells[cix];if(cell.className.indexOf(ptable.Class_BookmarkColumn)>=0){this.Cells[this.Cells.length]=cell.innerHTML;}}}
this.Save=function(index){setCookie("Bookmark"+ index,this.Tag,2);setCookie("Bookmark"+ index + "Parts",this.Cells.length,2);for(var p in this.Cells){setCookie("Bookmark"+ index + "Part"+ p,this.Cells[p],2);}}
this.Load=function(index){this.Tag=getCookie("Bookmark"+ index);var count=getCookie("Bookmark"+ index + "Parts").split("|");for(p=0;p<count;p++){this.Cells[this.Cells.length]=getCookie("Bookmark"+ index + "Part"+ p);}}
this.AppendTableCells=function(tr,headercells){for(var p in this.Cells){var td=tr.appendChild(document.createElement("td"));td.innerHTML=this.Cells[p];td.className=headercells[p].OriginalClasses;}}}
function InPagePopUp(element,popup,popupclass){if("string"==typeof(element)){element=document.getElementById(element);}
if("string"==typeof(popup)){popup=document.getElementById(popup);}
if(!popup)return;if(!element)return;popup.style.display="none";element.Popup=popup;popup.onclick=function(e){this.style.display="none";return false;}
element.onclick=function(e){if(!e)var e=window.event;if("block"==element.Popup.style.display){element.Popup.style.display="none";}
else{if(popupclass){var showing=getElementsByClassName(document,popupclass);for(i=0,j=0;i<showing.length;i++){showing[i].style.display="none";}}
element.Popup.style.display="block";var mouse=findMouse(e);var dims=getScreenSize();element.Popup.style.top=mouse.y - 10 + "px"
if(mouse.x<dims.width / 2){element.Popup.style.left=mouse.x - 10 + "px";element.Popup.style.right="";}
else{element.Popup.style.right=dims.width - mouse.x - 10 + "px";element.Popup.style.left="";}}}}
function getElementsByClassName(element,className){var el=new Array();var tags=element.getElementsByTagName("*");var tcl=" "+ className + " ";for(i=0,j=0;i<tags.length;i++){var test=" "+ tags[i].className + " ";if(test.indexOf(tcl)!=-1)
el[j++]=tags[i];}
return el;}
function TornArea(id,tickTime,totalTime,startOpen){var me=this;me.tickTime=tickTime;me.totalTime=totalTime;me.openImage="http://resources.findexperiencedays.com/pointdown.png";me.closeImage="http://resources.findexperiencedays.com/pointup.png";me.div=document.getElementById(id);me.panels=new Array();for(var i=0;i<this.div.childNodes.length;i++){if(this.div.childNodes[i].tagName=="DIV"){this.panels[this.panels.length]=this.div.childNodes[i];}}
TornArea.prototype.Toggle=function(){if(!me.middleHeight){me.middleHeight=me.panels[1].clientHeight;if(me.status==me.state.closed){me.panels[1].style.height="0px";}}
if(me.status==me.state.closed){me.status=me.state.opening;}
else if(me.status==me.state.open){me.status=me.state.closing;}
me.ticker.start();}
me.img=document.createElement("img");me.img.className="tornarrow";me.panels[2].appendChild(me.img);me.img.onclick=function(){me.Toggle();}
me.state={closed:0,closing:1,open:2,opening:3};me.ticker=new Ticker(function(){var prop=me.ticker.sinceStart()/ me.totalTime;if(prop>1){prop=1};var bezier=3 *(1 - prop)* prop * prop + prop * prop * prop;if(me.status==me.state.opening){var value=parseInt((me.middleHeight)* bezier);me.div.style.height=value + "px";if(prop>=1){me.status=me.state.open;me.img.src=me.closeImage;me.img.title="Hide this panel.";me.ticker.stop();}}
else if(me.status==me.state.closing){var value=parseInt((me.middleHeight)*(1 - bezier));me.div.style.height=value + "px";if(prop>=1){me.status=me.state.closed;me.img.src=me.openImage;me.img.title="Show this panel.";me.ticker.stop();}}},me.tickTime);if(startOpen){me.status=me.state.open;me.img.src=me.closeImage;}
else{me.status=me.state.closed;me.img.src=me.openImage;}}
function Ticker(callback,ms){this.timer=undefined;this.tickMS=ms;this.started=undefined;this.callback=callback;this.start=function(){var tickerme=this;this.started=new Date().getTime();this.timer=window.setInterval(function(){tickerme.callback();},tickerme.tickMS);}
this.isRunning=function(){return(this.timer !=undefined);}
this.stop=function(){window.clearInterval(this.timer);this.timer=undefined;}
this.sinceStart=function(){if(this.started){return(new Date().getTime()- this.started);}
return 0;}}
function GeoMapManager(entityname,container,imageCircle,imageSliderClose,imageSliderOpen,imageSpot,imageMarkerOff,imageMarkerOn){var me=this;this.entityName=entityname;this.map=undefined;this.imageCircle=imageCircle;this.imageSliderClose=imageSliderClose;this.imageSliderOpen=imageSliderOpen;this.imageSpot=imageSpot;this.imageMarkerOff=imageMarkerOff;this.imageMarkerOn=imageMarkerOn;this.container=document.getElementById(container);this.divmap=this.container.getElementsByTagName("div")[0];this.divpanel=this.container.getElementsByTagName("div")[1];this.divpanelcontent=this.divpanel.appendChild(document.createElement("div"));this.MapSlider=new MapSlider(this.divpanel,{closed:1,opendelay:500,arrowclass:"maparrow",closeimage:this.imageSliderClose,openimage:this.imageSliderOpen});this.divmap.onmouseover=function(){me.MapSlider.Open()}
this.divmap.onmouseout=function(){me.MapSlider.AbortAction()}
this.zoomPreferred=8;this.zoomMin=5;this.zoomMax=12;this.ProductTable=undefined;this.markers=new Array(0);this.rangeColor="FF0000";this.rangeAlpha=.8;this.rangeMetres=-1;this.rangeOn=false;this.homeMarker=undefined;this.homeAtHome=function(){if(this.homeMarker){var athome=false;var oldaddress=getCookie("MapAddressName");if(oldaddress){if(oldaddress==this.homeMarker.getTitle()){var lat=parseFloat(getCookie("MapAddressLat"));var lng=parseFloat(getCookie("MapAddressLon"));if((lat)&&(lng)){return true;}}}}
return false;}
this.homeAtVenue=function(){if(this.homeMarker){var title=this.homeMarker.getTitle();for(var j in this.markers){if(this.markers[j].getTitle()==title){return true;}}}
return false;}
this.UpdateMenus=function(){var me=this;while(this.divpanelcontent.hasChildNodes()){this.divpanelcontent.removeChild(this.divpanelcontent.lastChild);}
var p,b,a,d,li,ul,h3,i;d=this.divpanelcontent;h3=d.appendChild(document.createElement("h3"));h3.appendChild(document.createTextNode("Using the Map"));h3.style.margin="0px";d.appendChild(document.createElement("br"));if(this.homeMarker){i=d.appendChild(document.createElement("img"));i.style.width="23px";i.style.height="39px";i.style.styleFloat="left";i.style.cssFloat="left";i.style.margin="2px";i.src=this.imageSpot;p=d.appendChild(document.createElement("p"));p.style.fontWeight="bold";p.appendChild(document.createTextNode(this.homeMarker.getTitle()));p=d.appendChild(document.createElement("p"));p.style.clear="both";if(this.homeAtVenue()){p.appendChild(document.createTextNode("The distance column in the table shows distance in miles from your selected location and, for your convenience, we've initially set it to only show "+ this.entityName + " at this location."));}
else{if(this.markers.length>1){p.appendChild(document.createTextNode("A distance column has been added to the table giving the distances in miles from this location to the nearest venue for each of the "+ this.entityName + "."));}}
p=d.appendChild(document.createElement("p"));a=p.appendChild(document.createElement("a"));a.onclick=function(){me.eventHomeClearClick();}
a.title="Clear the 'from' location.";a.appendChild(document.createTextNode("Clear"));p.appendChild(document.createTextNode(" the 'from' location."));p=d.appendChild(document.createElement("p"));p.appendChild(document.createTextNode("Center on "));a=p.appendChild(document.createElement("a"));a.onclick=function(){me.homeCenter();}
a.title="Center on the 'from' location.";a.appendChild(document.createTextNode(this.homeMarker.getTitle()));p.appendChild(document.createTextNode("."));if(!this.homeAtHome()){var oldaddress=getCookie("MapAddressName");if(oldaddress){p=d.appendChild(document.createElement("p"));p.appendChild(document.createTextNode("Set 'from' back to "));a=p.appendChild(document.createElement("a"));a.onclick=function(){me.eventAddressEntered(oldaddress);}
a.title="Set 'from' back to "+ oldaddress + ".";a.appendChild(document.createTextNode(oldaddress));p.appendChild(document.createTextNode("."));}}
if(this.rangeMetres !=0){d.appendChild(document.createElement("br"));p=d.appendChild(document.createElement("p"));p.appendChild(document.createTextNode("Hint: To look at "+ this.entityName + " at a particular venue just double click on it's marker."));}}
else{p=d.appendChild(document.createElement("p"));p.appendChild(document.createTextNode("To set a 'from' location for measuring distance you can double-click on a venue marker (green), double-click anywhere else on the map, or type in a basic address (post code or town and county) below."));var input=d.appendChild(document.createElement("input"));input.type="text";input.size="35";input.id="addressInput";var useaddress=getCookie("MapAddressName");if(!useaddress){useaddress="Hanwell, London";}
input.value=useaddress;var button=d.appendChild(document.createElement("button"));button.appendChild(document.createTextNode("OK"));button.onclick=function(){me.eventAddressEntered(document.getElementById("addressInput").value);return false;};p=d.appendChild(document.createElement("p"));p.appendChild(document.createTextNode("Once a 'from' location has been set, a distance column will be added to the table showing distance in miles from this location."));}
if(this.markers.length==1){d.appendChild(document.createElement("hr"));p=d.appendChild(document.createElement("p"));p.appendChild(document.createTextNode("Center on "));a=p.appendChild(document.createElement("a"));a.onclick=function(){me.markerCenter(me.markers[0]);}
a.appendChild(document.createTextNode(this.markers[0].getTitle()));p.appendChild(document.createTextNode("."));}}
this.getSettings=function(){var opts=new Object();opts.centerlat=parseFloat(getCookie("MapCenterLat"));opts.centerlon=parseFloat(getCookie("MapCenterLon"));opts.homelat=parseFloat(getCookie("MapHomeLat"));opts.homelon=parseFloat(getCookie("MapHomeLon"));opts.homename=getCookie("MapHomeName");opts.zoom=parseFloat(getCookie("MapZoom"));return opts;}
this.setFromSettings=function(opts){if(opts.homelat && opts.homelon){var latlng1=new GLatLng(opts.homelat,opts.homelon);this.setHomeMarker(latlng1,opts.homename);}
else{this.setHomeMarker();}
if(opts.zoom){this.map.setZoom(opts.zoom);}
if(opts.centerlat && opts.centerlon){this.map.setCenter(new GLatLng(opts.centerlat,opts.centerlon));}}
this.setHomeMarker=function(p,name){var me=this;var existed=false;if(this.homeMarker){this.map.removeOverlay(this.homeMarker);this.homeMarker=undefined;existed=true;}
if(p){if(!name){name="Lat: "+ p.y.toFixed(2)+ " Lon: "+ p.x.toFixed(2);}
var markerOptions={title:name,image:this.imageSpot,width:23,height:39,zIndex:1};this.homeMarker=new GeoMarker(p,markerOptions);this.map.addOverlay(this.homeMarker);setCookie("MapHomeLat",this.homeMarker.getLatLng().lat(),2);setCookie("MapHomeLon",this.homeMarker.getLatLng().lng(),2);setCookie("MapHomeName",this.homeMarker.getTitle(),2);if(existed==false){me.map.setZoom(me.zoomPreferred);me.map.setCenter(p);}}
else{setCookie("MapHomeLat",undefined,2);setCookie("MapHomeLon",undefined,2);setCookie("MapHomeName",undefined,2);this.rangeMetres=-1;}
this.setRangeCircle(p,this.rangeMetres);this.setDistances();this.UpdateMenus();}
this.setRangeCircle=function(p,metres){if(this.rangeCircle){this.map.removeOverlay(this.rangeCircle);this.rangeCircle=undefined;}
if(p){if(metres>0){{var circleopts={image:this.imageCircle,radius:(metres / 1609.344)};this.rangeCircle=new GeoMarkerCircle(p,circleopts);this.map.addOverlay(this.rangeCircle);}}}}
this.homeCenter=function(){if(this.homeMarker){this.map.panTo(this.homeMarker.getLatLng());}}
this.markerCenter=function(marker){if(marker){this.map.panTo(marker.getLatLng());}}
this.setMaxDistance=function(miles){this.rangeMetres=(miles * 1609.344);if(this.rangeCircle){this.map.removeOverlay(this.rangeCircle);this.rangeCircle=undefined;}
if(this.homeMarker){if(miles>0){var circleopts={image:this.imageCircle,radius:miles};this.rangeCircle=new GeoMarkerCircle(this.homeMarker.getLatLng(),circleopts);this.map.addOverlay(this.rangeCircle);}}
this.UpdateMenus();}
this.clearMaxDistance=function(){this.rangeMetres=-1;if(this.rangeCircle){this.map.removeOverlay(this.rangeCircle);this.rangeCircle=undefined;}
this.UpdateMenus();}
this.setDistances=function(){var venueonly=this.homeAtVenue();var j;if(this.homeMarker){var homelatlng=this.homeMarker.getLatLng();for(j=0;j<this.markers.length;j++){this.markers[j].setDistance(homelatlng);}
if(this.ProductTable){if(this.markers.length>1){this.ProductTable.UpdateDistances(true,venueonly);}
else{this.ProductTable.UpdateDistances(false,venueonly);}}}
else{for(j=0;j<this.markers.length;j++){this.markers[j].clearDistance();}
if(this.ProductTable){this.ProductTable.UpdateDistances(false,venueonly);}}}
this.setMarkersEnabledState=function(productids){for(var i=0;i<this.markers.length;i++){var marker=this.markers[i];var inrange=true;var found=false;var loc=marker.getLocation();if(this.homeMarker){if(this.rangeMetres !=-1){inrange=(marker.getLatLng().distanceFrom(this.homeMarker.getLatLng())<=this.rangeMetres);}}
for(var j=0;j<loc.productids.length && !found;j++){for(var k=0;k<productids.length && !found;k++){if(loc.productids[j]==productids[k]){found=true;}}}
marker.setSelected(found & inrange);}}
this.zoomToMarkers=function(){if(this.markers.length==0)return;var rect=new GLatLngBounds();for(var j=0;j<this.markers.length;j++){rect.extend(this.markers[j].getLatLng());}
var sw=rect.getSouthWest();var ne=rect.getNorthEast();var de=ne.lat()- sw.lat();var dn=ne.lng()- sw.lng();if(de>0 && dn>0){sw=new GLatLng(sw.lat()- de / 4,sw.lng()- dn / 4);ne=new GLatLng(ne.lat()+ de / 4,ne.lng()+ dn / 4);rect.extend(sw);rect.extend(ne);}
var center=rect.getCenter();var zoomlevel=this.map.getBoundsZoomLevel(rect);if(zoomlevel>this.zoomPreferred){zoomlevel=this.zoomPreferred};this.map.setZoom(zoomlevel);this.map.setCenter(center);}
this.AddProductTable=function(prodtable){this.ProductTable=prodtable;if(this.ProductTable){this.ProductTable.GeoMapManager=this};}
this.AddLocationList=function(locationlist){var me=this;this.markers=new Array(0);for(var i=0;i<locationlist.locations.length;i++){var loc=locationlist.locations[i];var p=new GLatLng(loc.lat,loc.lon);var markeropts={imageUnselected:this.imageMarkerOff,image:this.imageMarkerOn,width:21,height:34,location:loc};var marker=new GeoMarkerSelectable(p,markeropts);GEvent.addListener(marker,"dblclick",function(latlng){me.eventMapLocationDblClick(latlng);});this.map.addOverlay(marker);this.markers[this.markers.length]=marker;loc.inrange=true;}
if(this.markers.length>0){var pref=parseInt(5 + Math.log(this.markers.length));if(pref>this.zoomPreferred){this.zoomPreferred=pref;}}
this.setDistances();this.UpdateMenus();}
this.eventAddressEntered=function(address){var me=this;var oldaddress=getCookie("MapAddressName");if(oldaddress==address){var lat=parseFloat(getCookie("MapAddressLat"));var lng=parseFloat(getCookie("MapAddressLon"));if((lat)&&(lng)){var p=new GLatLng(lat,lng);this.setHomeMarker(p,address);this.map.setCenter(p);return;}}
if(this.geocoder){this.geocoder.getLatLng(address,function(p){if(!p){alert("Your entry '"+ address + "' could not be mapped to a known location. Try entering a local town or village name or a postcode.");}
else{me.setHomeMarker(p,address);me.map.setCenter(p);setCookie("MapAddressName",address,2);setCookie("MapAddressLat",p.lat(),2);setCookie("MapAddressLon",p.lng(),2);}});}}
this.eventMapZoomComplete=function(oldzoom,newzoom){setCookie("MapZoom",newzoom,2);}
this.eventMapMoveComplete=function(){var latlng=this.map.getCenter();setCookie("MapCenterLat",latlng.lat(),2);setCookie("MapCenterLon",latlng.lng(),2);}
this.eventMapDblClick=function(latlng){this.setHomeMarker(latlng);}
this.eventMapLocationDblClick=function(marker){this.setHomeMarker(marker.getLatLng(),marker.getTitle());}
this.eventHomeClearClick=function(){this.setHomeMarker();}
if(GBrowserIsCompatible()){this.bounds=new GLatLngBounds();var opts=this.getSettings();this.geocoder=new GClientGeocoder();this.geocoder.setBaseCountryCode('GB');this.map=new GMap2(this.divmap);this.map.setCenter(new GLatLng(54.55,-3.0),5);G_PHYSICAL_MAP.getMinimumResolution=function(){return me.zoomMin};G_NORMAL_MAP.getMinimumResolution=function(){return me.zoomMin};G_SATELLITE_MAP.getMinimumResolution=function(){return me.zoomMin};G_HYBRID_MAP.getMinimumResolution=function(){return me.zoomMin};G_PHYSICAL_MAP.getMaximumResolution=function(){return me.zoomMax};G_NORMAL_MAP.getMaximumResolution=function(){return me.zoomMax};G_SATELLITE_MAP.getMaximumResolution=function(){return me.zoomMax};G_HYBRID_MAP.getMaximumResolution=function(){return me.zoomMax};this.map.enableContinuousZoom();this.map.disableDoubleClickZoom();this.map.addControl(new GSmallMapControl());this.map.enableScrollWheelZoom();GEvent.addListener(this.map,"dblclick",function(overlay,latlng){me.eventMapDblClick(latlng);});GEvent.addListener(this.map,"zoomend",function(oldLevel,newLevel){me.eventMapZoomComplete(oldLevel,newLevel);});GEvent.addListener(this.map,"moveend",function(){me.eventMapMoveComplete();});this.setFromSettings(opts);}}
function getCookie(c_name){if(document.cookie.length>0){c_start=document.cookie.indexOf(c_name + "=");if(c_start !=-1){c_start=c_start + c_name.length + 1;c_end=document.cookie.indexOf(";",c_start);if(c_end==-1)c_end=document.cookie.length;return unescape(document.cookie.substring(c_start,c_end));}}
return "";}
function ScriptSequencer(){var me=this;this.functions=new Array();this.stepIndex=0;this.waiting=undefined;function ScriptSequencerStructure(code,order,time){this.code=code;this.order=order;this.time=time;this.segment=undefined;}
ScriptSequencer.prototype.add=function(code,order,time){me.functions[me.functions.length]=new ScriptSequencerStructure(code,order +(me.functions.length * 0.00001),time);}
ScriptSequencer.prototype.execute=function(){this.functions.sort(function(x,y){if(x.order>y.order)return 1;if(x.order<y.order)return -1;return 0;}
);var totaltime=0;for(var i=0;i<this.functions.length;i++){totaltime +=this.functions[i].time;}
if(totaltime>0){var waiting=document.body.appendChild(document.createElement('div'));waiting.style.width='100%';waiting.style.height='100%';waiting.style.position='absolute';waiting.style.top='0px';waiting.style.left='0px';waiting.style.zIndex='1000';waiting.style.fontSize='24px';waiting.style.textAlign='center';var innerdiv=waiting.appendChild(document.createElement("DIV"));innerdiv.textAlign='center';innerdiv.style.position='absolute';innerdiv.style.backgroundColor='#000000';innerdiv.style.color='#FFFFFF';innerdiv.style.top='30%';innerdiv.style.padding='10px 20px 10px 20px';innerdiv.style.left='35%';innerdiv.style.width='30%';var para=innerdiv.appendChild(document.createElement("p"));para.style.margin="0px 0px 6px 0px";para.appendChild(document.createTextNode("Loading"));var table=innerdiv.appendChild(document.createElement("table"));table.cellPadding="0";table.cellSpacing="0";table.style.border="2px solid #FFFFFF";table.style.width="100%";var tbody=table.appendChild(document.createElement("tbody"));var tr=tbody.appendChild(document.createElement("tr"));this.waiting=waiting;var sumtime=0;var lastwidth=0;for(var i=0;i<this.functions.length;i++){if(this.functions[i].time>0){var td=tr.appendChild(document.createElement("td"));sumtime +=this.functions[i].time;var thiswidth=parseInt(100 * sumtime / totaltime);td.style.width=parseInt(thiswidth - lastwidth)+ "%";lastwidth=thiswidth;td.style.backgroundColor='#000000';td.style.height="5px";td.style.margin="0";td.style.padding="0";td.style.lineHeight="0";this.functions[i].segment=td;}}}
this.stepIndex=0;this.step();}
ScriptSequencer.prototype.step=function(){var start=new Date().getTime();while((this.stepIndex<this.functions.length)&(new Date().getTime()- start)<200){this.functions[this.stepIndex].code();if(this.functions[this.stepIndex].segment){this.functions[this.stepIndex].segment.style.backgroundColor='#FF0000';}
this.stepIndex +=1;}
if(this.stepIndex<this.functions.length){setTimeout(function(){me.step();},20);}
else{if(this.waiting){document.body.removeChild(this.waiting);}}}}
function DDMenu(id){this.ul=document.getElementById(id);this.currentspan=undefined;this.collapsetimer=undefined;this.CollapseAll=function(){var span=this.currentspan;while(span){if(span.SubUL){span.SubUL.style.display="none";}
span=span.PreviousSpan;};this.currentspan="undefined";}
this.OuterMouseOver=function(span){if(this.collapsetimer){window.clearTimeout(this.collapsetimer);this.CollapseAll();}
this.currentspan=span;while(span){if(span.SubUL){span.SubUL.style.display="block";}
span=span.PreviousSpan;};}
this.OuterMouseOut=function(span){var _self=this;this.collapsetimer=setTimeout(function(){_self.CollapseAll();},500);}
this.CodeUpLevels=function(el,previousSpan){for(var i=0;i<el.childNodes.length;i++){var sel=el.childNodes[i];if(sel.tagName){if(sel.tagName=="LI"){var span=sel.getElementsByTagName("span")[0];if(!span){span=sel.getElementsByTagName("a")[0];}
if(span){span.DDMenu=this;span.onmouseover=function(){this.DDMenu.OuterMouseOver(this);}
span.onmouseout=function(){this.DDMenu.OuterMouseOut(this);}
span.PreviousSpan=previousSpan;span.SubUL=sel.getElementsByTagName("ul")[0];}
for(var j=0;j<sel.childNodes.length;j++){var sel2=sel.childNodes[j];if(sel2.tagName){if(sel2.tagName=="UL"){this.CodeUpLevels(sel2,span);}}}}}}}
this.CodeUpLevels(this.ul,undefined);}
function DivRotator(containerid,msDelay,msSlideTime,scrolling,firstIsVisible){var me=this;this.container=document.getElementById(containerid);this.panels=new Array();this.oldPanel=undefined;this.newPanel=undefined;this.scrolling=scrolling;this.scrolloptions=["Up","Down","Left","Right","DownRight","UpRight","DownLeft","UpLeft"];this.thisscroll=scrolling;this.msDelay=msDelay;this.msSlideTime=msSlideTime;this.container.onmouseover=function(){me.pause=true;}
this.container.onmouseout=function(){me.pause=false;}
this.container.title="Scrolling paused";this.container.onclick=function(){me.startChangePanel();}
this.pause=false;this.doneone=false;this.findNextPanel=function(){var tryPanel=undefined;if(this.newPanel){tryPanel=this.newPanel.nextPanel;}
else{tryPanel=this.panels[0];}
if(tryPanel){var startPanel=tryPanel;do{var images=tryPanel.getElementsByTagName("IMG");var loaded=0;for(var j=0;j<images.length;j++){if(images[j].readyState){if(images[j].readyState=="complete"){loaded++;}}
else{if(images[j].height>20){loaded++;}}}
if(images.length==loaded){return tryPanel;}
tryPanel=tryPanel.nextPanel;}while(tryPanel !=startPanel)}
return undefined;}
this.startChangePanel=function(){if(me.pause){if(me.doneone){return}};if(!me.tickerSliding.isRunning()){me.oldPanel=me.newPanel;me.newPanel=me.findNextPanel();if(!me.newPanel){return;}
if(me.newPanel==me.oldPanel){return;}
if(me.scrolling=="Random"){me.thisscroll=me.scrolloptions[parseInt(Math.random()* me.scrolloptions.length)];}
else{me.thisscroll=me.scrolling;}
me.tickerBetween.stop();me.tickerSliding.start();}}
this.doSlide=function(){me.newPanel.style.visibility="visible";var prop=me.tickerSliding.sinceStart()/ me.msSlideTime;if(prop>1){prop=1;}
var bezier=3 *(1 - prop)* prop * prop + prop * prop * prop;switch(me.thisscroll){case "DownRight":me.newPanel.style.top=-parseInt(me.container.clientHeight *(1 - bezier))+ "px";me.newPanel.style.left=-parseInt(me.container.clientWidth *(1 - bezier))+ "px";if(me.oldPanel){me.oldPanel.style.top=parseInt(me.container.clientHeight *(bezier))+ "px";me.oldPanel.style.left=parseInt(me.container.clientWidth *(bezier))+ "px";}
break;case "Down":me.newPanel.style.top=-parseInt(me.container.clientHeight *(1 - bezier))+ "px";me.newPanel.style.left="0px";if(me.oldPanel){me.oldPanel.style.left="0px";me.oldPanel.style.top=parseInt(me.container.clientHeight *(bezier))+ "px";}
break;case "DownLeft":me.newPanel.style.left=parseInt(me.container.clientWidth *(1 - bezier))+ "px";me.newPanel.style.top=-parseInt(me.container.clientHeight *(1 - bezier))+ "px";if(me.oldPanel){me.oldPanel.style.left=-parseInt(me.container.clientWidth *(bezier))+ "px";me.oldPanel.style.top=parseInt(me.container.clientHeight *(bezier))+ "px";}
break;case "Left":me.newPanel.style.left=parseInt(me.container.clientWidth *(1 - bezier))+ "px";me.newPanel.style.top="0px";if(me.oldPanel){me.oldPanel.style.left=-parseInt(me.container.clientWidth *(bezier))+ "px";me.oldPanel.style.top="0px";}
break;case "UpLeft":me.newPanel.style.left=parseInt(me.container.clientWidth *(1 - bezier))+ "px";me.newPanel.style.top=parseInt(me.container.clientHeight *(1 - bezier))+ "px";if(me.oldPanel){me.oldPanel.style.left=-parseInt(me.container.clientWidth *(bezier))+ "px";me.oldPanel.style.top=-parseInt(me.container.clientHeight *(bezier))+ "px";}
break;case "Up":me.newPanel.style.top=parseInt(me.container.clientHeight *(1 - bezier))+ "px";me.newPanel.style.left="0px";if(me.oldPanel){me.oldPanel.style.top=-parseInt(me.container.clientHeight *(bezier))+ "px";me.oldPanel.style.left="0px";}
break;case "UpRight":me.newPanel.style.top=parseInt(me.container.clientHeight *(1 - bezier))+ "px";me.newPanel.style.left=-parseInt(me.container.clientWidth *(1 - bezier))+ "px";if(me.oldPanel){me.oldPanel.style.top=-parseInt(me.container.clientHeight *(bezier))+ "px";me.oldPanel.style.left=parseInt(me.container.clientWidth *(bezier))+ "px";}
break;default:me.newPanel.style.left=-parseInt(me.container.clientWidth *(1 - bezier))+ "px";me.newPanel.style.top="0px";if(me.oldPanel){me.oldPanel.style.left=parseInt(me.container.clientWidth *(bezier))+ "px";me.oldPanel.style.top="0px";}
break;}
if(prop==1){me.tickerSliding.stop();me.tickerBetween.tickMS=me.msDelay;me.tickerBetween.start();me.doneone=true;}}
for(var i=0;i<this.container.childNodes.length;i++){if(this.container.childNodes[i].tagName=="DIV"){var node=this.container.childNodes[i];this.panels[this.panels.length]=node;var hideNode=true;if(this.panels.length==1){if(firstIsVisible){this.newPanel=node;hideNode=false;node.style.visibility="visible";node.style.position="absolute";node.style.top="0px";node.style.left="0px";}}
if(hideNode){node.style.visibility="hidden";node.style.position="absolute";node.style.top="-1000px";node.style.left="-1000px";}}}
for(var i=0;i<this.panels.length;i++){if(i==this.panels.length - 1){this.panels[i].nextPanel=this.panels[0];}
else{this.panels[i].nextPanel=this.panels[i + 1];}}
this.tickerSliding=new Ticker(function(){me.doSlide();},20);if(firstIsVisible){this.tickerBetween=new Ticker(function(){me.startChangePanel();},this.msDelay);}
else{this.tickerBetween=new Ticker(function(){me.startChangePanel();},100);}
this.tickerBetween.start();}
function LocationList(){this.locations=new Array(0);LocationList.prototype.add=function(location){this.locations[this.locations.length]=location;}
LocationList.prototype.getNearestLocation=function(tag){var nearest=undefined;for(var l in this.locations){var loc=this.locations[l];for(var t in loc.productids){if(loc.productids[t]==tag){if(nearest){if(loc.distance<nearest.distance){nearest=loc;}}
else{nearest=loc;}}}}
return nearest;}}
function Location(name,lat,lon,productids){this.lat=lat;this.lon=lon;this.name=name;this.productids=productids.split(",");this.distance=undefined;}
function Point(x,y){this.x=x;this.y=y;return this;}
function setCookie(c_name,value,expiredays){var exdate=new Date();exdate.setDate(exdate.getDate()+ expiredays);document.cookie=c_name + "="+ escape(value)+((expiredays==null)? "":";expires="+ exdate.toGMTString());}
function GeoMarker(latlng,opts){this.latlng=latlng;if(!opts)opts={};this.height_=opts.height || 32;this.width_=opts.width || 32;this.image_=opts.image;this.imageOver_=opts.imageOver;this.clicked_=0;this.title_=opts.title;this.zIndex_=opts.zIndex || 0;}
GeoMarker.prototype=new GOverlay();GeoMarker.prototype.initialize=function(map){var me=this;this.map_=map;var div=document.createElement("div");this.div_=div;div.style.border="0px";div.style.position="absolute";div.style.paddingLeft="0px";div.style.width=this.height_ + "px";div.style.height=this.width_ + "px";div.style.zIndex=this.getZIndex({clicked:0});if(this.title_){div.title=this.title_;}
this.setImage(this.image_);GEvent.addDomListener(div,"click",function(event){me.clicked_=1;GEvent.trigger(me,"click",me);event.cancelBubble=true;});GEvent.addDomListener(div,"dblclick",function(event){me.clicked_=1;GEvent.trigger(me,"dblclick",me);event.cancelBubble=true;});map.getPane(G_MAP_MARKER_PANE).appendChild(div);};GeoMarker.prototype.remove=function(){this.div_.parentNode.removeChild(this.div_);};GeoMarker.prototype.redraw=function(force){if(!force)return;var divPixel=this.map_.fromLatLngToDivPixel(this.latlng);this.div_.style.width=this.width_ + "px";this.div_.style.left=(divPixel.x - parseInt(this.width_ + 1)/ 2)+ "px";this.div_.style.height=(this.height_)+ "px";this.div_.style.top=(divPixel.y)- this.height_ + "px";};GeoMarker.prototype.getZIndex=function(m){return GOverlay.getZIndex(this.getPoint().lat()- this.zIndex_ / 3600)- m.clicked * 10000;}
GeoMarker.prototype.getPoint=function(){return this.latlng;};GeoMarker.prototype.getLatLng=function(){return this.latlng;};GeoMarker.prototype.setStyle=function(style){for(s in style){this.div_.style[s]=style[s];}};GeoMarker.prototype.setVisible=function(visible){if(visible){this.show()}
else{this.hide()}}
GeoMarker.prototype.distanceFrom=function(latlng){return(this.latlng.distanceFrom(latlng));}
GeoMarker.prototype.setImage=function(image){this.image_=image;this.div_.style.backgroundImage="url("+ this.image_ + ")";}
GeoMarker.prototype.getTitle=function(){return(this.title_);};function GeoMarkerSelectable(latlng,opts){this.base=GeoMarker;this.base(latlng,opts);this.location_=opts.location;if(this.location_){this.location_.GeoMarker=this;this.title_=this.location_.name;}
this.imageSelected_=this.image_;this.imageUnselected_=opts.imageUnselected;this.selected=true;}
GeoMarkerSelectable.prototype=new GeoMarker();GeoMarkerSelectable.prototype.setSelected=function(selected){if(selected !=this.selected){if(selected){this.setImage(this.imageSelected_);this.selected=true;}
else{this.setImage(this.imageUnselected_);this.selected=false;}}}
GeoMarkerSelectable.prototype.setDistance=function(latlng){var distance=this.getLatLng().distanceFrom(latlng)/ 1609.344;if(distance !=0){distance=parseInt(distance + 0.999);}
this.location_.distance=distance;}
GeoMarkerSelectable.prototype.clearDistance=function(){this.location_.distance=undefined;}
GeoMarkerSelectable.prototype.getLocation=function(){return(this.location_);}
function GeoMarkerCircle(latlng,opts){this.base=GeoMarker;this.base(latlng,opts);this.radius_=opts.radius || 2;this.image_=opts.image;}
GeoMarkerCircle.prototype=new GeoMarker();GeoMarkerCircle.prototype.initialize=function(map){var me=this;this.map_=map;this.setSize();var div=document.createElement("div");this.div_=div;div.style.border="0px";div.style.position="absolute";div.style.paddingLeft="0px";div.style.width=100 + "px";div.style.height=100 + "px";div.style.zIndex=this.getZIndex({clicked:0});var img=div.appendChild(document.createElement("img"));img.src=this.image_;img.style.width="100%";img.style.height="100%";map.getPane(G_MAP_MARKER_PANE).appendChild(div);};GeoMarkerCircle.prototype.remove=function(){this.div_.parentNode.removeChild(this.div_);};GeoMarkerCircle.prototype.redraw=function(force){if(!force)return;var divPixel=this.map_.fromLatLngToDivPixel(this.latlng);this.setSize();this.div_.style.width=this.width_ + "px";this.div_.style.left=(divPixel.x - parseInt((this.width_ + 1)/ 2))+ "px";this.div_.style.height=(this.height_)+ "px";this.div_.style.top=(divPixel.y - parseInt((this.height_ + 1)/ 2))+ "px";};GeoMarkerCircle.prototype.setVisible=function(visible){if(visible){this.show()}
else{this.hide()}}
GeoMarkerCircle.prototype.getZIndex=function(m){return GOverlay.getZIndex(180);}
GeoMarkerCircle.prototype.setSize=function(){var radiuskm=this.radius_ * 1.609344;var p=this.getLatLng();var latConv=p.distanceFrom(new GLatLng(p.lat()+ 0.1,p.lng()))/ 100;var deltalat=radiuskm / latConv;var llatlng=new GLatLng(p.lat()- deltalat,p.lng());var rlatlng=new GLatLng(p.lat()+ deltalat,p.lng());var lpixels=this.map_.fromLatLngToDivPixel(llatlng);var rpixels=this.map_.fromLatLngToDivPixel(rlatlng);this.width_=parseInt(lpixels.y - rpixels.y);this.height_=this.width_;}

