function swapImage(selector, obj, imgType) {
	if (selector == "on") {
		$('#'+obj).attr("src", 'images/'+obj+'_on.'+imgType);
	} else {
		$('#'+obj).attr("src", 'images/'+obj+'.'+imgType);
	}
}

function popUp(strURL, strType, strTop, strLeft, strWidth, strHeight) {
	var strOptions = "";
	if (strType == "console") strOptions = "resizable,top="+strTop+",left="+strLeft+",height="+strHeight+",width="+strWidth;
	if (strType == "fixed") strOptions = "scrollbars,status,top="+strTop+",left="+strLeft+",height="+strHeight+",width="+strWidth;
	if (strType == "elastic") strOptions = "toolbar,menubar,scrollbars,resizable,location,top="+strTop+",left="+strLeft+",height="+strHeight+",width="+strWidth;
	window.open(strURL, 'newWin', strOptions);
}

function contactUs() {
	if ($('#name').val() != '' && $('#email').val() != '' && $('#message').val() != '') {
		$('#contact_thx').html('<span style="color:#00f;">Wysyłam...</span>');
		var params = {
			act: 'contact',
			name: $('#name').val(),
			email: $('#email').val(),
			message: $('#message').val()
		};
		
		$.ajax({
			type: "POST",
			url: "ajax.php",
			data: params,
			success: function(msg) {
				resp = msg.getElementsByTagName("data")[0].firstChild.data;
				if (resp == 1) {
					$('#contact_thx').html('<span style="color:#0d0;">Dziękujemy. Wiadomość została wysłana.</span>');
					$('#name').val(''); 
					$('#email').val(''); 
					$('#message').val('');
				} else if (resp == 2) {
					$('#contact_thx').html('<span style="color:#f00;">Nieprawidłowy adres email!</span>');
				}
			}
		});
	} else {
		$('#contact_thx').html('<span style="color:#f00;">Proszę wypełnić wszystkie pola!</span>');
	}
}
