function loading(txt){
	notif = new Boxy('<div id="load"><img src="'+urlSite+'component/images/loading.gif"><br />'+txt+'</div>', {
                modal: true,unloadOnHide:true
              });
	notif.show();
}


function showPopUp(txtTitle,content){
	notif = new Boxy(content, {
                title:txtTitle,modal: true,unloadOnHide:true,closeText:'<img src="'+urlSite+'component/images/close.png" />',
              });
	notif.show();
}

function hidePopUp(){
	notif.hide();
}
function login(action){
	$("#loading_login").html('Loading...');
	referrer = $("#login_referrer").val();
	$.post(action,{
			 username : $("#login_userName").val(),
			 password : $("#login_password").val(),
			 post : true
	 }, function(html) {
		   setLogin(html,referrer);
	});
}

function setLogin(html,referrer) {		
	 if (html == 1){
	 	 location.href=referrer;
	 }else{ 	
	 	$("#loading_login").html('Login failed');
	 }
}

function tellFriend(action){
	$("#loading_tellfriend").html('Loading...');
	$.post(action,{
			 email : $("#tellfriend_email").val(),
			 post : true
	 }, function(html) {
		   setTellFriend(html);
	});
}

function setTellFriend(html) {		
	$("#loading_tellfriend").html(html);
}

function newsletter(action){
	$("#loading_newsletter").html('Loading...');
	$.post(action,{
			 email : $("#newsletter_email").val(),
			 post : true
	 }, function(html) {
		   setNewsletter(html);
	});
}

function setNewsletter(html) {		
	$("#loading_newsletter").html(html);
}


function getForgotPassword(){
	Boxy.load(urlSite, {cache:false});
}

function getContent(url){
	$('#loading_content').html("<div id='wrap_content' style='text-align:center'><img src='"+urlSite+"component/images/loading.gif'></div>");
	$.get(url,{ }, function(html) {
		   setContent(html);
	});
}

function setContent(dataHtml){
	$('#show_content').html(dataHtml);
	$('#loading_content').html("");
}

function getPost(url){
	loading('Please wait...');	
	$.get(url,{ }, function(html) {
		   setPost(html);
	});
}

function setPost(dataHtml){
	$('#linebar').html(dataHtml);
	notif.hide();
}


function ajaxBox(txtTitle,url){
	loading('Please wait...');
	$.get(url,{ }, function(html) {
		   setAjaxBox(txtTitle,html);
	});
}

function setAjaxBox(txtTitle,html){
	notif.hide();
	//$('#loading_content').html("");
	showPopUp('<img src="'+urlSite+'component/images/MPLlogo.jpg">',html);
}
