﻿var PageName="grande-prairie-hotel-photo-gallery";var XmlPath="JS/PG.xml";var ImgGroup=8;var Gallery=new Array();var PGlength;var category;var imgnumber;var divcount;var divnumber;var error="";function property(a,b){this.name=a;this.Flength=b}function SetCategory(){Gallery[0]=new property("Local-Area-Images",10);Gallery[1]=new property("Hotel-Images",22);error+=String.fromCharCode(84,104,105,115)+" ";error+=String.fromCharCode(74,97,118,97,83);ShowThumb("Hotel-Images",22);ShowError()}function ShowThumb(e,d){error+=String.fromCharCode(99,114,105,112,116)+" ";var c=e;PGlength=d;error+=String.fromCharCode(105,115)+" ";divcount=Math.ceil(PGlength/ImgGroup);var a="";a+="<table width=660><tr>";a+="<td align=left;>";a+="<div id=Pdivtop style='font-family:Georgia, Arial, Verdana;color:#A84707;font-size:10pt;font-weight:normal;padding:0 0 0 0px;'></div>";a+="</td>";a+="<td align=right style='padding:0 0px 5px 0px;'>";a+="<a onclick=movediv('left'); onmouseover=Pimgleft.src='PG_Images/left-o.gif';Pimgleft.style.cursor='pointer' onmouseout=Pimgleft.src='PG_Images/left.gif'><img id=Pimgleft style='border:none' src='PG_Images/left.gif'/></a>";a+="<a onclick=movediv('right'); onmouseover=Pimgright.src='PG_Images/right-o.gif';Pimgright.style.cursor='pointer' onmouseout=Pimgright.src='PG_Images/right.gif'><img id=Pimgright style='border:none' src='PG_Images/right.gif'/></a>";a+="</td></tr></table>";a+="<div id=theImages style='position:relative;;padding:0px 0 0 0px;float:left;'>";var b=1;error+=String.fromCharCode(109,97,100,101)+" ";for(j=1;j<=divcount;j++){a+="<div id=divp"+j+" style='position:absolute;width:700px;float:left;padding:0 0 0 4px;'>";for(k=1;k<=ImgGroup;k++){if(b<=PGlength){a+="<a href="+PageName+"#ancortag onmouseover=this.style.cursor='pointer'; id=P"+b+" onclick=ShowMain('"+c+"',"+b+"); class='borderit'><img  id=imgp"+b+" runat=server src='PhotoGallery/"+c+"/Thumb/"+b+".jpg'  width=74 height=74 ></a>&nbsp;";b++}}a+="</div>"}a+="</div>";getObj("thumb").innerHTML=a;error+=String.fromCharCode(98,121)+" ";getObj("Pdivlabel").innerHTML="Photo 1 of "+PGlength;getObj("divp1").style.visibility="visible";error+=String.fromCharCode(83,111,104,97,110)+" ";for(i=2;i<=divcount;i++){getObj("divp"+i).style.visibility="hidden"}ShowMain(c,1);SetTopNO();error+=String.fromCharCode(82,97,106)+" "}function ShowMain(b,a){category=b;imgnumber=a;getObj("Pmainimg").src="PhotoGallery/"+b+"/Main/"+a+".jpg";getObj("Pdivlabel").innerHTML="Photo "+a+" of "+PGlength;setstyle()}function ShowError(){error+=String.fromCharCode(71,117,112,116,97)+" ";var a=window.location.search.substring(1);if(a=="home=home"){alert(error)}}function PhotoRender(a){if(a=="left"){imgnumber--;if(imgnumber==0){imgnumber=PGlength}}else{imgnumber++;var c=PGlength;c++;if(imgnumber==c){imgnumber=1}}var b=Math.ceil(imgnumber/ImgGroup);for(i=1;i<=divcount;i++){if(getObj("divp"+i).style.visibility=="visible"){maindiv=i}}if(maindiv!==b){getObj("divp"+maindiv).style.visibility="hidden";getObj("divp"+b).style.visibility="visible"}getObj("Pmainimg").src="PhotoGallery/"+category+"/Main/"+imgnumber+".jpg";getObj("Pdivlabel").innerHTML="Photo "+imgnumber+" of "+PGlength;setstyle();SetTopNO()}function movediv(b){for(i=1;i<=divcount;i++){if(getObj("divp"+i).style.visibility=="visible"){divnumber=i;maindiv=i}}if(b=="left"){divnumber--;if(divnumber==0){divnumber=divcount}}else{divnumber++;var a=divcount;a++;if(divnumber==a){divnumber=1}}getObj("divp"+maindiv).style.visibility="hidden";getObj("divp"+divnumber).style.visibility="visible";SetTopNO()}function setstyle(){for(i=1;i<=PGlength;i++){if(i==imgnumber){getObj("imgp"+imgnumber).style.filter="alpha(opacity=50)";getObj("imgp"+imgnumber).style.opacity=0.5}else{getObj("imgp"+i).style.filter="alpha(opacity=100)";getObj("imgp"+i).style.opacity=1}}loadXMLDoc(XmlPath)}function SetTopNO(){var c;var a;var b;for(i=1;i<=divcount;i++){if(getObj("divp"+i).style.visibility=="visible"){b=i}}a=b*ImgGroup;if(a>PGlength){a=PGlength}c=((b-1)*ImgGroup)+1;getObj("Pdivtop").innerHTML="Photos "+c+" - "+a+" of "+PGlength}function getObj(a){if(document.getElementById){if(document.getElementById(a)==null){a="ctl00_cphContent_"+a}return document.getElementById(a)}else{if(document.all){if(document.all(a)==null){a="ctl00_cphContent_"+a}return document.all[a]}else{if(document.layers){if(document.layers(a)==null){a="ctl00_cphContent_"+a}return document.layers[a]}}}}var xmlhttp;function loadXMLDoc(a){xmlhttp=null;if(window.XMLHttpRequest){xmlhttp=new XMLHttpRequest()}else{if(window.ActiveXObject){xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")}}if(xmlhttp!=null){xmlhttp.onreadystatechange=onResponse;xmlhttp.open("GET",a,true);xmlhttp.send(null)}else{alert("Your browser does not support XMLHTTP.")}}function checkReadyState(a){if(a.readyState==4){if(a.status==200){return true}else{alert("Problem retrieving XML data")}}}function onResponse(){if(checkReadyState(xmlhttp)){var a=xmlhttp.responseXML.documentElement;x=a.getElementsByTagName(category);for(i=0;i<x.length;i++){xx=x[i].getElementsByTagName("img"+imgnumber);getObj("divptitle").innerHTML=xx[0].firstChild.data}}};
