function openPopup(title, myurl, mydata, label)
{
	$.ajax({
		method: "get", url: myurl, data: mydata,
		beforeSend: function() {
			$("#fullscreen").show(500);
			$("#popup_container").show(500);
			$("#popup_title").html(title);
			$("#popup_content").html("<img src='images/busy.gif' /> Incarcare date..."); 
		}, 
		complete: function() {}, 
		success: function(html) {
			$("#popup_title").html(title);
			$("#popup_content").html(html);
			$("#close_popup").html("<a href='#inchide' onclick='closePopup(\"" + label + "\"); return false;' class='button2'>Inchide</a>");
			
			$("div.prettyRadiobuttons").addClass("radiolist");
			$("div.radiolist p").append('<a class="radio-select" href="#">Select</a>');
		}
	});
}


function closePopup(label)
{
	$("#fullscreen").hide(500);
	$("#popup_container").hide(500);
	
	if (label)
		location.hash = label;
}


function openUp(x, y, adress, name) 
{	
	var newOpenUp = window.open(adress, name, 'width=' + x + ', height=' + y + 'resizable=no, scrollbars=yes, menubar=no, location=no, status=no, screenX=1, screenY=1');
	newOpenUp.focus();
}


function doFormFocus(obj) {
	if (obj.value == obj.defaultValue) obj.value = '';
}


function doFormBlur(obj) {
	if (obj.value == '') obj.value = obj.defaultValue;
}


function validateSearchFieldsPage(form)
{
	if (form.search.value.length < 3) {
		alert('Va rugam sa introduceti o expresie mai lunga de 3 carcactere');
		return false;
	}
	
	if (form.search.value == form.search.defaultValue) {
		alert('Va rugam sa introduceti termenii de cautat');
		return false;
	}
	
	return true;
}


function getURL(mode, page, params)
{
	if (page == "")
		return host + (!mode ? 'index.php' : '') + (params && params != '' ? (params.substr(0, 1) != '#' ? '&' : '') + params : '');
	
	return host + (!mode ? 'index.php?page=' : '') + (mode ? '' : '') + page + (mode ? '.html' : '') + (params && params != '' ? (params.substr(0, 1) != '#' ? '&' : '') + params : '');
}

