var LocationChanger={curtainElem:null,dialogContainerElem:null,dialogContentsElem:null,closeLink:null,loginLink:null,positionInterval:null,currentCountry:"",currentCityId:-1,workingCountry:"",workingCountryName:"",workingCityId:-1,loadingImg:null,loadingImgElem:null,windowTitle:null,windowText:null,languagesLink:null,chooseLocationTitle:"",chooseLocationText:"",SelectCity:function(b,a){LocationChanger.ShowDialog();if(b!=null&&b!=undefined&&b.length>0&&a!=null&&a!=undefined&&a.length>0){LocationChanger.CountrySelected(a,b)}else{LocationChanger.ShowSelectCountry()}},ShowDialog:function(){var c=Math.max(document.documentElement.clientHeight,((document.height!=undefined)?document.height:document.body.offsetHeight));var k=Math.max(document.body.clientWidth,980);LocationChanger.loadingImg=new Image();LocationChanger.loadingImg.src="/images/bubbles/bubble_loading.gif";var i=Get("EntityDropbox");LocationChanger.curtainElem=document.createElement("div");LocationChanger.curtainElem.style.position="absolute";LocationChanger.curtainElem.style.width=k+"px";LocationChanger.curtainElem.style.height=c+"px";LocationChanger.curtainElem.style.zIndex=600;LocationChanger.curtainElem.style.backgroundColor="#252038";LocationChanger.curtainElem.style.opacity=0.85;LocationChanger.curtainElem.style.filter="alpha(opacity=85)";LocationChanger.curtainElem.appendChild(document.createTextNode(" "));LocationChanger.dialogContainerElem=document.createElement("div");var h=document.createElement("div");var g=document.createElement("div");var f=document.createElement("div");var d=document.createElement("div");LocationChanger.dialogContentsElem=document.createElement("div");LocationChanger.dialogContainerElem.className="Dialog";h.className="Dialog-tl";g.className="Dialog-tr";f.className="Dialog-bl";d.className="Dialog-br";LocationChanger.dialogContentsElem.className="Dialog-padding";LocationChanger.dialogContainerElem.style.position="absolute";LocationChanger.dialogContainerElem.style.width="580px";LocationChanger.dialogContainerElem.style.height="400px";LocationChanger.dialogContainerElem.style.zIndex=601;d.appendChild(LocationChanger.dialogContentsElem);f.appendChild(d);g.appendChild(f);h.appendChild(g);LocationChanger.dialogContainerElem.appendChild(h);i.appendChild(LocationChanger.dialogContainerElem);i.appendChild(LocationChanger.curtainElem);i=h=g=f=d=null;LocationChanger.PositionDialog();LocationChanger.positionInterval=setInterval("LocationChanger.PositionDialog()",500);LocationChanger.closeLink=document.createElement("div");var j=document.createElement("a");if(typeof(LocationChanger.closeLink.style.cssFloat)!="undefined"){LocationChanger.closeLink.style.cssFloat="right"}else{LocationChanger.closeLink.style.styleFloat="right"}LocationChanger.closeLink.style.margin="-10px -30px 0 0";j.className="CloseLink";j.onclick=function(){LocationChanger.HideDialog();return false};j.href="#";j.appendChild(document.createTextNode(Translation.Close));LocationChanger.closeLink.appendChild(j);LocationChanger.languagesLink=document.createElement("div");var a=document.createElement("a");LocationChanger.languagesLink.style.position="absolute";LocationChanger.languagesLink.style.bottom="5px";LocationChanger.languagesLink.style.right="10px";a.onclick=function(){Flags.ShowLanguagesDialog();return false};a.href="#";a.appendChild(document.createTextNode("Choose Your Language"));LocationChanger.languagesLink.appendChild(a);LocationChanger.loginLink=document.createElement("div");var b=document.createElement("a");var l=document.createElement("em");if(typeof(LocationChanger.loginLink.style.cssFloat)!="undefined"){LocationChanger.loginLink.style.cssFloat="right"}else{LocationChanger.loginLink.style.styleFloat="right"}LocationChanger.loginLink.style.margin="-12px -28px 0 0";LocationChanger.loginLink.style.color="#696969";b.href="http://www.metrodate.com/asp/login.aspx";b.onclick=function(){loginForm.Show();return false};b.style.color="#010078";b.style.fontWeight="bold";b.appendChild(document.createTextNode("Log In Here"));l.appendChild(document.createTextNode("Already a Metrodate Member?  "));l.style.padding="0 6px 0 0";LocationChanger.loginLink.appendChild(l);LocationChanger.loginLink.appendChild(b);LocationChanger.loadingImgElem=document.createElement("div");var e=document.createElement("img");e.src=LocationChanger.loadingImg.src;e.width=100;e.height=100;e.alt="Loading...";LocationChanger.loadingImgElem.style.textAlign="center";LocationChanger.loadingImgElem.style.margin="35px auto";LocationChanger.loadingImgElem.appendChild(e);LocationChanger.windowTitle=document.createElement("h2");LocationChanger.windowTitle.appendChild(document.createTextNode(LocationChanger.chooseLocationTitle));LocationChanger.windowText=document.createElement("em");LocationChanger.windowText.style.fontSize="11px";LocationChanger.windowText.appendChild(document.createTextNode(LocationChanger.chooseLocationText))},ShowSelectCountry:function(){LocationChanger.NewDialog();LocationChanger.dialogContentsElem.appendChild(LocationChanger.loadingImgElem);GetAjaxContent("/ajax/locationchanger/getcountries.ashx?c="+LocationChanger.currentCountry,LocationChanger.SelectCountryLoaded)},SelectCountryLoaded:function(i){LocationChanger.NewDialog();if(i==null||i==undefined||i=="ERROR"){LocationChanger.dialogContentsElem.appendChild(document.createTextNode("We're sorry, but we could not process your request due to an unexpected communication error.  Please wait a moment and try again. (ERROR CODE: 1)"));return}var k=i.split("[sectionbreak]")[0];var d=i.split("[sectionbreak]")[1].split("[break]");if(k=="GOTO"){LocationChanger.CountrySelected(d[0].split("[split]")[1],d[0].split("[split]")[0]);return}var c=document.createElement("div");c.style.width="180px";if(typeof(c.style.cssFloat)!="undefined"){c.style.cssFloat="right"}else{c.style.styleFloat="right"}LocationChanger.dialogContentsElem.appendChild(c);var h=document.createElement("div");h.style.width="316px";h.style.height="155px";h.style.overflow="hidden";h.style.margin="8px 0 0 0";h.style.background="transparent url(/images/layout2008/home/map_1085_155ea.jpg) no-repeat scroll 0px 0px";LocationChanger.dialogContentsElem.appendChild(h);var a=document.createElement("div");a.style.textAlign="center";a.style.fontSize="10px";a.style.margin="5px 0 0 0";a.appendChild(document.createTextNode("Click on a continent to view its countries."));LocationChanger.dialogContentsElem.appendChild(a);var m=document.createElement("map");var l=document.createElement("area");var g=document.createElement("area");var f=document.createElement("area");var j=document.createElement("area");var e=document.createElement("area");var n=document.createElement("area");m.appendChild(l);m.appendChild(g);m.appendChild(f);m.appendChild(j);m.appendChild(e);m.appendChild(n);m.id="MapCountries";m.name="MapCountries";l.shape="polygon";l.coords="13,13,8,29,23,33,29,29,22,54,40,76,66,76,84,70,69,53,109,37,111,27,128,17,141,14,143,3,53,2";l.onmouseover=function(){LocationChanger.ShiftToCountryView(h,1)};l.onmouseout=function(){LocationChanger.ShiftToCountryView(h,0)};l.onclick=function(){LocationChanger.ShowSelectRegion("NA",c)};l.href="#";g.shape="polygon";g.coords="59,93,67,78,95,76,121,98,100,139,98,154,76,155,67,115";g.onmouseover=function(){LocationChanger.ShiftToCountryView(h,2)};g.onmouseout=function(){LocationChanger.ShiftToCountryView(h,0)};g.onclick=function(){LocationChanger.ShowSelectRegion("SA",c)};g.href="#";f.shape="polygon";f.coords="152,2,195,5,197,15,192,32,191,42,177,42,166,49,132,50,139,23";f.onmouseover=function(){LocationChanger.ShiftToCountryView(h,3)};f.onmouseout=function(){LocationChanger.ShiftToCountryView(h,0)};f.onclick=function(){LocationChanger.ShowSelectRegion("EU",c)};f.href="#";j.shape="polygon";j.coords="195,95,204,109,187,133,153,132,146,92,126,81,129,52,176,51,186,68,190,78,202,74,197,86";j.onmouseover=function(){LocationChanger.ShiftToCountryView(h,4)};j.onmouseout=function(){LocationChanger.ShiftToCountryView(h,0)};j.onclick=function(){LocationChanger.ShowSelectRegion("AF",c)};j.href="#";e.shape="polygon";e.coords="288,102,288,84,274,65,297,22,296,10,232,3,196,5,198,18,193,43,179,44,171,48,180,51,183,59,190,75,199,73,210,67,221,87,233,87,236,76,245,98,256,107,266,104";e.onmouseover=function(){LocationChanger.ShiftToCountryView(h,5)};e.onmouseout=function(){LocationChanger.ShiftToCountryView(h,0)};e.onclick=function(){LocationChanger.ShowSelectRegion("AS",c)};e.href="#";n.shape="polygon";n.coords="255,129,252,111,275,106,281,104,289,103,290,90,305,104,299,113,316,123,316,149,285,147,258,136";n.onmouseover=function(){LocationChanger.ShiftToCountryView(h,6)};n.onmouseout=function(){LocationChanger.ShiftToCountryView(h,0)};n.onclick=function(){LocationChanger.ShowSelectRegion("OC",c)};n.href="#";h.appendChild(m);var b=document.createElement("img");b.src="/images/spacer.gif";b.width="316";b.height="155";b.useMap="#MapCountries";h.appendChild(b);if(k=="TOPCOUNTRIES"){LocationChanger.DisplayTopCountriesList(d,c)}if(k=="REGION"){LocationChanger.DisplayRegionalCountriesList(d,c)}},DisplayRegionalCountriesList:function(a,b){ClearChildNodes(b);LocationChanger.DisplayCountriesList(a,b)},DisplayTopCountriesList:function(a,b){ClearChildNodes(b);var c=document.createElement("div");c.appendChild(document.createTextNode("Common Selections:"));c.style.margin="20px 0 -12px 0";c.style.fontWeight="bold";b.appendChild(c);LocationChanger.DisplayCountriesList(a,b)},DisplayCountriesList:function(d,g){var a=document.createElement("div");a.style.width="180px";a.style.height="250px";a.style.overflow="auto";a.style.padding="1px";a.style.margin="20px 0 0 0";if(d.length>10){a.style.border="1px solid #F1F1F1"}for(var i=0,h;h=d[i];i++){var f=h.split("[split]")[0];var e=h.split("[split]")[1];var b=document.createElement("a");b.href="#";b.onclick=function(c,j){return function(){LocationChanger.CountrySelected(c,j);return false}}(e,f);b.appendChild(document.createTextNode(e));a.appendChild(b);a.appendChild(document.createElement("br"))}g.appendChild(a)},ShiftToCountryView:function(a,b){a.style.backgroundPosition="0px "+(b*-155)+"px"},ShowSelectRegion:function(b,a){GetAjaxContent("/ajax/locationchanger/getcountries.ashx?c="+LocationChanger.currentCountry+"&r="+b,function(c){LocationChanger.SelectRegionLoaded(c,a)})},SelectRegionLoaded:function(b,a){if(b==null||b==undefined||b=="ERROR"){LocationChanger.dialogContentsElem.appendChild(document.createTextNode("We're sorry, but we could not process your request due to an unexpected communication error.  Please wait a moment and try again. (ERROR CODE: 1)"));return}var c=b.split("[sectionbreak]")[0];var d=b.split("[sectionbreak]")[1].split("[break]");if(c=="TOPCOUNTRIES"){LocationChanger.DisplayTopCountriesList(d,a)}if(c=="REGION"){LocationChanger.DisplayRegionalCountriesList(d,a)}},CountrySelected:function(b,a){LocationChanger.NewDialog();LocationChanger.dialogContentsElem.appendChild(LocationChanger.loadingImgElem);LocationChanger.workingCountryName=b;LocationChanger.workingCountry=a;GetAjaxContent("/ajax/locationchanger/getcountryaction.ashx?c="+LocationChanger.workingCountry,LocationChanger.DoGetCityAction)},DoGetCityAction:function(b){if(b==null||b==undefined||b=="ERROR"){LocationChanger.NewDialog();LocationChanger.dialogContentsElem.appendChild(document.createTextNode("We're sorry, but we could not process your request due to an unexpected communication error.  Please wait a moment and try again. (ERROR CODE: 2)"));return}var d=b.split("[sectionbreak]")[0];var a=b.split("[sectionbreak]")[1];if(d=="SINGLECITY"){LocationChanger.workingCityId=a.split("[split]")[0];var c=a.split("[split]")[1];document.location.href="http://www.metrodate.com/"+c+"/"}else{if(d=="ZIPLOOKUP"){LocationChanger.ShowZipLookup(a)}else{if(d=="CITIESLIST"){LocationChanger.ShowCitiesListDialog(a)}}}},ShowZipLookup:function(g){LocationChanger.NewDialog();LocationChanger.dialogContentsElem.appendChild(LocationChanger.GetSelectedCountryText());var i=function(){LocationChanger.DoZipLookup(h.value,g,f,d);return false};var a=document.createElement("div");a.style.margin="12px 0 0 35px";var e=document.createElement("h3");e.appendChild(document.createTextNode("Please enter your "+LocationChanger.workingCountryName+" "+g+":"));a.appendChild(e);a.appendChild(document.createElement("br"));var b=document.createElement("strong");b.style.display="block";b.appendChild(document.createTextNode(g+":"));a.appendChild(b);var h=document.createElement("input");h.type="text";h.maxlength="16";h.value=ReadCookie("zip");h.style.width="150px";h.onkeypress=function(j){return SubmitOnEnter(j,i)};a.appendChild(h);var c=document.createElement("input");c.type="button";c.className="btnPurple_100";c.value="Go    ";c.style.margin="0 0 10px 10px";c.onclick=i;a.appendChild(c);a.appendChild(document.createElement("br"));var f=document.createElement("div");a.appendChild(f);var d=document.createElement("div");d.style.fontWeight="bold";d.style.color="#B8001A";a.appendChild(d);LocationChanger.dialogContentsElem.appendChild(a);setTimeout(function(){h.focus();h.select()},150)},DoZipLookup:function(b,c,a,d){ClearChildNodes(d);ClearChildNodes(a);if(b==null||b==undefined||b.length<=0){d.appendChild(document.createTextNode("Please enter a "+c+" to search for."));return}d.appendChild(LocationChanger.loadingImgElem);GetAjaxContent("/ajax/locationchanger/getzipsearch.ashx?c="+LocationChanger.workingCountry+"&z="+b,function(e){LocationChanger.ShowZipLookupResults(b,c,a,d,e)})},ShowZipLookupResults:function(a,f,b,g,c){if(c==null||c==undefined||c=="ERROR"){LocationChanger.NewDialog();LocationChanger.dialogContentsElem.appendChild(document.createTextNode("We're sorry, but we could not process your request due to an unexpected communication error.  Please wait a moment and try again. (ERROR CODE: 3)"));return}ClearChildNodes(g);ClearChildNodes(b);if(c=="INVALIDZIP"){g.appendChild(document.createTextNode("The "+f+' "'+a+'" is not in the correct format for '+LocationChanger.workingCountryName+".  Please correct any errors and try again."))}else{if(c=="NOMATCH"){g.appendChild(document.createTextNode("We could not locate any cities near this "+f+"."))}else{CreateCookie("zip",a,60);CreateCookie("country",LocationChanger.workingCountry,60);var e=c.split("[break]");var i=e[0].split("[split]")[1];var h=e[0].split("[split]")[2];var d=e[0].split("[split]")[3];if(document.location.href.indexOf("metrodate.com")>=0&&LocationChanger.currentCountry==LocationChanger.workingCountry&&typeof(HomepageBranding)!="undefined"){HomepageBranding.CheckNewZipResponse(a,LocationChanger.workingCountry,-1,h+"|"+d);LocationChanger.HideDialog()}else{document.location.href="http://www.metrodate.com/"}}}},ShowCitiesListDialog:function(c){LocationChanger.NewDialog();LocationChanger.dialogContentsElem.appendChild(LocationChanger.GetSelectedCountryText());var b=document.createElement("div");b.style.margin="12px 0 0 35px";var a=document.createElement("h3");a.appendChild(document.createTextNode("Select Your Closest City"));b.appendChild(a);LocationChanger.ShowCitiesList(c,b);LocationChanger.dialogContentsElem.appendChild(b)},ShowCitiesList:function(l,b){var h=l.split("[break]");for(var g=0,e;e=h[g];g++){var i=e.split("[split]")[0];var k=e.split("[split]")[1];var j=e.split("[split]")[2];var f=e.split("[split]")[3];var d=document.createElement("a");d.href="http://www.metrodate.com/"+k+"/";if(document.location.href.indexOf("metrodate.com")>=0&&LocationChanger.currentCountry==LocationChanger.workingCountry&&typeof(HomepageBranding)!="undefined"){d.onclick=function(m,c){return function(){HomepageBranding.CheckNewZipResponse("",LocationChanger.workingCountry,-1,m+"|"+c);LocationChanger.HideDialog();return false}}(j,f)}d.appendChild(document.createTextNode(i));b.appendChild(d);b.appendChild(document.createElement("br"))}var a=document.createElement("div");a.style.fontSize="11px";a.style.fontStyle="italic";a.appendChild(document.createTextNode("If you don't see your city, simply select the city closest to you."));b.appendChild(document.createElement("br"));b.appendChild(a)},GetSelectedCountryText:function(){var c=document.createElement("em");c.style.display="block";c.style.margin="10px 0 0 0";c.style.fontSize="11px";var b=document.createElement("strong");b.appendChild(document.createTextNode(LocationChanger.workingCountryName));var a=document.createElement("a");a.href="#";a.onclick=function(){LocationChanger.HideDialog();LocationChanger.SelectCity();return false};a.style.fontStyle="normal";a.style.fontSize="11px";a.appendChild(document.createTextNode("\u00abChange Country"));c.appendChild(document.createTextNode("You selected "));c.appendChild(b);c.appendChild(document.createTextNode("."));c.appendChild(document.createElement("br"));c.appendChild(a);return c},NewDialog:function(){ClearChildNodes(LocationChanger.dialogContentsElem);if(LocationChanger.currentCityId>0){LocationChanger.dialogContentsElem.appendChild(LocationChanger.closeLink)}else{LocationChanger.dialogContentsElem.appendChild(LocationChanger.loginLink)}LocationChanger.dialogContentsElem.appendChild(LocationChanger.windowTitle);LocationChanger.dialogContentsElem.appendChild(LocationChanger.windowText);LocationChanger.dialogContentsElem.appendChild(LocationChanger.languagesLink)},PositionDialog:function(){LocationChanger.dialogContainerElem.style.left=GetScreenCenteredX(580)+"px";LocationChanger.dialogContainerElem.style.top=GetScreenCenteredY(400)+"px"},HideDialog:function(){clearInterval(LocationChanger.positionInterval);var a=Get("EntityDropbox");a.removeChild(LocationChanger.dialogContainerElem);a.removeChild(LocationChanger.curtainElem);a=null}};