var fieldValues = new Array();
$(document).ready(function () {
	$('a.lightbox').lightbox();
	
	$('#login, #haslo, #polecEmail, #polecImie').focus(function() {clearFieldText($(this)); });
	$('#login, #haslo, #polecEmail, #polecImie').blur(function() {setFieldText($(this));});

});

var fieldValues = new Array();

function clearFieldText(obj)
{
    if(!fieldValues[$(obj).attr('name')])
    {
        fieldValues[$(obj).attr('name')] = $(obj).val();
        $(obj).val('');
    }
}

function setFieldText(obj)
{
    if($(obj).val().length == 0)
    {
    	$(obj).val(fieldValues[$(obj).attr('name')]);
        delete fieldValues[$(obj).attr('name')];
    }
} 

function validate(msg)
{
	return confirm(msg);
}

function jumpToPkat(obj)
{
	//alert(obj.options[obj.selectedIndex].value);
	document.location='#pk'+obj.options[obj.selectedIndex].value;
	obj.selectedIndex = 0;
}

function showLoader(type)
{
	if(type==0)
		$('#loader').hide();
	else
	{
	 	var top = $(window).scrollTop() + ($(window).height() / 50)+50;
		$('#loader').css('top', top);
		$('#loader').show();
	}
		
}

function setSelectValue(selectId, value)
{
	el = document.getElementById(selectId);
	
	for(i=0; i<el.length; i++)
	{
		if(el.options[i].value == value)
		{
			el.selectedIndex = i;
			break;
		}
	}
	setCity2(el);
}

function changePlateIcon()
{
	if($('#c_zamowienie .total2 strong').length > 0)
		$('#plateIcon').attr('src', '/gfx/small_plate_2.gif');
	else
		$('#plateIcon').attr('src', '/gfx/small_plate.gif');
}

