<!--

function getE(htmlElementName) {
 return document.getElementById(htmlElementName);
}

var myPopupWindow = null;


// Array.forEach( function ) - Apply a function to each element
Array.prototype.forEach = function( f ) {
 var i = this.length, j, l = this.length;
 for( i=0; i<l; i++ ) { if( ( j = this[i] ) ) { f( j ); } }
};

// Array.indexOf( value, begin, strict ) - Return index of the first element that matches value
Array.prototype.indexOf = function( v, b, s ) {
 for( var i = +b || 0, l = this.length; i < l; i++ ) {
  if( this[i]===v || s && this[i]==v ) { return i; }
 }
 return -1;
};

var IE7 = (navigator.userAgent.toLowerCase().indexOf("msie 7.0")!=-1?true:false);

//Layer resize
function Is() {
    agent  = navigator.userAgent.toLowerCase();
    this.major = parseInt(navigator.appVersion);
    this.minor = parseFloat(navigator.appVersion);
    this.ns    = ((agent.indexOf('mozilla') != -1) && 
      ((agent.indexOf('spoofer')  ==   -1) && (agent.indexOf('compatible') == -1)));
    this.ns4   = (this.ns && (this.major == 4));
    this.ns6   = (this.ns && (this.major >= 5));
    this.ie    = (agent.indexOf("msie") != -1);
    this.ie3   = (this.ie && (this.major  < 4));
    this.ie4   = (this.ie && (this.major == 4) && (agent.indexOf("msie 5.0") == -1));
    this.ie5   = (this.ie && (this.major == 4) && (agent.indexOf("msie 5.0") != -1));
    this.ie55  = (this.ie && (this.major == 4) && (agent.indexOf("msie 5.5") != -1));
    this.ie6  = (this.ie && (agent.indexOf("msie 6.0")!=-1) );
    this.ie7  = (this.ie && (agent.indexOf("msie 7.0")!=-1) );
}

var is = new Is();
//Layer resize - end




// BEGIN - Display City dropdown layer under the City Name field
function getCallbackFunction(req, processData) {
 // Return an anonymous function that listens to the
 // XMLHttpRequest instance
 return function () {
 // If the request's status is "complete"
   if (req.readyState == 4) {
     if (req.status == 200) {
       // Pass the XML payload of the response to the
       // handler function
       processData(req.responseXML);
     } else {
       // An HTTP problem has occurred
       alert("HTTP error: "+req.status);
     }
   }
 }
}


function selectLine(obj) {
 if (cityListPos != 0) unSelectLine(document.getElementById('tr'+cityListPos))
 obj.setAttribute('className','cityDDH');
 obj.setAttribute('class','cityDDH');
 cityListPos = parseInt(obj.id.substring(3,2));
}

function unSelectLine(obj) {
 obj.setAttribute('className','cityDDN');
 obj.setAttribute('class','cityDDN');
}
			
function CheckKey(e) {
 var key = e ? e.keyCode : window.event.keyCode;
 var obj = document.getElementById('fullAddress');

 if (key==13 && obj.value != '') {
   if (cityList.length > 1) fillIn(cityListPos)
 }

// Down Arrow button
 if (key==40) {
   if (cityListPos != cityList.length-1) {
     unSelectLine(document.getElementById('tr'+cityListPos));
     cityListPos++;
     selectLine(document.getElementById('tr'+cityListPos));
   }
 }

// Up Arrow button
 if (key==38) {
   if (cityListPos != 0) {
     unSelectLine(document.getElementById('tr'+cityListPos));
     cityListPos--;
     selectLine(document.getElementById('tr'+cityListPos));
   }
 }
}

function disableEnterKey(e) {
 var key = e ? e.keyCode : window.event.keyCode;
//     var key;
//     if(window.event)
//          key = window.event.keyCode;     //IE
//     else
//          key = e.which;     //firefox
     if(key == 13) return false;
     else return true;
}

function checkDistrict(obj) {
 c = obj.value
 if (c.toLowerCase() == 'i' || c.toLowerCase() == 'i.') obj.value = 'I. kerület';
 if (c.toLowerCase() == 'ii' || c.toLowerCase() == 'ii.') obj.value = 'II. kerület';
 if (c.toLowerCase() == 'iii' || c.toLowerCase() == 'iii.') obj.value = 'III. kerület';
 if (c.toLowerCase() == 'iv' || c.toLowerCase() == 'iv.') obj.value = 'IV. kerület';
 if (c.toLowerCase() == 'v' || c.toLowerCase() == 'v.') obj.value = 'V. kerület';
 if (c.toLowerCase() == 'vi' || c.toLowerCase() == 'vi.') obj.value = 'VI. kerület';
 if (c.toLowerCase() == 'vii' || c.toLowerCase() == 'vii.') obj.value = 'VII. kerület';
 if (c.toLowerCase() == 'viii' || c.toLowerCase() == 'viii.') obj.value = 'VIII. kerület';
 if (c.toLowerCase() == 'ix' || c.toLowerCase() == 'ix.') obj.value = 'IX. kerület';
 if (c.toLowerCase() == 'x' || c.toLowerCase() == 'x.') obj.value = 'X. kerület';
 if (c.toLowerCase() == 'xi' || c.toLowerCase() == 'xi.') obj.value = 'XI. kerület';
 if (c.toLowerCase() == 'xii' || c.toLowerCase() == 'xii.') obj.value = 'XII. kerület';
 if (c.toLowerCase() == 'xiii' || c.toLowerCase() == 'xiii.') obj.value = 'XIII. kerület';
 if (c.toLowerCase() == 'xiv' || c.toLowerCase() == 'xiv.') obj.value = 'XIV. kerület';
 if (c.toLowerCase() == 'xv' || c.toLowerCase() == 'xv.') obj.value = 'XV. kerület';
 if (c.toLowerCase() == 'xvi' || c.toLowerCase() == 'xvi.') obj.value = 'XVI. kerület';
 if (c.toLowerCase() == 'xvii' || c.toLowerCase() == 'xvii.') obj.value = 'XVII. kerület';
 if (c.toLowerCase() == 'xviii' || c.toLowerCase() == 'xviii.') obj.value = 'XVIII. kerület';
 if (c.toLowerCase() == 'xix' || c.toLowerCase() == 'xix.') obj.value = 'XIX. kerület';
 if (c.toLowerCase() == 'xx' || c.toLowerCase() == 'xx.') obj.value = 'XX. kerület';
 if (c.toLowerCase() == 'xxi' || c.toLowerCase() == 'xxi.') obj.value = 'XXI. kerület';
 if (c.toLowerCase() == 'xxii' || c.toLowerCase() == 'xxii.') obj.value = 'XXII. kerület';
 if (c.toLowerCase() == 'xxiii' || c.toLowerCase() == 'xxiii.') obj.value = 'XXIII. kerület';
}


// END - Display City dropdown layer under the City Name field






// BEGIN - Format number type field content to 'NNN NNN NNN' format
function removeSpaces(s) {
	var temp = '';
	for (ri=0; ri<s.length; ri++) {
		if (s.substr(ri,1)!=' ')
			temp = temp + s.substr(ri,1);
	}
	return temp;
}

function strReverse(s) {
	var temp = '';
	for (i=1; i<=s.length; i++) {
		temp = temp + s.substr(s.length-i,1);
	}
	return temp;
}

function chunkSplit(s) {
	var temp = s;
	var count = 0;
	for (i=0; i<s.length; i++) {
		if (i!=0 && (i/3 == Math.round(i/3)))
			count++;
	}
	switch(count) {
		case 1:
			temp = s.substr(0,3) + ' ' + s.substr(3,s.length-1);
			break;
		case 2:
			temp = s.substr(0,3) + ' ' + s.substr(3,3) + ' ' + s.substr(6,s.length-1);
			break;
		case 3:
			temp = s.substr(0,3) + ' ' + s.substr(3,3) + ' ' + s.substr(6,3) + ' ' + s.substr(9,s.length-1);
			break;
		case 4:
			temp = s.substr(0,3) + ' ' + s.substr(3,3) + ' ' + s.substr(6,3) + ' ' + ' ' + s.substr(9,3) + s.substr(12,s.length-1);
			break;
	}
	
	return temp;
}

function format_number(obj) {
 temp = removeSpaces(obj.value);
 temp = strReverse(temp);
 obj.value = strReverse(chunkSplit(temp));
}

function format_number_value(value) {
 temp = removeSpaces(value);
 temp = strReverse(temp);
 return strReverse(chunkSplit(temp));
}

// END - Format number type field content to 'NNN NNN NNN' format





function ctrlInput(e, inputType) {
 var key;
 var keychar;
 var characters;

 switch (inputType) {
	case 'email':
		characters = 'abcdefghijklmnopqrstuxyvwzABCDEFGHIJKLMNOPQRSTUXYVWZ0123456789.@-_';
	 	break;
	case 'emailpromo':
		characters = 'abcdefghijklmnopqrstuxyvwzABCDEFGHIJKLMNOPQRSTUXYVWZ0123456789.@-_;, ';
	 	break;
	case 'phone':
		characters = '0123456789()-+ /';
	 	break;
	case 'pwd':
		characters = 'abcdefghijklmnopqrstuxyvwzABCDEFGHIJKLMNOPQRSTUXYVWZ0123456789';
	 	break;
	case 'general':
		characters = 'abcdefghijklmnopqrstuxyvwzABCDEFGHIJKLMNOPQRSTUXYVWZöüóőúéáűíÖÜÓŐÚÉÁŰÍ0123456789 \'"+!%/=()<>#&@,.-?:_;*$€äÄß';
	 	break;
	case 'city':
		characters = 'abcdefghijklmnopqrstuxyvwzABCDEFGHIJKLMNOPQRSTUXYVWZöüóőúéáűíÖÜÓŐÚÉÁŰÍ0123456789,- äÄß';
	 	break;
	case 'address':
		characters = 'abcdefghijklmnopqrstuxyvwzABCDEFGHIJKLMNOPQRSTUXYVWZöüóőúéáűíÖÜÓŐÚÉÁŰÍ0123456789./,- äÄß';
	 	break;
	case 'fulladdress':
		characters = 'abcdefghijklmnopqrstuxyvwzABCDEFGHIJKLMNOPQRSTUXYVWZöüóőúéáűíÖÜÓŐÚÉÁŰÍ./,- äÄß';
	 	break;
	case 'url':
		characters = 'abcdefghijklmnopqrstuxyvwz0123456789.-';
	 	break;
	case 'num':
		characters = '0123456789';
	 	break;
	case 'decimal':
		characters = '0123456789.';
	 	break;
	case 'code':
		characters = '23456789bcdfghjkmnpqrstvwxyz';
	 	break;
	case 'taxnumber':
		characters = '0123456789-';
	 	break;
	default:
		characters = 'abcdefghijklmnopqrstuxyvwz0123456789';
		break;
 }
	 
 if (window.event) key = window.event.keyCode;
 else if (e) key = e.which;
 else return true;
 
 keychar = String.fromCharCode(key);
 
// Values:
//  8: [Backspace]
//  9: [Tab]
// 13: [Enter]
// 27: [Esc]
// 36: [Home]
// 37: [LeftArrow]
// 39: [RightArrow]

if ((key==null) || (key==0) || (key==8) || (key==9) || (key==13) || (key==27) ) return true;
 else if (characters.indexOf(keychar) > -1) return true;
 else return false;
}





function setLoupeImg(zoomLevel) {
 document.getElementById('loupeLevel').innerHTML = zoomLevel;
}


// Promo email functions

function emailCheck(str) {

		var at="@";
		var dot=".";
		var lat=str.indexOf(at);
		var lstr=str.length;
		var ldot=str.indexOf(dot);
		if (str.indexOf(at)==-1){
//		   alert(str + " - " + "error 1")
		   return false;
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
//		   alert(str + " - " + "error 2")
		   return false;
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr || str.indexOf(dot)==lstr-1 || str.indexOf(dot)==lstr-2){
//		   alert(str + " - " + "error 3")
		    return false;
		}

		 if (str.indexOf(at,(lat+1))!=-1){
//		   alert(str + " - " + "error 4")
		    return false;
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
//		   alert(str + " - " + "error 5")
		    return false;
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
//		   alert(str + " - " + "error 6")
		    return false;
		 }
		
		 if (str.indexOf(" ")!=-1){
//		   alert(str + " - " + "error 7")
		    return false;
		 }

 		 return true;
	}



function checkEmailList() {
 var temp = '';
 var list = document.getElementById('emailList').value;
 var validChars = '@.;,_-0123456789abcdefghijklmnopqrstuxyvwz';
 for (i=0; i<=list.length; i++) {
   for (k=0; k<validChars.length; k++) {
     if (list.charAt(i).toLowerCase() == validChars.charAt(k)) temp = temp + list.charAt(i).toLowerCase();
   }
 }
 
 list = temp;
 temp = '';
 var emails = new Array();
 var index = 0;

 for (i=0; i<=list.length; i++) {
   if (list.charAt(i) != ';' && list.charAt(i) != ',') {
     temp = temp + list.charAt(i);
   } else {
     if (emailCheck(temp)) {
	   ok = true;
	   for (j=0; j<emails.length; j++) 
	     if (temp == emails[j]) {
		   ok = false;
		   break;
		 }
	   if (ok) {
	     emails[index] = temp;
		 index++;
	   }
	 }
     temp = '';
   }
 }
 if (temp.length>0) {
   if (emailCheck(temp)) {
     ok = true;
	 for (j=0; j<emails.length; j++)
	     if (temp == emails[j]) {
		   ok = false;
		   break;
		 }
	 if (ok) {
	   emails[index] = temp;
	   index++;
	 }
   }
   temp = '';
 }

 return emails.length;
}


function textCounter(field, countfield, maxlimit) {
 if (field.value.length > maxlimit)
  field.value = field.value.substring(0, maxlimit);
 else
  countfield.value = maxlimit - field.value.length;
}



// Map's Custom Control processing function
// dx, dy values:
//		-1: move to the left/up on the map
//		 0: no move in the given direction
//		 1: move to the right/down on the map
function ctrlPanDirection(dx, dy) {
 currentCenter = map.getCenter();
 // Calculate map's height and width pixels divided by 4 - this will be the movement scale
 deltaWidth = (parseFloat(map.getBounds().getNorthEast().lng()) - parseFloat(map.getBounds().getSouthWest().lng())) / 4;
 deltaHeight = (parseFloat(map.getBounds().getSouthWest().lat()) - parseFloat(map.getBounds().getNorthEast().lat())) / 4;
 var newLng;
 var newLat;
 var deltaX = 0
 var deltaY = 0;

 switch (dx)
 {
 	case -1:
		newLng = parseFloat(currentCenter.lng()) - deltaWidth;
		deltaX = -map.getSize().width / 4;
		break;
	case 0:
		newLng = parseFloat(currentCenter.lng());
		break;
	case 1:
		newLng = parseFloat(currentCenter.lng()) + deltaWidth;
		deltaX = map.getSize().width / 4;
	    break;
 }

 switch (dy) {
 	case -1:
		newLat = parseFloat(currentCenter.lat()) - deltaHeight;
		deltaY = -map.getSize().height / 4;
		break;
	case 0:
		newLat = parseFloat(currentCenter.lat());
		break;
	case 1:
		newLat = parseFloat(currentCenter.lat()) + deltaHeight;
		deltaY = map.getSize().height / 4;
	    break;
 }

 map.panTo(new GLatLng(newLat, newLng));
}


// Popup Help Box

var ie=document.all;
var ns6=document.getElementById&&!document.all;
var offsetX = '10px';
var offsetY = '-20px';


function fixSelectBox(divId, show) {
 if(!document.getElementById("boxHide")) {
  var boxHideIframe = document.createElement("iframe");
  boxHideIframe.setAttribute("id","boxHide");
  boxHideIframe.setAttribute("src","javascript:'<html></html>';");
  boxHideIframe.setAttribute("scrolling","no");
  boxHideIframe.setAttribute("frameBorder","0");
  boxHideIframe.style.display = "none";
  boxHideIframe.style.position = "absolute";
  boxHideIframe.style.top = "0";
  boxHideIframe.style.left = "0";
  boxHideIframe.style.zIndex = "1";
  document.body.appendChild(boxHideIframe);
 }

 var iframe = document.getElementById("boxHide");

 if(document.getElementById(divId)) {
  var hintDivObject = document.getElementById(divId);
  iframe.style.display = (show) ? "block" : "none";

  if(ie&&show) { // IE specific
   iframe.style.top = hintDivObject.currentStyle['top'];
   iframe.style.left = hintDivObject.currentStyle['left'];
   iframe.style.width = hintDivObject.offsetWidth;
   iframe.style.height = hintDivObject.offsetHeight;
  }
 }
}

function getOffsetPos(obj, type) {
 var offsetTotal = (type == "top" ? obj.offsetTop : obj.offsetLeft);
 var parentElement = obj.offsetParent;
 while (parentElement != null) {
   offsetTotal = (type == "top" ? offsetTotal + parentElement.offsetTop : offsetTotal+parentElement.offsetLeft);
   parentElement = parentElement.offsetParent;
 }
 return offsetTotal;
}

function ieCompatibilityTest() {
 return (document.compatMode && document.compatMode != "BackCompat" ? document.documentElement : document.body);
}

function correctBrowserEdge(obj, type){
 var offsetEdge = (type == "rightedge" ? parseInt(offsetX) * -1 : parseInt(offsetY) * -1);
 
 if (type == "rightedge") {
  var windowEdge = ie && !window.opera ? ieCompatibilityTest().scrollLeft + ieCompatibilityTest().clientWidth - 30 : window.pageXOffset + window.innerWidth - 40;
  helpBoxObj.contentmeasure = helpBoxObj.offsetWidth;
  if (windowEdge - helpBoxObj.x < helpBoxObj.contentmeasure) offsetEdge = helpBoxObj.contentmeasure + obj.offsetWidth + parseInt(offsetX);
 } else {
  var windowEdge = ie && !window.opera ? ieCompatibilityTest().scrollTop + ieCompatibilityTest().clientHeight - 15 : window.pageYOffset + window.innerHeight - 18;
  helpBoxObj.contentmeasure = helpBoxObj.offsetHeight;
  if (windowEdge - helpBoxObj.y < helpBoxObj.contentmeasure) offsetEdge = helpBoxObj.contentmeasure - obj.offsetHeight;
 }
 
 return offsetEdge;
}

function showHelpBox(helpMsg, helpBoxWidth, obj, e) {
 if ((ie||ns6) && document.getElementById("dHelpBox")) {
  helpBoxObj = document.getElementById("dHelpBox");
  helpBoxObj.innerHTML = '<table><tr><td valign="top"><img src="/images/info.gif"></td><td>' + helpMsg + '</td></tr></table>';
//  helpBoxObj.style.top = "-500px"
//  helpBoxObj.style.left = "0px"
  if (helpBoxWidth != "") helpBoxObj.style.width = helpBoxWidth;
  helpBoxObj.y = getOffsetPos(obj, "top");
  helpBoxObj.x = getOffsetPos(obj, "left");
  helpBoxObj.style.top = helpBoxObj.y - correctBrowserEdge(obj, "bottomedge") + "px";
  helpBoxObj.style.left = helpBoxObj.x - correctBrowserEdge(obj, "rightedge") + obj.offsetWidth + "px";
  helpBoxObj.style.visibility = "visible";
//  if (obj.type == "text") obj.onblur = hideHelpBox
//  obj.onmouseout = hideHelpBox
  fixSelectBox('dHelpBox', true);
 }
}

function hideHelpBox(e) {
 helpBoxObj.style.visibility = "hidden";
// helpBoxObj.style.left = "-500px"
 fixSelectBox('dHelpBox', false);
}

function createHelpBox() {
 var divHelp=document.createElement("div");
 divHelp.setAttribute("id", "dHelpBox");
 document.body.appendChild(divHelp);
}

if (window.addEventListener) window.addEventListener("load", createHelpBox, false);
else if (window.attachEvent) window.attachEvent("onload", createHelpBox);
else if (getE) window.onload=createHelpBox;


-->