
var searchTitle = 'szukaj...';
var domainURL = 'http://' + document.domain + '/';
var imgDomainURL = '';
var ICON_WAIT = 'http://' + document.domain + '/static/im/wait.gif';
var ICON_IMG = '<img src="'+ICON_WAIT+'" alt="Proszę czekać"/>';

function printPage()
{
	window.print();
}

function goto(url)
{
	if (url.length > 3)
		document.location.href='http://'+url;
}

function url(u,a)
{
	u = u.substring(0,7) == 'http://'?u:('http://'+u);
	a = a.length == 0?u:a;
	document.write('<a href="'+u+'" target="_blank">'+a+'</a>');
}

/*$(document).ready(function(){

	$(function() {
	    $('.ourOffer').jCarouselLite({
	    	speed: 800,
	    	auto: 5000,
	    	visible: 1,
	    	scroll: 1
	    	});
	        
		});
	});

}
*/

function closeMessageBoxInfo(){$('#message_box_info').hide('slow');}
function closeMessageBox(){$('#message_box').hide('slow');}

function wtxt(t){document.write(t);}

function valVisitForm(u)
{
	var isValid = true;
	$('#err_name').text('');
	$('#err_phone').text('');
	$('#err_email').text('');
	$('#ff').val('fov');
	
	if ($('#name').val().length <= 3)
	{
		$('#err_name').text('Podaj imię, minimum 3 znaki');
		isValid = false;
	}
		
	if ($('#phone').val().length <= 5)
	{
		$('#err_phone').text('Podaj telefon kontaktowy, minimum 5 znaków');
		isValid = false;
	}
	
	var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
	if($('#email').val().length <=5 || !emailReg.test($('#email').val()))
	{
		$('#err_email').text('Niepoprawny adres E-mail');
		isValid = false;
	}

	if (isValid == true)
	{
		$('#ff').val('fov');
		$('#ordervisitform').attr('action',u);
	}
	return isValid;
}


function valComment()
{
	var isValid=true;
	$('#err_comment').html('');
	if($('#comment').val().length < 3)
	{
		$('#err_comment').html('Treść pytania/komentarza musi zawierać co najmniej 3 znaki');
		isValid=false;
	}

	var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
	if($('#email').val().length >=5 && !emailReg.test($('#email').val()))
	{
		$('#err_email').text('Niepoprawny adres E-mail');
		isValid = false;
	}
	
	$('#fac').val('fac');
	return isValid;
}

function dComment(id,tid)
{
	if(!confirm('Czy na pewno?'))return;
	$('#moderator_'+id).html(ICON_IMG);
	$.ajax({type:'POST',url:APP_URL+'opinions/dlt/pid/'+id,data:{tn:tn,tid:tid,id:id},
	success:function(txt)
	{
		alert(txt);
		if (txt == '1')
			$('#moderator_'+id).html('Usunięto');
		else
			$('#moderator_'+id).html('Błąd');
	}});
}

function faqVote(tid,vote){$('#fuv').val('fuv');$('#vote').val(vote);$('#tid').val(tid);}

function mark(o){o.focus();o.select();}
