jQuery(document).ready(function(){
	LoadDataURL("module_name=polls&op=question");
})

function ShowDialog() {
	if (jQuery(".dialogWindow").length) {
		jQuery(".dialogWindow").css({
			"top" : jQuery(window).scrollTop()+ (jQuery(window).height() - jQuery(".dialogWindow").outerHeight())/2,
			"left" : (jQuery(window).width() - jQuery(".dialogWindow").outerWidth())/2
		})
	}
	jQuery("div#windows-dialog").fadeIn(500);
}

function LoadDataURL(url) {
	jQuery.ajax({
		url: '/index.php',
		type: 'POST',
		data: url.replace(/\&amp;/g,'&'),
		dataType : 'json',
		beforeSend: function() {
			return php.beforeSend();
		},
		success: function(data, textStatus) {
			return php.success(data, textStatus);
		},
		error: function (xmlEr, typeEr, except) {
			return php.error(xmlEr, typeEr, except);
		},
		complete: function (XMLHttpRequest, textStatus) {
			return php.complete(XMLHttpRequest, textStatus);
		}
	});
	return false;
}

function LoadForm(form) {
	jQuery.ajax({
		url: '/index.php',
		type: "POST",
		data: jQuery('#'+form).formToArray(true),
		enctype: "multipart/form-data",
		dataType : "json",
		beforeSend: function() {
			return php.beforeSend();
		},
		success: function(data, textStatus) {
			return php.success(data, textStatus);
		},
		error: function (xmlEr, typeEr, except) {
			return;
		},
		complete: function (XMLHttpRequest, textStatus) {
			return php.complete(XMLHttpRequest, textStatus);
		}
	});
	return false;
}
