jQuery(document).ready(function(){
  SetInputDefaultContent('email', 'Az Ön e-mail címe');
  SetInputDefaultContent('CustomFields_2_1', 'Az Ön postai címe');
  SetInputDefaultContent('CustomFields_1_4', 'Az Ön keresztneve');
});



// set default content for a text input
function SetInputDefaultContent( inputID , valueText ){

  if ( jQuery('#' + inputID).length == 0 ) return false;
  
  var obj = jQuery('#' + inputID );
  
  obj.val(valueText);
  
  obj.focus(function(){
    if ( obj.val() == valueText ) obj.val('');
  });
  
  obj.blur(function(){
    if ( obj.val() == '' ) obj.val(valueText);
  });

  return true;

}

function AppType() 
{
      appname = navigator.appName;
      if (appname.indexOf('Microsoft') != -1) return "IE";
      if (appname.indexOf('Netscape') != -1) return "FF";
}

function showBox(map){
    
	

	var Center = "1"; // ha 1 akkor kozepre kerul
    var Width = "640";
    var Height = "480";
    var BackgroundColor = "#fff";
    var Border = "1px solid #ddd";
    var PositionX = "100";
    var PositionY = jQuery(window).scrollTop() + 100;
	
  
    // dark div
    
   createDarkBackground('main_container');
    
    // popup div building ------------------------------------------------------
    var NewDiv = document.createElement('div');
    //var NewDiv = document.getElementById(divname);
    NewDiv.id = 'CleanwebPopUpDiv';
    NewDiv.style.width = Width + "px";
    NewDiv.style.height = Height+"px";
    NewDiv.style.position = "absolute";
    NewDiv.style.top = PositionX + "px";
    NewDiv.style.left = PositionY + "px";
    NewDiv.style.backgroundColor = BackgroundColor;
    NewDiv.style.border = Border;
    NewDiv.style.overflow = "hidden";
    NewDiv.style.zIndex = "10000";
    
    if (Center > 0) {
        var WinWidth = 0;
        var WinHeight = 0;
        // az explorer megint feketet mond a feherre :S
        if (AppType() == "FF") {
            WinWidth = window.innerWidth;
            WinHeight = window.innerHeight;
        }
        else {
            WinWidth = document.body.offsetWidth;
            WinHeight = document.body.offsetHeight;
        }
        // a pozicio kiszamitasa
        var top = (WinHeight - Height) / 2;
        var left = (WinWidth - Width) / 2;
        NewDiv.style.top = PositionY + "px";
        NewDiv.style.left = left + "px";
    }
  
    
    NewDiv.style.visibility = "visible";
	document.body.appendChild(NewDiv);
	
	var MapDiv = document.createElement('mapDiv');
	

	NewDiv.innerHTML = '<div style="width:100%;background-color:#000;text-align:center;height:20px;line-height:20px;"><a style="font-weight:bold;font-size:12px;color:#ffd400;" href="javascript:removeDarkBackground()">Térkép bezárása</a></div>';
	
	if ( map == 2 )
		NewDiv.innerHTML += '<iframe width="640" height="460" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=hu&amp;geocode=&amp;q=budapest+b%C3%A9csi+%C3%BAt+343&amp;sll=47.482133,19.240644&amp;sspn=0.021346,0.05579&amp;ie=UTF8&amp;ll=47.560954,19.024228&amp;spn=0.010657,0.027895&amp;z=16&amp;output=embed&amp;s=AARTsJrZfdq8enpWGjDD3AzaRT28M0lr0Q"></iframe><br /><small><a href="http://maps.google.com/maps?f=q&amp;source=embed&amp;hl=hu&amp;geocode=&amp;q=budapest+b%C3%A9csi+%C3%BAt+343&amp;sll=47.482133,19.240644&amp;sspn=0.021346,0.05579&amp;ie=UTF8&amp;ll=47.560954,19.024228&amp;spn=0.010657,0.027895&amp;z=16" style="color:#0000FF;text-align:left">Nagyobb térképre váltás</a></small>';
	else
		NewDiv.innerHTML += '<iframe width="640" height="460" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=hu&amp;geocode=&amp;q=budapest+pesti+%C3%BAt+41&amp;sll=37.0625,-95.677068&amp;sspn=50.777825,114.257812&amp;ie=UTF8&amp;z=14&amp;iwloc=addr&amp;ll=47.489079,19.244871&amp;output=embed&amp;s=AARTsJqsRh3QWpQ6yIDTphM6iIvPP1EJMg"></iframe><br /><small><a href="http://maps.google.com/maps?f=q&amp;source=embed&amp;hl=hu&amp;geocode=&amp;q=budapest+pesti+%C3%BAt+67-73&amp;sll=37.0625,-95.677068&amp;sspn=50.777825,114.257812&amp;ie=UTF8&amp;z=14&amp;iwloc=addr&amp;ll=47.489079,19.244871" style="color:#0000FF;text-align:left">Nagyobb térképre váltás</a></small>';
  
}


function createDarkBackground(mainContainer){
	
	var DarkDiv = document.createElement('div');
    DarkDiv.id ='DarkDiv';
    DarkDiv.style.zIndex = '10000';
    DarkDiv.style.backgroundColor = '#000';

    try {
        DarkDiv.style.filter = 'alpha(opacity=75);';
    } 
    catch (x) {
    }
    finally {
        DarkDiv.style.opacity = '0.75';
    }
    
	DarkDiv.style.position = 'absolute';
	DarkDiv.style.top = '0px';
	DarkDiv.style.left = '0px';
	DarkDiv.style.width = '100%';
	DarkDiv.style.height = document.getElementById(mainContainer).clientHeight + 'px';
	DarkDiv.style.visibility = 'visible';
	DarkDiv.onclick = removeDarkBackground;
	document.body.appendChild(DarkDiv);
	
	
}

function removeDarkBackground(){
	document.body.removeChild(document.getElementById('DarkDiv'));
	document.body.removeChild(document.getElementById('CleanwebPopUpDiv'));
	
}
