$(document).ready(function(){
	
	//górne pole logowania
	 
	$("#login_top .input").blur(function(){
		if ($("#login_top .email").val() == '' ) $(this).val(' email ');
		if ($("#login_top .pass").val() == '' ) $(this).val(' hasło ');
	})
	$("#login_top .input").focus(function(){
		if ($("#login_top .email").val() == ' email ' ) $(this).val('');
		if ($("#login_top .pass").val() == ' hasło ' ) $(this).val('');
	})	
	$("#login_top .submit").click(function(){
		$("#login_top").submit();
		return false;
	})
	
	//sortowanie tabel 
	$("table.tablesorter").not(".nosort").tablesorter({widgets: ['zebra']}); //włącza obsługę sortowania tabeli
	// ładowanie danych ajaxem
	
	$('#loading').ajaxStart(function() {
		$(this).show();
		$('#domain_results').hide();
		}).ajaxStop(function() {
		$(this).hide();
		$('#domain_results').fadeIn('slow');
	});
	
	// Marquee //
	$(function () {
        // basic version is: $('div.demo marquee').marquee() - but we're doing some sexy extras
        
        $('#marquee marquee').marquee('pointer').mouseover(function () {
            $(this).trigger('stop');
        }).mouseout(function () {
            $(this).trigger('start');
        }).mousemove(function (event) {
            if ($(this).data('drag') == true) {
                this.scrollLeft = $(this).data('scrollX') + ($(this).data('x') - event.clientX);
            }
        }).mousedown(function (event) {
            $(this).data('drag', true).data('x', event.clientX).data('scrollX', this.scrollLeft);
        }).mouseup(function () {
            $(this).data('drag', false);
        });
    });
	// End of Marquee //
})




function validateDomain (strValue, strMatchPattern) {
	var objRegExp = new RegExp(strMatchPattern);
	
	var name = strValue.toLowerCase().replace(/^\s+|\s+$/g, '');
	
	
		//if(name && name !== 0 && name !== '0')
		//return false;
		if (!objRegExp.test(name))
			return false;
		return true;
}

function dialogMessage(prompt, title, action){
		$("#dialog-message").dialog("destroy");
	    if (title === undefined) title = "Informacja";
		$("#dialog-message").empty().attr('title',title).append('<span class="ui-icon ui-icon-'+action+'" style="float:left; margin:0 7px 20px 0;"></span><p>' + prompt + '</p>');
	    
		$("#dialog-message").dialog({
			modal: true,
			option: {
				dialogClass: alert
			},
			buttons: {
				Ok: function() {
					$(this).dialog('close');
				}
			}
		})
}


