// ------------------------------
//        input_default
// ------------------------------

function input_default(elm)
{
  if (!elm.base) elm.base = elm.value
  if (elm.value == elm.base) elm.value = "";
  else if (elm.value == "") elm.value = elm.base;
}

//------------------------------
//			input_password
//------------------------------

function input_password()
{
		$("#input_password_login").html("");
		$("#input_password_login").html('<input type="password" tabindex="101" id="input_password_login_focus" class="text" name="web_password" maxlength="12" />');
		$("#input_password_login_focus").focus();
}

//------------------------------
//		input_reg_password
//------------------------------

function input_reg_password(id)
{
	$("#input_"+id).html('');
	$("#input_"+id).html('<input type="password" class="input_long_req" id="input_'+id+'_focus" class="text" name="'+id+'" maxlength="12" />');
	$("#input_"+id+"_focus").focus();
}

//------------------------------
//		forgotten_password
//------------------------------

function forgotten_password(type)
{
	var test_div = $("#forgotten_password").css("display");
	if(test_div != "block")
	{
		if(type == "show")
		{
			$("#forgotten_password").show();
		}
		else
		{
			$("#forgotten_password").slideDown("slow");
		}
	}
	else
	{
		$("#forgotten_password").slideUp("slow");
	}
}

//------------------------------
//		  slideshow_select
//------------------------------

function slideshow_select(div, id)
{
	$("#slideshow_"+div+"_"+id).attr("class", div+"_over");
}

//------------------------------
//		slideshow_deselect
//------------------------------

function slideshow_deselect(div, id)
{
	$("#slideshow_"+div+"_"+id).attr("class", div);
}

//------------------------------
//				show_icon
//------------------------------

function show_icon(div)
{
	var test_div = $("#texts_"+div).css("display");
	if(test_div != "block")
	{
		$("#texts_"+div).slideDown("slow");
		scroll_to("texts_"+div);		
	}
	else
	{
		$("#texts_"+div).slideUp("slow");
	}
}

//------------------------------
//				show_video
//------------------------------

function show_video(id)
{
	$("#video_vimeo_all").fadeIn("slow");
	$("#video_vimeo").html(video[id]);
/*	var test_div = $("#texts_"+div).css("display");
	if(test_div != "block")
	{
	$("#texts_"+div).slideDown("slow");
	scroll_to("texts_"+div);		
	}
	else
	{
	$("#texts_"+div).slideUp("slow");
	}*/
}

//------------------------------
//			close_video
//------------------------------

function close_video(id)
{
	$("#video_vimeo_all").fadeOut("slow");
}


//------------------------------
//				scroll_to
//------------------------------

function scroll_to(id)
{
	$.scrollTo( $('#'+id), 1200 );
}

//------------------------------
//				change_class
//------------------------------

function change_class(id, class_style)
{
	$("#"+id).attr("class", class_style);
}

//------------------------------
//				dealer_detail
//------------------------------

function dealer_detail(id, type)
{
	if(type == undefined)
	{
		var type = "dealer"; 
	}
	
	var test_div = $("#"+type+"_detail_"+id).css("display");
	if(test_div != "table-row")
	{
		// $("#dealer_detail_"+id).slideDown("slow");
		$("#"+type+"_detail_"+id).show();
	}
	else
	{
		$("#"+type+"_detail_"+id).hide();
	}
}

//------------------------------
//			select_person
//------------------------------

function select_person(id)
{
	switch(id)
	{
		default:
		case 0:
			$("#form_0").show();
			$("#form_1").hide();

			$("#person_0").attr("class", "radio_selected");
			$("#person_1").attr("class", "radio");
			
			$("#person").attr("value", "0");
		break;
		
		case 1:
			$("#form_0").hide();
			$("#form_1").show();
			
			$("#person_0").attr("class", "radio");
			$("#person_1").attr("class", "radio_selected");
			
			$("#person").attr("value", "1");
		break;
	}
}

//------------------------------
//			select_package
//------------------------------

function select_package(id)
{
	$("a[id*='package_']").attr("class", "prd");
	var price = $("#package_price_"+id).html();
	$("#atc_price").html(price);
	$("#atc_package_id").html(id);
	$("#package_"+id).attr("class", "selected");
}

//------------------------------
//				need_login
//------------------------------

function need_login()
{
	$("#icon_need_login").fadeIn(300).delay(2000).fadeOut(1000);
}

//------------------------------
//			mapInitialize
//------------------------------

var objMap, objGeoCoder

function mapInitialize(div) {
	if (GBrowserIsCompatible()) {
		objMap = new GMap2($("#"+div)[0]);
		objMap.enableContinuousZoom();
		objGeoCoder = new GClientGeocoder();
		objMap.enableContinuousZoom();
		objMap.enableScrollWheelZoom();
		objMap.addControl(new GLargeMapControl3D());
		objMap.addControl(new GScaleControl());
		objMap.addControl(new GHierarchicalMapTypeControl());
		objMap.setCenter(new GLatLng(49.475263, 17.050781), 6, G_NORMAL_MAP);
	}
}

//------------------------------
//				mapAddDealer
//------------------------------

function mapAddDealer(strAddress, strDescription) {
	if (GBrowserIsCompatible()) objGeoCoder.getLatLng(strAddress, function(objPoint) {
		if (objPoint) {
			var objMarker = new GMarker(objPoint);
			objMap.addOverlay(objMarker);
			GEvent.addListener(objMarker, "click", function() {objMarker.openInfoWindowTabsHtml(strDescription)});
		}
	});
}

//------------------------------
//				mapAddPoint
//------------------------------

function mapAddPoint(coords, strDescription) {
	if (GBrowserIsCompatible())
	{
		var coords_new = coords.split(",");
		var x = $.trim(coords_new[0]);
		var y = $.trim(coords_new[1]);
		// var point = new GLatLng(coords);
		var point = new GLatLng(x, y);
		var objMarker = new GMarker(point);
		objMap.addOverlay(objMarker);
		GEvent.addListener(objMarker, "click", function() {objMarker.openInfoWindowTabsHtml(strDescription)});
	}
}


//--------------------------------
//	schovanie lightboxu
//--------------------------------

function hide_ad()
{
	$("#ad").hide();
	hideLightbox();
}
